add 流程历史查看

This commit is contained in:
周俊杰
2024-05-29 13:37:42 +08:00
parent fc521f7580
commit a4478902dd
5 changed files with 250 additions and 55 deletions

View File

@@ -2,17 +2,22 @@ package org.nl.wms.flow_manage.flow.controller.execution;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.nl.common.domain.entity.PageQuery;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.base_manage.material.service.dao.MdMeMaterialbase;
import org.nl.wms.early_manage.service.early_dtl.dao.AlmEarlyDtl;
import org.nl.wms.flow_manage.flow.service.deployment.IActReProcdefService;
import org.nl.wms.flow_manage.flow.service.execution.IActRuExecutionService;
import org.nl.wms.flow_manage.flow.service.execution.IFlowOperationService;
import org.nl.wms.flow_manage.flow.service.execution.dao.ActRuExecution;
import org.nl.wms.flow_manage.flow.service.execution.dto.ExecutionQuery;
import org.nl.wms.flow_manage.flow.service.execution.dto.StartProcessInstanceVo;
import org.nl.wms.flow_manage.flow.service.history.IActHiExecutionService;
import org.nl.wms.flow_manage.flow.service.history.dao.ActHiExecution;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -20,6 +25,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
/*
* @author ZZQ
@@ -36,8 +42,11 @@ public class ExecutionController {
@Autowired
private IActRuExecutionService executionService;
@Autowired
private IActHiExecutionService iActHiExecutionService;
@Autowired
private IActReProcdefService procdefService;
@GetMapping
public ResponseEntity<Object> getAll(ExecutionQuery query, PageQuery page) {
return new ResponseEntity<>(executionService.getAll(query, page), HttpStatus.OK);
@@ -67,6 +76,23 @@ public class ExecutionController {
}
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/dtl/{id}")
public ResponseEntity<Object> getDtl(@PathVariable String proc_inst_id) {
List<ActHiExecution> list = iActHiExecutionService.list(new LambdaQueryWrapper<ActHiExecution>().eq(ActHiExecution::getProc_inst_id, proc_inst_id));
JSONArray array = new JSONArray();
for (ActHiExecution actHiExecution : list) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("proc_inst_id", actHiExecution.getProc_inst_id());
jsonObject.put("activity_name", actHiExecution.getActivity_name());
jsonObject.put("update_time", actHiExecution.getUpdate_time());
jsonObject.put("form_id", actHiExecution.getForm_id());
jsonObject.put("form_type", actHiExecution.getForm_type());
jsonObject.put("form_data", actHiExecution.getForm_data());
array.add(jsonObject);
}
return new ResponseEntity<>(array, HttpStatus.OK);
}
@PostMapping(value = "/open")
public ResponseEntity<Object> getBpmnByModelId(JSONObject form) {

View File

@@ -7,7 +7,7 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3307}/${DB_NAME:zjhs_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
username: ${DB_USER:root}
password: ${DB_PWD:123456}
@@ -155,4 +155,4 @@ sa-token:
schedulerFile: /Users/mima0000/Desktop/scheduler.xml
lucene:
index:
path: E:\lms\lucene\index
path: D:\lms\lucene\index

View File

@@ -0,0 +1,131 @@
<template>
<el-dialog
:visible.sync="dialogVisible"
append-to-body
fullscreen
title="流程实例"
@close="close"
@open="open"
>
<div class="crud-opts2" style="margin-top: 30px;margin-bottom: 15px">
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
</span>
</div>
<!--表格渲染-->
<el-table
ref="table"
:data="tableData"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
:highlight-current-row="true"
border
max-height="300"
style="width: 100%;"
>
<el-table-column label="流程实例id" prop="proc_inst_id" />
<el-table-column label="节点名称" prop="activity_name" />
<el-table-column label="修改时间" prop="update_time" />
<el-table-column label="业务主键" prop="form_id" />
<el-table-column label="业务类型" prop="form_type" />
<el-table-column label="业务数据" show-overflow-tooltip prop="form_data" :formatter="jsonFormat" />
</el-table>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogVisible = false"> </el-button>
</span>
</el-dialog>
</template>
<script>
import { crud } from '@crud/crud'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import curdExecution from './curdExecution'
export default {
name: 'ViewDialog',
components: {},
dicts: ['PDM_BI_SHIFTTYPE', 'MPS_BD_ORDERSTATUS', 'PDM_BI_ORDERTYPE', 'IS_OR_NOT'],
mixins: [crud()],
props: {
dialogShow: {
type: Boolean,
default: false
},
bussConfig: {
type: Object
},
openParam: {
type: Object
}
},
data() {
return {
dialogVisible: false,
form: {
proc_inst_id: null,
activity_name: null,
update_time: null,
form_id: null,
form_type: null,
form_data: {}
},
tableData: [],
rules: {}
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
}
},
methods: {
setForm(row) {
this.getDtl(row)
this.dialogVisible = true
this.form.proc_inst_id = row.proc_inst_id
this.form.activity_name = row.activity_name
this.form.update_time = row.update_time
this.form.form_id = row.form_id
this.form.form_type = row.expression
this.form.form_data = row.form_data
},
jsonFormat(row, index) {
if (row.form_data != null) {
return JSON.stringify(row.form_data)
}
return ''
},
open() {
},
close() {
this.$emit('AddChanged')
},
getDtl(row) {
curdExecution.getDtl(row.proc_inst_id).then(res => {
this.tableData = res
})
}
}
}
</script>
<style>
.crud-opts2 {
padding: 0 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
padding: 4px 4px;
}
.input-with-select {
background-color: #fff;
}
</style>

View File

@@ -8,6 +8,13 @@ export function add(data) {
})
}
export function getDtl(proc_inst_id) {
return request({
url: 'api/bpmnExecution/dtl/' + proc_inst_id,
method: 'get'
})
}
export function del(ids) {
return request({
url: 'api/flow',
@@ -77,8 +84,8 @@ export function changeActive(data) {
}
export function flowConfirm(inst_id) {
return request({
url: 'api/bpmnExecution/confirm/'+inst_id,
method: 'get',
url: 'api/bpmnExecution/confirm/' + inst_id,
method: 'get'
})
}
@@ -92,6 +99,7 @@ export default {
publish,
queryByParentId,
getDeploymentById,
getDtl,
changeActive,
flowConfirm
}

View File

@@ -31,10 +31,10 @@
class="filter-item"
/>
</el-form-item>
<rrOperation/>
<rrOperation />
</el-form>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission"/>
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog
:close-on-click-modal="false"
@@ -45,28 +45,28 @@
>
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="150px">
<el-form-item label="父流程id" prop="parent_id">
<el-input v-model="form.parent_id" style="width: 300px;"/>
<el-input v-model="form.parent_id" style="width: 300px;" />
</el-form-item>
<el-form-item label="当前实例对应版本" prop="deployment_id">
<el-input v-model="form.deployment_id" style="width: 300px;"/>
<el-input v-model="form.deployment_id" style="width: 300px;" />
</el-form-item>
<el-form-item label="当前实例执行节点" prop="activity_id">
<el-input v-model="form.activity_id" style="width: 300px;"/>
<el-input v-model="form.activity_id" style="width: 300px;" />
</el-form-item>
<el-form-item label="实例状态" prop="status">
<el-input v-model="form.status" style="width: 300px;"/>
<el-input v-model="form.status" style="width: 300px;" />
</el-form-item>
<el-form-item label="表单类型" prop="form_type">
<el-input v-model="form.form_type" style="width: 300px;"/>
<el-input v-model="form.form_type" style="width: 300px;" />
</el-form-item>
<el-form-item label="表单id" prop="form_type">
<el-input v-model="form.form_id" style="width: 300px;"/>
<el-input v-model="form.form_id" style="width: 300px;" />
</el-form-item>
<el-form-item label="表单数据" prop="form_data">
<el-input type="textarea" v-model="form.form_data" style="width: 300px;"/>
<el-input v-model="form.form_data" type="textarea" style="width: 300px;" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input type="textarea" v-model="form.remark" style="width: 300px;"/>
<el-input v-model="form.remark" type="textarea" style="width: 300px;" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@@ -87,25 +87,39 @@
size="small"
style="width: 100%;"
>
<el-table-column type="selection" width="55"/>
<el-table-column prop="proc_inst_id" show-overflow-tooltip show-tooltip-when-overflow width="200" label="流程实例"/>
<el-table-column prop="parent_id" width="200" label="父流程"/>
<el-table-column v-if="false" prop="deployment_id" label="流程部署ID"/>
<el-table-column prop="deployment_name" show-overflow-tooltip show-tooltip-when-overflow width="130"
label="流程模型"/>
<el-table-column v-if="false" prop="activity_id" label="当前节点ID"/>
<el-table-column prop="activity_name" show-overflow-tooltip show-tooltip-when-overflow width="130"
label="当前节点"/>
<el-table-column type="selection" width="55" />
<el-table-column prop="proc_inst_id" show-overflow-tooltip show-tooltip-when-overflow width="220" label="流程实例">
<template slot-scope="scope">
<el-link type="warning" @click="toView(scope.row)">{{ scope.row.proc_inst_id }}</el-link>
</template>
</el-table-column>
<el-table-column prop="parent_id" width="200" label="父流程" />
<el-table-column v-if="false" prop="deployment_id" label="流程部署ID" />
<el-table-column
prop="deployment_name"
show-overflow-tooltip
show-tooltip-when-overflow
width="130"
label="流程模型"
/>
<el-table-column v-if="false" prop="activity_id" label="当前节点ID" />
<el-table-column
prop="activity_name"
show-overflow-tooltip
show-tooltip-when-overflow
width="130"
label="当前节点"
/>
<el-table-column prop="is_active" label="启用">
<template slot-scope="scope">
<el-switch
v-model="scope.row.is_active"
active-color="#13ce66"
:active-value=true
:inactive-value=false
:active-value="true"
:inactive-value="false"
inactive-color="#ff4949"
@change="changeActive(scope.row)"
inactive-color="#ff4949">
</el-switch>
/>
</template>
</el-table-column>
<el-table-column prop="status" label="实例状态">
@@ -113,14 +127,20 @@
{{ statusEnum.label.FLOW_STATUS[scope.row.status] }}
</template>
</el-table-column>
<el-table-column prop="remark" show-overflow-tooltip show-tooltip-when-overflow label="备注"/>
<el-table-column prop="form_type" show-overflow-tooltip show-tooltip-when-overflow width="130" label="表单类型"/>
<el-table-column prop="form_id" show-overflow-tooltip show-tooltip-when-overflow width="130" label="表单id"/>
<el-table-column prop="form_data" show-overflow-tooltip show-tooltip-when-overflow width="130" label="表单数据"
:formatter="jsonFormat"/>
<el-table-column prop="create_id" label="创建人" width="135"/>
<el-table-column prop="create_time" label="创建时间" width="135"/>
<el-table-column prop="update_time" label="修改时间" width="135"/>
<el-table-column prop="remark" show-overflow-tooltip show-tooltip-when-overflow label="备注" />
<el-table-column prop="form_type" show-overflow-tooltip show-tooltip-when-overflow width="130" label="表单类型" />
<el-table-column prop="form_id" show-overflow-tooltip show-tooltip-when-overflow width="130" label="表单id" />
<el-table-column
prop="form_data"
show-overflow-tooltip
show-tooltip-when-overflow
width="130"
label="表单数据"
:formatter="jsonFormat"
/>
<el-table-column prop="create_id" label="创建人" width="135" />
<el-table-column prop="create_time" label="创建时间" width="135" />
<el-table-column prop="update_time" label="修改时间" width="135" />
<el-table-column
v-permission="['admin','actDeModel:edit','actDeModel:del']"
fixed="right"
@@ -135,42 +155,47 @@
style="display: inline"
/>
<el-popover
:ref="`popover-${scope.$index}`"
placement="top"
width="180"
trigger="click"
style="z-index: 9999;"
:ref="`popover-${scope.$index}`"
>
<p>{{ popoverMessage }}</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="cancelFlow(scope)">取消</el-button>
<el-button type="primary" size="mini"
@click="confirmFlow(scope.row.proc_inst_id,scope)">确定
<el-button
type="primary"
size="mini"
@click="confirmFlow(scope.row.proc_inst_id,scope)"
>确定
</el-button>
</div>
<el-button slot="reference" type="text" icon="el-icon-video-play" size="mini" @click="showPopover">触发
</el-button>
</el-popover>
<el-button slot="right" @click="viewClick(scope.row)" type="text" icon="el-icon-thumb" size="mini">预览
<el-button slot="right" type="text" icon="el-icon-thumb" size="mini" @click="viewClick(scope.row)">预览
</el-button>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination/>
<pagination />
</div>
<ViewCurrentFlowDesigner ref="viewCurrentFlowDesigner"/>
<ViewDialog ref="itemview" />
<ViewCurrentFlowDesigner ref="viewCurrentFlowDesigner" />
</div>
</template>
<script>
import curdExecution from './curdExecution'
import CRUD, {presenter, header, form, crud} from '@crud/crud'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import ViewCurrentFlowDesigner from './ViewCurrentFlowDesigner';
import ViewCurrentFlowDesigner from './ViewCurrentFlowDesigner'
import ViewDialog from '@/views/wms/flow_manage/act/execution/ViewDialog.vue'
const defaultForm = {
proc_inst_id: null,
@@ -189,9 +214,9 @@ const defaultForm = {
form_data: null
}
export default {
statusEnums: ["FLOW_STATUS"],
statusEnums: ['FLOW_STATUS'],
name: 'Execution',
components: {pagination, crudOperation, rrOperation, udOperation, ViewCurrentFlowDesigner},
components: { pagination, crudOperation, rrOperation, udOperation, ViewCurrentFlowDesigner, ViewDialog },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
@@ -203,7 +228,7 @@ export default {
},
idField: 'proc_inst_id',
sort: 'proc_inst_id,desc',
crudMethod: {...curdExecution}
crudMethod: { ...curdExecution }
})
},
data() {
@@ -211,20 +236,20 @@ export default {
formTypes: [],
permission: {},
modelJson: '',
popoverMessage: "确定要触发流程吗",
popoverMessage: '确定要触发流程吗',
statusList: [
{
value: "30",
label: "未知"
value: '30',
label: '未知'
},
{
value: "20",
label: "未知"
value: '20',
label: '未知'
}
],
rules: {
name: [
{required: true, message: '不能为空', trigger: 'blur'}
{ required: true, message: '不能为空', trigger: 'blur' }
]
}
}
@@ -232,6 +257,11 @@ export default {
created() {
},
methods: {
toView(row) {
if (row !== null) {
this.$refs.itemview.setForm(row)
}
},
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
@@ -248,7 +278,7 @@ export default {
},
confirmFlow(proc_inst_id, scope) {
curdExecution.flowConfirm(proc_inst_id).then(res => {
this.crud.notify("触发成功", CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.notify('触发成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
scope._self.$refs[`popover-${scope.$index}`].doClose()
@@ -262,12 +292,12 @@ export default {
},
viewClick(row) {
curdExecution.getDeploymentById(row.deployment_id).then(res => {
this.$refs.viewCurrentFlowDesigner.showLogicFlowDesigner(res.model_editor_json, row);
this.$refs.viewCurrentFlowDesigner.showLogicFlowDesigner(res.model_editor_json, row)
})
},
flowConfirm(proc_inst_id) {
curdExecution.flowConfirm(proc_inst_id).then(res => {
crud.notify("操作成功", CRUD.NOTIFICATION_TYPE.SUCCESS)
crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
this.crud.toQuery()
},