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 |   78 ++++++++++++++++++++++++++++++++------
 1 files changed, 65 insertions(+), 13 deletions(-)

diff --git a/src/views/system/dept/form.vue b/src/views/system/dept/form.vue
index d652539..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,19 +8,42 @@
 import { Operation } from "@element-plus/icons-vue";
 import { getCaigoufangshiList } from "@/api/item/index";
 
-const { state } = useDept();
+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: "",
     projectCode: "", // 椤圭洰缂栧彿锛堝繀濉級
     projectName: "", // 椤圭洰鍚嶇О锛堝繀濉級
     hangyepinmu: null, // 琛屼笟鍝佺洰锛堝彲閫夛級
     caigoufangshi: null, // 閲囪喘鏂瑰紡锛堝彲閫夛級
+    caigoufangshiName: null,
     caigouyusuan: null, // 閲囪喘棰勭畻锛堝彲閫夛級
     dingbiaoguize: null, // 瀹氭爣瑙勫垯锛堝彲閫夛級
     baomingfei: null, // 鎶ュ悕璐癸紙鍙�夛級
     toubiaobaozhengjin: null, // 鎶曟爣淇濊瘉閲戯紙鍙�夛級
     lianhetitoubiao: null, // 鑱斿悎浣撴姇鏍囷紙鍙�夛級
-    kaibiaofangshi: null, // 寮�鏍囨柟寮忥紙鍙�夛級
+    kaibiaofangshi: "绾歌川鏍�", // 寮�鏍囨柟寮忥紙鍙�夛級
     shifoufenbao: "false", // 鏄惁鍒嗗寘锛堝彲閫夛級
     shifoutuisongxuanchuan: "true", // 鏄惁鎺ㄩ�佸浼狅紙鍙�夛級
     caigourenmingcheng: null, // 閲囪喘浜哄悕绉帮紙鍙�夛級
@@ -53,8 +76,15 @@
   return ruleFormRef.value;
 }
 const handleChange = value => {
-  console.log(value);
+  newFormInline.value.xingzhengquyuName = selectedLabels.value;
 };
+const selectChange = value => {
+  let obj = state.caigoufangshiList.find(item => {
+    return item.value == value;
+  });
+  newFormInline.value.caigoufangshiName = obj.label;
+};
+
 defineExpose({ getRef });
 onMounted(async () => {});
 </script>
@@ -113,11 +143,12 @@
         </el-form-item>
       </re-col>
       <re-col :value="6" :xs="24" :sm="24">
-        <el-form-item label="閲囪喘鏂瑰紡">
+        <el-form-item label="閲囪喘鏂瑰紡" prop="caigoufangshi">
           <el-select
             v-model="newFormInline.caigoufangshi"
             placeholder="璇烽�夋嫨閲囪喘鏂瑰紡"
             style="width: 240px"
+            @change="selectChange"
           >
             <el-option
               v-for="item in state.caigoufangshiList"
@@ -139,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="璇烽�夋嫨鐘舵��"
@@ -342,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
@@ -351,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
@@ -360,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
@@ -369,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
@@ -378,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
@@ -387,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
@@ -396,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