archives.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option" :search.sync="search" v-model="form" :table-loading="loading" :data="dataList"
  4. ref="crud" :key="key" :before-open="beforeOpen" @on-load="onLoad" @row-save="rowSave"
  5. @row-update="(row, index, done, loading) => { rowSave(row, done, loading, index) }" @search-change="searchChange"
  6. :upload-delete="uploadDelete" :before-close="beforeClose" @row-del="rowDel" @refresh-change="refreshChange"
  7. @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 234)"
  8. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 234)" :page.sync="page">
  9. <template slot-scope="{type,size,row,$index}" slot="menu">
  10. <el-button icon="el-icon-edit" :size="size" type="text" @click="$refs.crud.rowEdit(row, index)">查 看
  11. </el-button>
  12. </template>
  13. <tempalte slot="boxMakingCompanyForm">
  14. <dic-select v-model="form.boxMakingCompany" placeholder="造箱公司" key="id" label="cnName" res="records"
  15. url="/blade-los/bcorps/selectList?corpTypeName=箱东" :filterable="true" :remote="true" dataName="cnName"
  16. @selectChange="dicChange('boxMakingCompany', $event)"></dic-select>
  17. </tempalte>
  18. <template slot-scope="{type,size,row,index,disabled}" slot="code">
  19. <span class="el-button--text" style="cursor: pointer" @click="track(row)">{{ row.code }}</span>
  20. </template>
  21. </avue-crud>
  22. <el-dialog title="箱轨迹" :visible.sync="boxTrack" :append-to-body="true" :destroy-on-close="true"
  23. :close-on-click-modal="false" v-if="boxTrack" top="1vh" width="80%" v-dialog-drag>
  24. <span>
  25. <avue-crud ref="crudTrack" :option="optionTrack" :data="dataTrackList" :search.sync="searchTwo"
  26. :page.sync="pageTwo" :table-loading="loadingTwo" @on-load="onLoadTrack" @search-change="searchChangeTwo"
  27. @row-update="rowUpdateTrack"
  28. @resetColumn="resetColumnTwo('crudTrack', 'optionTrack', 'optionTrackBack', 234.1)"
  29. @saveColumn="saveColumnTwo('crudTrack', 'optionTrack', 'optionTrackBack', 234.1)" v-model="formTrack">
  30. <template slot-scope="{type,size,row,index,disabled}" slot="code">
  31. <span class="el-button--text" style="cursor: pointer" @click="contractNoJump(row)">{{ row.code
  32. }}</span>
  33. </template>
  34. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  35. <el-button icon="el-icon-edit" :size="size" :disabled="disabled" :type="type"
  36. @click="$refs.crudTrack.rowEdit(row, index)">编辑
  37. </el-button>
  38. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  39. @click="rowDel(row, index, 'GJ')">删除
  40. </el-button>
  41. </template>
  42. </avue-crud>
  43. </span>
  44. </el-dialog>
  45. </basic-container>
  46. </template>
  47. <script>
  48. import { addUpdate, boxRemove, getList, remove, archivestrajectory, update } from "@/api/box/archives";
  49. import { getToken } from "@/util/auth";
  50. import { getAllBoxs } from "@/api/basicData/portinformation";
  51. import dicSelect from "@/components/dicSelect/main";
  52. import fa from "element-ui/src/locale/lang/fa";
  53. export default {
  54. name: "archives",
  55. components: {
  56. dicSelect
  57. },
  58. data() {
  59. return {
  60. boxTrack: false,
  61. dataTrackList: [],
  62. loadingTwo: false,
  63. searchTwo: {},
  64. formTrack: {},
  65. optionTrack: {},
  66. optionTrackBack: {
  67. align: 'center',
  68. index: true,
  69. menu: false,
  70. addBtnText: "录入明细",
  71. refreshBtn: false,
  72. addBtn: false,
  73. span: 8,
  74. searchMenuPosition: "right",
  75. searchSpan: 6,
  76. searchMenuSpan: 24,
  77. searchIcon: true,
  78. searchIndex: 3,
  79. addRowBtn: false,
  80. cellBtn: false,
  81. editBtn: false,
  82. delBtn: false,
  83. menuWidth: 200,
  84. dialogTop: 25,
  85. dialogWidth: "80%",
  86. column: [
  87. {
  88. label: '箱号',
  89. prop: 'code',
  90. overHidden: true,
  91. // search: true
  92. },
  93. {
  94. label: '放箱号',
  95. prop: 'containerNumber',
  96. overHidden: true,
  97. },
  98. {
  99. label: '箱型',
  100. prop: 'boxType',
  101. overHidden: true,
  102. },
  103. {
  104. label: '箱东',
  105. prop: 'boxEastName',
  106. overHidden: true,
  107. },
  108. {
  109. label: '放箱号类型',
  110. prop: 'boxCategory',
  111. overHidden: true,
  112. },
  113. {
  114. label: '箱动态',
  115. prop: 'boxDynamics',
  116. overHidden: true,
  117. search: true,
  118. type: 'select',
  119. dicUrl: "/api/blade-system/dict-biz/dictionary?code=boxDynamics",
  120. props: {
  121. label: "dictValue",
  122. value: "dictValue"
  123. },
  124. },
  125. {
  126. label: '动态日期',
  127. prop: 'newDate',
  128. overHidden: true,
  129. },
  130. {
  131. label: '港口',
  132. prop: 'portCname',
  133. overHidden: true,
  134. search: true,
  135. type: "select",
  136. filterable: true,
  137. remote: true,
  138. dicUrl: "/api/blade-los/bports/list?size=20&current=1&cnName={{key}}",
  139. props: {
  140. label: "cnName",
  141. value: "cnName",
  142. res: "data.records"
  143. }
  144. },
  145. {
  146. label: '场站',
  147. prop: 'stationCname',
  148. overHidden: true,
  149. search: true,
  150. type: "select",
  151. filterable: true,
  152. remote: true,
  153. dicUrl: "/api/blade-los/bcorps/selectList?corpTypeName=场站&cnName={{key}}",
  154. props: {
  155. label: "cnName",
  156. value: "cnName",
  157. res: "data.records"
  158. }
  159. },
  160. {
  161. label: '客户名称',
  162. prop: 'corpName',
  163. overHidden: true,
  164. search: true,
  165. type: "select",
  166. filterable: true,
  167. remote: true,
  168. dicUrl: "/api/blade-los/bcorps/selectList?size=20&current=1&cnName={{key}}",
  169. props: {
  170. label: "cnName",
  171. value: "cnName",
  172. res: "data.records"
  173. }
  174. },
  175. {
  176. label: '提单号',
  177. prop: 'mblno',
  178. overHidden: true,
  179. },
  180. {
  181. label: '船名',
  182. prop: 'shipCname',
  183. overHidden: true,
  184. },
  185. {
  186. label: '航次',
  187. prop: 'voyage',
  188. overHidden: true,
  189. },
  190. {
  191. label: 'ETD',
  192. prop: 'etd',
  193. overHidden: true,
  194. },
  195. {
  196. label: 'POL堆场',
  197. prop: 'polCyCname',
  198. overHidden: true,
  199. },
  200. {
  201. label: 'POL免箱使天数',
  202. prop: 'polFreeBoxUseDays',
  203. width: 110,
  204. overHidden: true,
  205. },
  206. {
  207. label: 'POL提前出场日期',
  208. prop: 'polPreAppearanceDate',
  209. width: 120,
  210. overHidden: true,
  211. },
  212. {
  213. label: 'POL场站空箱出场日期',
  214. prop: 'polStationEmptyContainerExitDate',
  215. width: 140,
  216. overHidden: true,
  217. },
  218. {
  219. label: 'POL还箱日期',
  220. prop: 'polReturnDate',
  221. width: 100,
  222. overHidden: true,
  223. },
  224. {
  225. label: 'POL超期箱使天数',
  226. prop: 'polOverdueBoxUseDays',
  227. width: 120,
  228. overHidden: true,
  229. },
  230. {
  231. label: 'ETA',
  232. prop: 'eta',
  233. overHidden: true,
  234. },
  235. {
  236. label: 'POD空箱还箱日期',
  237. prop: 'podEmptyContainerReturnDate',
  238. width: 120,
  239. overHidden: true,
  240. },
  241. {
  242. label: 'POD场站',
  243. prop: 'podStationCname',
  244. overHidden: true,
  245. },
  246. {
  247. label: 'POD免箱使天数',
  248. prop: 'podFreeBoxUseDays',
  249. width: 110,
  250. overHidden: true,
  251. },
  252. {
  253. label: 'POD箱使天数',
  254. prop: 'podBoxUseDays',
  255. width: 100,
  256. overHidden: true,
  257. }
  258. ]
  259. },
  260. excelBox: false,
  261. loading: false,
  262. search: {},
  263. form: {},
  264. excelForm: {},
  265. dataList: [],
  266. page: {
  267. pageSize: 20,
  268. currentPage: 1,
  269. total: 0,
  270. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  271. },
  272. key: 0,
  273. option: {},
  274. optionList: {
  275. index: true,
  276. dialogDrag: true,
  277. addBtn: false,
  278. delBtn: false,
  279. editBtn: false,
  280. saveBtn: false,
  281. cancelBtnText: '关闭',
  282. span: 8,
  283. border: true,
  284. height: "auto",
  285. searchMenuPosition: "right",
  286. align: "center",
  287. searchSpan: 6,
  288. searchMenuSpan: 24,
  289. searchIcon: true,
  290. searchIndex: 3,
  291. menuWidth: 80,
  292. highlightCurrentRow: true,
  293. dialogWidth: "70%",
  294. column: [
  295. {
  296. label: '箱号',
  297. prop: 'code',
  298. width: 100,
  299. overHidden: true,
  300. search: true,
  301. disabled: true,
  302. },
  303. {
  304. label: '合同号',
  305. prop: 'contractNo',
  306. width: 100,
  307. disabled: true,
  308. overHidden: true,
  309. search: true,
  310. },
  311. {
  312. label: '港口',
  313. prop: 'addressCname',
  314. width: 100,
  315. overHidden: true,
  316. search: true,
  317. disabled: true,
  318. type: "select",
  319. filterable: true,
  320. remote: true,
  321. dicUrl: "/api/blade-los/bports/list?current=1&size=20&cnName={{key}}",
  322. props: {
  323. label: "cnName",
  324. value: "cnName",
  325. res: "data.records"
  326. }
  327. },
  328. {
  329. label: '场站',
  330. prop: 'stationCname',
  331. width: 100,
  332. overHidden: true,
  333. disabled: true,
  334. },
  335. {
  336. label: '放箱号',
  337. prop: 'containerNumber',
  338. width: 100,
  339. overHidden: true,
  340. disabled: true,
  341. },
  342. {
  343. label: '箱型',
  344. prop: 'typeName',
  345. width: 100,
  346. overHidden: true,
  347. search: true,
  348. disabled: true,
  349. type: "select",
  350. filterable: true,
  351. remote: true,
  352. dicUrl: "/api/blade-los/bcntrtypes/list?status=0&current=1&size=20&cnName={{key}}",
  353. props: {
  354. label: "cnName",
  355. value: "cnName",
  356. res: "data.records"
  357. }
  358. },
  359. {
  360. label: '动态日期',
  361. prop: 'newDate',
  362. width: 100,
  363. searchProp: 'newDateList',
  364. overHidden: true,
  365. search: true,
  366. disabled: true,
  367. type: "date",
  368. searchRange: true,
  369. searchDefaultTime: ["00:00:00", "23:59:59"],
  370. format: "yyyy-MM-dd",
  371. valueFormat: "yyyy-MM-dd HH:mm:ss"
  372. },
  373. {
  374. label: '箱状态',
  375. width: 100,
  376. overHidden: true,
  377. disabled: true,
  378. search: true,
  379. filterable: true,
  380. prop: 'status',
  381. type: 'select',
  382. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_archives_status",
  383. props: {
  384. label: "dictValue",
  385. value: "dictKey"
  386. }
  387. },
  388. {
  389. label: '箱属',
  390. prop: 'boxBelongsTo',
  391. width: 100,
  392. overHidden: true,
  393. disabled: true,
  394. },
  395. {
  396. label: '放箱号类型',
  397. prop: 'boxType',
  398. width: 100,
  399. overHidden: true,
  400. disabled: true,
  401. },
  402. {
  403. label: '箱东',
  404. prop: 'originalBoxEast',
  405. width: 100,
  406. overHidden: true,
  407. disabled: true,
  408. },
  409. {
  410. label: '限制港口',
  411. prop: 'restrictedPortsName',
  412. width: 100,
  413. overHidden: true,
  414. disabled: true,
  415. },
  416. {
  417. label: '限制船公司',
  418. prop: 'restrictingShippingCompaniesName',
  419. width: 100,
  420. overHidden: true,
  421. disabled: true,
  422. },
  423. {
  424. label: '启用日期',
  425. prop: 'activationDate',
  426. width: 100,
  427. overHidden: true,
  428. disabled: true,
  429. type: "date",
  430. format: "yyyy-MM-dd",
  431. valueFormat: "yyyy-MM-dd HH:mm:ss"
  432. },
  433. {
  434. label: '租赁公司',
  435. prop: 'leasingCompany',
  436. width: 100,
  437. overHidden: true,
  438. search: true,
  439. disabled: true,
  440. type: 'select',
  441. filterable: true,
  442. remote: true,
  443. dicUrl: "/api/blade-los/bcorps/selectList?current=1&size=5&corpTypeName=箱东&shortName={{key}}",
  444. props: {
  445. label: 'shortName',
  446. value: 'shortName',
  447. desc: 'code',
  448. res: 'data.records'
  449. },
  450. },
  451. {
  452. label: '箱来源',
  453. prop: 'boxSource',
  454. width: 100,
  455. overHidden: true,
  456. disabled: true,
  457. search: true,
  458. filterable: true,
  459. type: 'select',
  460. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_source",
  461. props: {
  462. label: "dictValue",
  463. value: "dictKey"
  464. }
  465. },
  466. {
  467. label: '箱好坏',
  468. prop: 'boxStatus',
  469. width: 100,
  470. overHidden: true,
  471. disabled: true,
  472. search: true,
  473. filterable: true,
  474. type: 'select',
  475. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_status",
  476. props: {
  477. label: "dictValue",
  478. value: "dictKey"
  479. }
  480. },
  481. {
  482. label: '租赁方式',
  483. prop: 'leaseMethod',
  484. width: 100,
  485. overHidden: true,
  486. filterable: true,
  487. type: 'select',
  488. disabled: true,
  489. dicUrl: "/api/blade-system/dict-biz/dictionary?code=lease_method",
  490. props: {
  491. label: "dictValue",
  492. value: "dictKey"
  493. }
  494. },
  495. {
  496. label: '空重(kg)',
  497. prop: 'emptyWeight',
  498. width: 100,
  499. overHidden: true,
  500. disabled: false,
  501. }, {
  502. label: '毛重(kg)',
  503. prop: 'gorssWeight',
  504. width: 100,
  505. overHidden: true,
  506. disabled: false,
  507. }, {
  508. label: '皮重(kg)',
  509. prop: 'tare',
  510. width: 100,
  511. overHidden: true,
  512. disabled: false,
  513. }, {
  514. label: '装载重量(kg)',
  515. prop: 'loadingWeight',
  516. width: 100,
  517. overHidden: true,
  518. disabled: false,
  519. }, {
  520. label: '容积(m³)',
  521. prop: 'volume',
  522. overHidden: true,
  523. disabled: false,
  524. width: 100
  525. },
  526. {
  527. label: '造箱公司',
  528. prop: 'boxMakingCompany',
  529. disabled: false,
  530. width: 100,
  531. overHidden: true,
  532. search: true,
  533. type: 'select',
  534. filterable: true,
  535. remote: true,
  536. dicUrl: "/api/blade-los/bcorps/selectList?current=1&size=5&corpTypeName=箱东&shortName={{key}}",
  537. props: {
  538. label: 'shortName',
  539. value: 'shortName',
  540. desc: 'code',
  541. res: 'data.records'
  542. },
  543. }, {
  544. label: '造箱日期',
  545. prop: 'boxMakingDate',
  546. searchProp: 'boxMakingDateList',
  547. width: 100,
  548. overHidden: true,
  549. disabled: false,
  550. search: true,
  551. type: "date",
  552. searchRange: true,
  553. searchDefaultTime: ["00:00:00", "23:59:59"],
  554. format: "yyyy-MM-dd",
  555. valueFormat: "yyyy-MM-dd HH:mm:ss"
  556. }, {
  557. label: '起租日期',
  558. prop: 'leaseCommencementDate',
  559. searchProp: 'leaseCommencementDateList',
  560. width: 100,
  561. overHidden: true,
  562. search: true,
  563. type: "date",
  564. disabled: true,
  565. searchRange: true,
  566. searchDefaultTime: ["00:00:00", "23:59:59"],
  567. format: "yyyy-MM-dd",
  568. valueFormat: "yyyy-MM-dd HH:mm:ss"
  569. }, {
  570. label: '购入日期',
  571. prop: 'purchaseDate',
  572. width: 100,
  573. overHidden: true,
  574. type: "date",
  575. disabled: true,
  576. searchRange: true,
  577. searchDefaultTime: ["00:00:00", "23:59:59"],
  578. format: "yyyy-MM-dd",
  579. valueFormat: "yyyy-MM-dd HH:mm:ss"
  580. }, {
  581. label: '箱龄(月)',
  582. prop: 'boxAge',
  583. overHidden: true,
  584. disabled: false,
  585. width: 100,
  586. }
  587. ]
  588. }
  589. }
  590. },
  591. async created() {
  592. this.option = await this.getColumnData(this.getColumnName(234), this.optionList);
  593. this.optionTrack = await this.getColumnData(this.getColumnName(234.1), this.optionTrackBack);
  594. this.key++
  595. let i = 0;
  596. this.option.column.forEach(item => {
  597. if (item.search) i++
  598. })
  599. if (i % 3 !== 0) {
  600. const num = 3 - Number(i % 3)
  601. this.option.searchMenuSpan = num * 8;
  602. this.option.searchMenuPosition = "right";
  603. }
  604. },
  605. methods: {
  606. dicChange(name, row) {
  607. if (name == 'typeName') {
  608. if (row) {
  609. this.form.typeId = row.id
  610. } else {
  611. this.form.typeId = null
  612. this.form.typeName = null
  613. }
  614. }
  615. if (name == 'purchaseCompanyName') {
  616. if (row) {
  617. this.form.boxMakingCompanyId = row.id
  618. } else {
  619. this.form.boxMakingCompanyId = null
  620. this.form.boxMakingCompany = null
  621. }
  622. }
  623. },
  624. // 箱轨迹里合同号跳转
  625. contractNoJump(row) {
  626. this.boxTrack = false
  627. if (row.billType == 'BUY') {
  628. this.$router.push({
  629. path: '/boxManagement/buyContainer/index',
  630. query: {
  631. id:row.srcId
  632. },
  633. });
  634. }
  635. if (row.billType == 'OW-F') {
  636. this.$router.push({
  637. path: '/ow/owPut/index',
  638. query: {
  639. id:row.srcId
  640. },
  641. });
  642. }
  643. },
  644. track(row) {
  645. // this.dataTrackList = row
  646. this.formSearch = row
  647. this.boxTrack = true
  648. },
  649. rowUpdateTrack(form, index, done, loading) {
  650. update(form).then(res => {
  651. done()
  652. this.$message.success("操作成功")
  653. this.onLoadTrack(this.pageTwo, this.searchTwo)
  654. })
  655. },
  656. //打开表单前
  657. beforeOpen(done, type) {
  658. if (type === "add") {
  659. this.findObject(this.option.column, "boxSource").value = this.$refs.crud.DIC.boxSource.length > 0 ? this.$refs.crud.DIC.boxSource[0].dictKey : ''
  660. this.findObject(this.option.column, "boxStatus").value = this.$refs.crud.DIC.boxStatus.length > 0 ? this.$refs.crud.DIC.boxStatus[0].dictKey : ''
  661. }
  662. done();
  663. },
  664. searchChangeTwo(params, done) {
  665. done();
  666. this.onLoadTrack(this.pageTwo, params)
  667. },
  668. onLoadTrack(page, params = {}) {
  669. params = {
  670. ...params,
  671. current: page.currentPage,
  672. size: page.pageSize,
  673. code: this.formSearch.code
  674. }
  675. this.loadingTwo = true
  676. archivestrajectory(params).then(res => {
  677. this.dataTrackList = res.data.data.records
  678. this.pageTwo.total = res.data.data.total
  679. this.$nextTick(() => {
  680. this.$refs.crudTrack.doLayout();
  681. this.$refs.crudTrack.dicInit();
  682. });
  683. }).finally(() => {
  684. this.loadingTwo = false
  685. })
  686. },
  687. //导出
  688. outExport() {
  689. this.$confirm('是否导出当前所有箱档案?', '提示', {
  690. confirmButtonText: '确定',
  691. cancelButtonText: '取消',
  692. type: 'warning'
  693. }).then(() => {
  694. let queryParams = this.search
  695. const routeData = this.$router.resolve({
  696. path: '/api/blade-box-tube/archives/export-archives-out', //跳转目标窗口的地址
  697. query: {
  698. 'Blade-Auth': getToken(),
  699. ...queryParams //括号内是要传递给新窗口的参数
  700. }
  701. })
  702. window.open(routeData.href.slice(1, routeData.href.length));
  703. }).catch(() => {
  704. this.$message({
  705. type: 'info',
  706. message: '已取消' //
  707. });
  708. })
  709. },
  710. derivation() {
  711. window.open(`/api/blade-box-tube/archives/export-archives-info?${this.website.tokenHeader}=${getToken()}`);
  712. },
  713. uploadBefore(file, done, loading) {
  714. loading = true;
  715. done();
  716. },
  717. uploadAfter(res, done, loading, column) {
  718. this.excelBox = false;
  719. this.$message.success("导入成功!");
  720. this.onLoad(this.page, this.search);
  721. loading = false;
  722. done();
  723. },
  724. balabala(val) {
  725. if (val === null) {
  726. this.form.address = ''
  727. } else {
  728. this.form.address = val.name
  729. }
  730. },
  731. getGSData(row) {
  732. this.form.leasingCompany = row.cname
  733. },
  734. //关闭弹窗前
  735. beforeClose(done, type) {
  736. this.onLoad(this.page, this.search)
  737. done()
  738. },
  739. //刷新
  740. refreshChange() {
  741. this.onLoad(this.page, this.search)
  742. },
  743. rowDel(form, index) {
  744. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  745. confirmButtonText: '确定',
  746. cancelButtonText: '取消',
  747. type: 'warning'
  748. }).then(() => {
  749. remove(form.id).then(res => {
  750. this.$message({
  751. type: 'success',
  752. message: '删除成功!'
  753. });
  754. this.onLoad(this.page, this.search)
  755. })
  756. }).catch(() => {
  757. });
  758. },
  759. uploadDelete(file, column) {
  760. return new Promise((resolve, reject) => {
  761. this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
  762. confirmButtonText: '确定',
  763. cancelButtonText: '取消',
  764. type: 'warning'
  765. }).then(() => {
  766. if (this.form.filesList[file.uid].id) {
  767. boxRemove(this.form.filesList[file.uid].id).then(res => {
  768. this.$message({
  769. type: 'success',
  770. message: '删除成功!'
  771. });
  772. resolve();
  773. })
  774. } else {
  775. resolve();
  776. }
  777. }).catch(() => {
  778. reject();
  779. this.$message({
  780. type: "info",
  781. message: "已取消删除"
  782. });
  783. })
  784. })
  785. },
  786. rowSave(form, done, loading, index) {
  787. done()
  788. addUpdate(form).then(res => {
  789. this.onLoad(this.page, this.search)
  790. })
  791. },
  792. searchChange(params, done) {
  793. done();
  794. this.onLoad(this.page, params)
  795. },
  796. onLoad(page, params = {}) {
  797. params = {
  798. ...params,
  799. current: page.currentPage,
  800. size: page.pageSize,
  801. ...Object.assign(params, this.search)
  802. }
  803. this.loading = true
  804. getList(params).then(res => {
  805. this.dataList = res.data.data.records
  806. this.page.total = res.data.data.total
  807. this.loading = false
  808. this.$nextTick(() => {
  809. this.$refs.crud.doLayout();
  810. this.$refs.crud.dicInit();
  811. });
  812. }).finally(() => {
  813. this.loading = false
  814. })
  815. },
  816. //自定义列保存
  817. async saveColumnTwo(ref, option, optionBack, code) {
  818. /**
  819. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  820. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  821. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  822. */
  823. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  824. if (inSave) {
  825. this.$message.success("保存成功");
  826. //关闭窗口
  827. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  828. }
  829. },
  830. //自定义列重置
  831. async resetColumnTwo(ref, option, optionBack, code) {
  832. this[option] = this[optionBack];
  833. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  834. if (inSave) {
  835. this.$message.success("重置成功");
  836. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  837. }
  838. },
  839. }
  840. }
  841. </script>
  842. <style lang="scss" scoped>
  843. ::v-deep .el-col-md-8 {
  844. width: 24.33333%;
  845. }
  846. </style>