index.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  1. <template>
  2. <div>
  3. <basic-container v-if="isShow">
  4. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :search.sync="query"
  5. v-model="form" id="out-table" :header-cell-class-name="headerClassName" ref="crud" @row-del="rowDel"
  6. @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
  7. @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"
  8. @resetColumn="resetColumn('crud', 'option', 'optionBack', 375)"
  9. @saveColumn="saveColumn('crud', 'option', 'optionBack', 375)" @on-load="onLoad">
  10. <template slot="checkboxSearch">
  11. <el-checkbox-group v-model="query.checkbox" @change="handleCheckedChange">
  12. <el-checkbox v-for="item in statusList" :label="item.value" :key="item.value">{{ item.label
  13. }}</el-checkbox>
  14. </el-checkbox-group>
  15. <!-- <avue-form v-model="query.checkbox" :option="checkboxOption"></avue-form> -->
  16. </template>
  17. <template slot="menuLeft">
  18. <el-button type="primary" size="small" icon="el-icon-plus" @click="addButton">新 增
  19. </el-button>
  20. <el-button type="success" size="small" :disabled="selectionList.length != 1" @click="copyButton">复制订单
  21. </el-button>
  22. <el-button type="warning" size="small" @click="outExport">导 出
  23. </el-button>
  24. <el-button type="info" size="small" :disabled="selectionList.length == 0"
  25. @click="allClick('生成申请收款')">生成货款收款
  26. </el-button>
  27. <el-button type="warning" size="small" :disabled="selectionList.length == 0"
  28. @click="allClick('生成申请付款')">生成货款付款
  29. </el-button>
  30. </template>
  31. <template slot="menu" slot-scope="{ row, index }">
  32. <el-button size="small" icon="el-icon-edit" type="text" @click="rowEdit(row)">编辑</el-button>
  33. <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)"
  34. :disabled="row.orderStatus != '录入'">删 除</el-button>
  35. </template>
  36. <template slot="contractNo" slot-scope="{ row }">
  37. <span style="color: #1e9fff" @click="rowEdit(row)">{{ row.contractNo }}</span>
  38. </template>
  39. </avue-crud>
  40. </basic-container>
  41. <detailsPage v-if="!isShow" :detailData="detailData" @goBack="goBack"></detailsPage>
  42. <el-dialog append-to-body title="申请费用" class="el-dialogDeep" :visible.sync="applyDialog" width="70%"
  43. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @closed="applyClosed"
  44. v-dialog-drag>
  45. <avue-crud ref="applyCrud" :data="applyData" :option="applyOptionList" @selection-change="applySelectionChange"
  46. @select="applySelectHandle">
  47. <tempalte slot="thisSettlementAmount" slot-scope="{ row }">
  48. <el-input-number v-if="row.$cellEdit" v-model="row.thisSettlementAmount" @change="applyChange(row)"
  49. :controls="false" placeholder="请输入 本次金额" size="small" style="width: 100%;"></el-input-number>
  50. </tempalte>
  51. </avue-crud>
  52. <span slot="footer" class="dialog-footer">
  53. <el-button size="mini" @click="applyDialog = false">取 消</el-button>
  54. <el-button size="mini" :disabled="applySelectList.length == 0" type="primary" @click="applySubmit">提
  55. 交</el-button>
  56. </span>
  57. </el-dialog>
  58. </div>
  59. </template>
  60. <script>
  61. import { getList, remove, copyAgent, applyForPaymentList, generate } from "@/api/tradeAgency/tradeAgency";
  62. import detailsPage from "./detailsPage";
  63. import { getToken } from "@/util/auth";
  64. export default {
  65. data() {
  66. return {
  67. applyDialog: false,
  68. applyData: [],
  69. applySelectList: [],
  70. detailData: {},
  71. applyOptionList: {
  72. header: false,
  73. tip: false,
  74. border: true,
  75. index: true,
  76. menu: false,
  77. selection: true,
  78. align: 'center',
  79. height: '450',
  80. column: [
  81. {
  82. label: "往来单位",
  83. prop: "corpCnName",
  84. overHidden: true,
  85. },
  86. {
  87. label: "合同号",
  88. prop: "billNo",
  89. overHidden: true,
  90. },
  91. {
  92. label: "提单号",
  93. prop: "mblno",
  94. overHidden: true,
  95. },
  96. {
  97. label: "费用名称",
  98. prop: "feeCnName",
  99. overHidden: true,
  100. },
  101. {
  102. label: "收费标准",
  103. prop: "unitNo",
  104. overHidden: true,
  105. },
  106. {
  107. label: "单价",
  108. prop: "price",
  109. overHidden: true,
  110. },
  111. {
  112. label: "数量",
  113. prop: "quantity",
  114. overHidden: true,
  115. },
  116. {
  117. label: "金额",
  118. prop: "amount",
  119. overHidden: true,
  120. },
  121. ]
  122. },
  123. isShow: true,
  124. form: {},
  125. query: {
  126. checkbox: [],
  127. businessType: 'MYDL',
  128. },
  129. loading: false,
  130. page: {
  131. pageSize: 10,
  132. currentPage: 1,
  133. total: 0
  134. },
  135. selectionList: [],
  136. statusList: [
  137. {
  138. label: '已开船',
  139. value: 'whetherSail'
  140. },
  141. {
  142. label: '已到港',
  143. value: 'whetherReachHarbor'
  144. },
  145. {
  146. label: '已通关',
  147. value: 'whetherClearance'
  148. },
  149. {
  150. label: '已派车',
  151. value: 'whetherDispatchCar'
  152. },
  153. {
  154. label: '已完成',
  155. value: 'whetherComplete'
  156. },
  157. {
  158. label: '已取消',
  159. value: 'whetherCancel'
  160. }
  161. ],
  162. option: {},
  163. optionBack: {
  164. height: 'auto',
  165. calcHeight: 30,
  166. menuWidth: 140,
  167. tip: false,
  168. searchShow: true,
  169. searchMenuSpan: 6,
  170. border: true,
  171. index: true,
  172. addBtn: false,
  173. viewBtn: false,
  174. editBtn: false,
  175. delBtn: false,
  176. selection: true,
  177. searchIcon: true,
  178. searchIndex: 3,
  179. column: [
  180. {
  181. label: "客户名称",
  182. prop: "corpId",
  183. overHidden: true,
  184. search: true,
  185. type: 'select',
  186. filterable: true,
  187. remote: true,
  188. dicUrl: "/api/blade-los/bcorps/listByType?cnName={{key}}",
  189. props: {
  190. label: 'cnName',
  191. value: 'id',
  192. res: 'data.records'
  193. },
  194. hide: true,
  195. showColumn: false,
  196. searchOrder: 1,
  197. },
  198. {
  199. label: "客户名称",
  200. prop: "corpName",
  201. width: "120",
  202. overHidden: true,
  203. },
  204. {
  205. label: "合同号",
  206. prop: "contractNo",
  207. width: "100",
  208. overHidden: true,
  209. search: true,
  210. searchOrder: 2,
  211. },
  212. {
  213. label: "提单号",
  214. prop: "billNo",
  215. width: "80",
  216. overHidden: true,
  217. search: true,
  218. searchOrder: 3,
  219. },
  220. {
  221. label: "放单方式",
  222. prop: "orderReleaseMethod",
  223. width: "120",
  224. overHidden: true,
  225. },
  226. {
  227. label: "订单号",
  228. prop: "orderNo",
  229. width: "80",
  230. overHidden: true,
  231. search: true,
  232. searchOrder: 9,
  233. },
  234. {
  235. label: "箱号",
  236. prop: "boxNo",
  237. width: "80",
  238. overHidden: true,
  239. search: true,
  240. searchOrder: 4,
  241. },
  242. {
  243. label: "订单状态",
  244. prop: "orderStatus",
  245. width: "120",
  246. overHidden: true,
  247. },
  248. {
  249. label: "审核状态",
  250. prop: "businessStatus",
  251. width: "120",
  252. overHidden: true,
  253. },
  254. {
  255. label: "审单状态",
  256. prop: "reviewStatus",
  257. width: "120",
  258. overHidden: true,
  259. search: true,
  260. searchOrder: 5,
  261. type: "select",
  262. dicUrl: "/api/blade-system/dict-biz/dictionary?code=audit_status",
  263. props: {
  264. label: "dictValue",
  265. value: "dictValue"
  266. },
  267. hide: true,
  268. showColumn: false,
  269. },
  270. {
  271. label: "合同日期",
  272. prop: "contractDate",
  273. type: "date",
  274. format: "yyyy-MM-dd",
  275. valueFormat: "yyyy-MM-dd 00:00:00",
  276. width: "120",
  277. overHidden: true
  278. },
  279. {
  280. label: "国家",
  281. prop: "country",
  282. width: "80",
  283. overHidden: true
  284. },
  285. {
  286. label: "通关进度",
  287. prop: "clearanceSpeedOfProgress",
  288. width: "120",
  289. overHidden: true,
  290. search: true,
  291. searchOrder: 11,
  292. },
  293. {
  294. label: "收货款",
  295. prop: "whetherReceivedDownPayments",
  296. width: "120",
  297. overHidden: true,
  298. search: true,
  299. searchOrder: 12,
  300. type: "select",
  301. dicUrl: "/api/blade-system/dict-biz/dictionary?code=received_down",
  302. props: {
  303. label: "dictValue",
  304. value: "dictValue"
  305. },
  306. hide: true,
  307. showColumn: false,
  308. },
  309. {
  310. label: "付汇",
  311. prop: "whetherReceivedBalancePayment",
  312. width: "120",
  313. overHidden: true,
  314. search: true,
  315. searchOrder: 13,
  316. type: "select",
  317. dicUrl: "/api/blade-system/dict-biz/dictionary?code=received_balance",
  318. props: {
  319. label: "dictValue",
  320. value: "dictValue"
  321. },
  322. hide: true,
  323. showColumn: false,
  324. },
  325. {
  326. label: "付汇记录",
  327. prop: "paymentRecord",
  328. width: "120",
  329. overHidden: true
  330. },
  331. {
  332. label: "运输方式",
  333. prop: "typeOfShipping",
  334. width: "120",
  335. overHidden: true
  336. },
  337. {
  338. label: "起运港",
  339. prop: "polCnName",
  340. width: "80",
  341. overHidden: true
  342. },
  343. {
  344. label: "目的港",
  345. prop: "podCnName",
  346. width: "80",
  347. overHidden: true
  348. },
  349. {
  350. label: "开船日期",
  351. prop: "etd",
  352. width: "120",
  353. overHidden: true,
  354. search: true,
  355. searchOrder: 6,
  356. searchProp: "etdList",
  357. type: "date",
  358. unlinkPanels: true,
  359. searchRange: true,
  360. format: "yyyy-MM-dd",
  361. valueFormat: "yyyy-MM-dd HH:mm:ss",
  362. searchDefaultTime: ["00:00:00", "23:59:59"],
  363. },
  364. {
  365. label: "预计到港",
  366. prop: "estimateReachHarbor",
  367. width: "120",
  368. overHidden: true,
  369. search: true,
  370. searchOrder: 7,
  371. searchProp: "estimateReachHarborList",
  372. type: "date",
  373. unlinkPanels: true,
  374. searchRange: true,
  375. format: "yyyy-MM-dd",
  376. valueFormat: "yyyy-MM-dd HH:mm:ss",
  377. searchDefaultTime: ["00:00:00", "23:59:59"],
  378. },
  379. {
  380. label: "实际到港",
  381. prop: "actualReachHarbor",
  382. width: "120",
  383. overHidden: true,
  384. search: true,
  385. searchOrder: 8,
  386. searchProp: "actualReachHarborList",
  387. type: "date",
  388. unlinkPanels: true,
  389. searchRange: true,
  390. format: "yyyy-MM-dd",
  391. valueFormat: "yyyy-MM-dd HH:mm:ss",
  392. searchDefaultTime: ["00:00:00", "23:59:59"],
  393. },
  394. {
  395. label: "PI发票号",
  396. prop: "InvoiceNo",
  397. width: "120",
  398. overHidden: true,
  399. search: true,
  400. searchOrder: 10,
  401. hide: true,
  402. showColumn: false,
  403. },
  404. {
  405. label: "币别",
  406. prop: "currency",
  407. width: "80",
  408. overHidden: true
  409. },
  410. {
  411. label: "总金额(USD)",
  412. prop: "amount",
  413. width: "100",
  414. overHidden: true
  415. },
  416. {
  417. label: "预付比例",
  418. prop: "advanceRatio",
  419. width: "120",
  420. overHidden: true
  421. },
  422. {
  423. label: "预付金额",
  424. prop: "prepaidAmount",
  425. width: "120",
  426. overHidden: true
  427. },
  428. {
  429. label: "铅封号",
  430. prop: "leadSealNo",
  431. width: "80",
  432. overHidden: true
  433. },
  434. {
  435. label: "金额",
  436. prop: "amount",
  437. width: "100",
  438. overHidden: true
  439. },
  440. {
  441. label: "首付实收",
  442. prop: "downPaymentsNetReceipts",
  443. width: "120",
  444. overHidden: true
  445. },
  446. {
  447. label: "尾款实收",
  448. prop: "mblno",
  449. width: "120",
  450. overHidden: true
  451. },
  452. {
  453. label: "备注",
  454. prop: "remarks",
  455. width: "80",
  456. overHidden: true
  457. },
  458. {
  459. label: "多选",
  460. prop: "checkbox",
  461. overHidden: true,
  462. search: true,
  463. searchSpan: 12,
  464. searchOrder: 14,
  465. hide: true,
  466. showColumn: false,
  467. }
  468. ]
  469. },
  470. data: [],
  471. };
  472. },
  473. components: {
  474. detailsPage,
  475. },
  476. async created() {
  477. this.option = await this.getColumnData(this.getColumnName(375), this.optionBack);
  478. },
  479. methods: {
  480. handleCheckedChange() {
  481. delete this.query.whetherSail
  482. delete this.query.whetherReachHarbor
  483. delete this.query.whetherClearance
  484. delete this.query.whetherDispatchCar
  485. delete this.query.whetherComplete
  486. delete this.query.whetherCancel
  487. if (this.query.checkbox) {
  488. this.query.checkbox.forEach(e => {
  489. this.query[e] = 1
  490. })
  491. }
  492. },
  493. applySelectionChange(list) {
  494. this.applySelectList = list;
  495. },
  496. applySelectHandle(selection, row) {
  497. if (row.feeType) {
  498. // 取消其中一个选中的时候 默认取消同单号的选中
  499. if (!selection.includes(row)) {
  500. this.pickUp(false, row.feeType);
  501. } else {
  502. this.pickUp(true, row.feeType);
  503. }
  504. }
  505. },
  506. // 需要默认勾选/取消的数据
  507. pickUp(bool, feeType) {
  508. let arr = [];
  509. this.applyData.forEach(e => {
  510. if (feeType == e.feeType) {
  511. arr.push(e)
  512. }
  513. })
  514. this.toggleSelection(arr, bool);
  515. },
  516. // 默认选择/取消中的行
  517. toggleSelection(rows, bool) {
  518. if (rows) {
  519. this.$nextTick(() => {
  520. rows.forEach(row => {
  521. this.$refs.applyCrud.toggleRowSelection(row, bool);
  522. });
  523. });
  524. } else {
  525. this.$refs.applyCrud.clearSelection();
  526. }
  527. },
  528. applyClosed() {
  529. this.applyData = []
  530. },
  531. applySubmit() {
  532. const loading = this.$loading({
  533. lock: true,
  534. text: '加载中',
  535. spinner: 'el-icon-loading',
  536. background: 'rgba(255,255,255,0.7)'
  537. });
  538. generate(this.applySelectList).then(res => {
  539. this.$message.success("生成成功");
  540. this.applyDialog = false;
  541. this.onLoad(this.page);
  542. }).finally(() => {
  543. loading.close();
  544. })
  545. },
  546. addButton() {
  547. this.isShow = false
  548. },
  549. copyButton() {
  550. this.isShow = false
  551. this.detailData = {
  552. copyId: this.selectionList[0].id
  553. };
  554. },
  555. allClick(name) {
  556. if (name == '生成申请付款') {
  557. let ids = []
  558. this.selectionList.forEach(item => {
  559. ids.push(item.id)
  560. })
  561. this.$confirm('是否生成申请付款?', '提示', {
  562. confirmButtonText: '确定',
  563. cancelButtonText: '取消',
  564. type: 'warning'
  565. }).then(() => {
  566. applyForPaymentList({ ids: ids.join(','), dc: 'C' }).then(res => {
  567. this.applyDialog = true
  568. this.applyData = res.data.data
  569. })
  570. })
  571. }
  572. if (name == '生成申请收款') {
  573. let ids = []
  574. this.selectionList.forEach(item => {
  575. ids.push(item.id)
  576. })
  577. this.$confirm('是否生成申请收款?', '提示', {
  578. confirmButtonText: '确定',
  579. cancelButtonText: '取消',
  580. type: 'warning'
  581. }).then(() => {
  582. applyForPaymentList({ ids: ids.join(','), dc: 'D' }).then(res => {
  583. this.applyDialog = true
  584. this.applyData = res.data.data
  585. })
  586. })
  587. }
  588. },
  589. rowEdit(row) {
  590. this.detailData = {
  591. id: row.id
  592. };
  593. this.isShow = false
  594. },
  595. // 删除
  596. rowDel(row, index) {
  597. this.$confirm("确定将选择数据删除?", {
  598. confirmButtonText: "确定",
  599. cancelButtonText: "取消",
  600. type: "warning"
  601. }).then(() => {
  602. remove({ ids: row.id }).then(res => {
  603. this.onLoad(this.page, this.query);
  604. this.$message.success("成功删除");
  605. })
  606. })
  607. },
  608. // 编辑
  609. inEdit(row) {
  610. },
  611. searchReset() {
  612. this.query = this.$options.data().query;
  613. this.onLoad(this.page);
  614. },
  615. // 搜索按钮点击
  616. searchChange(params, done) {
  617. this.page.currentPage = 1;
  618. this.onLoad(this.page, this.query);
  619. done();
  620. },
  621. selectionChange(list) {
  622. this.selectionList = list;
  623. },
  624. currentChange(currentPage) {
  625. this.page.currentPage = currentPage;
  626. },
  627. sizeChange(pageSize) {
  628. this.page.pageSize = pageSize;
  629. },
  630. refreshChange() {
  631. this.onLoad(this.page, this.query);
  632. },
  633. onLoad(page, params = {}) {
  634. let obj = {}
  635. obj = {
  636. ...Object.assign(params, this.query),
  637. }
  638. this.loading = true;
  639. getList(page.currentPage, page.pageSize, obj).then(res => {
  640. this.data = res.data.data.records;
  641. console.log(res.data.data.records)
  642. this.page.total = res.data.data.total;
  643. console.log(this.page.total)
  644. this.$nextTick(() => {
  645. this.$refs.crud.doLayout();
  646. this.$refs.crud.dicInit();
  647. });
  648. }).finally(() => {
  649. this.loading = false;
  650. })
  651. },
  652. // 详情的返回列表
  653. goBack() {
  654. // 初始化数据
  655. // if (JSON.stringify(this.$route.query) != "{}") {
  656. // this.$router.$avueRouter.closeTag();
  657. // this.$router.push({
  658. // path: "/iosBasicData/accounts/index"
  659. // });
  660. // }
  661. this.detailData = {}
  662. this.isShow = true;
  663. this.onLoad(this.page, this.query);
  664. },
  665. outExport() {
  666. let config = { params: { ...this.query } }
  667. if (config.params) {
  668. for (const propName of Object.keys(config.params)) {
  669. const value = config.params[propName];
  670. if (value !== null && typeof (value) !== "undefined") {
  671. if (value instanceof Array) {
  672. for (const key of Object.keys(value)) {
  673. let params = propName + '[' + key + ']';
  674. config.params[params] = value[key]
  675. }
  676. delete config.params[propName]
  677. }
  678. }
  679. }
  680. }
  681. const routeData = this.$router.resolve({
  682. path: '/api/blade-los/agentview/export', //跳转目标窗口的地址
  683. query: {
  684. ...config.params, //括号内是要传递给新窗口的参数
  685. identification: this.url
  686. }
  687. })
  688. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  689. },
  690. //自定义列保存
  691. async saveColumn(ref, option, optionBack, code) {
  692. /**
  693. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  694. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  695. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  696. */
  697. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  698. if (inSave) {
  699. this.$message.success("保存成功");
  700. //关闭窗口
  701. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  702. this.queryReset()
  703. }
  704. },
  705. //自定义列重置
  706. async resetColumn(ref, option, optionBack, code) {
  707. this[option] = this[optionBack];
  708. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  709. if (inSave) {
  710. this.$message.success("重置成功");
  711. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  712. this.queryReset()
  713. }
  714. },
  715. // 更改表格颜色
  716. headerClassName(tab) {
  717. //颜色间隔
  718. let back = ""
  719. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  720. if (tab.columnIndex % 2 === 0) {
  721. back = "back-one"
  722. } else if (tab.columnIndex % 2 === 1) {
  723. back = "back-two"
  724. }
  725. }
  726. return back;
  727. },
  728. }
  729. }
  730. </script>
  731. <style scoped>
  732. ::v-deep#out-table .back-one {
  733. background: #ecf5ff !important;
  734. text-align: center;
  735. }
  736. ::v-deep#out-table .back-two {
  737. background: #ecf5ff !important;
  738. text-align: center;
  739. }
  740. .pointerClick {
  741. cursor: pointer;
  742. color: #1e9fff;
  743. }
  744. ::v-deep .el-col-md-8 {
  745. width: 24.33333%;
  746. }
  747. </style>