From d3778a11d90b0ecbb15ea73430a110c24695dd0a Mon Sep 17 00:00:00 2001 From: yewj Date: Wed, 13 Nov 2024 09:38:06 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/basic/product/drug/drugAdd.vue | 220 +++++++++++------- .../companyDrug/basicCompanyproductEdit.vue | 99 +++++--- 2 files changed, 198 insertions(+), 121 deletions(-) diff --git a/src/views/basic/product/drug/drugAdd.vue b/src/views/basic/product/drug/drugAdd.vue index 589967b..9ce9903 100644 --- a/src/views/basic/product/drug/drugAdd.vue +++ b/src/views/basic/product/drug/drugAdd.vue @@ -502,16 +502,16 @@ v-if="selectDrugLevelVisible" > - + - + - + @@ -531,7 +531,7 @@ - + @@ -542,9 +542,9 @@ - + @@ -570,7 +570,7 @@ import { updatetDrug, delDrugLevel, updateLevelDrug, calculateDistCount, calculateUseCount, - getDrugLevelList,getDrugLevelListBycode + getDrugLevelList, getDrugLevelListBycode } from '@/api/basic/product/drugUdiinfos' import {getCodeRelDetail} from '@/api/basic/product/udiRelevance' import {isBlank} from "@/utils/strUtil"; @@ -617,7 +617,7 @@ export default { } }, // components: {selectChargesProjectDialog, chooseHouseDrug}, - components: { chooseHouseDrug}, + components: {chooseHouseDrug}, data() { return { ybDrugDetail: {}, @@ -628,7 +628,7 @@ export default { page: 1, limit: 20, total: 0, - approvalNum:"", + approvalNum: "", }, newProductData: { cpmctymc: null, @@ -925,7 +925,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, @@ -942,14 +942,14 @@ export default { //如果都为空 进行补充 if (!this.$isNotBlank(this.newProductData.sptm) && !this.$isNotBlank(this.newProductData.ybbm)) { - getCodeRelDetail({drugCode:row.nameCode}).then((response) => { - if (response.code == 20000) { - if (response.data != null && response.data.length > 0) { - this.newProductData.sptm = response.data[0].sptm; - this.newProductData.ybbm = response.data[0].ybbm; - this.getYbDrugData() - } + getCodeRelDetail({drugCode: row.nameCode}).then((response) => { + if (response.code == 20000) { + if (response.data != null && response.data.length > 0) { + this.newProductData.sptm = response.data[0].sptm; + this.newProductData.ybbm = response.data[0].ybbm; + this.getYbDrugData() } + } }).catch(() => { }) } @@ -965,7 +965,7 @@ export default { row.isUpDisabled = true row.rowDisabled = false }, - selectDrugLevel(){ + selectDrugLevel() { //获取分页列表 this.filterQueryDrugLevel.approvalNum = this.newProductData.zczbhhzbapzbh getDrugLevelList(this.filterQueryDrugLevel).then((response) => { @@ -977,21 +977,48 @@ export default { }).catch(() => { }) }, - selectDrugLevelItem(row){ - getDrugLevelListBycode({nameCode:row.nameCode}).then((response) => { + extractNumber(bzgg) { + // 使用正则表达式提取数字 + const match = bzgg.match(/^\d+/); + // 如果匹配到,则返回数字,否则返回null + return match ? parseInt(match[0], 10) : null; + }, + + extractUnitAfterNumber(bzgg) { + // 使用正则表达式提取数字后面的单位 + const match = bzgg.match(/^\d+([^\d/]+)/); + // 如果匹配到,则返回单位,否则返回null + return match ? match[1].trim() : null; + }, + + + 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, @@ -1001,7 +1028,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 => { @@ -1012,7 +1039,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 @@ -1022,7 +1049,6 @@ export default { }) } - } }).catch(() => { }) @@ -1031,10 +1057,15 @@ 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: '', @@ -1047,12 +1078,13 @@ export default { this.newProductData.productId = null this.selectedIndex = this.detailList.length - 1 this.isSave = false - }, + } + , rowChange(index, val) { - if(this.editRowSwitch == true ){ + if (this.editRowSwitch == true) { this.$message.error('请先保存当前产品标识编辑') return } @@ -1060,7 +1092,8 @@ export default { this.selectedIndex = index this.isSave = false this.editRowSwitch = true - }, + } + , deleteLevel(index, row) { this.$confirm('此操作将删除该层级,是否继续?', '提示', { @@ -1089,27 +1122,28 @@ export default { } }).catch(() => { }) - }, - - - //设置层级 - // setDefaultLevel(){ - // //判断流通 最大层级 - // if (this.newProductData.distributeMaxLevel == null){ - // let levelUnit = this.levelUnitList[this.levelUnitList.length - 1]; - // this.newProductData.distributeMaxLevel = levelUnit.packLevel - // } - // // 判断使用 采集最大层级 - // if (this.newProductData.useMaxLevel == null){ - // //获取获取第一个 如果packUnit且为null的话就设置第二个 - // let levelUnit = this.levelUnitList[0]; - // if (isBlank(levelUnit.packUnit)){ - // levelUnit = this.levelUnitList[1] - // } - // this.newProductData.useMaxLevel = levelUnit.packLevel - // } - // }, - //获取层级标识 + } + , + + +//设置层级 +// setDefaultLevel(){ +// //判断流通 最大层级 +// if (this.newProductData.distributeMaxLevel == null){ +// let levelUnit = this.levelUnitList[this.levelUnitList.length - 1]; +// this.newProductData.distributeMaxLevel = levelUnit.packLevel +// } +// // 判断使用 采集最大层级 +// if (this.newProductData.useMaxLevel == null){ +// //获取获取第一个 如果packUnit且为null的话就设置第二个 +// let levelUnit = this.levelUnitList[0]; +// if (isBlank(levelUnit.packUnit)){ +// levelUnit = this.levelUnitList[1] +// } +// this.newProductData.useMaxLevel = levelUnit.packLevel +// } +// }, +//获取层级标识 getDetailList() { if (this.newProductData.uuid != null) { let query = { @@ -1129,7 +1163,8 @@ export default { this.detailList = [] }) } - }, + } + , distributeLevelDiChange(val) { const matchingItem = this.detailList.find(item => item.nameCode == val) @@ -1144,7 +1179,8 @@ export default { } }) - }, + } + , useLevelDiChange(val) { const matchingItem = this.detailList.find(item => item.nameCode == val) if (matchingItem) { @@ -1157,7 +1193,8 @@ export default { useLeverCount: res.data.useLeverCount } }) - }, + } + , getDiLevel() { let query = { id: this.relId @@ -1173,7 +1210,8 @@ export default { this.loading = false this.levelUnitList = [] }) - }, + } + , findMaxLevelObject() { this.maxLevel = 1; @@ -1182,19 +1220,22 @@ export default { this.maxLevel = Number(obj.packLevel); } } - }, + } + , /** * 选择收费项目 */ selectPayFeecode() { this.tollProjectDialogVisible = true - }, + } + , getData(data) { this.tollProjectDialogVisible = false this.newProductData.payFeeCode = data.medCatalogCode - }, + } + , /** * 第三方系统药品信息 */ @@ -1212,7 +1253,8 @@ export default { this.loading = false this.sysList = [] }) - }, + } + , resetThirdId() { this.sysList.forEach((item) => { if (item.sysId === 'thirdId') { @@ -1227,7 +1269,8 @@ export default { this.newProductData.thirdId4 = item.thirdId } }) - }, + } + , /** * 关联 第三方 */ @@ -1235,7 +1278,8 @@ export default { this.defaultSys = row.sysId this.isImport = false this.chooseHouseDrugVisible = true - }, + } + , removeErp(row) { this.$confirm('此操作将解除该绑定药品信息, 是否继续?', '提示', { confirmButtonText: '确定', @@ -1264,17 +1308,19 @@ export default { }) .catch(() => { }) - }, + } + , closeUdi(val) { this.chooseHouseDrugVisible = false this.getThirdSysDetail() - }, - handleInput(index, value,type){ + } + , + handleInput(index, value, type) { const intValue = parseInt(value, 10); // 更新行的数据 - if (type == 1){ + if (type == 1) { this.$set(this.detailList[index], 'packLevel', intValue); - }else { + } else { this.$set(this.detailList[index], 'bhxjsl', intValue); } @@ -1297,19 +1343,21 @@ export default { } else { this.selectedIndex = 0 } - }, + } + , directives: { - 'debounce-input': { - inserted(el, binding) { - let timeout - el.addEventListener('input', () => { - clearTimeout(timeout) - timeout = setTimeout(() => { - binding.value() - }, parseInt(binding.arg) || 300) - }) + 'debounce-input': + { + inserted(el, binding) { + let timeout + el.addEventListener('input', () => { + clearTimeout(timeout) + timeout = setTimeout(() => { + binding.value() + }, parseInt(binding.arg) || 300) + }) + } } - } } } diff --git a/src/views/supplier/companyDrug/basicCompanyproductEdit.vue b/src/views/supplier/companyDrug/basicCompanyproductEdit.vue index d7d893f..3e56f45 100644 --- a/src/views/supplier/companyDrug/basicCompanyproductEdit.vue +++ b/src/views/supplier/companyDrug/basicCompanyproductEdit.vue @@ -717,7 +717,7 @@ - +