index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <template>
  2. <div>
  3. <basic-container v-show="!detailsOpen">
  4. <avue-crud :option="option" :search.sync="search" v-model="form" :table-loading="loading" :data="dataList"
  5. ref="crud" :key="key" @on-load="onLoad" @search-change="searchChange" @row-del="rowDel"
  6. @expand-change="expandChange" @refresh-change="refreshChange"
  7. @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 269)"
  8. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 269)" :page.sync="page">
  9. <template slot-scope="{ row }" slot="status">
  10. <span v-for=" item in orderStatusList" :style="{ color: item.colour }" v-if="item.dictKey == row.status">{{ item.dictValue }}</span>
  11. </template>
  12. <template slot-scope="{ row }" slot="expand">
  13. <avue-crud :data="row.itemData" :option="itemOption" :table-loading="row.itemLoading" :cell-style="cellStyle"
  14. class="itemTable"></avue-crud>
  15. </template>
  16. <template slot-scope="{type,size,row,index}" slot="menu">
  17. <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
  18. <el-button :size="size" :type="type"
  19. :disabled="row.status != '录入' && row.status != '待确认' && row.item >= 1 || row.businessSource == '外部销售'"
  20. @click="$refs.crud.rowDel(row, index)">删除</el-button>
  21. </template>
  22. <template slot="corpNameSearch">
  23. <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
  24. </template>
  25. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  26. <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新建订单</el-button>
  27. <el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>
  28. </template>
  29. <template slot-scope="{ row, index }" slot="ordNo">
  30. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.ordNo }}
  31. </span>
  32. </template>
  33. <template slot-scope="{ row, index }" slot="srcOrdNo">
  34. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 3)">{{ row.srcOrdNo }}
  35. </span>
  36. </template>
  37. </avue-crud>
  38. </basic-container>
  39. <detailsPage v-if="detailsOpen" @goBack="goBack" :onLoad="form" :detailData="detailData" @backToList="backToList">
  40. </detailsPage>
  41. </div>
  42. </template>
  43. <script>
  44. import { getList, remove, getGoodsInfo } from "@/api/tirePartsMall/salesManagement/saleOrder";
  45. import detailsPage from "./detailsPage"
  46. import { getDetails } from "@/api/tirePartsMall/salesManagement/saleOrder";
  47. import {getToken} from "@/util/auth";
  48. export default {
  49. name: "index",
  50. components: {
  51. detailsPage
  52. },
  53. data() {
  54. return {
  55. detailsOpen: false,
  56. orderStatusList:[],
  57. loading: false,
  58. search: {},
  59. form: {},
  60. dataList: [],
  61. detailData: {},
  62. page: {
  63. pageSize: 20,
  64. currentPage: 1,
  65. total: 0,
  66. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  67. },
  68. key: 0,
  69. itemOption: {
  70. align: "center",
  71. header: false,
  72. border: true,
  73. menu: false,
  74. column: [
  75. {
  76. label: '轮胎名称',
  77. prop: 'goodsId',
  78. width: 200,
  79. overHidden: true,
  80. dicData: [],
  81. props: {
  82. label: 'cname',
  83. value: 'id'
  84. },
  85. dicUrl: "/api/blade-sales-part/goodsDesc/goodsListAll"
  86. }, {
  87. label: '数量',
  88. prop: 'goodsNum',
  89. overHidden: true,
  90. width: 100,
  91. },
  92. {
  93. label: '价格',
  94. prop: 'price',
  95. overHidden: true,
  96. width: 100,
  97. },
  98. {
  99. label: '批次号',
  100. prop: 'dot',
  101. type: "select",
  102. disabled: true,
  103. allowCreate: true,
  104. filterable: true,
  105. width: 150,
  106. dicData: [],
  107. props: {
  108. label: "dot",
  109. value: "dot"
  110. },
  111. dicUrl: "/api/blade-sales-part/stockDesc/dotList",
  112. overHidden: true,
  113. }, {
  114. label: '轮胎编码',
  115. prop: 'goodsNo',
  116. overHidden: true,
  117. width: 150
  118. },
  119. {
  120. label: '品牌',
  121. prop: 'brandId',
  122. disabled: false,
  123. width: 100,
  124. overHidden: true,
  125. props: {
  126. label: 'cname',
  127. value: 'id'
  128. },
  129. dicUrl: '/api/blade-sales-part/brandDesc/listAll?type=PP'
  130. },
  131. {
  132. label: '花纹',
  133. prop: 'pattern',
  134. overHidden: true,
  135. disabled: false,
  136. width: 150
  137. },
  138. {
  139. label: '发货数量',
  140. prop: 'sendNum',
  141. disabled: false,
  142. overHidden: true,
  143. width: 100,
  144. }]
  145. },
  146. option: {},
  147. optionList: {
  148. viewBtn: false,
  149. editBtn: false,
  150. delBtn: false,
  151. addBtn: false,
  152. index: true,
  153. span: 8,
  154. border: true,
  155. height: "auto",
  156. searchMenuPosition: "right",
  157. align: "center",
  158. size: "small",
  159. menuWidth: 50,
  160. searchSpan: 8,
  161. searchIcon: true,
  162. expand: true,
  163. expandWidth: 60,
  164. searchIndex: 2,
  165. highlightCurrentRow: true,
  166. dialogWidth: "70%",
  167. summaryText: "合计",
  168. showSummary: true,
  169. sumColumnList: [{
  170. name: 'goodsTotalNum',
  171. type: 'sum',
  172. }, {
  173. name: 'totalMoney',
  174. type: 'sum',
  175. },],
  176. column: [{
  177. label: '销售单号',
  178. prop: "ordNo",
  179. search: true,
  180. overHidden: true,
  181. }, {
  182. label: '来源单号',
  183. prop: "srcOrdNo",
  184. search: true,
  185. overHidden: true,
  186. },
  187. {
  188. label: "业务来源",
  189. prop: "businessSource",
  190. overHidden: true,
  191. search: true,
  192. type: 'select',
  193. dicUrl: "/api/blade-system/dict-biz/dictionary?code=business_Source",
  194. props: {
  195. label: "dictValue",
  196. value: "dictKey"
  197. }
  198. }, {
  199. label: '所属公司',
  200. prop: "salesCompanyName",
  201. overHidden: true,
  202. }, {
  203. label: '业务对象',
  204. prop: "customerId",
  205. search: true,
  206. remote: true,
  207. overHidden: true,
  208. type: 'select',
  209. props: {
  210. label: 'cname',
  211. value: 'id'
  212. },
  213. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=KH&cname={{key}}',
  214. }, {
  215. label: '业务员',
  216. disabled: false,
  217. prop: "salerId",
  218. search: true,
  219. type: "select",
  220. props: {
  221. label: "name",
  222. value: "id"
  223. },
  224. dicUrl: "/api/blade-user/client/getUserByRole",
  225. filterable: true,
  226. rules: [{
  227. required: true,
  228. message: " ",
  229. trigger: "blur"
  230. }]
  231. }, {
  232. label: '仓库',
  233. prop: "storageId",
  234. search: true,
  235. overHidden: true,
  236. // remote: true,
  237. type: 'select',
  238. props: {
  239. label: 'cname',
  240. value: 'id'
  241. },
  242. dicUrl: '/api/blade-sales-part/storageDesc/listAll?cname={{key}}',
  243. }, {
  244. label: '行数',
  245. prop: "numberRows",
  246. overHidden: true,
  247. }, {
  248. label: '数量',
  249. prop: "goodsTotalNum",
  250. overHidden: true,
  251. }, {
  252. label: '金额',
  253. prop: "totalMoney",
  254. overHidden: true,
  255. }, {
  256. label: '已收金额',
  257. prop: "paymentAmountTl",
  258. disabled: true
  259. }, {
  260. label: '状态',
  261. prop: "status",
  262. search: true,
  263. overHidden: true,
  264. type: 'select',
  265. dicUrl: "/api/blade-system/dict-biz/dictionary?code=sales_Status",
  266. props: {
  267. label: "dictValue",
  268. value: "dictKey"
  269. }
  270. }, {
  271. label: '结算状态',
  272. prop: "actualPaymentStatus",
  273. searchProp: 'actualPaymentType',
  274. search: true,
  275. overHidden: true,
  276. type: 'select',
  277. dicData: [
  278. {
  279. label: "待收款",
  280. value: 1,
  281. },
  282. {
  283. label: "已收款",
  284. value: 2,
  285. },
  286. {
  287. label: "尾款",
  288. value: 3,
  289. },
  290. {
  291. label: "已退款",
  292. value: 4,
  293. }
  294. ],
  295. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=settlement_Status",
  296. // props: {
  297. // label: "dictValue",
  298. // value: "dictKey"
  299. // }
  300. }, {
  301. label: '应结日期',
  302. prop: "dueDate",
  303. overHidden: true,
  304. }, {
  305. label: '业务日期',
  306. prop: "businesDate",
  307. overHidden: true,
  308. searchProp: "businesDateList",
  309. type: "date",
  310. overHidden: true,
  311. search: true,
  312. width: 100,
  313. searchRange: true,
  314. searchDefaultTime: ["00:00:00", "23:59:59"],
  315. format: "yyyy-MM-dd",
  316. valueFormat: "yyyy-MM-dd HH:mm:ss"
  317. }, {
  318. label: "制单人",
  319. prop: "createUserName",
  320. searchProp: "createUser",
  321. overHidden: true,
  322. width: 100,
  323. filterable: true,
  324. remote: true,
  325. type: "select",
  326. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  327. props: {
  328. label: "account",
  329. value: "id",
  330. res: 'data.records'
  331. }
  332. }, {
  333. label: "制单日期",
  334. prop: "createTime",
  335. searchProp: "createTimeList",
  336. type: "date",
  337. overHidden: true,
  338. width: 100,
  339. searchRange: true,
  340. searchDefaultTime: ["00:00:00", "23:59:59"],
  341. format: "yyyy-MM-dd",
  342. valueFormat: "yyyy-MM-dd HH:mm:ss"
  343. }, {
  344. label: "更新人",
  345. prop: "updateUserName",
  346. searchProp: "updateUser",
  347. overHidden: true,
  348. width: 100,
  349. filterable: true,
  350. remote: true,
  351. type: "select",
  352. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  353. props: {
  354. label: "account",
  355. value: "id",
  356. res: 'data.records'
  357. }
  358. }, {
  359. label: "更新日期",
  360. prop: "updateTime",
  361. searchProp: "updateTimeList",
  362. type: "date",
  363. overHidden: true,
  364. width: 100,
  365. searchRange: true,
  366. searchDefaultTime: ["00:00:00", "23:59:59"],
  367. format: "yyyy-MM-dd",
  368. valueFormat: "yyyy-MM-dd HH:mm:ss"
  369. }]
  370. }
  371. }
  372. },
  373. activated() {
  374. console.log(213213213213);
  375. setTimeout(() => {
  376. console.log(this.$route.query.check);
  377. if (this.$route.query.check) {
  378. this.editOpen({ id: this.$route.query.check.srcBillId }, 1)
  379. this.$store.commit("IN_LTXS_STATUS");
  380. }
  381. if (this.$route.query.type == 'S') {
  382. this.editOpen({ id: this.$route.query.detail.srcParentId }, 1)
  383. }
  384. if (this.$route.query.jumpId) {
  385. this.editOpen({ id: this.$route.query.jumpId }, 1)
  386. }
  387. this.detailData = {
  388. id: this.$route.query.check.billId,
  389. check: this.$route.query.check,
  390. auditId: this.$route.query.check.id
  391. };
  392. }, 100);
  393. },
  394. async created() {
  395. this.option = await this.getColumnData(this.getColumnName(269), this.optionList);
  396. this.key++
  397. let i = 0;
  398. this.option.column.forEach(item => {
  399. if (item.search) i++
  400. })
  401. if (i % 3 !== 0) {
  402. const num = 3 - Number(i % 3)
  403. this.option.searchMenuSpan = num * 8;
  404. this.option.searchMenuPosition = "right";
  405. }
  406. this.getWorkDicts("sales_Status").then(res => {
  407. this.orderStatusList = res.data.data
  408. console.log(this.orderStatusList);
  409. });
  410. },
  411. methods: {
  412. // 导出
  413. outExport() {
  414. console.log(this.search,412)
  415. let config = { params: { ...this.search } }
  416. if (config.params) {
  417. for (const propName of Object.keys(config.params)) {
  418. const value = config.params[propName];
  419. if (value !== null && typeof (value) !== "undefined") {
  420. if (value instanceof Array) {
  421. for (const key of Object.keys(value)) {
  422. let params = propName + '[' + key + ']';
  423. config.params[params] = value[key]
  424. }
  425. delete config.params[propName]
  426. }
  427. }
  428. }
  429. }
  430. console.log(config,427)
  431. config.params.bsType = 'XS'
  432. const routeData = this.$router.resolve({
  433. path: '/api/blade-sales-part/order/listExport', //跳转目标下载地址
  434. query: {
  435. ...config.params //括号内是要传递给新窗口的参数
  436. }
  437. })
  438. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  439. },
  440. check(row) {
  441. this.form = row
  442. this.detailsOpen = true
  443. },
  444. backToList(type) {
  445. this.form = {}
  446. this.detailsOpen = false
  447. if (type === 0) {
  448. this.detailData = {}
  449. }
  450. this.onLoad(this.page, this.search)
  451. this.$store.commit("OUT_LTXS_STATUS");
  452. },
  453. editOpen(row, status) {
  454. this.form = row
  455. this.detailData = {
  456. id: row.id,
  457. status: status
  458. };
  459. console.log(status);
  460. this.$store.commit("IN_LTXS_STATUS");
  461. this.detailsOpen = true;
  462. },
  463. //刷新
  464. refreshChange() {
  465. this.onLoad(this.page, this.search)
  466. },
  467. expandChange(row) {
  468. if (!row.itemData) {
  469. getDetails({ id: row.id })
  470. .then(res => {
  471. this.dataList[row.$index].itemData = res.data.data.orderItemsList;
  472. })
  473. .finally(() => {
  474. this.dataList[row.$index].itemLoading = false;
  475. });
  476. }
  477. },
  478. rowDel(form, index) {
  479. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  480. confirmButtonText: '确定',
  481. cancelButtonText: '取消',
  482. type: 'warning'
  483. }).then(() => {
  484. remove({ id: form.id }).then(res => {
  485. this.$message({
  486. type: 'success',
  487. message: '删除成功!'
  488. });
  489. this.dataList.splice(index, 1);
  490. this.onLoad(this.page)
  491. })
  492. }).catch(() => {
  493. });
  494. },
  495. searchChange(params, done) {
  496. done();
  497. this.onLoad(this.page, params)
  498. },
  499. onLoad(page, params = {}) {
  500. params = {
  501. ...params,
  502. current: page.currentPage,
  503. size: page.pageSize,
  504. bsType: "XS",
  505. ...Object.assign(params, this.search)
  506. }
  507. this.loading = true
  508. this.dataList.forEach(item => {
  509. this.$refs.crud.toggleRowExpansion(item, false);
  510. });
  511. getList(params).then(res => {
  512. if (res.data.data.records) {
  513. res.data.data.records.forEach(e => {
  514. e.itemLoading = true;
  515. });
  516. }
  517. this.dataList = res.data.data.records
  518. this.page.total = res.data.data.total
  519. this.$nextTick(() => {
  520. this.$refs.crud.doLayout()
  521. })
  522. this.loading = false
  523. }).finally(() => {
  524. this.loading = false
  525. })
  526. },
  527. //自定义列保存
  528. async saveColumnTwo(ref, option, optionBack, code) {
  529. /**
  530. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  531. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  532. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  533. */
  534. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  535. if (inSave) {
  536. this.$message.success("保存成功");
  537. //关闭窗口
  538. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  539. }
  540. },
  541. //自定义列重置
  542. async resetColumnTwo(ref, option, optionBack, code) {
  543. this[option] = this[optionBack];
  544. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  545. if (inSave) {
  546. this.$message.success("重置成功");
  547. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  548. }
  549. }
  550. }
  551. }
  552. </script>
  553. <style scoped>
  554. .itemTable ::v-deep .el-table {
  555. margin-left: 50px;
  556. width: 100%;
  557. }
  558. </style>