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', 347)"
  8. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 347)" :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: 'goodsName',
  87. width: 200,
  88. overHidden: true,
  89. disabled: false,
  90. filterable: true,
  91. type: 'select',
  92. props: {
  93. label: 'cname',
  94. value: 'cname'
  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: 'brandName',
  130. width: 100,
  131. overHidden: true,
  132. disabled: false,
  133. type: 'select',
  134. props: {
  135. label: 'cname',
  136. value: 'cname'
  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: "sendTotalNum",
  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: "customerName",
  220. search: true,
  221. overHidden: true,
  222. type: 'select',
  223. props: {
  224. label: 'cname',
  225. value: 'cname'
  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: 'cname'
  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: "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. // width: 120,
  269. }, {
  270. label: '业务日期',
  271. prop: "businesDate",
  272. searchProp: "businesDateList",
  273. type: "date",
  274. overHidden: true,
  275. search: true,
  276. width: 100,
  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: 'realName'
  290. },
  291. dicUrl: '/api/blade-user/stockClerkList',
  292. // props: {
  293. // label: 'name',
  294. // value: 'id'
  295. // },
  296. // dicUrl: "/api/blade-user/getWarehouseKeeper?salesCompanyId=" + JSON.parse(localStorage.getItem("saber-userInfo")).content.dept_id,
  297. // width: 200
  298. }, {
  299. label: "制单人",
  300. prop: "createUserName",
  301. searchProp: "createUser",
  302. overHidden: true,
  303. width: 100,
  304. filterable: true,
  305. remote: true,
  306. type: "select",
  307. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  308. props: {
  309. label: "account",
  310. value: "account",
  311. res: 'data.records'
  312. }
  313. }, {
  314. label: "制单日期",
  315. prop: "createTime",
  316. searchProp: "createTimeList",
  317. type: "date",
  318. overHidden: true,
  319. width: 100,
  320. searchRange: true,
  321. searchDefaultTime: ["00:00:00", "23:59:59"],
  322. format: "yyyy-MM-dd",
  323. valueFormat: "yyyy-MM-dd HH:mm:ss"
  324. }, {
  325. label: "更新人",
  326. prop: "updateUserName",
  327. searchProp: "updateUser",
  328. overHidden: true,
  329. width: 100,
  330. filterable: true,
  331. remote: true,
  332. type: "select",
  333. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  334. props: {
  335. label: "account",
  336. value: "account",
  337. res: 'data.records'
  338. }
  339. }, {
  340. label: "更新日期",
  341. prop: "updateTime",
  342. searchProp: "updateTimeList",
  343. type: "date",
  344. overHidden: true,
  345. width: 100,
  346. searchRange: true,
  347. searchDefaultTime: ["00:00:00", "23:59:59"],
  348. format: "yyyy-MM-dd",
  349. valueFormat: "yyyy-MM-dd HH:mm:ss"
  350. }]
  351. }
  352. }
  353. },
  354. async created() {
  355. this.option = await this.getColumnData(this.getColumnName(347), this.optionList);
  356. customerListAll().then((res) => {
  357. this.storageNameList = res.data.data
  358. this.salesCompanyId = this.storageNameList[0].salesCompanyId;
  359. // stockClerkNameList
  360. getWarehouseKeeper({ salesCompanyId: this.salesCompanyId }).then(res => {
  361. this.stockClerkNameList = res.data.data;
  362. })
  363. })
  364. this.key++
  365. let i = 0;
  366. this.option.column.forEach(item => {
  367. if (item.search) i++
  368. })
  369. if (i % 3 !== 0) {
  370. const num = 3 - Number(i % 3)
  371. this.option.searchMenuSpan = num * 8;
  372. this.option.searchMenuPosition = "right";
  373. }
  374. if (this.$route.query.id) {
  375. this.detailData = {
  376. id: this.$route.query.id
  377. };
  378. this.detailsOpen = true;
  379. }
  380. this.corpsDescListAllfun()
  381. },
  382. activated(){
  383. // if (this.$route.query.id) {
  384. // this.detailData = {
  385. // id: this.$route.query.id
  386. // };
  387. // this.detailsOpen = true;
  388. // }
  389. },
  390. mounted() {
  391. // console.log(this.$refs.crud);
  392. },
  393. methods: {
  394. check(row) {
  395. this.form = row
  396. this.detailsOpen = true
  397. },
  398. backToList(type) {
  399. this.form = {}
  400. this.detailsOpen = false
  401. if (type === 0) {
  402. this.detailData = {}
  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:'KH'}).then(res=>{
  436. this.findObject(this.option.column, "customerId").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: "THSHGD",
  449. ...Object.assign(params,this.search),
  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. })
  476. this.loading = false
  477. }).finally(() => {
  478. // console.log(this.search)
  479. this.search=obj2
  480. // if(this.search.statusName==''){
  481. // this.search.statusName='待入库'
  482. // }
  483. this.loading = false
  484. })
  485. },
  486. editOpen(row, status) {
  487. this.form = row
  488. this.detailData = {
  489. id: row.id,
  490. status: status
  491. };
  492. this.detailsOpen = true;
  493. },
  494. expandChange(row) {
  495. if (!row.itemData) {
  496. getDetails({ id: row.id })
  497. .then(res => {
  498. this.dataList[row.$index].itemData = res.data.data.shipItemsList;
  499. })
  500. .finally(() => {
  501. this.dataList[row.$index].itemLoading = false;
  502. });
  503. }
  504. },
  505. //自定义列保存
  506. async saveColumnTwo(ref, option, optionBack, code) {
  507. /**
  508. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  509. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  510. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  511. */
  512. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  513. if (inSave) {
  514. this.$message.success("保存成功");
  515. //关闭窗口
  516. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  517. }
  518. },
  519. //自定义列重置
  520. async resetColumnTwo(ref, option, optionBack, code) {
  521. this[option] = this[optionBack];
  522. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  523. if (inSave) {
  524. this.$message.success("重置成功");
  525. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  526. }
  527. }
  528. }
  529. }
  530. </script>
  531. <style scoped></style>