index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. <template>
  2. <div>
  3. <basic-container v-if="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" @on-load="onLoad"
  23. @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. </template>
  34. <template slot="menu" slot-scope="{row}">
  35. <el-button v-if="tabsValue == 'C' || tabsValue == 'D'" type="text" size="small"
  36. :disabled="saberUserInfo.role_name.indexOf('admin') == -1 ? saberUserInfo.role_name.indexOf('允许修改他人业务') == -1 ? saberUserInfo.user_id != row.createUser : false : false"
  37. @click="settlementfun(row)">结算
  38. </el-button>
  39. <el-button v-if="tabsValue == '业务单据' || tabsValue == '已完成'" type="text" size="small"
  40. @click="editfun(row)">编辑
  41. </el-button>
  42. <!--:disabled="saberUserInfo.role_name.indexOf('允许修改他人业务') == -1?saberUserInfo.user_id != row.createUser:false"-->
  43. <el-button v-if="tabsValue == '业务单据'" type="text" size="small"
  44. :disabled="saberUserInfo.role_name.indexOf('admin') == -1 ? saberUserInfo.role_name.indexOf('允许修改他人业务') == -1 ? saberUserInfo.user_id != row.createUser : false : false"
  45. @click="rowDel(row)">删除
  46. </el-button>
  47. </template>
  48. <template slot="billNo" slot-scope="{row}">
  49. <span class="pointerClick" @click="editfun(row)">{{ row.billNo }}
  50. </span>
  51. </template>
  52. <template slot="requestNo" slot-scope="{row}">
  53. <span class="pointerClick" @click="editfun2(row)">{{ row.requestNo }}
  54. </span>
  55. </template>
  56. </avue-crud>
  57. </basic-container>
  58. <settlementDetails ref="settlementDetailsRef" v-if="!isShow" :editSave="editSave" @goBack="goBack">
  59. </settlementDetails>
  60. </div>
  61. </template>
  62. <script>
  63. import { fininvoicesList, generateFinStlBills } from "@/api/iosBasicData/fininvoices";
  64. import { finstlbillsList, finstlbillsRemove } from "@/api/iosBasicData/finstlbills";
  65. import finstlbillsDetails from "@/views/iosBasicData/CollectionSettlement/finstlbillsDetails.vue";
  66. import settlementDetails from "@/views/iosBasicData/ComputationCenter/settlementDetails.vue";
  67. import { getBcorpslistByType } from "@/api/iosBasicData/bcorps";
  68. import { bbusinesstypeList } from "@/api/iosBasicData/bbusinesstype";
  69. export default {
  70. components: { settlementDetails },
  71. data() {
  72. return {
  73. selectionList: [], // 多选的数据
  74. isShow: true,
  75. editSave: false, // 详情是否禁用
  76. tabsValue: 'C', // tabs切换
  77. // 动画
  78. loading: false,
  79. // 分页
  80. page: {
  81. pageSize: 10,
  82. currentPage: 1,
  83. total: 0
  84. },
  85. query: {}, // 检索条件
  86. data: [], // 数据
  87. form: {},
  88. option: {},
  89. optionBack: {
  90. height: 'auto',
  91. calcHeight: 30,
  92. tip: false,
  93. searchShow: true,
  94. searchMenuSpan: 6,
  95. searchLabelWidth: '100',
  96. border: true,
  97. index: true,
  98. selection: true,
  99. dialogClickModal: false,
  100. searchIcon: true,
  101. searchIndex: 3,
  102. stripe: true,
  103. addBtn: false,
  104. viewBtn: false,
  105. delBtn: false,
  106. editBtn: false,
  107. menuWidth: '100',
  108. column: [
  109. {
  110. label: "业务类型",
  111. prop: "businessType",
  112. hide: false,
  113. overHidden: true,
  114. type: 'select',
  115. dicData: [],
  116. props: {
  117. label: "cnName",
  118. value: "code"
  119. },
  120. },
  121. {
  122. label: "业务类型",
  123. prop: "type",
  124. hide: true,
  125. overHidden: true,
  126. },
  127. {
  128. label: "单据编号",
  129. prop: "billNo",
  130. search: true,
  131. overHidden: true,
  132. },
  133. {
  134. label: "来源单号",
  135. prop: "requestNo",
  136. search: true,
  137. overHidden: true,
  138. },
  139. {
  140. label: "往来单位",
  141. prop: "corpCnName",
  142. search: true,
  143. overHidden: true,
  144. type: 'select',
  145. filterable: true,
  146. remote: true,
  147. dicUrl: "/api/blade-los/bcorps/listByType?cnName={{key}}",
  148. dicData: [],
  149. props: {
  150. label: 'cnName',
  151. value: 'cnName',
  152. res: 'data.records'
  153. },
  154. },
  155. {
  156. label: "发票抬头",
  157. prop: "invCorpCnName",
  158. hide: true,
  159. overHidden: true,
  160. },
  161. {
  162. label: "申请人",
  163. prop: "createUserName",
  164. overHidden: true,
  165. },
  166. {
  167. label: "结算日期",
  168. prop: "billDate",
  169. overHidden: true,
  170. width: "150",
  171. },
  172. {
  173. label: "结算日期起",
  174. prop: "billDateStart",
  175. search: true,
  176. overHidden: true,
  177. hide: true,
  178. searchLabelWidth: '100',
  179. type: "date",
  180. format: "yyyy-MM-dd",
  181. valueFormat: "yyyy-MM-dd HH:mm:ss",
  182. },
  183. {
  184. label: "结算日期止",
  185. prop: "billDateEnd",
  186. search: true,
  187. overHidden: true,
  188. hide: true,
  189. searchLabelWidth: '100',
  190. type: "date",
  191. format: "yyyy-MM-dd",
  192. valueFormat: "yyyy-MM-dd HH:mm:ss",
  193. },
  194. {
  195. label: "单据开始日期",
  196. prop: "businessDateStart",
  197. search: true,
  198. overHidden: true,
  199. hide: true,
  200. searchLabelWidth: '100',
  201. type: "date",
  202. format: "yyyy-MM-dd",
  203. valueFormat: "yyyy-MM-dd HH:mm:ss",
  204. },
  205. {
  206. label: "单据结束日期",
  207. prop: "businessDateEnd",
  208. search: true,
  209. overHidden: true,
  210. hide: true,
  211. searchLabelWidth: '100',
  212. type: "date",
  213. format: "yyyy-MM-dd",
  214. valueFormat: "yyyy-MM-dd HH:mm:ss",
  215. },
  216. // {
  217. // label: "单据日期",
  218. // prop: "billDate",
  219. // search:true,
  220. // overHidden:true,
  221. // searchProp: 'billDateList',
  222. // type: "daterange",
  223. // searchRange: true,
  224. // searchDefaultTime: ["00:00:00", "23:59:59"],
  225. // format: "yyyy-MM-dd",
  226. // valueFormat: "yyyy-MM-dd HH:mm:ss"
  227. // },
  228. {
  229. label: "提交日期",
  230. prop: "auditDateFrom",
  231. width: "140",
  232. overHidden: true,
  233. },
  234. {
  235. label: "审核日期",
  236. prop: "auditDateTo",
  237. width: "140",
  238. overHidden: true,
  239. },
  240. {
  241. label: "收/付",
  242. prop: "dc",
  243. width: "140",
  244. search: true,
  245. type: "select",
  246. dicData: [{
  247. id: 'C',
  248. name: "付款",
  249. }, {
  250. id: 'D',
  251. name: "收款",
  252. }],
  253. props: {
  254. label: "name",
  255. value: "id",
  256. },
  257. overHidden: true,
  258. },
  259. {
  260. label: "CNY",
  261. prop: "amountSub",
  262. overHidden: true,
  263. },
  264. {
  265. label: "USD",
  266. prop: "amountSubUsd",
  267. overHidden: true,
  268. },
  269. {
  270. label: "事由",
  271. prop: "remarks",
  272. overHidden: true,
  273. },
  274. ]
  275. },
  276. saberUserInfo: {}, // 当前登录人个人信息
  277. }
  278. },
  279. async created() {
  280. // 获取当前登录人个人信息
  281. this.saberUserInfo = JSON.parse(localStorage.getItem('saber-userInfo')).content
  282. this.option = await this.getColumnData(this.getColumnName(324), this.optionBack);
  283. if (this.$route.query.billId) {
  284. // 从审批里查看跳进来的
  285. this.editFun({ id: this.$route.query.billId })
  286. }
  287. this.$store.commit('JSZX_IN_DETAIL')
  288. this.getBcorpslistByTypefun()
  289. this.bbusinesstypeListfun()
  290. },
  291. methods: {
  292. // 获取业务类型
  293. bbusinesstypeListfun() {
  294. bbusinesstypeList(1, 50).then(res => {
  295. this.findObject(this.option.column, "businessType").dicData = res.data.data.records
  296. })
  297. },
  298. // 获取往来单位数据
  299. getBcorpslistByTypefun() {
  300. getBcorpslistByType(1, 10).then(res => {
  301. this.findObject(this.option.column, "corpCnName").dicData = res.data.data.records
  302. })
  303. },
  304. // 选择结算
  305. chooseSettlement() {
  306. if (this.selectionList.length === 0) {
  307. this.$message.warning("请选择至少一条数据");
  308. return;
  309. }
  310. this.$confirm("确定将选择数据结算?", {
  311. confirmButtonText: "确定",
  312. cancelButtonText: "取消",
  313. type: "warning"
  314. }).then(() => {
  315. let arrId = this.selectionList.map(item => {
  316. return item.id
  317. })
  318. this.isShow = false
  319. this.$nextTick(() => {
  320. this.$refs.settlementDetailsRef.generateFinStlBillsfun(arrId.join(','), this.tabsValue)
  321. })
  322. })
  323. },
  324. // 结算
  325. settlementfun(row) {
  326. this.isShow = false
  327. // this.editSave = true
  328. this.$nextTick(() => {
  329. this.$refs.settlementDetailsRef.generateFinStlBillsfun(row.id, this.tabsValue)
  330. })
  331. },
  332. // 添加
  333. addfun() {
  334. this.isShow = false
  335. this.editSave = false
  336. },
  337. // 编辑
  338. editfun(row) {
  339. this.isShow = false
  340. this.editSave = true
  341. this.$nextTick(() => {
  342. this.$refs.settlementDetailsRef.finstlbillsDetailfun(row.id)
  343. })
  344. },
  345. // 编辑
  346. editfun2(row) {
  347. if (row.dc == 'C') {
  348. this.$router.push({
  349. path: "/iosBasicData/PaymentApplication/index",
  350. query: {
  351. id: row.id
  352. }
  353. });
  354. } else {
  355. this.$router.push({
  356. path: "/iosBasicData/fininvoicesOutput/index",
  357. query: {
  358. id: row.id
  359. }
  360. });
  361. }
  362. },
  363. // 详情的返回列表
  364. goBack() {
  365. // 初始化数据
  366. // this.detailData = this.$options.data().detailData;
  367. if (JSON.stringify(this.$route.query) != "{}") {
  368. this.$router.$avueRouter.closeTag();
  369. this.$router.push({
  370. path: "/iosBasicData/ComputationCenter/index"
  371. });
  372. }
  373. this.isShow = true;
  374. this.onLoad(this.page, this.search);
  375. },
  376. // tabs 切换
  377. handleClick() {
  378. if (this.tabsValue == 'D') {
  379. this.findObject(this.option.column, "invCorpCnName").hide = false
  380. this.findObject(this.option.column, "type").hide = false
  381. this.findObject(this.option.column, "businessType").hide = true
  382. } else {
  383. this.findObject(this.option.column, "invCorpCnName").hide = true
  384. this.findObject(this.option.column, "type").hide = true
  385. this.findObject(this.option.column, "businessType").hide = false
  386. }
  387. // this.query = {};
  388. this.page.currentPage = 1
  389. this.selectionList = []
  390. this.$set(this.query, 'billNo', '')
  391. this.$set(this.query, 'corpCnName', '')
  392. this.$set(this.query, 'businessDateStart', '')
  393. this.$set(this.query, 'businessDateEnd', '')
  394. this.onLoad(this.page)
  395. },
  396. // 刷新回调
  397. refreshChange() {
  398. console.log('刷新回调')
  399. this.onLoad(this.page)
  400. },
  401. // 分页回调
  402. currentChange(currentPage) {
  403. console.log(currentPage, '分页回调')
  404. this.page.currentPage = currentPage;
  405. },
  406. sizeChange(pageSize) {
  407. console.log(pageSize, '分条回调')
  408. this.page.pageSize = pageSize;
  409. },
  410. // 多选回调
  411. selectionChange(list) {
  412. console.log(list, '多选回调')
  413. this.selectionList = list;
  414. },
  415. // 清空回调
  416. searchReset() {
  417. console.log('清空回调')
  418. this.query = {};
  419. this.onLoad(this.page);
  420. },
  421. // 搜索回调
  422. searchChange(params, done) {
  423. console.log(params, '搜索回调')
  424. this.query = params;
  425. this.page.currentPage = 1;
  426. this.onLoad(this.page, params);
  427. done();
  428. },
  429. // 一键删除
  430. handleDelete() {
  431. if (this.selectionList.length === 0) {
  432. this.$message.warning("请选择至少一条数据");
  433. return;
  434. }
  435. // 判断是否可以编辑别人业务 true 就没有权限
  436. if (this.ModifyOthersfun()) return;
  437. this.$confirm("确定将选择数据删除?", {
  438. confirmButtonText: "确定",
  439. cancelButtonText: "取消",
  440. type: "warning"
  441. }).then(() => {
  442. let arrId = this.selectionList.map(item => {
  443. return item.id
  444. })
  445. finstlbillsRemove(arrId.join(',')).then(res => {
  446. this.onLoad(this.page);
  447. this.$message({
  448. type: "success",
  449. message: "操作成功!"
  450. });
  451. })
  452. })
  453. },
  454. // 行删除回调
  455. rowDel(row) {
  456. console.log('行删除回调')
  457. this.$confirm("确定将选择数据删除?", {
  458. confirmButtonText: "确定",
  459. cancelButtonText: "取消",
  460. type: "warning"
  461. }).then(() => {
  462. finstlbillsRemove(row.id).then(res => {
  463. this.onLoad(this.page);
  464. this.$message({
  465. type: "success",
  466. message: "操作成功!"
  467. });
  468. })
  469. })
  470. },
  471. // 判断是否可以编辑别人业务
  472. ModifyOthersfun() {
  473. let sumArr = []
  474. const h = this.$createElement
  475. // 判断是否有权限
  476. if (this.saberUserInfo.role_name.indexOf('允许修改他人业务') != -1) return false
  477. // 当前登录人和选择的创建人对比是不是一个人
  478. for (let item of this.selectionList) {
  479. if (this.saberUserInfo.user_id != item.createUser) {
  480. sumArr.push(h('p', `你没有"允许修改他人业务"权限,请重新选择数据`))
  481. }
  482. }
  483. if (sumArr.length != 0) {
  484. this.$confirm('提示', {
  485. message: h('div', sumArr),
  486. confirmButtonText: "确定",
  487. cancelButtonText: "取消",
  488. type: "warning"
  489. }).catch(err => { })
  490. return true
  491. }
  492. },
  493. // 新增弹窗确认回调
  494. rowSave(row, done, loading) {
  495. console.log('新增弹窗确认回调')
  496. },
  497. // 编辑弹窗确认回调
  498. rowUpdate(row, index, done, loading) {
  499. console.log('编辑弹窗确认回调')
  500. done();
  501. loading();
  502. },
  503. // 打开弹窗的回调
  504. beforeOpen(done, type) {
  505. console.log(type, '打开弹窗的回调')
  506. done();
  507. },
  508. // 列表获取数据
  509. async onLoad(page, params = {}) {
  510. this.loading = true;
  511. let res = {}
  512. if (this.tabsValue == 'C') {
  513. // 调用 付费申请数据
  514. res = await finstlbillsList(page.currentPage, page.pageSize, {
  515. ...Object.assign(params, this.query),
  516. businessType: 'FFSQ',
  517. status: 3,
  518. billStatus: 0,
  519. })
  520. } else if (this.tabsValue == 'D') {
  521. // 调用 销项发票业务数据
  522. res = await fininvoicesList(page.currentPage, page.pageSize, {
  523. ...Object.assign(params, this.query),
  524. type: '销项',
  525. status: 3,
  526. billStatus: 0,
  527. })
  528. } else if (this.tabsValue == '业务单据') {
  529. // 应收应付 业务数据
  530. res = await finstlbillsList(page.currentPage, page.pageSize, {
  531. ...Object.assign(params, this.query),
  532. businessType: 'STL',
  533. status: 0,
  534. })
  535. } else {
  536. // 应收应付 业务数据 已完成
  537. res = await finstlbillsList(page.currentPage, page.pageSize, {
  538. ...Object.assign(params, this.query),
  539. businessType: 'STL',
  540. status: 3,
  541. })
  542. }
  543. const data = res.data.data;
  544. this.page.total = data.total;
  545. this.data = data.records;
  546. this.loading = false;
  547. },
  548. //自定义列保存
  549. async saveColumnTwo(ref, option, optionBack, code) {
  550. /**
  551. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  552. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  553. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  554. */
  555. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  556. if (inSave) {
  557. this.$message.success("保存成功");
  558. //关闭窗口
  559. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  560. }
  561. },
  562. //自定义列重置
  563. async resetColumnTwo(ref, option, optionBack, code) {
  564. this[option] = this[optionBack];
  565. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  566. if (inSave) {
  567. this.$message.success("重置成功");
  568. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  569. }
  570. },
  571. // 更改表格颜色
  572. headerClassName(tab) {
  573. //颜色间隔
  574. let back = ""
  575. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  576. if (tab.columnIndex % 2 === 0) {
  577. back = "back-one"
  578. } else if (tab.columnIndex % 2 === 1) {
  579. back = "back-two"
  580. }
  581. }
  582. return back;
  583. },
  584. }
  585. }
  586. </script>
  587. <style scoped>
  588. ::v-deep#out-table .back-one {
  589. background: #ecf5ff !important;
  590. text-align: center;
  591. }
  592. ::v-deep#out-table .back-two {
  593. background: #ecf5ff !important;
  594. text-align: center;
  595. }
  596. /deep/ .el-col-md-8 {
  597. width: 24.33333%;
  598. }
  599. .pointerClick {
  600. cursor: pointer;
  601. color: #1e9fff;
  602. }
  603. </style>