index.vue 15 KB

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