diff --git a/src/views/basic/product/drug/drugAdd.vue b/src/views/basic/product/drug/drugAdd.vue index 60813c0..147f944 100644 --- a/src/views/basic/product/drug/drugAdd.vue +++ b/src/views/basic/product/drug/drugAdd.vue @@ -524,18 +524,19 @@ :close-on-press-escape="false" width="85%" v-if="selectDrugLevelVisible" + @close="closeSelectDrugLevelVisible" > - + - + - + @@ -555,7 +556,7 @@ - + @@ -567,9 +568,9 @@ - + @@ -648,8 +649,8 @@ export default { ybDrugDetail: {}, productData: {}, filterQueryDrugLevel: { - nameCode: "", - cpmctymc: "", + nameCode: '', + cpmctymc: '', page: 1, limit: 20, total: 0, @@ -956,7 +957,7 @@ export default { sjcpbm: row.sjcpbm, bhxjcpbm: row.bhxjcpbm, bhxjsl: row.bhxjsl, - relId: this.newProductData.id, + relId: this.newProductData.rlId, uuid: this.newProductData.uuid, productId: row.productId, diType: row.diType, @@ -1011,19 +1012,31 @@ export default { selectDrugLevelItem(row){ getDrugLevelListBycode({nameCode:row.nameCode}).then((response) => { if (response.code == 20000) { - if (response.data.length > 0){ - response.data.forEach( item => { - //新增层级 + if (response.data.length > 0) { + response.data.forEach(item => { let parts = item.bzgg.split('/'); - // 首先,根据 ':' 分割字符串 - const ratioParts = item.packRatio.split(':'); - let selectedValue; - if (item.packLevel >= 0 && item.packLevel < ratioParts.length) { - selectedValue = ratioParts[item.packLevel]; - } else { - selectedValue = null; // 或者你可以设置一个默认值 + const levels = item.packRatio.split(":").map(Number); + const calculatedLevels = [levels[0]]; + for (let i = levels.length - 1; i > 0; i--) { + const ratio = levels[i] / levels[i - 1]; + calculatedLevels.unshift(ratio); + } + calculatedLevels.reverse(); + let selectedValue = calculatedLevels[item.packLevel - 1]; + console.log(item) + if (item.packLevel == 1) { + selectedValue = this.extractNumber(this.newProductData.bzgg) + item.xjdw = this.extractUnitAfterNumber(this.newProductData.bzgg) } + // const ratioParts = item.packRatio.split(':'); + // let selectedValue; + // if (item.packLevel >= 0 && item.packLevel < ratioParts.length) { + // selectedValue = ratioParts[item.packLevel]; + // } else { + // selectedValue = 1; // 或者你可以设置一个默认值 + // } + let editQuery = { nameCode: item.nameCode, packLevel: item.packLevel, @@ -1032,7 +1045,7 @@ export default { relId: this.newProductData.id, uuid: this.newProductData.uuid, productId: item.productId, - diType: item.packLevel == 1?1:4, + diType: item.packLevel == 1 ? 1 : 4, xjdw: item.xjdw } updateLevelDrug(editQuery).then(res => { @@ -1043,7 +1056,7 @@ export default { packLevel: item.packLevel, packUnit: parts[1] || '', bhxjsl: selectedValue, - diType: item.packLevel == 1?1:4, + diType: item.packLevel == 1 ? 1 : 4, isDisabled: false, rowDisabled: false, isUpDisabled: true @@ -1053,7 +1066,6 @@ export default { }) } - } }).catch(() => { }) @@ -1062,15 +1074,19 @@ export default { this.selectedIndex = this.detailList.length - 1 this.isSave = false this.selectDrugLevelVisible = false - }, - handleCurrentChange(){ + this.getDetailList() + } + , + + + handleCurrentChange() { this.selectDrugLevel() }, addDrugLevel() { this.detailList.push({ nameCode: '', - packLevel: 0, - bhxjsl: 0, + packLevel: null, + bhxjsl: null, isDisabled: false, rowDisabled: false, isUpDisabled: true diff --git a/src/views/pharmaceuticals/distribution/PanelCreateOrderCodes.vue b/src/views/pharmaceuticals/distribution/PanelCreateOrderCodes.vue index ee87409..1b44b91 100644 --- a/src/views/pharmaceuticals/distribution/PanelCreateOrderCodes.vue +++ b/src/views/pharmaceuticals/distribution/PanelCreateOrderCodes.vue @@ -118,11 +118,19 @@ 关联 + 查看 + @@ -203,11 +211,32 @@ - + + + + + +