流程编辑
This commit is contained in:
1 parent
7751704fe7
commit
696457321b
6 files changed
+915
-313
No files matched your search
@@ -1,92 +1,208 @@
|
||||
<template id="edit-node">
|
||||
<v-form v-model="isFormValid" ref="dataForm" lazy-validation>
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<v-row class="ma-0 pa-0">
|
||||
<v-col cols="12" class="ma-0 pa-0 mb-1">
|
||||
<span class="jh-input-label">GUID</span>
|
||||
<v-text-field class="jh-v-input" dense filled single-line disabled label="GUID" v-model="node.id"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-col cols="12" class="ma-0 pa-0 mb-1">
|
||||
<span class="jh-input-label">名称</span>
|
||||
<v-text-field class="jh-v-input" dense filled single-line label="名称" v-model="node.label"></v-text-field>
|
||||
<v-text-field class="jh-v-input" dense filled single-line label="名称" v-model="node.label" :disabled="node.type == 'start' || node.type == 'end'"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<span class="jh-input-label">备注说明</span>
|
||||
<v-text-field class="jh-v-input" dense filled single-line label="备注说明" v-model="node.Remark"></v-text-field>
|
||||
</v-col>
|
||||
<template v-if="!node.id.includes('start-') && !node.id.includes('end-')">
|
||||
|
||||
<v-col cols="12">
|
||||
<span class="jh-input-label">指派类型</span>
|
||||
|
||||
<!-- 审批节点 -->
|
||||
<template v-if="node.type == 'approvalTask'">
|
||||
<v-col cols="12" class="ma-0 pa-0 mb-1">
|
||||
<span class="jh-input-label">审批人类型</span>
|
||||
<v-select
|
||||
:items="assignTypeList"
|
||||
:items="constantObj.approverTypes"
|
||||
dense filled single-line
|
||||
item-text="text"
|
||||
color="success"
|
||||
item-color="success"
|
||||
item-value="value"
|
||||
class="jh-v-input"
|
||||
label="指派类型"
|
||||
v-model="node.assignType"
|
||||
label="审批人类型"
|
||||
v-model="node.approverType"
|
||||
@change="clearUser"
|
||||
></v-select>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<span class="jh-input-label">指派</span>
|
||||
<v-autocomplete
|
||||
class="jh-v-input"
|
||||
dense filled single-line clearable
|
||||
:items="optionList"
|
||||
<template v-if="node.approverType == '指定上级'">
|
||||
<v-col cols="12" class="ma-0 pa-0 mb-1">
|
||||
<span class="jh-input-label">指定上级</span>
|
||||
<v-select
|
||||
:items="constantObj.superiors"
|
||||
dense filled single-line
|
||||
item-text="text"
|
||||
item-value="value"
|
||||
:label="assignType"
|
||||
:multiple="node.assignType === 'person'"
|
||||
v-model="node.assignValue"
|
||||
:disabled="!node.assignType">
|
||||
</v-autocomplete>
|
||||
</v-col>
|
||||
<v-col cols="12" v-if="mode == 'serial'">
|
||||
<span class="jh-input-label">允许的操作(英文逗号分隔)</span>
|
||||
<v-text-field class="jh-v-input" dense filled single-line label="允许的操作(英文逗号分隔)" v-model="node.lineTypeList"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" >
|
||||
<span class="jh-input-label">可写模板</span>
|
||||
class="jh-v-input"
|
||||
v-model="node.user"
|
||||
multiple
|
||||
></v-select>
|
||||
</v-col>
|
||||
</template>
|
||||
<template v-if="node.approverType == '指定部门负责人'">
|
||||
<v-col cols="12" class="ma-0 pa-0 mb-1">
|
||||
<span class="jh-input-label">指定部门负责人</span>
|
||||
<v-select
|
||||
:items="constantObj.deptHeaders"
|
||||
dense filled single-line
|
||||
item-text="text"
|
||||
item-value="value"
|
||||
class="jh-v-input"
|
||||
v-model="node.user"
|
||||
multiple
|
||||
></v-select>
|
||||
</v-col>
|
||||
</template>
|
||||
<template v-if="node.approverType == '指定标签'">
|
||||
<v-col cols="12" class="ma-0 pa-0 mb-1">
|
||||
<span class="jh-input-label">指定标签</span>
|
||||
<v-select
|
||||
:items="label"
|
||||
dense filled single-line
|
||||
item-text="labelName"
|
||||
item-value="labelId"
|
||||
class="jh-v-input"
|
||||
v-model="node.user"
|
||||
multiple
|
||||
></v-select>
|
||||
</v-col>
|
||||
</template>
|
||||
<template v-if="node.approverType == '指定人员'">
|
||||
<v-col cols="12" class="ma-0 pa-0 mb-1">
|
||||
<span class="jh-input-label">指定人员</span>
|
||||
<v-select
|
||||
:items="user"
|
||||
dense filled single-line
|
||||
item-text="username"
|
||||
item-value="userId"
|
||||
class="jh-v-input"
|
||||
v-model="node.user"
|
||||
multiple
|
||||
></v-select>
|
||||
</v-col>
|
||||
</template>
|
||||
<v-col cols="12" class="ma-0 pa-0 mb-1">
|
||||
<span class="jh-input-label">多人审批方式</span>
|
||||
<v-select
|
||||
:items="tpl"
|
||||
dense filled single-line
|
||||
item-text="text"
|
||||
color="success"
|
||||
item-color="success"
|
||||
item-value="value"
|
||||
class="jh-v-input"
|
||||
label="可写模板"
|
||||
multiple
|
||||
v-model="node.formIdEdit"
|
||||
></v-select>
|
||||
</v-col>
|
||||
<v-col cols="12" >
|
||||
<span class="jh-input-label">隐藏模板</span>
|
||||
<v-select
|
||||
:items="tpl"
|
||||
:items="constantObj.approvalTypes"
|
||||
dense filled single-line
|
||||
item-text="text"
|
||||
item-value="value"
|
||||
color="success"
|
||||
item-color="success"
|
||||
class="jh-v-input"
|
||||
label="隐藏模板"
|
||||
multiple
|
||||
v-model="node.formIdHidden"
|
||||
label="多人审批方式"
|
||||
v-model="node.approvalType"
|
||||
></v-select>
|
||||
</v-col>
|
||||
</template>
|
||||
<template v-if="node.id.includes('end-')">
|
||||
<v-col cols="12">
|
||||
<span class="jh-input-label">流程完成Hook</span>
|
||||
<v-text-field class="jh-v-input" dense filled single-line label="流程完成Hook" v-model="node.finishHook"></v-text-field>
|
||||
<!-- 抄送节点 -->
|
||||
<template v-if="node.type == 'noticeTask'">
|
||||
<v-col cols="12" class="ma-0 pa-0 mb-1">
|
||||
<span class="jh-input-label">抄送人类型</span>
|
||||
<v-select
|
||||
:items="constantObj.noticerTypes"
|
||||
dense filled single-line
|
||||
item-text="text"
|
||||
item-value="value"
|
||||
class="jh-v-input"
|
||||
label="抄送人类型"
|
||||
v-model="node.noticerType"
|
||||
@change="doUiAction('clearUser')"
|
||||
></v-select>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<span class="jh-input-label">流程中断Hook</span>
|
||||
<v-text-field class="jh-v-input" dense filled single-line label="流程中断Hook" v-model="node.interruptHook"></v-text-field>
|
||||
<template v-if="node.noticerType == '指定人员'">
|
||||
<v-col cols="12" class="ma-0 pa-0 mb-1">
|
||||
<span class="jh-input-label">指定人员</span>
|
||||
<v-select
|
||||
:items="user"
|
||||
dense filled single-line
|
||||
item-text="username"
|
||||
item-value="userId"
|
||||
class="jh-v-input"
|
||||
v-model="node.user"
|
||||
multiple
|
||||
></v-select>
|
||||
</v-col>
|
||||
</template>
|
||||
</template>
|
||||
<!-- 条件节点 -->
|
||||
<template v-if="node.type == 'conditionTask'">
|
||||
<v-col cols="12" class="ma-0 pa-0 mb-1">
|
||||
<span class="jh-input-label">优先级</span>
|
||||
<v-select
|
||||
:items="prioritys"
|
||||
dense filled single-line
|
||||
item-text="text"
|
||||
item-value="priority"
|
||||
class="jh-v-input"
|
||||
label="审批人类型"
|
||||
v-model="node.priority"
|
||||
></v-select>
|
||||
</v-col>
|
||||
<v-col cols="12" class="ma-0 pa-0 mb-1" v-if="node.priority && node.priority != -1">
|
||||
<span class="jh-input-label">条件组</span>
|
||||
<v-dialog
|
||||
v-model="isConditionGroupShown"
|
||||
width="900"
|
||||
>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<span role="button" class="success--text font-weight-medium font-size-2 ml-2" v-bind="attrs" v-on="on">
|
||||
设置条件
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
同时满足以下条件
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<!-- <v-row v-for="(index, item) in node.conditionList"> -->
|
||||
<v-card elevation="0" outlined>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="node.conditionList"
|
||||
v-model="node.conditionList"
|
||||
:items-per-page="10"
|
||||
class="elevation-1"
|
||||
>
|
||||
<template v-slot:item.action="{ item, index }">
|
||||
<span role="button" class="success--text font-weight-medium font-size-2 mr-2 ml-2" @click="doUiAction('deleteCondition', index)">
|
||||
<v-icon size="16" class="success--text">mdi-delete-outline</v-icon>删除
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:item.id="{ item }">
|
||||
<v-select :items="conditions" dense filled single-line item-text="name" item-value="id" class="jh-v-input" v-model="item.id"
|
||||
@change="changeConditionId($event, item)"></v-select>
|
||||
</template>
|
||||
<template v-slot:item.express="{ item }">
|
||||
<v-select :items="constantObj.operators[item.type]" dense filled single-line class="jh-v-input" v-model="item.express"></v-select>
|
||||
</template>
|
||||
<template v-slot:item.option-list="{ item }">
|
||||
<div v-if="item.type == 'number'" class="d-flex align-center">
|
||||
<v-text-field class="jh-v-input" dense filled v-model="item.option.begin"></v-text-field>
|
||||
<span> 至 </span>
|
||||
<v-text-field class="jh-v-input" dense filled v-model="item.option.end"></v-text-field>
|
||||
</div>
|
||||
<v-select v-else :items="getOptionList(item)" item-text="text" item-value="value" dense filled class="jh-v-input" v-model="item.option" multiple></v-select>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card>
|
||||
<v-btn class="add-btn" @click="doUiAction('addCondition')">添加条件</v-btn>
|
||||
</v-card-text>
|
||||
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
color="primary"
|
||||
text
|
||||
@click="doUiAction('closeConditionGroupDialog')"
|
||||
>
|
||||
关闭
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-col>
|
||||
</template>
|
||||
</v-row>
|
||||
@@ -115,16 +231,31 @@
|
||||
return []
|
||||
}
|
||||
},
|
||||
tpl: {
|
||||
label: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
mode: {
|
||||
workflowConfig: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
nodeList: [],
|
||||
lineList: []
|
||||
}
|
||||
}
|
||||
},
|
||||
workflowForm: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
displayMode: {
|
||||
type: String,
|
||||
default: 'serial'
|
||||
}
|
||||
default: "complex"
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -132,26 +263,82 @@
|
||||
node: {
|
||||
id: ''
|
||||
},
|
||||
headers:[
|
||||
{ text: '条件', value: 'id', width: 150 },
|
||||
{ text: '运算', value: 'express', width: 100 },
|
||||
{ text: '选项', value: 'option-list', width: 280},
|
||||
{ text: '操作', value: 'action', align: 'left', sortable: false, width: 80, class: 'fixed', cellClass: 'fixed'},
|
||||
],
|
||||
typeList: [
|
||||
{ Value: 'start', Text: '起点' },
|
||||
{ Value: 'end', Text: '终点' },
|
||||
{ Value: 'userTask', Text: '审核节点' },
|
||||
{ Value: 'receiveTask', Text: '处理节点' }
|
||||
{ Value: 'userTask', Text: '审核人' },
|
||||
{ Value: 'receiveTask', Text: '处理节点' },
|
||||
{ Value: 'approvalTask', Text: '审核节点' },
|
||||
{ Value: 'conditionTask', Text: '条件节点' },
|
||||
{ Value: 'noticeTask', Text: '抄送节点' }
|
||||
],
|
||||
assignTypeList: [{value: 'person', text: '用户'}, {value: 'group', text: '组'}]
|
||||
constantObj: {
|
||||
approverTypes: [
|
||||
{ text:'指定上级', value:'指定上级' },
|
||||
{ text:'指定部门负责人', value:'指定部门负责人' },
|
||||
{ text:'指定标签', value:'指定标签' },
|
||||
{ text:'指定人员', value:'指定人员' },
|
||||
{ text:'申请人自选', value:'申请人自选' },
|
||||
],
|
||||
approvalTypes: [
|
||||
{
|
||||
value: '依次审批',
|
||||
text:'依次审批'
|
||||
},
|
||||
{
|
||||
value: '会签',
|
||||
text:'会签审批(需所有人同意)'
|
||||
},
|
||||
{
|
||||
value: '或签',
|
||||
text:'或签审批(1人同意即可)'
|
||||
},
|
||||
],
|
||||
superiors:[
|
||||
'直属上级',
|
||||
..._.times(9, i => `第${i + 2}级上级`)
|
||||
],
|
||||
deptHeaders:[
|
||||
'直接部门负责人',
|
||||
..._.times(9, i => `第${i + 2}级部门负责人`)
|
||||
],
|
||||
noticerTypes: [
|
||||
{ text:'指定人员', value:'指定人员' },
|
||||
{ text:'申请人自选', value:'申请人自选' },
|
||||
],
|
||||
operators: {
|
||||
'single': [{ text: '包含', value: 'include' }],
|
||||
'multiple': [{ text: '完全包含', value: 'fullInclude' }, { text: '其一包含', value: 'oneInclude'}],
|
||||
'number': [{ text: '小于', value: 'less' }, { text: '小于等于', value: 'lessEqual'}, { text: '等于', value: 'equal'},
|
||||
{ text: '大于等于', value: 'moreEqual'}, { text: '大于', value: 'more'}, { text: '介于(a≤x≤b)', value: 'between'},]
|
||||
}
|
||||
},
|
||||
|
||||
isConditionGroupShown: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
node: {
|
||||
handler: function (node) {
|
||||
handler: async function (node) {
|
||||
// 更新节点或者连线的文案
|
||||
this.lf.updateText(node.id, node.label);
|
||||
this.lf.setProperties(node.id, node);
|
||||
// 更新数据
|
||||
await this.$emit('reflesh-workflow')
|
||||
this.$forceUpdate()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
tpl: {
|
||||
handler: function (tpl) {
|
||||
console.log('tpl change', tpl)
|
||||
'node.conditionList': {
|
||||
handler: async function (val) {
|
||||
this.$forceUpdate()
|
||||
this.$emit('reflesh-workflow')
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
@@ -160,31 +347,127 @@
|
||||
isMobile() {
|
||||
return window.innerWidth < 600;
|
||||
},
|
||||
assignType() {
|
||||
if (!this.node.assignType) return '请选择指派类型';
|
||||
return this.assignTypeList.find(e => e.value === this.node.assignType).text;
|
||||
prioritys(){
|
||||
var num = this.workflowConfig.nodeList.filter(n=>n.properties.type == 'conditionTask').length
|
||||
return [
|
||||
{ text: '默认条件', priority: -1 },
|
||||
..._.times(num - 1, i => {
|
||||
return { text: `优先级${i + 1}`, priority: i + 1 }
|
||||
})
|
||||
]
|
||||
},
|
||||
optionList() {
|
||||
if (!this.node.assignType) {
|
||||
return []
|
||||
}
|
||||
if (this.node.assignType === 'person') {
|
||||
return this.user
|
||||
}
|
||||
if (this.node.assignType === 'group') {
|
||||
return this.group
|
||||
}
|
||||
conditions(){
|
||||
var conditions = [
|
||||
{
|
||||
id: 'single-applyPerson',
|
||||
name: '申请人',
|
||||
type: 'single',
|
||||
operator: [
|
||||
{
|
||||
text: '包含'
|
||||
}
|
||||
],
|
||||
optionList: this.user
|
||||
},
|
||||
...this.workflowForm
|
||||
.filter(i => ['single', 'multiple', 'number'].includes(i.type))
|
||||
.map(i => {
|
||||
return {
|
||||
id: i.id,
|
||||
name: i.statement,
|
||||
type: i.type,
|
||||
operator: this.constantObj.operators[i.type],
|
||||
optionList: i.optionList
|
||||
}
|
||||
})
|
||||
]
|
||||
|
||||
return conditions || []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async doUiAction(uiActionId, uiActionData) {
|
||||
switch (uiActionId) {
|
||||
case 'init':
|
||||
await this.init(uiActionData);
|
||||
break;
|
||||
case 'clearUser':
|
||||
await this.clearUser();
|
||||
break;
|
||||
case 'addCondition':
|
||||
await this.addCondition();
|
||||
break;
|
||||
case 'deleteCondition':
|
||||
await this.deleteCondition(uiActionData);
|
||||
break;
|
||||
case 'closeConditionGroupDialog':
|
||||
await this.closeConditionGroupDialog();
|
||||
break;
|
||||
default:
|
||||
console.error("[doUiAction] uiActionId not find", {uiActionId});
|
||||
break;
|
||||
}
|
||||
},
|
||||
init(node) {
|
||||
this.node = node.properties;
|
||||
},
|
||||
async clearUser(){
|
||||
this.node.user = []
|
||||
await this.$emit('reflesh-workflow')
|
||||
},
|
||||
addCondition(){
|
||||
if(this.node?.conditionList && this.node.conditionList.length > 0){
|
||||
this.$set(this.node, 'conditionList', [...this.node.conditionList, {}])
|
||||
}else{
|
||||
this.$set(this.node, 'conditionList', [{}])
|
||||
}
|
||||
this.$forceUpdate()
|
||||
},
|
||||
deleteCondition(index){
|
||||
this.node.conditionList.splice(index, 1)
|
||||
},
|
||||
changeConditionId(id, item){
|
||||
var conditionItem = this.conditions.find(c => c.id == id)
|
||||
item.type = conditionItem.type || null
|
||||
item.express = null
|
||||
item.option = item.type == 'number'? { begin: null, end: null} : null
|
||||
},
|
||||
closeConditionGroupDialog(){
|
||||
this.$forceUpdate()
|
||||
this.$emit('reflesh-workflow')
|
||||
this.isConditionGroupShown = false
|
||||
|
||||
|
||||
},
|
||||
getOptionList(item){
|
||||
if(!item.id) return []
|
||||
if(item.id == 'single-applyPerson'){
|
||||
return this.user.map(u => {
|
||||
return {
|
||||
text: u.username,
|
||||
value: u.id
|
||||
}
|
||||
})
|
||||
}else{
|
||||
let optionList = this.workflowForm.find(f => f.id == item.id)?.optionList
|
||||
return optionList.map(o => {
|
||||
return {
|
||||
text: o,
|
||||
value: o
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
.v-textarea textarea {
|
||||
line-height: 1.2rem;
|
||||
}
|
||||
.v-textarea textarea {
|
||||
line-height: 1.2rem;
|
||||
}
|
||||
.add-btn {
|
||||
width: 100%;
|
||||
margin-top: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user