diff --git a/app/view/component/flow/editLine.html b/app/view/component/flow/editLine.html
index 6a61d2a..27e1426 100644
--- a/app/view/component/flow/editLine.html
+++ b/app/view/component/flow/editLine.html
@@ -1,39 +1,27 @@
-
-
+
+
GUID
-
+
源活动
-
+
目标活动
-
+
名称
-
- 操作类型
-
-
-
+
执行Hook
-
+
备注说明
@@ -50,10 +38,6 @@
lf: {
type: Object,
default: null
- },
- mode: {
- type: String,
- default: 'serial'
}
},
data() {
@@ -61,14 +45,16 @@
line: { label: '' },
isUpdate: false,
isFormValid: true,
- lineTypeList: []
}
},
watch: {
line: {
- handler: function (line) {
+ handler: async function (line) {
+ // 更新节点或者连线的文案
this.lf.updateText(line.id, `${line.type}-${line.label}`);
this.lf.setProperties(line.id, line);
+ // 更新数据
+ await this.$emit('reflesh-workflow')
},
deep: true
}
@@ -79,10 +65,9 @@
},
},
methods: {
- init(line, lineTypeList) {
+ init(line) {
this.isUpdate = false;
this.line = line.properties;
- this.lineTypeList = lineTypeList;
this.$nextTick(() => {
this.isUpdate = true;
});
diff --git a/app/view/component/flow/editNode.html b/app/view/component/flow/editNode.html
index 5c5bac0..24ac7ba 100644
--- a/app/view/component/flow/editNode.html
+++ b/app/view/component/flow/editNode.html
@@ -1,92 +1,208 @@
-
-
+
+
GUID
-
+
名称
-
+
-
- 备注说明
-
-
-
-
-
- 指派类型
-
+
+
+
+ 审批人类型
-
- 指派
-
+
+ 指定上级
+
-
-
-
- 允许的操作(英文逗号分隔)
-
-
-
- 可写模板
+ class="jh-v-input"
+ v-model="node.user"
+ multiple
+ >
+
+
+
+
+ 指定部门负责人
+
+
+
+
+
+ 指定标签
+
+
+
+
+
+ 指定人员
+
+
+
+
+ 多人审批方式
-
-
- 隐藏模板
-
-
-
- 流程完成Hook
-
+
+
+
+ 抄送人类型
+
-
- 流程中断Hook
-
+
+
+ 指定人员
+
+
+
+
+
+
+
+ 优先级
+
+
+
+ 条件组
+
+
+
+ 设置条件
+
+
+
+
+
+ 同时满足以下条件
+
+
+
+
+
+
+
+
+ mdi-delete-outline删除
+
+
+
+
+
+
+
+
+
+
+
+ 至
+
+
+
+
+
+
+ 添加条件
+
+
+
+
+
+
+
+ 关闭
+
+
+
+
@@ -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
+ }
+ })
+ }
+ }
}
})
diff --git a/app/view/component/flow/processFlow.html b/app/view/component/flow/processFlow.html
index 3193c98..8f95084 100644
--- a/app/view/component/flow/processFlow.html
+++ b/app/view/component/flow/processFlow.html
@@ -1,36 +1,105 @@
-
-
-
@@ -135,6 +119,7 @@ Vue.component("workflow-editor-drawer", {
userList: [],
groupList: [],
workflowFormList: [],
+ labelList: []
},
formObj: {},
submitUiActionId: 'createItem',
@@ -154,23 +139,24 @@ Vue.component("workflow-editor-drawer", {
}
},
async created() {
- this.doUiAction('getUserGroupData');
+ this.doUiAction('getConstantData');
},
methods: {
async doUiAction(uiActionId, uiActionData) {
switch (uiActionId) {
case 'open':
await this.prepareFormObj(uiActionData);
- await this.buildConstantWorkflowFormList();
+ // await this.buildConstantWorkflowFormList();
await this.buildConstantWorkflowConfig();
await this.openDrawer();
break;
case 'close':
await this.closeDrawer();
break;
- case 'getUserGroupData':
+ case 'getConstantData':
await this.getUserList();
await this.getGroupList();
+ await this.getLabelList();
break;
case 'createItem':
await this.confirmCreateItemDialog();
@@ -197,18 +183,16 @@ Vue.component("workflow-editor-drawer", {
if(item) {
this.submitUiActionId = 'updateItem';
let formObj = _.clone(item);
- formObj.basicInfo = {
+ formObj.workflowInfo = {
workflowName: item.workflowName,
- workflowRemark: item.workflowRemark,
- mode: item.mode,
+ ...JSON.parse(item.workflowInfo),
}
formObj.workflowConfig = formObj.workflowConfig ? JSON.parse(formObj.workflowConfig) : null;
formObj.workflowForm = formObj.workflowForm ? (typeof formObj.workflowForm == 'string'? JSON.parse(formObj.workflowForm): formObj.workflowForm) : [];
- formObj.mode = formObj.workflowConfig.mode || 'serial';
this.formObj = formObj;
} else {
this.submitUiActionId = 'createItem';
- this.formObj = {basicInfo: {}, workflowForm: [], workflowConfig: {lineList: [], nodeList: []}, mode: 'serial'};
+ this.formObj = {workflowInfo: {}, workflowForm: [], workflowConfig: {lineList: [], nodeList: []}};
}
this.$refs.form.resetValidation();
this.loading = false;
@@ -238,7 +222,7 @@ Vue.component("workflow-editor-drawer", {
}
})).data.appData.resultData;
this.constantObj.userList = rows.map(e => {
- return {text: e.username, value: e.userId, userId: e.userId}
+ return {username: e.username, userId: e.userId, userId: e.userId}
})
},
@@ -257,9 +241,25 @@ Vue.component("workflow-editor-drawer", {
}
})).data.appData.resultData;
this.constantObj.groupList = rows.map(e => {
- return {text: e.groupName, value: e.groupId}
+ return {groupName: e.groupName, groupId: e.groupId}
});
},
+ /**
+ * 获取label数据
+ */
+ async getLabelList() {
+ const {rows} = (await window.jianghuAxios({
+ data: {
+ appData: {
+ pageId: 'allPage',
+ actionId: 'selectLabelList',
+ actionData: {},
+ where: {},
+ }
+ }
+ })).data.appData.resultData;
+ this.constantObj.labelList = rows;
+ },
// -- <<<<<<<<<<<<< 获取数据 --------------------
// -- constantObj 数据构建 >>>>>>>>>>> ---------------
buildConstantWorkflowFormList() {
@@ -275,7 +275,7 @@ Vue.component("workflow-editor-drawer", {
buildConstantWorkflowConfig() {
if (!this.formObj.workflowConfig) return;
- this.$refs.processFlow.init();
+ this.$refs.processFlow.doUiAction('complexModeInit');
},
// -- <<<<<<<<<<<<< constantObj 数据构建 ---------------
// ---- 数据准备 >>>>>>>>>>>>>> ---------
@@ -305,11 +305,20 @@ Vue.component("workflow-editor-drawer", {
this.loading = false;
}, 300)
},
+ // TODO: 检验数据
+ prepareValidate(){
+ var submitAble = false
+ // 判断info的数据
+ // 判断form的数据
+ // 判断流程图的数据
+ // 只允许在第一个节点设置条件节点
+ // 不允许节点孤立
+
+ },
prepareFormSubmitData() {
- const {id, workflowId, workflowName, workflowRemark, workflowCategory, mode, workflowForm} = this.formObj;
+ const {id, workflowId, workflowInfo, workflowForm} = this.formObj;
+ const { workflowName, ...data } = workflowInfo
const workflowConfig = this.$refs.processFlow.getBusinessData();
- workflowConfig.mode = mode
- // TODO: 清除不存在的用户
workflowConfig.nodeList.forEach(node => {
if (node.type === 'userTask') {
node.assignValue = node.assignValue || [];
@@ -319,8 +328,7 @@ Vue.component("workflow-editor-drawer", {
});
this.formSubmitData = {
workflowName,
- workflowRemark,
- workflowCategory,
+ workflowInfo: data? JSON.stringify(data) : null,
workflowId: workflowId || null,
workflowConfig: workflowConfig ? JSON.stringify(workflowConfig) : null,
workflowForm: workflowForm ? JSON.stringify(workflowForm) : null,
@@ -375,6 +383,9 @@ Vue.component("workflow-editor-drawer", {
this.$emit('success');
},
// ---------- <<<<<<<<<< 修改流程 updateItem --------
+ refleshWorkflowConfig(data){
+ this.$set(this.formObj, 'workflowConfig', _.clone(data))
+ }
}
})