提交代码
parent
acda4fb4ba
commit
238fa041ca
|
@ -77,7 +77,7 @@ public class FlowDefinitionController extends BaseController {
|
|||
InputStream in = null;
|
||||
try {
|
||||
in = file.getInputStream();
|
||||
flowDefinitionService.importFile(name, category, in);
|
||||
flowDefinitionService.importFile(name, category, null , in);
|
||||
} catch (Exception e) {
|
||||
log.error("导入失败:", e);
|
||||
return AjaxResult.success(e.getMessage());
|
||||
|
@ -102,7 +102,6 @@ public class FlowDefinitionController extends BaseController {
|
|||
} catch (Exception e) {
|
||||
return AjaxResult.error("加载xml文件异常");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "读取图片文件")
|
||||
|
@ -129,7 +128,6 @@ public class FlowDefinitionController extends BaseController {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "保存流程设计器内的xml文件")
|
||||
|
@ -138,7 +136,7 @@ public class FlowDefinitionController extends BaseController {
|
|||
InputStream in = null;
|
||||
try {
|
||||
in = new ByteArrayInputStream(vo.getXml().getBytes(StandardCharsets.UTF_8));
|
||||
flowDefinitionService.importFile(vo.getName(), vo.getCategory(), in);
|
||||
flowDefinitionService.importFile(vo.getName(), vo.getCategory(), vo.getOwnerDeptId(), in);
|
||||
} catch (Exception e) {
|
||||
log.error("导入失败:", e);
|
||||
return AjaxResult.error(e.getMessage());
|
||||
|
@ -151,7 +149,6 @@ public class FlowDefinitionController extends BaseController {
|
|||
log.error("关闭输入流出错", e);
|
||||
}
|
||||
}
|
||||
|
||||
return AjaxResult.success("导入成功");
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,11 @@ public class FlowSaveXmlVo implements Serializable {
|
|||
*/
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 流程单位
|
||||
*/
|
||||
private String ownerDeptId;
|
||||
|
||||
/**
|
||||
* xml 文件
|
||||
*/
|
||||
|
|
|
@ -33,7 +33,7 @@ public interface IFlowDefinitionService {
|
|||
* @param category
|
||||
* @param in
|
||||
*/
|
||||
void importFile(String name, String category, InputStream in);
|
||||
void importFile(String name, String category, String OwnerDeptId, InputStream in);
|
||||
|
||||
/**
|
||||
* 读取xml
|
||||
|
|
|
@ -3,10 +3,13 @@ package com.yanzhu.flowable.service.impl;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.yanzhu.common.core.text.Convert;
|
||||
import com.yanzhu.common.utils.StringUtils;
|
||||
import com.yanzhu.flowable.common.constant.ProcessConstants;
|
||||
import com.yanzhu.common.core.domain.AjaxResult;
|
||||
import com.yanzhu.common.core.domain.entity.SysUser;
|
||||
import com.yanzhu.common.utils.SecurityUtils;
|
||||
import com.yanzhu.system.domain.flowable.FlowDeptVo;
|
||||
import com.yanzhu.system.domain.flowable.FlowQueryVo;
|
||||
import com.yanzhu.system.domain.FlowProcDefDto;
|
||||
import com.yanzhu.flowable.factory.FlowServiceFactory;
|
||||
|
@ -98,16 +101,31 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
|
|||
*
|
||||
* 当每个key的流程第一次部署时,指定版本为1。对其后所有使用相同key的流程定义,
|
||||
* 部署时版本会在该key当前已部署的最高版本号基础上加1。key参数用于区分流程定义
|
||||
* @param name
|
||||
* @param category
|
||||
* @param in
|
||||
* @param name 流程名称
|
||||
* @param category 流程类型
|
||||
* @param OwnerDeptId 流程单位
|
||||
* @param in 流程文件流
|
||||
*/
|
||||
@Override
|
||||
public void importFile(String name, String category, InputStream in) {
|
||||
public void importFile(String name, String category, String OwnerDeptId, InputStream in) {
|
||||
Deployment deploy = repositoryService.createDeployment().addInputStream(name + BPMN_FILE_SUFFIX, in).name(name).category(category).deploy();
|
||||
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult();
|
||||
repositoryService.setProcessDefinitionCategory(definition.getId(), category);
|
||||
|
||||
/**新增流程单位关系**/
|
||||
FlowDeptVo flowDeptVo = new FlowDeptVo();
|
||||
flowDeptVo.setProcdefId(definition.getId());
|
||||
//超管能为
|
||||
if(SecurityUtils.isAdmin(SecurityUtils.getUserId())){
|
||||
if(StringUtils.isNotEmpty(OwnerDeptId)){
|
||||
// OwnerDeptId转换Long失败...默认返回null
|
||||
flowDeptVo.setDeptId(Convert.toLong(OwnerDeptId));
|
||||
}
|
||||
}else{
|
||||
// 从部门祖籍列表中获取项目单位信息...
|
||||
Long projectDeptId = Convert.toLong(SecurityUtils.getLoginUser().getUser().getDept().getAncestors().split(",")[2]);
|
||||
flowDeptVo.setDeptId(projectDeptId);
|
||||
}
|
||||
flowDeployMapper.insertActReProcdefDept(flowDeptVo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.yanzhu.system.domain.flowable;
|
||||
|
||||
import com.yanzhu.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
|
||||
/**
|
||||
* <p>工作流项目单位关系<p>
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-02-23
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("工作流项目单位关系")
|
||||
public class FlowDeptVo extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 流程定义主键 */
|
||||
private String procdefId;
|
||||
|
||||
/** 流程定义单位 */
|
||||
private Long deptId;
|
||||
|
||||
/** 流程定义排序 */
|
||||
private String sort;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("procdefId", getProcdefId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("sort", getSort())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.yanzhu.system.mapper;
|
||||
|
||||
import com.yanzhu.system.domain.FlowProcDefDto;
|
||||
import com.yanzhu.system.domain.flowable.FlowDeptVo;
|
||||
import com.yanzhu.system.domain.flowable.FlowQueryVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -21,4 +22,12 @@ public interface FlowDeployMapper {
|
|||
* @return
|
||||
*/
|
||||
List<FlowProcDefDto> selectDeployList(FlowQueryVo flowQueryVo);
|
||||
|
||||
/**
|
||||
* 新增单位流程关系
|
||||
*
|
||||
* @param flowDeptVo 流程 单位关系
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertActReProcdefDept(FlowDeptVo flowDeptVo);
|
||||
}
|
||||
|
|
|
@ -38,5 +38,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增单位流程关系-->
|
||||
<insert id="insertActReProcdefDept" parameterType="com.yanzhu.system.domain.flowable.FlowDeptVo">
|
||||
insert into act_re_procdef_dept
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="procdefId != null">PROCDEF_ID_,</if>
|
||||
<if test="deptId != null">DEPT_ID_,</if>
|
||||
<if test="sort != null">SORT_,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="procdefId != null">#{procdefId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="sort != null">#{sort},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
|
@ -3,7 +3,9 @@
|
|||
<x-form ref="xForm" v-model="formData" :config="formConfig">
|
||||
<template #executionListener>
|
||||
<el-badge :value="executionListenerLength">
|
||||
<el-button size="small" @click="dialogName = 'executionListenerDialog'">编辑</el-button>
|
||||
<el-button size="small" @click="dialogName = 'executionListenerDialog'"
|
||||
>编辑</el-button
|
||||
>
|
||||
</el-badge>
|
||||
</template>
|
||||
<template #signal>
|
||||
|
@ -28,86 +30,104 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import mixinPanel from '../../common/mixinPanel'
|
||||
import mixinExecutionListener from '../../common/mixinExecutionListener'
|
||||
import signalDialog from './property/signal'
|
||||
import { commonParse } from '../../common/parseElement'
|
||||
import mixinPanel from "../../common/mixinPanel";
|
||||
import mixinExecutionListener from "../../common/mixinExecutionListener";
|
||||
import signalDialog from "./property/signal";
|
||||
import { commonParse } from "../../common/parseElement";
|
||||
export default {
|
||||
components: {
|
||||
signalDialog
|
||||
signalDialog,
|
||||
},
|
||||
mixins: [mixinPanel, mixinExecutionListener],
|
||||
data() {
|
||||
return {
|
||||
signalLength: 0,
|
||||
formData: {}
|
||||
}
|
||||
formData: {},
|
||||
xmlOption: [
|
||||
{
|
||||
xType: "input",
|
||||
name: "id",
|
||||
label: "流程标识key",
|
||||
rules: [{ required: true, message: "Id 不能为空" }],
|
||||
},
|
||||
{
|
||||
xType: "input",
|
||||
name: "name",
|
||||
label: "流程名称",
|
||||
},
|
||||
{
|
||||
xType: "input",
|
||||
name: "documentation",
|
||||
label: "节点描述",
|
||||
},
|
||||
{
|
||||
xType: "slot",
|
||||
name: "executionListener",
|
||||
label: "执行监听器",
|
||||
},
|
||||
{
|
||||
xType: "slot",
|
||||
name: "signal",
|
||||
label: "信号定义",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
formConfig() {
|
||||
const _this = this
|
||||
const _this = this;
|
||||
// 页面初始完成后执行...
|
||||
if (_this.categorys.length > 0) {
|
||||
let category = {
|
||||
xType: "select",
|
||||
name: "processCategory",
|
||||
label: "流程分类",
|
||||
rules: [{ required: true, message: "流程类型不能为空" }],
|
||||
dic: { data: _this.categorys, label: "dictLabel", value: "dictValue" },
|
||||
};
|
||||
_this.xmlOption.unshift(category);
|
||||
// 超管能为其它项目&&公司添加工作流程
|
||||
if (_this.$store.getters.userId == 1) {
|
||||
console.log("我是超管...{}");
|
||||
_this.xmlOption.unshift({
|
||||
xType: "input",
|
||||
name: "ownerDeptId",
|
||||
label: "所属项目主键",
|
||||
});
|
||||
}
|
||||
}
|
||||
return {
|
||||
inline: false,
|
||||
item: [
|
||||
{
|
||||
xType: 'select',
|
||||
name: 'processCategory',
|
||||
label: '流程分类',
|
||||
dic: { data: _this.categorys, label: 'dictLabel', value: 'dictValue' }
|
||||
},
|
||||
{
|
||||
xType: 'input',
|
||||
name: 'id',
|
||||
label: '流程标识key',
|
||||
rules: [{ required: true, message: 'Id 不能为空' }]
|
||||
},
|
||||
{
|
||||
xType: 'input',
|
||||
name: 'name',
|
||||
label: '流程名称'
|
||||
},
|
||||
{
|
||||
xType: 'input',
|
||||
name: 'documentation',
|
||||
label: '节点描述'
|
||||
},
|
||||
{
|
||||
xType: 'slot',
|
||||
name: 'executionListener',
|
||||
label: '执行监听器'
|
||||
},
|
||||
{
|
||||
xType: 'slot',
|
||||
name: 'signal',
|
||||
label: '信号定义'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
item: _this.xmlOption,
|
||||
};
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
'formData.processCategory': function(val) {
|
||||
if (val === '') val = null
|
||||
this.updateProperties({ 'flowable:processCategory': val })
|
||||
}
|
||||
"formData.processCategory": function (val) {
|
||||
if (val === "") val = null;
|
||||
this.updateProperties({ "flowable:processCategory": val });
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.formData = commonParse(this.element)
|
||||
this.formData = commonParse(this.element);
|
||||
},
|
||||
methods: {
|
||||
computedSignalLength() {
|
||||
this.signalLength = this.element.businessObject.extensionElements?.values?.length ?? 0
|
||||
this.signalLength =
|
||||
this.element.businessObject.extensionElements?.values?.length ?? 0;
|
||||
},
|
||||
finishSignal() {
|
||||
if (this.dialogName === 'signalDialog') {
|
||||
this.computedSignalLength()
|
||||
if (this.dialogName === "signalDialog") {
|
||||
this.computedSignalLength();
|
||||
}
|
||||
this.dialogName = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
this.dialogName = "";
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
.bjs-powered-by {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -7,6 +7,7 @@ const getters = {
|
|||
cachedViews: state => state.tagsView.cachedViews,
|
||||
token: state => state.user.token,
|
||||
avatar: state => state.user.avatar,
|
||||
userId: state => state.user.id,
|
||||
name: state => state.user.name,
|
||||
introduction: state => state.user.introduction,
|
||||
roles: state => state.user.roles,
|
||||
|
|
|
@ -1,16 +1,40 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-form-item label="流程名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入名称"
|
||||
placeholder="请输入流程名称"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间" prop="deployTime">
|
||||
<el-form-item label="项目名称" prop="deptName">
|
||||
<el-input
|
||||
v-model="queryParams.deptName"
|
||||
placeholder="请输入项目名称"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="流程类型" prop="category">
|
||||
<el-select
|
||||
v-model="queryParams.category"
|
||||
@keyup.enter.native="handleQuery"
|
||||
placeholder="请选择流程类型"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_process_category"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间" prop="deployTime" v-if="false">
|
||||
<el-date-picker clearable size="small"
|
||||
v-model="queryParams.deployTime"
|
||||
type="date"
|
||||
|
@ -77,12 +101,11 @@
|
|||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="业务表单" align="center" :show-overflow-tooltip="true">
|
||||
<el-table-column label="项目名称" align="center" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="scope.row.formId" type="text" @click="handleForm(scope.row.formId)">
|
||||
<span>{{ scope.row.formName }}</span>
|
||||
</el-button>
|
||||
<label v-else>暂无表单</label>
|
||||
<!-- @click="handleForm(scope.row.formId)" -->
|
||||
<el-tag type="info" v-if="scope.row.deptId">{{ scope.row.deptName }}</el-tag>
|
||||
<el-tag>缺省工作流</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="流程版本" align="center">
|
||||
|
@ -100,10 +123,10 @@
|
|||
<el-table-column label="操作" width="250" fixed="right"class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="handleLoadXml(scope.row)" icon="el-icon-edit-outline" type="text" size="small">设计</el-button>
|
||||
<el-button @click="handleAddForm(scope.row)" icon="el-icon-edit-el-icon-s-promotion" type="text" size="small" v-if="scope.row.formId == null">配置主表单</el-button>
|
||||
<!-- <el-button @click="handleAddForm(scope.row)" icon="el-icon-edit-el-icon-s-promotion" type="text" size="small" v-if="scope.row.formId == null">配置主表单</el-button> -->
|
||||
<el-button @click="handleUpdateSuspensionState(scope.row)" icon="el-icon-video-pause" type="text" size="small" v-if="scope.row.suspensionState === 1">挂起</el-button>
|
||||
<el-button @click="handleUpdateSuspensionState(scope.row)" icon="el-icon-video-play" type="text" size="small" v-if="scope.row.suspensionState === 2">激活</el-button>
|
||||
<el-button @click="handleDelete(scope.row)" icon="el-icon-delete" type="text" size="small" v-hasPermi="['system:deployment:remove']">删除</el-button>
|
||||
<el-button v-if="scope.row.deptId" @click="handleDelete(scope.row)" icon="el-icon-delete" type="text" size="small" v-hasPermi="['system:deployment:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -319,7 +342,8 @@ export default {
|
|||
derivedFrom: null,
|
||||
derivedFromRoot: null,
|
||||
parentDeploymentId: null,
|
||||
engineVersion: null
|
||||
engineVersion: null,
|
||||
deptName: null
|
||||
},
|
||||
formQueryParams:{
|
||||
pageNum: 1,
|
||||
|
|
Loading…
Reference in New Issue