From 592c1750b148874737cdfba4b22b6229f9805fe6 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期三, 02 七月 2025 14:55:27 +0800
Subject: [PATCH] 新增

---
 src/views/build/conpanyFunctionConsult/qualityObjectives/objective/components/objectiveDialog.vue |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 55 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..7b51a39 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
   }
@@ -371,6 +380,10 @@
     if(title.value === '新增'){
       console.log('sta',state.form)
       const {id, ...data} = JSON.parse(JSON.stringify(state.form))
+      if(data.qualityTargets && data.qualityTargets.length == 0){
+        ElMessage.warning('请填写质量目标')
+        return
+      }
       const res = await addObjective(data)
       if(res.code === 200){
         ElMessage({
@@ -386,6 +399,10 @@
       dialogVisible.value = false;
     }else if(title.value === '编辑'){
       const {...data} = JSON.parse(JSON.stringify(state.form))
+      if(data.qualityTargets && data.qualityTargets.length == 0){
+        ElMessage.warning('请填写质量目标')
+        return
+      }
       const res = await editObject(data)
       if(res.code === 200){
         ElMessage({
@@ -434,10 +451,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 +463,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 +509,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 +540,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