index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  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. export default {
  126. name: "customerInformation",
  127. props: {
  128. detailData: {
  129. type: Object
  130. }
  131. },
  132. components: {
  133. detailPage,
  134. ApplyPayment,
  135. financialAccount
  136. },
  137. data() {
  138. return {
  139. configuration: {
  140. multipleChoices: false,
  141. multiple: false,
  142. collapseTags: false,
  143. placeholder: "请点击右边按钮选择",
  144. dicData: [],
  145. clearable: true,
  146. },
  147. search: {},
  148. loading: false,
  149. form: {},
  150. option: {},
  151. parentId: 0,
  152. dataList: [],
  153. page: {
  154. pageSize: 10,
  155. currentPage: 1,
  156. total: 0,
  157. pageSizes: [10,50,100,200,300]
  158. },
  159. // 非单个禁用
  160. single: true,
  161. // 非多个禁用
  162. multiple: true,
  163. selection: [],
  164. isShow: true,
  165. detailData: {},
  166. billType:"申请", //账单类型
  167. billData:{}, //账单需要数据
  168. financeData: {
  169. url:"/financialManagement/paymentRequest/index",
  170. pageStatus:"this.$store.getters.pqStatus",
  171. pageLabel:"付费申请",
  172. checkType: 'ffsq'
  173. }, // 账单请核需要的路由
  174. applyPaymentDialog:false,//生成账单组件
  175. financialAccountDialog:false,
  176. applyPaymentList: [],
  177. }
  178. },
  179. async created() {
  180. this.search.requiredArrivalDate = defaultDate(1)
  181. // this.option = option
  182. this.option = await this.getColumnData(this.getColumnName(17), option);
  183. this.getWorkDicts("payment_term").then(res => {
  184. this.findObject(this.option.column, "paymentType").dicData =
  185. res.data.data;
  186. });
  187. gainUser().then(res => {
  188. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  189. })
  190. let i = 0;
  191. this.option.column.forEach(item => {
  192. if (item.search) i++
  193. })
  194. if (i % 3 !== 0){
  195. const num = 3 - Number(i % 3)
  196. this.option.searchMenuSpan = num * 8;
  197. this.option.searchMenuPosition = "right";
  198. }
  199. this.option.column.forEach(item => {
  200. if (item.pickerOptions) {
  201. item.pickerOptions = {
  202. shortcuts: [{
  203. text: '最近一周',
  204. onClick(picker) {
  205. const end = new Date();
  206. const start = new Date();
  207. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  208. picker.$emit('pick', [start, end]);
  209. }
  210. }, {
  211. text: '最近一个月',
  212. onClick(picker) {
  213. const end = new Date();
  214. const start = new Date();
  215. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  216. picker.$emit('pick', [start, end]);
  217. }
  218. }, {
  219. text: '最近三个月',
  220. onClick(picker) {
  221. const end = new Date();
  222. const start = new Date();
  223. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  224. picker.$emit('pick', [start, end]);
  225. }
  226. }]
  227. }
  228. }
  229. })
  230. },
  231. activated() {
  232. if (this.$route.query.check) {
  233. this.isShow = true
  234. // this.beforeOpenPage({id: this.$route.query.check.billId})
  235. this.detailData = {
  236. id: this.$route.query.check.billId,
  237. check: this.$route.query.check,
  238. };
  239. this.isShow = false;
  240. this.$store.commit("DOMCG_IN_DETAIL");
  241. }
  242. if (this.$route.query.params) {
  243. this.beforeOpenPage({id: this.$route.query.params})
  244. }
  245. },
  246. methods: {
  247. cellStyle() {
  248. return "padding:0;height:40px;";
  249. },
  250. searchCriteriaSwitch(type){
  251. if (type){
  252. this.option.height = this.option.height - 90
  253. }else {
  254. this.option.height = this.option.height + 90
  255. }
  256. this.$refs.crud.getTableHeight()
  257. },
  258. //删除列表后面的删除按钮触发触发(row, index, done)
  259. rowDel(row, index, done) {
  260. this.$confirm("确定将选择数据删除?", {
  261. confirmButtonText: "确定",
  262. cancelButtonText: "取消",
  263. type: "warning"
  264. }).then(() => {
  265. return deleteDetails(row.id);
  266. }).then(() => {
  267. this.$message({
  268. type: "success",
  269. message: "操作成功!"
  270. });
  271. this.page.currentPage = 1;
  272. this.onLoad(this.page, {parentId: 0});
  273. });
  274. },
  275. //查询全部
  276. initData() {
  277. customerList().then(res => {
  278. const column = this.findObject(this.option.column, "parentId");
  279. column.dicData = res.data.data.records;
  280. });
  281. },
  282. //新增子项触发
  283. handleAdd(row) {
  284. this.parentId = row.id;
  285. const column = this.findObject(this.option.column, "parentId");
  286. column.value = row.id;
  287. column.addDisabled = true;
  288. this.$refs.crud.rowAdd();
  289. },
  290. //查看跳转页面
  291. beforeOpenPage(row, index) {
  292. const data = {
  293. moduleName: 'cg',
  294. tableName: 'business_order',
  295. billId: row.id,
  296. no: localStorage.getItem('browserID')
  297. }
  298. this.checkLock(data).then(res => {
  299. if (res.data.code == 200) {
  300. this.detailData = {
  301. seeDisabled: true,
  302. id: row.id,
  303. };
  304. this.isShow = false;
  305. this.$store.commit("DOMCG_IN_DETAIL");
  306. }
  307. }).catch(err => {
  308. this.detailData = {
  309. id: row.id,
  310. seeDisabled: true,
  311. opDisabled: true
  312. };
  313. this.isShow = false;
  314. this.$store.commit("DOMCG_IN_DETAIL");
  315. })
  316. },
  317. //新增跳转页面
  318. beforeOpen(row, index) {
  319. this.detailData = {
  320. id: row.id,
  321. };
  322. this.isShow = false;
  323. this.$store.commit("DOMCG_IN_DETAIL");
  324. },
  325. editOpen(row, index) {
  326. const data = {
  327. moduleName: 'cg',
  328. tableName: 'business_order',
  329. billId: row.id,
  330. no: localStorage.getItem('browserID')
  331. }
  332. this.checkLock(data).then(res => {
  333. if (res.data.code == 200) {
  334. this.detailData = {
  335. seeDisabled: true,
  336. id: row.id,
  337. };
  338. this.isShow = false;
  339. this.$store.commit("DOMCG_IN_DETAIL");
  340. }
  341. }).catch(err => {
  342. this.detailData = {
  343. id: row.id,
  344. seeDisabled: true,
  345. opDisabled: true
  346. };
  347. this.isShow = false;
  348. this.$store.commit("DOMCG_IN_DETAIL");
  349. })
  350. },
  351. // 复制新单
  352. copyOrder() {
  353. const id = this.selection[0].id;
  354. this.detailData = {
  355. copyId: id,
  356. };
  357. this.isShow = false;
  358. this.$store.commit("DOMCG_IN_DETAIL");
  359. },
  360. //点击新增时触发
  361. beforeClose(done) {
  362. this.parentId = "";
  363. const column = this.findObject(this.option.column, "parentId");
  364. column.value = "";
  365. column.addDisabled = false;
  366. done();
  367. },
  368. //点击搜索按钮触发
  369. searchChange(params, done) {
  370. if (params.requiredArrivalDate) {
  371. this.$set(params, 'requiredArrivalStartDate', params.requiredArrivalDate[0]+ " " + "00:00:00")
  372. this.$set(params, 'requiredArrivalEndDate', params.requiredArrivalDate[1]+ " " + "23:59:59")
  373. this.$delete(params,'requiredArrivalDate')
  374. }
  375. if (params.createTime) {
  376. params.createStartTime = params.createTime[0]+ " " + "00:00:00"
  377. params.createEndTime = params.createTime[1]+ " " + "23:59:59"
  378. this.$delete(params,'createTime')
  379. }
  380. this.page.currentPage = 1;
  381. this.onLoad(this.page, params);
  382. done()
  383. },
  384. searchReset() {
  385. console.log('1')
  386. },
  387. selectionChange(list) {
  388. console.log(list)
  389. this.selection = []
  390. this.selection = list;
  391. this.single = list.length !== 1;
  392. this.multiple = list.length == 0
  393. },
  394. currentChange(currentPage) {
  395. this.page.currentPage = currentPage;
  396. },
  397. sizeChange(pageSize) {
  398. this.page.pageSize = pageSize;
  399. },
  400. refreshChange() {
  401. this.page.currentPage = 1;
  402. this.onLoad(this.page,this.search);
  403. },
  404. onLoad(page, params) {
  405. let data = this.gobackSearch(params)
  406. let queryParams = Object.assign({tradeType: 'GN'}, data, {
  407. size: page.pageSize,
  408. current: page.currentPage,
  409. // billType:'CG',
  410. // corpsTypeId: this.treeDeptId
  411. })
  412. this.loading = true;
  413. customerList(queryParams).then(res => {
  414. this.dataList = res.data.data.records
  415. this.page.total = res.data.data.total
  416. this.option.height = window.innerHeight - 240;
  417. }).finally(() => {
  418. this.loading = false;
  419. })
  420. },
  421. //树桩列点击展开触发
  422. treeLoad(tree, treeNode, resolve) {
  423. const parentId = tree.id;
  424. customerList({parentId: parentId}).then(res => {
  425. resolve(res.data.data.records);
  426. });
  427. },
  428. goBack() {
  429. this.selection = []
  430. this.applyPaymentList = []
  431. this.single = true
  432. this.multiple = true
  433. this.detailData=this.$options.data().detailData
  434. this.isShow = true;
  435. this.onLoad(this.page, this.search);
  436. },
  437. gobackSearch(params) {
  438. params = Object.assign({}, this.search)
  439. if (params.requiredArrivalDate && params.requiredArrivalDate != '') {
  440. params.requiredArrivalStartDate = params.requiredArrivalDate[0]+ " " + "00:00:00"
  441. params.requiredArrivalEndDate = params.requiredArrivalDate[1]+ " " + "23:59:59"
  442. this.$delete(params,'requiredArrivalDate')
  443. }
  444. if (params.createTime && params.createTime != '') {
  445. params.createStartTime = params.createTime[0]+ " " + "00:00:00"
  446. params.createEndTime = params.createTime[1]+ " " + "23:59:59"
  447. this.$delete(params,'createTime')
  448. }
  449. return params
  450. },
  451. //列保存触发
  452. async saveColumn() {
  453. /**
  454. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  455. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  456. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  457. */
  458. const inSave = await this.saveColumnData(
  459. this.getColumnName(17),
  460. this.option
  461. );
  462. if (inSave) {
  463. this.$message.success("保存成功");
  464. //关闭窗口
  465. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  466. this.$nextTick(() => {
  467. this.$refs.crud.doLayout()
  468. })
  469. }
  470. },
  471. async resetColumn() {
  472. this.option = option;
  473. const inSave = await this.delColumnData(
  474. this.getColumnName(17),
  475. option
  476. );
  477. if (inSave) {
  478. this.$nextTick(() => {
  479. this.$refs.crud.doLayout()
  480. })
  481. this.$message.success("重置成功");
  482. //关闭窗口
  483. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  484. }
  485. },
  486. // 申请货款
  487. applyPayment() {
  488. this.applyPaymentList = []
  489. if (this.selection.length > 1) {
  490. for (let item in this.selection) {
  491. if (this.selection[0].corpId !== this.selection[item].corpId) {
  492. return this.$message.error('批量结算供应商必须一致')
  493. }
  494. }
  495. }
  496. let a = []
  497. this.selection.forEach(item => {
  498. let form = {
  499. srcOrderno:item.orderNo,
  500. itemType:"采购",
  501. optionType:"GN",
  502. corpsName:item.strCorpName,
  503. corpId:item.corpId,
  504. srcParentId: item.id,
  505. currency: 'CNY',
  506. exchangeRate: '1',
  507. taxRate: '0',
  508. accDate: item.businesDate,
  509. srcType: 1,
  510. tradeType: 'GN',
  511. amount: item.orderAmount
  512. }
  513. a.push(form)
  514. })
  515. this.applyPaymentList = [...a]
  516. // this.beforeBillData(true);
  517. this.financialAccountDialog = true;
  518. },
  519. beforeBillData(type) {
  520. if(type){ //申请货款
  521. // this.billData.srcId = -1
  522. }
  523. },
  524. //关闭账单
  525. choceFun(){
  526. this.financialAccountDialog = false
  527. },
  528. }
  529. }
  530. </script>
  531. <style scoped>
  532. </style>