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 | 69 +++++++++++++++++++++++++++------- 1 files changed, 55 insertions(+), 14 deletions(-) diff --git a/src/views/system/dept/form.vue b/src/views/system/dept/form.vue index 2e46642..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"; @@ -8,7 +8,28 @@ import { Operation } from "@element-plus/icons-vue"; import { getCaigoufangshiList } from "@/api/item/index"; -const { state } = useDept(ref({})); +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: "", @@ -22,7 +43,7 @@ baomingfei: null, // 鎶ュ悕璐癸紙鍙�夛級 toubiaobaozhengjin: null, // 鎶曟爣淇濊瘉閲戯紙鍙�夛級 lianhetitoubiao: null, // 鑱斿悎浣撴姇鏍囷紙鍙�夛級 - kaibiaofangshi: null, // 寮�鏍囨柟寮忥紙鍙�夛級 + kaibiaofangshi: "绾歌川鏍�", // 寮�鏍囨柟寮忥紙鍙�夛級 shifoufenbao: "false", // 鏄惁鍒嗗寘锛堝彲閫夛級 shifoutuisongxuanchuan: "true", // 鏄惁鎺ㄩ�佸浼狅紙鍙�夛級 caigourenmingcheng: null, // 閲囪喘浜哄悕绉帮紙鍙�夛級 @@ -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 => { @@ -96,10 +117,9 @@ </el-form-item> </re-col> <re-col :value="6" :xs="24" :sm="24"> - <el-form-item label="椤圭洰缂栧彿"> + <el-form-item label="椤圭洰缂栧彿" prop="projectCode"> <el-input v-model="newFormInline.projectCode" - disabled clearable placeholder="璇疯緭鍏ラ」鐩紪鍙�" /> @@ -150,7 +170,7 @@ </el-form-item> </re-col> <re-col :value="6" :xs="24" :sm="24"> - <el-form-item label="瀹氬埗瑙勫垝" prop="dingbiaoguize"> + <el-form-item label="鎴愪氦鏂规硶" prop="dingbiaoguize"> <!-- <el-checkbox-group v-model="newFormInline.dingbiaoguize" placeholder="璇烽�夋嫨鐘舵��" @@ -353,7 +373,10 @@ </p> </re-col> <re-col :value="6" :xs="24" :sm="24"> - <el-form-item label="浠g悊鏈烘瀯鍚嶇О" prop="dailijigoumingcheng"> + <el-form-item + label="浠g悊鏈烘瀯鍚嶇О" + :prop="nowRole.code == 'DLJG' ? 'dailijigoumingcheng' : ''" + > <el-input v-model="newFormInline.dailijigoumingcheng" clearable @@ -362,7 +385,10 @@ </el-form-item> </re-col> <re-col :value="6" :xs="24" :sm="24"> - <el-form-item label="鑱旂郴浜�" prop="dailiLianxiren"> + <el-form-item + label="鑱旂郴浜�" + :prop="nowRole.code == 'DLJG' ? 'dailiLianxiren' : ''" + > <el-input v-model="newFormInline.dailiLianxiren" clearable @@ -371,7 +397,10 @@ </el-form-item> </re-col> <re-col :value="6" :xs="24" :sm="24"> - <el-form-item label="鑱旂郴鐢佃瘽" prop="dailiLianxidianhua"> + <el-form-item + label="鑱旂郴鐢佃瘽" + :prop="nowRole.code == 'DLJG' ? 'dailiLianxidianhua' : ''" + > <el-input v-model="newFormInline.dailiLianxidianhua" clearable @@ -380,7 +409,10 @@ </el-form-item> </re-col> <re-col :value="6" :xs="24" :sm="24"> - <el-form-item label="鐢靛瓙閭" prop="dailiDianziyoujian"> + <el-form-item + label="鐢靛瓙閭" + :prop="nowRole.code == 'DLJG' ? 'dailiDianziyoujian' : ''" + > <el-input v-model="newFormInline.dailiDianziyoujian" clearable @@ -389,7 +421,10 @@ </el-form-item> </re-col> <re-col :value="12" :xs="24" :sm="24"> - <el-form-item label="閫氫俊鍦板潃" prop="dailiTongxindizhi"> + <el-form-item + label="閫氫俊鍦板潃" + :prop="nowRole.code == 'DLJG' ? 'dailiTongxindizhi' : ''" + > <el-input v-model="newFormInline.dailiTongxindizhi" clearable @@ -398,7 +433,10 @@ </el-form-item> </re-col> <re-col :value="6" :xs="24" :sm="24"> - <el-form-item label="椤圭洰缁忕悊" prop="dailiXiangmujingli"> + <el-form-item + label="椤圭洰缁忕悊" + :prop="nowRole.code == 'DLJG' ? 'dailiXiangmujingli' : ''" + > <el-input v-model="newFormInline.dailiXiangmujingli" clearable @@ -407,7 +445,10 @@ </el-form-item> </re-col> <re-col :value="6" :xs="24" :sm="24"> - <el-form-item label="鑱旂郴鐢佃瘽" prop="dailijingliLianxidianhua"> + <el-form-item + label="鑱旂郴鐢佃瘽" + :prop="nowRole.code == 'DLJG' ? 'dailijingliLianxidianhua' : ''" + > <el-input v-model="newFormInline.dailijingliLianxidianhua" clearable -- Gitblit v1.9.1