index.vue 22 KB

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