24282 11 hónapja
szülő
commit
47e181b3ed

+ 14 - 19
jy-flow/src/main/java/com/jy/flow/controller/ExecuteController.java

@@ -41,7 +41,6 @@ import com.warm.flow.core.service.UserService;
 import com.warm.flow.core.utils.StreamUtils;
 import com.warm.flow.orm.entity.FlowHisTask;
 import jakarta.annotation.Resource;
-import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -49,7 +48,6 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -183,26 +181,23 @@ public class ExecuteController {
      * 查询已办任务历史记录
      */
     @GetMapping("/doneList/{instanceId}")
-    public List<FlowHisTask> doneList(@PathVariable("instanceId") Long instanceId) {
-        List<HisTask> flowHisTasks = hisTaskService.orderById().desc().list(new FlowHisTask().setInstanceId(instanceId));
-        Map<Long, String> userMap = StreamUtils.toMap(sysUserDao.list(), SysUser::getId, SysUser::getNickname);
+    public List<HisTask> doneList(@PathVariable("instanceId") Long instanceId) {
+        List<HisTask> vo = hisTaskService.orderById().desc().list(new FlowHisTask().setInstanceId(instanceId));
+        if (vo.isEmpty()) {
+            return vo;
+        }
 
-        List<FlowHisTask> flowHisTaskList = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(flowHisTasks)) {
-            for (HisTask hisTask : flowHisTasks) {
-                if (StrUtil.isNotEmpty(hisTask.getApprover())) {
-                    String name = getName(hisTask.getApprover());
-                    hisTask.setApprover(name);
-                }
-                if (StrUtil.isNotEmpty(hisTask.getCollaborator())) {
-                    hisTask.setCollaborator(userMap.get(Long.valueOf(hisTask.getCollaborator())));
-                }
-                FlowHisTask flowHisTask = new FlowHisTask();
-                BeanUtils.copyProperties(hisTask, flowHisTask);
-                flowHisTaskList.add(flowHisTask);
+        Map<Long, String> userMap = StreamUtils.toMap(sysUserDao.list(), SysUser::getId, SysUser::getNickname);
+        for (HisTask hisTask : vo) {
+            if (StrUtil.isNotEmpty(hisTask.getApprover())) {
+                hisTask.setApprover(userMap.get(Long.valueOf(hisTask.getApprover())));
+            }
+            if (StrUtil.isNotEmpty(hisTask.getCollaborator())) {
+                hisTask.setCollaborator(userMap.get(Long.valueOf(hisTask.getCollaborator())));
             }
         }
-        return flowHisTaskList;
+
+        return vo;
     }
 
     /**

+ 18 - 11
jy-flow/src/main/java/com/jy/flow/mapper/xml/WarmFLowMapper.xml

@@ -81,19 +81,23 @@
         LEFT JOIN flow_definition d on t.definition_id = d.id
         LEFT JOIN flow_instance i on t.instance_id = i.id
         <where>
-            t.node_type = 1
-            and t.del_flag = 0
+            t.del_flag = 0
+            and t.node_type = 1
             <if test="task.permissionList != null and task.permissionList.size > 0">
                 AND uu.processed_by in
                 <foreach item="permission" collection="task.permissionList" open="(" separator="," close=")">
                     #{permission}
                 </foreach>
             </if>
-            <if test="task.nodeCode != null and task.nodeCode != ''">and t.node_code = #{task.nodeCode}</if>
-            <if test="task.nodeName != null and task.nodeName != ''">and t.node_name like concat('%',
-                #{task.nodeName}, '%')
+            <if test="task.nodeCode != null and task.nodeCode != ''">
+                and t.node_code = #{task.nodeCode}
+            </if>
+            <if test="task.nodeName != null and task.nodeName != ''">
+                and t.node_name like concat('%',#{task.nodeName}, '%')
+            </if>
+            <if test="task.instanceId != null ">
+                and t.instance_id = #{task.instanceId}
             </if>
-            <if test="task.instanceId != null ">and t.instance_id = #{task.instanceId}</if>
         </where>
         order by t.create_time desc
     </select>
@@ -143,6 +147,7 @@
         LEFT JOIN flow_instance i on t.instance_id = i.id
         order by t.create_time desc
     </select>
+
     <select id="copyPage" resultMap="FlowTaskResult">
         SELECT
         c.nickname AS approver,
@@ -159,13 +164,15 @@
         LEFT JOIN flow_definition d on b.definition_id=d.id
         WHERE
         a.type = 4
-        <if test="task.flowName != null and task.flowName != ''">and c.nick_name like concat('%',
-            #{task.flowName}, '%')
+        <if test="task.flowName != null and task.flowName != ''">
+          and c.nick_name like concat('%',#{task.flowName}, '%')
+        </if>
+        <if test="task.nodeName != null and task.nodeName != ''">
+          and b.node_name like concat('%',#{task.nodeName}, '%')
         </if>
-        <if test="task.nodeName != null and task.nodeName != ''">and b.node_name like concat('%',
-            #{task.nodeName}, '%')
+        <if test="task.nodeType != null">
+          and b.node_type = #{task.nodeType}
         </if>
-        <if test="task.nodeType != null">and b.node_type = #{task.nodeType}</if>
         ORDER BY create_time DESC
     </select>
 

+ 16 - 63
jy-ui/src/views/flow/taskDone/index.vue

@@ -23,12 +23,9 @@ const imgUrl = ref('')
 const doneListVisible = ref(false)
 const doneList = ref([])
 
-const handleData = ref({})
-
 const handleVisible = ref(false)
 const handleComponent = ref(null)
 const businessId = ref(null)
-const taskId = ref(null)
 
 const queryConfig: FormConfigType[] = [
   {
@@ -83,12 +80,12 @@ const columnConfig: ColumnConfigType[] = [
     label: '审批人'
   },
   {
-    prop: 'transferredBy',
-    label: '转办人'
+    prop: 'cooperateType',
+    label: '协作类型'
   },
   {
-    prop: 'delegate',
-    label: '委派人'
+    prop: 'collaborator',
+    label: '协作人'
   },
   {
     prop: 'flowStatus',
@@ -96,19 +93,14 @@ const columnConfig: ColumnConfigType[] = [
     dict: 'flow_status'
   },
   {
-    prop: 'activityStatus',
-    label: '激活状态',
-    dict: 'activity_status'
-  },
-  {
     prop: 'createTime',
-    label: '创建时间'
+    label: '审批时间'
   },
   {
-    width: 200,
+    width: 250,
     handleConfig: [
       {
-        text: '办理',
+        text: '流程明细',
         click(row) {
           const path = `/src/views/${row.formPath}`
           const module = modules[path]
@@ -117,26 +109,25 @@ const columnConfig: ColumnConfigType[] = [
             return
           }
           businessId.value = row.businessId
-          taskId.value = row.id
           handleComponent.value = markRaw(defineAsyncComponent(module))
           handleVisible.value = true
         }
       },
       {
-        text: '流程图',
+        text: '审批记录',
         click(row) {
-          getChartApi(row.instanceId).then((resp) => {
-            chartVisible.value = true
-            imgUrl.value = 'data:image/gif;base64,' + resp
+          getDoneListApi(row.instanceId).then((resp) => {
+            doneListVisible.value = true
+            doneList.value = resp
           })
         }
       },
       {
-        text: '审批记录',
+        text: '流程图',
         click(row) {
-          getDoneListApi(row.instanceId).then((resp) => {
-            doneListVisible.value = true
-            doneList.value = resp
+          getChartApi(row.instanceId).then((resp) => {
+            chartVisible.value = true
+            imgUrl.value = 'data:image/gif;base64,' + resp
           })
         }
       }
@@ -168,21 +159,6 @@ const doneListColumnConfig: ColumnConfigType[] = [
   }
 ]
 
-const handleConfig: FormConfigType[] = [
-  {
-    type: 'input',
-    itemType: 'textarea',
-    label: '审批意见',
-    prop: 'message',
-    rows: 5
-  },
-  {
-    type: 'slot',
-    label: '审批类型',
-    prop: 'handle'
-  }
-]
-
 onMounted(() => {
   getPage()
 })
@@ -194,14 +170,6 @@ function getPage() {
   })
 }
 
-function handle(handleType) {
-  const message = handleData.value.message
-  handleApi({ taskId: taskId.value, handleType, message }).then(() => {
-    getPage()
-    ElMessage.success('办理成功')
-    this.handleVisible = false
-  })
-}
 </script>
 
 <template>
@@ -224,22 +192,7 @@ function handle(handleType) {
     </a-table>
 
     <a-dialog title="" v-model="handleVisible" width="1200px" :footer="false">
-      <el-card shadow="always">
-        <template #header>流程明细</template>
-        <component :is="handleComponent" :businessId="businessId" />
-      </el-card>
-
-      <el-card shadow="always" style="margin-top: 20px">
-        <template #header>办理参数</template>
-        <a-form v-model="handleData" :config="handleConfig" :span="24">
-          <template #handle>
-            <el-button type="primary" @click="handle(1)">通 过</el-button>
-            <el-button type="primary" @click="handle(2)">回 退</el-button>
-            <el-button type="primary" @click="handle(3)">拒 绝</el-button>
-            <el-button @click="handleVisible = false">关 闭</el-button>
-          </template>
-        </a-form>
-      </el-card>
+      <component :is="handleComponent" :businessId="businessId" />
     </a-dialog>
 
     <a-dialog title="流程图" v-model="chartVisible" width="1200px" :footer="false">

+ 10 - 10
jy-ui/src/views/flow/taskTodo/index.vue

@@ -100,7 +100,7 @@ const columnConfig: ColumnConfigType[] = [
     label: '创建时间'
   },
   {
-    width: 200,
+    width: 250,
     handleConfig: [
       {
         text: '办理',
@@ -118,23 +118,23 @@ const columnConfig: ColumnConfigType[] = [
         }
       },
       {
-        text: '流程图',
+        text: '审批记录',
         click(row) {
-          getChartApi(row.instanceId).then((resp) => {
-            chartVisible.value = true
-            imgUrl.value = 'data:image/gif;base64,' + resp
+          getDoneListApi(row.instanceId).then((resp) => {
+            doneListVisible.value = true
+            doneList.value = resp
           })
         }
       },
       {
-        text: '审批记录',
+        text: '流程图',
         click(row) {
-          getDoneListApi(row.instanceId).then((resp) => {
-            doneListVisible.value = true
-            doneList.value = resp
+          getChartApi(row.instanceId).then((resp) => {
+            chartVisible.value = true
+            imgUrl.value = 'data:image/gif;base64,' + resp
           })
         }
-      }
+      },
     ]
   }
 ]