From 6a402cc6f2968bb2c65e2027958558fa68c1eb2a Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Mon, 10 Nov 2025 14:12:06 +0800 Subject: [PATCH] =?UTF-8?q?2025-11-10=20=E4=BB=93=E5=BA=93=E7=9B=98?= =?UTF-8?q?=E7=82=B9=E7=AE=A1=E7=90=86=E7=9A=84=E7=9B=98=E7=82=B9=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E3=80=81=E7=9B=98=E7=82=B9=E5=BA=93=E4=BD=8D=E3=80=81?= =?UTF-8?q?=E7=9B=98=E7=82=B9=E7=89=A9=E6=96=99=E6=94=B9=E4=B8=BA=E5=A4=9A?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/warehouse/MultiSelectDialog.vue | 275 ++++++++++++++++++ .../modules/warehouse/countingReport.vue | 254 ++++++++-------- 2 files changed, 406 insertions(+), 123 deletions(-) create mode 100644 src/views/modules/warehouse/MultiSelectDialog.vue diff --git a/src/views/modules/warehouse/MultiSelectDialog.vue b/src/views/modules/warehouse/MultiSelectDialog.vue new file mode 100644 index 0000000..544fbdd --- /dev/null +++ b/src/views/modules/warehouse/MultiSelectDialog.vue @@ -0,0 +1,275 @@ + + + + + + diff --git a/src/views/modules/warehouse/countingReport.vue b/src/views/modules/warehouse/countingReport.vue index 032f248..c512196 100644 --- a/src/views/modules/warehouse/countingReport.vue +++ b/src/views/modules/warehouse/countingReport.vue @@ -125,24 +125,36 @@ - - 盘点仓库 - - + + 盘点仓库(多选) + + - - 盘点货位 - - + + 盘点货位(多选) + + - - 盘点物料 - - + + 盘点物料(多选) + + @@ -156,7 +168,8 @@ - + + @@ -226,12 +239,11 @@ import { countingReportDetailList } from '@/api/warehouse/countingReport.js' import {getSiteAndBuByUserName} from "@/api/qc/qc.js" -import Chooselist from '@/views/modules/common/Chooselist_eam' -import {verifyData} from "@/api/chooselist/chooselist.js" +import MultiSelectDialog from './MultiSelectDialog.vue' export default { components: { - Chooselist, + MultiSelectDialog }, data() { return { @@ -268,6 +280,12 @@ export default { locationName: '', partNo: '', partDesc: '', + warehouseIds: [], // 多选仓库数组 + locationIds: [], // 多选货位数组 + partNos: [], // 多选物料数组 + warehouseDisplay: '', // 仓库显示文本 + locationDisplay: '', // 货位显示文本 + partDisplay: '', // 物料显示文本 remark: '' }, saveLoading: false, @@ -287,17 +305,17 @@ export default { message: ' ', trigger: ['blur','change'] }], - warehouseId: [{ + warehouseIds: [{ required: false, message: ' ', trigger: ['blur','change'] }], - locationId: [{ + locationIds: [{ required: false, message: ' ', trigger: ['blur','change'] }], - partNo: [{ + partNos: [{ required: false, message: ' ', trigger: ['blur','change'] @@ -400,13 +418,19 @@ export default { locationName: '', partNo: '', partDesc: '', + warehouseIds: [], + locationIds: [], + partNos: [], + warehouseDisplay: '', + locationDisplay: '', + partDisplay: '', remark: '' } // 初始化校验规则(默认都不必填) - this.rules.warehouseId[0].required = false - this.rules.locationId[0].required = false - this.rules.partNo[0].required = false + this.rules.warehouseIds[0].required = false + this.rules.locationIds[0].required = false + this.rules.partNos[0].required = false this.$nextTick(() => { if (this.$refs.modalForm) { @@ -420,6 +444,17 @@ export default { this.modalFlag = true this.modalTitle = '修改盘点任务' this.modalDisableFlag = true + + // 将逗号分隔的字符串转换为数组 + const warehouseIds = row.warehouseId ? row.warehouseId.split(',') : [] + const locationIds = row.locationId ? row.locationId.split(',') : [] + const partNos = row.partNo ? row.partNo.split(',') : [] + + // 构建显示文本(显示名称) + const warehouseDisplay = row.warehouseName || '' + const locationDisplay = row.locationName || '' + const partDisplay = row.partDesc || '' + this.modalData = { flag: 'update', bu: row.site + '_' + row.buNo, @@ -434,22 +469,28 @@ export default { locationName: row.locationName, partNo: row.partNo, partDesc: row.partDesc, + warehouseIds: warehouseIds, + locationIds: locationIds, + partNos: partNos, + warehouseDisplay: warehouseDisplay, + locationDisplay: locationDisplay, + partDisplay: partDisplay, remark: row.remark } // 根据已有的盘点维度设置校验规则 if (row.checkDimension === '按仓库') { - this.rules.warehouseId[0].required = true - this.rules.locationId[0].required = false - this.rules.partNo[0].required = false + this.rules.warehouseIds[0].required = true + this.rules.locationIds[0].required = false + this.rules.partNos[0].required = false } else if (row.checkDimension === '按货位') { - this.rules.warehouseId[0].required = false - this.rules.locationId[0].required = true - this.rules.partNo[0].required = false + this.rules.warehouseIds[0].required = false + this.rules.locationIds[0].required = true + this.rules.partNos[0].required = false } else if (row.checkDimension === '按物料') { - this.rules.warehouseId[0].required = false - this.rules.locationId[0].required = false - this.rules.partNo[0].required = true + this.rules.warehouseIds[0].required = false + this.rules.locationIds[0].required = false + this.rules.partNos[0].required = true } this.$nextTick(() => { @@ -468,6 +509,12 @@ export default { this.modalData.locationName = '' this.modalData.partNo = '' this.modalData.partDesc = '' + this.modalData.warehouseIds = [] + this.modalData.locationIds = [] + this.modalData.partNos = [] + this.modalData.warehouseDisplay = '' + this.modalData.locationDisplay = '' + this.modalData.partDisplay = '' // 清除表单校验 this.$nextTick(() => { @@ -479,19 +526,19 @@ export default { // 根据维度设置必填项 if (this.modalData.checkDimension === '按仓库') { // 按仓库:仓库必填,货位和物料非必填 - this.rules.warehouseId[0].required = true - this.rules.locationId[0].required = false - this.rules.partNo[0].required = false + this.rules.warehouseIds[0].required = true + this.rules.locationIds[0].required = false + this.rules.partNos[0].required = false } else if (this.modalData.checkDimension === '按货位') { // 按货位:货位必填,仓库和物料非必填 - this.rules.warehouseId[0].required = false - this.rules.locationId[0].required = true - this.rules.partNo[0].required = false + this.rules.warehouseIds[0].required = false + this.rules.locationIds[0].required = true + this.rules.partNos[0].required = false } else if (this.modalData.checkDimension === '按物料') { // 按物料:物料必填,仓库和货位非必填 - this.rules.warehouseId[0].required = false - this.rules.locationId[0].required = false - this.rules.partNo[0].required = true + this.rules.warehouseIds[0].required = false + this.rules.locationIds[0].required = false + this.rules.partNos[0].required = true } }, @@ -500,8 +547,17 @@ export default { this.$refs.modalForm.validate((valid) => { if (valid) { this.saveLoading = true + + // 将数组转换为逗号分隔的字符串 + const saveData = { + ...this.modalData, + warehouseId: this.modalData.warehouseIds.length > 0 ? this.modalData.warehouseIds.join(',') : '', + locationId: this.modalData.locationIds.length > 0 ? this.modalData.locationIds.join(',') : '', + partNo: this.modalData.partNos.length > 0 ? this.modalData.partNos.join(',') : '' + } + const apiMethod = this.modalData.flag === 'add' ? countingReportSave : countingReportUpdate - apiMethod(this.modalData).then(({data}) => { + apiMethod(saveData).then(({data}) => { if (data && data.code === 0) { this.$message.success(data.msg) this.modalFlag = false @@ -639,92 +695,44 @@ export default { .reduce((sum, item) => sum + (item.rollQty || 0), 0) }, - // 输入校验 - warehouseBlur (tagNo) { - let tempData = { - tagno: tagNo, - conditionSql: " and WareHouseID = '" + this.modalData.warehouseId + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.warehouseId = data.baseListData[0].WareHouseID - this.modalData.warehouseName = data.baseListData[0].WareHouseName - } else { - this.modalData.warehouseName = '' - } - } - }) - }, - - locationBlur (tagNo) { - let tempData = { - tagno: tagNo, - conditionSql: " and LocationID = '" + this.modalData.locationId + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'" + // 打开多选对话框 + openMultiSelect(type) { + if (!this.modalData.bu) { + this.$message.warning('请先选择BU') + return } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.locationId = data.baseListData[0].LocationID - this.modalData.locationName = data.baseListData[0].LocationName - } else { - this.modalData.locationName = '' - } - } - }) - }, - - partBlur (tagNo) { - let tempData = { - tagno: tagNo, - conditionSql: " and PartNo = '" + this.modalData.partNo + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'" + + const [site, buNo] = this.modalData.bu.split('_') + let selectedIds = [] + + if (type === 'warehouse') { + selectedIds = this.modalData.warehouseIds + } else if (type === 'location') { + selectedIds = this.modalData.locationIds + } else if (type === 'part') { + selectedIds = this.modalData.partNos } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.partNo = data.baseListData[0].PartNo - this.modalData.partDesc = data.baseListData[0].PartDescription - } else { - this.modalData.partDesc = '' - } - } - }) + + this.$refs.multiSelectDialog.init(type, site, buNo, selectedIds) }, - // 获取基础数据列表S - getBaseList (val, type) { - this.tagNo = val - this.tagType = type - this.$nextTick(() => { - let strVal = '' - if (val === 20) { - strVal = this.modalData.warehouseId - this.$refs.baseList.init(val, strVal) - } - if (val === 22) { - strVal = this.modalData.locationId - this.$refs.baseList.init(val, strVal) - } - if (val === 509) { - strVal = this.modalData.partNo - this.$refs.baseList.init(val, strVal) - } - }) - }, - - // 列表方法的回调 - getBaseData (val) { - if (this.tagNo === 20) { - this.modalData.warehouseId = val.WareHouseID - this.modalData.warehouseName = val.WareHouseName - } - if (this.tagNo === 22) { - this.modalData.locationId = val.LocationID - this.modalData.locationName = val.LocationName - } - if (this.tagNo === 509) { - this.modalData.partNo = val.PartNo - this.modalData.partDesc = val.PartDescription + // 多选对话框确认回调 + handleMultiSelectConfirm(result) { + if (result.type === 'warehouse') { + this.modalData.warehouseIds = result.codes + this.modalData.warehouseId = result.codes.join(',') // 编码(保存用) + this.modalData.warehouseName = result.names.join(',') // 名称(显示用) + this.modalData.warehouseDisplay = result.names.join(',') // 显示名称 + } else if (result.type === 'location') { + this.modalData.locationIds = result.codes + this.modalData.locationId = result.codes.join(',') + this.modalData.locationName = result.names.join(',') + this.modalData.locationDisplay = result.names.join(',') // 显示名称 + } else if (result.type === 'part') { + this.modalData.partNos = result.codes + this.modalData.partNo = result.codes.join(',') + this.modalData.partDesc = result.names.join(',') + this.modalData.partDisplay = result.names.join(',') // 显示名称 } },