index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. <template>
  2. <div>
  3. <basic-container v-if="isShow">
  4. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :permission="permissionList"
  5. id="out-table" :header-cell-class-name="headerClassName" :before-open="beforeOpen" v-model="form" ref="crud"
  6. @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel" @search-change="searchChange"
  7. @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
  8. @size-change="sizeChange" @refresh-change="refreshChange"
  9. @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 315)"
  10. @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 315)" @on-load="onLoad" @expand-change="expandChange">
  11. <template slot="expand" slot-scope="{row}">
  12. <finstlbillsitems :tableData="row.finStlBillsItemsList || []" :brfalse="false"></finstlbillsitems>
  13. </template>
  14. <template slot="menuLeft">
  15. <el-button type="success" size="small" icon="el-icon-plus" plain @click="newbillFun">新建账单
  16. </el-button>
  17. <el-button type="danger" size="small" icon="el-icon-delete" plain @click="handleDelete">删 除
  18. </el-button>
  19. </template>
  20. <template slot="menu" slot-scope="{row}">
  21. <el-button type="text" size="small" @click="editFun(row)">编辑
  22. </el-button>
  23. <el-button type="text" size="small" @click="rowDel(row)">删除
  24. </el-button>
  25. </template>
  26. </avue-crud>
  27. </basic-container>
  28. <finstlbillsDetails ref="finstlbillsDetails" v-if="!isShow" :editSave="editSave" @goBack="goBack">
  29. </finstlbillsDetails>
  30. </div>
  31. </template>
  32. <script>
  33. import { finstlbillsList, finstlbillsDetail, finstlbillsSubmit, finstlbillsRemove, finstlbillsitemsList } from "@/api/iosBasicData/finstlbills";
  34. import { mapGetters } from "vuex";
  35. import finstlbillsDetails from '@/views/iosBasicData/CollectionSettlement/finstlbillsDetails.vue'
  36. import { getWorkDicts } from "@/api/system/dictbiz";
  37. import finstlbillsitems from "@/views/iosBasicData/CollectionSettlement/assembly/finstlbillsitems.vue";
  38. import { getRateList } from "@/api/iosBasicData/rateManagement";
  39. export default {
  40. components: { finstlbillsitems, finstlbillsDetails },
  41. data() {
  42. return {
  43. // 详情页面和列表切换
  44. isShow: true,
  45. form: {},
  46. query: {},
  47. loading: true,
  48. page: {
  49. pageSize: 10,
  50. currentPage: 1,
  51. total: 0
  52. },
  53. selectionList: [],
  54. option: {},
  55. optionBack: {
  56. height: 'auto',
  57. calcHeight: 30,
  58. tip: false,
  59. searchShow: true,
  60. searchMenuSpan: 6,
  61. searchIcon: true,
  62. searchIndex: 3,
  63. border: true,
  64. index: true,
  65. viewBtn: true,
  66. selection: true,
  67. dialogClickModal: false,
  68. menuWidth: 100,
  69. expand: true,
  70. rowKey: 'id',
  71. column: [
  72. {
  73. label: "业务类型",
  74. prop: "businessType",
  75. overHidden: true,
  76. },
  77. {
  78. label: "MB/L NO",
  79. prop: "mblno",
  80. search: true,
  81. overHidden: true,
  82. },
  83. {
  84. label: "单据编号",
  85. prop: "billNo",
  86. search: true,
  87. overHidden: true,
  88. },
  89. {
  90. label: "对账/结算日期",
  91. prop: "billDate",
  92. width: "150",
  93. overHidden: true,
  94. },
  95. {
  96. label: "客户名称",
  97. prop: "corpCnName",
  98. search: true,
  99. width: "120",
  100. overHidden: true,
  101. },
  102. {
  103. label: "客户英文名称",
  104. prop: "corpEnName",
  105. width: "120",
  106. overHidden: true,
  107. },
  108. {
  109. label: "客户是否已签约",
  110. prop: "corpIsSigned",
  111. width: "120",
  112. dicData: [],
  113. props: {
  114. label: "dictValue",
  115. value: "dictKey"
  116. },
  117. },
  118. {
  119. label: "客户约号",
  120. prop: "corpArgreementNo",
  121. overHidden: true,
  122. },
  123. {
  124. label: "客户账期备注",
  125. prop: "corpAccRemarks",
  126. width: "120",
  127. overHidden: true,
  128. },
  129. {
  130. label: "业务类型",
  131. prop: "businessTypes",
  132. width: "120",
  133. overHidden: true,
  134. type: 'select',
  135. multiple: true,
  136. dicData: [
  137. {
  138. label: '海运出口',
  139. value: 'SE'
  140. }, {
  141. label: '海运进口',
  142. value: 'SI'
  143. }
  144. ],
  145. },
  146. {
  147. label: "本币应收",
  148. prop: "amountDr",
  149. width: "160"
  150. },
  151. {
  152. label: "本币应付",
  153. prop: "amountCr",
  154. width: "160"
  155. },
  156. // {
  157. // label: "综合 USD 应收 - 非 USD 外币转换为 USD",
  158. // prop: "amountDrUsd",
  159. // width: "160"
  160. // },
  161. // {
  162. // label: "综合 USD 应付 - 非 USD 外币转换为 USD",
  163. // prop: "amountCrUsd",
  164. // width: "160"
  165. // },
  166. {
  167. label: "合计本币应收",
  168. prop: "amountDrLoc",
  169. width: "160"
  170. },
  171. {
  172. label: "合计本币应付",
  173. prop: "amountCrLoc",
  174. width: "160"
  175. },
  176. {
  177. label: "本币税后应收",
  178. prop: "amountDrNet",
  179. width: "160"
  180. },
  181. {
  182. label: "本币税后应付",
  183. prop: "amountCrNet",
  184. width: "160"
  185. },
  186. // {
  187. // label: "综合 USD 税后应收 - 非 USD 外币转换为 USD",
  188. // prop: "amountDrUsdNet",
  189. // width: "160"
  190. // },
  191. // {
  192. // label: "综合 USD 税后应付 - 非 USD 外币转换为 USD",
  193. // prop: "amountCrUsdNet",
  194. // width: "160"
  195. // },
  196. {
  197. label: "合计本币税后应收",
  198. prop: "amountDrLocNet",
  199. width: "170"
  200. },
  201. {
  202. label: "合计本币税后应付",
  203. prop: "amountCrLocNet",
  204. width: "170"
  205. },
  206. {
  207. label: "业务单据编号",
  208. prop: "businessNo",
  209. width: "120",
  210. overHidden: true,
  211. },
  212. {
  213. label: "账单编号",
  214. prop: "accountNo",
  215. width: "100",
  216. overHidden: true,
  217. },
  218. {
  219. label: "对账单编号",
  220. prop: "checkNo",
  221. width: "100",
  222. overHidden: true,
  223. },
  224. {
  225. label: "业务所在部门",
  226. prop: "deptName",
  227. width: "120",
  228. overHidden: true,
  229. },
  230. {
  231. label: "业务操作",
  232. prop: "operatorName",
  233. width: "100",
  234. overHidden: true,
  235. },
  236. {
  237. label: "业务员",
  238. prop: "salesName",
  239. overHidden: true,
  240. },
  241. {
  242. label: "费用收付",
  243. prop: "dc",
  244. // search:true,
  245. type: 'select',
  246. dicData: [
  247. {
  248. label: 'Debit',
  249. value: 'D'
  250. }, {
  251. label: 'Credit',
  252. value: 'C'
  253. }
  254. ],
  255. overHidden: true,
  256. },
  257. {
  258. label: "币种",
  259. prop: "curCode",
  260. search: true,
  261. type: 'select',
  262. dicData: [],
  263. props: {
  264. label: "code",
  265. value: "id"
  266. },
  267. overHidden: true,
  268. },
  269. {
  270. label: "中文船名",
  271. prop: "vesselCnName",
  272. overHidden: true,
  273. },
  274. {
  275. label: "英文船名",
  276. prop: "vesselEnName",
  277. overHidden: true,
  278. },
  279. {
  280. label: "航次",
  281. prop: "voyageNo",
  282. overHidden: true,
  283. },
  284. {
  285. label: "HB/L NO",
  286. prop: "hblno",
  287. },
  288. {
  289. label: "财务开始日期",
  290. prop: "accountDateFrom",
  291. width: "140"
  292. },
  293. {
  294. label: "财务结束日期",
  295. prop: "accountDateTo",
  296. width: "140"
  297. },
  298. {
  299. label: "审核开始日期",
  300. prop: "auditDateFrom",
  301. width: "140"
  302. },
  303. {
  304. label: "审核结束日期",
  305. prop: "auditDateTo",
  306. width: "140"
  307. },
  308. {
  309. label: "发票号",
  310. prop: "invoiceNo",
  311. },
  312. {
  313. label: "检验检疫 NO",
  314. prop: "iqNo",
  315. width: "140"
  316. },
  317. {
  318. label: "费用中文名称",
  319. prop: "feeCode",
  320. width: "140"
  321. },
  322. {
  323. label: "费用中文名称",
  324. prop: "feeCnName",
  325. width: "140"
  326. },
  327. {
  328. label: "费用英文名称",
  329. prop: "feeEnName",
  330. width: "140"
  331. },
  332. {
  333. label: "是否审核",
  334. prop: "isApproved",
  335. dicData: [],
  336. props: {
  337. label: "dictValue",
  338. value: "dictKey"
  339. },
  340. },
  341. {
  342. label: "是否签收",
  343. prop: "isSignfor",
  344. dicData: [],
  345. props: {
  346. label: "dictValue",
  347. value: "dictKey"
  348. },
  349. },
  350. {
  351. label: "是否对账",
  352. prop: "isChecked",
  353. dicData: [],
  354. props: {
  355. label: "dictValue",
  356. value: "dictKey"
  357. },
  358. },
  359. {
  360. label: "是否销账",
  361. prop: "isCleared",
  362. dicData: [],
  363. props: {
  364. label: "dictValue",
  365. value: "dictKey"
  366. },
  367. },
  368. {
  369. label: "是否开发票",
  370. prop: "isInvoice",
  371. dicData: [],
  372. props: {
  373. label: "dictValue",
  374. value: "dictKey"
  375. },
  376. width: "140"
  377. },
  378. {
  379. label: "是否含税价计算",
  380. prop: "isTax",
  381. dicData: [],
  382. props: {
  383. label: "dictValue",
  384. value: "dictKey"
  385. },
  386. width: "140"
  387. },
  388. {
  389. label: "凭证类型",
  390. prop: "voucherType",
  391. },
  392. {
  393. label: "凭证号",
  394. prop: "voucherNo",
  395. },
  396. {
  397. label: "凭证日期",
  398. prop: "voucherDate",
  399. },
  400. {
  401. label: "备注",
  402. prop: "remarks",
  403. },
  404. ]
  405. },
  406. data: [],
  407. editSave: false, // 编辑保存打印状态
  408. };
  409. },
  410. computed: {
  411. ...mapGetters(["permission"]),
  412. permissionList() {
  413. return {
  414. addBtn: this.vaildData(this.permission.finstlbills_add, false),
  415. viewBtn: this.vaildData(this.permission.finstlbills_view, false),
  416. delBtn: this.vaildData(this.permission.finstlbills_delete, false),
  417. editBtn: this.vaildData(this.permission.finstlbills_edit, false)
  418. };
  419. },
  420. ids() {
  421. let ids = [];
  422. this.selectionList.forEach(ele => {
  423. ids.push(ele.id);
  424. });
  425. return ids.join(",");
  426. }
  427. },
  428. async created() {
  429. this.option = await this.getColumnData(this.getColumnName(315), this.optionBack);
  430. this.dictionaryfun() // 获取字典数据
  431. this.getRateListfun() // 币别数据
  432. },
  433. methods: {
  434. // 展开行
  435. expandChange(row, expendList) {
  436. finstlbillsitemsList(1, 20, { pid: row.id }).then(res => {
  437. row.finStlBillsItemsList = res.data.data.records
  438. })
  439. },
  440. // 新建账单
  441. newbillFun() {
  442. this.isShow = false
  443. this.editSave = false
  444. // this.$refs.finstlbillsDetails
  445. },
  446. // 编辑
  447. editFun(row) {
  448. this.isShow = false
  449. this.editSave = true
  450. this.$nextTick(() => {
  451. this.$refs.finstlbillsDetails.finstlbillsDetailfun(row.id)
  452. })
  453. },
  454. // 详情的返回列表
  455. goBack() {
  456. // 初始化数据
  457. // this.detailData = this.$options.data().detailData;
  458. if (JSON.stringify(this.$route.query) != "{}") {
  459. this.$router.$avueRouter.closeTag();
  460. this.$router.push({
  461. path: "/iosBasicData/settlement/index"
  462. });
  463. }
  464. this.isShow = true;
  465. this.onLoad(this.page, this.search);
  466. },
  467. // 添加
  468. rowSave(row, done, loading) {
  469. finstlbillsSubmit(row).then(() => {
  470. this.onLoad(this.page);
  471. this.$message({
  472. type: "success",
  473. message: "操作成功!"
  474. });
  475. done();
  476. }, error => {
  477. loading();
  478. window.console.log(error);
  479. });
  480. },
  481. // 保存
  482. rowUpdate(row, index, done, loading) {
  483. finstlbillsSubmit(row).then(() => {
  484. this.onLoad(this.page);
  485. this.$message({
  486. type: "success",
  487. message: "操作成功!"
  488. });
  489. done();
  490. }, error => {
  491. loading();
  492. console.log(error);
  493. });
  494. },
  495. // 删除
  496. rowDel(row) {
  497. this.$confirm("确定将选择数据删除?", {
  498. confirmButtonText: "确定",
  499. cancelButtonText: "取消",
  500. type: "warning"
  501. })
  502. .then(() => {
  503. return finstlbillsRemove(row.id);
  504. })
  505. .then(() => {
  506. this.onLoad(this.page);
  507. this.$message({
  508. type: "success",
  509. message: "操作成功!"
  510. });
  511. });
  512. },
  513. // 批量删除
  514. handleDelete() {
  515. if (this.selectionList.length === 0) {
  516. this.$message.warning("请选择至少一条数据");
  517. return;
  518. }
  519. this.$confirm("确定将选择数据删除?", {
  520. confirmButtonText: "确定",
  521. cancelButtonText: "取消",
  522. type: "warning"
  523. })
  524. .then(() => {
  525. return finstlbillsRemove(this.ids);
  526. })
  527. .then(() => {
  528. this.onLoad(this.page);
  529. this.$message({
  530. type: "success",
  531. message: "操作成功!"
  532. });
  533. this.$refs.crud.toggleSelection();
  534. });
  535. },
  536. // 详情
  537. beforeOpen(done, type) {
  538. if (["edit", "view"].includes(type)) {
  539. finstlbillsDetail(this.form.id).then(res => {
  540. this.form = res.data.data;
  541. });
  542. }
  543. done();
  544. },
  545. searchReset() {
  546. this.query = {};
  547. this.onLoad(this.page);
  548. },
  549. searchChange(params, done) {
  550. this.query = params;
  551. this.page.currentPage = 1;
  552. this.onLoad(this.page, params);
  553. done();
  554. },
  555. selectionChange(list) {
  556. this.selectionList = list;
  557. },
  558. selectionClear() {
  559. this.selectionList = [];
  560. this.$refs.crud.toggleSelection();
  561. },
  562. currentChange(currentPage) {
  563. this.page.currentPage = currentPage;
  564. },
  565. sizeChange(pageSize) {
  566. this.page.pageSize = pageSize;
  567. },
  568. refreshChange() {
  569. this.onLoad(this.page, this.query);
  570. },
  571. onLoad(page, params = {}) {
  572. this.loading = true;
  573. finstlbillsList(
  574. page.currentPage,
  575. page.pageSize,
  576. { ...Object.assign(params, this.query), businessType: 'STL', dc: 'D' },
  577. ).then(res => {
  578. const data = res.data.data;
  579. this.page.total = data.total;
  580. this.data = data.records.map(item => {
  581. item.isApproved = item.isApproved + ''
  582. item.isSignfor = item.isSignfor + ''
  583. item.isChecked = item.isChecked + ''
  584. item.isCleared = item.isCleared + ''
  585. item.isInvoice = item.isInvoice + ''
  586. item.isTax = item.isTax + ''
  587. item.corpIsSigned = item.corpIsSigned + ''
  588. return item
  589. })
  590. this.loading = false;
  591. this.selectionClear();
  592. });
  593. },
  594. // 获取字典数据
  595. dictionaryfun() {
  596. // 全部是否
  597. getWorkDicts('ifInvoice').then(res => {
  598. this.findObject(this.option.column, "isApproved").dicData = res.data.data
  599. this.findObject(this.option.column, "isSignfor").dicData = res.data.data
  600. this.findObject(this.option.column, "isChecked").dicData = res.data.data
  601. this.findObject(this.option.column, "isCleared").dicData = res.data.data
  602. })
  603. // 是否开发票
  604. getWorkDicts('invoice_los').then(res => {
  605. this.findObject(this.option.column, "isInvoice").dicData = res.data.data
  606. })
  607. // 是否
  608. getWorkDicts('ifInvoice').then(res => {
  609. this.findObject(this.option.column, "corpIsSigned").dicData = res.data.data
  610. this.findObject(this.option.column, "isTax").dicData = res.data.data
  611. })
  612. },
  613. // 获取币别数据
  614. getRateListfun(cnName) {
  615. getRateList({ current: 1, size: 20, cnName }).then(res => {
  616. this.findObject(this.option.column, "curCode").dicData = res.data.data.records
  617. })
  618. },
  619. //自定义列保存
  620. async saveColumnTwo(ref, option, optionBack, code) {
  621. /**
  622. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  623. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  624. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  625. */
  626. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  627. if (inSave) {
  628. this.$message.success("保存成功");
  629. //关闭窗口
  630. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  631. }
  632. },
  633. //自定义列重置
  634. async resetColumnTwo(ref, option, optionBack, code) {
  635. this[option] = this[optionBack];
  636. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  637. if (inSave) {
  638. this.$message.success("重置成功");
  639. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  640. }
  641. },
  642. // 更改表格颜色
  643. headerClassName(tab) {
  644. //颜色间隔
  645. let back = ""
  646. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  647. if (tab.columnIndex % 2 === 0) {
  648. back = "back-one"
  649. } else if (tab.columnIndex % 2 === 1) {
  650. back = "back-two"
  651. }
  652. }
  653. return back;
  654. },
  655. }
  656. };
  657. </script>
  658. <style scoped>
  659. ::v-deep#out-table .back-one {
  660. background: #ecf5ff !important;
  661. text-align: center;
  662. }
  663. ::v-deep#out-table .back-two {
  664. background: #ecf5ff !important;
  665. text-align: center;
  666. }
  667. </style>