index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  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'
  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: "status",
  258. search: true,
  259. overHidden: true,
  260. type: 'select',
  261. dicUrl: "/api/blade-system/dict-biz/dictionary?code=sales_Status",
  262. props: {
  263. label: "dictValue",
  264. value: "dictKey"
  265. }
  266. }, {
  267. label: '结算状态',
  268. prop: "actualPaymentStatus",
  269. searchProp: 'actualPaymentType',
  270. search: true,
  271. overHidden: true,
  272. type: 'select',
  273. dicData: [
  274. {
  275. label: "待收款",
  276. value: 1,
  277. },
  278. {
  279. label: "已收款",
  280. value: 2,
  281. },
  282. {
  283. label: "尾款",
  284. value: 3,
  285. },
  286. {
  287. label: "已退款",
  288. value: 3,
  289. }
  290. ],
  291. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=settlement_Status",
  292. // props: {
  293. // label: "dictValue",
  294. // value: "dictKey"
  295. // }
  296. }, {
  297. label: '应结日期',
  298. prop: "dueDate",
  299. overHidden: true,
  300. }, {
  301. label: '业务日期',
  302. prop: "businesDate",
  303. overHidden: true,
  304. searchProp: "businesDateList",
  305. type: "date",
  306. overHidden: true,
  307. search: true,
  308. width: 100,
  309. searchRange: true,
  310. searchDefaultTime: ["00:00:00", "23:59:59"],
  311. format: "yyyy-MM-dd",
  312. valueFormat: "yyyy-MM-dd HH:mm:ss"
  313. }, {
  314. label: "制单人",
  315. prop: "createUserName",
  316. searchProp: "createUser",
  317. overHidden: true,
  318. width: 100,
  319. filterable: true,
  320. remote: true,
  321. type: "select",
  322. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  323. props: {
  324. label: "account",
  325. value: "id",
  326. res: 'data.records'
  327. }
  328. }, {
  329. label: "制单日期",
  330. prop: "createTime",
  331. searchProp: "createTimeList",
  332. type: "date",
  333. overHidden: true,
  334. width: 100,
  335. searchRange: true,
  336. searchDefaultTime: ["00:00:00", "23:59:59"],
  337. format: "yyyy-MM-dd",
  338. valueFormat: "yyyy-MM-dd HH:mm:ss"
  339. }, {
  340. label: "更新人",
  341. prop: "updateUserName",
  342. searchProp: "updateUser",
  343. overHidden: true,
  344. width: 100,
  345. filterable: true,
  346. remote: true,
  347. type: "select",
  348. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  349. props: {
  350. label: "account",
  351. value: "id",
  352. res: 'data.records'
  353. }
  354. }, {
  355. label: "更新日期",
  356. prop: "updateTime",
  357. searchProp: "updateTimeList",
  358. type: "date",
  359. overHidden: true,
  360. width: 100,
  361. searchRange: true,
  362. searchDefaultTime: ["00:00:00", "23:59:59"],
  363. format: "yyyy-MM-dd",
  364. valueFormat: "yyyy-MM-dd HH:mm:ss"
  365. }]
  366. }
  367. }
  368. },
  369. activated() {
  370. console.log(213213213213);
  371. setTimeout(() => {
  372. console.log(this.$route.query.check);
  373. if (this.$route.query.check) {
  374. this.editOpen({ id: this.$route.query.check.srcBillId }, 1)
  375. this.$store.commit("IN_LTXS_STATUS");
  376. }
  377. if (this.$route.query.type == 'S') {
  378. this.editOpen({ id: this.$route.query.detail.srcParentId }, 1)
  379. }
  380. this.detailData = {
  381. id: this.$route.query.check.billId,
  382. check: this.$route.query.check,
  383. auditId: this.$route.query.check.id
  384. };
  385. }, 100);
  386. },
  387. async created() {
  388. this.option = await this.getColumnData(this.getColumnName(269), this.optionList);
  389. this.key++
  390. let i = 0;
  391. this.option.column.forEach(item => {
  392. if (item.search) i++
  393. })
  394. if (i % 3 !== 0) {
  395. const num = 3 - Number(i % 3)
  396. this.option.searchMenuSpan = num * 8;
  397. this.option.searchMenuPosition = "right";
  398. }
  399. this.getWorkDicts("sales_Status").then(res => {
  400. this.orderStatusList = res.data.data
  401. console.log(this.orderStatusList);
  402. });
  403. },
  404. methods: {
  405. // 导出
  406. outExport() {
  407. console.log(this.search,412)
  408. let config = { params: { ...this.search } }
  409. if (config.params) {
  410. for (const propName of Object.keys(config.params)) {
  411. const value = config.params[propName];
  412. if (value !== null && typeof (value) !== "undefined") {
  413. if (value instanceof Array) {
  414. for (const key of Object.keys(value)) {
  415. let params = propName + '[' + key + ']';
  416. config.params[params] = value[key]
  417. }
  418. delete config.params[propName]
  419. }
  420. }
  421. }
  422. }
  423. console.log(config,427)
  424. config.params.bsType = 'XS'
  425. const routeData = this.$router.resolve({
  426. path: '/api/blade-sales-part/order/listExport', //跳转目标下载地址
  427. query: {
  428. ...config.params //括号内是要传递给新窗口的参数
  429. }
  430. })
  431. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  432. },
  433. check(row) {
  434. this.form = row
  435. this.detailsOpen = true
  436. },
  437. backToList(type) {
  438. this.form = {}
  439. this.detailsOpen = false
  440. if (type === 0) {
  441. this.detailData = {}
  442. }
  443. this.onLoad(this.page, this.search)
  444. this.$store.commit("OUT_LTXS_STATUS");
  445. },
  446. editOpen(row, status) {
  447. this.form = row
  448. this.detailData = {
  449. id: row.id,
  450. status: status
  451. };
  452. console.log(status);
  453. this.$store.commit("IN_LTXS_STATUS");
  454. this.detailsOpen = true;
  455. },
  456. //刷新
  457. refreshChange() {
  458. this.onLoad(this.page, this.search)
  459. },
  460. expandChange(row) {
  461. if (!row.itemData) {
  462. getDetails({ id: row.id })
  463. .then(res => {
  464. this.dataList[row.$index].itemData = res.data.data.orderItemsList;
  465. })
  466. .finally(() => {
  467. this.dataList[row.$index].itemLoading = false;
  468. });
  469. }
  470. },
  471. rowDel(form, index) {
  472. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  473. confirmButtonText: '确定',
  474. cancelButtonText: '取消',
  475. type: 'warning'
  476. }).then(() => {
  477. remove({ id: form.id }).then(res => {
  478. this.$message({
  479. type: 'success',
  480. message: '删除成功!'
  481. });
  482. this.dataList.splice(index, 1);
  483. this.onLoad(this.page)
  484. })
  485. }).catch(() => {
  486. });
  487. },
  488. searchChange(params, done) {
  489. done();
  490. this.onLoad(this.page, params)
  491. },
  492. onLoad(page, params = {}) {
  493. params = {
  494. ...params,
  495. current: page.currentPage,
  496. size: page.pageSize,
  497. bsType: "XS",
  498. ...Object.assign(params, this.search)
  499. }
  500. this.loading = true
  501. this.dataList.forEach(item => {
  502. this.$refs.crud.toggleRowExpansion(item, false);
  503. });
  504. getList(params).then(res => {
  505. if (res.data.data.records) {
  506. res.data.data.records.forEach(e => {
  507. e.itemLoading = true;
  508. });
  509. }
  510. this.dataList = res.data.data.records
  511. this.page.total = res.data.data.total
  512. this.$nextTick(() => {
  513. this.$refs.crud.doLayout()
  514. })
  515. this.loading = false
  516. }).finally(() => {
  517. this.loading = false
  518. })
  519. },
  520. //自定义列保存
  521. async saveColumnTwo(ref, option, optionBack, code) {
  522. /**
  523. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  524. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  525. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  526. */
  527. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  528. if (inSave) {
  529. this.$message.success("保存成功");
  530. //关闭窗口
  531. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  532. }
  533. },
  534. //自定义列重置
  535. async resetColumnTwo(ref, option, optionBack, code) {
  536. this[option] = this[optionBack];
  537. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  538. if (inSave) {
  539. this.$message.success("重置成功");
  540. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  541. }
  542. }
  543. }
  544. }
  545. </script>
  546. <style scoped>
  547. .itemTable ::v-deep .el-table {
  548. margin-left: 50px;
  549. width: 100%;
  550. }
  551. </style>