index.vue 15 KB

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