| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139 |
- <template>
- <el-dialog
- :title="title"
- :visible.sync="visible"
- v-if="visible"
- :before-close="handleClose"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- width="75%"
- >
- <el-card shadow="never">
- <pickingListSearch
- @search="reload"
- ref="searchRef"
- @handledime="handledime"
- />
- <!-- <pickingSearch v-else @search="reload" ref="pickingRef" /> -->
- <ele-split-layout
- width="244px"
- allow-collapse
- :right-style="{ overflow: 'hidden' }"
- >
- <div class="ele-border-lighter split-layout-right-content">
- <AssetTree
- ref="assetTreeRef"
- :treeIds="treeIds"
- @handleNodeClick="handleNodeClick"
- @setRootId="setRootId"
- />
- </div>
- <!-- 表格 -->
- <template v-slot:content>
- <ele-pro-table
- :initLoad="false"
- ref="table"
- :columns="columns"
- :datasource="datasource"
- :selection.sync="selection"
- row-key="id"
- height="calc(100vh - 350px)"
- class="dict-table"
- :cache-key="tableKey"
- :row-style="rowStyle"
- :row-click-checked="true"
- :row-click-checked-intelligent="false"
- @update:selection="handleSelectionChange"
- >
- <template v-slot:toolbar>
- <el-alert
- type="info"
- :closable="false"
- class="ele-alert-border"
- style="width: 300px"
- >
- <i class="el-icon-info ele-text-info"></i>
- <span class="ele-text">
- <span>
- 已选择
- <b class="ele-text-info">{{ allSelection.length }}</b>
- 项数据<em></em>
- </span>
- </span>
- <el-link type="primary" :underline="false" @click="clearChoose">
- 清空
- </el-link>
- </el-alert>
- </template>
- <!-- <template v-slot:code="{ row }">
- {{ row.rootCategoryLevelId == 4 ? row.codeNumber : row.code }}
- </template> -->
- <template v-slot:runStatus="{ row }">
- {{ stateList[Number(row.runStatus)] }}
- </template>
- <template v-slot:vehicleLen="{ row }">
- {{ row.extInfo.vehicleLen || '-' }}
- {{ row.extInfo.wilde || '-' }} {{ row.extInfo.hight || '-' }}
- </template>
- <template v-slot:status="{ row }">
- <span
- :style="{ color: row.status == 0 ? '#157A2C' : '#FFA929' }"
- >{{
- row.status == 0 ? '空闲' : row.status == 1 ? '占用' : ''
- }}</span
- >
- </template>
- <template v-slot:packingCountBase="{ row }">
- {{ row.packingCountBase }} {{ row.minUnit }}
- </template>
- <template v-slot:measureQuantity="{ row }">
- {{ row.measureQuantity }} {{ row.measureUnit }}
- </template>
- <template v-slot:weight="{ row }">
- {{ row.weight }} {{ row.weightUnit }}
- </template>
- <!-- 库存保质期 -->
- <template v-slot:expirationDate="{ row }">
- <span v-if="row.expirationDate">
- {{ row.expirationDate ? row.expirationDate : '-' }}
- {{
- row.expirationDateUnit == 'year'
- ? '年'
- : row.expirationDateUnit == 'month'
- ? '月'
- : '日'
- }}
- </span>
- </template>
- <!-- 质检状态 -->
- <template v-slot:qualityStatus="{ row }">
- <span v-if="row.qualityResult == 0 || row.qualityResult == 1"
- >已检</span
- >
- <span v-else-if="row.qualityStatus == 1">已检</span>
- <span v-else-if="row.qualityStatus == 0">未检</span>
- <span v-else>-</span>
- </template>
- <!-- 质检结果 -->
- <template v-slot:qualityResult="{ row }">
- <span v-if="row.qualityResult == 0 || row.qualityResult == ''"
- >合格</span
- >
- <span v-else-if="row.qualityResult == 1">不合格</span>
- <span v-else-if="row.qualityResult == 3">让步接收</span>
- <span v-else>-</span>
- </template>
- </ele-pro-table>
- </template>
- </ele-split-layout>
- </el-card>
- <div class="btns">
- <el-button type="primary" size="small" @click="selected">选择</el-button>
- <el-button size="small" @click="handleClose">关闭</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import AssetTree from '../../components/assetTree.vue';
- import pickingListSearch from './newPickingListSearch.vue';
- import pickingSearch from './pickingSearch.vue';
- import {
- pageeLedgerMain,
- assetPage,
- listInProduct
- } from '@/api/produce/workOrder';
- import storageApi from '@/api/warehouseManagement';
- // import { deepCopy } from '@/utils/util.js';
- import { getOutindetailtwo } from '@/api/produce/picking';
- export default {
- components: { AssetTree, pickingListSearch, pickingSearch },
- props: {
- isType: {
- type: String,
- default: '',
- required: true
- }
- },
- data() {
- return {
- visible: false,
- id: null,
- treeIds: null,
- categoryLevelId: null,
- rootCategoryLevelId: null,
- isCategory: true,
- stateList: [
- '启动',
- '空闲',
- '运行',
- '故障',
- '检修',
- '停机',
- '待料',
- '占用'
- ],
- selection: [],
- allSelection: [],
- temporaryList: [],
- // cloumsAll: [
- // {
- // width: 45,
- // type: 'selection',
- // columnKey: 'selection',
- // align: 'center',
- // reserveSelection: true
- // },
- // {
- // columnKey: 'index',
- // label: '序号',
- // type: 'index',
- // width: 50,
- // align: 'center'
- // },
- // {
- // prop: 'code',
- // label: '物品编码',
- // slot: 'code'
- // },
- // {
- // prop: 'codeNumber',
- // label: '编号',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'name',
- // label: '名称',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'brandNum',
- // label: '牌号',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'specification',
- // label: '规格',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'modelType',
- // label: '型号',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'batchNo',
- // label: '批次号',
- // align: 'center'
- // },
- // // {
- // // prop: 'manualBatchNo',
- // // label: '批次号',
- // // align: 'center'
- // // },
- // {
- // prop: 'availableCountBase',
- // label: '计量库存数量',
- // sortable: 'custom',
- // slot: 'availableCountBase',
- // showOverflowTooltip: true,
- // width: 130,
- // align: 'center'
- // },
- // ...([1, 23, 8].includes(Number(this.rootCategoryLevelId))
- // ? [
- // {
- // prop: 'packingCountBase',
- // label: '包装库存',
- // slot: 'packingCountBase',
- // showOverflowTooltip: true
- // }
- // ]
- // : []),
- // {
- // prop: 'weight',
- // label: '重量',
- // showOverflowTooltip: true,
- // slot: 'weight'
- // },
- // {
- // prop: 'expirationDate',
- // slot: 'expirationDate',
- // label: '库存保质期',
- // width: 100
- // },
- // {
- // prop: 'expirationTime',
- // label: '周期倒计时',
- // showOverflowTooltip: true,
- // width: 100
- // },
- // {
- // prop: 'qualityResult',
- // slot: 'qualityResult',
- // label: '质检结果',
- // showOverflowTooltip: true,
- // width: 100
- // },
- // {
- // prop: 'qualityStatus',
- // slot: 'qualityStatus',
- // label: '质检状态',
- // showOverflowTooltip: true,
- // width: 100
- // },
- // {
- // prop: 'pathName',
- // width: 230,
- // label: '仓库',
- // showOverflowTooltip: true
- // },
- // ...(this.rootCategoryLevelId == '4'
- // ? [
- // {
- // prop: 'workstationName',
- // label: '工位',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'runStatus',
- // label: '状态',
- // slot: 'runStatus',
- // showOverflowTooltip: true
- // }
- // ]
- // : []),
- // // ...(this.rootCategoryLevelId == '5'
- // // ? [
- // // {
- // // prop: 'dieHoleNum',
- // // label: '模孔数量',
- // // showOverflowTooltip: true
- // // },
- // // {
- // // prop: 'mandrelDiameter',
- // // label: '芯棒直径',
- // // showOverflowTooltip: true
- // // },
- // // {
- // // prop: 'shrinkEffictive',
- // // label: '收缩系数',
- // // showOverflowTooltip: true
- // // }
- // // ]
- // // : []),
- // // ...(this.rootCategoryLevelId == '7'
- // // ? [
- // // {
- // // prop: 'materialQuality',
- // // label: '材质',
- // // showOverflowTooltip: true
- // // },
- // // {
- // // prop: 'vehicleLen',
- // // label: '长宽高',
- // // slot: 'vehicleLen',
- // // showOverflowTooltip: true
- // // }
- // // ]
- // // : []),
- // ...(this.rootCategoryLevelId == '8'
- // ? [
- // {
- // prop: 'extInfo.slotNum',
- // label: '槽数',
- // showOverflowTooltip: true
- // }
- // ]
- // : []),
- // ...(this.rootCategoryLevelId == '11'
- // ? [
- // {
- // prop: 'status',
- // label: '状态',
- // slot: 'status',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'region',
- // label: '位置',
- // showOverflowTooltip: true
- // }
- // ]
- // : [])
- // ]
- cloumsAll: [
- {
- width: 45,
- type: 'selection',
- columnKey: 'selection',
- align: 'center',
- reserveSelection: true
- },
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 50,
- align: 'center'
- },
- {
- prop: 'categoryCode',
- label: '物品编码'
- },
- {
- prop: 'codeNumber',
- label: '编号',
- showOverflowTooltip: true
- },
- {
- prop: 'categoryName',
- label: '名称',
- showOverflowTooltip: true
- },
- {
- prop: 'brandNum',
- label: '牌号',
- showOverflowTooltip: true
- },
- {
- prop: 'specification',
- label: '规格',
- showOverflowTooltip: true
- },
- // {
- // prop: 'modelType',
- // label: '型号',
- // showOverflowTooltip: true
- // },
- {
- prop: 'categoryModel',
- label: '型号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'batchNo',
- label: '批次号',
- align: 'center'
- },
- // {
- // prop: 'manualBatchNo',
- // label: '批次号',
- // align: 'center'
- // },
- {
- prop: 'measureQuantity',
- label: '计量库存数量',
- sortable: 'custom',
- slot: 'measureQuantity',
- showOverflowTooltip: true,
- width: 130,
- align: 'center'
- },
- ...([1, 23, 8].includes(Number(this.rootCategoryLevelId))
- ? [
- {
- prop: 'packingCountBase',
- label: '包装库存',
- slot: 'packingCountBase',
- showOverflowTooltip: true
- }
- ]
- : []),
- {
- prop: 'weight',
- label: '重量',
- showOverflowTooltip: true,
- slot: 'weight'
- },
- {
- prop: 'expirationDate',
- slot: 'expirationDate',
- label: '库存保质期',
- width: 100
- },
- {
- prop: 'expirationTime',
- label: '周期倒计时',
- showOverflowTooltip: true,
- width: 100
- },
- {
- prop: 'qualityResult',
- slot: 'qualityResult',
- label: '质检结果',
- showOverflowTooltip: true,
- width: 100
- },
- {
- prop: 'qualityStatus',
- slot: 'qualityStatus',
- label: '质检状态',
- showOverflowTooltip: true,
- width: 100
- },
- {
- prop: 'warehouseName',
- width: 230,
- label: '仓库',
- showOverflowTooltip: true
- },
- ...(this.rootCategoryLevelId == '4'
- ? [
- {
- prop: 'workstationName',
- label: '工位',
- showOverflowTooltip: true
- },
- {
- prop: 'runStatus',
- label: '状态',
- slot: 'runStatus',
- showOverflowTooltip: true
- }
- ]
- : []),
- // ...(this.rootCategoryLevelId == '5'
- // ? [
- // {
- // prop: 'dieHoleNum',
- // label: '模孔数量',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'mandrelDiameter',
- // label: '芯棒直径',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'shrinkEffictive',
- // label: '收缩系数',
- // showOverflowTooltip: true
- // }
- // ]
- // : []),
- // ...(this.rootCategoryLevelId == '7'
- // ? [
- // {
- // prop: 'materialQuality',
- // label: '材质',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'vehicleLen',
- // label: '长宽高',
- // slot: 'vehicleLen',
- // showOverflowTooltip: true
- // }
- // ]
- // : []),
- ...(this.rootCategoryLevelId == '8'
- ? [
- {
- prop: 'extInfo.slotNum',
- label: '槽数',
- showOverflowTooltip: true
- }
- ]
- : []),
- ...(this.rootCategoryLevelId == '11'
- ? [
- {
- prop: 'status',
- label: '状态',
- slot: 'status',
- showOverflowTooltip: true
- },
- {
- prop: 'region',
- label: '位置',
- showOverflowTooltip: true
- }
- ]
- : [])
- ]
- };
- },
- computed: {
- tableKey() {
- return `table-${this.rootCategoryLevelId}`;
- },
- // 表格列配置
- columns() {
- return this.cloumsAll;
- // return [
- // {
- // width: 45,
- // type: 'selection',
- // columnKey: 'selection',
- // align: 'center',
- // reserveSelection: true
- // },
- // {
- // columnKey: 'index',
- // label: '序号',
- // type: 'index',
- // width: 50,
- // align: 'center'
- // },
- // {
- // prop: 'code',
- // label: '物品编码',
- // slot: 'code'
- // },
- // {
- // prop: 'codeNumber',
- // label: '编号',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'name',
- // label: '名称',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'brandNum',
- // label: '牌号',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'specification',
- // label: '规格',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'modelType',
- // label: '型号',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'batchNo',
- // label: '批次号',
- // align: 'center'
- // },
- // // {
- // // prop: 'manualBatchNo',
- // // label: '批次号',
- // // align: 'center'
- // // },
- // {
- // prop: 'availableCountBase',
- // label: '计量库存数量',
- // sortable: 'custom',
- // slot: 'availableCountBase',
- // showOverflowTooltip: true,
- // width: 130,
- // align: 'center'
- // },
- // ...([1, 23, 8].includes(Number(this.rootCategoryLevelId))
- // ? [
- // {
- // prop: 'packingCountBase',
- // label: '包装库存',
- // slot: 'packingCountBase',
- // showOverflowTooltip: true
- // }
- // ]
- // : []),
- // {
- // prop: 'weight',
- // label: '重量',
- // showOverflowTooltip: true,
- // slot: 'weight'
- // },
- // {
- // prop: 'expirationDate',
- // slot: 'expirationDate',
- // label: '库存保质期',
- // width: 100
- // },
- // {
- // prop: 'expirationTime',
- // label: '周期倒计时',
- // showOverflowTooltip: true,
- // width: 100
- // },
- // {
- // prop: 'qualityResult',
- // slot: 'qualityResult',
- // label: '质检结果',
- // showOverflowTooltip: true,
- // width: 100
- // },
- // {
- // prop: 'qualityStatus',
- // slot: 'qualityStatus',
- // label: '质检状态',
- // showOverflowTooltip: true,
- // width: 100
- // },
- // {
- // prop: 'pathName',
- // width: 230,
- // label: '仓库',
- // showOverflowTooltip: true
- // },
- // ...(this.rootCategoryLevelId == '4'
- // ? [
- // {
- // prop: 'workstationName',
- // label: '工位',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'runStatus',
- // label: '状态',
- // slot: 'runStatus',
- // showOverflowTooltip: true
- // }
- // ]
- // : []),
- // // ...(this.rootCategoryLevelId == '5'
- // // ? [
- // // {
- // // prop: 'dieHoleNum',
- // // label: '模孔数量',
- // // showOverflowTooltip: true
- // // },
- // // {
- // // prop: 'mandrelDiameter',
- // // label: '芯棒直径',
- // // showOverflowTooltip: true
- // // },
- // // {
- // // prop: 'shrinkEffictive',
- // // label: '收缩系数',
- // // showOverflowTooltip: true
- // // }
- // // ]
- // // : []),
- // // ...(this.rootCategoryLevelId == '7'
- // // ? [
- // // {
- // // prop: 'materialQuality',
- // // label: '材质',
- // // showOverflowTooltip: true
- // // },
- // // {
- // // prop: 'vehicleLen',
- // // label: '长宽高',
- // // slot: 'vehicleLen',
- // // showOverflowTooltip: true
- // // }
- // // ]
- // // : []),
- // ...(this.rootCategoryLevelId == '8'
- // ? [
- // {
- // prop: 'extInfo.slotNum',
- // label: '槽数',
- // showOverflowTooltip: true
- // }
- // ]
- // : []),
- // ...(this.rootCategoryLevelId == '11'
- // ? [
- // {
- // prop: 'status',
- // label: '状态',
- // slot: 'status',
- // showOverflowTooltip: true
- // },
- // {
- // prop: 'region',
- // label: '位置',
- // showOverflowTooltip: true
- // }
- // ]
- // : [])
- // ];
- }
- },
- watch: {},
- methods: {
- /* 表格数据源 */
- async datasource({ page, where, limit }) {
- const dimension = this.$refs.searchRef.dimension;
- let URL;
- let param = {
- ...where,
- pageNum: page,
- size: limit,
- categoryLevelId: this.categoryLevelId
- };
- if (this.isType == 'pick') {
- if (dimension == 1) {
- URL = storageApi.getProductList;
- } else if (dimension == 2) {
- URL = storageApi.getBatchList;
- }
- // else if (dimension == 3) {
- // URL = storageApi.getPackingList;
- // }
- param.dimension = dimension;
- // param.dimension = 1;
- // param.dimension = dimension;
- // URL = pageeLedgerMain;
- // URL = getOutindetailtwo;
- } else if (this.isType == 'feed') {
- if ([4, 7, 14].includes(Number(this.rootCategoryLevelId))) {
- URL = assetPage;
- } else if (this.rootCategoryLevelId == 2) {
- param.workOrderId = this.id;
- delete param.taskId;
- delete param.categoryLevelId;
- URL = listInProduct;
- } else if (
- ![2, 4, 7, 14].includes(Number(this.rootCategoryLevelId))
- ) {
- URL = assetPage;
- }
- } else if (this.isType == 'job') {
- URL = assetPage;
- }
- const res = await URL(param);
- if (this.rootCategoryLevelId == '11') {
- let _res = res;
- console.log(res, 'res');
- let _list = [];
- _res.list.forEach((e) => {
- if (e.aridRegionList && e.aridRegionList.length != 0) {
- e.aridRegionList.map((i) => {
- let obj = {
- name: e.name,
- region: e.extInfo.region,
- rootCategoryLevelId: e.rootCategoryLevelId,
- ...i,
- instanceId: i.id
- };
- _list.push(obj);
- });
- }
- });
- res.list = _list;
- return res;
- } else {
- let _res = res;
- let _list = [];
- _list.push(
- ..._res.list.map((i) => {
- const warehouseId = i.pathIds && i.pathIds.split(',')[0];
- return {
- warehouseId,
- ...i,
- instanceId: i.id
- };
- })
- );
- res.list = _list;
- // if (this.isType == 'pick') {
- // this.columns = this.cloumsPick;
- // } else {
- // this.columns = this.cloumsAll
- // }
- return res;
- }
- },
- handleSelectionChange(data) {
- const selectionList = [];
- this.allSelection.forEach((item) => {
- if (item.warehouseIdList && item.warehouseIdList.length != 0) {
- selectionList.push({
- id: item.id,
- ids: item.warehouseIdList
- });
- }
- });
- this.allSelection = data;
- if (selectionList.length != 0) {
- selectionList.forEach((item) => {
- this.allSelection.forEach((it) => {
- if (item.id == it.id) {
- it.warehouseIdList = item.ids;
- }
- });
- });
- }
- this.allSelection.forEach((it) => {
- if (!it.warehouseIdList || it.warehouseIdList.length == 0) {
- if (it.warehouseId) {
- it.warehouseIdList = [];
- it.warehouseIdList.push(it.warehouseId);
- }
- }
- });
- // this.allSelection.forEach((item) => {
- // })
- console.log(this.allSelection, 'this.allSelection22');
- },
- /* 清空选择 */
- clearChoose() {
- this.allSelection = [];
- this.$refs.table.clearSelection();
- },
- rowStyle({ row }) {
- return this.selection.includes(row) ? { background: '#e6f7ff' } : null;
- },
- handleNodeClick(data) {
- console.log(data, 'handleNodeClick');
- this.isCategory = true;
- this.categoryLevelId = data.id;
- this.rootCategoryLevelId = data.rootCategoryLevelId;
- this.reload();
- },
- setRootId(data) {
- this.categoryLevelId = data.id;
- this.rootCategoryLevelId = data.rootCategoryLevelId;
- this.reload();
- },
- handledime() {
- this.reload(this.$refs.searchRef.where);
- },
- /* 刷新表格 */
- reload(where) {
- this.$nextTick(() => {
- this.isCategory = false;
- this.$refs.table.reload({ pageNum: 1, where: where });
- });
- },
- onDone() {
- this.$nextTick(() => {
- this.allSelection.forEach((item) => {
- this.$refs.table.toggleRowSelection(item, true);
- });
- });
- },
- open(id, item, t) {
- this.id = id;
- if (t) {
- this.title = t;
- } else {
- this.title = '领料列表';
- }
- if (this.isType == 'pick') {
- this.temporaryList = item.pickList || [];
- this.allSelection = item.pickList || [];
- this.visible = true;
- this.$nextTick(() => {
- this.allSelection.forEach((item) => {
- this.$refs.table.toggleRowSelection(item, true);
- });
- console.log(this.allSelection, 'this.allSelection');
- });
- } else if (this.isType == 'feed') {
- let feedList = [];
- feedList = [
- ...item.modelList,
- ...item.equipmentList,
- ...item.instanceList,
- ...item.aridRegionList,
- ...item.turnover,
- ...item.palletList,
- ...item.revolvingDiskList,
- ...item.semiProductList
- ];
- this.temporaryList = feedList || [];
- this.allSelection = feedList || [];
- this.visible = true;
- this.$nextTick(() => {
- feedList.forEach((item) => {
- this.$refs.table.toggleRowSelection(item, true);
- });
- });
- } else if (this.isType == 'job') {
- let feedList = [];
- feedList = [...item.turnover, ...item.equipmentList];
- this.temporaryList = feedList || [];
- this.allSelection = feedList || [];
- this.visible = true;
- this.$nextTick(() => {
- feedList.forEach((item) => {
- this.$refs.table.toggleRowSelection(item, true);
- });
- });
- }
- },
- handleClose() {
- this.clearChoose();
- this.temporaryList = [];
- this.allSelection = [];
- this.visible = false;
- },
- selected() {
- if (this.allSelection.length == 0) {
- this.$message.warning('请选择物料');
- return false;
- }
- if (this.temporaryList.length > 0) {
- // 使用Promise来“模拟”异步操作
- new Promise((resolve) => {
- if (this.temporaryList.length > 0) {
- this.temporaryList.forEach((item) => {
- this.allSelection.forEach((item2) => {
- if (item.id == item2.id && this.isType == 'pick') {
- this.$set(
- item2,
- 'demandQuantity',
- item.demandQuantity || null
- );
- } else if (item.id == item2.id && this.isType == 'feed') {
- this.$set(item2, 'feedQuantity', item.feedQuantity || null);
- }
- });
- });
- }
- this.allSelection.sort(
- (a, b) => a.rootCategoryLevelId - b.rootCategoryLevelId
- );
- resolve();
- }).then(() => {
- this.$emit('allSelection', this.id, this.allSelection);
- this.handleClose();
- });
- } else {
- console.log('456');
- this.allSelection.sort(
- (a, b) => a.rootCategoryLevelId - b.rootCategoryLevelId
- );
- this.$emit('allSelection', this.id, this.allSelection);
- this.handleClose();
- }
- }
- },
- created() {
- if (this.isType == 'pick') {
- // this.treeIds = '1, 5, 7, 8, 10, 13, 14, 23, 26, 9, 28';
- this.treeIds =
- '9, 23, 2, 1, 4, 14, 5, 8, 16, 13, 15, 6, 10, 22, 1777158952502956034';
- // this.treeIds = '9, 1, 14, 5, 8, 13, 15, 6, 10, 22';
- } else if (this.isType == 'feed') {
- this.treeIds = '1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 26, 9, 23,28';
- } else if (this.isType == 'job') {
- this.treeIds = '4, 7';
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .tree_col {
- border: 1px solid #eee;
- padding: 10px 0;
- box-sizing: border-box;
- height: 500px;
- overflow: auto;
- }
- .table_col {
- padding-left: 10px;
- ::v-deep .el-table th.el-table__cell {
- background: #f2f2f2;
- }
- }
- .pagination {
- text-align: right;
- padding: 10px 0;
- }
- .btns {
- text-align: center;
- padding: 10px 0;
- }
- .topsearch {
- margin-bottom: 15px;
- }
- ::v-deep .is-checked {
- background: #e6f7ff;
- }
- </style>
|