StoreSpecials1.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  1. <template>
  2. <div class="page-wrap">
  3. <div class="crumbs">
  4. <el-breadcrumb separator="/">
  5. <i class="el-icon-eleme"></i> 特价菜列表
  6. </el-breadcrumb>
  7. </div>
  8. <div class="background">
  9. <div class="topbox">
  10. <div class="topbox-left">
  11. <span class="page-title">特价菜活动管理</span>
  12. </div>
  13. <div class="topbox-right">
  14. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="add">新增活动</el-button>
  15. </div>
  16. </div>
  17. <div class="searchbox">
  18. <span>活动名称</span>
  19. <el-input v-model="activityName" placeholder="请输入活动名称" size="small" style="width:200px" clearable @clear="getDataList" @keyup.enter.native="getDataList"></el-input>
  20. <el-button type="primary" icon="el-icon-search" size="small" @click="getDataList">查询</el-button>
  21. </div>
  22. <div class="tablebox">
  23. <dptable ref="mainTable" :columns="columns" :dataSource="tableData" :options="options" :fetch="getDataList"/>
  24. </div>
  25. </div>
  26. <el-dialog :title="editTitle" :class="isMobile ? 'el-dialog' : ''" :fullscreen="isMobile" :visible.sync="dialogVisible" :before-close="closeDia">
  27. <div class="container" >
  28. <div class="form-box" style="width: 100%">
  29. <el-form ref="form" :model="form" >
  30. <el-form-item label="活动名称" required>
  31. <el-input v-model="form.activityName" placeholder="活动名称20字以内" style="width: 220px;"></el-input>
  32. </el-form-item>
  33. <el-form-item label="活动描述" required>
  34. <el-input v-model="form.activityComment" placeholder="活动描述20字以内" style="width: 220px;"></el-input>
  35. </el-form-item>
  36. <el-form-item label="活动日期" required>
  37. <el-date-picker
  38. v-model="value1"
  39. type="daterange"
  40. range-separator="至"
  41. start-placeholder="开始日期"
  42. end-placeholder="结束日期"
  43. style="width: 220px">
  44. </el-date-picker>
  45. </el-form-item>
  46. <div class="crumbs" >
  47. <el-button class="added" type="primary" @click="added">选择商品</el-button>
  48. </div>
  49. <el-form-item label="活动商品" required>
  50. <dptable :columns="columns1" :dataSource="tableData1" :fetch="getDataList" :options="options1"/>
  51. </el-form-item>
  52. <el-form-item>
  53. <el-button type="primary" @click="save">保存</el-button>
  54. <el-button @click="closeDia">关闭</el-button>
  55. </el-form-item>
  56. </el-form>
  57. </div>
  58. </div>
  59. </el-dialog>
  60. <el-dialog :title="editTitle" :class="isMobile ? 'el-dialog' : ''" :fullscreen="isMobile" :visible.sync="getflg" :before-close="closeGetDia">
  61. <div class="container" >
  62. <div class="form-box" style="width: 100%">
  63. <el-form ref="form" :model="form" >
  64. <el-form-item label="活动名称">
  65. <el-input disabled v-model="form.activityName" placeholder="活动名称20字以内" style="width: 220px;"></el-input>
  66. </el-form-item>
  67. <el-form-item label="活动描述">
  68. <el-input disabled v-model="form.activityComment" placeholder="活动描述20字以内" style="width: 220px;"></el-input>
  69. </el-form-item>
  70. <el-form-item label="活动日期">
  71. <el-date-picker
  72. disabled
  73. v-model="value1"
  74. type="daterange"
  75. range-separator="至"
  76. start-placeholder="开始日期"
  77. end-placeholder="结束日期"
  78. style="width: 220px">
  79. </el-date-picker>
  80. </el-form-item>
  81. <el-form-item label="活动商品">
  82. <dptable :columns="columns3" :dataSource="tableData1" :fetch="getDataList" :options="options1"/>
  83. </el-form-item>
  84. <el-form-item>
  85. <el-button @click="closeGetDia">关闭</el-button>
  86. </el-form-item>
  87. </el-form>
  88. </div>
  89. </div>
  90. </el-dialog>
  91. <!-- 商品检索弹窗 -->
  92. <el-dialog title="商品检索" :class="isMobile ? 'el-dialog' : ''" :fullscreen="isMobile" :visible.sync="dialogTableVisible1" :before-close="closeDia11">
  93. <div class="container" >
  94. <div class="handle-box-top" style="margin-top:-10px;height:20px;">
  95. <div style="padding-bottom:5px;">
  96. <span style="margin-left:5px">商品名称:</span>
  97. <el-input v-model="goodsName" placeholder="商品名称" class="handle-input mr10" style="width:150px"></el-input>
  98. <el-button style="margin-left:20px;" type="primary" icon="search" @click="getGoodsList">搜索</el-button>
  99. </div>
  100. </div>
  101. </div>
  102. <div class="container" style="margin-top:10px">
  103. <dptable style="margin-top:-10px;" :columns="columns2" :dataSource="goodsList" :options="options2"/>
  104. </div>
  105. </el-dialog>
  106. <div class="img-preview" v-if="previewVisible" @click="previewVisible = false">
  107. <img :src="previewImage" @click.stop />
  108. </div>
  109. </div>
  110. </template>
  111. <script>
  112. import dptable from "../../../common/Dptable";
  113. const querystring = require("querystring");
  114. export default {
  115. components: {
  116. dptable
  117. },
  118. data() {
  119. return {
  120. // 访问数据的地址
  121. url: '/storeSpecialsThirdApi/getStoreSpecialActivityListForThird',
  122. updateSpecialsUrl: '/storeSpecialsThirdApi/saveStoreSpecialActivityForThird',
  123. getByIdUrl: '/storeSpecialsThirdApi/getStoreSpecialActivityByIdForThird',
  124. goodsUrl: '/storeSpecialsThirdApi/getStoreSingleGoodsForSpecialForThird',
  125. changeStatusUrl: '/storeSpecialsThirdApi/updateStoreSpecialActivityStatusForThird',
  126. delurl: '/storeSpecialsThirdApi/deleteStoreSpecialActivityForThird',
  127. activityName: "",
  128. columns: [
  129. {
  130. prop: "activityName",
  131. label: "活动名称",
  132. },
  133. {
  134. prop: "activityComment",
  135. label: "活动描述",
  136. },
  137. {
  138. prop: "startDate",
  139. label: "开始时间",
  140. },
  141. {
  142. prop: "endDate",
  143. label: "结束时间",
  144. },
  145. {
  146. prop: "status",
  147. label: "状态",
  148. width: 100,
  149. render: (row, column, index) => {
  150. if (row.status == 1) {
  151. return (
  152. <span style="color: green">进行中</span>
  153. )
  154. } else {
  155. return (
  156. <span style="color: red" >停止</span>
  157. )
  158. }
  159. }
  160. },
  161. {
  162. prop: "status",
  163. label: "更改状态",
  164. width: 100,
  165. render: (row, column, index) => {
  166. if (row.status == 1) {
  167. return (
  168. <button class="el-button el-button--mini is-plain"
  169. onClick={e => this.changeStatus(e, row)}>
  170. 停止
  171. </button>
  172. );
  173. } else {
  174. return (
  175. <button class="el-button el-button--danger el-button--mini is-plain"
  176. onClick={e => this.changeStatus(e, row)}>
  177. 进行
  178. </button>
  179. );
  180. }
  181. }
  182. },
  183. {
  184. button: true,
  185. label: "操作",
  186. fixed: 'right',
  187. group: [
  188. {
  189. name: "查看",
  190. type: "primary",
  191. icon: "el-icon-info",
  192. plain: true,
  193. onClick: (row, index) => {
  194. this.getRow(row);
  195. }
  196. },
  197. {
  198. name: "编辑",
  199. type: "warning",
  200. icon: "el-icon-edit",
  201. plain: true,
  202. onClick: (row, index) => {
  203. this.enditRow(row);
  204. }
  205. },
  206. {
  207. name: '删除',
  208. type: 'danger',
  209. icon: 'el-icon-delete',
  210. plain: true,
  211. onClick: row => {
  212. this.deleteRow(row.storeSpecialActivityId);
  213. }
  214. },
  215. ]
  216. }
  217. ],
  218. value1: [],
  219. tableData: [],
  220. options: {
  221. mutiSelect: false, // 是否有前部的多选框
  222. index: false, // 显示序号, 多选则 mutiSelect
  223. initTable: true, // 是否一挂载就加载数据
  224. height: "600"
  225. },
  226. dialogVisible: false,
  227. getflg: false,
  228. editTitle: '',
  229. form: {
  230. activityName: '',
  231. activityComment: '',
  232. status: 1,
  233. },
  234. goodsList: [],
  235. store: {},
  236. columns1: [
  237. {
  238. prop: 'pictureUrl',
  239. label: '商品图片',
  240. width: 120,
  241. fixed: true,
  242. render: (row, column, index) => {
  243. if (row.pictureUrl != null && row.pictureUrl != '' && row.pictureUrl != undefined) {
  244. return (<img onClick={e => this.viewpictrue(row.pictureUrl)} style="height:80px;width:80px;" src={row.pictureUrl} />)
  245. }
  246. }
  247. },
  248. {
  249. prop: "goodsName",
  250. label: "菜品名称",
  251. width: 160
  252. },
  253. {
  254. prop: "costPrice",
  255. label: "原价",
  256. width: 80
  257. },
  258. {
  259. text: true,
  260. prop: "activityPrice",
  261. label: "活动价",
  262. width: 80,
  263. },
  264. {
  265. text: true,
  266. prop: "maxNum",
  267. label: "每单限购",
  268. width: 80,
  269. },
  270. {
  271. text: true,
  272. prop: "activityNum",
  273. label: "活动库存",
  274. width: 80,
  275. },
  276. {
  277. prop: "inventory",
  278. label: "剩余库存",
  279. width: 80
  280. },
  281. {
  282. button: true,
  283. label: "操作",
  284. group: [
  285. {
  286. name: '删除',
  287. type: 'danger',
  288. icon: 'el-icon-delete',
  289. plain: true,
  290. onClick: (row, index) => {
  291. this.onDeleteItem(
  292. index
  293. );
  294. }
  295. }
  296. ]
  297. }
  298. ],
  299. columns3: [
  300. {
  301. prop: 'pictureUrl',
  302. label: '商品图片',
  303. width: 120,
  304. fixed: true,
  305. render: (row, column, index) => {
  306. if (row.pictureUrl != null && row.pictureUrl != '' && row.pictureUrl != undefined) {
  307. return (<img onClick={e => this.viewpictrue(row.pictureUrl)} style="height:80px;width:80px;" src={row.pictureUrl} />)
  308. }
  309. }
  310. },
  311. {
  312. prop: "goodsName",
  313. label: "菜品名称",
  314. width: 160
  315. },
  316. {
  317. prop: "costPrice",
  318. label: "原价",
  319. width: 80
  320. },
  321. {
  322. prop: "activityPrice",
  323. label: "活动价",
  324. width: 100,
  325. },
  326. {
  327. prop: "maxNum",
  328. label: "每单限购",
  329. width: 100,
  330. },
  331. {
  332. prop: "activityNum",
  333. label: "活动库存",
  334. width: 100,
  335. },
  336. {
  337. prop: "inventory",
  338. label: "剩余库存",
  339. width: 80
  340. },
  341. ],
  342. tableData1: [],
  343. options1: {
  344. mutiSelect: false,// 是否有前部的多选框
  345. index: false, // 显示序号, 多选则 mutiSelect
  346. initTable: false, // 是否一挂载就加载数据
  347. border: true
  348. },
  349. columns2: [
  350. {
  351. prop: 'goodsName', label: '商品名称', width: 400,
  352. },
  353. {
  354. prop: 'pictureUrl',
  355. label: '商品图片',
  356. width: 120,
  357. fixed: true,
  358. render: (row, column, index) => {
  359. if (row.pictureUrl != null && row.pictureUrl != '' && row.pictureUrl != undefined) {
  360. return (<img onClick={e => this.viewpictrue(row.pictureUrl)} style="height:80px;width:80px;" src={row.pictureUrl} />)
  361. }
  362. }
  363. },
  364. {
  365. button: true,
  366. label: '操作',
  367. width: 100,
  368. group: [
  369. {
  370. name: '选择',
  371. type: 'warning',
  372. icon: 'el-icon-edit',
  373. plain: true,
  374. onClick: (row, index) => {
  375. this.selectRow(row);
  376. }
  377. },
  378. ]
  379. }
  380. ],
  381. options2: {
  382. mutiSelect: false,// 是否有前部的多选框
  383. index: false, // 显示序号, 多选则 mutiSelect
  384. initTable: false, // 是否一挂载就加载数据
  385. border: true,
  386. height: '500'
  387. },
  388. dialogTableVisible1: false,
  389. goodsName: '',
  390. isMobile: false,
  391. editingRowId: null,
  392. previewImage: '',
  393. previewVisible: false
  394. };
  395. },
  396. created () {
  397. if (this.$isMobile()){
  398. // 移动端
  399. this.isMobile = true
  400. } else {
  401. // PC端
  402. this.isMobile = false
  403. }
  404. this.store = JSON.parse(localStorage.getItem("storeInfo"));
  405. },
  406. methods: {
  407. // 选择后关闭弹窗
  408. selectRow(row) {
  409. row.costPrice = this.moneyConverter(row.costPrice)
  410. row.activityPrice = this.moneyConverter(row.activityPrice)
  411. row.maxNum = ''
  412. this.tableData1.push(row)
  413. this.dialogTableVisible1 = false
  414. this.goodsList = []
  415. this.goodsName = ''
  416. },
  417. closeDia11 () {
  418. this.dialogTableVisible1 = false
  419. this.goodsList = []
  420. this.goodsName = ''
  421. },
  422. onDeleteItem(index) {
  423. this.tableData1.splice(index, 1);
  424. },
  425. added() {
  426. this.getGoodsList()
  427. this.dialogTableVisible1 = true
  428. },
  429. getGoodsList() {
  430. const ids = this.tableData1.map(item => item.goodsId);
  431. const idsStr = ids.join(',');
  432. this.$axios.post(this.goodsUrl,querystring.stringify({
  433. storeId: this.store.storeId,
  434. goodsName: this.goodsName,
  435. ids: idsStr
  436. })).then(res => {
  437. this.goodsList = res.data.list;
  438. }).catch(error => {
  439. console.log(error);
  440. });
  441. },
  442. getDataList() {
  443. this.options.loading = true;
  444. this.$axios.post(this.url,querystring.stringify({
  445. activityName: this.activityName,
  446. storeId: this.store.storeId
  447. })).then(res => {
  448. this.tableData = res.data.list;
  449. this.options.loading = false;
  450. }).catch(error => {
  451. console.log(error);
  452. this.options.loading = false;
  453. });
  454. },
  455. //添加品牌
  456. add() {
  457. this.editTitle = "新增特价菜活动";
  458. this.dialogVisible = true;
  459. },
  460. getRow (row) {
  461. this.highlightRow(row);
  462. this.getActivityById(row.storeSpecialActivityId);
  463. this.editTitle = "查看特价菜活动";
  464. this.value1.push(row.startDate)
  465. this.value1.push(row.endDate)
  466. this.form = {
  467. storeSpecialActivityId: row.storeSpecialActivityId,
  468. storeId: row.storeId,
  469. activityName: row.activityName,
  470. activityComment: row.activityComment,
  471. sort: row.sort,
  472. minBuyNum: row.minBuyNum,
  473. status: row.status,
  474. }
  475. this.dialogVisible = false;
  476. this.getflg = true;
  477. },
  478. // 编辑行
  479. enditRow(row) {
  480. if (row.status === 1) {
  481. this.$message.error("进行中的活动不可以修改,请先修改活动状态");
  482. return;
  483. }
  484. this.getActivityById(row.storeSpecialActivityId);
  485. this.editTitle = "编辑特价菜活动";
  486. this.value1.push(row.startDate)
  487. this.value1.push(row.endDate)
  488. this.form = {
  489. storeSpecialActivityId: row.storeSpecialActivityId,
  490. storeId: row.storeId,
  491. activityName: row.activityName,
  492. activityComment: row.activityComment,
  493. sort: row.sort,
  494. minBuyNum: row.minBuyNum,
  495. status: row.status,
  496. }
  497. this.dialogVisible = true;
  498. this.highlightRow(row);
  499. },
  500. getActivityById(id) {
  501. this.options.loading = true;
  502. this.$axios.post(this.getByIdUrl,querystring.stringify({
  503. id: id,
  504. storeId: this.store.storeId
  505. })).then(res => {
  506. this.form = res.data.obj;
  507. this.tableData1 = res.data.list;
  508. for (let i = 0; i < this.tableData1.length; i++) {
  509. this.tableData1[i].costPrice = this.moneyConverter(this.tableData1[i].costPrice)
  510. this.tableData1[i].activityPrice = this.moneyConverter(this.tableData1[i].activityPrice)
  511. }
  512. this.options.loading = false;
  513. }).catch(error => {
  514. console.log(error);
  515. this.options.loading = false;
  516. });
  517. },
  518. // 删除活动
  519. deleteRow(key) {
  520. this.$confirm('确定要删除该特价菜活动吗?', '提示', {
  521. confirmButtonText: '确定',
  522. cancelButtonText: '取消',
  523. type: 'warning'
  524. }).then(() => {
  525. this.$axios.post(this.delurl, querystring.stringify({
  526. id: key,
  527. storeId: this.store.storeId
  528. })).then(res => {
  529. if (res.data.rtnBean.rtnCode == 0) {
  530. this.$message.success("删除成功!");
  531. } else {
  532. this.$message.error(res.data.rtnBean.rtnMsg);
  533. }
  534. this.clearHighlight();
  535. this.getDataList();
  536. }).catch((error) => {
  537. this.$message.error("数据处理异常,请与管理员联系!");
  538. })
  539. }).catch(() => {
  540. this.$message.info('已取消删除');
  541. });
  542. },
  543. save() {
  544. let regPrice = (/^[0-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/);
  545. if (!this.form.activityName) {
  546. this.$message.error("请输入活动名称");
  547. return;
  548. }
  549. if (this.form.activityName.length > 20) {
  550. this.$message.error("活动名称不能超过20字");
  551. return;
  552. }
  553. if (!this.form.activityComment) {
  554. this.$message.error("请输入活动描述");
  555. return;
  556. }
  557. if (this.form.activityComment.length > 30) {
  558. this.$message.error("活动描述不能超过30个字符");
  559. return;
  560. }
  561. if (!this.value1 || this.value1.length === 0){
  562. this.$message.error("请选择活动时间范围");
  563. return;
  564. }
  565. let start = ''
  566. let end = ''
  567. if (this.value1 && this.value1.length !== 0){
  568. start = this.value1[0] ? this.$moment(this.value1[0]).format("YYYY-MM-DD") : '';
  569. end = this.value1[1] ? this.$moment(this.value1[1]).format("YYYY-MM-DD") : '';
  570. }
  571. for (let i = 0; i < this.tableData1.length; i++) {
  572. if (!this.tableData1[i].goodsId) {
  573. this.$message.error("请选择商品");
  574. return;
  575. }
  576. if (!this.tableData1[i].activityPrice) {
  577. this.$message.error("请输入活动价格");
  578. return;
  579. }
  580. if (!regPrice.test(this.tableData1[i].activityPrice)) {
  581. this.$message.error("活动价格只能是整数或小数点后两位");
  582. return;
  583. }
  584. if (this.tableData1[i].activityPrice >= this.tableData1[i].costPrice) {
  585. this.$message.error("活动价必须小于原价");
  586. return;
  587. }
  588. if (!this.tableData1[i].maxNum) {
  589. this.$message.error("请输入每单限购");
  590. return;
  591. }
  592. if (Number(this.tableData1[i].maxNum) <= 0) {
  593. this.$message.error("每单限购要大于0");
  594. return;
  595. }
  596. if (!this.tableData1[i].activityNum) {
  597. this.$message.error("请输入活动库存");
  598. return;
  599. }
  600. if (Number(this.tableData1[i].activityNum) <= 0) {
  601. this.$message.error("活动库存要大于0");
  602. return;
  603. }
  604. if (Number(this.tableData1[i].maxNum) > Number(this.tableData1[i].activityNum)) {
  605. this.$message.error("每单限购不能大于活动库存");
  606. return;
  607. }
  608. if (Number(this.tableData1[i].activityNum) > Number(9999)) {
  609. this.$message.error("活动库存不能超过9999");
  610. return;
  611. }
  612. }
  613. this.$axios.post(this.updateSpecialsUrl, querystring.stringify({
  614. storeId: this.store.storeId,
  615. storeSpecialActivityId: this.form.storeSpecialActivityId,
  616. activityName: this.form.activityName,
  617. activityComment: this.form.activityComment,
  618. startDate: start,
  619. endDate: end,
  620. goodsListStr: JSON.stringify(this.tableData1)
  621. })).then(res => {
  622. if (res.data.rtnBean.rtnCode == 0) {
  623. this.$message.success(res.data.rtnBean.rtnMsg);
  624. this.dialogVisible = false;
  625. this.getDataList()
  626. this.initForm()
  627. } else {
  628. this.$message.error(res.data.rtnBean.rtnMsg);
  629. }
  630. }).catch((error) => {
  631. this.$message.error('更新失败了!')
  632. })
  633. },
  634. changeStatus(e, row) {
  635. this.highlightRow(row);
  636. this.options.loading = true;
  637. let status = row.status === 1 ? 0 : 1;
  638. this.$axios.post(this.changeStatusUrl, querystring.stringify({
  639. id: row.storeSpecialActivityId,
  640. storeId: this.store.storeId,
  641. status: status
  642. })
  643. ).then(res => {
  644. if (res.data.rtnBean.rtnCode == 0) {
  645. this.$message.success(res.data.rtnBean.rtnMsg);
  646. } else {
  647. this.$message.error(res.data.rtnBean.rtnMsg);
  648. }
  649. this.options.loading = false;
  650. this.clearHighlight();
  651. this.getDataList();
  652. }).catch(error => {
  653. console.log(error);
  654. this.options.loading = false;
  655. });
  656. },
  657. initForm() {
  658. this.form = {
  659. storeSpecialActivityId: '',
  660. storeId: '',
  661. activityName: '',
  662. activityComment: '',
  663. sort: '',
  664. startDate: '',
  665. status: 1,
  666. endDate: ''
  667. }
  668. this.value1 = []
  669. this.tableData1 = []
  670. },
  671. highlightRow(row) {
  672. this.editingRowId = row.storeSpecialActivityId;
  673. this.$nextTick(() => {
  674. const elTable = this.$refs.mainTable && this.$refs.mainTable.$children[0];
  675. if (elTable) elTable.setCurrentRow(row);
  676. });
  677. },
  678. clearHighlight() {
  679. this.editingRowId = null;
  680. const elTable = this.$refs.mainTable && this.$refs.mainTable.$children[0];
  681. if (elTable) elTable.setCurrentRow();
  682. },
  683. closeDia(){
  684. this.dialogVisible = false;
  685. this.clearHighlight();
  686. this.initForm()
  687. },
  688. viewpictrue(url) {
  689. if (url) {
  690. this.previewImage = url;
  691. this.previewVisible = true;
  692. }
  693. },
  694. closeGetDia(){
  695. this.getflg = false;
  696. this.clearHighlight();
  697. this.initForm()
  698. },
  699. }
  700. };
  701. </script>
  702. <style scoped>
  703. .page-wrap{
  704. height: 100%;
  705. display: flex;
  706. flex-direction: column;
  707. overflow: hidden;
  708. }
  709. .crumbs{
  710. color: #666;
  711. flex-shrink: 0;
  712. }
  713. .background{
  714. flex: 1;
  715. min-height: 0;
  716. display: flex;
  717. flex-direction: column;
  718. gap: 10px;
  719. padding: 0 10px 10px;
  720. }
  721. .topbox{
  722. background: white;
  723. box-shadow: 0 12px 20px -8px rgba(22, 50, 62, 0.3);
  724. border-radius: 10px;
  725. min-height: 52px;
  726. display: flex;
  727. align-items: center;
  728. justify-content: space-between;
  729. padding: 10px 16px;
  730. flex-shrink: 0;
  731. }
  732. .topbox-left{ flex-shrink: 0; }
  733. .page-title{
  734. font-size: 14px;
  735. color: #409EFF;
  736. font-weight: 600;
  737. }
  738. .topbox-right{
  739. flex-shrink: 0;
  740. display: flex;
  741. gap: 8px;
  742. }
  743. .searchbox{
  744. background: white;
  745. box-shadow: 0 12px 20px -8px rgba(22, 50, 62, 0.3);
  746. border-radius: 10px;
  747. padding: 12px 16px;
  748. display: flex;
  749. align-items: center;
  750. gap: 10px;
  751. flex-shrink: 0;
  752. font-size: 13px;
  753. color: #606266;
  754. }
  755. .tablebox{
  756. flex: 1;
  757. min-height: 0;
  758. background: white;
  759. box-shadow: 0 12px 20px -8px rgba(22, 50, 62, 0.3);
  760. border-radius: 10px;
  761. padding: 16px;
  762. overflow: hidden;
  763. }
  764. </style>
  765. <style>
  766. .tablebox,
  767. .tablebox > div,
  768. .tablebox .el-table,
  769. .tablebox .el-table__inner-wrapper,
  770. .tablebox .el-table__body-wrapper {
  771. border: none !important;
  772. outline: none !important;
  773. box-shadow: none !important;
  774. }
  775. .tablebox table {
  776. width: 100%;
  777. border-collapse: separate;
  778. border-spacing: 0;
  779. border-radius: 8px;
  780. overflow: hidden;
  781. border: none !important;
  782. }
  783. .tablebox th,
  784. .tablebox td {
  785. border: none !important;
  786. }
  787. .tablebox th {
  788. background: #409EFF !important;
  789. color: #fff !important;
  790. font-weight: 500 !important;
  791. font-size: 13px !important;
  792. padding: 10px 8px !important;
  793. }
  794. .tablebox thead tr:first-child th:first-child { border-top-left-radius: 8px; }
  795. .tablebox thead tr:first-child th:last-child { border-top-right-radius: 8px; }
  796. .tablebox tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
  797. .tablebox tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
  798. .tablebox td {
  799. padding: 8px !important;
  800. font-size: 13px;
  801. border-left: 1px solid #ebeef5 !important;
  802. }
  803. .tablebox td:first-child,
  804. .tablebox th:first-child {
  805. border-left: none !important;
  806. }
  807. .tablebox .el-table__body tr.current-row > td:first-child,
  808. .tablebox .el-table__body tr:hover > td:first-child {
  809. border-left: 3px solid #409EFF !important;
  810. padding-left: 5px !important;
  811. }
  812. .tablebox tr:hover td { background: #f6faff; }
  813. .tablebox .el-button--mini { padding: 5px 10px; font-size: 12px; }
  814. .img-preview {
  815. position: fixed;
  816. top: 0; left: 0; right: 0; bottom: 0;
  817. background: rgba(0,0,0,0.7);
  818. display: flex;
  819. align-items: center;
  820. justify-content: center;
  821. z-index: 9999;
  822. cursor: zoom-out;
  823. }
  824. .img-preview img {
  825. max-width: 80%;
  826. max-height: 80%;
  827. border-radius: 8px;
  828. cursor: default;
  829. }
  830. </style>