xy 16 ساعت پیش
والد
کامیت
f5d912b5f2
1فایلهای تغییر یافته به همراه55 افزوده شده و 18 حذف شده
  1. 55 18
      yudao-ui-admin-vue3/src/views/pressure2/expenseReminderManagement/index.vue

+ 55 - 18
yudao-ui-admin-vue3/src/views/pressure2/expenseReminderManagement/index.vue

@@ -218,7 +218,7 @@ import { isEmpty } from '@/utils/is'
 import { useRoute, useRouter } from 'vue-router'
 import { getDeptList } from '@/api/laboratory/dept'
 import {useDictStore} from "@/store/modules/dict";
-import {DICT_TYPE} from "@/utils/dict";
+import {DICT_TYPE, getStrDictOptions} from "@/utils/dict";
 
 const route = useRoute()
 const router = useRouter()
@@ -228,6 +228,8 @@ const userStore = useUserStoreWithOut() // 用户信息缓存
 
 const dictStore = useDictStore()
 const equipTypeMap = dictStore.getDictMap[DICT_TYPE.PRESSURE2_EQUIP_MAIN_TYPE]
+const boilerCheckTypeOptions = getStrDictOptions(DICT_TYPE.BOILER_CHECK_TYPE)
+const pipeCheckTypeOptions = getStrDictOptions(DICT_TYPE.PIPE_CHECK_TYPE)
 
 defineOptions({
   name: 'ExpenseReminderManagementIndex'
@@ -249,20 +251,6 @@ defineOptions({
       })
   })
 }
-const checkTypeMap = computed(() => [
-  {
-    label: '定期检验',
-    value: 100
-  },
-  {
-    label: '年度检查',
-    value: 200
-  },
-  {
-    label: '超年限检验',
-    value: 300
-  }
-])
 
 const statusMap = ref([
   {
@@ -283,8 +271,49 @@ const statusMap = ref([
   }
 ])
 
+
+// 处理设备类型变化
+const handleEquipMainTypeChange = (value: any) => {
+  const searchForm = smartTableRef.value?.getSearchForm() || {}
+  const checkTypeColumn = columns.value.find(col => col.prop === 'checkType')
+  
+  if (!value) {
+    // 设备类型清空时,隐藏检验性质并清空其值
+    showCheckTypeSearch.value = false
+    searchForm.checkType = undefined
+    // 移除 search 属性来隐藏筛选项
+    if (checkTypeColumn) {
+      checkTypeColumn.search = undefined
+    }
+  } else {
+    // 设备类型有值时,显示检验性质并更新选项
+    showCheckTypeSearch.value = true
+    // 恢复 search 属性
+    if (checkTypeColumn && !checkTypeColumn.search) {
+      checkTypeColumn.search = {
+        type: 'select',
+        options: value === '200' ? boilerCheckTypeOptions : pipeCheckTypeOptions,
+        fieldProps: {
+          placeholder: '请选择检验性质',
+          clearable: true
+        },
+        sort: 4
+      }
+    } else if (checkTypeColumn && checkTypeColumn.search) {
+      // 更新选项
+      checkTypeColumn.search.options = value === '200' ? boilerCheckTypeOptions : pipeCheckTypeOptions
+    }
+  }
+  
+  // 更新搜索表单
+  smartTableRef.value?.setSearchForm(searchForm)
+}
+
+
 const equipMainType = ref('boiler')
 const smartTableRef = ref<SmartInstanceExpose>()
+// 检验性质筛选是否显示
+const showCheckTypeSearch = ref(false)
 const pagerConfig = reactive({
   pageNo: 1,
   pageSize: 10
@@ -588,7 +617,8 @@ const columns = ref<SmartTableColumn[]>([
       options: equipTypeMap,
       fieldProps: {
         placeholder: '请输入设备类型',
-        clearable: true
+        clearable: true,
+        onChange: handleEquipMainTypeChange
       },
       sort: 2
     },
@@ -647,7 +677,7 @@ const columns = ref<SmartTableColumn[]>([
     },
     search: {
       type: 'select',
-      options: checkTypeMap.value,
+      options: boilerCheckTypeOptions,
       fieldProps: {
         placeholder: '请选择检验性质',
         clearable: true
@@ -655,7 +685,8 @@ const columns = ref<SmartTableColumn[]>([
       sort: 4
     },
     render(_row, value) {
-      return checkTypeMap.value.find((x) => x.value === value)?.label || ''
+      return _row.equipMainType == '200' ? (boilerCheckTypeOptions.find((x) => x.value == value)?.label || '')
+        : (pipeCheckTypeOptions.find((x) => x.value == value)?.label || '')
     }
   },
   {
@@ -1069,6 +1100,12 @@ const handleCloseChangePayerContactDialog = () => {
 }
 
 onMounted(() => {
+  // 初始化时隐藏检验性质筛选项
+  const checkTypeColumn = columns.value.find(col => col.prop === 'checkType')
+  if (checkTypeColumn) {
+    checkTypeColumn.search = undefined
+  }
+  
   smartTableRef.value?.setSearchForm(searchFormData.value)
   const routerQuery = route.query || {}
   if(Object.entries(routerQuery).length){