index.vue 19 KB

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