From 36a315121f466fd06cf9b13b2ffb492d98aaa46d Mon Sep 17 00:00:00 2001
From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com>
Date: Tue, 31 Mar 2026 15:50:00 +0800
Subject: [PATCH] 修改回显

---
 src/views/saftyCheckMng/dailyCheck/index.vue |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/views/saftyCheckMng/dailyCheck/index.vue b/src/views/saftyCheckMng/dailyCheck/index.vue
index a72a2c2..8fa1c1c 100644
--- a/src/views/saftyCheckMng/dailyCheck/index.vue
+++ b/src/views/saftyCheckMng/dailyCheck/index.vue
@@ -75,7 +75,7 @@
           <el-button link type="primary" @click="openDialog('view',scope.row)">查看</el-button>
           <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
           <el-button link type="primary" @click="downloadFile(scope.row)">导出</el-button>
-          <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
+          <el-button v-if="isAuthority" link type="danger" @click="handleDelete(scope.row)">删除</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -118,7 +118,6 @@
   originDeptList: [],
   dataList: [],
   deptList: [],
-  safetyDeptList: [],
   userList: [],
   checkTypeList: [
     {
@@ -181,7 +180,7 @@
           multiple: true
         },
         rules: [{ required: true, message: '请选择部门', trigger: 'blur' }],
-        options: () => state.safetyDeptList
+        options: () => state.deptList
       },
       {
         label: '检查类型',
@@ -245,14 +244,21 @@
   },
   dataLoader: {},
   api: {},
-  checkDate: []
+  checkDate: [],
+  isAuthority: false
 });
 
-const { queryParams, total, dataList,deptList, userList, formConfig, dataLoader, api, checkTypeList, checkDate } = toRefs(state);
+const { queryParams, total, dataList,deptList, userList, formConfig, dataLoader, api, checkTypeList, checkDate, isAuthority } = toRefs(state);
+const userStore = useUserStore()
 onMounted(async ()=>{
   await getList()
   await getDeptList()
   await getUserList()
+  if(userStore.roles.includes('admin') || userStore.roles.includes('sys_admin') || userStore.roles.includes('place_safety_officer')){
+    state.isAuthority = true
+  }else{
+    state.isAuthority = false
+  }
 })
 
 onUnmounted(()=>{
@@ -263,7 +269,6 @@
   listDept().then(response => {
     state.originDeptList = response.data
     state.deptList = proxy.handleTree(response.data, "deptId")
-    state.safetyDeptList = proxy.handleTree(response.data.filter(item=>item.safety == '1'), "deptId")
   })
 }
 
@@ -301,6 +306,9 @@
 
 const openDialog = (type, value) => {
   const initalData = JSON.parse(JSON.stringify(value))
+  if (initalData.dailySafetyInspectionDepts && Array.isArray(initalData.dailySafetyInspectionDepts)) {
+    initalData.dailySafetyInspectionDepts = initalData.dailySafetyInspectionDepts.map(item => item.deptId)
+  }
   dialogRef.value.openDialog(type, initalData)
 }
 
@@ -341,7 +349,7 @@
 
 const handleSubmit = async (data, type) => {
   const params = JSON.parse(JSON.stringify(data))
-  console.log(state.originDeptList,'ori')
+  console.log(params.dailySafetyInspectionDepts,555)
   params.dailySafetyInspectionDepts = params.dailySafetyInspectionDepts.map(i=>{
     return {
       deptId: i,

--
Gitblit v1.9.2