index.vue 16 KB

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