index.vue 21 KB

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