From f37d45b8998ea08a42002579ecc103244bdac17b Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 21 十一月 2024 11:06:56 +0800 Subject: [PATCH] Merge remote-tracking branch 'supervisionVue/hc-dataproduct-v1112' into lsf-dataproduct-1024 --- src/views/fysp/check/components/ArbitraryPhoto.vue | 28 ++++++++++------------------ 1 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/views/fysp/check/components/ArbitraryPhoto.vue b/src/views/fysp/check/components/ArbitraryPhoto.vue index 46b1c88..4593d21 100644 --- a/src/views/fysp/check/components/ArbitraryPhoto.vue +++ b/src/views/fysp/check/components/ArbitraryPhoto.vue @@ -19,7 +19,7 @@ return { // 鏃犳暟鎹� typesList: [], - typesMap: new Map(), + typesMap: new Map() }; }, mounted() { @@ -31,19 +31,6 @@ mediafileApi.getRoutineByStGuid(this.subtask.stGuid).then((res) => { let typeList = []; let typeMap = new Map(); - function hasThisTypeName(typeName) { - return typeList.map((item) => item.typeName).indexOf(typeName) != -1; - } - function addNewType(typeId, typeName, img) { - typeList.push({ - typeId: typeId, - typeName: typeName - }); - typeMap.set(typeId, [img]); - } - function addToThisType(typeId, img) { - typeMap.get(typeId).push(img); - } const data = res.data; for (const e of data) { let img = { @@ -51,13 +38,18 @@ }; const businesstype = e.businesstype; const businesstypeid = e.businesstypeid; - if (hasThisTypeName(businesstype)) { - addToThisType(businesstypeid, img); + if ( + typeList.find((item) => item.typeName == businesstype) != undefined + ) { + typeMap.get(businesstypeid).push(img); } else { - addNewType(businesstypeid, businesstype, img); + typeList.push({ + typeId: businesstypeid, + typeName: businesstype + }); + typeMap.set(businesstypeid, [img]); } } - this.typesList = typeList; this.typesMap = typeMap; }); -- Gitblit v1.9.3