index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  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: 38,
  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: "financeStatus",
  245. search: true,
  246. overHidden: true,
  247. type: 'select',
  248. dicUrl: "/api/blade-system/dict-biz/dictionary?code=settlement_Status",
  249. props: {
  250. label: "dictValue",
  251. value: "dictKey"
  252. }
  253. }, {
  254. label: '应结日期',
  255. prop: "dueDate",
  256. overHidden: true,
  257. }, {
  258. label: "制单人",
  259. prop: "createUserName",
  260. searchProp: "createUser",
  261. overHidden: true,
  262. width: 100,
  263. filterable: true,
  264. remote: true,
  265. type: "select",
  266. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  267. props: {
  268. label: "account",
  269. value: "id",
  270. res: 'data.records'
  271. }
  272. }, {
  273. label: "制单日期",
  274. prop: "createTime",
  275. searchProp: "createTimeList",
  276. type: "date",
  277. overHidden: true,
  278. width: 100,
  279. searchRange: true,
  280. searchDefaultTime: ["00:00:00", "23:59:59"],
  281. format: "yyyy-MM-dd",
  282. valueFormat: "yyyy-MM-dd HH:mm:ss"
  283. }, {
  284. label: "更新人",
  285. prop: "updateUserName",
  286. searchProp: "updateUser",
  287. overHidden: true,
  288. width: 100,
  289. filterable: true,
  290. remote: true,
  291. type: "select",
  292. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  293. props: {
  294. label: "account",
  295. value: "id",
  296. res: 'data.records'
  297. }
  298. }, {
  299. label: "更新日期",
  300. prop: "updateTime",
  301. searchProp: "updateTimeList",
  302. type: "date",
  303. overHidden: true,
  304. width: 100,
  305. searchRange: true,
  306. searchDefaultTime: ["00:00:00", "23:59:59"],
  307. format: "yyyy-MM-dd",
  308. valueFormat: "yyyy-MM-dd HH:mm:ss"
  309. }]
  310. }
  311. }
  312. },
  313. activated() {
  314. console.log(213213213213);
  315. setTimeout(() => {
  316. console.log(this.$route.query.check);
  317. if (this.$route.query.check) {
  318. this.editOpen({ id: this.$route.query.check.srcBillId }, 1)
  319. this.$store.commit("IN_LTXS_STATUS");
  320. }
  321. if(this.$route.query.type == 'S'){
  322. this.editOpen({ id: this.$route.query.detail.srcParentId }, 1)
  323. }
  324. this.detailData = {
  325. id: this.$route.query.check.billId,
  326. check: this.$route.query.check,
  327. auditId: this.$route.query.check.id
  328. };
  329. }, 100);
  330. },
  331. async created() {
  332. this.option = await this.getColumnData(this.getColumnName(269), this.optionList);
  333. this.key++
  334. let i = 0;
  335. this.option.column.forEach(item => {
  336. if (item.search) i++
  337. })
  338. if (i % 3 !== 0) {
  339. const num = 3 - Number(i % 3)
  340. this.option.searchMenuSpan = num * 8;
  341. this.option.searchMenuPosition = "right";
  342. }
  343. },
  344. methods: {
  345. check(row) {
  346. this.form = row
  347. this.detailsOpen = true
  348. },
  349. backToList(type) {
  350. this.form = {}
  351. this.detailsOpen = false
  352. if (type === 0) {
  353. this.detailData = {}
  354. }
  355. this.onLoad(this.page, this.search)
  356. this.$store.commit("OUT_LTXS_STATUS");
  357. },
  358. editOpen(row, status) {
  359. this.form = row
  360. this.detailData = {
  361. id: row.id,
  362. status: status
  363. };
  364. console.log(status);
  365. this.$store.commit("IN_LTXS_STATUS");
  366. this.detailsOpen = true;
  367. },
  368. //刷新
  369. refreshChange() {
  370. this.onLoad(this.page, this.search)
  371. },
  372. expandChange(row) {
  373. if (!row.itemData) {
  374. getDetails({ id: row.id })
  375. .then(res => {
  376. this.dataList[row.$index].itemData = res.data.data.orderItemsList;
  377. })
  378. .finally(() => {
  379. this.dataList[row.$index].itemLoading = false;
  380. });
  381. }
  382. },
  383. rowDel(form, index) {
  384. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  385. confirmButtonText: '确定',
  386. cancelButtonText: '取消',
  387. type: 'warning'
  388. }).then(() => {
  389. remove({ id: form.id }).then(res => {
  390. this.$message({
  391. type: 'success',
  392. message: '删除成功!'
  393. });
  394. this.dataList.splice(index, 1);
  395. this.onLoad(this.page)
  396. })
  397. }).catch(() => {
  398. });
  399. },
  400. searchChange(params, done) {
  401. done();
  402. this.onLoad(this.page, params)
  403. },
  404. onLoad(page, params = {}) {
  405. params = {
  406. ...params,
  407. current: page.currentPage,
  408. size: page.pageSize,
  409. bsType: "XS",
  410. ...Object.assign(params, this.search)
  411. }
  412. this.loading = true
  413. this.dataList.forEach(item => {
  414. this.$refs.crud.toggleRowExpansion(item, false);
  415. });
  416. getList(params).then(res => {
  417. if (res.data.data.records) {
  418. res.data.data.records.forEach(e => {
  419. e.itemLoading = true;
  420. });
  421. }
  422. this.dataList = res.data.data.records
  423. this.page.total = res.data.data.total
  424. this.loading = false
  425. }).finally(() => {
  426. this.loading = false
  427. })
  428. },
  429. //自定义列保存
  430. async saveColumnTwo(ref, option, optionBack, code) {
  431. /**
  432. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  433. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  434. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  435. */
  436. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  437. if (inSave) {
  438. this.$message.success("保存成功");
  439. //关闭窗口
  440. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  441. }
  442. },
  443. //自定义列重置
  444. async resetColumnTwo(ref, option, optionBack, code) {
  445. this[option] = this[optionBack];
  446. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  447. if (inSave) {
  448. this.$message.success("重置成功");
  449. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  450. }
  451. }
  452. }
  453. }
  454. </script>
  455. <style scoped>
  456. .itemTable ::v-deep .el-table {
  457. margin-left: 50px;
  458. width: 100%;
  459. }
  460. </style>