index.vue 20 KB

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