Przeglądaj źródła

同一个单位不能一起排期

xuzhancheng 1 miesiąc temu
rodzic
commit
7ce75dbbf2

+ 15 - 9
yudao-ui-admin-vue3/src/views/pressure2/equipboilerscheduling/components/BoilerPlanScheduleDialog.vue

@@ -319,7 +319,7 @@
             v-for="checkItem in checkItemList"
             :key="checkItem.inspectionNature + '-' + checkItem.type"
           >
-            <div v-if="checkItem.inspectionNature == formData.checkType">
+            <div v-if="checkItem.inspectionNature == formData.checkType && getEquipCountByType(checkItem.inspectionNature) != 0">
               <div class="content-title" @click="toggleCheckItemCollapse(checkItem)">
                 <el-icon class="collapse-icon" :class="{ 'is-collapsed': !checkItem.isExpanded }">
                   <ArrowDown />
@@ -1154,21 +1154,27 @@ const handleQueryCheckItemList = async () => {
 
   if (allTasks.length > 0) {
     const firstType = allTasks[0].type
+    const firstUnit = allTasks[0].unitId
     const hasDifferentType = allTasks.some(task => task.type !== firstType)
+    const hasDifferentUnit = allTasks.some(task => task.unitId !== firstUnit)
 
     if (hasDifferentType) {
       ElMessage.error('请选择同一类型设备')
       dialogVisible.value = false
       return
     }
-  }
-  const unitId = allTasks.length > 0 ? allTasks[0].unitId : undefined
-  if (unitId){
-    ClientUnitApi.getClientUnit(unitId).then(res => {
-      formData.value.inIsExempt = res.isExempt
-      formData.value.outIsExempt = res.isExempt
-      formData.value.preIsExempt = res.isExempt
-    })
+
+    if (hasDifferentUnit) {
+      ElMessage.error('请选择同一单位设备')
+      dialogVisible.value = false
+      return
+    }
+    if (firstUnit){
+      ClientUnitApi.getClientUnit(firstUnit).then(res => {
+        formData.value.yearIsExempt = res.isExempt
+        formData.value.legalIsExempt = res.isExempt
+      })
+    }
   }
 
   // 获取统一的设备类型,如果列表为空则设为 undefined

+ 16 - 9
yudao-ui-admin-vue3/src/views/pressure2/pipescheduling/components/PipePlanScheduleDialog.vue

@@ -230,7 +230,7 @@
             v-show="showCheck(checkItem)"
             :key="checkItem.inspectionNature + '-' + checkItem.type"
           >
-            <div v-if="checkItem.inspectionNature == formData.checkType">
+            <div v-if="checkItem.inspectionNature == formData.checkType && getEquipCountByType(checkItem.inspectionNature) != 0">
               <div class="content-title" @click="toggleCheckItemCollapse(checkItem)">
                 <el-icon class="collapse-icon" :class="{ 'is-collapsed': !checkItem.isExpanded }">
                   <ArrowDown />
@@ -855,20 +855,27 @@ const handleQueryCheckItemList = async () => {
 
   if (allTasks.length > 0) {
     const firstType = allTasks[0].pipeCategory
+    const firstUnit = allTasks[0].unitId
     const hasDifferentType = allTasks.some(task => task.pipeCategory !== firstType)
+    const hasDifferentUnit = allTasks.some(task => task.unitId !== firstUnit)
 
     if (hasDifferentType) {
       ElMessage.error('请选择同一类型设备')
       dialogVisible.value = false
       return
     }
-  }
-  const unitId = allTasks.length > 0 ? allTasks[0].unitId : undefined
-  if (unitId){
-   ClientUnitApi.getClientUnit(unitId).then(res => {
-    formData.value.yearIsExempt = res.isExempt
-    formData.value.legalIsExempt = res.isExempt
-   })
+
+    if (hasDifferentUnit) {
+      ElMessage.error('请选择同一单位设备')
+      dialogVisible.value = false
+      return
+    }
+    if (firstUnit){
+      ClientUnitApi.getClientUnit(firstUnit).then(res => {
+        formData.value.yearIsExempt = res.isExempt
+        formData.value.legalIsExempt = res.isExempt
+      })
+    }
   }
 
   // 获取统一的设备类型,如果列表为空则设为 undefined
@@ -941,7 +948,6 @@ const open = async (selectedLegalList?: EquipPipeSchedulingVO[], selectedYearLis
   //console.log('open', props.selectedRows)
   dialogVisible.value = true
 
-  handleQueryCheckItemList()
 
   // 重置所有检验员选择
   legalSelectedCheckers.value = []
@@ -987,6 +993,7 @@ const open = async (selectedLegalList?: EquipPipeSchedulingVO[], selectedYearLis
   formData.value.legalTaskList = selectedLegalList
   formData.value.yearTaskList = selectedYearList
 
+  handleQueryCheckItemList()
   // 获取当前登录用户的部门ID
   const deptId = userStore.getUser.deptId?.toString() || '1'