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; }