From a00ad0bb305257173c29fca09af5c199ef3931ce Mon Sep 17 00:00:00 2001 From: "15881625488@163.com" <15881625488@163.com> Date: Sat, 31 Jan 2026 10:30:45 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A[=E6=A8=A1=E6=9D=BF=E7=AE=A1?= =?UTF-8?q?=E7=90=86]=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/calUnitTools.js | 17 +++++++++++++++++ src/utils/index.js | 3 ++- .../business/comps/template/comps/sp/SWYPFXRYPZB.vue | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/utils/calUnitTools.js b/src/utils/calUnitTools.js index 1a99e2f..1f0aa08 100644 --- a/src/utils/calUnitTools.js +++ b/src/utils/calUnitTools.js @@ -80,3 +80,20 @@ export function multiplyDecimals(a, b) { result = result.replace(/\.?0+$/, '') || '0' return (isNegative ? '-' : '') + result } + +//模板物资去重 +export function uniqeResource(oldList,newList) { + for(var i=0;i-1){ + const { total, unit }=addTj([oldList[_index].syl,newList[i].syl],[oldList[_index].syldw,newList[i].syldw]) + oldList[_index].syl=total + oldList[_index].syldw=unit + }else{ + oldList.push(newList[i]) + } + } + return oldList; +} diff --git a/src/utils/index.js b/src/utils/index.js index 189bb71..d095c33 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -422,4 +422,5 @@ export const getExpireDate = (startDate, effectivePeriod, effectivePeriodUnit) = export function getuuid() { return Math.random().toString(36).substring(2) + Date.now().toString(36); -} \ No newline at end of file +} + diff --git a/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue b/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue index 329ced8..ef0409e 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue @@ -39,6 +39,7 @@ import templateMixin from "../../mixins/templateMixin"; import CustomTable from '@/components/Template/CustomTable.vue'; import { getLatestSn } from '@/api/template'; import { EventBus } from "@/utils/eventBus"; +import { uniqeResource } from "@/utils/calUnitTools"; export default { name: "Sp001", @@ -309,7 +310,7 @@ export default { } //使用的试剂、仪器 const stepResource = this.$refs.stepRef.getStepResource() - this.resourceTmp = tmpResource.concat(stepResource.sjResource||[]) + this.resourceTmp =uniqeResource(tmpResource,stepResource.sjResource||[]) this.yqResourceTmp = stepResource.yqResource||[] return content; }