From 1d66f43353524889999bbd9ac0b331c557ff98f7 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期一, 30 六月 2025 17:29:22 +0800
Subject: [PATCH] 修改

---
 src/views/build/conpanyFunctionConsult/qualityObjectives/objective/components/objectiveDialog.vue |   52 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/src/views/build/conpanyFunctionConsult/qualityObjectives/objective/components/objectiveDialog.vue b/src/views/build/conpanyFunctionConsult/qualityObjectives/objective/components/objectiveDialog.vue
index f856200..6125513 100644
--- a/src/views/build/conpanyFunctionConsult/qualityObjectives/objective/components/objectiveDialog.vue
+++ b/src/views/build/conpanyFunctionConsult/qualityObjectives/objective/components/objectiveDialog.vue
@@ -345,7 +345,6 @@
   state.isAdmin = userInfo.userType === 0;
   state.form.companyName = userInfo.companyName
   state.form.companyId = userInfo.companyId
-  await getDeptList()
   title.value = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看' ;
   if(type === 'edit' || type === 'review') {
     state.form = JSON.parse(JSON.stringify(value));
@@ -354,13 +353,23 @@
       state.form.companyName = value.companyName
     }
   }
+  await getDeptList()
+  if(state.isAdmin){
+    await   getCompanyList()
+  }
+  await   getPeopleList()
   dialogVisible.value = true;
 }
 const addObject = () => {
   state.form.qualityTargets.push({})
 }
 const getDeptList = async () => {
-  const res = await getDept()
+  const param = {
+    pageNum: 1,
+    pageSize: 999,
+    companyId: state.form.companyId
+  }
+  const res = await getDept(param)
   if(res.code === 200){
     state.deptList = res.data
   }
@@ -434,10 +443,10 @@
   state.form.qualityTargets = state.form.qualityTargets.filter(item=> item != val)
 }
 const getPeopleList = async (val)=>{
-  if(val != ""){
+  if(val){
     const queryParams = {
       name: val,
-      companyId: state.form.companyId
+      companyId: state.form.companyId == 0 ? null : state.form.companyId
     }
     const res = await getUser(queryParams)
     if (res.code == 200) {
@@ -446,6 +455,20 @@
     } else {
       ElMessage.warning(res.message)
     }
+  }else {
+    const queryParams = {
+      pageNum: 1,
+      pageSize: 10,
+      companyId: state.form.companyId == 0 ? null : state.form.companyId
+    }
+    const res = await getUser(queryParams)
+    if (res.code == 200) {
+      state.peopleList = res.data.list
+
+    } else {
+      ElMessage.warning(res.message)
+    }
+
   }
 }
 const selectValue = (val) => {
@@ -478,19 +501,27 @@
   }
 }
 const selectValueCom = (val) => {
+  state.form.leadBy = null
+  state.form.qualityBy = null
+  state.form.compilationBy = null
+  state.form.leadName = null
+  state.form.qualityName = null
+  state.form.compilationName = null
+  state.form.departId = null
   state.companyList.forEach(item => {
     if(item.name === val){
       state.form.companyId = item.id
     }
   })
   getDeptList()
+  getPeopleList()
 }
 const changeLevel = () => {
   // state.form.companyName = ''
   state.form.departId = null
 }
 const getCompanyList = async (val)=>{
-  if(val != ""){
+  if(val){
     const queryParams = {
       name: val
     }
@@ -501,6 +532,17 @@
     } else {
       ElMessage.warning(res.message)
     }
+  }else {
+    const queryParams = {
+      pageSize: 10,
+      pageNum: 1,
+    }
+    const res = await getCompany(queryParams)
+    if (res.code == 200) {
+      state.companyList = res.data.list
+    } else {
+      ElMessage.warning(res.message)
+    }
   }
 }
 

--
Gitblit v1.9.2