index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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: localStorage.getItem('browserID')
  276. }
  277. this.checkLock(data).then(res => {
  278. if (res.data.code == 200) {
  279. this.detailData = {
  280. seeDisabled: true,
  281. id: row.id,
  282. };
  283. this.isShow = false;
  284. this.$store.commit("DOMCG_IN_DETAIL");
  285. }
  286. }).catch(err => {
  287. this.detailData = {
  288. id: row.id,
  289. seeDisabled: true,
  290. opDisabled: true
  291. };
  292. this.isShow = false;
  293. this.$store.commit("DOMCG_IN_DETAIL");
  294. })
  295. },
  296. //新增跳转页面
  297. beforeOpen(row, index) {
  298. this.detailData = {
  299. id: row.id,
  300. };
  301. this.isShow = false;
  302. this.$store.commit("DOMCG_IN_DETAIL");
  303. },
  304. editOpen(row, index) {
  305. const data = {
  306. moduleName: 'cg',
  307. tableName: 'business_order',
  308. billId: row.id,
  309. no: localStorage.getItem('browserID')
  310. }
  311. this.checkLock(data).then(res => {
  312. if (res.data.code == 200) {
  313. this.detailData = {
  314. seeDisabled: true,
  315. id: row.id,
  316. };
  317. this.isShow = false;
  318. this.$store.commit("DOMCG_IN_DETAIL");
  319. }
  320. }).catch(err => {
  321. this.detailData = {
  322. id: row.id,
  323. seeDisabled: true,
  324. opDisabled: true
  325. };
  326. this.isShow = false;
  327. this.$store.commit("DOMCG_IN_DETAIL");
  328. })
  329. },
  330. // 复制新单
  331. copyOrder() {
  332. const id = this.selection[0].id;
  333. this.detailData = {
  334. copyId: id,
  335. };
  336. this.isShow = false;
  337. this.$store.commit("DOMCG_IN_DETAIL");
  338. },
  339. //点击新增时触发
  340. beforeClose(done) {
  341. this.parentId = "";
  342. const column = this.findObject(this.option.column, "parentId");
  343. column.value = "";
  344. column.addDisabled = false;
  345. done();
  346. },
  347. //点击搜索按钮触发
  348. searchChange(params, done) {
  349. if (params.requiredArrivalDate) {
  350. this.$set(params, 'requiredArrivalStartDate', params.requiredArrivalDate[0]+ " " + "00:00:00")
  351. this.$set(params, 'requiredArrivalEndDate', params.requiredArrivalDate[1]+ " " + "23:59:59")
  352. this.$delete(params,'requiredArrivalDate')
  353. }
  354. if (params.createTime) {
  355. params.createStartTime = params.createTime[0]+ " " + "00:00:00"
  356. params.createEndTime = params.createTime[1]+ " " + "23:59:59"
  357. this.$delete(params,'createTime')
  358. }
  359. this.page.currentPage = 1;
  360. this.onLoad(this.page, params);
  361. done()
  362. },
  363. searchReset() {
  364. console.log('1')
  365. },
  366. selectionChange(list) {
  367. console.log(list)
  368. this.selection = []
  369. this.selection = list;
  370. this.single = list.length !== 1;
  371. this.multiple = list.length == 0
  372. },
  373. currentChange(currentPage) {
  374. this.page.currentPage = currentPage;
  375. },
  376. sizeChange(pageSize) {
  377. this.page.pageSize = pageSize;
  378. },
  379. refreshChange() {
  380. this.page.currentPage = 1;
  381. this.onLoad(this.page,this.search);
  382. },
  383. onLoad(page, params) {
  384. let data = this.gobackSearch(params)
  385. let queryParams = Object.assign({tradeType: 'GN'}, data, {
  386. size: page.pageSize,
  387. current: page.currentPage,
  388. // billType:'CG',
  389. // corpsTypeId: this.treeDeptId
  390. })
  391. this.loading = true;
  392. customerList(queryParams).then(res => {
  393. this.dataList = res.data.data.records
  394. this.page.total = res.data.data.total
  395. }).finally(() => {
  396. this.loading = false;
  397. })
  398. },
  399. //树桩列点击展开触发
  400. treeLoad(tree, treeNode, resolve) {
  401. const parentId = tree.id;
  402. customerList({parentId: parentId}).then(res => {
  403. resolve(res.data.data.records);
  404. });
  405. },
  406. goBack() {
  407. this.selection = []
  408. this.applyPaymentList = []
  409. this.single = true
  410. this.multiple = true
  411. this.detailData=this.$options.data().detailData
  412. this.isShow = true;
  413. this.onLoad(this.page, this.search);
  414. },
  415. gobackSearch(params) {
  416. params = Object.assign({}, this.search)
  417. if (params.requiredArrivalDate && params.requiredArrivalDate != '') {
  418. params.requiredArrivalStartDate = params.requiredArrivalDate[0]+ " " + "00:00:00"
  419. params.requiredArrivalEndDate = params.requiredArrivalDate[1]+ " " + "23:59:59"
  420. this.$delete(params,'requiredArrivalDate')
  421. }
  422. if (params.createTime && params.createTime != '') {
  423. params.createStartTime = params.createTime[0]+ " " + "00:00:00"
  424. params.createEndTime = params.createTime[1]+ " " + "23:59:59"
  425. this.$delete(params,'createTime')
  426. }
  427. return params
  428. },
  429. //列保存触发
  430. async saveColumn() {
  431. /**
  432. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  433. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  434. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  435. */
  436. const inSave = await this.saveColumnData(
  437. this.getColumnName(17),
  438. this.option
  439. );
  440. if (inSave) {
  441. this.$message.success("保存成功");
  442. //关闭窗口
  443. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  444. }
  445. },
  446. async resetColumn() {
  447. this.option = option;
  448. const inSave = await this.delColumnData(
  449. this.getColumnName(17),
  450. option
  451. );
  452. if (inSave) {
  453. this.$message.success("重置成功");
  454. //关闭窗口
  455. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  456. }
  457. },
  458. // 申请货款
  459. applyPayment() {
  460. this.applyPaymentList = []
  461. if (this.selection.length > 1) {
  462. for (let item in this.selection) {
  463. if (this.selection[0].corpId !== this.selection[item].corpId) {
  464. return this.$message.error('批量结算供应商必须一致')
  465. }
  466. }
  467. }
  468. let a = []
  469. this.selection.forEach(item => {
  470. let form = {
  471. srcOrderno:item.orderNo,
  472. itemType:"采购",
  473. optionType:"GN",
  474. corpsName:item.strCorpName,
  475. corpId:item.corpId,
  476. srcParentId: item.id,
  477. currency: 'CNY',
  478. exchangeRate: '1',
  479. taxRate: '0',
  480. accDate: item.businesDate,
  481. srcType: 1,
  482. tradeType: 'GN',
  483. amount: item.orderAmount
  484. }
  485. a.push(form)
  486. })
  487. this.applyPaymentList = [...a]
  488. // this.beforeBillData(true);
  489. this.financialAccountDialog = true;
  490. },
  491. beforeBillData(type) {
  492. if(type){ //申请货款
  493. // this.billData.srcId = -1
  494. }
  495. },
  496. //关闭账单
  497. choceFun(){
  498. this.financialAccountDialog = false
  499. },
  500. }
  501. }
  502. </script>
  503. <style scoped>
  504. </style>