item-list.vue 16 KB

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