更多ruoyi-nbcio功能请看演示系统
gitee源代码地址
前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio
演示地址:RuoYi-Nbcio后台管理系统
更多nbcio-boot功能请看演示系统
gitee源代码地址
后端代码: https://gitee.com/nbacheng/nbcio-boot
前端代码:https://gitee.com/nbacheng/nbcio-vue.git
在线演示(包括H5) : http://122.227.135.243:9888
1、对于实际业务,自定义业务对应的流程可能是多个,需要用户发起流程的时候进行选择
比如下面
相同服务名称有两个相同的流程,不进行选择可能就会有问题了
2、发起的时候首先要去检查流程,把符合要求的都取出来
List<WfCustomForm> selectSysCustomFormByServiceName(String serviceName) {
List<WfCustomForm> wfCustomFormList = wfCustomFormService.selectSysCustomFormByServiceName(serviceName);
List<WfCustomForm> newCustomFormList = new ArrayList<WfCustomForm>();
if(ObjectUtil.isNotEmpty(wfCustomFormList)){
for(WfCustomForm wfCustomForm: wfCustomFormList) {
JSONArray jsonArray = JSONArray.parseArray(wfCustomForm.getAuthorize());
if (ObjectUtil.isNotEmpty(jsonArray)) {
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
newCustomFormList.add(wfCustomForm);
}
}
}
return newCustomFormList;
}
return null;
}
3、取出来后,要是超过1个,那就需要用户进行前端选择
this.submitLoading = true;
const processParams = {
serviceName: this.serviceName
}
getProcesss(processParams).then(res => {/**查询关联流程信息 */
this.processList = res.data;
this.submitLoading = false;
console.log("getProcesss this.processList",this.processList)
if (this.processList && this.processList.length > 1) {
this.flowOpen = true;
}
else if (this.processList && this.processList.length === 1) {
this.selectFlowId = res.data[0].id;
var params = Object.assign({
dataId: this.dataId
}, this.variables);
startByDataId(this.dataId, this.selectFlowId, this.serviceName, params)
.then(res => {
console.log("startByDataId res",res);
if (res.code == 200 ) {
this.$message.success(res.msg);
this.$emit('success');
} else {
this.$message.error(res.msg);
}
})
.finally(() => (this.submitLoading = false));
} else {
this.$message.error("检查该业务是否已经关联流程!");
}
})
.finally(() => (this.submitLoading = false));
4、显示需要选择的流程界面
<!--挂载关联多个流程-->
<a-modal @cancel="flowOpen = false" :title="flowTitle" :visible.sync="flowOpen" width="70%" append-to-body>
<el-row :gutter="64">
<el-col :span="20" :xs="64" style="width: 100%">
<el-table ref="singleTable" :data="processList" border highlight-current-row style="width: 100%">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" v-if="true"/>
<el-table-column label="业务表单名称" align="center" prop="businessName" />
<el-table-column label="业务服务名称" align="center" prop="businessService" />
<el-table-column label="流程名称" align="center" prop="flowName" />
<el-table-column label="关联流程发布主键" align="center" prop="deployId" />
<el-table-column label="前端路由地址" align="center" prop="routeName" />
<el-table-column label="组件注入方法" align="center" prop="component" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="selectProcess(scope.row)">确定</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</a-modal>