From 03c275439949875a857538df89a41696642c42b3 Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期一, 01 九月 2025 17:15:39 +0800 Subject: [PATCH] '首页公告与详情' --- src/views/system/dept/form.vue | 25 +++++++++++++++++++++++-- 1 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/views/system/dept/form.vue b/src/views/system/dept/form.vue index 86db301..aebf30d 100644 --- a/src/views/system/dept/form.vue +++ b/src/views/system/dept/form.vue @@ -1,5 +1,5 @@ <script setup lang="ts"> -import { onMounted, ref, reactive } from "vue"; +import { onMounted, ref, reactive, computed } from "vue"; import ReCol from "@/components/ReCol"; import { formRules } from "./utils/rule"; import { FormProps } from "./utils/types"; @@ -9,6 +9,27 @@ import { getCaigoufangshiList } from "@/api/item/index"; const { state, nowRole } = useDept(ref({})); +// 閫掑綊鏌ユ壘label鐨勫嚱鏁� +const findLabelsByValues = (values, options, currentLabels = []) => { + if (!values.length || !options) return currentLabels; + + const [firstValue, ...restValues] = values; + const matched = options.find(item => item.code === firstValue); + + if (matched) { + currentLabels.push(matched.name); + // 缁х画鏌ユ壘涓嬩竴绾� + return findLabelsByValues(restValues, matched.regions, currentLabels); + } + return currentLabels; +}; +// 璁$畻灞炴�э細鏍规嵁selectedValue鍔ㄦ�佽幏鍙杔abel +const selectedLabels = computed(() => { + return findLabelsByValues( + newFormInline.value.xingzhengquyu, + state.regionList + ).join(""); +}); const props = withDefaults(defineProps<FormProps>(), { formInline: () => ({ id: "", @@ -55,7 +76,7 @@ return ruleFormRef.value; } const handleChange = value => { - console.log(value); + newFormInline.value.xingzhengquyuName = selectedLabels.value; }; const selectChange = value => { let obj = state.caigoufangshiList.find(item => { -- Gitblit v1.9.1