index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  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', 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" :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: "customerId",
  217. search: true,
  218. overHidden: true,
  219. filterable:true,
  220. type: 'select',
  221. props: {
  222. label: 'cname',
  223. value: 'id'
  224. },
  225. dicData: [],
  226. }, {
  227. label: "仓库",
  228. prop: "storageName",
  229. search: true,
  230. overHidden: true,
  231. filterable:true,
  232. type: 'select',
  233. dicUrl: "/api/blade-sales-part/storageDesc/listAll",
  234. props: {
  235. label: 'cname',
  236. value: 'id'
  237. },
  238. }, {
  239. label: "订单数量",
  240. prop: "goodsTotalNum",
  241. search: false,
  242. overHidden: true,
  243. }, {
  244. label: "实际数量",
  245. prop: "sendTotalNum",
  246. search: false,
  247. overHidden: true,
  248. }, {
  249. label: "状态",
  250. prop: "statusName",
  251. search: true,
  252. overHidden: true,
  253. type: "select",
  254. dicData: [{
  255. label: "待入库",
  256. value: "待入库"
  257. }, {
  258. label: "已入库",
  259. value: "已入库"
  260. }, {
  261. label: "已撤销",
  262. value: "已撤销"
  263. }],
  264. }, {
  265. label: '业务日期',
  266. prop: "businesDate",
  267. searchProp: "businesDateList",
  268. type: "date",
  269. overHidden: true,
  270. search: true,
  271. width: 100,
  272. searchRange: true,
  273. searchDefaultTime: ["00:00:00", "23:59:59"],
  274. format: "yyyy-MM-dd",
  275. valueFormat: "yyyy-MM-dd HH:mm:ss"
  276. }, {
  277. label: "库管",
  278. prop: "stockClerkName",
  279. search: true,
  280. overHidden: true,
  281. type: 'select',
  282. props: {
  283. label: 'realName',
  284. value: 'id'
  285. },
  286. dicUrl: '/api/blade-user/stockClerkList',
  287. }, {
  288. label: "制单人",
  289. prop: "createUserName",
  290. searchProp: "createUser",
  291. overHidden: true,
  292. width: 100,
  293. filterable: true,
  294. remote: true,
  295. type: "select",
  296. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  297. props: {
  298. label: "account",
  299. value: "id",
  300. res: 'data.records'
  301. }
  302. }, {
  303. label: "制单日期",
  304. prop: "createTime",
  305. searchProp: "createTimeList",
  306. type: "date",
  307. overHidden: true,
  308. width: 100,
  309. searchRange: true,
  310. searchDefaultTime: ["00:00:00", "23:59:59"],
  311. format: "yyyy-MM-dd",
  312. valueFormat: "yyyy-MM-dd HH:mm:ss"
  313. }, {
  314. label: "更新人",
  315. prop: "updateUserName",
  316. searchProp: "updateUser",
  317. overHidden: true,
  318. width: 100,
  319. filterable: true,
  320. remote: true,
  321. type: "select",
  322. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  323. props: {
  324. label: "account",
  325. value: "id",
  326. res: 'data.records'
  327. }
  328. }, {
  329. label: "更新日期",
  330. prop: "updateTime",
  331. searchProp: "updateTimeList",
  332. type: "date",
  333. overHidden: true,
  334. width: 100,
  335. searchRange: true,
  336. searchDefaultTime: ["00:00:00", "23:59:59"],
  337. format: "yyyy-MM-dd",
  338. valueFormat: "yyyy-MM-dd HH:mm:ss"
  339. }]
  340. }
  341. }
  342. },
  343. async created() {
  344. customerListAll().then((res) => {
  345. this.storageNameList = res.data.data
  346. this.salesCompanyId = this.storageNameList[0].salesCompanyId;
  347. // stockClerkNameList
  348. getWarehouseKeeper({ salesCompanyId: this.salesCompanyId }).then(res => {
  349. this.stockClerkNameList = res.data.data;
  350. })
  351. })
  352. this.option = await this.getColumnData(this.getColumnName(274), this.optionList);
  353. this.key++
  354. let i = 0;
  355. this.option.column.forEach(item => {
  356. if (item.search) i++
  357. })
  358. if (i % 3 !== 0) {
  359. const num = 3 - Number(i % 3)
  360. this.option.searchMenuSpan = num * 8;
  361. this.option.searchMenuPosition = "right";
  362. }
  363. if (this.$route.query.id) {
  364. this.detailData = {
  365. id: this.$route.query.id
  366. };
  367. this.detailsOpen = true;
  368. }
  369. this.corpsDescListAllfun()
  370. },
  371. activated(){
  372. // if (this.$route.query.id) {
  373. // this.detailData = {
  374. // id: this.$route.query.id
  375. // };
  376. // this.detailsOpen = true;
  377. // }
  378. },
  379. mounted() {
  380. // console.log(this.$refs.crud);
  381. },
  382. methods: {
  383. check(row) {
  384. this.form = row
  385. this.detailsOpen = true
  386. },
  387. backToList(type) {
  388. this.form = {}
  389. this.detailsOpen = false
  390. if (type === 0) {
  391. this.detailData = {}
  392. }
  393. this.onLoad(this.page, this.search)
  394. // this.$store.commit("DOMIO_OUT_DETAIL");
  395. },
  396. //刷新
  397. refreshChange() {
  398. this.onLoad(this.page, this.search)
  399. },
  400. rowDel(form, index) {
  401. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  402. confirmButtonText: '确定',
  403. cancelButtonText: '取消',
  404. type: 'warning'
  405. }).then(() => {
  406. remove(form.id).then(res => {
  407. this.$message({
  408. type: 'success',
  409. message: '删除成功!'
  410. });
  411. this.dataList.splice(index, 1);
  412. this.onLoad(this.page)
  413. })
  414. }).catch(() => {
  415. });
  416. },
  417. searchChange(params, done) {
  418. this.page.currentPage = 1
  419. done();
  420. this.onLoad(this.page, params)
  421. },
  422. // 获取业务对象
  423. corpsDescListAllfun(){
  424. corpsDescListAll({corpType:'GYS,KH'}).then(res=>{
  425. this.findObject(this.option.column, "customerId").dicData = res.data.data
  426. })
  427. },
  428. onLoad(page, params = {}) {
  429. let storageId = this.search.storageName;
  430. let searchWithoutStorageName = { ...this.search };
  431. delete searchWithoutStorageName.storageName;
  432. var obj2 = this.deepClone(this.search)
  433. params = {
  434. ...params,
  435. current: page.currentPage,
  436. size: page.pageSize,
  437. bizTypeName: "SHGD,TKSHGD",
  438. ...Object.assign(params, searchWithoutStorageName),
  439. storageId: storageId,
  440. // statusName: this.search.$statusName,
  441. stockClerkName: this.search.$stockClerkName
  442. };
  443. delete params.storageName;
  444. // delete this.search.storageName
  445. this.loading = true
  446. this.dataList.forEach(item => {
  447. this.$refs.crud.toggleRowExpansion(item, false);
  448. });
  449. getList(params).then(res => {
  450. if (res.data.data.records) {
  451. res.data.data.records.forEach(e => {
  452. e.itemLoading = true;
  453. this.findObject(this.option.column, "customerId").dicData.map(item=>{
  454. if (e.customerId == item.id) {
  455. e.customerName = item.cname
  456. }
  457. })
  458. });
  459. }
  460. this.dataList = res.data.data.records
  461. this.page.total = res.data.data.total
  462. this.$nextTick(() => {
  463. this.$refs.crud.doLayout()
  464. })
  465. this.loading = false
  466. }).finally(() => {
  467. this.search=obj2
  468. this.loading = false
  469. })
  470. },
  471. editOpen(row, status) {
  472. this.form = row
  473. this.detailData = {
  474. id: row.id,
  475. status: status
  476. };
  477. this.detailsOpen = true;
  478. },
  479. expandChange(row) {
  480. if (!row.itemData) {
  481. getDetails({ id: row.id })
  482. .then(res => {
  483. this.dataList[row.$index].itemData = res.data.data.shipItemsList;
  484. })
  485. .finally(() => {
  486. this.dataList[row.$index].itemLoading = false;
  487. });
  488. }
  489. },
  490. //自定义列保存
  491. async saveColumnTwo(ref, option, optionBack, code) {
  492. /**
  493. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  494. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  495. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  496. */
  497. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  498. if (inSave) {
  499. this.$message.success("保存成功");
  500. //关闭窗口
  501. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  502. }
  503. },
  504. //自定义列重置
  505. async resetColumnTwo(ref, option, optionBack, code) {
  506. this[option] = this[optionBack];
  507. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  508. if (inSave) {
  509. this.$message.success("重置成功");
  510. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  511. }
  512. }
  513. }
  514. }
  515. </script>
  516. <style scoped></style>