ソースを参照

受理单添加部门筛选

xy 5 日 前
コミット
dbb499d1f7

+ 49 - 1
yudao-ui-admin-vue3/src/views/pressure2/acceptorder/index.vue

@@ -76,9 +76,11 @@
     PressureEquipMainTypeMap,
     PressureEquipTypeMap
   } from "@/utils/constants";
+  import { getSimpleDeptList } from '@/api/system/dept'
   const dictStore = useDictStore()
   const userStore = useUserStore()
   const getCurrentUserRoles = computed(() => userStore.getRoles)
+  const currentUserDeptId = computed(() => userStore.getUser?.deptId)
 
   const route = useRoute()
   const isAuditPage = computed(() => route.path.includes('/accept-order-audit'))
@@ -122,6 +124,22 @@
       },
       render: (row, value) => <el-button link type="primary" onClick={() => handleOpenDetail(row)}>{ value || '-'}</el-button>
     },
+    {
+      label: '部门',
+      prop: 'deptId',
+      width: 150,
+      search: {
+        type: 'select',
+        options: [],
+        fieldProps: {
+          placeholder: '请选择部门'
+        }
+      },
+      render: (row, value) => {
+        const deptOption = columns.value.find(col => col.prop === 'deptId')?.search?.options?.find((opt: any) => opt.value === value)
+        return deptOption ? deptOption.label : '-'
+      }
+    },
     {
       label: '使用单位',
       prop: 'unitName',
@@ -383,6 +401,27 @@
   const dataList = ref([])
   const SmartTableRef = ref<SmartInstanceExpose>()
   const isClaim = ref('100')
+  const deptOptions = ref<Array<{label: string, value: string}>>([])
+  
+  // 获取部门列表
+  const getDeptList = async () => {
+    try {
+      const res = await getSimpleDeptList()
+      if (res && Array.isArray(res)) {
+        deptOptions.value = res.map(dept => ({
+          label: dept.name,
+          value: dept.id
+        }))
+        // 更新columns中的部门选项
+        const deptColumn = columns.value.find(col => col.prop === 'deptId')
+        if (deptColumn && deptColumn.search) {
+          deptColumn.search.options = deptOptions.value
+        }
+      }
+    } catch (error) {
+      console.error('获取部门列表失败:', error)
+    }
+  }
   
   // 处理状态筛选查询
   const handleQuery = () => {
@@ -545,7 +584,7 @@
     }
   }
 
-  onMounted(() => {
+  onMounted(async () => {
     const { unitName, filterCancel, bpmUserId } = route.query as Recordable
     if(unitName){
       searchFormData.value.unitName = unitName
@@ -557,6 +596,15 @@
      if(bpmUserId){
       searchFormData.value.bpmUserId = bpmUserId
     }
+    
+    // 获取部门列表
+    await getDeptList()
+    
+    // 设置默认部门为当前登录人部门
+    if (currentUserDeptId.value) {
+      searchFormData.value.deptId = currentUserDeptId.value
+    }
+    
     SmartTableRef.value?.setSearchForm(searchFormData.value)
     getOrderList()
   })

+ 49 - 1
yudao-ui-admin-vue3/src/views/pressure2/acceptorder/pipeIndex.vue

@@ -76,9 +76,11 @@
     PressureEquipMainTypeMap,
     PressureEquipTypeMap
   } from "@/utils/constants";
+  import { getSimpleDeptList } from '@/api/system/dept'
   const dictStore = useDictStore()
   const userStore = useUserStore()
   const getCurrentUserRoles = computed(() => userStore.getRoles)
+  const currentUserDeptId = computed(() => userStore.getUser?.deptId)
 
   const route = useRoute()
   const isAuditPage = computed(() => route.path.includes('/accept-order-audit'))
@@ -121,6 +123,22 @@
       },
       render: (row, value) => <el-button link type="primary" onClick={() => handleOpenDetail(row)}>{ value || '-'}</el-button>
     },
+    {
+      label: '部门',
+      prop: 'deptId',
+      width: 150,
+      search: {
+        type: 'select',
+        options: [],
+        fieldProps: {
+          placeholder: '请选择部门'
+        }
+      },
+      render: (row, value) => {
+        const deptOption = columns.value.find(col => col.prop === 'deptId')?.search?.options?.find((opt: any) => opt.value === value)
+        return deptOption ? deptOption.label : '-'
+      }
+    },
     {
       label: '使用单位',
       prop: 'unitName',
@@ -382,6 +400,27 @@
   const dataList = ref([])
   const SmartTableRef = ref<SmartInstanceExpose>()
   const isClaim = ref('100')
+  const deptOptions = ref<Array<{label: string, value: string}>>([])
+  
+  // 获取部门列表
+  const getDeptList = async () => {
+    try {
+      const res = await getSimpleDeptList()
+      if (res && Array.isArray(res)) {
+        deptOptions.value = res.map(dept => ({
+          label: dept.name,
+          value: dept.id
+        }))
+        // 更新columns中的部门选项
+        const deptColumn = columns.value.find(col => col.prop === 'deptId')
+        if (deptColumn && deptColumn.search) {
+          deptColumn.search.options = deptOptions.value
+        }
+      }
+    } catch (error) {
+      console.error('获取部门列表失败:', error)
+    }
+  }
   
   // 处理状态筛选查询
   const handleQuery = () => {
@@ -544,7 +583,7 @@
     }
   }
 
-  onMounted(() => {
+  onMounted(async () => {
     const { unitName, filterCancel, bpmUserId } = route.query as Recordable
     if(unitName){
       searchFormData.value.unitName = unitName
@@ -556,6 +595,15 @@
      if(bpmUserId){
       searchFormData.value.bpmUserId = bpmUserId
     }
+    
+    // 获取部门列表
+    await getDeptList()
+    
+    // 设置默认部门为当前登录人部门
+    if (currentUserDeptId.value) {
+      searchFormData.value.deptId = currentUserDeptId.value
+    }
+    
     SmartTableRef.value?.setSearchForm(searchFormData.value)
     getOrderList()
   })