item-list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <div class="itemList">
  3. <!-- 数据表格 -->
  4. <item-search
  5. @search="reload"
  6. ref="refSeavch"
  7. @handledime="handledime"
  8. ></item-search>
  9. <ele-pro-table
  10. ref="table"
  11. :initLoad="false"
  12. :columns="columns"
  13. :datasource="datasource"
  14. height="calc(100vh - 405px)"
  15. full-height="calc(100vh - 116px)"
  16. tool-class="ele-toolbar-form"
  17. cache-key="systemOrgUserTable"
  18. @select="selectChange"
  19. @select-all="changeSelectAll"
  20. >
  21. <!-- 表头工具栏 -->
  22. <template v-slot:toolbar="{ row }">
  23. <el-button
  24. v-if="selectedDime == 3 || selectedDime == 4"
  25. size="small"
  26. :disabled="checkRadioData.length == 0"
  27. icon="el-icon-set-up"
  28. class="ele-btn-icon"
  29. @click="allPrinting()"
  30. >
  31. 打印条码
  32. </el-button>
  33. <el-button
  34. v-if="selectedDime == 2 || selectedDime == 3"
  35. size="small"
  36. :disabled="checkRadioData.length == 0"
  37. icon="el-icon-set-up"
  38. class="ele-btn-icon"
  39. @click="showAllot()"
  40. >
  41. 调拨
  42. </el-button>
  43. </template>
  44. <!-- 批次号 -->
  45. <template v-slot:batchNo="{ row }">
  46. <el-popover placement="right-start" width="800" trigger="hover">
  47. <el-table :data="row.outInBatchDetailsVOList">
  48. <el-table-column
  49. width="150"
  50. property="bizNo"
  51. label="入库单号"
  52. ></el-table-column>
  53. <el-table-column
  54. width="100"
  55. property="bizType"
  56. label="入库场景"
  57. ></el-table-column>
  58. <el-table-column
  59. width="120"
  60. property="count"
  61. label="入库数量"
  62. ></el-table-column>
  63. <el-table-column
  64. width="80"
  65. property="measuringUnit"
  66. label="计量单位"
  67. ></el-table-column>
  68. <el-table-column
  69. width="100"
  70. property="packageCount"
  71. label="包装数量"
  72. ></el-table-column>
  73. <el-table-column
  74. width="80"
  75. property="packingUnit"
  76. label="包装单位"
  77. ></el-table-column>
  78. <el-table-column
  79. width="330"
  80. property="position"
  81. label="库位"
  82. ></el-table-column>
  83. <el-table-column
  84. width="160"
  85. property="createTime"
  86. label="入库时间"
  87. ></el-table-column>
  88. </el-table>
  89. <span slot="reference"> {{ row.batchNo }}</span>
  90. </el-popover>
  91. </template>
  92. <!-- 最小包装单元 -->
  93. <template v-slot:minPackingCount="{ row }">
  94. <span v-if="row.minPackingCount">
  95. {{ row.minPackingCount }}
  96. {{ row.measuringUnit }}/{{ row.minUnit }}
  97. </span>
  98. </template>
  99. <!-- 库存保质期 -->
  100. <template v-slot:expirationDate="{ row }">
  101. <span v-if="row.expirationDate">
  102. {{ row.expirationDate ? row.expirationDate : '-' }}
  103. {{
  104. row.expirationDateUnit == 'year'
  105. ? '年'
  106. : row.expirationDateUnit == 'month'
  107. ? '月'
  108. : '日'
  109. }}
  110. </span>
  111. </template>
  112. <!-- 质检状态 -->
  113. <template v-slot:qualityStatus="{ row }">
  114. <span v-if="row.qualityResult == 0 || row.qualityResult == 1"
  115. >已检</span
  116. >
  117. <span v-else-if="row.qualityStatus == 1">已检</span>
  118. <span v-else-if="row.qualityStatus == 0">未检</span>
  119. <span v-else>-</span>
  120. </template>
  121. <!-- 质检结果 -->
  122. <template v-slot:qualityResult="{ row }">
  123. <span v-if="row.qualityResult == 0 || row.qualityResult == ''"
  124. >合格</span
  125. >
  126. <span v-else-if="row.qualityResult == 1">不合格</span>
  127. <span v-else-if="row.qualityResult == 3">让步接收</span>
  128. <span v-else>-</span>
  129. </template>
  130. <!-- 操作列 -->
  131. <template v-slot:action="{ row }">
  132. <el-link
  133. type="primary"
  134. :underline="false"
  135. icon="el-icon-edit"
  136. @click="details(row)"
  137. >
  138. 详情
  139. </el-link>
  140. </template>
  141. </ele-pro-table>
  142. <print ref="printRef" :dimension="selectedDime"></print>
  143. <printSr ref="printSrRef" :dimension="selectedDime"></printSr>
  144. <printTg ref="printTgRef" :dimension="selectedDime"></printTg>
  145. <allot ref="allotRef" :dimension="selectedDime"></allot>
  146. </div>
  147. </template>
  148. <script>
  149. import allot from './allot.vue';
  150. import print from './print.vue';
  151. import printSr from './printSr.vue';
  152. import printTg from './printTg.vue';
  153. import ItemSearch from './item-search.vue';
  154. // import {
  155. // getUserPage,
  156. // removePersonnel,
  157. // unbindLoginName
  158. // } from '@/api/system/organization';
  159. import {
  160. pageeLedgerMain,
  161. removeItem,
  162. getWarehouseList
  163. } from '@/api/classifyManage/itemInformation';
  164. import storageApi from '@/api/warehouseManagement';
  165. import { getBatchDetails } from '@/api/classifyManage/index';
  166. export default {
  167. components: { ItemSearch, print, printSr, printTg, allot },
  168. props: {
  169. // 机构id
  170. organizationId: [Number, String],
  171. // 全部机构
  172. organizationList: Array,
  173. current: {
  174. type: Object,
  175. default: () => ({})
  176. }
  177. },
  178. data() {
  179. return {
  180. checkRadioData: [],
  181. searchForm: {
  182. dimension: '1'
  183. },
  184. selectedDime: '1'
  185. };
  186. },
  187. computed: {
  188. // 表格列配置
  189. columns() {
  190. // selectedDime 1物品维度 2批次维度 3包装维度 4物料维度
  191. let arr = [
  192. {
  193. columnKey: 'index',
  194. type: 'index',
  195. width: 50,
  196. align: 'center',
  197. label: '序号',
  198. showOverflowTooltip: true,
  199. fixed: 'left'
  200. },
  201. {
  202. prop: 'categoryCode',
  203. label: '物品编码',
  204. showOverflowTooltip: true
  205. },
  206. {
  207. prop: 'categoryName',
  208. label: '物品名称',
  209. showOverflowTooltip: true
  210. },
  211. {
  212. prop: 'brandNum',
  213. label: '牌号',
  214. showOverflowTooltip: true
  215. },
  216. {
  217. prop: 'categoryModel',
  218. label: '型号',
  219. showOverflowTooltip: true
  220. },
  221. {
  222. prop: 'specification',
  223. label: '规格',
  224. showOverflowTooltip: true
  225. },
  226. this.selectedDime != 1
  227. ? {
  228. prop: 'batchNo',
  229. label: '批次号',
  230. align: 'center'
  231. }
  232. : '',
  233. {
  234. prop: 'level',
  235. label: '级别',
  236. showOverflowTooltip: true
  237. },
  238. {
  239. prop: 'measureQuantity',
  240. label: '计量数量',
  241. sortable: 'custom',
  242. showOverflowTooltip: true,
  243. width: 130,
  244. align: 'center'
  245. },
  246. {
  247. prop: 'measureUnit',
  248. label: '计量单位',
  249. align: 'center'
  250. },
  251. {
  252. prop: 'weight',
  253. label: '重量',
  254. showOverflowTooltip: true
  255. },
  256. {
  257. prop: 'weightUnit',
  258. label: '重量单位',
  259. showOverflowTooltip: true
  260. },
  261. this.selectedDime == 3
  262. ? {
  263. prop: 'packageNo',
  264. label: '包装编码',
  265. showOverflowTooltip: true
  266. }
  267. : '',
  268. this.selectedDime == 3
  269. ? {
  270. prop: 'packingQuantity',
  271. label: '包装数量 ',
  272. showOverflowTooltip: true
  273. }
  274. : '',
  275. this.selectedDime == 3
  276. ? {
  277. prop: 'packingUnit',
  278. label: '包装单位 ',
  279. showOverflowTooltip: true
  280. }
  281. : '',
  282. this.selectedDime == 3 || this.selectedDime == 4
  283. ? {
  284. prop: 'barcodes',
  285. label: '发货条码 ',
  286. showOverflowTooltip: true
  287. }
  288. : '',
  289. this.selectedDime == 3 || this.selectedDime == 4
  290. ? {
  291. prop: 'clientCode',
  292. label: '客户代号',
  293. showOverflowTooltip: true
  294. }
  295. : '',
  296. this.selectedDime == 3 || this.selectedDime == 4
  297. ? {
  298. prop: 'engrave',
  299. label: '刻码 ',
  300. showOverflowTooltip: true
  301. }
  302. : '',
  303. this.selectedDime == 4
  304. ? {
  305. prop: 'materielDesignation',
  306. label: '物料代号',
  307. showOverflowTooltip: true
  308. }
  309. : '',
  310. {
  311. columnKey: 'action',
  312. label: '操作',
  313. width: 100,
  314. align: 'left',
  315. resizable: false,
  316. slot: 'action',
  317. fixed: 'right'
  318. }
  319. ];
  320. return arr.filter((item) => item != '');
  321. },
  322. clientEnvironmentId() {
  323. return this.$store.state.user.info.clientEnvironmentId;
  324. }
  325. },
  326. methods: {
  327. // 调拨
  328. showAllot() {
  329. this.$refs.allotRef.open(this.checkRadioData);
  330. },
  331. // 全选
  332. changeSelectAll(arr) {
  333. console.log(arr);
  334. if (arr.length != 0) {
  335. this.checkRadioData = arr;
  336. } else {
  337. this.checkRadioData = [];
  338. }
  339. },
  340. selectChange(selection, row) {
  341. if (selection.length != 0) {
  342. this.checkRadioData = selection;
  343. } else {
  344. this.checkRadioData = [];
  345. }
  346. },
  347. allPrinting() {
  348. if (this.clientEnvironmentId == 2) {
  349. this.$refs.printSrRef.open(this.checkRadioData);
  350. } else if (this.clientEnvironmentId == 3) {
  351. this.$refs.printTgRef.open(this.checkRadioData);
  352. } else {
  353. this.$refs.printRef.open(this.checkRadioData);
  354. }
  355. },
  356. handledime(val) {
  357. this.selectedDime = val;
  358. this.reload();
  359. },
  360. /* 表格数据源 */
  361. datasource({ page, limit, where, order }) {
  362. const dimension = this.$refs.refSeavch.dimension;
  363. const treeId = this.$parent.$parent.$parent.current.id;
  364. if (this.selectedDime == 1) {
  365. // 物品维度
  366. const data = storageApi.getProductList({
  367. ...where,
  368. ...order,
  369. pageNum: page,
  370. size: limit
  371. });
  372. return data;
  373. } else if (this.selectedDime == 2) {
  374. // 批次维度
  375. const params = {
  376. categoryLevelId: treeId,
  377. ...where,
  378. ...order
  379. };
  380. const data = storageApi.getBatchList({
  381. ...params,
  382. pageNum: page,
  383. size: limit
  384. });
  385. return data;
  386. } else if (this.selectedDime == 4) {
  387. // 物料维度
  388. const params = {
  389. categoryLevelId: treeId,
  390. ...where,
  391. ...order
  392. };
  393. const data = storageApi.getMaterialList({
  394. ...params,
  395. pageNum: page,
  396. size: limit
  397. });
  398. return data;
  399. } else {
  400. // 包装维度
  401. const params = {
  402. categoryLevelId: treeId,
  403. ...where,
  404. ...order
  405. };
  406. const data = storageApi.getPackingList({
  407. ...params,
  408. pageNum: page,
  409. size: limit
  410. });
  411. return data;
  412. }
  413. },
  414. /* 刷新表格 */
  415. reload(where) {
  416. this.$nextTick(() => {
  417. this.$refs.table.reload({
  418. pageNum: 1,
  419. where: {
  420. ...where,
  421. categoryLevelId: this.current?.data?.id || this.current?.id
  422. }
  423. });
  424. });
  425. },
  426. details(row) {
  427. const key = Date.now();
  428. this.$store.commit('stockManagement/CLEAR_BASEINFO');
  429. this.$store.commit('stockManagement/CHANGE_BASEINFO', {
  430. key,
  431. value: row
  432. });
  433. const url =
  434. this.$refs.refSeavch.dimension == 1
  435. ? '/warehouseManagement/stockLedger/allBatchDetails'
  436. : '/warehouseManagement/stockLedger/batchDetails';
  437. this.$router.push({
  438. path: url,
  439. query: {
  440. key,
  441. dimension: this.$refs.refSeavch.dimension,
  442. // id: this.$refs.refSeavch.dimension != 3 ? row.id : row.categoryId,
  443. id: row.categoryId,
  444. assetId: row.assetId,
  445. batchNo: row.batchNo
  446. }
  447. });
  448. }
  449. },
  450. watch: {
  451. // 监听机构id变化
  452. current: {
  453. handler() {
  454. this.reload();
  455. }
  456. }
  457. }
  458. };
  459. </script>