archives.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. <template>
  2. <basic-container>
  3. <avue-crud
  4. :option="option"
  5. :search.sync="search"
  6. v-model="form"
  7. :table-loading="loading"
  8. :data="dataList"
  9. ref="crud"
  10. :key="key"
  11. :before-open="beforeOpen"
  12. @on-load="onLoad"
  13. @row-save="rowSave"
  14. @row-update="(row,index,done,loading)=>{rowSave(row,done,loading,index)}"
  15. @search-change="searchChange"
  16. :upload-delete="uploadDelete"
  17. :before-close="beforeClose"
  18. @row-del="rowDel"
  19. @refresh-change="refreshChange"
  20. @resetColumn="resetColumnTwo('crud','option','optionList',234)"
  21. @saveColumn="saveColumnTwo('crud','option','optionList',234)"
  22. :page.sync="page">
  23. <template slot-scope="scope" slot="menuLeft">
  24. <el-button type="success" size="small" icon="el-icon-bottom" @click="excelBox = true">导入
  25. </el-button>
  26. <el-button type="warning"
  27. icon="el-icon-download"
  28. size="small"
  29. @click="outExport">导出
  30. </el-button>
  31. </template>
  32. <template slot-scope="{type,size,row,index,disabled}" slot="code">
  33. <span class="el-button--text" style="cursor: pointer" @click="track(row)">{{row.code}}</span>
  34. </template>
  35. <template slot="leasingCompanyIdForm">
  36. <crop-select v-model="form.leasingCompanyId" disabled @getCorpData="getGSData" corpType="KH"/>
  37. </template>
  38. <template slot="addressIdForm">
  39. <port-info v-model="form.addressId" type="id" @balabalaTow="balabala"/>
  40. </template>
  41. <template slot="addressIdSearch">
  42. <port-info v-model="search.addressId" type="id"/>
  43. </template>
  44. <template slot="addressId" slot-scope="{row}">
  45. {{ row.address }}
  46. </template>
  47. <template slot="leasingCompanyIdSearch">
  48. <crop-select v-model="search.leasingCompanyId" corpType="KH"/>
  49. </template>
  50. <template slot="leasingCompanyId" slot-scope="{row}">
  51. {{ row.leasingCompany }}
  52. </template>
  53. </avue-crud>
  54. <el-dialog title="导入箱档案" append-to-body :visible.sync="excelBox" width="555px" :close-on-click-modal="false"
  55. v-dialog-drag>
  56. <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading"
  57. :upload-before="uploadBefore" :upload-after="uploadAfter">
  58. <template slot="excelTemplate">
  59. <el-button type="primary" @click="derivation">
  60. 点击下载<i class="el-icon-download el-icon--right"></i>
  61. </el-button>
  62. </template>
  63. </avue-form>
  64. <p style="text-align: center;color: #DC0505">
  65. 温馨提示 第一次导入时请先下载模板
  66. </p>
  67. </el-dialog>
  68. <el-dialog
  69. title="箱轨迹"
  70. :visible.sync="boxTrack"
  71. :append-to-body="true"
  72. :destroy-on-close="true"
  73. :close-on-click-modal="false"
  74. v-if="boxTrack"
  75. top="1vh"
  76. width="80%">
  77. <span>
  78. <avue-crud
  79. ref="crudTrack"
  80. :option="optionTrack"
  81. :data="dataTrackList"
  82. :search.sync="searchTwo"
  83. :page.sync="pageTwo"
  84. :table-loading="loadingTwo"
  85. @on-load="onLoadTrack"
  86. @search-change="searchChangeTwo"
  87. @row-update="rowUpdateTrack"
  88. @resetColumn="resetColumnTwo('crudTrack','optionTrack','optionTrackBack',234.1)"
  89. @saveColumn="saveColumnTwo('crudTrack','optionTrack','optionTrackBack',234.1)"
  90. v-model="formTrack">
  91. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  92. <el-button icon="el-icon-edit" :size="size" :disabled="disabled" :type="type"
  93. @click="$refs.crudTrack.rowEdit(row,index)">编辑
  94. </el-button>
  95. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  96. @click="rowDel(row,index,'GJ')">删除
  97. </el-button>
  98. </template>
  99. </avue-crud>
  100. </span>
  101. </el-dialog>
  102. </basic-container>
  103. </template>
  104. <script>
  105. import {addUpdate, boxRemove, getList, remove} from "@/api/box/archives";
  106. import {getToken} from "@/util/auth";
  107. import {getAllBoxs} from "@/api/basicData/portinformation";
  108. import {archivestrajectory, update} from "@/api/boxManagement/exportShipment";
  109. export default {
  110. name: "archives",
  111. data() {
  112. return {
  113. boxTrack: false,
  114. dataTrackList:[],
  115. searchTwo:{},
  116. formTrack: {},
  117. optionTrack: {},
  118. optionTrackBack: {
  119. align: 'center',
  120. index: true,
  121. menu:false,
  122. addBtnText: "录入明细",
  123. refreshBtn: false,
  124. addBtn: false,
  125. span: 8,
  126. searchMenuPosition: "right",
  127. searchSpan: 8,
  128. searchIcon: true,
  129. searchIndex: 2,
  130. addRowBtn: false,
  131. cellBtn: false,
  132. editBtn: false,
  133. delBtn: false,
  134. menuWidth: 200,
  135. dialogTop: 25,
  136. dialogWidth: "80%",
  137. column: [{
  138. label: '箱号',
  139. prop: 'code',
  140. overHidden: true,
  141. remote: true,
  142. filterable: true,
  143. type: "select",
  144. dicUrl: "/api/blade-box-tube/archives/selectArchivesList?size=10&current=1&code={{key}}",
  145. props: {
  146. label: "code",
  147. value: "code"
  148. },
  149. disabled: true
  150. }, {
  151. label: '地点',
  152. prop: 'address',
  153. overHidden: true,
  154. formProp: 'address',
  155. search: true
  156. }, {
  157. label: '日期',
  158. prop: 'newDate',
  159. search: true,
  160. searchProp: 'newDateList',
  161. overHidden: true,
  162. type: "date",
  163. searchRange: true,
  164. searchDefaultTime: ["00:00:00", "23:59:59"],
  165. format: "yyyy-MM-dd",
  166. valueFormat: "yyyy-MM-dd HH:mm:ss"
  167. }, {
  168. label: '应收',
  169. prop: 'collect',
  170. overHidden: true
  171. }, {
  172. label: '应付',
  173. prop: 'pay',
  174. overHidden: true
  175. }, {
  176. label: '业务类型',
  177. prop: 'billType',
  178. overHidden: true
  179. }, {
  180. label: '状态',
  181. prop: 'status',
  182. overHidden: true
  183. }]
  184. },
  185. excelBox: false,
  186. loading: false,
  187. search: {},
  188. form: {},
  189. excelForm: {},
  190. dataList: [],
  191. page: {
  192. pageSize: 20,
  193. currentPage: 1,
  194. total: 0,
  195. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  196. },
  197. pageTwo:{
  198. pageSize: 20,
  199. currentPage: 1,
  200. total: 0,
  201. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  202. },
  203. loadingTwo:false,
  204. excelOption: {
  205. submitBtn: false,
  206. emptyBtn: false,
  207. column: [
  208. {
  209. label: "模板下载",
  210. prop: "excelTemplate",
  211. formslot: true,
  212. span: 24
  213. },
  214. {
  215. label: "模板上传",
  216. prop: "excelFile",
  217. type: "upload",
  218. drag: true,
  219. loadText: "模板上传中,请稍等",
  220. span: 24,
  221. propsHttp: {
  222. res: "data"
  223. },
  224. tip: "请上传 .xls,.xlsx 标准格式文件",
  225. action: "/api/blade-box-tube/archives/import-descParts-info"
  226. }
  227. ]
  228. },
  229. key: 0,
  230. option: {},
  231. optionList: {
  232. index: true,
  233. dialogDrag: true,
  234. span: 8,
  235. border: true,
  236. height:"auto",
  237. searchMenuPosition: "right",
  238. align: "center",
  239. searchSpan: 8,
  240. searchIcon: true,
  241. searchIndex: 2,
  242. highlightCurrentRow: true,
  243. dialogWidth: "70%",
  244. column: [{
  245. label: '合同号',
  246. prop: 'contractNo',
  247. width: 100,
  248. disabled:true,
  249. overHidden: true,
  250. search: true,
  251. },{
  252. label: '箱号',
  253. prop: 'code',
  254. width: 100,
  255. overHidden: true,
  256. filterable: true,
  257. remote: true,
  258. type: "select",
  259. search: true,
  260. allowCreate: true,
  261. dicUrl: "/api/blade-box-tube/archives/list?size=10&current=1&code={{key}}",
  262. props: {
  263. label: "code",
  264. value: "code",
  265. res:"data.records"
  266. }
  267. }, {
  268. label: '箱类型',
  269. prop: 'typeId',
  270. width: 100,
  271. overHidden: true,
  272. search: true,
  273. filterable: true,
  274. type: 'select',
  275. dataType: 'string',
  276. props: {
  277. label: 'name',
  278. value: 'id'
  279. },
  280. dicUrl: '/api/blade-client/container/listMessage'
  281. }, {
  282. label: '最新地点',
  283. prop: 'addressId',
  284. width: 100,
  285. overHidden: true,
  286. search: true,
  287. }, {
  288. label: '最新日期',
  289. prop: 'newDate',
  290. width: 100,
  291. searchProp: 'newDateList',
  292. overHidden: true,
  293. search: true,
  294. type: "date",
  295. searchRange: true,
  296. searchDefaultTime: ["00:00:00", "23:59:59"],
  297. format: "yyyy-MM-dd",
  298. valueFormat: "yyyy-MM-dd HH:mm:ss"
  299. }, {
  300. label: '租赁公司',
  301. prop: 'leasingCompanyId',
  302. width: 100,
  303. overHidden: true,
  304. search: true,
  305. }, {
  306. label: '箱来源',
  307. prop: 'boxSource',
  308. width: 100,
  309. overHidden: true,
  310. search: true,
  311. filterable: true,
  312. type: 'select',
  313. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_source",
  314. props: {
  315. label: "dictValue",
  316. value: "dictKey"
  317. }
  318. }, {
  319. label: '箱状态',
  320. prop: 'boxStatus',
  321. width: 100,
  322. overHidden: true,
  323. search: true,
  324. filterable: true,
  325. type: 'select',
  326. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_status",
  327. props: {
  328. label: "dictValue",
  329. value: "dictKey"
  330. }
  331. }, {
  332. label: '租赁方式',
  333. prop: 'leaseMethod',
  334. width: 100,
  335. overHidden: true,
  336. filterable: true,
  337. type: 'select',
  338. disabled:true,
  339. dicUrl: "/api/blade-system/dict-biz/dictionary?code=lease_method",
  340. props: {
  341. label: "dictValue",
  342. value: "dictKey"
  343. }
  344. }, {
  345. label: '空重(kg)',
  346. prop: 'emptyWeight',
  347. width: 100,
  348. overHidden: true,
  349. type: 'number',
  350. controls: false,
  351. }, {
  352. label: '毛重(kg)',
  353. prop: 'gorssWeight',
  354. width: 100,
  355. overHidden: true,
  356. type: 'number',
  357. controls: false,
  358. }, {
  359. label: '皮重(kg)',
  360. prop: 'tare',
  361. width: 100,
  362. overHidden: true,
  363. type: 'number',
  364. controls: false,
  365. }, {
  366. label: '装载重量(kg)',
  367. prop: 'loadingWeight',
  368. width: 100,
  369. overHidden: true,
  370. type: 'number',
  371. controls: false,
  372. }, {
  373. label: '容积(m³)',
  374. prop: 'volume',
  375. type: 'number',
  376. controls: false,
  377. overHidden: true,
  378. width: 100
  379. }, {
  380. label: '状态',
  381. width: 100,
  382. overHidden: true,
  383. search: true,
  384. filterable: true,
  385. prop: 'status',
  386. type: 'select',
  387. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_archives_status",
  388. props: {
  389. label: "dictValue",
  390. value: "dictKey"
  391. }
  392. }, {
  393. label: '造箱公司',
  394. prop: 'boxMakingCompany',
  395. width: 100,
  396. overHidden: true,
  397. search: true,
  398. }, {
  399. label: '造箱日期',
  400. prop: 'boxMakingDate',
  401. searchProp: 'boxMakingDateList',
  402. width: 100,
  403. overHidden: true,
  404. search: true,
  405. type: "date",
  406. searchRange: true,
  407. searchDefaultTime: ["00:00:00", "23:59:59"],
  408. format: "yyyy-MM-dd",
  409. valueFormat: "yyyy-MM-dd HH:mm:ss"
  410. }, {
  411. label: '起租日期',
  412. prop: 'leaseCommencementDate',
  413. searchProp: 'leaseCommencementDateList',
  414. width: 100,
  415. overHidden: true,
  416. search: true,
  417. type: "date",
  418. disabled:true,
  419. searchRange: true,
  420. searchDefaultTime: ["00:00:00", "23:59:59"],
  421. format: "yyyy-MM-dd",
  422. valueFormat: "yyyy-MM-dd HH:mm:ss"
  423. }, {
  424. label: '购入日期',
  425. prop: 'purchaseDate',
  426. width: 100,
  427. overHidden: true,
  428. type: "date",
  429. disabled:true,
  430. searchRange: true,
  431. searchDefaultTime: ["00:00:00", "23:59:59"],
  432. format: "yyyy-MM-dd",
  433. valueFormat: "yyyy-MM-dd HH:mm:ss"
  434. }, {
  435. label: '箱龄(月)',
  436. prop: 'boxAge',
  437. overHidden: true,
  438. width: 100,
  439. }, {
  440. label: '出入场状态',
  441. prop: 'boxAccessStatus',
  442. overHidden: true,
  443. display:false,
  444. width: 100,
  445. }, {
  446. label: '照片',
  447. prop: 'filesList',
  448. width: 200,
  449. overHidden: true,
  450. type: 'upload',
  451. span: 24,
  452. listType: 'picture-card',
  453. tip: '只能上传jpg/png文件,且不超过500kb',
  454. propsHttp: {
  455. url: 'link',
  456. name: 'originalName',
  457. res: 'data'
  458. },
  459. action: '/api/blade-resource/oss/endpoint/put-file'
  460. }]
  461. }
  462. }
  463. },
  464. async created() {
  465. this.option = await this.getColumnData(this.getColumnName(234), this.optionList);
  466. this.optionTrack = await this.getColumnData(this.getColumnName(234.1), this.optionTrackBack);
  467. this.key++
  468. this.findObject(this.option.column, "typeId").change = ({value, column}) => {
  469. getAllBoxs().then(res => {
  470. for (let item of res.data.data) {
  471. if (value == item.id) {
  472. this.form.name = item.name
  473. }
  474. }
  475. })
  476. }
  477. let i = 0;
  478. this.option.column.forEach(item => {
  479. if (item.search) i++
  480. })
  481. if (i % 3 !== 0) {
  482. const num = 3 - Number(i % 3)
  483. this.option.searchMenuSpan = num * 8;
  484. this.option.searchMenuPosition = "right";
  485. }
  486. },
  487. methods: {
  488. track(row) {
  489. // this.dataTrackList = row
  490. this.formSearch = row
  491. this.boxTrack = true
  492. },
  493. rowUpdateTrack(form, index, done, loading) {
  494. update(form).then(res => {
  495. done()
  496. this.$message.success("操作成功")
  497. this.onLoadTrack(this.pageTwo, this.searchTwo)
  498. })
  499. },
  500. searchChangeTwo(params, done) {
  501. done();
  502. this.onLoadTrack(this.pageTwo, params)
  503. },
  504. onLoadTrack(page, params = {}) {
  505. params = {
  506. ...params,
  507. current: page.currentPage,
  508. size: page.pageSize,
  509. code: this.formSearch.code
  510. }
  511. this.loadingTwo = true
  512. archivestrajectory(params).then(res => {
  513. this.dataTrackList = res.data.data.records
  514. this.pageTwo.total = res.data.data.total
  515. this.loadingTwo = false
  516. }).finally(() => {
  517. this.loadingTwo = false
  518. })
  519. },
  520. //打开表单前
  521. beforeOpen(done,type){
  522. if (type === "add"){
  523. this.findObject(this.option.column, "typeId").value = this.$refs.crud.DIC.typeId.length>0?this.$refs.crud.DIC.typeId[0].id:''
  524. this.form.name = this.$refs.crud.DIC.typeId.length>0?this.$refs.crud.DIC.typeId[0].name:''
  525. this.findObject(this.option.column, "boxSource").value = this.$refs.crud.DIC.boxSource.length>0?this.$refs.crud.DIC.boxSource[0].dictKey:''
  526. this.findObject(this.option.column, "boxStatus").value = this.$refs.crud.DIC.boxStatus.length>0?this.$refs.crud.DIC.boxStatus[0].dictKey:''
  527. }
  528. done();
  529. },
  530. //导出
  531. outExport() {
  532. this.$confirm('是否导出当前所有箱档案?', '提示', {
  533. confirmButtonText: '确定',
  534. cancelButtonText: '取消',
  535. type: 'warning'
  536. }).then(() => {
  537. let queryParams = this.search
  538. const routeData = this.$router.resolve({
  539. path: '/api/blade-box-tube/archives/export-archives-out', //跳转目标窗口的地址
  540. query: {
  541. 'Blade-Auth': getToken(),
  542. ...queryParams //括号内是要传递给新窗口的参数
  543. }
  544. })
  545. window.open(routeData.href.slice(1, routeData.href.length));
  546. }).catch(() => {
  547. this.$message({
  548. type: 'info',
  549. message: '已取消' //
  550. });
  551. })
  552. },
  553. derivation() {
  554. window.open(`/api/blade-box-tube/archives/export-archives-info?${this.website.tokenHeader}=${getToken()}`);
  555. },
  556. uploadBefore(file, done, loading) {
  557. loading = true;
  558. done();
  559. },
  560. uploadAfter(res, done, loading, column) {
  561. this.excelBox = false;
  562. this.$message.success("导入成功!");
  563. this.onLoad(this.page, this.search);
  564. loading = false;
  565. done();
  566. },
  567. balabala(val) {
  568. if (val === null) {
  569. this.form.address = ''
  570. } else {
  571. this.form.address = val.name
  572. }
  573. },
  574. getGSData(row) {
  575. this.form.leasingCompany = row.cname
  576. },
  577. //关闭弹窗前
  578. beforeClose(done, type) {
  579. this.onLoad(this.page, this.search)
  580. done()
  581. },
  582. //刷新
  583. refreshChange() {
  584. this.onLoad(this.page, this.search)
  585. },
  586. rowDel(form, index) {
  587. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  588. confirmButtonText: '确定',
  589. cancelButtonText: '取消',
  590. type: 'warning'
  591. }).then(() => {
  592. remove(form.id).then(res => {
  593. this.$message({
  594. type: 'success',
  595. message: '删除成功!'
  596. });
  597. this.onLoad(this.page, this.search)
  598. })
  599. }).catch(() => {
  600. });
  601. },
  602. uploadDelete(file, column) {
  603. return new Promise((resolve, reject)=>{
  604. this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
  605. confirmButtonText: '确定',
  606. cancelButtonText: '取消',
  607. type: 'warning'
  608. }).then(() => {
  609. if (this.form.filesList[file.uid].id){
  610. boxRemove(this.form.filesList[file.uid].id).then(res => {
  611. this.$message({
  612. type: 'success',
  613. message: '删除成功!'
  614. });
  615. resolve();
  616. })
  617. }else {
  618. resolve();
  619. }
  620. }).catch(()=>{
  621. reject();
  622. this.$message({
  623. type: "info",
  624. message: "已取消删除"
  625. });
  626. })
  627. })
  628. },
  629. rowSave(form, done, loading, index) {
  630. done()
  631. addUpdate(form).then(res => {
  632. this.onLoad(this.page, this.search)
  633. })
  634. },
  635. searchChange(params, done) {
  636. done();
  637. this.onLoad(this.page, params)
  638. },
  639. onLoad(page, params = {}) {
  640. params = {
  641. ...params,
  642. current: page.currentPage,
  643. size: page.pageSize,
  644. ...Object.assign(params, this.search)
  645. }
  646. this.loading = true
  647. getList(params).then(res => {
  648. this.dataList = res.data.data.records
  649. this.page.total = res.data.data.total
  650. this.loading = false
  651. }).finally(() => {
  652. this.loading = false
  653. })
  654. },
  655. //自定义列保存
  656. async saveColumnTwo(ref, option, optionBack, code) {
  657. /**
  658. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  659. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  660. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  661. */
  662. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  663. if (inSave) {
  664. this.$message.success("保存成功");
  665. //关闭窗口
  666. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  667. }
  668. },
  669. //自定义列重置
  670. async resetColumnTwo(ref, option, optionBack, code) {
  671. this[option] = this[optionBack];
  672. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  673. if (inSave) {
  674. this.$message.success("重置成功");
  675. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  676. }
  677. },
  678. }
  679. }
  680. </script>
  681. <style scoped>
  682. </style>