pickingList.vue 13 KB

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