index.vue 16 KB

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