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 => {