index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. <template>
  2. <div>
  3. <basic-container v-if="isShow">
  4. <avue-crud
  5. :option="option"
  6. :table-loading="loading"
  7. :data="data"
  8. :page.sync="page"
  9. :search.sync="query"
  10. v-model="form"
  11. id="out-table"
  12. :header-cell-class-name="headerClassName"
  13. ref="crud"
  14. @row-del="rowDel"
  15. @search-change="searchChange"
  16. @search-reset="searchReset"
  17. @selection-change="selectionChange"
  18. @current-change="currentChange"
  19. @size-change="sizeChange"
  20. @refresh-change="refreshChange"
  21. @resetColumn="resetColumn('crud', 'option', 'optionBack', 532)"
  22. @saveColumn="saveColumn('crud', 'option', 'optionBack', 532)"
  23. @on-load="onLoad"
  24. >
  25. <template slot="menuLeft">
  26. <el-tabs v-model="query.changeOrderStatus" type="card" @tab-click="handleClick">
  27. <el-tab-pane label="申请" name="申请"></el-tab-pane>
  28. <el-tab-pane label="已换单" name="已换单"></el-tab-pane>
  29. </el-tabs>
  30. <el-button type="primary" size="small" @click="allClick('确认设备单')" :disabled="selectionList.length == 0">确认设备单 </el-button>
  31. <el-button type="success" size="small" @click="allClick('导出')">导出 </el-button>
  32. <el-button type="primary" size="small" @click="allClick('收押箱款')" :disabled="selectionList.length == 0">收押箱款 </el-button>
  33. <el-button type="success" size="small" @click="allClick('退押箱款')" :disabled="selectionList.length == 0">退押箱款 </el-button>
  34. <el-button size="small" style="margin-right: 8px" :disabled="selectionList.length != 1" @click="$refs.print.openDialog()">预 览 </el-button>
  35. <el-button
  36. v-if="roleName.indexOf('admin') != -1"
  37. size="small"
  38. style="margin-right: 8px"
  39. :disabled="selectionList.length != 1"
  40. @click="$refs.report.openDialog()"
  41. >报表设计
  42. </el-button>
  43. </template>
  44. <template slot="menu" slot-scope="{ row, index }">
  45. <el-button v-if="row.changeOrderStatus == '申请'" size="small" type="text" @click="allClick('确认换单', row)">确认换单</el-button>
  46. <el-button size="small" type="text" @click="allClick('上传附件', row)">上传附件</el-button>
  47. </template>
  48. </avue-crud>
  49. </basic-container>
  50. <el-dialog title="导入数据" append-to-body :visible.sync="excelBox" width="555px" :close-on-click-modal="false" v-dialog-drag>
  51. <avue-form
  52. v-if="excelBox"
  53. :option="excelOption"
  54. v-model="excelForm"
  55. :table-loading="excelLoading"
  56. :upload-before="uploadBefore"
  57. :upload-after="onSuccess"
  58. >
  59. <template slot="excelTemplate">
  60. <el-button type="primary" @click="handleGet"> 点击下载<i class="el-icon-download el-icon--right"></i> </el-button>
  61. </template>
  62. <template slot="corpCnName">
  63. <dic-select
  64. v-model="excelForm.corpCnName"
  65. placeholder="场站"
  66. key="id"
  67. :slotRight="true"
  68. rightLabel="code"
  69. label="shortName"
  70. res="records"
  71. url="/blade-los/bcorps/selectList?status=0&current=1&size=5&corpTypeName=场站"
  72. :filterable="true"
  73. :remote="true"
  74. dataName="shortName"
  75. @selectChange="dicChange('corpCnName', $event)"
  76. >
  77. </dic-select>
  78. </template>
  79. </avue-form>
  80. <p style="text-align: center;color: #DC0505">
  81. 温馨提示 第一次导入时请先下载模板
  82. </p>
  83. </el-dialog>
  84. <business-reports :id="id" ref="print" businessValue="YASJ" :printUpdate="false" :type="true"></business-reports>
  85. <reports :id="id" businessValue="YASJ" ref="report" :printUpdate="false"></reports>
  86. <file-update ref="file"></file-update>
  87. </div>
  88. </template>
  89. <script>
  90. import {
  91. getList,
  92. confirmExchangeOrder,
  93. confirmEquipmentList,
  94. confirmPaymentCollection,
  95. confirmRefund,
  96. changeOrderFile,
  97. changeOrderList
  98. } from "@/api/iosBasicData/ImportExchange.js";
  99. import dicSelect from "@/components/dicSelect/main";
  100. import fileUpdate from "./components/fileUpdate.vue";
  101. import businessReports from "@/components/boxManagement/businessReports.vue";
  102. import reports from "@/components/boxManagement/reports.vue";
  103. import { getToken } from "@/util/auth";
  104. import _ from "lodash";
  105. export default {
  106. data() {
  107. return {
  108. id: null,
  109. excelBox: false,
  110. excelForm: {},
  111. excelLoading: false,
  112. excelOption: {
  113. submitBtn: false,
  114. emptyBtn: false,
  115. column: [
  116. {
  117. label: "场站",
  118. span: 24,
  119. prop: "corpCnName",
  120. // type: 'select',
  121. // filterable: true,
  122. // remote: true,
  123. // dicUrl: "/api/blade-los/bcorps/selectList?status=0&corpTypeName=场站&size=5&current=1&shortName={{key}}",
  124. // props: {
  125. // label: "shortName",
  126. // value: "id",
  127. // desc: 'code',
  128. // res: "data.records"
  129. // },
  130. rules: [
  131. {
  132. required: true,
  133. message: "选择场站",
  134. trigger: "blur"
  135. }
  136. ],
  137. display: false
  138. },
  139. {
  140. label: "模板下载",
  141. prop: "excelTemplate",
  142. formslot: true,
  143. span: 24,
  144. display: true
  145. },
  146. {
  147. label: "模板上传",
  148. prop: "excelFile",
  149. type: "upload",
  150. drag: true,
  151. loadText: "模板上传中,请稍等",
  152. span: 24,
  153. propsHttp: {
  154. res: "data"
  155. },
  156. tip: "请上传 .xls,.xlsx 标准格式文件",
  157. action: "/api/blade-los/boxdynamicsrecord/importExcel?type=CC"
  158. }
  159. ]
  160. },
  161. isShow: true,
  162. form: {},
  163. query: {
  164. changeOrderStatus: "申请"
  165. },
  166. loading: false,
  167. page: {
  168. pageSize: 10,
  169. currentPage: 1,
  170. total: 0
  171. },
  172. selectionList: [],
  173. option: {},
  174. optionBack: {
  175. height: "auto",
  176. calcHeight: 30,
  177. menuWidth: 160,
  178. tip: false,
  179. searchShow: true,
  180. searchMenuSpan: 24,
  181. border: true,
  182. index: true,
  183. addBtn: false,
  184. viewBtn: false,
  185. editBtn: false,
  186. delBtn: false,
  187. selection: true,
  188. searchIcon: true,
  189. align: "center",
  190. searchIndex: 3,
  191. column: [
  192. {
  193. label: "所属公司",
  194. prop: "branchId",
  195. width: "120",
  196. search: true,
  197. overHidden: true,
  198. hide: true,
  199. type: "select",
  200. filterable: true,
  201. dicUrl: "/api/blade-system/dept/lazy-list",
  202. props: {
  203. label: "deptName",
  204. value: "id"
  205. }
  206. },
  207. {
  208. label: "系统号",
  209. prop: "billNo",
  210. width: "120",
  211. overHidden: true
  212. },
  213. {
  214. label: "收据号",
  215. prop: "iqNo",
  216. width: "120",
  217. overHidden: true
  218. },
  219. {
  220. label: "换单状态",
  221. prop: "changeOrderStatus",
  222. width: "80",
  223. overHidden: true
  224. },
  225. {
  226. label: "提货单状态",
  227. prop: "deliveryNoteStatus",
  228. width: "100",
  229. overHidden: true
  230. },
  231. {
  232. label: "设备单状态",
  233. prop: "equipmentSingleStatus",
  234. width: "100",
  235. overHidden: true
  236. },
  237. {
  238. label: "押箱金额",
  239. prop: "boxPackingAmount",
  240. width: "80",
  241. overHidden: true
  242. },
  243. {
  244. label: "收押箱款日期",
  245. prop: "harvestBoxPackingDate",
  246. width: "100",
  247. overHidden: true
  248. },
  249. {
  250. label: "退押箱款日期",
  251. prop: "retreatBoxPackingDate",
  252. width: "100",
  253. overHidden: true
  254. },
  255. {
  256. label: "客户名称",
  257. prop: "corpCnName",
  258. width: "100",
  259. search: true,
  260. overHidden: true,
  261. type: "select",
  262. filterable: true,
  263. remote: true,
  264. dicUrl: "/api/blade-los/bcorps/listByType?shortName={{key}}",
  265. props: {
  266. label: "cnName",
  267. value: "cnName",
  268. res: "data.records"
  269. }
  270. },
  271. {
  272. label: "MB/L NO",
  273. prop: "mblno",
  274. width: "100",
  275. search: true,
  276. overHidden: true
  277. },
  278. {
  279. label: "HB/L NO",
  280. prop: "hblno",
  281. width: "100",
  282. search: true,
  283. overHidden: true
  284. },
  285. {
  286. label: "船名",
  287. prop: "vesselEnName",
  288. width: "100",
  289. overHidden: true
  290. },
  291. {
  292. label: "航次",
  293. prop: "voyageNo",
  294. width: "60",
  295. overHidden: true
  296. },
  297. {
  298. label: "ETA",
  299. prop: "eta",
  300. width: "100",
  301. overHidden: true
  302. },
  303. {
  304. label: "ATA",
  305. prop: "actualEta",
  306. width: "100",
  307. overHidden: true
  308. },
  309. {
  310. label: "箱型/箱量",
  311. prop: "quantityCntrDescr",
  312. width: "100",
  313. overHidden: true
  314. },
  315. {
  316. label: "应收本币",
  317. prop: "amountDr",
  318. width: "80",
  319. overHidden: true
  320. },
  321. {
  322. label: "应收外币",
  323. prop: "amountDrUsd",
  324. width: "80",
  325. overHidden: true
  326. },
  327. {
  328. label: "实收本币",
  329. prop: "receivedAmountDr",
  330. width: "80",
  331. overHidden: true
  332. },
  333. {
  334. label: "实收外币",
  335. prop: "receivedAmountDrUsd",
  336. width: "80",
  337. overHidden: true
  338. },
  339. {
  340. label: "制单人",
  341. prop: "createUserName",
  342. overHidden: true,
  343. width: 80
  344. },
  345. {
  346. label: "制单日期",
  347. prop: "createTime",
  348. type: "date",
  349. overHidden: true,
  350. width: 100,
  351. format: "yyyy-MM-dd",
  352. valueFormat: "yyyy-MM-dd HH:mm:ss"
  353. },
  354. {
  355. label: "修改人",
  356. prop: "updateUserName",
  357. overHidden: true,
  358. width: 80
  359. },
  360. {
  361. label: "修改日期",
  362. prop: "updateTime",
  363. type: "date",
  364. overHidden: true,
  365. width: 100,
  366. format: "yyyy-MM-dd",
  367. valueFormat: "yyyy-MM-dd HH:mm:ss"
  368. }
  369. ]
  370. },
  371. data: [],
  372. roleName: []
  373. };
  374. },
  375. components: {
  376. dicSelect,
  377. fileUpdate,
  378. businessReports,
  379. reports
  380. },
  381. async created() {
  382. this.roleName = localStorage.getItem("roleName").split(",");
  383. this.option = await this.getColumnData(this.getColumnName(532), this.optionBack);
  384. },
  385. activated() {
  386. setTimeout(() => {}, 100);
  387. },
  388. methods: {
  389. allClick(name, row) {
  390. if (name == "确认设备单") {
  391. this.$confirm("是否确认设备单?", "提示", {
  392. confirmButtonText: "确定",
  393. cancelButtonText: "取消",
  394. type: "warning"
  395. }).then(() => {
  396. let ids = [];
  397. for (let item of this.selectionList) {
  398. ids.push(item.id);
  399. }
  400. let obj = {
  401. ids: ids.join(",")
  402. };
  403. confirmEquipmentList(obj).then(res => {
  404. this.$message({
  405. type: "success",
  406. message: "操作成功!"
  407. });
  408. this.refreshChange();
  409. });
  410. });
  411. }
  412. if (name == "收押箱款") {
  413. let sum = 0;
  414. let ids=[]
  415. for (let item of this.selectionList) {
  416. ids.push(item.id)
  417. sum += Number(item.boxPackingAmount ? item.boxPackingAmount : 0);
  418. }
  419. this.$DialogForm.show({
  420. title: "收押箱款",
  421. width: "30%",
  422. menuPosition: "right",
  423. data: { amount: sum,corpName:this.selectionList[0].corpCnName },
  424. option: {
  425. submitText: "确定",
  426. emptyText: "取消",
  427. // labelWidth: 130,
  428. column: [
  429. {
  430. label: "日期",
  431. span: 24,
  432. prop: "harvestBoxPackingDate",
  433. type: "date",
  434. format: "yyyy-MM-dd",
  435. valueFormat: "yyyy-MM-dd 00:00:00",
  436. rules: [
  437. {
  438. required: true,
  439. message: "",
  440. trigger: "blur"
  441. }
  442. ]
  443. },
  444. {
  445. label: "金额",
  446. span: 24,
  447. prop: "amount",
  448. type: "number",
  449. controls: false
  450. },
  451. {
  452. label: "付款单位",
  453. span: 24,
  454. prop: "corpName"
  455. },
  456. {
  457. label: "支票号",
  458. span: 24,
  459. prop: "chequeNumber"
  460. }
  461. ]
  462. },
  463. beforeClose: done => {
  464. done();
  465. },
  466. callback: res => {
  467. res.done();
  468. let obj = {
  469. ids: ids.join(','),
  470. ...res.data
  471. };
  472. confirmPaymentCollection(obj).then(res => {
  473. this.$message({
  474. type: "success",
  475. message: "操作成功!"
  476. });
  477. this.refreshChange();
  478. });
  479. res.close();
  480. }
  481. });
  482. }
  483. if (name == "退押箱款") {
  484. this.$DialogForm.show({
  485. title: "退押箱款",
  486. width: "30%",
  487. menuPosition: "right",
  488. option: {
  489. submitText: "确定",
  490. emptyText: "取消",
  491. // labelWidth: 130,
  492. column: [
  493. {
  494. label: "日期",
  495. span: 24,
  496. prop: "retreatBoxPackingDate",
  497. type: "date",
  498. format: "yyyy-MM-dd",
  499. valueFormat: "yyyy-MM-dd 00:00:00",
  500. rules: [
  501. {
  502. required: true,
  503. message: "",
  504. trigger: "blur"
  505. }
  506. ]
  507. }
  508. ]
  509. },
  510. beforeClose: done => {
  511. done();
  512. },
  513. callback: res => {
  514. res.done();
  515. let obj = {
  516. id: this.selectionList[0].id,
  517. ...res.data
  518. };
  519. confirmRefund(obj).then(res => {
  520. this.$message({
  521. type: "success",
  522. message: "操作成功!"
  523. });
  524. this.refreshChange();
  525. });
  526. res.close();
  527. }
  528. });
  529. }
  530. if (name == "确认换单") {
  531. this.$confirm("是否确认换单?", "提示", {
  532. confirmButtonText: "确定",
  533. cancelButtonText: "取消",
  534. type: "warning"
  535. }).then(() => {
  536. let obj = {
  537. id: row.id
  538. };
  539. confirmExchangeOrder(obj).then(res => {
  540. this.$message({
  541. type: "success",
  542. message: "操作成功!"
  543. });
  544. this.refreshChange();
  545. });
  546. });
  547. }
  548. if (name == "上传附件") {
  549. this.$refs.file.openDialog(row);
  550. }
  551. },
  552. uploadBefore(file, done, loading) {
  553. done();
  554. loading = true;
  555. },
  556. // 上传成功
  557. onSuccess(res, done, loading, column) {
  558. if (res == "操作成功" || res.msg == "操作成功") {
  559. this.$message.success("上传成功!");
  560. }
  561. this.excelBox = false;
  562. // this.$message.success("导入成功!");
  563. loading = false;
  564. this.onLoad(this.page, this.query);
  565. done();
  566. },
  567. // 下载模板
  568. handleGet() {
  569. window.open(`/api/blade-los/boxdynamicsrecord/exportTemplate?${this.website.tokenHeader}=${getToken()}`);
  570. },
  571. rowEdit(row) {},
  572. searchReset() {
  573. this.query = this.$options.data().query;
  574. this.onLoad(this.page);
  575. },
  576. // 搜索按钮点击
  577. searchChange(params, done) {
  578. this.page.currentPage = 1;
  579. this.onLoad(this.page, this.query);
  580. done();
  581. },
  582. selectionChange(list) {
  583. this.id = null;
  584. if (list.length == 1) {
  585. this.id = list[0].iqNo;
  586. }
  587. this.selectionList = list;
  588. },
  589. currentChange(currentPage) {
  590. this.page.currentPage = currentPage;
  591. },
  592. sizeChange(pageSize) {
  593. this.page.pageSize = pageSize;
  594. },
  595. refreshChange() {
  596. this.onLoad(this.page, this.query);
  597. },
  598. handleClick() {
  599. this.onLoad(this.page, this.query);
  600. },
  601. onLoad(page, params = {}) {
  602. let obj = {};
  603. obj = {
  604. ...Object.assign(params, this.query)
  605. };
  606. this.loading = true;
  607. getList(page.currentPage, page.pageSize, obj)
  608. .then(res => {
  609. this.data = res.data.data.records;
  610. this.page.total = res.data.data.total;
  611. this.$nextTick(() => {
  612. this.$refs.crud.doLayout();
  613. this.$refs.crud.dicInit();
  614. });
  615. })
  616. .finally(() => {
  617. this.loading = false;
  618. });
  619. },
  620. // 详情的返回列表
  621. goBack() {
  622. // 初始化数据
  623. this.detailData = {};
  624. this.isShow = true;
  625. this.onLoad(this.page, this.query);
  626. },
  627. outExport() {
  628. let config = { params: { ...this.query } };
  629. if (config.params) {
  630. for (const propName of Object.keys(config.params)) {
  631. const value = config.params[propName];
  632. if (value !== null && typeof value !== "undefined") {
  633. if (value instanceof Array) {
  634. for (const key of Object.keys(value)) {
  635. let params = propName + "[" + key + "]";
  636. config.params[params] = value[key];
  637. }
  638. delete config.params[propName];
  639. }
  640. }
  641. }
  642. }
  643. const routeData = this.$router.resolve({
  644. path: "/api/blade-los/routecost/exportRouteCost", //跳转目标窗口的地址
  645. query: {
  646. ...config.params, //括号内是要传递给新窗口的参数
  647. identification: this.url
  648. }
  649. });
  650. window.open(routeData.href.slice(1, routeData.href.length) + "&" + `${this.website.tokenHeader}=${getToken()}`);
  651. },
  652. //自定义列保存
  653. async saveColumn(ref, option, optionBack, code) {
  654. /**
  655. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  656. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  657. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  658. */
  659. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  660. if (inSave) {
  661. this.$message.success("保存成功");
  662. //关闭窗口
  663. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  664. this.selectionList = [];
  665. this.searchReset();
  666. }
  667. },
  668. //自定义列重置
  669. async resetColumn(ref, option, optionBack, code) {
  670. this[option] = this[optionBack];
  671. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  672. if (inSave) {
  673. this.$message.success("重置成功");
  674. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  675. this.selectionList = [];
  676. this.searchReset();
  677. }
  678. },
  679. // 更改表格颜色
  680. headerClassName(tab) {
  681. //颜色间隔
  682. let back = "";
  683. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  684. if (tab.columnIndex % 2 === 0) {
  685. back = "back-one";
  686. } else if (tab.columnIndex % 2 === 1) {
  687. back = "back-two";
  688. }
  689. }
  690. return back;
  691. }
  692. }
  693. };
  694. </script>
  695. <style lang="scss" scoped>
  696. ::v-deep #out-table .back-one {
  697. background: #ecf5ff !important;
  698. text-align: center;
  699. }
  700. ::v-deep #out-table .back-two {
  701. background: #ecf5ff !important;
  702. text-align: center;
  703. }
  704. .pointerClick {
  705. cursor: pointer;
  706. color: #1e9fff;
  707. }
  708. ::v-deep .el-col-md-8 {
  709. width: 24.33333%;
  710. }
  711. </style>