From 57776764f8235b49d7ac65acf2a1bb351bd78013 Mon Sep 17 00:00:00 2001 From: odjbin <1042039504@qq.com> Date: Sat, 6 Jul 2024 23:29:33 +0800 Subject: [PATCH] =?UTF-8?q?fix=20:=20=E4=BF=AE=E5=A4=8D=E5=BE=81=E9=9B=86?= =?UTF-8?q?=E5=85=AC=E5=8F=B8=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/project-demand/requirement/add.vue | 30 +++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/views/project-demand/requirement/add.vue b/src/views/project-demand/requirement/add.vue index 4c3874a..3e1cd64 100644 --- a/src/views/project-demand/requirement/add.vue +++ b/src/views/project-demand/requirement/add.vue @@ -104,6 +104,7 @@ 重新提交 返回 + @@ -128,7 +129,6 @@ import {getSubCompOpt} from '@/api/user/user.js' import {useTagsView} from '@/stores/tagsview.js' import {getFundOption} from "@/api/special-fund"; import CompanyPicker from "@/components/DetailComponent/CompanyPicker.vue"; -import {matterTree} from "@/utils/matterTree"; import {useCacheStore} from '@/stores/cache.js' @@ -408,22 +408,30 @@ const handleResubmit = () => { } }) } - +const matterTree = (array,data, id) => { + if (id) { + data.forEach(item => { + if (item.value == id) { + let obj={ + label:item.label, + value:item.value + } + array.push(obj); + } + if (item.children && item.children.length > 0) { + matterTree(array,item.children,id) + } + }) + return array; + } +} const getCompanyOptionItem = (val) => { - let newObj = {} - let newArray = [] if (val !== undefined) { val.forEach(item => { matterTree(companyNameArray.value, companyOption.value, item) }) - companyNameArray.value.forEach(companyItem => { - newObj = { - label: companyItem - } - newArray.push(newObj) - }) } - return newArray; + return companyNameArray.value; } const getDetailInfo = async () => { getFormInfo(route.query.id).then(res => {