index.vue 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008
  1. <template>
  2. <div>
  3. <basic-container v-show="isShow">
  4. <div style="margin-top: 10px">
  5. <el-tabs type="card" v-model="tabsValue" @tab-click="handleClick">
  6. <el-tab-pane label="待付" name="C">
  7. <span slot="label">待付</span>
  8. </el-tab-pane>
  9. <el-tab-pane label="待收" name="D">
  10. <span slot="label">待收</span>
  11. </el-tab-pane>
  12. <el-tab-pane label="业务单据" name="业务单据">
  13. <span slot="label" style="color: #4c9e44">财务单据</span>
  14. </el-tab-pane>
  15. <el-tab-pane label="已完成" name="已完成"></el-tab-pane>
  16. </el-tabs>
  17. </div>
  18. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" id="out-table"
  19. :header-cell-class-name="headerClassName" :before-open="beforeOpen" v-model="form" ref="crud"
  20. :search.sync="query" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel"
  21. @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
  22. @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"
  23. @on-load="onLoad" @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 324)"
  24. @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 324)">
  25. <template slot="menuLeft">
  26. <el-button v-if="tabsValue == 'C' || tabsValue == 'D'" type="primary" size="small" plain
  27. @click="chooseSettlement()">选择结算
  28. </el-button>
  29. <el-button v-if="tabsValue == '业务单据'" type="primary" size="small" plain @click="addfun()">添加单据
  30. </el-button>
  31. <el-button v-if="tabsValue == '业务单据'" type="danger" size="small" plain @click="handleDelete()">一键删除
  32. </el-button>
  33. <span style="font-size: 24px;font-weight: 600;">
  34. <span style="color: #67C23A;margin-right: 10px;">
  35. 本币:{{ amountSubSum.toFixed(2) }}元
  36. </span>
  37. <span style="color: #E6A23C;">
  38. 外币:{{ amountSubUsdSum.toFixed(2) }}元
  39. </span>
  40. </span>
  41. </template>
  42. <tempalte slot="feeCnNameSearch">
  43. <dic-select v-model="query.feeCnName" placeholder="费用名称" key="id" label="cnName" res="records"
  44. url="/blade-los/bfees/list" :filterable="true" :remote="true" dataName="cnName"></dic-select>
  45. </tempalte>
  46. <template slot="menu" slot-scope="{row}">
  47. <el-button v-if="tabsValue == 'C' || tabsValue == 'D'" type="text" size="small"
  48. :disabled="saberUserInfo.role_name.indexOf('admin') == -1 ? saberUserInfo.role_name.indexOf('允许修改他人业务') == -1 ? saberUserInfo.user_id != row.createUser : false : false"
  49. @click="settlementfun(row)">结算
  50. </el-button>
  51. <el-button v-if="tabsValue == '业务单据' || tabsValue == '已完成'" type="text" size="small"
  52. @click="rowEdit(row)">编辑
  53. </el-button>
  54. <!--:disabled="saberUserInfo.role_name.indexOf('允许修改他人业务') == -1?saberUserInfo.user_id != row.createUser:false"-->
  55. <el-button v-if="tabsValue == '业务单据'" type="text" size="small"
  56. :disabled="saberUserInfo.role_name.indexOf('admin') == -1 ? saberUserInfo.role_name.indexOf('允许修改他人业务') == -1 ? saberUserInfo.user_id != row.createUser : false : false"
  57. @click="rowDel(row)">删除
  58. </el-button>
  59. </template>
  60. <template slot="billNo" slot-scope="{row}">
  61. <span class="pointerClick" @click="rowEdit(row)">{{ row.billNo }}
  62. </span>
  63. </template>
  64. <!-- <template slot="requestNo" slot-scope="{row}">
  65. <span class="pointerClick" @click="editfun2(row)">{{ row.requestNo }}
  66. </span>
  67. </template> -->
  68. </avue-crud>
  69. </basic-container>
  70. <detailsPage ref="details" v-if="!isShow" :detailData="detailData" @goBack="goBack" @toAddEdit="toAddEdit"
  71. :pageIds="pageIds" :key="datekey">
  72. </detailsPage>
  73. </div>
  74. </template>
  75. <script>
  76. import { fininvoicesList, generateFinStlBills } from "@/api/iosBasicData/fininvoices";
  77. import { finstlbillsList, finstlbillsRemove } from "@/api/iosBasicData/finstlbills";
  78. import finstlbillsDetails from "@/views/iosBasicData/CollectionSettlement/finstlbillsDetails.vue";
  79. import settlementDetails from "@/views/iosBasicData/ComputationCenter/settlementDetails.vue";
  80. import { getBcorpslistByType } from "@/api/iosBasicData/bcorps";
  81. import { bbusinesstypeList } from "@/api/iosBasicData/bbusinesstype";
  82. import dicSelect from "@/components/dicSelect/main";
  83. import { dateFormat } from "@/util/date";
  84. import detailsPage from "./detailsPage";
  85. export default {
  86. components: { detailsPage, dicSelect },
  87. data() {
  88. return {
  89. pageIds: [],
  90. amountSubSum: 0,
  91. amountSubUsdSum: 0,
  92. datekey: Date.now(),
  93. selectionList: [], // 多选的数据
  94. isShow: true,
  95. editSave: false, // 详情是否禁用
  96. tabsValue: 'C', // tabs切换
  97. // 动画
  98. loading: false,
  99. // 分页
  100. page: {
  101. pageSize: 10,
  102. currentPage: 1,
  103. total: 0
  104. },
  105. query: {}, // 检索条件
  106. data: [], // 数据
  107. form: {},
  108. option: {},
  109. optionBack: {
  110. height: 'auto',
  111. calcHeight: 30,
  112. tip: false,
  113. searchShow: true,
  114. searchMenuSpan: 24,
  115. searchLabelWidth: '100',
  116. border: true,
  117. index: true,
  118. selection: true,
  119. dialogClickModal: false,
  120. stripe: true,
  121. addBtn: false,
  122. viewBtn: false,
  123. delBtn: false,
  124. editBtn: false,
  125. searchIcon: true,
  126. searchIndex: 3,
  127. menuWidth: '100',
  128. column: [
  129. {
  130. label: "所属公司",
  131. prop: "branchId",
  132. width: "120",
  133. overHidden: true,
  134. hide: true,
  135. showColumn: false,
  136. type: "select",
  137. filterable: true,
  138. dicUrl: "/api/blade-system/dept/lazy-list",
  139. props: {
  140. label: "deptName",
  141. value: "id",
  142. },
  143. search: false,
  144. searchOrder: 1
  145. },
  146. {
  147. label: "所属公司",
  148. prop: "branchName",
  149. width: "120",
  150. overHidden: true,
  151. hide: true,
  152. showColumn: false,
  153. },
  154. {
  155. label: "往来单位",
  156. prop: "corpCnName",
  157. search: true,
  158. overHidden: true,
  159. type: 'select',
  160. filterable: true,
  161. remote: true,
  162. dicUrl: "/api/blade-los/bcorps/listByType?cnName={{key}}",
  163. dicData: [],
  164. searchOrder: 1.1,
  165. props: {
  166. label: 'cnName',
  167. value: 'cnName',
  168. res: 'data.records'
  169. },
  170. },
  171. {
  172. label: "MB/L NO",
  173. prop: "mblno",
  174. search: true,
  175. searchOrder: 2,
  176. overHidden: true
  177. },
  178. {
  179. label: "HB/L NO",
  180. prop: "hblno",
  181. search: true,
  182. searchOrder: 2.2,
  183. overHidden: true
  184. },
  185. {
  186. label: "业务类型",
  187. prop: "businessType",
  188. hide: false,
  189. overHidden: true,
  190. type: 'select',
  191. dicData: [],
  192. props: {
  193. label: "cnName",
  194. value: "code"
  195. },
  196. },
  197. {
  198. label: "业务类型",
  199. prop: "type",
  200. hide: true,
  201. overHidden: true,
  202. },
  203. {
  204. label: "JOB NO",
  205. prop: "billNo",
  206. search: true,
  207. overHidden: true,
  208. },
  209. {
  210. label: "来源单号",
  211. prop: "requestNo",
  212. search: true,
  213. overHidden: true,
  214. },
  215. {
  216. label: "发票抬头",
  217. prop: "invCorpCnName",
  218. hide: true,
  219. overHidden: true,
  220. },
  221. {
  222. label: "费用名称",
  223. prop: "feeCnName",
  224. search: true,
  225. overHidden: true,
  226. },
  227. // {
  228. // label: "申请人",
  229. // prop: "createUserName",
  230. // overHidden: true,
  231. // },
  232. {
  233. label: "结算日期",
  234. prop: "billDate",
  235. overHidden: true,
  236. width: "150",
  237. },
  238. {
  239. label: "结算日期起",
  240. prop: "billDateStart",
  241. search: true,
  242. overHidden: true,
  243. hide: true,
  244. searchLabelWidth: '100',
  245. type: "date",
  246. format: "yyyy-MM-dd",
  247. valueFormat: "yyyy-MM-dd HH:mm:ss",
  248. },
  249. {
  250. label: "结算日期止",
  251. prop: "billDateEnd",
  252. search: true,
  253. overHidden: true,
  254. hide: true,
  255. searchLabelWidth: '100',
  256. type: "date",
  257. format: "yyyy-MM-dd",
  258. valueFormat: "yyyy-MM-dd HH:mm:ss",
  259. },
  260. {
  261. label: "开票日期起",
  262. prop: "invoiceDateStart",
  263. search: false,
  264. overHidden: true,
  265. hide: true,
  266. searchLabelWidth: '100',
  267. type: "date",
  268. format: "yyyy-MM-dd",
  269. valueFormat: "yyyy-MM-dd HH:mm:ss",
  270. },
  271. {
  272. label: "开票日期止",
  273. prop: "invoiceDateEnd",
  274. search: false,
  275. overHidden: true,
  276. hide: true,
  277. searchLabelWidth: '100',
  278. type: "date",
  279. format: "yyyy-MM-dd",
  280. valueFormat: "yyyy-MM-dd HH:mm:ss",
  281. },
  282. {
  283. label: "单据开始日期",
  284. prop: "businessDateStart",
  285. search: true,
  286. overHidden: true,
  287. hide: true,
  288. searchLabelWidth: '100',
  289. type: "date",
  290. format: "yyyy-MM-dd",
  291. valueFormat: "yyyy-MM-dd HH:mm:ss",
  292. },
  293. {
  294. label: "单据结束日期",
  295. prop: "businessDateEnd",
  296. search: true,
  297. overHidden: true,
  298. hide: true,
  299. searchLabelWidth: '100',
  300. type: "date",
  301. format: "yyyy-MM-dd",
  302. valueFormat: "yyyy-MM-dd HH:mm:ss",
  303. },
  304. // {
  305. // label: "单据日期",
  306. // prop: "billDate",
  307. // search:true,
  308. // overHidden:true,
  309. // searchProp: 'billDateList',
  310. // type: "daterange",
  311. // searchRange: true,
  312. // searchDefaultTime: ["00:00:00", "23:59:59"],
  313. // format: "yyyy-MM-dd",
  314. // valueFormat: "yyyy-MM-dd HH:mm:ss"
  315. // },
  316. {
  317. label: "提交日期",
  318. prop: "auditDateFrom",
  319. width: "140",
  320. overHidden: true,
  321. },
  322. {
  323. label: "审核日期",
  324. prop: "auditDateTo",
  325. width: "140",
  326. overHidden: true,
  327. },
  328. {
  329. label: "收/付",
  330. prop: "dc",
  331. width: "140",
  332. search: true,
  333. type: "select",
  334. dicData: [{
  335. id: 'C',
  336. name: "付款",
  337. }, {
  338. id: 'D',
  339. name: "收款",
  340. }],
  341. props: {
  342. label: "name",
  343. value: "id",
  344. },
  345. overHidden: true,
  346. },
  347. {
  348. label: "结算人",
  349. prop: "createUserName",
  350. width: "100",
  351. search: false,
  352. hide: true,
  353. overHidden: true,
  354. },
  355. {
  356. label: "核销人",
  357. prop: "createUserNames",
  358. width: "100",
  359. search: true,
  360. hide: false,
  361. overHidden: true,
  362. },
  363. {
  364. label: "JOB NO",
  365. prop: "businessNo",
  366. width: "120",
  367. search: true,
  368. searchOrder: 3,
  369. overHidden: true
  370. },
  371. {
  372. label: "ACCT NO",
  373. prop: "accountNo",
  374. width: "100",
  375. search: true,
  376. searchOrder: 5,
  377. overHidden: true
  378. },
  379. {
  380. label: "对账单号",
  381. prop: "checkNo",
  382. search: true,
  383. width: "100",
  384. searchOrder: 6,
  385. overHidden: true
  386. },
  387. {
  388. label: "船名",
  389. prop: "vesselCnName",
  390. search: true,
  391. searchOrder: 7,
  392. overHidden: true
  393. },
  394. {
  395. label: "航次",
  396. prop: "voyageNo",
  397. search: true,
  398. searchOrder: 8,
  399. overHidden: true
  400. },
  401. {
  402. label: "发票汇率",
  403. prop: "exrate",
  404. overHidden: true,
  405. hide: true,
  406. },
  407. {
  408. label: "是否转人民币",
  409. prop: "isExchangeToCny",
  410. overHidden: true,
  411. hide: true,
  412. width: "100",
  413. dicData: [{
  414. label: '否',
  415. value: '0'
  416. }, {
  417. label: '是',
  418. value: '1'
  419. }]
  420. },
  421. {
  422. label: "本币",
  423. prop: "amountSub",
  424. overHidden: true,
  425. },
  426. {
  427. label: "外币",
  428. prop: "amountSubUsd",
  429. overHidden: true,
  430. },
  431. {
  432. label: "事由",
  433. prop: "remarks",
  434. overHidden: true,
  435. },
  436. ]
  437. },
  438. saberUserInfo: {}, // 当前登录人个人信息
  439. detailData: {},
  440. }
  441. },
  442. async created() {
  443. // 获取当前登录人个人信息
  444. this.saberUserInfo = JSON.parse(localStorage.getItem('saber-userInfo')).content
  445. this.option = await this.getColumnData(this.getColumnName(324), this.optionBack);
  446. if (this.saberUserInfo.role_name.indexOf('admin') != -1 || this.saberUserInfo.role_name.indexOf('总部') != -1) {
  447. this.option.searchMenuSpan = 24
  448. this.option.column.forEach(item => {
  449. if (item.prop == 'branchId') {
  450. item.search = true
  451. }
  452. if (item.prop == 'branchName') {
  453. item.hide = false
  454. item.showColumn = true
  455. }
  456. })
  457. }
  458. if (this.$route.query.billId) {
  459. // 从审批里查看跳进来的
  460. this.rowEdit({ id: this.$route.query.billId })
  461. }
  462. this.$store.commit('JSZX_IN_DETAIL')
  463. this.getBcorpslistByTypefun()
  464. this.bbusinesstypeListfun()
  465. },
  466. activated() {
  467. setTimeout(() => {
  468. if (this.$route.query.billNo) {
  469. this.isShow = false
  470. this.$nextTick(() => {
  471. this.$refs.settlementDetailsRef.finstlbillsDetailfun(this.$route.query.billNo)
  472. })
  473. this.$store.commit('JSZX_IN_DETAIL')
  474. }
  475. }, 100);
  476. },
  477. methods: {
  478. // 获取业务类型
  479. bbusinesstypeListfun() {
  480. bbusinesstypeList(1, 50).then(res => {
  481. this.findObject(this.option.column, "businessType").dicData = res.data.data.records
  482. })
  483. },
  484. // 获取往来单位数据
  485. getBcorpslistByTypefun() {
  486. getBcorpslistByType(1, 10).then(res => {
  487. this.findObject(this.option.column, "corpCnName").dicData = res.data.data.records
  488. })
  489. },
  490. // 选择结算
  491. chooseSettlement() {
  492. if (this.selectionList.length === 0) {
  493. this.$message.warning("请选择要结算的数据");
  494. return;
  495. }
  496. for (let item of this.selectionList) {
  497. if (item.branchName != this.selectionList[0].branchName) {
  498. return this.$message.error('请选择相同的所属公司')
  499. }
  500. if (item.corpId != this.selectionList[0].corpId) {
  501. return this.$message.error('请选择相同的往来单位')
  502. }
  503. }
  504. // this.$confirm("确定将选择数据结算?", {
  505. // confirmButtonText: "确定",
  506. // cancelButtonText: "取消",
  507. // type: "warning"
  508. // }).then(() => {
  509. // let arrId = this.selectionList.map(item => {
  510. // return item.id
  511. // })
  512. // this.isShow = false
  513. // this.$nextTick(() => {
  514. // this.$refs.settlementDetailsRef.generateFinStlBillsfun(arrId.join(','), this.tabsValue)
  515. // })
  516. // })
  517. this.$DialogForm.show({
  518. title: '生成结算单',
  519. width: '30%',
  520. menuPosition: 'right',
  521. data: {
  522. date: dateFormat(new Date(), "yyyy-MM-dd") + ' 00:00:00',
  523. },
  524. option: {
  525. submitText: '确定',
  526. emptyText: '取消',
  527. column: [
  528. {
  529. label: '结算日期',
  530. prop: 'date',
  531. span: 24,
  532. type: "date",
  533. format: "yyyy-MM-dd",
  534. valueFormat: "yyyy-MM-dd 00:00:00",
  535. rules: [{
  536. required: true,
  537. message: "请选择日期",
  538. trigger: "blur",
  539. }],
  540. },
  541. ]
  542. },
  543. beforeClose: (done) => {
  544. done()
  545. },
  546. callback: (res) => {
  547. res.done()
  548. let arrId = this.selectionList.map(item => {
  549. return item.id
  550. })
  551. this.isShow = false
  552. this.$nextTick(() => {
  553. this.$refs.details.generateFinStlBills(arrId.join(","), res.data, this.tabsValue)
  554. })
  555. res.close()
  556. }
  557. })
  558. },
  559. // 结算
  560. settlementfun(row) {
  561. this.$DialogForm.show({
  562. title: '生成结算单',
  563. width: '30%',
  564. menuPosition: 'right',
  565. data: {
  566. date: dateFormat(new Date(), "yyyy-MM-dd") + ' 00:00:00',
  567. },
  568. option: {
  569. submitText: '确定',
  570. emptyText: '取消',
  571. column: [
  572. {
  573. label: '结算日期',
  574. prop: 'date',
  575. span: 24,
  576. type: "date",
  577. format: "yyyy-MM-dd",
  578. valueFormat: "yyyy-MM-dd 00:00:00",
  579. rules: [{
  580. required: true,
  581. message: "请选择日期",
  582. trigger: "blur",
  583. }],
  584. },
  585. ]
  586. },
  587. beforeClose: (done) => {
  588. done()
  589. },
  590. callback: (res) => {
  591. res.done()
  592. console.log(res.data)
  593. this.isShow = false
  594. this.$nextTick(() => {
  595. this.$refs.details.generateFinStlBills(row.id, res.data, this.tabsValue)
  596. })
  597. res.close()
  598. }
  599. })
  600. },
  601. // 添加
  602. addfun() {
  603. this.pageIds = []
  604. this.isShow = false
  605. },
  606. toAddEdit() {
  607. this.detailData = {}
  608. this.datekey = Date.now()
  609. this.isShow = false
  610. },
  611. // 编辑
  612. rowEdit(row) {
  613. if (this.tabsValue == 'C') {
  614. if (this.$store.getters.payAppStatus) {
  615. this.$alert("付费申请页面已存在,请关闭付费申请再进行操作", "温馨提示", {
  616. confirmButtonText: "确定",
  617. type: 'warning',
  618. callback: action => {
  619. }
  620. });
  621. } else {
  622. this.$router.push({
  623. path: `/iosBasicData/financialManagement/PaymentApplication/index`,
  624. query: {
  625. id: row.id
  626. }
  627. })
  628. }
  629. } else if (this.tabsValue == 'D') {
  630. if (this.$store.getters.finOutStatus) {
  631. this.$alert("销项发票页面已存在,请关闭销项发票再进行操作", "温馨提示", {
  632. confirmButtonText: "确定",
  633. type: 'warning',
  634. callback: action => {
  635. }
  636. });
  637. } else {
  638. this.$router.push({
  639. path: `/iosBasicData/financialManagement/fininvoicesOutput/index`,
  640. query: {
  641. id: row.id
  642. }
  643. })
  644. }
  645. } else {
  646. this.pageIds = []
  647. this.data.forEach(item => {
  648. this.pageIds.push(item.id)
  649. })
  650. this.detailData = {
  651. id: row.id
  652. };
  653. this.isShow = false
  654. }
  655. },
  656. // 编辑
  657. editfun2(row) {
  658. if (row.dc == 'C') {
  659. if (this.$store.getters.payAppStatus) {
  660. this.$alert("付费申请页面已存在,请关闭付费申请再进行操作", "温馨提示", {
  661. confirmButtonText: "确定",
  662. type: 'warning',
  663. callback: action => {
  664. }
  665. });
  666. } else {
  667. this.$router.push({
  668. path: `/iosBasicData/financialManagement/PaymentApplication/index`,
  669. query: {
  670. id: row.id
  671. }
  672. })
  673. }
  674. } else {
  675. if (this.$store.getters.finOutStatus) {
  676. this.$alert("销项发票页面已存在,请关闭销项发票再进行操作", "温馨提示", {
  677. confirmButtonText: "确定",
  678. type: 'warning',
  679. callback: action => {
  680. }
  681. });
  682. } else {
  683. this.$router.push({
  684. path: `/iosBasicData/financialManagement/fininvoicesOutput/index`,
  685. query: {
  686. id: row.id
  687. }
  688. })
  689. }
  690. }
  691. },
  692. // 详情的返回列表
  693. goBack() {
  694. // 初始化数据
  695. this.pageIds = []
  696. // this.detailData = this.$options.data().detailData;
  697. if (JSON.stringify(this.$route.query) != "{}") {
  698. this.$router.$avueRouter.closeTag();
  699. this.$router.push({
  700. path: "/iosBasicData/financialManagement/computationCenter/index"
  701. });
  702. }
  703. this.detailData = {}
  704. this.isShow = true;
  705. this.onLoad(this.page, this.search);
  706. },
  707. // tabs 切换
  708. handleClick() {
  709. if (this.tabsValue == 'C') {
  710. this.findObject(this.option.column, "createUserName").hide = true
  711. this.findObject(this.option.column, "createUserName").search = false
  712. this.findObject(this.option.column, "createUserNames").hide = false
  713. this.findObject(this.option.column, "createUserNames").search = true
  714. this.findObject(this.option.column, "exrate").hide = true
  715. this.findObject(this.option.column, "isExchangeToCny").hide = true
  716. this.findObject(this.option.column, "invCorpCnName").hide = true
  717. this.findObject(this.option.column, "type").hide = true
  718. this.findObject(this.option.column, "businessType").hide = false
  719. this.findObject(this.option.column, "billDateStart").search = true
  720. this.findObject(this.option.column, "billDateEnd").search = true
  721. this.findObject(this.option.column, "businessDateStart").search = true
  722. this.findObject(this.option.column, "businessDateEnd").search = true
  723. this.findObject(this.option.column, "invoiceDateStart").search = false
  724. this.findObject(this.option.column, "invoiceDateEnd").search = false
  725. } else if (this.tabsValue == 'D') {
  726. this.findObject(this.option.column, "createUserName").hide = false
  727. this.findObject(this.option.column, "createUserName").search = true
  728. this.findObject(this.option.column, "createUserNames").hide = true
  729. this.findObject(this.option.column, "createUserNames").search = false
  730. this.findObject(this.option.column, "exrate").hide = false
  731. this.findObject(this.option.column, "isExchangeToCny").hide = false
  732. this.findObject(this.option.column, "invCorpCnName").hide = false
  733. this.findObject(this.option.column, "type").hide = false
  734. this.findObject(this.option.column, "businessType").hide = true
  735. this.findObject(this.option.column, "billDateStart").search = false
  736. this.findObject(this.option.column, "billDateEnd").search = false
  737. this.findObject(this.option.column, "businessDateStart").search = false
  738. this.findObject(this.option.column, "businessDateEnd").search = false
  739. this.findObject(this.option.column, "invoiceDateStart").search = true
  740. this.findObject(this.option.column, "invoiceDateEnd").search = true
  741. } else {
  742. this.findObject(this.option.column, "createUserName").hide = false
  743. this.findObject(this.option.column, "createUserName").search = true
  744. this.findObject(this.option.column, "createUserNames").hide = false
  745. this.findObject(this.option.column, "createUserNames").search = true
  746. this.findObject(this.option.column, "invCorpCnName").hide = true
  747. this.findObject(this.option.column, "type").hide = true
  748. this.findObject(this.option.column, "businessType").hide = false
  749. this.findObject(this.option.column, "billDateStart").search = true
  750. this.findObject(this.option.column, "billDateEnd").search = true
  751. this.findObject(this.option.column, "businessDateStart").search = true
  752. this.findObject(this.option.column, "businessDateEnd").search = true
  753. this.findObject(this.option.column, "invoiceDateStart").search = false
  754. this.findObject(this.option.column, "invoiceDateEnd").search = false
  755. }
  756. this.amountSubSum = 0
  757. this.amountSubUsdSum = 0
  758. // this.query = {};
  759. this.page.currentPage = 1
  760. this.selectionList = []
  761. this.$set(this.query, 'billNo', '')
  762. this.$set(this.query, 'corpCnName', '')
  763. this.$set(this.query, 'businessDateStart', '')
  764. this.$set(this.query, 'businessDateEnd', '')
  765. this.onLoad(this.page)
  766. },
  767. // 刷新回调
  768. refreshChange() {
  769. console.log('刷新回调')
  770. this.onLoad(this.page)
  771. },
  772. // 分页回调
  773. currentChange(currentPage) {
  774. console.log(currentPage, '分页回调')
  775. this.page.currentPage = currentPage;
  776. },
  777. sizeChange(pageSize) {
  778. console.log(pageSize, '分条回调')
  779. this.page.pageSize = pageSize;
  780. },
  781. // 多选回调
  782. selectionChange(list) {
  783. this.amountSubSum = 0
  784. this.amountSubUsdSum = 0
  785. if (list.length) {
  786. list.forEach(e => {
  787. this.amountSubSum += Number(e.amountSub)
  788. this.amountSubUsdSum += Number(e.amountSubUsd)
  789. })
  790. }
  791. this.selectionList = list;
  792. },
  793. // 清空回调
  794. searchReset() {
  795. console.log('清空回调')
  796. this.query = {};
  797. this.onLoad(this.page);
  798. },
  799. // 搜索回调
  800. searchChange(params, done) {
  801. console.log(params, '搜索回调')
  802. this.query = params;
  803. this.page.currentPage = 1;
  804. this.onLoad(this.page, params);
  805. done();
  806. },
  807. // 一键删除
  808. handleDelete() {
  809. if (this.selectionList.length === 0) {
  810. this.$message.warning("请选择至少一条数据");
  811. return;
  812. }
  813. // 判断是否可以编辑别人业务 true 就没有权限
  814. if (this.ModifyOthersfun()) return;
  815. this.$confirm("确定将选择数据删除?", {
  816. confirmButtonText: "确定",
  817. cancelButtonText: "取消",
  818. type: "warning"
  819. }).then(() => {
  820. let arrId = this.selectionList.map(item => {
  821. return item.id
  822. })
  823. finstlbillsRemove(arrId.join(',')).then(res => {
  824. this.onLoad(this.page);
  825. this.$message({
  826. type: "success",
  827. message: "操作成功!"
  828. });
  829. })
  830. })
  831. },
  832. // 行删除回调
  833. rowDel(row) {
  834. console.log('行删除回调')
  835. this.$confirm("确定将选择数据删除?", {
  836. confirmButtonText: "确定",
  837. cancelButtonText: "取消",
  838. type: "warning"
  839. }).then(() => {
  840. finstlbillsRemove(row.id).then(res => {
  841. this.onLoad(this.page);
  842. this.$message({
  843. type: "success",
  844. message: "操作成功!"
  845. });
  846. })
  847. })
  848. },
  849. // 判断是否可以编辑别人业务
  850. ModifyOthersfun() {
  851. let sumArr = []
  852. const h = this.$createElement
  853. // 判断是否有权限
  854. if (this.saberUserInfo.role_name.indexOf('允许修改他人业务') != -1) return false
  855. // 当前登录人和选择的创建人对比是不是一个人
  856. for (let item of this.selectionList) {
  857. if (this.saberUserInfo.user_id != item.createUser) {
  858. sumArr.push(h('p', `你没有"允许修改他人业务"权限,请重新选择数据`))
  859. }
  860. }
  861. if (sumArr.length != 0) {
  862. this.$confirm('提示', {
  863. message: h('div', sumArr),
  864. confirmButtonText: "确定",
  865. cancelButtonText: "取消",
  866. type: "warning"
  867. }).catch(err => { })
  868. return true
  869. }
  870. },
  871. // 新增弹窗确认回调
  872. rowSave(row, done, loading) {
  873. console.log('新增弹窗确认回调')
  874. },
  875. // 编辑弹窗确认回调
  876. rowUpdate(row, index, done, loading) {
  877. console.log('编辑弹窗确认回调')
  878. done();
  879. loading();
  880. },
  881. // 打开弹窗的回调
  882. beforeOpen(done, type) {
  883. console.log(type, '打开弹窗的回调')
  884. done();
  885. },
  886. // 列表获取数据
  887. async onLoad(page, params = {}) {
  888. this.loading = true;
  889. let res = {}
  890. if (this.tabsValue == 'C') {
  891. // 调用 付费申请数据
  892. res = await finstlbillsList(page.currentPage, page.pageSize, {
  893. ...Object.assign(params, this.query),
  894. businessType: 'FFSQ',
  895. status: 3,
  896. billStatus: 0,
  897. })
  898. } else if (this.tabsValue == 'D') {
  899. // 调用 销项发票业务数据
  900. res = await fininvoicesList(page.currentPage, page.pageSize, {
  901. ...Object.assign(params, this.query),
  902. type: '销项',
  903. status: 3,
  904. billStatus: 0,
  905. })
  906. } else if (this.tabsValue == '业务单据') {
  907. // 应收应付 业务数据
  908. res = await finstlbillsList(page.currentPage, page.pageSize, {
  909. ...Object.assign(params, this.query),
  910. businessType: 'STL',
  911. status: 0,
  912. })
  913. } else {
  914. // 应收应付 业务数据 已完成
  915. res = await finstlbillsList(page.currentPage, page.pageSize, {
  916. ...Object.assign(params, this.query),
  917. businessType: 'STL',
  918. status: 3,
  919. })
  920. }
  921. const data = res.data.data;
  922. this.page.total = data.total;
  923. this.data = data.records;
  924. this.loading = false;
  925. this.$nextTick(() => {
  926. this.$refs.crud.dicInit();
  927. });
  928. this.$refs.crud.refreshTable();
  929. },
  930. //自定义列保存
  931. async saveColumnTwo(ref, option, optionBack, code) {
  932. /**
  933. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  934. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  935. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  936. */
  937. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  938. if (inSave) {
  939. this.$message.success("保存成功");
  940. //关闭窗口
  941. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  942. }
  943. },
  944. //自定义列重置
  945. async resetColumnTwo(ref, option, optionBack, code) {
  946. this[option] = this[optionBack];
  947. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  948. if (this.saberUserInfo.role_name.indexOf('admin') != -1 || this.saberUserInfo.role_name.indexOf('总部') != -1) {
  949. this.option.searchMenuSpan = 24
  950. this.option.column.forEach(item => {
  951. if (item.prop == 'branchId') {
  952. item.search = true
  953. }
  954. if (item.prop == 'branchName') {
  955. item.hide = false
  956. item.showColumn = true
  957. }
  958. })
  959. }
  960. if (inSave) {
  961. this.$message.success("重置成功");
  962. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  963. }
  964. },
  965. // 更改表格颜色
  966. headerClassName(tab) {
  967. //颜色间隔
  968. let back = ""
  969. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  970. if (tab.columnIndex % 2 === 0) {
  971. back = "back-one"
  972. } else if (tab.columnIndex % 2 === 1) {
  973. back = "back-two"
  974. }
  975. }
  976. return back;
  977. },
  978. }
  979. }
  980. </script>
  981. <style scoped>
  982. ::v-deep#out-table .back-one {
  983. background: #ecf5ff !important;
  984. text-align: center;
  985. }
  986. ::v-deep#out-table .back-two {
  987. background: #ecf5ff !important;
  988. text-align: center;
  989. }
  990. /deep/ .el-col-md-8 {
  991. width: 24.33333%;
  992. }
  993. .pointerClick {
  994. cursor: pointer;
  995. color: #1e9fff;
  996. }
  997. </style>