index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. <template>
  2. <div>
  3. <basic-container v-show="isShow">
  4. <avue-crud :option="option"
  5. :data="dataList"
  6. ref="crud"
  7. v-model="form"
  8. :page.sync="page"
  9. :search.sync="search"
  10. :table-loading="loading"
  11. @row-del="rowDel"
  12. :before-open="beforeOpen"
  13. :before-close="beforeClose"
  14. @search-change="searchChange"
  15. @search-reset="searchReset"
  16. @selection-change="selectionChange"
  17. @current-change="currentChange"
  18. @size-change="sizeChange"
  19. @refresh-change="refreshChange"
  20. @on-load="onLoad"
  21. @tree-load="treeLoad"
  22. @saveColumn="saveColumn"
  23. @resetColumn="resetColumn"
  24. @search-criteria-switch="searchCriteriaSwitch"
  25. :cell-style="cellStyle">
  26. <template slot="menuLeft" slot-scope="{size}">
  27. <el-button type="success" :size="size" icon="el-icon-copy-document" @click="copyOrder" :disabled="single">复制单据</el-button>
  28. <el-button type="info" :size="size" icon="el-icon-printer">报表打印</el-button>
  29. <el-button type="warning" :size="size" icon="el-icon-thumb" :disabled="multiple" @click="applyPayment">申请货款</el-button>
  30. </template>
  31. <template slot-scope="scope" slot="orgOrderNo">
  32. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.orgOrderNo }}</span>
  33. </template>
  34. <template slot="corpIdSearch">
  35. <crop-select
  36. v-model="search.corpId"
  37. corpType="GYS"
  38. ></crop-select>
  39. </template>
  40. <template slot-scope="scope" slot="corpId">
  41. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.strCorpName }}</span>
  42. </template>
  43. <template slot-scope="scope" slot="orderNo">
  44. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.orderNo }}</span>
  45. </template>
  46. <template slot-scope="scope" slot="createUser">
  47. {{ scope.row.createUserName }}
  48. </template>
  49. <template slot-scope="scope" slot="menu">
  50. <!-- <el-button-->
  51. <!-- type="text"-->
  52. <!-- icon="el-icon-edit"-->
  53. <!-- size="small"-->
  54. <!-- @click.stop="editOpen(scope.row,scope.index)"-->
  55. <!-- >编辑-->
  56. <!-- </el-button>-->
  57. <el-button
  58. type="text"
  59. icon="el-icon-delete"
  60. size="small"
  61. @click.stop="rowDel(scope.row,scope.index)"
  62. :disabled="scope.row.status > 0"
  63. >删除
  64. </el-button>
  65. </template>
  66. </avue-crud>
  67. </basic-container>
  68. <detail-page
  69. ref="detail"
  70. @goBack="goBack"
  71. :detailData="detailData"
  72. v-if="!isShow"
  73. ></detail-page>
  74. <el-dialog
  75. title="账单"
  76. append-to-body
  77. class="el-dialogDeep"
  78. :visible.sync="applyPaymentDialog"
  79. width="60%"
  80. :close-on-click-modal="false"
  81. :destroy-on-close="true"
  82. :close-on-press-escape="false"
  83. v-dialog-drag
  84. >
  85. <apply-payment
  86. v-if="applyPaymentDialog"
  87. :billType="billType"
  88. :billData="billData"
  89. :arrList="applyPaymentList"
  90. @choceFun="choceFun"
  91. >
  92. </apply-payment>
  93. </el-dialog>
  94. <el-dialog
  95. append-to-body
  96. title="账单"
  97. class="el-dialogDeep"
  98. :visible.sync="financialAccountDialog"
  99. width="70%"
  100. :close-on-click-modal="false"
  101. :destroy-on-close="true"
  102. :close-on-press-escape="false"
  103. v-dialog-drag
  104. >
  105. <financial-account
  106. v-if="financialAccountDialog"
  107. :billType="billType"
  108. :billData="billData"
  109. :checkData="financeData"
  110. :arrList="applyPaymentList"
  111. @choceFun="choceFun"
  112. >
  113. </financial-account>
  114. </el-dialog>
  115. </div>
  116. </template>
  117. <script>
  118. import option from "./configuration/mainList.json";
  119. import {customerList, deleteDetails} from "@/api/basicData/purchaseOrder"
  120. import detailPage from "./detailsPageEdit";
  121. import { defaultDate } from "@/util/date";
  122. import ApplyPayment from "@/components/finance/applyPayment";
  123. import financialAccount from "../../../components/finance/financialAccount";
  124. import { gainUser } from "@/api/basicData/customerInquiry";
  125. import { customerList as feeList } from "@/api/basicData/basicFeesDesc";
  126. export default {
  127. name: "customerInformation",
  128. props: {
  129. detailData: {
  130. type: Object
  131. }
  132. },
  133. components: {
  134. detailPage,
  135. ApplyPayment,
  136. financialAccount
  137. },
  138. data() {
  139. return {
  140. configuration: {
  141. multipleChoices: false,
  142. multiple: false,
  143. collapseTags: false,
  144. placeholder: "请点击右边按钮选择",
  145. dicData: [],
  146. clearable: true,
  147. },
  148. search: {},
  149. loading: false,
  150. form: {},
  151. option: {},
  152. parentId: 0,
  153. dataList: [],
  154. page: {
  155. pageSize: 10,
  156. currentPage: 1,
  157. total: 0,
  158. pageSizes: [10,50,100,200,300]
  159. },
  160. // 非单个禁用
  161. single: true,
  162. // 非多个禁用
  163. multiple: true,
  164. selection: [],
  165. isShow: true,
  166. detailData: {},
  167. billType:"申请", //账单类型
  168. billData:{}, //账单需要数据
  169. financeData: {
  170. url:"/financialManagement/paymentRequest/index",
  171. pageStatus:"this.$store.getters.pqStatus",
  172. pageLabel:"付费申请",
  173. checkType: 'ffsq'
  174. }, // 账单请核需要的路由
  175. applyPaymentDialog:false,//生成账单组件
  176. financialAccountDialog:false,
  177. applyPaymentList: [],
  178. feesOption: [],
  179. }
  180. },
  181. async created() {
  182. this.search.requiredArrivalDate = defaultDate(1)
  183. // this.option = option
  184. this.option = await this.getColumnData(this.getColumnName(17), option);
  185. this.getWorkDicts("payment_term").then(res => {
  186. this.findObject(this.option.column, "paymentType").dicData =
  187. res.data.data;
  188. });
  189. gainUser().then(res => {
  190. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  191. })
  192. feeList().then(res => {
  193. this.feesOption = res.data.data.records
  194. })
  195. let i = 0;
  196. this.option.column.forEach(item => {
  197. if (item.search) i++
  198. })
  199. if (i % 3 !== 0){
  200. const num = 3 - Number(i % 3)
  201. this.option.searchMenuSpan = num * 8;
  202. this.option.searchMenuPosition = "right";
  203. }
  204. this.option.column.forEach(item => {
  205. if (item.pickerOptions) {
  206. item.pickerOptions = {
  207. shortcuts: [{
  208. text: '最近一周',
  209. onClick(picker) {
  210. const end = new Date();
  211. const start = new Date();
  212. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  213. picker.$emit('pick', [start, end]);
  214. }
  215. }, {
  216. text: '最近一个月',
  217. onClick(picker) {
  218. const end = new Date();
  219. const start = new Date();
  220. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  221. picker.$emit('pick', [start, end]);
  222. }
  223. }, {
  224. text: '最近三个月',
  225. onClick(picker) {
  226. const end = new Date();
  227. const start = new Date();
  228. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  229. picker.$emit('pick', [start, end]);
  230. }
  231. }]
  232. }
  233. }
  234. })
  235. },
  236. activated() {
  237. if (this.$route.query.check) {
  238. this.isShow = true
  239. // this.beforeOpenPage({id: this.$route.query.check.billId})
  240. this.detailData = {
  241. id: this.$route.query.check.billId,
  242. check: this.$route.query.check,
  243. };
  244. this.isShow = false;
  245. this.$store.commit("DOMCG_IN_DETAIL");
  246. }
  247. if (this.$route.query.params) {
  248. this.beforeOpenPage({id: this.$route.query.params})
  249. }
  250. },
  251. methods: {
  252. cellStyle() {
  253. return "padding:0;height:40px;";
  254. },
  255. searchCriteriaSwitch(type){
  256. if (type){
  257. this.option.height = this.option.height - 90
  258. }else {
  259. this.option.height = this.option.height + 90
  260. }
  261. this.$refs.crud.getTableHeight()
  262. },
  263. //删除列表后面的删除按钮触发触发(row, index, done)
  264. rowDel(row, index, done) {
  265. this.$confirm("确定将选择数据删除?", {
  266. confirmButtonText: "确定",
  267. cancelButtonText: "取消",
  268. type: "warning"
  269. }).then(() => {
  270. return deleteDetails(row.id);
  271. }).then(() => {
  272. this.$message({
  273. type: "success",
  274. message: "操作成功!"
  275. });
  276. this.page.currentPage = 1;
  277. this.onLoad(this.page, {parentId: 0});
  278. });
  279. },
  280. //查询全部
  281. initData() {
  282. customerList().then(res => {
  283. const column = this.findObject(this.option.column, "parentId");
  284. column.dicData = res.data.data.records;
  285. });
  286. },
  287. //新增子项触发
  288. handleAdd(row) {
  289. this.parentId = row.id;
  290. const column = this.findObject(this.option.column, "parentId");
  291. column.value = row.id;
  292. column.addDisabled = true;
  293. this.$refs.crud.rowAdd();
  294. },
  295. //查看跳转页面
  296. beforeOpenPage(row, index) {
  297. const data = {
  298. moduleName: 'cg',
  299. tableName: 'business_order',
  300. billId: row.id,
  301. no: localStorage.getItem('browserID')
  302. }
  303. this.checkLock(data).then(res => {
  304. if (res.data.code == 200) {
  305. this.detailData = {
  306. seeDisabled: true,
  307. id: row.id,
  308. };
  309. this.isShow = false;
  310. this.$store.commit("DOMCG_IN_DETAIL");
  311. }
  312. }).catch(err => {
  313. this.detailData = {
  314. id: row.id,
  315. seeDisabled: true,
  316. opDisabled: true
  317. };
  318. this.isShow = false;
  319. this.$store.commit("DOMCG_IN_DETAIL");
  320. })
  321. },
  322. //新增跳转页面
  323. beforeOpen(row, index) {
  324. this.detailData = {
  325. id: row.id,
  326. };
  327. this.isShow = false;
  328. this.$store.commit("DOMCG_IN_DETAIL");
  329. },
  330. editOpen(row, index) {
  331. const data = {
  332. moduleName: 'cg',
  333. tableName: 'business_order',
  334. billId: row.id,
  335. no: localStorage.getItem('browserID')
  336. }
  337. this.checkLock(data).then(res => {
  338. if (res.data.code == 200) {
  339. this.detailData = {
  340. seeDisabled: true,
  341. id: row.id,
  342. };
  343. this.isShow = false;
  344. this.$store.commit("DOMCG_IN_DETAIL");
  345. }
  346. }).catch(err => {
  347. this.detailData = {
  348. id: row.id,
  349. seeDisabled: true,
  350. opDisabled: true
  351. };
  352. this.isShow = false;
  353. this.$store.commit("DOMCG_IN_DETAIL");
  354. })
  355. },
  356. // 复制新单
  357. copyOrder() {
  358. const id = this.selection[0].id;
  359. this.detailData = {
  360. copyId: id,
  361. };
  362. this.isShow = false;
  363. this.$store.commit("DOMCG_IN_DETAIL");
  364. },
  365. //点击新增时触发
  366. beforeClose(done) {
  367. this.parentId = "";
  368. const column = this.findObject(this.option.column, "parentId");
  369. column.value = "";
  370. column.addDisabled = false;
  371. done();
  372. },
  373. //点击搜索按钮触发
  374. searchChange(params, done) {
  375. if (params.requiredArrivalDate) {
  376. this.$set(params, 'requiredArrivalStartDate', params.requiredArrivalDate[0]+ " " + "00:00:00")
  377. this.$set(params, 'requiredArrivalEndDate', params.requiredArrivalDate[1]+ " " + "23:59:59")
  378. this.$delete(params,'requiredArrivalDate')
  379. }
  380. if (params.createTime) {
  381. params.createStartTime = params.createTime[0]+ " " + "00:00:00"
  382. params.createEndTime = params.createTime[1]+ " " + "23:59:59"
  383. this.$delete(params,'createTime')
  384. }
  385. this.page.currentPage = 1;
  386. this.onLoad(this.page, params);
  387. done()
  388. },
  389. searchReset() {
  390. console.log('1')
  391. },
  392. selectionChange(list) {
  393. console.log(list)
  394. this.selection = []
  395. this.selection = list;
  396. this.single = list.length !== 1;
  397. this.multiple = list.length == 0
  398. },
  399. currentChange(currentPage) {
  400. this.page.currentPage = currentPage;
  401. },
  402. sizeChange(pageSize) {
  403. this.page.pageSize = pageSize;
  404. },
  405. refreshChange() {
  406. this.page.currentPage = 1;
  407. this.onLoad(this.page,this.search);
  408. },
  409. onLoad(page, params) {
  410. let data = this.gobackSearch(params)
  411. let queryParams = Object.assign({tradeType: 'GN'}, data, {
  412. size: page.pageSize,
  413. current: page.currentPage,
  414. // billType:'CG',
  415. // corpsTypeId: this.treeDeptId
  416. })
  417. this.loading = true;
  418. customerList(queryParams).then(res => {
  419. this.dataList = res.data.data.records
  420. this.page.total = res.data.data.total
  421. this.option.height = window.innerHeight - 240;
  422. }).finally(() => {
  423. this.loading = false;
  424. })
  425. },
  426. //树桩列点击展开触发
  427. treeLoad(tree, treeNode, resolve) {
  428. const parentId = tree.id;
  429. customerList({parentId: parentId}).then(res => {
  430. resolve(res.data.data.records);
  431. });
  432. },
  433. goBack() {
  434. this.selection = []
  435. this.applyPaymentList = []
  436. this.single = true
  437. this.multiple = true
  438. this.detailData=this.$options.data().detailData
  439. this.isShow = true;
  440. this.onLoad(this.page, this.search);
  441. },
  442. gobackSearch(params) {
  443. params = Object.assign({}, this.search)
  444. if (params.requiredArrivalDate && params.requiredArrivalDate != '') {
  445. params.requiredArrivalStartDate = params.requiredArrivalDate[0]+ " " + "00:00:00"
  446. params.requiredArrivalEndDate = params.requiredArrivalDate[1]+ " " + "23:59:59"
  447. this.$delete(params,'requiredArrivalDate')
  448. }
  449. if (params.createTime && params.createTime != '') {
  450. params.createStartTime = params.createTime[0]+ " " + "00:00:00"
  451. params.createEndTime = params.createTime[1]+ " " + "23:59:59"
  452. this.$delete(params,'createTime')
  453. }
  454. return params
  455. },
  456. //列保存触发
  457. async saveColumn() {
  458. /**
  459. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  460. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  461. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  462. */
  463. const inSave = await this.saveColumnData(
  464. this.getColumnName(17),
  465. this.option
  466. );
  467. if (inSave) {
  468. this.$message.success("保存成功");
  469. //关闭窗口
  470. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  471. this.$nextTick(() => {
  472. this.$refs.crud.doLayout()
  473. })
  474. }
  475. },
  476. async resetColumn() {
  477. this.option = option;
  478. const inSave = await this.delColumnData(
  479. this.getColumnName(17),
  480. option
  481. );
  482. if (inSave) {
  483. this.$nextTick(() => {
  484. this.$refs.crud.doLayout()
  485. })
  486. this.$message.success("重置成功");
  487. //关闭窗口
  488. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  489. }
  490. },
  491. // 申请货款
  492. applyPayment() {
  493. this.applyPaymentList = []
  494. if (this.selection.length > 1) {
  495. for (let item in this.selection) {
  496. if (this.selection[0].corpId !== this.selection[item].corpId) {
  497. return this.$message.error('批量结算供应商必须一致')
  498. }
  499. }
  500. }
  501. let a = []
  502. this.selection.forEach(item => {
  503. let form = {
  504. srcOrderno:item.orderNo,
  505. itemType:"采购",
  506. optionType:"GN",
  507. corpsName:item.strCorpName,
  508. corpId:item.corpId,
  509. srcParentId: item.id,
  510. currency: 'CNY',
  511. exchangeRate: '1',
  512. taxRate: '0',
  513. accDate: item.businesDate,
  514. srcType: 1,
  515. tradeType: 'GN',
  516. amount: item.orderAmount,
  517. costType: this.feesOption.find(e => e.cname == '货款')? this.feesOption.find(e => e.cname == '货款').id: null,
  518. }
  519. a.push(form)
  520. })
  521. this.applyPaymentList = [...a]
  522. // this.beforeBillData(true);
  523. this.financialAccountDialog = true;
  524. },
  525. beforeBillData(type) {
  526. if(type){ //申请货款
  527. // this.billData.srcId = -1
  528. }
  529. },
  530. //关闭账单
  531. choceFun(){
  532. this.financialAccountDialog = false
  533. },
  534. }
  535. }
  536. </script>
  537. <style scoped>
  538. </style>