From 3324a54fa4d0840f8a5dc8adb21753180ecd3f3c Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期二, 02 九月 2025 14:25:06 +0800
Subject: [PATCH] 公告信息页面

---
 src/views/system/dept/form.vue |   75 +++++++++++++++++++++++++++++++------
 1 files changed, 63 insertions(+), 12 deletions(-)

diff --git a/src/views/system/dept/form.vue b/src/views/system/dept/form.vue
index 88586e0..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: "",
@@ -16,12 +37,13 @@
     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, // 閲囪喘浜哄悕绉帮紙鍙�夛級
@@ -54,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>
@@ -119,6 +148,7 @@
             v-model="newFormInline.caigoufangshi"
             placeholder="璇烽�夋嫨閲囪喘鏂瑰紡"
             style="width: 240px"
+            @change="selectChange"
           >
             <el-option
               v-for="item in state.caigoufangshiList"
@@ -140,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="璇烽�夋嫨鐘舵��"
@@ -343,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
@@ -352,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
@@ -361,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
@@ -370,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
@@ -379,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
@@ -388,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
@@ -397,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