index.vue 18 KB

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