item-list.vue 16 KB

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