流程编辑
This commit is contained in:
1 parent
7751704fe7
commit
696457321b
6 files changed
+915
-313
No files matched your search
@@ -42,20 +42,18 @@
|
||||
<v-stepper-items flat outlined>
|
||||
<v-stepper-content step="1">
|
||||
<v-card flat>
|
||||
<v-card-text>
|
||||
<v-card-text class="pa-0">
|
||||
<div class="mt-1">
|
||||
{{formObj.basicInfo}}
|
||||
<!-- <div class="text-subtitle-2 mb-2">基础信息</div> -->
|
||||
<workflow-basic-info :basic-info="formObj.basicInfo"></workflow-basic-info>
|
||||
<workflow-basic-info :workflow-info="formObj.workflowInfo"></workflow-basic-info>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-stepper-content>
|
||||
<v-stepper-content step="2">
|
||||
<v-card flat>
|
||||
<v-card-text>
|
||||
<v-card-text class="pa-0">
|
||||
<div class="mt-1">
|
||||
{{formObj.workflowForm}}
|
||||
<!-- <div class="text-subtitle-2 mb-2">表单设置</div> -->
|
||||
<tpl-form-design :form="formObj.workflowForm" v-if="!loading"></tpl-form-design>
|
||||
</div>
|
||||
@@ -64,16 +62,17 @@
|
||||
</v-stepper-content>
|
||||
<v-stepper-content step="3">
|
||||
<v-card flat>
|
||||
<v-card-text>
|
||||
<v-card-text class="pa-0">
|
||||
<div class="mt-1">
|
||||
<!-- <div class="text-subtitle-2 mb-2">流程设置</div> -->
|
||||
<process-flow
|
||||
ref="processFlow"
|
||||
:data="formObj.workflowConfig"
|
||||
:workflow-config="formObj.workflowConfig"
|
||||
:user="constantObj.userList"
|
||||
:group="constantObj.groupList"
|
||||
:tpl="constantObj.workflowFormList"
|
||||
:mode="formObj.mode">
|
||||
:label="constantObj.labelList"
|
||||
:workflow-form="formObj.workflowForm"
|
||||
@reflesh-workflow-config="refleshWorkflowConfig">
|
||||
</process-flow>
|
||||
</div>
|
||||
</v-card-text>
|
||||
@@ -83,21 +82,6 @@
|
||||
</v-stepper>
|
||||
|
||||
</template>
|
||||
<!-- <v-card flat>
|
||||
<v-card-text>
|
||||
<div class="mt-8">
|
||||
<div class="text-subtitle-2 mb-2">流程设置</div>
|
||||
<process-flow
|
||||
ref="processFlow"
|
||||
:data="formObj.workflowConfig"
|
||||
:user="constantObj.userList"
|
||||
:group="constantObj.groupList"
|
||||
:tpl="constantObj.workflowFormList"
|
||||
:mode="formObj.mode">
|
||||
</process-flow>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card> -->
|
||||
</v-form>
|
||||
</div>
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user