item-list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. <template>
  2. <div>
  3. <!-- 数据表格 -->
  4. <item-search @search="reload" ref="refSeavch" @handledime="handledime">
  5. </item-search>
  6. <ele-pro-table
  7. ref="table"
  8. :initLoad="false"
  9. :columns="columns"
  10. :datasource="datasource"
  11. height="calc(100vh - 355px)"
  12. full-height="calc(100vh - 116px)"
  13. tool-class="ele-toolbar-form"
  14. cache-key="systemOrgUserTable"
  15. >
  16. <!-- 表头工具栏 -->
  17. <template v-slot:toolbar> </template>
  18. <!-- 批次号 -->
  19. <template v-slot:batchNo="{ row }">
  20. <el-popover placement="right-start" width="800" trigger="hover">
  21. <el-table :data="row.outInBatchDetailsVOList">
  22. <el-table-column
  23. width="150"
  24. property="bizNo"
  25. label="入库单号"
  26. ></el-table-column>
  27. <el-table-column
  28. width="100"
  29. property="bizType"
  30. label="入库场景"
  31. ></el-table-column>
  32. <el-table-column
  33. width="120"
  34. property="count"
  35. label="入库数量"
  36. ></el-table-column>
  37. <el-table-column
  38. width="80"
  39. property="measuringUnit"
  40. label="计量单位"
  41. ></el-table-column>
  42. <el-table-column
  43. width="100"
  44. property="packageCount"
  45. label="包装数量"
  46. ></el-table-column>
  47. <el-table-column
  48. width="80"
  49. property="packingUnit"
  50. label="包装单位"
  51. ></el-table-column>
  52. <el-table-column
  53. width="330"
  54. property="position"
  55. label="库位"
  56. ></el-table-column>
  57. <el-table-column
  58. width="160"
  59. property="createTime"
  60. label="入库时间"
  61. ></el-table-column>
  62. </el-table>
  63. <span slot="reference"> {{ row.batchNo }}</span>
  64. </el-popover>
  65. </template>
  66. <!-- 库存保质期 -->
  67. <template v-slot:expirationDate="{ row }">
  68. <span v-if="row.expirationDate">
  69. {{ row.expirationDate ? row.expirationDate : '-' }}
  70. {{
  71. row.expirationDateUnit == 'year'
  72. ? '年'
  73. : row.expirationDateUnit == 'month'
  74. ? '月'
  75. : '日'
  76. }}
  77. </span>
  78. </template>
  79. <!-- 质检状态 -->
  80. <template v-slot:qualityStatus="{ row }">
  81. <span v-if="row.qualityStatus == 0">未检</span>
  82. <span v-else-if="row.qualityStatus == 1">已检</span>
  83. <span v-else>-</span>
  84. </template>
  85. <!-- 质检结果 -->
  86. <template v-slot:qualityResult="{ row }">
  87. <span v-if="row.qualityResult == 0">合格</span>
  88. <span v-else-if="row.qualityResult == 1">不合格</span>
  89. <span v-else-if="row.qualityResult == 3">让步接收</span>
  90. <span v-else>-</span>
  91. </template>
  92. <!-- 操作列 -->
  93. <template v-slot:action="{ row }">
  94. <el-link
  95. type="primary"
  96. :underline="false"
  97. icon="el-icon-edit"
  98. @click="details(row)"
  99. >
  100. 详情
  101. </el-link>
  102. </template>
  103. </ele-pro-table>
  104. </div>
  105. </template>
  106. <script>
  107. import ItemSearch from './item-search.vue';
  108. // import {
  109. // getUserPage,
  110. // removePersonnel,
  111. // unbindLoginName
  112. // } from '@/api/system/organization';
  113. import {
  114. pageeLedgerMain,
  115. removeItem,
  116. getWarehouseList
  117. } from '@/api/classifyManage/itemInformation';
  118. import ouint from '@/api/warehouseManagement/outin';
  119. import { getBatchDetails } from '@/api/classifyManage/index';
  120. export default {
  121. components: { ItemSearch },
  122. props: {
  123. // 机构id
  124. organizationId: [Number, String],
  125. // 全部机构
  126. organizationList: Array,
  127. current: {
  128. type: Object,
  129. default: () => ({})
  130. }
  131. },
  132. data() {
  133. return {
  134. searchForm: {
  135. dimension: 1
  136. },
  137. isShow: false,
  138. isPack: false,
  139. isMeta: false,
  140. selectedDime: 1
  141. };
  142. },
  143. computed: {
  144. // 表格列配置
  145. columns() {
  146. let obj = [
  147. {
  148. columnKey: 'index',
  149. type: 'index',
  150. width: 50,
  151. align: 'center',
  152. label: '序号',
  153. showOverflowTooltip: true,
  154. fixed: 'left'
  155. },
  156. {
  157. prop: 'code',
  158. label: '编码',
  159. showOverflowTooltip: true
  160. },
  161. {
  162. prop: 'name',
  163. label: '名称',
  164. showOverflowTooltip: true
  165. },
  166. {
  167. prop: 'brandNum',
  168. label: '牌号',
  169. showOverflowTooltip: true
  170. },
  171. {
  172. prop: 'modelType',
  173. label: '型号',
  174. showOverflowTooltip: true
  175. },
  176. {
  177. prop: 'packingCountBase',
  178. label: '包装库存数量',
  179. sortable: 'custom',
  180. showOverflowTooltip: true,
  181. width: 130,
  182. align: 'center'
  183. },
  184. {
  185. prop: 'minUnit',
  186. label: '包装单位',
  187. showOverflowTooltip: true
  188. },
  189. {
  190. prop: 'availableCountBase',
  191. label: '计量库存数量',
  192. sortable: 'custom',
  193. showOverflowTooltip: true,
  194. width: 130,
  195. align: 'center'
  196. },
  197. {
  198. prop: 'measuringUnit',
  199. label: '计量单位',
  200. align: 'center'
  201. },
  202. {
  203. prop: 'expirationDate',
  204. slot: 'expirationDate',
  205. label: '库存保质期',
  206. showOverflowTooltip: true,
  207. width: 100
  208. },
  209. {
  210. prop: 'expirationTime',
  211. label: '周期倒计时',
  212. showOverflowTooltip: true,
  213. width: 100
  214. },
  215. {
  216. prop: 'qualityStatus',
  217. slot: 'qualityStatus',
  218. label: '质检状态',
  219. showOverflowTooltip: true,
  220. width: 100
  221. },
  222. {
  223. prop: 'qualityResult',
  224. slot: 'qualityResult',
  225. label: '质检结果',
  226. showOverflowTooltip: true,
  227. width: 100
  228. },
  229. {
  230. prop: 'paths',
  231. width: 230,
  232. label: '仓库',
  233. showOverflowTooltip: true
  234. },
  235. // {
  236. // prop: '',
  237. // label: '安全库存',
  238. // showOverflowTooltip: true
  239. // },
  240. // {
  241. // prop: '',
  242. // label: '质保期',
  243. // showOverflowTooltip: true
  244. // },
  245. {
  246. columnKey: 'action',
  247. label: '操作',
  248. width: 100,
  249. align: 'left',
  250. resizable: false,
  251. slot: 'action'
  252. }
  253. ];
  254. if (this.isShow) {
  255. obj.splice(1, 0, {
  256. slot: 'batchNo',
  257. prop: 'batchNo',
  258. label: '批次号',
  259. showOverflowTooltip: true
  260. });
  261. let index = obj.findIndex((item) => item.label == '仓库');
  262. if (index !== -1) {
  263. obj.splice(index, 1);
  264. }
  265. }
  266. if (this.isPack) {
  267. obj.splice(1, 0, {
  268. slot: 'batchNum',
  269. prop: 'batchNum',
  270. label: '批次号',
  271. showOverflowTooltip: true
  272. });
  273. // 寻找现有的 'code' 对象的索引
  274. let codeIndex = obj.findIndex((item) => item.prop === 'code');
  275. if (codeIndex !== -1) {
  276. // 删除现有的 'code' 对象
  277. obj.splice(codeIndex, 1, {
  278. prop: 'packagingCode',
  279. label: '包装编码',
  280. showOverflowTooltip: true
  281. });
  282. }
  283. }
  284. if (this.isMeta) {
  285. obj.splice(1, 0, {
  286. slot: 'batchNum',
  287. prop: 'batchNum',
  288. label: '批次号',
  289. showOverflowTooltip: true
  290. });
  291. obj.splice(10, 0, {
  292. prop: 'weight',
  293. label: '重量',
  294. showOverflowTooltip: true
  295. });
  296. obj.splice(11, 0, {
  297. prop: 'weightUnit',
  298. label: '重量单位',
  299. showOverflowTooltip: true
  300. });
  301. obj.splice(6, 0, {
  302. prop: 'meterielCode',
  303. label: '物料代号',
  304. showOverflowTooltip: true
  305. });
  306. obj.splice(7, 0, {
  307. prop: 'engrave',
  308. label: '刻码',
  309. showOverflowTooltip: true
  310. });
  311. // 寻找现有的 'code' 对象的索引
  312. let codeIndex = obj.findIndex((item) => item.prop === 'code');
  313. if (codeIndex !== -1) {
  314. // 删除现有的 'code' 对象
  315. obj.splice(codeIndex, 1, {
  316. prop: 'materialCode',
  317. label: '物料编码',
  318. showOverflowTooltip: true
  319. });
  320. }
  321. }
  322. return obj;
  323. }
  324. },
  325. methods: {
  326. handledime(val) {
  327. this.$set(this, 'isShow', val == 2);
  328. this.$set(this, 'isPack', val == 3);
  329. this.$set(this, 'isMeta', val == 4);
  330. // this.reload({
  331. // ...this.$refs.refSeavch.params,
  332. // dimension: this.$refs.refSeavch.dimension
  333. // });
  334. // if (val == 2) {
  335. // // this.handleBatchDimension(val);
  336. // this.reload();
  337. // } else if (val == 3) {
  338. // this.handleInventoryDimension(val);
  339. // }else{}
  340. this.reload();
  341. this.selectedDime = val;
  342. },
  343. //批次维度
  344. async handleBatchDimension(event) {
  345. // const treeId = this.$parent.$parent.$parent.current.id;
  346. // const params = {
  347. // page: 1,
  348. // size: 10,
  349. // categoryLevelId: treeId
  350. // };
  351. // const res = await getBatchDetails(params);
  352. // console.log(res);
  353. // 待完善
  354. },
  355. //库存维度
  356. async handleInventoryDimension(val) {
  357. // const treeId = this.$parent.$parent.$parent.current.id;
  358. // const rep = await ouint.getInventoryDetails({
  359. // pageNum: 1,
  360. // size: 10,
  361. // categoryLevelId: treeId
  362. // });
  363. // console.log(rep);
  364. //待完善
  365. },
  366. /* 表格数据源 */
  367. datasource({ page, limit, where, order }) {
  368. const dimension = this.$refs.refSeavch.dimension;
  369. const treeId = this.$parent.$parent.$parent.current.id;
  370. if (this.selectedDime == 1) {
  371. const data = ouint.getRealTimeInventory({
  372. ...where,
  373. ...order,
  374. pageNum: page,
  375. size: limit,
  376. dimension: dimension
  377. });
  378. const result = data.then((res) => {
  379. let item = res.list.map((item) => {
  380. return {
  381. ...item,
  382. paths: item.pathName.split(',')[0],
  383. qualityResult:
  384. typeof item.qualityResult != 'number'
  385. ? 3
  386. : item.qualityResult,
  387. qualityStatus:
  388. typeof item.qualityStatus != 'number' ? 3 : item.qualityStatus
  389. };
  390. });
  391. return { ...res, list: item };
  392. });
  393. return result;
  394. } else if (this.selectedDime == 2) {
  395. const params = {
  396. categoryLevelId: treeId,
  397. ...where,
  398. ...order,
  399. dimension: dimension
  400. };
  401. const data = getBatchDetails({
  402. ...params,
  403. pageNum: page,
  404. size: limit
  405. });
  406. const result = data.then((res) => {
  407. let item = res.list.map((item) => {
  408. return {
  409. ...item,
  410. minUnit: item.packingUnit,
  411. qualityResult:
  412. typeof item.qualityResult != 'number'
  413. ? 3
  414. : item.qualityResult,
  415. qualityStatus:
  416. typeof item.qualityStatus != 'number' ? 3 : item.qualityStatus
  417. };
  418. });
  419. return { ...res, list: item };
  420. });
  421. return result;
  422. } else if (this.selectedDime == 4) {
  423. const params = {
  424. categoryLevelId: treeId,
  425. ...where,
  426. ...order,
  427. dimension: dimension
  428. };
  429. const data = ouint.getMaterielDetails({
  430. ...params,
  431. pageNum: page,
  432. size: limit
  433. });
  434. const result = data.then((res) => {
  435. const data = res.list.map((item) => {
  436. return {
  437. ...item,
  438. minUnit: item.packingUnit,
  439. paths: item.pathName,
  440. availableCountBase: 1,
  441. packingCountBase: 1,
  442. materialCode: item.code,
  443. batchNum: item.batchNo,
  444. qualityResult:
  445. typeof item.qualityResult != 'number'
  446. ? 3
  447. : item.qualityResult,
  448. qualityStatus:
  449. typeof item.qualityStatus != 'number' ? 3 : item.qualityStatus
  450. };
  451. });
  452. console.log(data);
  453. return { ...res, list: data };
  454. });
  455. console.log(result);
  456. return result;
  457. } else {
  458. const params = {
  459. categoryLevelId: treeId,
  460. ...where,
  461. ...order,
  462. dimension: dimension
  463. };
  464. const data = ouint.getInventoryDetails({
  465. ...params,
  466. pageNum: page,
  467. size: limit
  468. });
  469. const result = data.then((res) => {
  470. const data = res.list.map((item) => {
  471. return {
  472. ...item,
  473. minUnit: item.packingUnit,
  474. paths: item.pathName.split(',')[0],
  475. // availableCountBase: 1,
  476. packingCountBase: 1,
  477. packagingCode: item.code,
  478. qualityResult:
  479. typeof item.qualityResult != 'number'
  480. ? 3
  481. : item.qualityResult,
  482. qualityStatus:
  483. typeof item.qualityStatus != 'number' ? 3 : item.qualityStatus
  484. };
  485. });
  486. return { ...res, list: data };
  487. });
  488. return result;
  489. }
  490. },
  491. /* 刷新表格 */
  492. reload(where) {
  493. this.$nextTick(() => {
  494. this.$refs.table.reload({
  495. pageNum: 1,
  496. where: {
  497. ...where,
  498. categoryLevelId: this.current?.data?.id || this.current?.id
  499. }
  500. });
  501. });
  502. },
  503. details(row) {
  504. const key = Date.now();
  505. this.$store.commit('stockManagement/CLEAR_BASEINFO');
  506. this.$store.commit('stockManagement/CHANGE_BASEINFO', {
  507. key,
  508. value: row
  509. });
  510. const url =
  511. this.$refs.refSeavch.dimension == 1
  512. ? '/warehouseManagement/stockLedger/allBatchDetails'
  513. : '/warehouseManagement/stockLedger/batchDetails';
  514. this.$router.push({
  515. path: url,
  516. query: {
  517. key,
  518. dimension: this.$refs.refSeavch.dimension,
  519. id: this.$refs.refSeavch.dimension != 3 ? row.id : row.categoryId,
  520. assetId: row.assetId,
  521. batchNo: row.batchNo
  522. }
  523. });
  524. }
  525. },
  526. watch: {
  527. // 监听机构id变化
  528. current: {
  529. handler() {
  530. this.reload();
  531. }
  532. }
  533. }
  534. };
  535. </script>
  536. <style lang="scss" scoped></style>