pickingList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. <template>
  2. <el-dialog
  3. title="领料列表"
  4. :visible.sync="visible"
  5. v-if="visible"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. :close-on-press-escape="false"
  9. append-to-body
  10. width="75%"
  11. >
  12. <el-card shadow="never">
  13. <pickingListSearch @search="reload" ref="searchRef" />
  14. <ele-split-layout
  15. width="244px"
  16. allow-collapse
  17. :right-style="{ overflow: 'hidden' }"
  18. >
  19. <div class="ele-border-lighter split-layout-right-content">
  20. <AssetTree
  21. ref="assetTreeRef"
  22. :treeIds="treeIds"
  23. @handleNodeClick="handleNodeClick"
  24. @setRootId="setRootId"
  25. />
  26. </div>
  27. <!-- 表格 -->
  28. <template v-slot:content>
  29. <ele-pro-table
  30. :initLoad="false"
  31. ref="table"
  32. :columns="columns"
  33. :datasource="datasource"
  34. :selection.sync="selection"
  35. row-key="id"
  36. height="calc(100vh - 350px)"
  37. class="dict-table"
  38. :key="tableKey"
  39. :cache-key="tableKey"
  40. :row-style="rowStyle"
  41. :row-click-checked="true"
  42. :row-click-checked-intelligent="false"
  43. @update:selection="handleSelectionChange"
  44. @done="onDone"
  45. >
  46. <template v-slot:toolbar>
  47. <el-alert
  48. type="info"
  49. :closable="false"
  50. class="ele-alert-border"
  51. style="width: 300px"
  52. >
  53. <i class="el-icon-info ele-text-info"></i>
  54. <span class="ele-text">
  55. <span>
  56. 已选择
  57. <b class="ele-text-info">{{ allSelection.length }}</b>
  58. 项数据<em></em>
  59. </span>
  60. </span>
  61. <el-link type="primary" :underline="false" @click="clearChoose">
  62. 清空
  63. </el-link>
  64. </el-alert>
  65. </template>
  66. <template v-slot:code="{ row }">
  67. {{ row.rootCategoryLevelId == 4 ? row.codeNumber : row.code }}
  68. </template>
  69. <template v-slot:runStatus="{ row }">
  70. {{ stateList[Number(row.runStatus)] }}
  71. </template>
  72. <template v-slot:vehicleLen="{ row }">
  73. {{ row.extInfo.vehicleLen || '-' }}
  74. {{ row.extInfo.wilde || '-' }} {{ row.extInfo.hight || '-' }}
  75. </template>
  76. <template v-slot:status="{ row }">
  77. <span :style="{ color: row.status == 0 ? '#157A2C' : '#FFA929' }"
  78. >状态{{
  79. row.status == 0 ? '空闲' : row.status == 1 ? '占用' : ''
  80. }}</span
  81. >
  82. </template>
  83. <template v-slot:packingCountBase="{ row }">
  84. {{ row.packingCountBase }} {{ row.minUnit }}
  85. </template>
  86. <template v-slot:availableCountBase="{ row }">
  87. {{ row.availableCountBase }} {{ row.measuringUnit }}
  88. </template>
  89. <template v-slot:weight="{ row }">
  90. {{ row.weight }} {{ row.weightUnit }}
  91. </template>
  92. <!-- 库存保质期 -->
  93. <template v-slot:expirationDate="{ row }">
  94. <span v-if="row.expirationDate">
  95. {{ row.expirationDate ? row.expirationDate : '-' }}
  96. {{
  97. row.expirationDateUnit == 'year'
  98. ? '年'
  99. : row.expirationDateUnit == 'month'
  100. ? '月'
  101. : '日'
  102. }}
  103. </span>
  104. </template>
  105. <!-- 质检状态 -->
  106. <template v-slot:qualityStatus="{ row }">
  107. <span v-if="row.qualityResult == 0 || row.qualityResult == 1"
  108. >已检</span
  109. >
  110. <span v-else-if="row.qualityStatus == 1">已检</span>
  111. <span v-else-if="row.qualityStatus == 0">未检</span>
  112. <span v-else>-</span>
  113. </template>
  114. <!-- 质检结果 -->
  115. <template v-slot:qualityResult="{ row }">
  116. <span v-if="row.qualityResult == 0 || row.qualityResult == ''"
  117. >合格</span
  118. >
  119. <span v-else-if="row.qualityResult == 1">不合格</span>
  120. <span v-else-if="row.qualityResult == 3">让步接收</span>
  121. <span v-else>-</span>
  122. </template>
  123. </ele-pro-table>
  124. </template>
  125. </ele-split-layout>
  126. </el-card>
  127. <div class="btns">
  128. <el-button type="primary" size="small" @click="selected">选择</el-button>
  129. <el-button size="small" @click="handleClose">关闭</el-button>
  130. </div>
  131. </el-dialog>
  132. </template>
  133. <script>
  134. import AssetTree from '../../components/assetTree.vue';
  135. import pickingListSearch from './pickingListSearch.vue';
  136. import { pageeLedgerMain } from '@/api/produce/workOrder';
  137. export default {
  138. components: { AssetTree, pickingListSearch },
  139. props: {
  140. isType: {
  141. type: String,
  142. default: '',
  143. required: true
  144. }
  145. },
  146. data() {
  147. return {
  148. visible: false,
  149. id: null,
  150. treeIds: null,
  151. categoryLevelId: null,
  152. rootCategoryLevelId: null,
  153. isCategory: true,
  154. stateList: [
  155. '启动',
  156. '空闲',
  157. '运行',
  158. '故障',
  159. '检修',
  160. '停机',
  161. '待料',
  162. '占用'
  163. ],
  164. selection: [],
  165. allSelection: []
  166. };
  167. },
  168. computed: {
  169. tableKey() {
  170. return `table-${this.rootCategoryLevelId}`;
  171. },
  172. // 表格列配置
  173. columns() {
  174. return [
  175. {
  176. width: 45,
  177. type: 'selection',
  178. columnKey: 'selection',
  179. align: 'center',
  180. reserveSelection: true
  181. },
  182. {
  183. columnKey: 'index',
  184. label: '序号',
  185. type: 'index',
  186. width: 50,
  187. align: 'center'
  188. },
  189. {
  190. prop: 'code',
  191. label: '编码',
  192. slot: 'code'
  193. },
  194. {
  195. prop: 'name',
  196. label: '名称',
  197. showOverflowTooltip: true
  198. },
  199. {
  200. prop: 'brandNum',
  201. label: '牌号',
  202. showOverflowTooltip: true
  203. },
  204. {
  205. prop: 'modelType',
  206. label: '型号',
  207. showOverflowTooltip: true
  208. },
  209. {
  210. prop: 'specification',
  211. label: '规格',
  212. showOverflowTooltip: true
  213. },
  214. {
  215. prop: 'batchNo',
  216. label: '批次号',
  217. align: 'center'
  218. },
  219. {
  220. prop: 'manualBatchNo',
  221. label: '批号',
  222. align: 'center'
  223. },
  224. {
  225. prop: 'availableCountBase',
  226. label: '计量库存数量',
  227. sortable: 'custom',
  228. slot: 'availableCountBase',
  229. showOverflowTooltip: true,
  230. width: 130,
  231. align: 'center'
  232. },
  233. ...([1, 23, 8].includes(Number(this.rootCategoryLevelId))
  234. ? [
  235. {
  236. prop: 'packingCountBase',
  237. label: '包装库存',
  238. slot: 'packingCountBase',
  239. showOverflowTooltip: true
  240. }
  241. ]
  242. : []),
  243. {
  244. prop: 'weight',
  245. label: '重量',
  246. showOverflowTooltip: true,
  247. slot: 'weight'
  248. },
  249. {
  250. prop: 'expirationDate',
  251. slot: 'expirationDate',
  252. label: '库存保质期',
  253. width: 100
  254. },
  255. {
  256. prop: 'expirationTime',
  257. label: '周期倒计时',
  258. showOverflowTooltip: true,
  259. width: 100
  260. },
  261. {
  262. prop: 'qualityResult',
  263. slot: 'qualityResult',
  264. label: '质检结果',
  265. showOverflowTooltip: true,
  266. width: 100
  267. },
  268. {
  269. prop: 'qualityStatus',
  270. slot: 'qualityStatus',
  271. label: '质检状态',
  272. showOverflowTooltip: true,
  273. width: 100
  274. },
  275. {
  276. prop: 'pathName',
  277. width: 230,
  278. label: '仓库',
  279. showOverflowTooltip: true
  280. },
  281. ...(this.rootCategoryLevelId == '4'
  282. ? [
  283. {
  284. prop: 'workstationName',
  285. label: '工位',
  286. showOverflowTooltip: true
  287. },
  288. {
  289. prop: 'runStatus',
  290. label: '状态',
  291. slot: 'runStatus',
  292. showOverflowTooltip: true
  293. }
  294. ]
  295. : []),
  296. // ...(this.rootCategoryLevelId == '5'
  297. // ? [
  298. // {
  299. // prop: 'dieHoleNum',
  300. // label: '模孔数量',
  301. // showOverflowTooltip: true
  302. // },
  303. // {
  304. // prop: 'mandrelDiameter',
  305. // label: '芯棒直径',
  306. // showOverflowTooltip: true
  307. // },
  308. // {
  309. // prop: 'shrinkEffictive',
  310. // label: '收缩系数',
  311. // showOverflowTooltip: true
  312. // }
  313. // ]
  314. // : []),
  315. // ...(this.rootCategoryLevelId == '7'
  316. // ? [
  317. // {
  318. // prop: 'materialQuality',
  319. // label: '材质',
  320. // showOverflowTooltip: true
  321. // },
  322. // {
  323. // prop: 'vehicleLen',
  324. // label: '长宽高',
  325. // slot: 'vehicleLen',
  326. // showOverflowTooltip: true
  327. // }
  328. // ]
  329. // : []),
  330. ...(this.rootCategoryLevelId == '8'
  331. ? [
  332. {
  333. prop: 'extInfo.slotNum',
  334. label: '槽数',
  335. showOverflowTooltip: true
  336. }
  337. ]
  338. : []),
  339. ...(this.rootCategoryLevelId == '11'
  340. ? [
  341. {
  342. prop: 'status',
  343. label: '状态',
  344. slot: 'status',
  345. showOverflowTooltip: true
  346. }
  347. ]
  348. : [])
  349. ];
  350. }
  351. },
  352. watch: {},
  353. methods: {
  354. /* 表格数据源 */
  355. datasource({ page, where, limit }) {
  356. let URL = pageeLedgerMain;
  357. if (this.isCategory) {
  358. return URL({
  359. ...where,
  360. pageNum: page,
  361. size: limit,
  362. categoryLevelId: this.categoryLevelId,
  363. dimension: 1
  364. });
  365. } else {
  366. return URL({
  367. ...where,
  368. pageNum: page,
  369. categoryLevelId: this.categoryLevelId,
  370. size: limit,
  371. dimension: 1
  372. });
  373. }
  374. },
  375. handleSelectionChange(data) {
  376. this.allSelection = this.allSelection.filter(
  377. (f) => f.rootCategoryLevelId != this.rootCategoryLevelId
  378. );
  379. this.allSelection = [...this.allSelection, ...data];
  380. },
  381. onDone() {
  382. this.$nextTick(() => {
  383. const ids = this.allSelection.map((item) => item.id);
  384. this.$refs.table.setSelectedRowKeys(ids);
  385. });
  386. },
  387. /* 清空选择 */
  388. clearChoose() {
  389. this.allSelection = [];
  390. this.$refs.table.clearSelection();
  391. },
  392. rowStyle({ row }) {
  393. return this.selection.includes(row) ? { background: '#e6f7ff' } : null;
  394. },
  395. handleNodeClick(data) {
  396. this.isCategory = true;
  397. this.categoryLevelId = data.id;
  398. this.rootCategoryLevelId = data.rootCategoryLevelId;
  399. this.reload();
  400. },
  401. setRootId(data) {
  402. this.categoryLevelId = data.id;
  403. this.rootCategoryLevelId = data.rootCategoryLevelId;
  404. this.reload();
  405. },
  406. /* 刷新表格 */
  407. reload(where) {
  408. this.$nextTick(() => {
  409. this.isCategory = false;
  410. this.$refs.table.reload({ pageNum: 1, where: where });
  411. });
  412. },
  413. open(id, item) {
  414. this.id = id;
  415. this.visible = true;
  416. },
  417. handleClose() {
  418. this.clearChoose();
  419. this.visible = false;
  420. },
  421. selected() {
  422. if (this.allSelection.length == 0) {
  423. this.$message.warning('请选择物料');
  424. return false;
  425. }
  426. this.$emit('allSelection', this.id, this.allSelection);
  427. this.handleClose();
  428. }
  429. },
  430. created() {
  431. if (this.isType == 'pick') {
  432. this.treeIds = '1, 5, 7, 8, 10, 13, 14, 23, 26, 9, 28';
  433. }
  434. }
  435. };
  436. </script>
  437. <style lang="scss" scoped>
  438. .tree_col {
  439. border: 1px solid #eee;
  440. padding: 10px 0;
  441. box-sizing: border-box;
  442. height: 500px;
  443. overflow: auto;
  444. }
  445. .table_col {
  446. padding-left: 10px;
  447. ::v-deep .el-table th.el-table__cell {
  448. background: #f2f2f2;
  449. }
  450. }
  451. .pagination {
  452. text-align: right;
  453. padding: 10px 0;
  454. }
  455. .btns {
  456. text-align: center;
  457. padding: 10px 0;
  458. }
  459. .topsearch {
  460. margin-bottom: 15px;
  461. }
  462. ::v-deep .is-checked {
  463. background: #e6f7ff;
  464. }
  465. </style>