3 Ревизии 0d8cb1ce66 ... a168affa4c

Автор SHA1 Съобщение Дата
  wuwenyi a168affa4c Merge branch 'feature/pref-1.0' преди 2 седмици
  wuwenyi be5cbd4b98 fix: 流程明细前端筛选完没有重新分页的问题 преди 2 седмици
  wuwenyi 72aa6a6cbb pref: 优化批量通过 преди 2 седмици
променени са 5 файла, в които са добавени 52 реда и са изтрити 18 реда
  1. 1 1
      src/api/flow/instance.ts
  2. 2 2
      src/api/flow/task.ts
  3. 13 6
      src/views/analysis/StuckInstanceTable.vue
  4. 7 7
      src/views/analysis/useAnalysis.ts
  5. 29 2
      src/views/flow/task/todo.vue

+ 1 - 1
src/api/flow/instance.ts

@@ -8,7 +8,7 @@ export function listMyInstance(params?: PageQuery): Promise<PageResult<FlowInsta
 }
 
 export function listInstance(
-  params?: PageQuery & { applicantName?: string; processName?: string; definitionName?: string; processDefinitionId?: number; currentNodeName?: string }
+  params?: PageQuery & { applicantName?: string; processName?: string; definitionName?: string; processDefinitionId?: number; currentNodeId?: string }
 ): Promise<PageResult<FlowInstance>> {
   return http.get('/flow/instance/page', { params })
 }

+ 2 - 2
src/api/flow/task.ts

@@ -4,7 +4,7 @@ import type { PageQuery, PageResult } from '@/types/api'
 import type { User } from '@/types/system'
 
 export function listTodo(
-  params?: PageQuery & { processName?: string; formFilters?: string }
+  params?: PageQuery & { processName?: string; formFilters?: string; currentNodeId?: string }
 ): Promise<PageResult<FlowTask>> {
   return http.get('/flow/task/todo', { params })
 }
