index.vue 13 KB

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