This commit is contained in:
guorui
2025-02-19 10:28:49 +08:00
commit dad6d41cbc
1052 changed files with 102186 additions and 0 deletions

View File

@@ -0,0 +1,592 @@
<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-input
v-model="queryParams.name"
placeholder="请输入名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="开始时间" prop="deployTime">
<el-date-picker clearable size="small"
v-model="queryParams.deployTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-upload"-->
<!-- size="mini"-->
<!-- @click="handleImport"-->
<!-- >导入</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-plus"
size="mini"
@click="handleLoadXml"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:deployment:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-alert title="流程设计说明" type="success">
<template slot='title'>
<p>流程设计说明:</p>
<div>1XML文件中的流程定义id属性用作流程定义的key参数</div>
<div>2XML文件中的流程定义name属性用作流程定义的name参数如果未给定name属性会使用id作为name</div>
<div>3当每个唯一key的流程第一次部署时指定版本为1对其后所有使用相同key的流程定义部署时版本会在该key当前已部署的最高版本号基础上加1key参数用于区分流程定义</div>
<div>4id参数设置为{processDefinitionKey}:{processDefinitionVersion}:{generated-id}其中generated-id是一个唯一数字用以保证在集群环境下流程定义缓存中流程id的唯一性</div>
</template>
</el-alert>
<el-table v-loading="loading" fit :data="definitionList" border @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="流程编号" align="center" prop="deploymentId" :show-overflow-tooltip="true"/>
<el-table-column label="流程标识" align="center" prop="flowKey" :show-overflow-tooltip="true" />
<el-table-column label="流程分类" align="center" prop="category" />
<el-table-column label="流程名称" align="center" width="120" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-button type="text" @click="handleReadImage(scope.row.deploymentId)">
<span>{{ scope.row.name }}</span>
</el-button>
</template>
</el-table-column>
<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>
</template>
</el-table-column>
<el-table-column label="流程版本" align="center">
<template slot-scope="scope">
<el-tag size="medium" >v{{ scope.row.version }}</el-tag>
</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-tag type="success" v-if="scope.row.suspensionState === 1">激活</el-tag>
<el-tag type="warning" v-if="scope.row.suspensionState === 2">挂起</el-tag>
</template>
</el-table-column>
<el-table-column label="部署时间" align="center" prop="deploymentTime" width="180"/>
<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="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>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改流程定义对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="看看" prop="name">
<el-input v-model="form.name" placeholder="请输入看看" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- bpmn20.xml导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xml"
:headers="upload.headers"
:action="upload.url + '?name=' + upload.name+'&category='+ upload.category"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处
<em>点击上传</em>
</div>
<div class="el-upload__tip" slot="tip">
流程名称<el-input v-model="upload.name"/>
流程分类
<div>
<!-- <el-input v-model="upload.category"/>-->
<el-select v-model="upload.category" placeholder="请选择流程分类">
<el-option
v-for="dict in dict.type.sys_process_category"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</div>
</div>
<div class="el-upload__tip" style="color:red" slot="tip">提示仅允许导入bpmn20.xml格式文件</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
<!-- 流程图 -->
<el-dialog :title="readImage.title" :visible.sync="readImage.open" width="70%" append-to-body>
<!-- <el-image :src="readImage.src"></el-image> -->
<bpmn-viewer :flowData="flowData"/>
</el-dialog>
<!--表单配置详情-->
<el-dialog :title="formTitle" :visible.sync="formConfOpen" width="50%" append-to-body>
<div class="test-form">
<v-form-render :form-data="formData" ref="vFormRef"/>
</div>
</el-dialog>
<!--挂载表单-->
<el-dialog :title="formDeployTitle" :visible.sync="formDeployOpen" width="60%" append-to-body>
<el-row :gutter="24">
<el-col :span="10" :xs="24">
<el-table
ref="singleTable"
:data="formList"
border
highlight-current-row
@current-change="handleCurrentChange"
style="width: 100%">
<el-table-column label="表单编号" align="center" prop="formId" />
<el-table-column label="表单名称" align="center" prop="formName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="submitFormDeploy(scope.row)">确定</el-button>
</template>
</el-table-column>
</el-table>
<pagination
small
layout="prev, pager, next"
v-show="formTotal>0"
:total="formTotal"
:page.sync="formQueryParams.pageNum"
:limit.sync="formQueryParams.pageSize"
@pagination="ListFormDeploy"
/>
</el-col>
<el-col :span="14" :xs="24">
<div class="test-form">
<v-form-render :form-data="formData" ref="vFormCurrentRowRef"/>
</div>
</el-col>
</el-row>
</el-dialog>
<!-- &lt;!&ndash;流程设计器&ndash;&gt;-->
<!-- <el-dialog-->
<!-- title="流程配置"-->
<!-- :visible.sync="dialogVisible"-->
<!-- :close-on-press-escape="false"-->
<!-- :fullscreen=true-->
<!-- :before-close="handleClose"-->
<!-- append-to-body>-->
<!-- <Model :deployId="deployId"/>-->
<!-- </el-dialog>-->
</div>
</template>
<script>
import {
listDefinition,
updateState,
delDeployment,
addDeployment,
updateDeployment,
exportDeployment,
definitionStart,
flowXmlAndNode
} from "@/api/flowable/definition";
import { getToken } from "@/utils/auth";
import { getForm, addDeployForm ,listForm } from "@/api/flowable/form";
import BpmnViewer from '@/components/Process/viewer';
import Model from './model';
export default {
name: "Definition",
dicts: ['sys_process_category'],
components: {
BpmnViewer,
Model
},
data() {
return {
// 遮罩层
loading: true,
dialogVisible: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 流程定义表格数据
definitionList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
formConfOpen: false,
formTitle: "",
formDeployOpen: false,
formDeployTitle: "",
formList: [],
formTotal:0,
formData: {}, // 默认表单数据
readImage:{
open: false,
src: "",
},
// bpmn.xml 导入
upload: {
// 是否显示弹出层xml导入
open: false,
// 弹出层标题xml导入
title: "",
// 是否禁用上传
isUploading: false,
name: null,
category: null,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/flowable/definition/import"
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
category: null,
key: null,
tenantId: null,
deployTime: null,
derivedFrom: null,
derivedFromRoot: null,
parentDeploymentId: null,
engineVersion: null
},
formQueryParams:{
pageNum: 1,
pageSize: 10,
},
// 挂载表单到流程实例
formDeployParam:{
formId: null,
deployId: null
},
deployId: '',
currentRow: null,
// xml
flowData: {},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
activated() {
const time = this.$route.query.t;
if (time != null) {
this.getList();
}
},
methods: {
/** 查询流程定义列表 */
getList() {
this.loading = true;
listDefinition(this.queryParams).then(response => {
this.definitionList = response.data.records;
this.total = response.data.total;
this.loading = false;
});
},
handleClose(done) {
this.$confirm('确定要关闭吗?关闭未保存的修改都会丢失?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
done();
}).catch(() => {});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
category: null,
key: null,
tenantId: null,
deployTime: null,
derivedFrom: null,
derivedFromRoot: null,
parentDeploymentId: null,
engineVersion: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.deploymentId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加流程定义";
},
/** 跳转到流程设计页面 */
handleLoadXml(row){
// this.dialogVisible = true;
// this.deployId = row.deploymentId;
this.$router.push({ path: '/flowable/definition/model',query: { deployId: row.deploymentId }})
},
/** 流程图查看 */
handleReadImage(deployId){
this.readImage.title = "流程图";
this.readImage.open = true;
// this.readImage.src = process.env.VUE_APP_BASE_API + "/flowable/definition/readImage/" + deploymentId;
flowXmlAndNode({deployId:deployId}).then(res => {
this.flowData = res.data;
})
},
/** 表单查看 */
handleForm(formId){
getForm(formId).then(res =>{
this.formTitle = "表单详情";
this.formConfOpen = true;
this.$nextTick(() => {
// 回显数据
this.$refs.vFormRef.setFormJson(JSON.parse(res.data.formContent))
this.$nextTick(() => {
// 表单禁用
this.$refs.vFormRef.disableForm();
})
})
})
},
/** 启动流程 */
handleDefinitionStart(row){
definitionStart(row.id).then(res =>{
this.$modal.msgSuccess(res.msg);
})
},
/** 挂载表单弹框 */
handleAddForm(row){
this.formDeployParam.deployId = row.deploymentId
this.ListFormDeploy()
},
/** 挂载表单列表 */
ListFormDeploy(){
listForm(this.formQueryParams).then(res =>{
this.formList = res.rows;
this.formTotal = res.total;
this.formDeployOpen = true;
this.formDeployTitle = "挂载表单";
})
},
// /** 更改挂载表单弹框 */
// handleEditForm(row){
// this.formDeployParam.deployId = row.deploymentId
// const queryParams = {
// pageNum: 1,
// pageSize: 10
// }
// listForm(queryParams).then(res =>{
// this.formList = res.rows;
// this.formDeployOpen = true;
// this.formDeployTitle = "挂载表单";
// })
// },
/** 挂载表单 */
submitFormDeploy(row){
this.formDeployParam.formId = row.formId;
addDeployForm(this.formDeployParam).then(res =>{
this.$modal.msgSuccess(res.msg);
this.formDeployOpen = false;
this.getList();
})
},
handleCurrentChange(data) {
if (data) {
this.$nextTick(() => {
// 回显数据
this.$refs.vFormCurrentRowRef.setFormJson(JSON.parse(data.formContent))
this.$nextTick(() => {
// 表单禁用
this.$refs.vFormCurrentRowRef.disableForm();
})
})
}
},
/** 挂起/激活流程 */
handleUpdateSuspensionState(row){
let state = 1;
if (row.suspensionState === 1) {
state = 2
}
const params = {
deployId: row.deploymentId,
state: state
}
updateState(params).then(res => {
this.$modal.msgSuccess(res.msg);
this.getList();
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.deploymentId || this.ids
getDeployment(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改流程定义";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDeployment(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDeployment(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const deploymentIds = row.deploymentId || this.ids;
this.$confirm('是否确认删除流程定义编号为"' + deploymentIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delDeployment(deploymentIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有流程定义数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportDeployment(queryParams);
}).then(response => {
this.download(response.msg);
})
},
/** 导入bpmn.xml文件 */
handleImport(){
this.upload.title = "bpmn20.xml文件导入";
this.upload.open = true;
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$message(response.msg);
this.getList();
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
}
}
};
</script>

View File

@@ -0,0 +1,155 @@
<template>
<div>
<bpmn-model
v-if="dataExit"
:xml="xml"
:is-view="false"
@save="save"
@showXML="showXML"
/>
<!--在线查看xml-->
<el-drawer :title="xmlTitle" :modal="false" direction="rtl" :visible.sync="xmlOpen" size="60%">
<!-- 设置对话框内容高度 -->
<el-scrollbar>
<pre v-highlight="xmlData"><code class="xml"></code></pre>
</el-scrollbar>
</el-drawer>
</div>
</template>
<script>
import {readXml, roleList, saveXml, userList,expList} from "@/api/flowable/definition";
import BpmnModel from '@/components/Process'
import vkBeautify from 'vkbeautify'
import hljs from 'highlight.js'
import 'highlight.js/styles/atelier-savanna-dark.css'
export default {
name: "Model",
components: {
BpmnModel,
vkBeautify
},
// 自定义指令
directives: {
deep: true,
highlight:{
deep: true,
bind: function bind(el, binding) {
const targets = el.querySelectorAll('code');
let target;
let i;
for (i = 0; i < targets.length; i += 1) {
target = targets[i];
if (typeof binding.value === 'string') {
target.textContent = binding.value;
}
hljs.highlightBlock(target);
}
},
componentUpdated: function componentUpdated(el, binding) {
const targets = el.querySelectorAll('code');
let target;
let i;
for (i = 0; i < targets.length; i += 1) {
target = targets[i];
if (typeof binding.value === 'string') {
target.textContent = binding.value;
hljs.highlightBlock(target);
}
}
},
}
},
data() {
return {
xml: "", // 后端查询到的xml
modeler:"",
dataExit: false,
xmlOpen: false,
xmlTitle: '',
xmlData: '',
};
},
created () {
const deployId = this.$route.query && this.$route.query.deployId;
// 查询流程xml
if (deployId) {
this.getXmlData(deployId);
}
this.getDataList()
},
methods: {
/** xml 文件 */
getXmlData(deployId) {
// 发送请求获取xml
readXml(deployId).then(res =>{
this.xml = res.data;
this.modeler = res.data
})
},
/** 保存xml */
save(data) {
const params = {
name: data.process.name,
category: data.process.category,
xml: data.xml
}
saveXml(params).then(res => {
this.$modal.msgSuccess(res.msg)
// 关闭当前标签页并返回上个页面
const obj = { path: "/flowable/definition", query: { t: Date.now()} };
this.$tab.closeOpenPage(obj);
})
},
/** 指定流程办理人员列表 */
getDataList() {
userList().then(res => {
this.modelerStore.userList = res.data;
})
roleList().then(res => {
this.modelerStore.roleList = res.data;
})
expList().then(res => {
this.modelerStore.expList = res.data;
this.dataExit = true;
});
},
/** 展示xml */
showXML(xmlData){
this.xmlTitle = 'xml查看';
this.xmlOpen = true;
this.xmlData = vkBeautify.xml(xmlData);
},
},
};
</script>
<style lang="scss" scoped>
.content-box{
line-height: 10px;
}
// 修改对话框高度
.showAll_dialog {
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
::v-deep .el-dialog {
margin: 0 auto !important;
height: 80%;
overflow: hidden;
background-color: #ffffff;
.el-dialog__body {
position: absolute;
left: 0;
top: 54px;
bottom: 0;
right: 0;
z-index: 1;
overflow: hidden;
overflow-y: auto;
// 下边设置字体,我的需求是黑底白字
color: #ffffff;
padding: 0 15px;
}
}
}
</style>

View File

@@ -0,0 +1,297 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入表达式名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option
v-for="dict in dict.type.sys_common_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:expression:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:expression:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:expression:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:expression:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="expressionList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="名称" align="center" prop="name" />
<el-table-column label="表达式内容" align="center" prop="expression" />
<el-table-column label="指定类型" align="center" prop="dataType" >
<template slot-scope="scope">
<dict-tag :options="dict.type.exp_data_type" :value="scope.row.dataType"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:expression:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:expression:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改流程达式对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入表达式名称" />
</el-form-item>
<el-form-item label="内容" prop="expression">
<el-input v-model="form.expression" placeholder="请输入表达式内容" />
</el-form-item>
<el-form-item label="指定类型" prop="dataType">
<el-radio-group v-model="form.dataType">
<el-radio
v-for="dict in dict.type.exp_data_type"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_common_status"
:key="dict.value"
:label="parseInt(dict.value)"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listExpression, getExpression, delExpression, addExpression, updateExpression } from "@/api/flowable/expression";
export default {
name: "FlowExp",
dicts: ['sys_common_status','exp_data_type'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 流程达式表格数据
expressionList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
expression: null,
status: null,
},
// 表单参数
form: {
dataType: 'fixed'
},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询流程达式列表 */
getList() {
this.loading = true;
listExpression(this.queryParams).then(response => {
this.expressionList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
expression: null,
createTime: null,
updateTime: null,
createBy: null,
updateBy: null,
status: null,
remark: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加流程达式";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getExpression(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改流程达式";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateExpression(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addExpression(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除流程达式编号为"' + ids + '"的数据项?').then(function() {
return delExpression(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/expression/export', {
...this.queryParams
}, `expression_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@@ -0,0 +1,335 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="监听类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择监听类型" clearable>
<el-option
v-for="dict in dict.type.sys_listener_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:listener:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:listener:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:listener:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:listener:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="listenerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="名称" align="center" prop="name" />
<el-table-column label="监听类型" align="center" prop="type">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_listener_type" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="事件类型" align="center" prop="eventType"/>
<el-table-column label="值类型" align="center" prop="valueType">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_listener_value_type" :value="scope.row.valueType"/>
</template>
</el-table-column>
<el-table-column label="执行内容" align="center" prop="value" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:listener:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:listener:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改流程监听对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item>
<el-form-item label="监听类型" prop="type">
<el-select v-model="form.type" placeholder="请选择监听类型">
<el-option
v-for="dict in dict.type.sys_listener_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="事件类型" prop="eventType" v-if="form.type === '1'">
<el-select v-model="form.eventType" placeholder="请选择事件类型">
<el-option
v-for="dict in taskListenerEventList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="事件类型" prop="eventType" v-else>
<el-select v-model="form.eventType" placeholder="请选择事件类型">
<el-option
v-for="dict in executionListenerEventList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="值类型" prop="valueType">
<el-radio-group v-model="form.valueType">
<el-radio
v-for="dict in dict.type.sys_listener_value_type"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="执行内容" prop="value">
<el-input v-model="form.value" placeholder="请输入执行内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listListener, getListener, delListener, addListener, updateListener } from "@/api/flowable/listener";
export default {
name: "Listener",
dicts: ['sys_listener_value_type', 'sys_listener_type', 'common_status', 'sys_listener_event_type'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 流程监听表格数据
listenerList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
type: null,
eventType: null,
valueType: null,
value: null,
status: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
},
taskListenerEventList: [
{label: 'create', value: 'create'},
{label: 'assignment', value: 'assignment'},
{label: 'complete', value: 'complete'},
{label: 'delete', value: 'delete'},
],
executionListenerEventList: [
{label: 'start', value: 'start'},
{label: 'end', value: 'end'},
{label: 'take', value: 'take'},
],
};
},
created() {
this.getList();
},
methods: {
/** 查询流程监听列表 */
getList() {
this.loading = true;
listListener(this.queryParams).then(response => {
this.listenerList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
type: null,
eventType: null,
valueType: null,
value: null,
createTime: null,
updateTime: null,
createBy: null,
updateBy: null,
status: null,
remark: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加流程监听";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getListener(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改流程监听";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateListener(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addListener(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除流程监听编号为"' + ids + '"的数据项?').then(function() {
return delListener(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/listener/export', {
...this.queryParams
}, `listener_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@@ -0,0 +1,204 @@
<template>
<div class="app-container">
<el-card class="box-card" >
<div slot="header" class="clearfix">
<span class="el-icon-document">已办任务</span>
<el-button style="float: right;" size="mini" type="danger" @click="goBack">关闭</el-button>
</div>
<el-tabs tab-position="top" v-model="activeName" @tab-click="handleClick">
<!--表单信息-->
<el-tab-pane label="表单信息" name="1">
<el-col :span="16" :offset="4">
<v-form-render ref="vFormRef"/>
</el-col>
</el-tab-pane>
<!--流程流转记录-->
<el-tab-pane label="流转记录" name="2">
<el-col :span="16" :offset="4" >
<div class="block">
<el-timeline>
<el-timeline-item
v-for="(item,index ) in flowRecordList"
:key="index"
:icon="setIcon(item.finishTime)"
:color="setColor(item.finishTime)"
>
<p style="font-weight: 700">{{item.taskName}}</p>
<el-card :body-style="{ padding: '10px' }">
<el-descriptions class="margin-top" :column="1" size="small" border>
<el-descriptions-item v-if="item.assigneeName" label-class-name="my-label">
<template slot="label"><i class="el-icon-user"></i>办理人</template>
{{item.assigneeName}}
<el-tag type="info" size="mini">{{item.deptName}}</el-tag>
</el-descriptions-item>
<el-descriptions-item v-if="item.candidate" label-class-name="my-label">
<template slot="label"><i class="el-icon-user"></i>候选办理</template>
{{item.candidate}}
</el-descriptions-item>
<el-descriptions-item label-class-name="my-label">
<template slot="label"><i class="el-icon-date"></i>接收时间</template>
{{item.createTime}}
</el-descriptions-item>
<el-descriptions-item v-if="item.finishTime" label-class-name="my-label">
<template slot="label"><i class="el-icon-date"></i>处理时间</template>
{{item.finishTime}}
</el-descriptions-item>
<el-descriptions-item v-if="item.duration" label-class-name="my-label">
<template slot="label"><i class="el-icon-time"></i>耗时</template>
{{item.duration}}
</el-descriptions-item>
<el-descriptions-item v-if="item.comment" label-class-name="my-label">
<template slot="label"><i class="el-icon-tickets"></i>处理意见</template>
{{item.comment.comment}}
</el-descriptions-item>
</el-descriptions>
</el-card>
</el-timeline-item>
</el-timeline>
</div>
</el-col>
</el-tab-pane>
<el-tab-pane label="流程图" name="3">
<Bpmn-viewer :flowData="flowData" :procInsId="taskForm.procInsId"/>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script>
import {flowRecord} from "@/api/flowable/finished";
import {getProcessVariables, flowXmlAndNode} from "@/api/flowable/definition";
import BpmnViewer from '@/components/Process/viewer';
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Record",
components: {
BpmnViewer,
},
props: {},
data() {
return {
// 模型xml数据
flowData: {},
activeName: '1',
// 查询参数
queryParams: {
deptId: undefined
},
// 遮罩层
loading: true,
flowRecordList: [], // 流程流转数据
taskForm:{
multiple: false,
comment:"", // 意见内容
procInsId: "", // 流程实例编号
instanceId: "", // 流程实例编号
deployId: "", // 流程定义编号
taskId: "" ,// 流程任务编号
procDefId: "", // 流程编号
vars: "",
},
};
},
created() {
this.taskForm.deployId = this.$route.query && this.$route.query.deployId;
this.taskForm.taskId = this.$route.query && this.$route.query.taskId;
this.taskForm.procInsId = this.$route.query && this.$route.query.procInsId;
// 流程任务重获取变量表单
if (this.taskForm.taskId){
this.processVariables( this.taskForm.taskId)
}
this.getFlowRecordList( this.taskForm.procInsId, this.taskForm.deployId);
},
methods: {
handleClick(tab, event) {
if (tab.name === '3') {
flowXmlAndNode({procInsId: this.taskForm.procInsId, deployId: this.taskForm.deployId}).then(res => {
this.flowData = res.data;
})
}
},
setIcon(val) {
if (val) {
return "el-icon-check";
} else {
return "el-icon-time";
}
},
setColor(val) {
if (val) {
return "#2bc418";
} else {
return "#b3bdbb";
}
},
/** 流程流转记录 */
getFlowRecordList(procInsId, deployId) {
const that = this
const params = {procInsId: procInsId, deployId: deployId}
flowRecord(params).then(res => {
that.flowRecordList = res.data.flowList;
}).catch(res => {
this.goBack();
})
},
/** 获取流程变量内容 */
processVariables(taskId) {
if (taskId) {
// 提交流程申请时填写的表单存入了流程变量中后续任务处理时需要展示
getProcessVariables(taskId).then(res => {
// 回显表单
this.$nextTick(() => {
this.$refs.vFormRef.setFormJson(res.data.formJson);
this.$nextTick(() => {
// 加载表单填写的数据
this.$refs.vFormRef.setFormData(res.data);
this.$nextTick(() => {
// 表单禁用
this.$refs.vFormRef.disableForm();
})
})
})
});
}
},
/** 返回页面 */
goBack() {
// 关闭当前标签页并返回上个页面
const obj = { path: "/task/finished", query: { t: Date.now()} };
this.$tab.closeOpenPage(obj);
},
}
};
</script>
<style lang="scss" scoped>
.test-form {
margin: 15px auto;
width: 800px;
padding: 15px;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both
}
.box-card {
width: 100%;
margin-bottom: 20px;
}
.el-tag + .el-tag {
margin-left: 10px;
}
.my-label {
background: #E1F3D8;
}
</style>

View File

@@ -0,0 +1,284 @@
<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-input
v-model="queryParams.name"
placeholder="请输入名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="开始时间" prop="deployTime">
<el-date-picker clearable size="small"
v-model="queryParams.deployTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:deployment:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="finishedList" border @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="任务编号" align="center" prop="taskId" :show-overflow-tooltip="true"/>
<el-table-column label="流程名称" align="center" prop="procDefName" :show-overflow-tooltip="true"/>
<el-table-column label="任务节点" align="center" prop="taskName" />
<el-table-column label="流程发起人" align="center">
<template slot-scope="scope">
<label>{{scope.row.startUserName}} <el-tag type="info" size="mini">{{scope.row.startDeptName}}</el-tag></label>
</template>
</el-table-column>
<el-table-column label="接收时间" align="center" prop="createTime" width="180"/>
<el-table-column label="审批时间" align="center" prop="finishTime" width="180"/>
<el-table-column label="耗时" align="center" prop="duration" width="180"/>
<el-table-column label="操作" width="150" fixed="right" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-tickets"
@click="handleFlowRecord(scope.row)"
>流转记录</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-refresh-left"
@click="handleRevoke(scope.row)"
>撤回
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { finishedList, getDeployment, delDeployment, addDeployment, updateDeployment, exportDeployment, revokeProcess } from "@/api/flowable/finished";
export default {
name: "Deploy",
components: {
},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 已办任务列表数据
finishedList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
src: "",
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
category: null,
key: null,
tenantId: null,
deployTime: null,
derivedFrom: null,
derivedFromRoot: null,
parentDeploymentId: null,
engineVersion: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询流程定义列表 */
getList() {
this.loading = true;
finishedList(this.queryParams).then(response => {
this.finishedList = response.data.records;
this.total = response.data.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
category: null,
key: null,
tenantId: null,
deployTime: null,
derivedFrom: null,
derivedFromRoot: null,
parentDeploymentId: null,
engineVersion: null
};
this.resetForm("form");
},
setIcon(val){
if (val){
return "el-icon-check";
}else {
return "el-icon-time";
}
},
setColor(val){
if (val){
return "#2bc418";
}else {
return "#b3bdbb";
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加流程定义";
},
/** 流程流转记录 */
handleFlowRecord(row){
this.$router.push({ path: '/flowable/task/finished/detail/index',
query: {
procInsId: row.procInsId,
deployId: row.deployId,
taskId: row.taskId,
}})
},
/** 撤回任务 */
handleRevoke(row){
const params = {
instanceId: row.procInsId
}
revokeProcess(params).then( res => {
this.$modal.msgSuccess(res.msg);
this.getList();
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getDeployment(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改流程定义";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDeployment(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDeployment(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除流程定义编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delDeployment(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有流程定义数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportDeployment(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>

View File

@@ -0,0 +1,123 @@
<template>
<div>
<v-form-designer ref="vfDesigner" :designer-config="designerConfig">
<!-- 保存按钮 -->
<template #customSaveButton>
<el-button type="text" @click="saveFormJson"><i class="el-icon-s-promotion" />保存</el-button>
</template>
</v-form-designer>
<!--系统表单信息-->
<el-dialog :title="formTitle" :visible.sync="formOpen" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="表单名称" prop="formName">
<el-input v-model="form.formName" placeholder="请输入表单名称" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {addForm, getForm, updateForm} from "@/api/flowable/form";
import { StrUtil } from '@/utils/StrUtil'
export default {
name: "flowForm",
data() {
return {
formTitle: "",
formOpen: false,
// 表单校验
rules: {
formName: [
{ required: true, message: "表单名称不能为空", trigger: "blur" }
]
},
// 表单参数
form: {
formId: null,
formName: null,
formContent: null,
remark: null
},
designerConfig: {
generateSFCButton: false,
exportCodeButton: false, //是否显示导出代码按钮
toolbarMaxWidth: 320,
toolbarMinWidth: 300, //设计器工具按钮栏最小宽度(单位像素)
formHeader: false,
},
}
},
mounted() {
const formId = this.$route.query && this.$route.query.formId;
if (StrUtil.isNotBlank(formId)) {
getForm(formId).then(res => {
this.$nextTick(() => {
// 加载表单json数据
this.$refs.vfDesigner.setFormJson(JSON.parse(res.data.formContent))
})
this.form = res.data;
})
}else {
this.$nextTick(() => {
// 加载表单json数据
this.$refs.vfDesigner.setFormJson({"widgetList":[],"formConfig":{"modelName":"formData","refName":"vForm","rulesName":"rules","labelWidth":80,"labelPosition":"left","size":"","labelAlign":"label-left-align","cssCode":"","customClass":"","functions":"","layoutType":"PC","onFormCreated":"","onFormMounted":"","onFormDataChange":"","onFormValidate":""}})
})
}
},
methods:{
// 保存表单数据
saveFormJson() {
let formJson = this.$refs.vfDesigner.getFormJson()
this.form.formContent = JSON.stringify(formJson);
this.formOpen = true;
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.formId != null) {
updateForm(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.formOpen = false;
});
} else {
addForm(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.formOpen = false;
});
}
// 关闭当前标签页并返回上个页面
const obj = { path: "/flowable/form", query: { t: Date.now()} };
this.$tab.closeOpenPage(obj);
}
});
},
// 取消按钮
cancel() {
this.formOpen = false;
this.reset();
},
}
}
</script>
<style lang="scss" scoped>
body {
margin: 0; /* 如果页面出现垂直滚动条则加入此行CSS以消除之 */
}
.el-container.main-container{
background: #fff;
margin-left: 0 !important;
}
</style>

View File

@@ -0,0 +1,357 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="表单名称" prop="formName">
<el-input
v-model="queryParams.formName"
placeholder="请输入表单名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['flowable:form:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="formList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="表单主键" align="center" prop="formId" />
<el-table-column label="表单名称" align="center" prop="formName" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleDetail(scope.row)"
>详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['flowable:form:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['flowable:form:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改流程表单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="表单名称" prop="formName">
<el-input v-model="form.formName" placeholder="请输入表单名称" />
</el-form-item>
<el-form-item label="表单内容">
<editor v-model="form.formContent" :min-height="192"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!--表单详情-->
<el-dialog :title="formTitle" :visible.sync="formRenderOpen" width="60%" append-to-body>
<v-form-render :form-data="formData" ref="vFormRef"/>
</el-dialog>
<!--表单设计器-->
<el-dialog
custom-class="dialogClass"
:visible.sync="dialogVisible"
:close-on-press-escape="false"
:fullscreen=true
:before-close="handleClose"
append-to-body>
<v-form-designer ref="vfDesigner" :designer-config="designerConfig">
<!-- 自定义按钮插槽演示 -->
<template #customSaveButton>
<el-button type="text" @click="saveFormJson"><i class="el-icon-s-promotion" />保存</el-button>
</template>
</v-form-designer>
</el-dialog>
<!--系统表单信息-->
<el-dialog :title="formTitle" :visible.sync="formOpen" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="表单名称" prop="formName">
<el-input v-model="form.formName" placeholder="请输入表单名称" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listForm, getForm, delForm, addForm, updateForm, exportForm } from "@/api/flowable/form";
import Editor from '@/components/Editor';
export default {
name: "Form",
components: {
Editor
},
data() {
return {
// 遮罩层
loading: true,
dialogVisible: false,
designerConfig: {
exportCodeButton: false, //是否显示导出代码按钮
},
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 流程表单表格数据
formList: [],
// 弹出层标题
title: "",
formRenderOpen: false,
formTitle: "",
formOpen: false,
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
formName: null,
formContent: null,
},
// 表单参数
form: {
formId: null,
formName: null,
formContent: null,
remark: null
},
// 表单校验
rules: {},
formData: {},
};
},
created() {
this.getList();
},
activated() {
const time = this.$route.query.t;
if (time != null) {
this.getList();
}
},
methods: {
/** 查询流程表单列表 */
getList() {
this.loading = true;
listForm(this.queryParams).then(response => {
this.formList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 表单重置
reset() {
this.form = {
formId: null,
formName: null,
formContent: null,
createTime: null,
updateTime: null,
createBy: null,
updateBy: null,
remark: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.formId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 表单配置信息 */
handleDetail(row) {
this.formRenderOpen = true;
this.formTitle = "表单详情";
this.$nextTick(() => {
// 回显数据
this.$refs.vFormRef.setFormJson(JSON.parse(row.formContent))
this.$nextTick(() => {
// 表单禁用
this.$refs.vFormRef.disableForm();
})
})
},
/** 新增按钮操作 */
handleAdd() {
// this.dialogVisible = true;
this.$router.push({ path: '/flowable/task/flowForm/index'})
},
// 保存表单数据
saveFormJson() {
let formJson = this.$refs.vfDesigner.getFormJson()
this.form.formContent = JSON.stringify(formJson);
this.formOpen = true;
},
// 取消按钮
cancel() {
this.formOpen = false;
this.reset();
},
handleClose(done) {
this.$confirm('确定要关闭吗?关闭未保存的修改都会丢失?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
done();
}).catch(() => {});
},
/** 修改按钮操作 */
handleUpdate(row) {
// this.form = row;
// this.dialogVisible = true;
// this.$nextTick(() => {
// // 加载表单json数据
// this.$refs.vfDesigner.setFormJson(JSON.parse(row.formContent))
// })
this.$router.push({ path: '/flowable/task/flowForm/index', query: {formId: row.formId }})
},
/** 重置表单 */
resetFormData() {
this.$refs.vFormRef.resetForm();
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.formId != null) {
updateForm(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.formOpen = false;
this.getList();
});
} else {
addForm(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.formOpen = false;
this.getList();
});
}
this.dialogVisible = false;
}
});
},
/** 提交按钮 */
submitFormData() {
this.$refs.vFormRef.getFormData().then(formData => {
// Form Validation OK
console.log(JSON.stringify(formData))
}).catch(error => {
// Form Validation failed
this.$modal.msgError(error)
})
},
/** 删除按钮操作 */
handleDelete(row) {
const formIds = row.formId || this.ids;
this.$confirm('是否确认删除表单编号为"' + formIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delForm(formIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
},
}
};
</script>
<style scoped>
.test-form {
margin: 15px auto;
width: 800px;
padding: 15px;
}
/deep/ .dialogClass .el-dialog__header {
padding: 0;
}
/deep/ .dialogClass .el-dialog__body {
padding: 0;
}
</style>

View File

@@ -0,0 +1,200 @@
<template>
<div class="app-container">
<el-card class="box-card" >
<div slot="header" class="clearfix">
<span class="el-icon-document">已发任务</span>
<el-button style="float: right;" size="mini" type="danger" @click="goBack">关闭</el-button>
</div>
<el-tabs tab-position="top" v-model="activeName" @tab-click="handleClick">
<!--表单信息-->
<el-tab-pane label="表单信息" name="1">
<el-col :span="16" :offset="4">
<v-form-render ref="vFormRef"/>
</el-col>
</el-tab-pane>
<!--流程流转记录-->
<el-tab-pane label="流转记录" name="2">
<el-col :span="16" :offset="4" >
<div class="block">
<el-timeline>
<el-timeline-item
v-for="(item,index ) in flowRecordList"
:key="index"
:icon="setIcon(item.finishTime)"
:color="setColor(item.finishTime)"
>
<p style="font-weight: 700">{{item.taskName}}</p>
<el-card :body-style="{ padding: '10px' }">
<el-descriptions class="margin-top" :column="1" size="small" border>
<el-descriptions-item v-if="item.assigneeName" label-class-name="my-label">
<template slot="label"><i class="el-icon-user"></i>办理人</template>
{{item.assigneeName}}
<el-tag type="info" size="mini">{{item.deptName}}</el-tag>
</el-descriptions-item>
<el-descriptions-item v-if="item.candidate" label-class-name="my-label">
<template slot="label"><i class="el-icon-user"></i>候选办理</template>
{{item.candidate}}
</el-descriptions-item>
<el-descriptions-item label-class-name="my-label">
<template slot="label"><i class="el-icon-date"></i>接收时间</template>
{{item.createTime}}
</el-descriptions-item>
<el-descriptions-item v-if="item.finishTime" label-class-name="my-label">
<template slot="label"><i class="el-icon-date"></i>处理时间</template>
{{item.finishTime}}
</el-descriptions-item>
<el-descriptions-item v-if="item.duration" label-class-name="my-label">
<template slot="label"><i class="el-icon-time"></i>耗时</template>
{{item.duration}}
</el-descriptions-item>
<el-descriptions-item v-if="item.comment" label-class-name="my-label">
<template slot="label"><i class="el-icon-tickets"></i>处理意见</template>
{{item.comment.comment}}
</el-descriptions-item>
</el-descriptions>
</el-card>
</el-timeline-item>
</el-timeline>
</div>
</el-col>
</el-tab-pane>
<!--流程图-->
<el-tab-pane label="流程图" name="3">
<bpmn-viewer :flowData="flowData" :procInsId="taskForm.procInsId"/>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script>
import {flowRecord} from "@/api/flowable/finished";
import {getProcessVariables, flowXmlAndNode} from "@/api/flowable/definition";
import BpmnViewer from '@/components/Process/viewer';
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Record",
components: {
BpmnViewer
},
props: {},
data() {
return {
// 模型xml数据
flowData: {},
activeName: '1',
// 查询参数
queryParams: {},
// 遮罩层
loading: true,
flowRecordList: [], // 流程流转数据
taskForm:{
multiple: false,
comment:"", // 意见内容
procInsId: "", // 流程实例编号
instanceId: "", // 流程实例编号
deployId: "", // 流程定义编号
taskId: "" ,// 流程任务编号
procDefId: "", // 流程编号
},
};
},
created() {
this.taskForm.deployId = this.$route.query && this.$route.query.deployId;
this.taskForm.taskId = this.$route.query && this.$route.query.taskId;
this.taskForm.procInsId = this.$route.query && this.$route.query.procInsId;
// 流程任务重获取变量表单
this.processVariables( this.taskForm.taskId)
this.getFlowRecordList(this.taskForm.procInsId, this.taskForm.deployId);
},
methods: {
handleClick(tab, event) {
if (tab.name === '3'){
flowXmlAndNode({procInsId:this.taskForm.procInsId,deployId:this.taskForm.deployId}).then(res => {
this.flowData = res.data;
})
}
},
setIcon(val) {
if (val) {
return "el-icon-check";
} else {
return "el-icon-time";
}
},
setColor(val) {
if (val) {
return "#2bc418";
} else {
return "#b3bdbb";
}
},
/** 流程流转记录 */
getFlowRecordList(procInsId, deployId) {
const that = this
const params = {procInsId: procInsId, deployId: deployId}
flowRecord(params).then(res => {
that.flowRecordList = res.data.flowList;
}).catch(res => {
this.goBack();
})
},
/** 获取流程变量内容 */
processVariables(taskId) {
if (taskId) {
// 提交流程申请时填写的表单存入了流程变量中后续任务处理时需要展示
getProcessVariables(taskId).then(res => {
this.$nextTick(() => {
// 回显表单
this.$refs.vFormRef.setFormJson(res.data.formJson);
this.$nextTick(() => {
// 加载表单填写的数据
this.$refs.vFormRef.setFormData(res.data);
this.$nextTick(() => {
// 表单禁用
this.$refs.vFormRef.disableForm();
})
})
})
});
}
},
/** 返回页面 */
goBack() {
// 关闭当前标签页并返回上个页面
const obj = { path: "/task/process", query: { t: Date.now()} };
this.$tab.closeOpenPage(obj);
},
}
};
</script>
<style lang="scss" scoped>
.test-form {
margin: 15px auto;
width: 800px;
padding: 15px;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both
}
.box-card {
width: 100%;
margin-bottom: 20px;
}
.el-tag + .el-tag {
margin-left: 10px;
}
.my-label {
background: #E1F3D8;
}
</style>

View File

@@ -0,0 +1,377 @@
<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-input
v-model="queryParams.name"
placeholder="请输入名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="开始时间" prop="deployTime">
<el-date-picker clearable size="small"
v-model="queryParams.deployTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:deployment:add']"
>新增流程</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:deployment:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="myProcessList" border @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="流程编号" align="center" prop="procInsId" :show-overflow-tooltip="true"/>
<el-table-column label="流程名称" align="center" prop="procDefName" :show-overflow-tooltip="true"/>
<el-table-column label="流程类别" align="center" prop="category" width="100px" />
<el-table-column label="流程版本" align="center" width="80px">
<template slot-scope="scope">
<el-tag size="medium" >v{{ scope.row.procDefVersion }}</el-tag>
</template>
</el-table-column>
<el-table-column label="提交时间" align="center" prop="createTime" width="180"/>
<el-table-column label="流程状态" align="center" width="100">
<template slot-scope="scope">
<el-tag v-if="scope.row.finishTime == null" size="mini">进行中</el-tag>
<el-tag type="success" v-if="scope.row.finishTime != null" size="mini">已完成</el-tag>
</template>
</el-table-column>
<el-table-column label="耗时" align="center" prop="duration" width="180"/>
<el-table-column label="当前节点" align="center" prop="taskName"/>
<el-table-column label="办理人" align="center">
<template slot-scope="scope">
<label v-if="scope.row.assigneeName">{{scope.row.assigneeName}} <el-tag type="info" size="mini">{{scope.row.assigneeDeptName}}</el-tag></label>
<!-- <label v-if="scope.row.candidate">{{scope.row.candidate}}</label>-->
</template>
</el-table-column>
<el-table-column label="操作" width="150" fixed="right" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button @click="handleFlowRecord(scope.row)" type="text" size="small">详情</el-button>
<el-button @click="handleStop(scope.row)" type="text" size="small">取消申请</el-button>
<el-button @click="handleDelete(scope.row)" type="text" size="small" v-hasPermi="['system:deployment:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 发起流程 -->
<el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
<el-form :model="queryProcessParams" ref="queryProcessForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="名称" prop="name">
<el-input
v-model="queryProcessParams.name"
placeholder="请输入名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleProcessQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetProcessQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="processLoading" fit :data="definitionList" border >
<el-table-column label="流程名称" align="center" prop="name" />
<el-table-column label="流程版本" align="center">
<template slot-scope="scope">
<el-tag size="medium" >v{{ scope.row.version }}</el-tag>
</template>
</el-table-column>
<el-table-column label="流程分类" align="center" prop="category" />
<el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit-outline"
@click="handleStartProcess(scope.row)"
>发起流程</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="processTotal>0"
:total="processTotal"
:page.sync="queryProcessParams.pageNum"
:limit.sync="queryProcessParams.pageSize"
@pagination="listDefinition"
/>
</el-dialog>
</div>
</template>
<script>
import {
getDeployment,
delDeployment,
addDeployment,
updateDeployment,
exportDeployment,
flowRecord
} from "@/api/flowable/finished";
import { myProcessList,stopProcess } from "@/api/flowable/process";
import {listDefinition} from "@/api/flowable/definition";
export default {
name: "Deploy",
components: {
},
data() {
return {
// 遮罩层
loading: true,
processLoading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
processTotal:0,
// 我发起的流程列表数据
myProcessList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
src: "",
definitionList:[],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
category: null,
key: null,
tenantId: null,
deployTime: null,
derivedFrom: null,
derivedFromRoot: null,
parentDeploymentId: null,
engineVersion: null
},
// 查询参数
queryProcessParams: {
pageNum: 1,
pageSize: 10,
name: null,
category: null,
key: null,
tenantId: null,
deployTime: null,
derivedFrom: null,
derivedFromRoot: null,
parentDeploymentId: null,
engineVersion: null
},
// 表单参数
form: {},
// 表单校验
rules: {
},
};
},
created() {
this.getList();
},
methods: {
/** 查询流程定义列表 */
getList() {
this.loading = true;
myProcessList(this.queryParams).then(response => {
this.myProcessList = response.data.records;
this.total = response.data.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
category: null,
key: null,
tenantId: null,
deployTime: null,
derivedFrom: null,
derivedFromRoot: null,
parentDeploymentId: null,
engineVersion: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 搜索按钮操作 */
handleProcessQuery() {
this.queryProcessParams.pageNum = 1;
this.listDefinition();
},
/** 重置按钮操作 */
resetProcessQuery() {
this.resetForm("queryProcessForm");
this.handleProcessQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.procInsId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.open = true;
this.title = "发起流程";
this.listDefinition();
},
listDefinition(){
listDefinition(this.queryProcessParams).then(response => {
this.definitionList = response.data.records;
this.processTotal = response.data.total;
this.processLoading = false;
});
},
/** 发起流程申请 */
handleStartProcess(row){
this.$router.push({ path: '/flowable/task/myProcess/send/index',
query: {
deployId: row.deploymentId,
procDefId: row.id
}
})
},
/** 取消流程申请 */
handleStop(row){
const params = {
instanceId: row.procInsId
}
stopProcess(params).then( res => {
this.$modal.msgSuccess(res.msg);
this.getList();
});
},
/** 流程流转记录 */
handleFlowRecord(row){
this.$router.push({ path: '/flowable/task/myProcess/detail/index',
query: {
procInsId: row.procInsId,
deployId: row.deployId,
taskId: row.taskId
}})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getDeployment(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改流程定义";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDeployment(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDeployment(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.procInsId || this.ids;// 暂不支持删除多个流程
this.$confirm('是否确认删除流程定义编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
return delDeployment(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有流程定义数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
return exportDeployment(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>

View File

@@ -0,0 +1,249 @@
<template>
<div class="app-container">
<el-card class="box-card" >
<div slot="header" class="clearfix">
<span class="el-icon-document">发起任务</span>
<el-button style="float: right;" size="mini" type="danger" @click="goBack">关闭</el-button>
</div>
<el-tabs tab-position="top" v-model="activeName" @tab-click="handleClick">
<!--表单信息-->
<el-tab-pane label="表单信息" name="1">
<!--初始化流程加载表单信息-->
<el-col :span="16" :offset="4">
<v-form-render :form-data="formRenderData" ref="vFormRef"/>
<div style="margin-left:15%;margin-bottom: 20px;font-size: 14px;">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button type="primary" @click="resetForm"> </el-button>
</div>
</el-col>
</el-tab-pane>
<!--流程图-->
<el-tab-pane label="流程图" name="2">
<bpmn-viewer :flowData="flowData"/>
</el-tab-pane>
</el-tabs>
<!--选择流程接收人-->
<el-dialog :title="taskTitle" :visible.sync="taskOpen" width="65%" append-to-body>
<flow-user v-if="checkSendUser" :checkType="checkType" @handleUserSelect="handleUserSelect"/>
<flow-role v-if="checkSendRole" @handleRoleSelect="handleRoleSelect"/>
<span slot="footer" class="dialog-footer">
<el-button @click="taskOpen = false"> </el-button>
<el-button type="primary" @click="submitTask"> </el-button>
</span>
</el-dialog>
</el-card>
</div>
</template>
<script>
import {definitionStart, flowXmlAndNode} from "@/api/flowable/definition";
import BpmnViewer from '@/components/Process/viewer';
import {flowFormData} from "@/api/flowable/process";
import {getNextFlowNodeByStart} from "@/api/flowable/todo";
import FlowUser from '@/components/flow/User'
import FlowRole from '@/components/flow/Role'
export default {
name: "Record",
components: {
BpmnViewer,
FlowUser,
FlowRole,
},
props: {},
data() {
return {
// 模型xml数据
flowData: {},
activeName: '1', // 切换tab标签
// 查询参数
queryParams: {
deptId: undefined
},
// 遮罩层
loading: true,
deployId: "", // 流程定义编号
procDefId: "", // 流程实例编号
formRenderData: {},
variables: [], // 流程变量数据
taskTitle: null,
taskOpen: false,
checkSendUser: false, // 是否展示人员选择模块
checkSendRole: false,// 是否展示角色选择模块
checkType: '', // 选择类型
checkValues: null, // 选中任务接收人员数据
formData: {}, // 填写的表单数据,
multiInstanceVars: '', // 会签节点
formJson: {} // 表单json
};
},
created() {
this.deployId = this.$route.query && this.$route.query.deployId;
// 初始化表单
this.procDefId = this.$route.query && this.$route.query.procDefId;
// this.getNextFlowNodeByStart(this.deployId);
this.getFlowFormData(this.deployId);
},
methods: {
handleClick(tab, event) {
if (tab.name === '2'){
flowXmlAndNode({deployId:this.deployId}).then(res => {
this.flowData = res.data;
})
}
},
/** 流程表单数据 */
getFlowFormData(deployId) {
const params = {deployId: deployId}
flowFormData(params).then(res => {
// 流程过程中不存在初始化表单 直接读取的流程变量中存储的表单值
this.$nextTick(() => {
// 回显数据
this.$refs.vFormRef.setFormJson(res.data);
this.formJson = res.data;
})
}).catch(res => {
this.goBack();
})
},
/** 返回页面 */
goBack() {
// 关闭当前标签页并返回上个页面
const obj = { path: "/task/process", query: { t: Date.now()} };
this.$tab.closeOpenPage(obj);
},
/** 申请流程表单数据提交 */
submitForm() {
this.$refs.vFormRef.getFormData().then(formData => {
// 根据当前任务或者流程设计配置的下一步节点 todo 暂时未涉及到考虑网关、表达式和多节点情况
getNextFlowNodeByStart({deploymentId: this.deployId, variables: formData}).then(res => {
const data = res.data;
if (data) {
this.formData = formData;
if (data.dataType === 'dynamic') {
if (data.type === 'assignee') { // 指定人员
this.checkSendUser = true;
this.checkType = "single";
} else if (data.type === 'candidateUsers') { // 候选人员(多个)
this.checkSendUser = true;
this.checkType = "multiple";
} else if (data.type === 'candidateGroups') { // 指定组(所属角色接收任务)
this.checkSendRole = true;
} else { // 会签
// 流程设计指定的 elementVariable 作为会签人员列表
this.multiInstanceVars = data.vars;
this.checkSendUser = true;
this.checkType = "multiple";
}
this.taskOpen = true;
this.taskTitle = "选择任务接收";
} else {
if (this.procDefId) {
const param = {
formJson: this.formJson,
}
// 复制对象的属性值给新的对象
Object.assign(param, formData);
// 启动流程并将表单数据加入流程变量
definitionStart(this.procDefId, param).then(res => {
this.$modal.msgSuccess(res.msg);
this.goBack();
})
}
}
}
})
}).catch(error => {
// this.$modal.msgError(error)
})
},
/** 重置表单 */
resetForm() {
this.$refs.vFormRef.resetForm();
},
/** 提交流程 */
submitTask() {
if (!this.checkValues && this.checkSendUser){
this.$modal.msgError("请选择任务接收!");
return;
}
if (!this.checkValues && this.checkSendRole){
this.$modal.msgError("请选择流程接收角色组!");
return;
}
if (this.formData) {
const param = {
formJson: this.formJson,
}
// 复制对象的属性值给新的对象
Object.assign(param, this.formData);
if (this.multiInstanceVars) {
this.$set(param, this.multiInstanceVars, this.checkValues);
} else {
this.$set(param, "approval", this.checkValues);
}
// 启动流程并将表单数据加入流程变量
definitionStart(this.procDefId, param).then(res => {
this.$modal.msgSuccess(res.msg);
this.goBack();
})
}
},
// 用户信息选中数据
handleUserSelect(selection) {
if (selection) {
if (selection instanceof Array) {
const selectVal = selection.map(item => item.userId);
if (this.multiInstanceVars) {
this.checkValues = selectVal;
} else {
this.checkValues = selectVal.join(',');
}
} else {
this.checkValues = selection.userId;
}
}
},
// 角色信息选中数据
handleRoleSelect(selection) {
if (selection) {
if (selection instanceof Array) {
const selectVal = selection.map(item => item.roleId);
this.checkValues = selectVal.join(',')
} else {
this.checkValues = selection;
}
}
},
}
};
</script>
<style lang="scss" scoped>
.test-form {
margin: 15px auto;
width: 800px;
padding: 15px;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both
}
.box-card {
width: 100%;
margin-bottom: 20px;
}
.el-tag + .el-tag {
margin-left: 10px;
}
.my-label {
background: #E1F3D8;
}
</style>

View File

@@ -0,0 +1,461 @@
<template>
<div class="app-container">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span class="el-icon-document">待办任务</span>
<el-tag style="margin-left:10px">发起人:{{ startUser }}</el-tag>
<el-tag>任务节点:{{ taskName }}</el-tag>
<el-button style="float: right;" size="mini" type="danger" @click="goBack">关闭</el-button>
</div>
<el-tabs tab-position="top" v-model="activeName" @tab-click="handleClick">
<!--表单信息-->
<el-tab-pane label="表单信息" name="1">
<el-col :span="16" :offset="4">
<v-form-render ref="vFormRef"/>
<div style="margin-left:10%;margin-bottom: 20px;font-size: 14px;">
<el-button type="primary" @click="handleComplete"> </el-button>
</div>
</el-col>
</el-tab-pane>
<!--流程流转记录-->
<el-tab-pane label="流转记录" name="2">
<!--flowRecordList-->
<el-col :span="16" :offset="4">
<div class="block">
<el-timeline>
<el-timeline-item
v-for="(item,index ) in flowRecordList"
:key="index"
:icon="setIcon(item.finishTime)"
:color="setColor(item.finishTime)"
>
<p style="font-weight: 700">{{ item.taskName }}</p>
<el-card :body-style="{ padding: '10px' }">
<el-descriptions class="margin-top" :column="1" size="small" border>
<el-descriptions-item v-if="item.assigneeName" label-class-name="my-label">
<template slot="label"><i class="el-icon-user"></i>办理人</template>
{{ item.assigneeName }}
<el-tag type="info" size="mini">{{ item.deptName }}</el-tag>
</el-descriptions-item>
<el-descriptions-item v-if="item.candidate" label-class-name="my-label">
<template slot="label"><i class="el-icon-user"></i>候选办理</template>
{{ item.candidate }}
</el-descriptions-item>
<el-descriptions-item label-class-name="my-label">
<template slot="label"><i class="el-icon-date"></i>接收时间</template>
{{ item.createTime }}
</el-descriptions-item>
<el-descriptions-item v-if="item.finishTime" label-class-name="my-label">
<template slot="label"><i class="el-icon-date"></i>处理时间</template>
{{ item.finishTime }}
</el-descriptions-item>
<el-descriptions-item v-if="item.duration" label-class-name="my-label">
<template slot="label"><i class="el-icon-time"></i>耗时</template>
{{ item.duration }}
</el-descriptions-item>
<el-descriptions-item v-if="item.comment" label-class-name="my-label">
<template slot="label"><i class="el-icon-tickets"></i>处理意见</template>
{{ item.comment.comment }}
</el-descriptions-item>
</el-descriptions>
</el-card>
</el-timeline-item>
</el-timeline>
</div>
</el-col>
</el-tab-pane>
<!--流程图-->
<el-tab-pane label="流程图" name="3">
<bpmn-viewer :flowData="flowData" :procInsId="taskForm.procInsId"/>
</el-tab-pane>
</el-tabs>
<!--审批任务-->
<el-dialog :title="completeTitle" :visible.sync="completeOpen" width="60%" append-to-body>
<el-form ref="taskForm" :model="taskForm">
<el-form-item prop="targetKey">
<flow-user v-if="checkSendUser" :checkType="checkType" @handleUserSelect="handleUserSelect"></flow-user>
<flow-role v-if="checkSendRole" @handleRoleSelect="handleRoleSelect"></flow-role>
</el-form-item>
<el-form-item label="处理意见" label-width="80px" prop="comment"
:rules="[{ required: true, message: '请输入处理意见', trigger: 'blur' }]">
<el-input type="textarea" v-model="taskForm.comment" placeholder="请输入处理意见"/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="completeOpen = false"> </el-button>
<el-button type="primary" @click="taskComplete"> </el-button>
</span>
</el-dialog>
<!--退回流程-->
<el-dialog :title="returnTitle" :visible.sync="returnOpen" width="40%" append-to-body>
<el-form ref="taskForm" :model="taskForm" label-width="80px">
<el-form-item label="退回节点" prop="targetKey">
<el-radio-group v-model="taskForm.targetKey">
<el-radio-button
v-for="item in returnTaskList"
:key="item.id"
:label="item.id"
>{{ item.name }}
</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="退回意见" prop="comment"
:rules="[{ required: true, message: '请输入意见', trigger: 'blur' }]">
<el-input style="width: 50%" type="textarea" v-model="taskForm.comment" placeholder="请输入意见"/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="returnOpen = false"> </el-button>
<el-button type="primary" @click="taskReturn"> </el-button>
</span>
</el-dialog>
<!--驳回流程-->
<el-dialog :title="rejectTitle" :visible.sync="rejectOpen" width="40%" append-to-body>
<el-form ref="taskForm" :model="taskForm" label-width="80px">
<el-form-item label="驳回意见" prop="comment"
:rules="[{ required: true, message: '请输入意见', trigger: 'blur' }]">
<el-input style="width: 50%" type="textarea" v-model="taskForm.comment" placeholder="请输入意见"/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="rejectOpen = false"> </el-button>
<el-button type="primary" @click="taskReject"> </el-button>
</span>
</el-dialog>
</el-card>
</div>
</template>
<script>
import {flowRecord} from "@/api/flowable/finished";
import FlowUser from '@/components/flow/User'
import FlowRole from '@/components/flow/Role'
import {flowXmlAndNode} from "@/api/flowable/definition";
import {
complete,
rejectTask,
returnList,
returnTask,
getNextFlowNode,
delegate,
flowTaskForm
} from "@/api/flowable/todo";
import BpmnViewer from '@/components/Process/viewer';
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Record",
components: {
BpmnViewer,
FlowUser,
FlowRole,
},
props: {},
data() {
return {
eventName: "click",
// 流程数据
flowData: {},
activeName: '1',
// 遮罩层
loading: true,
flowRecordList: [], // 流程流转数据
rules: {}, // 表单校验
taskForm: {
returnTaskShow: false, // 是否展示回退表单
delegateTaskShow: false, // 是否展示回退表单
defaultTaskShow: true, // 默认处理
comment: "", // 意见内容
procInsId: "", // 流程实例编号
instanceId: "", // 流程实例编号
deployId: "", // 流程定义编号
taskId: "",// 流程任务编号
procDefId: "", // 流程编号
targetKey: "",
variables: {},
},
returnTaskList: [], // 回退列表数据
completeTitle: null,
completeOpen: false,
returnTitle: null,
returnOpen: false,
rejectOpen: false,
rejectTitle: null,
checkSendUser: false, // 是否展示人员选择模块
checkSendRole: false,// 是否展示角色选择模块
checkType: 'single', // 选择类型
taskName: null, // 任务节点
startUser: null, // 发起人信息,
multiInstanceVars: '', // 会签节点
formJson:{}
};
},
created() {
if (this.$route.query) {
this.taskName = this.$route.query.taskName;
this.startUser = this.$route.query.startUser;
this.taskForm.deployId = this.$route.query.deployId;
this.taskForm.taskId = this.$route.query.taskId;
this.taskForm.procInsId = this.$route.query.procInsId;
this.taskForm.executionId = this.$route.query.executionId;
this.taskForm.instanceId = this.$route.query.procInsId;
// 流程任务获取变量信息
if (this.taskForm.taskId) {
this.getFlowTaskForm(this.taskForm.taskId);
}
this.getFlowRecordList(this.taskForm.procInsId, this.taskForm.deployId);
}
},
methods: {
handleClick(tab, event) {
if (tab.name === '3') {
flowXmlAndNode({procInsId: this.taskForm.procInsId, deployId: this.taskForm.deployId}).then(res => {
this.flowData = res.data;
})
}
},
setIcon(val) {
if (val) {
return "el-icon-check";
} else {
return "el-icon-time";
}
},
setColor(val) {
if (val) {
return "#2bc418";
} else {
return "#b3bdbb";
}
},
// 用户信息选中数据
handleUserSelect(selection) {
if (selection) {
if (selection instanceof Array) {
const selectVal = selection.map(item => item.userId.toString());
if (this.multiInstanceVars) {
this.$set(this.taskForm.variables, this.multiInstanceVars, selectVal);
} else {
this.$set(this.taskForm.variables, "approval", selectVal.join(','));
}
} else {
this.$set(this.taskForm.variables, "approval", selection.userId.toString());
}
}
},
// 角色信息选中数据
handleRoleSelect(selection, roleName) {
if (selection) {
if (selection instanceof Array) {
const selectVal = selection.map(item => item.roleId.toString());
this.$set(this.taskForm.variables, "approval", selectVal.join(','));
} else {
this.$set(this.taskForm.variables, "approval", selection);
}
}
},
/** 流程流转记录 */
getFlowRecordList(procInsId, deployId) {
const that = this
const params = {procInsId: procInsId, deployId: deployId}
flowRecord(params).then(res => {
that.flowRecordList = res.data.flowList;
}).catch(res => {
this.goBack();
})
},
/** 流程节点表单 */
getFlowTaskForm(taskId) {
if (taskId) {
// 提交流程申请时填写的表单存入了流程变量中后续任务处理时需要展示
flowTaskForm({taskId: taskId}).then(res => {
// 回显表单
this.$refs.vFormRef.setFormJson(res.data.formJson);
this.formJson = res.data.formJson;
this.$nextTick(() => {
// 加载表单填写的数据
this.$refs.vFormRef.setFormData(res.data);
// this.$nextTick(() => {
// // 表单禁用
// this.$refs.vFormRef.disableForm();
// })
})
});
}
},
/** 委派任务 */
handleDelegate() {
this.taskForm.delegateTaskShow = true;
this.taskForm.defaultTaskShow = false;
},
handleAssign() {
},
/** 返回页面 */
goBack() {
// 关闭当前标签页并返回上个页面
const obj = { path: "/task/todo", query: { t: Date.now()} };
this.$tab.closeOpenPage(obj);
},
/** 驳回任务 */
handleReject() {
this.rejectOpen = true;
this.rejectTitle = "驳回流程";
},
/** 驳回任务 */
taskReject() {
this.$refs["taskForm"].validate(valid => {
if (valid) {
rejectTask(this.taskForm).then(res => {
this.$modal.msgSuccess(res.msg);
this.goBack();
});
}
});
},
/** 可退回任务列表 */
handleReturn() {
this.returnOpen = true;
this.returnTitle = "退回流程";
returnList(this.taskForm).then(res => {
this.returnTaskList = res.data;
})
},
/** 提交退回任务 */
taskReturn() {
this.$refs["taskForm"].validate(valid => {
if (valid) {
returnTask(this.taskForm).then(res => {
this.$modal.msgSuccess(res.msg);
this.goBack()
});
}
});
},
/** 取消回退任务按钮 */
cancelTask() {
this.taskForm.returnTaskShow = false;
this.taskForm.defaultTaskShow = true;
this.returnTaskList = [];
},
/** 委派任务 */
submitDeleteTask() {
this.$refs["taskForm"].validate(valid => {
if (valid) {
delegate(this.taskForm).then(response => {
this.$modal.msgSuccess(response.msg);
this.goBack();
});
}
});
},
/** 取消回退任务按钮 */
cancelDelegateTask() {
this.taskForm.delegateTaskShow = false;
this.taskForm.defaultTaskShow = true;
this.returnTaskList = [];
},
/** 加载审批任务弹框 */
handleComplete() {
this.completeOpen = true;
this.completeTitle = "流程审批";
this.submitForm();
},
/** 用户审批任务 */
taskComplete() {
if (!this.taskForm.variables && this.checkSendUser) {
this.$modal.msgError("请选择流程接收人员!");
return;
}
if (!this.taskForm.variables && this.checkSendRole) {
this.$modal.msgError("请选择流程接收角色组!");
return;
}
if (!this.taskForm.comment) {
this.$modal.msgError("请输入审批意见!");
return;
}
if (this.taskForm) {
complete(this.taskForm).then(response => {
this.$modal.msgSuccess(response.msg);
this.goBack();
});
} else {
complete(this.taskForm).then(response => {
this.$modal.msgSuccess(response.msg);
this.goBack();
});
}
},
/** 申请流程表单数据提交 */
submitForm() {
// 根据当前任务或者流程设计配置的下一步节点 todo 暂时未涉及到考虑网关、表达式和多节点情况
const params = {taskId: this.taskForm.taskId}
getNextFlowNode(params).then(res => {
this.$refs.vFormRef.getFormData().then(formData => {
Object.assign(this.taskForm.variables, formData);
this.taskForm.variables.formJson = this.formJson;
console.log(this.taskForm, "流程审批提交表单数据1")
}).catch(error => {
// this.$modal.msgError(error)
})
const data = res.data;
if (data) {
if (data.dataType === 'dynamic') {
if (data.type === 'assignee') { // 指定人员
this.checkSendUser = true;
this.checkType = "single";
} else if (data.type === 'candidateUsers') { // 候选人员(多个)
this.checkSendUser = true;
this.checkType = "multiple";
} else if (data.type === 'candidateGroups') { // 指定组(所属角色接收任务)
this.checkSendRole = true;
} else { // 会签
// 流程设计指定的 elementVariable 作为会签人员列表
this.multiInstanceVars = data.vars;
this.checkSendUser = true;
this.checkType = "multiple";
}
}
}
})
},
// 动态绑定操作按钮的点击事件
handleButtonClick(method) {
this[method]();
}
},
};
</script>
<style lang="scss" scoped>
.test-form {
margin: 15px auto;
width: 800px;
padding: 15px;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both
}
.box-card {
width: 100%;
margin-bottom: 20px;
}
.el-tag + .el-tag {
margin-left: 10px;
}
.my-label {
background: #E1F3D8;
}
</style>

View File

@@ -0,0 +1,209 @@
<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-input
v-model="queryParams.name"
placeholder="请输入名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="开始时间" prop="deployTime">
<el-date-picker clearable size="small"
v-model="queryParams.deployTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:deployment:remove']"
>删除
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="todoList" border @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="任务编号" align="center" prop="taskId" :show-overflow-tooltip="true"/>
<el-table-column label="流程名称" align="center" prop="procDefName"/>
<el-table-column label="当前节点" align="center" prop="taskName"/>
<el-table-column label="流程版本" align="center">
<template slot-scope="scope">
<el-tag size="medium" >v{{scope.row.procDefVersion}}</el-tag>
</template>
</el-table-column>
<el-table-column label="流程发起人" align="center">
<template slot-scope="scope">
<label>{{scope.row.startUserName}} <el-tag type="info" size="mini">{{scope.row.startDeptName}}</el-tag></label>
</template>
</el-table-column>
<el-table-column label="接收时间" align="center" prop="createTime" width="180"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit-outline"
@click="handleProcess(scope.row)"
>处理
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import {
todoList,
complete,
returnList,
returnTask,
rejectTask,
getDeployment,
delDeployment,
exportDeployment
} from "@/api/flowable/todo";
export default {
name: "Deploy",
components: {},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 流程待办任务表格数据
todoList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
category: null
},
// 表单参数
form: {},
// 表单校验
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询流程定义列表 */
getList() {
this.loading = true;
todoList(this.queryParams).then(response => {
this.todoList = response.data.records;
this.total = response.data.total;
this.loading = false;
});
},
// 跳转到处理页面
handleProcess(row){
this.$router.push({ path: '/flowable/task/todo/detail/index',
query: {
procInsId: row.procInsId,
executionId: row.executionId,
deployId: row.deployId,
taskId: row.taskId,
taskName: row.taskName,
startUser: row.startUserName + '-' + row.startDeptName,
}})
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
category: null,
key: null,
tenantId: null,
deployTime: null,
derivedFrom: null,
derivedFromRoot: null,
parentDeploymentId: null,
engineVersion: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.taskId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.taskId || this.ids;
this.$confirm('是否确认删除流程定义编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return delDeployment(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
},
}
};
</script>