index.vue 16 KB

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