index.vue 14 KB

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