index.vue 22 KB

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