@@ -26,7 +26,7 @@ export function rejectTask(id: number, data: ApprovalAction): Promise<void> {
 }
 
 export function batchApproveTask(taskIds: number[], data: ApprovalAction): Promise<void> {
-  return http.post('/flow/task/batch-approve', { taskIds, comment: data.comment, attachmentUrls: data.attachmentUrls })
+  return http.post('/flow/task/batch-approve', { taskIds, comment: data.comment, attachmentUrls: data.attachmentUrls, targetNodeId: data.targetNodeId })
 }
 
 export function batchRejectTask(taskIds: number[], data: ApprovalAction): Promise<void> {

+ 13 - 6
src/views/analysis/StuckInstanceTable.vue

@@ -8,8 +8,8 @@
             <el-option v-for="def in definitionList" :key="def.id" :label="def.name" :value="def.id" />
           </el-select>
           <el-input v-model="localQuery.applicantName" placeholder="归属用户" clearable style="width: 140px; margin-left: 8px;" @change="onSearch" />
-          <el-select v-model="localQuery.currentNodeName" placeholder="当前节点" clearable style="width: 140px; margin-left: 8px;" @change="onSearch">
-            <el-option v-for="node in currentNodeOptions" :key="node" :label="node" :value="node" />
+          <el-select v-model="localQuery.currentNodeId" placeholder="当前节点" clearable style="width: 140px; margin-left: 8px;" @change="onSearch">
+            <el-option v-for="node in currentNodeOptions" :key="node.id" :label="node.name" :value="node.id" />
           </el-select>
           <el-button type="primary" @click="onSearch" style="margin-left: 8px;">查询</el-button>
         </div>
@@ -49,8 +49,8 @@
       :page-sizes="[10, 20, 50]"
       layout="total, sizes, prev, pager, next, jumper"
       class="pagination"
-      @size-change="onSearch"
-      @current-change="onSearch"
+      @size-change="onPageChange"
+      @current-change="onPageChange"
     />
   </el-card>
 </template>
@@ -70,10 +70,10 @@ const props = defineProps<{
     processDefinitionId?: number
     processName: string
     applicantName: string
-    currentNodeName: string
+    currentNodeId: string
   }
   definitionList: FlowDefinition[]
-  currentNodeOptions: string[]
+  currentNodeOptions: { id: string; name: string }[]
 }>()
 
 const emit = defineEmits<{
@@ -100,11 +100,18 @@ function updateQuery() {
 function onProcessChange() {
   const def = props.definitionList.find((d) => d.id === localQuery.processDefinitionId)
   localQuery.processName = def?.name || ''
+  localQuery.pageNum = 1
   updateQuery()
   emit('process-change')
 }
 
 function onSearch() {
+  localQuery.pageNum = 1
+  updateQuery()
+  emit('search')
+}
+
+function onPageChange() {
   updateQuery()
   emit('search')
 }

+ 7 - 7
src/views/analysis/useAnalysis.ts

@@ -105,12 +105,12 @@ export function useAnalysis() {
   const loadingAll = ref(false)
 
   // 流程明细
-  const instanceQuery = reactive({ pageNum: 1, pageSize: 10, processDefinitionId: undefined as number | undefined, processName: '', applicantName: '', currentNodeName: '' })
+  const instanceQuery = reactive({ pageNum: 1, pageSize: 10, processDefinitionId: undefined as number | undefined, processName: '', applicantName: '', currentNodeId: '' })
   const instanceList = ref<FlowInstance[]>([])
   const instanceTotal = ref(0)
   const loadingInstanceList = ref(false)
   const definitionList = ref<FlowDefinition[]>([])
-  const currentNodeOptions = ref<string[]>([])
+  const currentNodeOptions = ref<{ id: string; name: string }[]>([])
 
   const instanceDetailVisible = ref(false)
   const instanceDetailId = ref(0)
@@ -296,7 +296,7 @@ export function useAnalysis() {
       try {
         currentNodeOptions.value = JSON.parse(def.flowJson)
           .nodes.filter((n: any) => n.type !== 'start' && n.type !== 'end' && n.type !== 'condition' && n.type !== 'cc')
-          .map((n: any) => n.name)
+          .map((n: any) => ({ id: n.id, name: n.name }))
       } catch {
         currentNodeOptions.value = []
       }
@@ -391,7 +391,7 @@ export function useAnalysis() {
     if (idx == null) return
     const node = nodeList.value[idx]
     if (!node) return
-    instanceQuery.currentNodeName = node.nodeName
+    instanceQuery.currentNodeId = node.nodeId || ''
     instanceQuery.processName = node.processName || ''
     instanceQuery.pageNum = 1
     loadInstanceList()
@@ -404,7 +404,7 @@ export function useAnalysis() {
   }
 
   function onInstanceProcessChange() {
-    instanceQuery.currentNodeName = ''
+    instanceQuery.currentNodeId = ''
     // 按名称或 ID 查找定义(StuckInstanceTable 切换时传 processName,顶栏切换时传 processDefinitionId)
     const def = definitionList.value.find((d) => d.name === instanceQuery.processName)
       || definitionOptions.value.find((d) => d.name === instanceQuery.processName)
@@ -414,7 +414,7 @@ export function useAnalysis() {
       try {
         currentNodeOptions.value = JSON.parse(def.flowJson)
           .nodes.filter((n: any) => n.type !== 'start' && n.type !== 'end' && n.type !== 'condition' && n.type !== 'cc')
-          .map((n: any) => n.name)
+          .map((n: any) => ({ id: n.id, name: n.name }))
       } catch {
         currentNodeOptions.value = []
       }
@@ -433,7 +433,7 @@ export function useAnalysis() {
         processDefinitionId: instanceQuery.processDefinitionId,
         definitionName: instanceQuery.processName || undefined,
         applicantName: instanceQuery.applicantName || undefined,
-        currentNodeName: instanceQuery.currentNodeName || undefined,
+        currentNodeId: instanceQuery.currentNodeId || undefined,
       })
       instanceList.value = res.list
       instanceTotal.value = res.total

+ 29 - 2
src/views/flow/task/todo.vue

@@ -13,10 +13,15 @@
 
       <el-form :inline="true" :model="queryParams" class="search-form">
         <el-form-item label="流程名称">
-          <el-select v-model="queryParams.processName" placeholder="全部流程" clearable style="width: 200px;">
+          <el-select v-model="queryParams.processName" placeholder="全部流程" clearable style="width: 200px;" @change="onProcessChange">
             <el-option v-for="def in definitionList" :key="def.id" :label="def.name" :value="def.name" />
           </el-select>
         </el-form-item>
+        <el-form-item label="当前节点">
+          <el-select v-model="queryParams.currentNodeId" placeholder="全部节点" clearable style="width: 160px;">
+            <el-option v-for="node in currentNodeOptions" :key="node.id" :label="node.name" :value="node.id" />
+          </el-select>
+        </el-form-item>
         <el-form-item>
           <el-button type="primary" @click="handleQuery">查询</el-button>
           <el-button @click="resetQuery">重置</el-button>
@@ -276,11 +281,30 @@ const tableData = ref<FlowTask[]>([])
 const total = ref(0)
 const tableRef = ref<TableInstance>()
 const definitionList = ref<FlowDefinition[]>([])
+const currentNodeOptions = ref<{ id: string; name: string }[]>([])
+
+function onProcessChange() {
+  queryParams.currentNodeId = undefined
+  const def = definitionList.value.find(d => d.name === queryParams.processName)
+  if (def?.flowJson) {
+    try {
+      currentNodeOptions.value = JSON.parse(def.flowJson)
+        .nodes.filter((n: any) => n.type !== 'start' && n.type !== 'end' && n.type !== 'condition' && n.type !== 'cc')
+        .map((n: any) => ({ id: n.id, name: n.name }))
+    } catch {
+      currentNodeOptions.value = []
+    }
+  } else {
+    currentNodeOptions.value = []
+  }
+}
+
 const queryParams = reactive({
   pageNum: 1,
   pageSize: 10,
   processName: undefined as string | undefined,
-  formFilters: undefined as string | undefined
+  formFilters: undefined as string | undefined,
+  currentNodeId: undefined as string | undefined
 })
 
 // 表单字段筛选
@@ -566,6 +590,8 @@ function handleQuery() {
 function resetQuery() {
   queryParams.processName = undefined
   queryParams.formFilters = undefined
+  queryParams.currentNodeId = undefined
+  currentNodeOptions.value = []
   activeUrgency.value = 'all'
   queryParams.pageNum = 1
   Object.keys(filterForm).forEach(key => delete filterForm[key])
@@ -578,6 +604,7 @@ async function loadDefinitions() {
     // 默认选中第一个流程并触发查询
     if (definitionList.value.length > 0 && !queryParams.processName) {
       queryParams.processName = definitionList.value[0].name
+      onProcessChange()
       loadData()
     }
   } catch {