index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903
  1. <template>
  2. <div>
  3. <basic-container v-show="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" :search.sync="search"
  9. @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 314)"
  10. @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 314)" @on-load="onLoad"
  11. @expand-change="expandChange">
  12. <template slot="expand" slot-scope="{row}">
  13. <finstlbillsitems :tableData="row.finStlBillsItemsList || []" :brfalse="false"></finstlbillsitems>
  14. </template>
  15. <tempalte slot="feeCnNameSearch">
  16. <dic-select v-model="search.feeCnName" placeholder="费用名称" key="id" label="cnName" res="records"
  17. url="/blade-los/bfees/list" :filterable="true" :remote="true" dataName="cnName"></dic-select>
  18. </tempalte>
  19. <template slot="menuLeft">
  20. <el-button type="success" size="small" icon="el-icon-plus" plain @click="newbillFun">新建账单
  21. </el-button>
  22. <el-button type="danger" size="small" icon="el-icon-delete" plain @click="handleDelete">一键删除
  23. </el-button>
  24. </template>
  25. <template slot="menu" slot-scope="{row}">
  26. <el-button type="text" size="small" @click="editFun(row)">编辑
  27. </el-button>
  28. <!--:disabled="saberUserInfo.role_name.indexOf('允许修改他人业务') == -1?saberUserInfo.user_id != row.createUser:false"-->
  29. <el-button type="text" size="small"
  30. v-if="saberUserInfo.role_name.indexOf('admin') == -1 ? saberUserInfo.role_name.indexOf('允许修改他人业务') == -1 ? saberUserInfo.user_id == row.createUser : true : true"
  31. :disabled="row.billStatus == 1" @click="rowDel(row)">删除
  32. </el-button>
  33. </template>
  34. <template slot-scope="{ row }" slot="billNo">
  35. <span class="pointerClick" @click="editFun(row)">{{ row.billNo }}
  36. </span>
  37. </template>
  38. <template slot-scope="{ row }" slot="billStatus">
  39. <span v-if="row.billStatus == 1" style="color: #7fbb41">是</span>
  40. <span v-if="row.billStatus == 0" style="color: #d2983c">否</span>
  41. </template>
  42. </avue-crud>
  43. </basic-container>
  44. <finstlbillsDetails ref="finstlbillsDetails" v-if="!isShow" :editSave="editSave" @goBack="goBack"
  45. @toAddEdit="toAddEdit" :key="datekey">
  46. </finstlbillsDetails>
  47. </div>
  48. </template>
  49. <script>
  50. import { finstlbillsList, finstlbillsDetail, finstlbillsSubmit, finstlbillsRemove, finstlbillsitemsList } from "@/api/iosBasicData/finstlbills";
  51. import { mapGetters } from "vuex";
  52. import finstlbillsDetails from '@/views/iosBasicData/finstlbills/finstlbillsDetails.vue'
  53. import { getWorkDicts } from "@/api/system/dictbiz";
  54. import finstlbillsitems from "@/views/iosBasicData/finstlbills/assembly/finstlbillsitems.vue";
  55. import dicSelect from "@/components/dicSelect/main";
  56. export default {
  57. components: { finstlbillsitems, finstlbillsDetails, dicSelect },
  58. data() {
  59. return {
  60. datekey: Date.now(),
  61. search: {},
  62. // 详情页面和列表切换
  63. isShow: true,
  64. form: {},
  65. query: {},
  66. loading: true,
  67. page: {
  68. pageSize: 10,
  69. currentPage: 1,
  70. total: 0
  71. },
  72. selectionList: [],
  73. option: {},
  74. optionBack: {
  75. height: 'auto',
  76. calcHeight: 30,
  77. tip: false,
  78. searchShow: true,
  79. searchMenuSpan: 6,
  80. searchIcon: true,
  81. searchIndex: 3,
  82. border: true,
  83. index: true,
  84. viewBtn: true,
  85. selection: true,
  86. dialogClickModal: false,
  87. menuWidth: 100,
  88. expand: true,
  89. rowKey: 'id',
  90. column: [
  91. {
  92. label: "所属公司",
  93. prop: "branchId",
  94. width: "120",
  95. overHidden: true,
  96. hide: true,
  97. showColumn: false,
  98. type: "select",
  99. filterable: true,
  100. dicUrl: "/api/blade-system/dept/lazy-list",
  101. props: {
  102. label: "deptName",
  103. value: "id",
  104. },
  105. search: false,
  106. searchOrder: 1
  107. },
  108. {
  109. label: "所属公司",
  110. prop: "branchName",
  111. width: "120",
  112. overHidden: true,
  113. hide: true,
  114. showColumn: false,
  115. },
  116. {
  117. label: "单据编号",
  118. prop: "billNo",
  119. search: true,
  120. overHidden: true,
  121. },
  122. {
  123. label: "对账日期",
  124. prop: "billDate",
  125. overHidden: true,
  126. width: "150",
  127. },
  128. {
  129. label: "业务开始日期",
  130. prop: "businessDateStart",
  131. search: true,
  132. overHidden: true,
  133. hide: true,
  134. searchLabelWidth: "100",
  135. type: "date",
  136. format: "yyyy-MM-dd",
  137. valueFormat: "yyyy-MM-dd HH:mm:ss",
  138. },
  139. {
  140. label: "业务结束日期",
  141. prop: "businessDateEnd",
  142. search: true,
  143. overHidden: true,
  144. hide: true,
  145. searchLabelWidth: "100",
  146. type: "date",
  147. format: "yyyy-MM-dd",
  148. valueFormat: "yyyy-MM-dd HH:mm:ss",
  149. },
  150. {
  151. label: "客户名称",
  152. prop: "corpCnName",
  153. search: true,
  154. width: "120",
  155. searchOrder: 1.1,
  156. overHidden: true,
  157. },
  158. {
  159. label: "客户英文名称",
  160. prop: "corpEnName",
  161. width: "120",
  162. overHidden: true,
  163. },
  164. {
  165. label: "JOB NO",
  166. prop: "businessNo",
  167. width: "120",
  168. search: true,
  169. searchOrder: 3,
  170. overHidden: true
  171. },
  172. {
  173. label: "ACCT NO",
  174. prop: "accountNo",
  175. width: "100",
  176. search: true,
  177. searchOrder: 5,
  178. overHidden: true
  179. },
  180. {
  181. label: "MB/L NO",
  182. prop: "mblno",
  183. search: true,
  184. searchOrder: 2,
  185. overHidden: true
  186. },
  187. {
  188. label: "HB/L NO",
  189. prop: "hblno",
  190. search: true,
  191. searchOrder: 4,
  192. overHidden: true
  193. },
  194. {
  195. label: "对账单号",
  196. prop: "checkNo",
  197. search: true,
  198. width: "100",
  199. searchOrder: 6,
  200. overHidden: true
  201. },
  202. {
  203. label: "船名",
  204. prop: "vesselCnName",
  205. search: true,
  206. searchOrder: 7,
  207. overHidden: true
  208. },
  209. {
  210. label: "航次",
  211. prop: "voyageNo",
  212. search: true,
  213. searchOrder: 8,
  214. overHidden: true
  215. },
  216. // {
  217. // label: "客户是否已签约",
  218. // prop: "corpIsSigned",
  219. // width:"120",
  220. // dicData:[],
  221. // props: {
  222. // label: "dictValue",
  223. // value: "dictKey"
  224. // },
  225. // overHidden:true,
  226. // },
  227. {
  228. label: "客户约号",
  229. prop: "corpArgreementNo",
  230. overHidden: true,
  231. },
  232. // {
  233. // label: "客户账期备注",
  234. // prop: "corpAccRemarks",
  235. // width:"120",
  236. // overHidden:true,
  237. // },
  238. {
  239. label: "业务类型",
  240. prop: "businessType",
  241. width: "120",
  242. overHidden: true,
  243. type: 'select',
  244. multiple: true,
  245. dicData: [
  246. {
  247. label: '海运出口',
  248. value: 'SE'
  249. }, {
  250. label: '海运进口',
  251. value: 'SI'
  252. }
  253. ],
  254. },
  255. {
  256. label: "本币应收",
  257. prop: "amountDr",
  258. width: "160"
  259. },
  260. {
  261. label: "本币应付",
  262. prop: "amountCr",
  263. width: "160"
  264. },
  265. // {
  266. // label: "综合 USD 应收 - 非 USD 外币转换为 USD",
  267. // prop: "amountDrUsd",
  268. // width: "160"
  269. // },
  270. // {
  271. // label: "综合 USD 应付 - 非 USD 外币转换为 USD",
  272. // prop: "amountCrUsd",
  273. // width: "160"
  274. // },
  275. {
  276. label: "合计本币应收",
  277. prop: "amountDrLoc",
  278. width: "160"
  279. },
  280. {
  281. label: "合计本币应付",
  282. prop: "amountCrLoc",
  283. width: "160"
  284. },
  285. {
  286. label: "本币税后应收",
  287. prop: "amountDrNet",
  288. width: "160"
  289. },
  290. {
  291. label: "本币税后应付",
  292. prop: "amountCrNet",
  293. width: "160"
  294. },
  295. // {
  296. // label: "综合 USD 税后应收 - 非 USD 外币转换为 USD",
  297. // prop: "amountDrUsdNet",
  298. // width: "160"
  299. // },
  300. // {
  301. // label: "综合 USD 税后应付 - 非 USD 外币转换为 USD",
  302. // prop: "amountCrUsdNet",
  303. // width: "160"
  304. // },
  305. {
  306. label: "合计本币税后应收",
  307. prop: "amountDrLocNet",
  308. width: "170"
  309. },
  310. {
  311. label: "合计本币税后应付",
  312. prop: "amountCrLocNet",
  313. width: "170"
  314. },
  315. {
  316. label: "业务单据编号",
  317. prop: "businessNo",
  318. width: "120",
  319. overHidden: true,
  320. },
  321. {
  322. label: "账单编号",
  323. prop: "accountNo",
  324. width: "100",
  325. overHidden: true,
  326. },
  327. // {
  328. // label: "对账单编号",
  329. // prop: "checkNo",
  330. // width: "100",
  331. // overHidden: true,
  332. // },
  333. // {
  334. // label: "业务所在部门",
  335. // prop: "deptName",
  336. // width: "120",
  337. // overHidden: true,
  338. // },
  339. // {
  340. // label: "业务操作",
  341. // prop: "operatorName",
  342. // width: "100",
  343. // overHidden: true,
  344. // },
  345. // {
  346. // label: "业务员",
  347. // prop: "salesName",
  348. // overHidden: true,
  349. // },
  350. // {
  351. // label: "费用收付",
  352. // prop: "dc",
  353. // search: true,
  354. // overHidden: true,
  355. // },
  356. // {
  357. // label: "币种",
  358. // prop: "curCode",
  359. // overHidden: true,
  360. // },
  361. // {
  362. // label: "中文船名",
  363. // prop: "vesselCnName",
  364. // overHidden: true,
  365. // },
  366. // {
  367. // label: "英文船名",
  368. // prop: "vesselEnName",
  369. // overHidden: true,
  370. // },
  371. // {
  372. // label: "航次",
  373. // prop: "voyageNo",
  374. // overHidden: true,
  375. // },
  376. // {
  377. // label: "财务开始日期",
  378. // prop: "accountDateFrom",
  379. // width: "140",
  380. // overHidden: true,
  381. // },
  382. // {
  383. // label: "财务结束日期",
  384. // prop: "accountDateTo",
  385. // width: "140",
  386. // overHidden: true,
  387. // },
  388. // {
  389. // label: "审核开始日期",
  390. // prop: "auditDateFrom",
  391. // width: "140",
  392. // overHidden: true,
  393. // },
  394. // {
  395. // label: "审核结束日期",
  396. // prop: "auditDateTo",
  397. // width: "140",
  398. // overHidden: true,
  399. // },
  400. // {
  401. // label: "发票号",
  402. // prop: "invoiceNo",
  403. // overHidden: true,
  404. // },
  405. // {
  406. // label: "检验检疫 NO",
  407. // prop: "iqNo",
  408. // width: "140",
  409. // overHidden: true,
  410. // },
  411. // {
  412. // label: "费用中文名称",
  413. // prop: "feeCode",
  414. // width: "140",
  415. // overHidden:true,
  416. // },
  417. // {
  418. // label: "费用名称",
  419. // prop: "feeCnName",
  420. // searchLabelWidth: "100",
  421. // width: "140",
  422. // search: true,
  423. // overHidden: true,
  424. // },
  425. // {
  426. // label: "费用英文名称",
  427. // prop: "feeEnName",
  428. // width: "140",
  429. // overHidden: true,
  430. // },
  431. {
  432. label: "是否审核",
  433. prop: "isApproved",
  434. dicData: [],
  435. props: {
  436. label: "dictValue",
  437. value: "dictKey"
  438. },
  439. overHidden: true,
  440. },
  441. {
  442. label: "是否签收",
  443. prop: "isSignfor",
  444. dicData: [],
  445. props: {
  446. label: "dictValue",
  447. value: "dictKey"
  448. },
  449. overHidden: true,
  450. },
  451. {
  452. label: "是否对账",
  453. prop: "isChecked",
  454. dicData: [],
  455. props: {
  456. label: "dictValue",
  457. value: "dictKey"
  458. },
  459. overHidden: true,
  460. },
  461. {
  462. label: "是否生成对账",
  463. prop: "billStatus",
  464. dicData: [],
  465. props: {
  466. label: "dictValue",
  467. value: "dictKey"
  468. },
  469. width: "100",
  470. overHidden: true,
  471. },
  472. {
  473. label: "是否销账",
  474. prop: "isCleared",
  475. dicData: [],
  476. props: {
  477. label: "dictValue",
  478. value: "dictKey"
  479. },
  480. overHidden: true,
  481. },
  482. {
  483. label: "是否开发票",
  484. prop: "isInvoice",
  485. dicData: [],
  486. props: {
  487. label: "dictValue",
  488. value: "dictKey"
  489. },
  490. width: "140",
  491. overHidden: true,
  492. },
  493. {
  494. label: "是否含税价计算",
  495. prop: "isTax",
  496. dicData: [],
  497. props: {
  498. label: "dictValue",
  499. value: "dictKey"
  500. },
  501. width: "140",
  502. overHidden: true,
  503. },
  504. // {
  505. // label: "凭证类型",
  506. // prop: "voucherType",
  507. // overHidden: true,
  508. // },
  509. // {
  510. // label: "凭证号",
  511. // prop: "voucherNo",
  512. // overHidden: true,
  513. // },
  514. // {
  515. // label: "凭证日期",
  516. // prop: "voucherDate",
  517. // overHidden: true,
  518. // },
  519. {
  520. label: "备注",
  521. prop: "remarks",
  522. overHidden: true,
  523. },
  524. ]
  525. },
  526. data: [],
  527. editSave: false, // 编辑保存打印状态
  528. saberUserInfo: {}, // 当前登录人个人信息
  529. };
  530. },
  531. computed: {
  532. ...mapGetters(["permission"]),
  533. permissionList() {
  534. return {
  535. addBtn: this.vaildData(this.permission.finstlbills_add, false),
  536. viewBtn: this.vaildData(this.permission.finstlbills_view, false),
  537. delBtn: this.vaildData(this.permission.finstlbills_delete, false),
  538. editBtn: this.vaildData(this.permission.finstlbills_edit, false)
  539. };
  540. },
  541. ids() {
  542. let ids = [];
  543. this.selectionList.forEach(ele => {
  544. ids.push(ele.id);
  545. });
  546. return ids.join(",");
  547. }
  548. },
  549. async created() {
  550. // 获取当前登录人个人信息
  551. this.saberUserInfo = JSON.parse(localStorage.getItem('saber-userInfo')).content
  552. this.option = await this.getColumnData(this.getColumnName(314), this.optionBack);
  553. if (this.saberUserInfo.role_name.indexOf('admin') != -1 || this.saberUserInfo.role_name.indexOf('总部') != -1) {
  554. this.option.searchMenuSpan = 24
  555. this.option.column.forEach(item => {
  556. if (item.prop == 'branchId') {
  557. item.search = true
  558. }
  559. if (item.prop == 'branchName') {
  560. item.hide = false
  561. item.showColumn = true
  562. }
  563. })
  564. }
  565. if (this.$route.query.billId) {
  566. // 从审批里查看跳进来的
  567. this.editFun({ id: this.$route.query.billId })
  568. }
  569. this.$store.commit('DZZXF_IN_DETAIL')
  570. this.dictionaryfun() // 获取字典数据
  571. },
  572. methods: {
  573. // 展开行
  574. expandChange(row, expendList) {
  575. finstlbillsitemsList(1, 20, { pid: row.id }).then(res => {
  576. console.log(res.data.data.records, 476)
  577. row.finStlBillsItemsList = res.data.data.records.map(item => {
  578. if (item.curCode == 'CNY') {
  579. this.$set(item, 'amountRMB', item.amount)
  580. this.$set(item, 'currentInvoiceAmountRMB', item.currentInvoiceAmount)
  581. this.$set(item, 'unsettledAmountRMB', item.unsettledAmount)
  582. this.$set(item, 'stlTtlAmountRMB', item.stlTtlAmount)
  583. this.$set(item, 'currentStlAmountRMB', item.currentStlAmount)
  584. } else {
  585. this.$set(item, 'amountUSD', item.amount)
  586. this.$set(item, 'currentInvoiceAmountUSD', item.currentInvoiceAmount)
  587. this.$set(item, 'unsettledAmountUSD', item.unsettledAmount)
  588. this.$set(item, 'stlTtlAmountUSD', item.stlTtlAmount)
  589. this.$set(item, 'currentStlAmountUSD', item.currentStlAmount)
  590. }
  591. return item
  592. })
  593. })
  594. },
  595. // 新建账单
  596. newbillFun() {
  597. this.isShow = false
  598. this.editSave = false
  599. // this.$refs.finstlbillsDetails
  600. },
  601. toAddEdit() {
  602. this.datekey = Date.now()
  603. this.isShow = false
  604. this.editSave = false
  605. },
  606. // 编辑
  607. editFun(row) {
  608. this.isShow = false
  609. this.editSave = true
  610. this.$nextTick(() => {
  611. this.$refs.finstlbillsDetails.finstlbillsDetailfun(row.id)
  612. })
  613. },
  614. // 详情的返回列表
  615. goBack() {
  616. // 初始化数据
  617. // this.detailData = this.$options.data().detailData;
  618. if (JSON.stringify(this.$route.query) != "{}") {
  619. this.$router.$avueRouter.closeTag();
  620. this.$router.push({
  621. path: "/iosBasicData/finstlbills/index"
  622. });
  623. }
  624. this.isShow = true;
  625. this.onLoad(this.page, this.search);
  626. },
  627. // 添加
  628. rowSave(row, done, loading) {
  629. finstlbillsSubmit(row).then(() => {
  630. this.onLoad(this.page);
  631. this.$message({
  632. type: "success",
  633. message: "操作成功!"
  634. });
  635. done();
  636. }, error => {
  637. loading();
  638. window.console.log(error);
  639. });
  640. },
  641. // 保存
  642. rowUpdate(row, index, done, loading) {
  643. finstlbillsSubmit(row).then(() => {
  644. this.onLoad(this.page);
  645. this.$message({
  646. type: "success",
  647. message: "操作成功!"
  648. });
  649. done();
  650. }, error => {
  651. loading();
  652. console.log(error);
  653. });
  654. },
  655. // 删除
  656. rowDel(row) {
  657. this.$confirm("确定将选择数据删除?", {
  658. confirmButtonText: "确定",
  659. cancelButtonText: "取消",
  660. type: "warning"
  661. })
  662. .then(() => {
  663. return finstlbillsRemove(row.id);
  664. })
  665. .then(() => {
  666. this.onLoad(this.page);
  667. this.$message({
  668. type: "success",
  669. message: "操作成功!"
  670. });
  671. });
  672. },
  673. // 批量删除
  674. handleDelete() {
  675. if (this.selectionList.length === 0) {
  676. this.$message.warning("请选择至少一条数据");
  677. return;
  678. }
  679. // 判断是否可以编辑别人业务 true 就没有权限
  680. if (this.ModifyOthersfun()) return;
  681. // 已经提交请核的提示不让删除
  682. let sumArr = []
  683. const h = this.$createElement
  684. for (let item of this.selectionList) {
  685. if (item.billStatus == 1) {
  686. sumArr.push(h('p', `序号${item.$index + 1}的数据已经确认对账请勿删除`))
  687. }
  688. }
  689. if (sumArr.length != 0) {
  690. this.$confirm('提示', {
  691. message: h('div', sumArr),
  692. confirmButtonText: "确定",
  693. cancelButtonText: "取消",
  694. type: "warning"
  695. })
  696. return;
  697. }
  698. this.$confirm("确定将选择数据删除?", {
  699. confirmButtonText: "确定",
  700. cancelButtonText: "取消",
  701. type: "warning"
  702. })
  703. .then(() => {
  704. return finstlbillsRemove(this.ids);
  705. })
  706. .then(() => {
  707. this.onLoad(this.page);
  708. this.$message({
  709. type: "success",
  710. message: "操作成功!"
  711. });
  712. this.$refs.crud.toggleSelection();
  713. });
  714. },
  715. // 判断是否可以编辑别人业务
  716. ModifyOthersfun() {
  717. let sumArr = []
  718. const h = this.$createElement
  719. // 判断是否有权限
  720. if (this.saberUserInfo.role_name.indexOf('允许修改他人业务') != -1) return false
  721. // 当前登录人和选择的创建人对比是不是一个人
  722. for (let item of this.selectionList) {
  723. if (this.saberUserInfo.user_id != item.createUser) {
  724. sumArr.push(h('p', `你没有"允许修改他人业务"权限,请重新选择数据`))
  725. }
  726. }
  727. if (sumArr.length != 0) {
  728. this.$confirm('提示', {
  729. message: h('div', sumArr),
  730. confirmButtonText: "确定",
  731. cancelButtonText: "取消",
  732. type: "warning"
  733. }).catch(err => { })
  734. return true
  735. }
  736. },
  737. // 详情
  738. beforeOpen(done, type) {
  739. if (["edit", "view"].includes(type)) {
  740. finstlbillsDetail(this.form.id).then(res => {
  741. this.form = res.data.data;
  742. });
  743. }
  744. done();
  745. },
  746. searchReset() {
  747. this.query = {};
  748. this.onLoad(this.page);
  749. },
  750. // 搜索
  751. searchChange(params, done) {
  752. this.query = params;
  753. this.page.currentPage = 1;
  754. this.onLoad(this.page, params);
  755. done();
  756. },
  757. selectionChange(list) {
  758. this.selectionList = list;
  759. },
  760. selectionClear() {
  761. this.selectionList = [];
  762. this.$refs.crud.toggleSelection();
  763. this.$refs.crud.refreshTable();
  764. },
  765. currentChange(currentPage) {
  766. this.page.currentPage = currentPage;
  767. },
  768. sizeChange(pageSize) {
  769. this.page.pageSize = pageSize;
  770. },
  771. refreshChange() {
  772. this.onLoad(this.page, this.query);
  773. },
  774. onLoad(page, params = {}) {
  775. this.loading = true;
  776. finstlbillsList(
  777. page.currentPage,
  778. page.pageSize,
  779. { ...Object.assign(params, this.query), businessType: 'CHK' }
  780. ).then(res => {
  781. const data = res.data.data;
  782. this.page.total = data.total;
  783. this.data = data.records.map(item => {
  784. item.isApproved = item.isApproved + ''
  785. item.isSignfor = item.isSignfor + ''
  786. item.isChecked = item.isChecked + ''
  787. item.billStatus = item.billStatus + ''
  788. item.isCleared = item.isCleared + ''
  789. item.isInvoice = item.isInvoice + ''
  790. item.isTax = item.isTax + ''
  791. item.corpIsSigned = item.corpIsSigned + ''
  792. return item
  793. })
  794. this.$nextTick(() => {
  795. this.$refs.crud.dicInit();
  796. });
  797. this.loading = false;
  798. this.selectionClear();
  799. });
  800. },
  801. // 获取字典数据
  802. dictionaryfun() {
  803. // 全部是否
  804. getWorkDicts('ifInvoice').then(res => {
  805. this.findObject(this.option.column, "isApproved").dicData = res.data.data
  806. this.findObject(this.option.column, "isSignfor").dicData = res.data.data
  807. this.findObject(this.option.column, "isCleared").dicData = res.data.data
  808. this.findObject(this.option.column, "billStatus").dicData = res.data.data
  809. })
  810. // 对账状态字典
  811. getWorkDicts('los_check_status').then(res => {
  812. this.findObject(this.option.column, "isChecked").dicData = res.data.data
  813. })
  814. // 是否开发票
  815. getWorkDicts('invoice_los').then(res => {
  816. this.findObject(this.option.column, "isInvoice").dicData = res.data.data
  817. })
  818. // 是否
  819. getWorkDicts('ifInvoice').then(res => {
  820. // this.findObject(this.option.column, "corpIsSigned").dicData = res.data.data
  821. this.findObject(this.option.column, "isTax").dicData = res.data.data
  822. })
  823. },
  824. //自定义列保存
  825. async saveColumnTwo(ref, option, optionBack, code) {
  826. /**
  827. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  828. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  829. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  830. */
  831. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  832. if (inSave) {
  833. this.$message.success("保存成功");
  834. //关闭窗口
  835. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  836. }
  837. },
  838. //自定义列重置
  839. async resetColumnTwo(ref, option, optionBack, code) {
  840. this[option] = this[optionBack];
  841. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  842. if (this.saberUserInfo.role_name.indexOf('admin') != -1 || this.saberUserInfo.role_name.indexOf('总部') != -1) {
  843. this.option.searchMenuSpan = 24
  844. this.option.column.forEach(item => {
  845. if (item.prop == 'branchId') {
  846. item.search = true
  847. }
  848. if (item.prop == 'branchName') {
  849. item.hide = false
  850. item.showColumn = true
  851. }
  852. })
  853. }
  854. if (inSave) {
  855. this.$message.success("重置成功");
  856. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  857. }
  858. },
  859. // 更改表格颜色
  860. headerClassName(tab) {
  861. //颜色间隔
  862. let back = ""
  863. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  864. if (tab.columnIndex % 2 === 0) {
  865. back = "back-one"
  866. } else if (tab.columnIndex % 2 === 1) {
  867. back = "back-two"
  868. }
  869. }
  870. return back;
  871. },
  872. }
  873. };
  874. </script>
  875. <style scoped>
  876. ::v-deep#out-table .back-one {
  877. background: #ecf5ff !important;
  878. text-align: center;
  879. }
  880. ::v-deep#out-table .back-two {
  881. background: #ecf5ff !important;
  882. text-align: center;
  883. }
  884. .pointerClick {
  885. cursor: pointer;
  886. color: #1e9fff;
  887. }
  888. /deep/ .el-col-md-8 {
  889. width: 24.33333%;
  890. }
  891. </style>