index.vue 15 KB

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