index.vue 16 KB

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