并行测试
This commit is contained in:
1 parent
7dbfa46918
commit
7062befd9f
5 files changed
+635
-276
No files matched your search
@@ -96,7 +96,7 @@ class WorkflowService extends Service {
|
|||||||
|
|
||||||
actionData.workflowConfigCustom = JSON.stringify(workflowConfigCustom);
|
actionData.workflowConfigCustom = JSON.stringify(workflowConfigCustom);
|
||||||
actionData.workflowId = workflow.workflowId;
|
actionData.workflowId = workflow.workflowId;
|
||||||
actionData.taskTitle = `[${group}]${username}`;
|
actionData.taskTitle = workflow.workflowName;
|
||||||
actionData.workflowForm = formItemList;
|
actionData.workflowForm = formItemList;
|
||||||
const formData = {};
|
const formData = {};
|
||||||
formItemList.forEach(item => {
|
formItemList.forEach(item => {
|
||||||
|
|||||||
@@ -74,7 +74,9 @@
|
|||||||
class="jh-fixed-table-height elevation-0 mt-0 mb-xs-4">
|
class="jh-fixed-table-height elevation-0 mt-0 mb-xs-4">
|
||||||
|
|
||||||
<template v-slot:item.taskTitle="{ item }">
|
<template v-slot:item.taskTitle="{ item }">
|
||||||
<span>{{item.taskTitle}}</span>
|
<span>{{item.taskTitle}}</span> -
|
||||||
|
<span>{{item.taskExplain}}</span>
|
||||||
|
|
||||||
<span v-if="workflowType != 'todo'">
|
<span v-if="workflowType != 'todo'">
|
||||||
<v-chip
|
<v-chip
|
||||||
v-if="item.taskHandleDesc === '拒绝'" label outlined
|
v-if="item.taskHandleDesc === '拒绝'" label outlined
|
||||||
|
|||||||
@@ -0,0 +1,318 @@
|
|||||||
|
{% extends 'template/jhTemplateV3.html'%}
|
||||||
|
|
||||||
|
{% block vue_template %}
|
||||||
|
<jh-layout-v3>
|
||||||
|
|
||||||
|
<template slot="serverSearch">
|
||||||
|
<div class="mt-4" style="text-align: right;">
|
||||||
|
<v-btn color="success" @click="doUiAction(dialogSaveInfoAction)" style="height: 40px">
|
||||||
|
保存
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template slot-scope="props">
|
||||||
|
<v-card class="" :class="{'pa-8': !props.ismobile, 'pa-4': props.ismobile}">
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
|
||||||
|
<v-text-field class="cus-v-input mr-2" dense filled single-line color="success" prefix="流程名:" v-model="editItem['workflowName']" :rules="requireRules">
|
||||||
|
</v-text-field>
|
||||||
|
</v-col>
|
||||||
|
<!-- <v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
|
||||||
|
<v-text-field class="cus-v-input mr-2" dense filled single-line color="success" prefix="分类:" v-model="editItem['workflowCategory']" :rules="requireRules">
|
||||||
|
</v-text-field>
|
||||||
|
</v-col> -->
|
||||||
|
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
|
||||||
|
<v-text-field class="cus-v-input mr-2" dense filled single-line color="success" prefix="备注:"
|
||||||
|
v-model="editItem['workflowRemark']">
|
||||||
|
</v-text-field>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
|
||||||
|
<v-select class="cus-v-input mr-2" dense filled single-line color="success" prefix="审批模式:"
|
||||||
|
v-model="editItem['mode']" :items="constantCollection.modeList" />
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-card>
|
||||||
|
|
||||||
|
<!-- <div class=" pb-4" style="font-size: 18px; font-weight: bold">模板设置</div>
|
||||||
|
<tpl-form-design :form="editItem.workflowForm" v-if="!loading">
|
||||||
|
</tpl-form-design> -->
|
||||||
|
|
||||||
|
<div class="pt-4 pb-4" style="font-size: 18px; font-weight: bold">流程设置</div>
|
||||||
|
<process-flow v-if="!loading" ref="processFlow" :data="editItem.workflowConfig" :user="constantCollection.userList"
|
||||||
|
:group="constantCollection.groupList" :tpl="constantCollection.workflowFormList"
|
||||||
|
:mode="editItem.mode">
|
||||||
|
</process-flow>
|
||||||
|
|
||||||
|
<v-overlay :value="loading" absolute>
|
||||||
|
<v-progress-circular
|
||||||
|
indeterminate
|
||||||
|
size="64"
|
||||||
|
></v-progress-circular>
|
||||||
|
</v-overlay>
|
||||||
|
</template>
|
||||||
|
</jh-layout-v3>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block vue_body %}
|
||||||
|
{% include 'component/flow/processFlow.html' %}
|
||||||
|
{% include 'component/flow/editFlow.html' %}
|
||||||
|
{% include 'component/flow/editLine.html' %}
|
||||||
|
{% include 'component/flow/editNode.html' %}
|
||||||
|
{% include 'component/tpl/tplFormDesign.html' %}
|
||||||
|
{% include 'component/tpl/formItemListGenerator.html' %}
|
||||||
|
{% include 'component/tpl/formItemListRender.html' %}
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
new Vue({
|
||||||
|
el: '#app',
|
||||||
|
template: '#app-template',
|
||||||
|
vuetify: new Vuetify(),
|
||||||
|
data: () => ({
|
||||||
|
requireRules: [
|
||||||
|
v => !!v || '必填',
|
||||||
|
],
|
||||||
|
constantCollection: {
|
||||||
|
userList: [],
|
||||||
|
groupList: [],
|
||||||
|
workflowFormList: [],
|
||||||
|
modeList: [
|
||||||
|
{ text: '串行', value: 'serial'},
|
||||||
|
{ text: '并行', value: 'parallel'},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
editItem: {},
|
||||||
|
dialogSaveInfoAction: 'createItem',
|
||||||
|
loading: false,
|
||||||
|
}),
|
||||||
|
watch: {
|
||||||
|
'editItem.workflowForm': {
|
||||||
|
handler(val) {
|
||||||
|
if (!val) return
|
||||||
|
this.buildWorkflowFormList(val);
|
||||||
|
if (!this.editItem.workflowConfig) return;
|
||||||
|
this.buildWorkflowConfig()
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async created() {
|
||||||
|
const searchParams = new URLSearchParams(location.search.substring(1));
|
||||||
|
const id = searchParams.get('id');
|
||||||
|
if(id) {
|
||||||
|
this.editItem = {id};
|
||||||
|
await this.syncEditItem()
|
||||||
|
} else {
|
||||||
|
this.clearItemData();
|
||||||
|
}
|
||||||
|
this.getUserList();
|
||||||
|
this.getGroupList();
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async doUiAction(uiActionId, uiActionData) {
|
||||||
|
switch (uiActionId) {
|
||||||
|
case 'createItem':
|
||||||
|
await this.confirmCreateItemDialog(uiActionData);
|
||||||
|
await this.doCreateItem(uiActionData);
|
||||||
|
await this.syncEditItem()
|
||||||
|
break;
|
||||||
|
case 'updateItem':
|
||||||
|
await this.confirmUpdateItemDialog(uiActionData);
|
||||||
|
await this.doUpdateItem(uiActionData);
|
||||||
|
await this.syncEditItem()
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.error("[doUiAction] uiActionId not find", { uiActionId });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
buildEditItem() {
|
||||||
|
const { id, workflowId, workflowName, workflowRemark, workflowCategory, mode, workflowForm } = this.editItem;
|
||||||
|
const workflowConfig = this.$refs.processFlow.getData();
|
||||||
|
workflowConfig.mode = mode
|
||||||
|
// TODO: 清除不存在的用户
|
||||||
|
workflowConfig.nodeList.forEach(node => {
|
||||||
|
if (node.type === 'userTask') {
|
||||||
|
node.assignValue = node.assignValue || [];
|
||||||
|
node.assignValue = node.assignValue.filter(userId => this.constantCollection.userList.findIndex(u => u.userId === userId) > -1);
|
||||||
|
node.origin.properties.assignValue = node.assignValue;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let item = {
|
||||||
|
workflowName,
|
||||||
|
workflowRemark,
|
||||||
|
workflowCategory,
|
||||||
|
workflowId: workflowId || null,
|
||||||
|
workflowConfig: workflowConfig ? JSON.stringify(workflowConfig) : null,
|
||||||
|
workflowForm: workflowForm ? JSON.stringify(workflowForm) : null,
|
||||||
|
}
|
||||||
|
if (id) {
|
||||||
|
item.id = id;
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
},
|
||||||
|
|
||||||
|
buildWorkflowFormList(val) {
|
||||||
|
this.constantCollection.workflowFormList = [];
|
||||||
|
for (const item of val) {
|
||||||
|
this.constantCollection.workflowFormList.push({
|
||||||
|
text: item.component.outline,
|
||||||
|
value: item.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
buildWorkflowConfig() {
|
||||||
|
for (const config of this.editItem.workflowConfig.nodeList) {
|
||||||
|
if (!config.formId) return;
|
||||||
|
const formId = []
|
||||||
|
for (const item of config.formId) {
|
||||||
|
if (!this.constantCollection.workflowFormList.find(e => e.value === item)) {
|
||||||
|
formId.push(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
config.formId = formId
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取user数据
|
||||||
|
*/
|
||||||
|
async getUserList() {
|
||||||
|
const {rows} = (await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: 'workflowManagement',
|
||||||
|
actionId: 'selectUserList',
|
||||||
|
actionData: {},
|
||||||
|
where: {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})).data.appData.resultData;
|
||||||
|
this.constantCollection.userList = rows.map(e => {
|
||||||
|
return {text: e.username, value: e.userId, userId: e.userId }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取group数据
|
||||||
|
*/
|
||||||
|
async getGroupList() {
|
||||||
|
const {rows} = (await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: 'workflowManagement',
|
||||||
|
actionId: 'selectGroupList',
|
||||||
|
actionData: {},
|
||||||
|
where: {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})).data.appData.resultData;
|
||||||
|
this.constantCollection.groupList = rows.map(e => {
|
||||||
|
return {text: e.groupName, value: e.groupId}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
async clearItemData() {
|
||||||
|
this.dialogSaveInfoAction = 'createItem';
|
||||||
|
this.editItem = {workflowForm: [], workflowConfig: {lineList: [], nodeList: []}, mode: 'serial'};
|
||||||
|
},
|
||||||
|
|
||||||
|
async syncEditItem() {
|
||||||
|
this.loading = true;
|
||||||
|
this.dialogSaveInfoAction = 'updateItem';
|
||||||
|
const {rows} = (await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: 'workflowManagement',
|
||||||
|
actionId: 'selectItemList',
|
||||||
|
where: {id: this.editItem.id},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})).data.appData.resultData;
|
||||||
|
if (!rows.length) {
|
||||||
|
this.clearItemData();
|
||||||
|
} else {
|
||||||
|
const item = rows[0];
|
||||||
|
item.workflowConfig = item.workflowConfig ? JSON.parse(item.workflowConfig) : null;
|
||||||
|
item.workflowForm = item.workflowForm ? JSON.parse(item.workflowForm) : [];
|
||||||
|
item.mode = item.workflowConfig.mode || 'serial';
|
||||||
|
this.editItem = item;
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.loading = false;
|
||||||
|
}, 500)
|
||||||
|
},
|
||||||
|
|
||||||
|
async confirmCreateItemDialog() {
|
||||||
|
if (await window.confirmDialog({title: "新增", content: "确定新增吗?"}) === false) {
|
||||||
|
throw new Error("[confirmCreateFormDialog] 否");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*/
|
||||||
|
async doCreateItem() {
|
||||||
|
delete this.editItem.id;
|
||||||
|
const item = this.buildEditItem();
|
||||||
|
await window.vtoast.loading("新增数据");
|
||||||
|
const {rows} = (await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: 'workflowManagement',
|
||||||
|
actionId: 'insertItem',
|
||||||
|
actionData: item
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})).data.appData.resultData;
|
||||||
|
this.editItem.id = rows[0];
|
||||||
|
history.pushState({}, '', `?id=${rows[0]}`);
|
||||||
|
await window.vtoast.success("新增数据成功");
|
||||||
|
},
|
||||||
|
|
||||||
|
async confirmUpdateItemDialog() {
|
||||||
|
if (await window.confirmDialog({title: "修改", content: "确定修改吗?"}) === false) {
|
||||||
|
throw new Error("[confirmUpdateItemDialog] 否");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*/
|
||||||
|
async doUpdateItem() {
|
||||||
|
const {id, ...item} = this.buildEditItem();
|
||||||
|
await window.vtoast.loading("修改数据");
|
||||||
|
await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: 'workflowManagement',
|
||||||
|
actionId: 'updateItem',
|
||||||
|
actionData: item,
|
||||||
|
where: {id: id}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
await window.vtoast.success("修改数据成功");
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.theme--light.v-data-table > .v-data-table__wrapper > table > tbody > tr > td:not(.v-data-table__mobile-row) {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
max-width: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme--light.v-data-table > .v-data-table__wrapper > table > tbody > tr {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
+308
-268
@@ -1,119 +1,158 @@
|
|||||||
{% extends 'template/jhTemplateV3.html'%}
|
{% extends 'template/jhTemplateV4.html'%}
|
||||||
|
|
||||||
{% block vue_template %}
|
{% block vueTemplate %}
|
||||||
<jh-layout-v3>
|
|
||||||
|
|
||||||
<template slot="serverSearch">
|
<script type="text/html" id="app-template">
|
||||||
<div class="mt-4" style="text-align: right;">
|
<div>
|
||||||
<v-btn color="success" @click="doUiAction(dialogSaveInfoAction)" style="height: 40px">
|
<v-app mobile-breakpoint="sm">
|
||||||
保存
|
<jh-menu />
|
||||||
</v-btn>
|
<v-main class="mt-15">
|
||||||
</div>
|
<!-- 头部内容 >>>>>>>>>>>>> -->
|
||||||
</template>
|
<div class="jh-page-second-bar px-8">
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="12" xs="12" sm="12" md="4" xl="3">
|
||||||
|
<div class="pt-3 text-h7 font-weight-bold">流程编辑
|
||||||
|
<!-- 帮助页按钮 -->
|
||||||
|
<v-icon
|
||||||
|
@click="isHelpPageDrawerShown = true" color="success"
|
||||||
|
small>mdi-help-circle-outline
|
||||||
|
</v-icon>
|
||||||
|
</div>
|
||||||
|
<v-breadcrumbs class="pb-3 pt-0 pl-0" :items="breadcrumbs" divider="-"></v-breadcrumbs>
|
||||||
|
</v-col>
|
||||||
|
<!--pc端的搜索条件表单 >>>>>>>> -->
|
||||||
|
<v-col cols="12" xs="12" sm="12" md="8" xl="9" class="d-flex align-center">
|
||||||
|
<v-row class="jh-backend-form-container justify-end ma-0 py-4 pt-xs-0 ">
|
||||||
|
<v-btn small @click="doUiAction(dialogSaveInfoAction)" color="success" class="">
|
||||||
|
保存
|
||||||
|
</v-btn>
|
||||||
|
</v-row>
|
||||||
|
</v-col>
|
||||||
|
<!-- <<<<<<<< pc端的搜索条件表单 -->
|
||||||
|
</v-row>
|
||||||
|
</div>
|
||||||
|
<!-- <<<<<<<<<<<<< 头部内容 -->
|
||||||
|
<div class="jh-page-body-container px-8">
|
||||||
|
<v-card class="pa-4">
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
|
||||||
|
<v-text-field class="cus-v-input mr-2" dense filled single-line color="success" prefix="流程名:" v-model="editItem['workflowName']" :rules="requireRules">
|
||||||
|
</v-text-field>
|
||||||
|
</v-col>
|
||||||
|
<!-- <v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
|
||||||
|
<v-text-field class="cus-v-input mr-2" dense filled single-line color="success" prefix="分类:" v-model="editItem['workflowCategory']" :rules="requireRules">
|
||||||
|
</v-text-field>
|
||||||
|
</v-col> -->
|
||||||
|
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
|
||||||
|
<v-text-field class="cus-v-input mr-2" dense filled single-line color="success" prefix="备注:"
|
||||||
|
v-model="editItem['workflowRemark']">
|
||||||
|
</v-text-field>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
|
||||||
|
<v-select class="cus-v-input mr-2" dense filled single-line color="success" prefix="审批模式:"
|
||||||
|
v-model="editItem['mode']" :items="constantCollection.modeList" />
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-card>
|
||||||
|
|
||||||
<template slot-scope="props">
|
<div class="pt-4 pb-4 text-h7">流程设置</div>
|
||||||
<v-card class="mt-3 mb-3" :class="{'pa-8': !props.ismobile, 'pa-4': props.ismobile}">
|
<process-flow v-if="!loading" ref="processFlow" :data="editItem.workflowConfig" :user="constantCollection.userList"
|
||||||
<v-row>
|
:group="constantCollection.groupList" :tpl="constantCollection.workflowFormList"
|
||||||
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
|
:mode="editItem.mode">
|
||||||
<v-text-field class="cus-v-input mr-2" dense filled single-line color="success" prefix="流程名:" v-model="editItem['workflowName']" :rules="requireRules">
|
</process-flow>
|
||||||
</v-text-field>
|
</div>
|
||||||
</v-col>
|
|
||||||
<!-- <v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
|
|
||||||
<v-text-field class="cus-v-input mr-2" dense filled single-line color="success" prefix="分类:" v-model="editItem['workflowCategory']" :rules="requireRules">
|
|
||||||
</v-text-field>
|
|
||||||
</v-col> -->
|
|
||||||
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
|
|
||||||
<v-text-field class="cus-v-input mr-2" dense filled single-line color="success" prefix="备注:"
|
|
||||||
v-model="editItem['workflowRemark']">
|
|
||||||
</v-text-field>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
|
|
||||||
<v-select class="cus-v-input mr-2" dense filled single-line color="success" prefix="审批模式:"
|
|
||||||
v-model="editItem['mode']" :items="constantCollection.modeList" />
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</v-card>
|
|
||||||
|
|
||||||
<!-- <div class=" pb-4" style="font-size: 18px; font-weight: bold">模板设置</div>
|
<v-overlay :value="loading" absolute>
|
||||||
<tpl-form-design :form="editItem.workflowForm" v-if="!loading">
|
<v-progress-circular
|
||||||
</tpl-form-design> -->
|
indeterminate
|
||||||
|
size="64"
|
||||||
|
></v-progress-circular>
|
||||||
|
</v-overlay>
|
||||||
|
</v-main>
|
||||||
|
</v-app>
|
||||||
|
|
||||||
<div class="pt-8 pb-4" style="font-size: 18px; font-weight: bold">流程设置</div>
|
<jh-toast />
|
||||||
<process-flow v-if="!loading" ref="processFlow" :data="editItem.workflowConfig" :user="constantCollection.userList"
|
<jh-mask />
|
||||||
:group="constantCollection.groupList" :tpl="constantCollection.workflowFormList"
|
<jh-confirm-dialog />
|
||||||
:mode="editItem.mode">
|
</div>
|
||||||
</process-flow>
|
</script>
|
||||||
|
|
||||||
<v-overlay :value="loading" absolute>
|
|
||||||
<v-progress-circular
|
|
||||||
indeterminate
|
|
||||||
size="64"
|
|
||||||
></v-progress-circular>
|
|
||||||
</v-overlay>
|
|
||||||
</template>
|
|
||||||
</jh-layout-v3>
|
|
||||||
|
|
||||||
|
<div id="app">
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block vue_body %}
|
{% block vueScript %}
|
||||||
{% include 'component/flow/processFlow.html' %}
|
{% include 'component/flow/processFlow.html' %}
|
||||||
{% include 'component/flow/editFlow.html' %}
|
{% include 'component/flow/editFlow.html' %}
|
||||||
{% include 'component/flow/editLine.html' %}
|
{% include 'component/flow/editLine.html' %}
|
||||||
{% include 'component/flow/editNode.html' %}
|
{% include 'component/flow/editNode.html' %}
|
||||||
{% include 'component/tpl/tplFormDesign.html' %}
|
|
||||||
{% include 'component/tpl/formItemListGenerator.html' %}
|
|
||||||
{% include 'component/tpl/formItemListRender.html' %}
|
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
new Vue({
|
new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
template: '#app-template',
|
template: '#app-template',
|
||||||
vuetify: new Vuetify(),
|
vueComponent: 'page',
|
||||||
data: () => ({
|
vuetify: new Vuetify(),
|
||||||
requireRules: [
|
data: () => ({
|
||||||
v => !!v || '必填',
|
breadcrumbs: [
|
||||||
],
|
{
|
||||||
constantCollection: {
|
text: '首页',
|
||||||
userList: [],
|
disabled: true,
|
||||||
groupList: [],
|
},
|
||||||
workflowFormList: [],
|
{
|
||||||
modeList: [
|
text: '申请模板',
|
||||||
{ text: '串行', value: 'serial'},
|
disabled: true,
|
||||||
{ text: '并行', value: 'parallel'},
|
}
|
||||||
]
|
],
|
||||||
},
|
validationRules: {
|
||||||
editItem: {},
|
requireRules: [
|
||||||
dialogSaveInfoAction: 'createItem',
|
v => !!v || 'This is required',
|
||||||
loading: false,
|
],
|
||||||
}),
|
|
||||||
watch: {
|
|
||||||
'editItem.workflowForm': {
|
|
||||||
handler(val) {
|
|
||||||
if (!val) return
|
|
||||||
this.buildWorkflowFormList(val);
|
|
||||||
if (!this.editItem.workflowConfig) return;
|
|
||||||
this.buildWorkflowConfig()
|
|
||||||
},
|
},
|
||||||
deep: true,
|
requireRules: [
|
||||||
immediate: true
|
v => !!v || '必填',
|
||||||
}
|
],
|
||||||
},
|
constantCollection: {
|
||||||
async created() {
|
userList: [],
|
||||||
const searchParams = new URLSearchParams(location.search.substring(1));
|
groupList: [],
|
||||||
const id = searchParams.get('id');
|
workflowFormList: [],
|
||||||
if(id) {
|
modeList: [
|
||||||
this.editItem = {id};
|
{ text: '串行', value: 'serial' },
|
||||||
await this.syncEditItem()
|
{ text: '并行', value: 'parallel' },
|
||||||
} else {
|
]
|
||||||
this.clearItemData();
|
},
|
||||||
}
|
editItem: {},
|
||||||
this.getUserList();
|
dialogSaveInfoAction: 'createItem',
|
||||||
this.getGroupList();
|
loading: false,
|
||||||
},
|
}),
|
||||||
mounted() {
|
watch: {
|
||||||
},
|
'editItem.workflowForm': {
|
||||||
methods: {
|
handler(val) {
|
||||||
async doUiAction(uiActionId, uiActionData) {
|
if (!val) return
|
||||||
|
this.buildWorkflowFormList(val);
|
||||||
|
if (!this.editItem.workflowConfig) return;
|
||||||
|
this.buildWorkflowConfig()
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async created() {
|
||||||
|
const searchParams = new URLSearchParams(location.search.substring(1));
|
||||||
|
const id = searchParams.get('id');
|
||||||
|
if (id) {
|
||||||
|
this.editItem = { id };
|
||||||
|
await this.syncEditItem()
|
||||||
|
} else {
|
||||||
|
this.clearItemData();
|
||||||
|
}
|
||||||
|
this.getUserList();
|
||||||
|
this.getGroupList();
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async doUiAction(uiActionId, uiActionData) {
|
||||||
switch (uiActionId) {
|
switch (uiActionId) {
|
||||||
case 'createItem':
|
case 'createItem':
|
||||||
await this.confirmCreateItemDialog(uiActionData);
|
await this.confirmCreateItemDialog(uiActionData);
|
||||||
@@ -129,190 +168,191 @@ new Vue({
|
|||||||
console.error("[doUiAction] uiActionId not find", { uiActionId });
|
console.error("[doUiAction] uiActionId not find", { uiActionId });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
buildEditItem() {
|
buildEditItem() {
|
||||||
const { id, workflowId, workflowName, workflowRemark, workflowCategory, mode, workflowForm } = this.editItem;
|
const { id, workflowId, workflowName, workflowRemark, workflowCategory, mode, workflowForm } = this.editItem;
|
||||||
const workflowConfig = this.$refs.processFlow.getData();
|
const workflowConfig = this.$refs.processFlow.getData();
|
||||||
workflowConfig.mode = mode
|
workflowConfig.mode = mode
|
||||||
// TODO: 清除不存在的用户
|
// TODO: 清除不存在的用户
|
||||||
workflowConfig.nodeList.forEach(node => {
|
workflowConfig.nodeList.forEach(node => {
|
||||||
if (node.type === 'userTask') {
|
if (node.type === 'userTask') {
|
||||||
node.assignValue = node.assignValue || [];
|
node.assignValue = node.assignValue || [];
|
||||||
node.assignValue = node.assignValue.filter(userId => this.constantCollection.userList.findIndex(u => u.userId === userId) > -1);
|
node.assignValue = node.assignValue.filter(userId => this.constantCollection.userList.findIndex(u => u.userId === userId) > -1);
|
||||||
node.origin.properties.assignValue = node.assignValue;
|
node.origin.properties.assignValue = node.assignValue;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let item = {
|
||||||
|
workflowName,
|
||||||
|
workflowRemark,
|
||||||
|
workflowCategory,
|
||||||
|
workflowId: workflowId || null,
|
||||||
|
workflowConfig: workflowConfig ? JSON.stringify(workflowConfig) : null,
|
||||||
|
workflowForm: workflowForm ? JSON.stringify(workflowForm) : null,
|
||||||
}
|
}
|
||||||
});
|
if (id) {
|
||||||
let item = {
|
item.id = id;
|
||||||
workflowName,
|
}
|
||||||
workflowRemark,
|
return item;
|
||||||
workflowCategory,
|
},
|
||||||
workflowId: workflowId || null,
|
|
||||||
workflowConfig: workflowConfig ? JSON.stringify(workflowConfig) : null,
|
|
||||||
workflowForm: workflowForm ? JSON.stringify(workflowForm) : null,
|
|
||||||
}
|
|
||||||
if (id) {
|
|
||||||
item.id = id;
|
|
||||||
}
|
|
||||||
return item;
|
|
||||||
},
|
|
||||||
|
|
||||||
buildWorkflowFormList(val) {
|
buildWorkflowFormList(val) {
|
||||||
this.constantCollection.workflowFormList = [];
|
this.constantCollection.workflowFormList = [];
|
||||||
for (const item of val) {
|
for (const item of val) {
|
||||||
this.constantCollection.workflowFormList.push({
|
this.constantCollection.workflowFormList.push({
|
||||||
text: item.component.outline,
|
text: item.component.outline,
|
||||||
value: item.id
|
value: item.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
buildWorkflowConfig() {
|
||||||
|
for (const config of this.editItem.workflowConfig.nodeList) {
|
||||||
|
if (!config.formId) return;
|
||||||
|
const formId = []
|
||||||
|
for (const item of config.formId) {
|
||||||
|
if (!this.constantCollection.workflowFormList.find(e => e.value === item)) {
|
||||||
|
formId.push(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
config.formId = formId
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取user数据
|
||||||
|
*/
|
||||||
|
async getUserList() {
|
||||||
|
const { rows } = (await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: 'workflowManagement',
|
||||||
|
actionId: 'selectUserList',
|
||||||
|
actionData: {},
|
||||||
|
where: {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})).data.appData.resultData;
|
||||||
|
this.constantCollection.userList = rows.map(e => {
|
||||||
|
return { text: e.username, value: e.userId, userId: e.userId }
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
},
|
/**
|
||||||
|
* 获取group数据
|
||||||
buildWorkflowConfig() {
|
*/
|
||||||
for (const config of this.editItem.workflowConfig.nodeList) {
|
async getGroupList() {
|
||||||
if (!config.formId) return;
|
const { rows } = (await window.jianghuAxios({
|
||||||
const formId = []
|
data: {
|
||||||
for (const item of config.formId) {
|
appData: {
|
||||||
if (!this.constantCollection.workflowFormList.find(e => e.value === item)) {
|
pageId: 'workflowManagement',
|
||||||
formId.push(item)
|
actionId: 'selectGroupList',
|
||||||
|
actionData: {},
|
||||||
|
where: {},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})).data.appData.resultData;
|
||||||
config.formId = formId
|
this.constantCollection.groupList = rows.map(e => {
|
||||||
}
|
return { text: e.groupName, value: e.groupId }
|
||||||
},
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
async clearItemData() {
|
||||||
* 获取user数据
|
this.dialogSaveInfoAction = 'createItem';
|
||||||
*/
|
this.editItem = { workflowForm: [], workflowConfig: { lineList: [], nodeList: [] }, mode: 'serial' };
|
||||||
async getUserList() {
|
},
|
||||||
const {rows} = (await window.jianghuAxios({
|
// <!-- 提交流程修改 >>>>>>>>>>>>> -->
|
||||||
data: {
|
async syncEditItem() {
|
||||||
appData: {
|
this.loading = true;
|
||||||
pageId: 'workflowManagement',
|
this.dialogSaveInfoAction = 'updateItem';
|
||||||
actionId: 'selectUserList',
|
const { rows } = (await window.jianghuAxios({
|
||||||
actionData: {},
|
data: {
|
||||||
where: {},
|
appData: {
|
||||||
|
pageId: 'workflowManagement',
|
||||||
|
actionId: 'selectItemList',
|
||||||
|
where: { id: this.editItem.id },
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
})).data.appData.resultData;
|
||||||
|
if (!rows.length) {
|
||||||
|
this.clearItemData();
|
||||||
|
} else {
|
||||||
|
const item = rows[0];
|
||||||
|
item.workflowConfig = item.workflowConfig ? JSON.parse(item.workflowConfig) : null;
|
||||||
|
item.workflowForm = item.workflowForm ? JSON.parse(item.workflowForm) : [];
|
||||||
|
item.mode = item.workflowConfig.mode || 'serial';
|
||||||
|
this.editItem = item;
|
||||||
}
|
}
|
||||||
})).data.appData.resultData;
|
setTimeout(() => {
|
||||||
this.constantCollection.userList = rows.map(e => {
|
this.loading = false;
|
||||||
return {text: e.username, value: e.userId, userId: e.userId }
|
}, 500)
|
||||||
})
|
},
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 获取group数据
|
|
||||||
*/
|
|
||||||
async getGroupList() {
|
|
||||||
const {rows} = (await window.jianghuAxios({
|
|
||||||
data: {
|
|
||||||
appData: {
|
|
||||||
pageId: 'workflowManagement',
|
|
||||||
actionId: 'selectGroupList',
|
|
||||||
actionData: {},
|
|
||||||
where: {},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).data.appData.resultData;
|
|
||||||
this.constantCollection.groupList = rows.map(e => {
|
|
||||||
return {text: e.groupName, value: e.groupId}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
async clearItemData() {
|
async confirmCreateItemDialog() {
|
||||||
this.dialogSaveInfoAction = 'createItem';
|
if (await window.confirmDialog({ title: "新增", content: "确定新增吗?" }) === false) {
|
||||||
this.editItem = {workflowForm: [], workflowConfig: {lineList: [], nodeList: []}, mode: 'serial'};
|
|
||||||
},
|
|
||||||
|
|
||||||
async syncEditItem() {
|
|
||||||
this.loading = true;
|
|
||||||
this.dialogSaveInfoAction = 'updateItem';
|
|
||||||
const {rows} = (await window.jianghuAxios({
|
|
||||||
data: {
|
|
||||||
appData: {
|
|
||||||
pageId: 'workflowManagement',
|
|
||||||
actionId: 'selectItemList',
|
|
||||||
where: {id: this.editItem.id},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).data.appData.resultData;
|
|
||||||
if (!rows.length) {
|
|
||||||
this.clearItemData();
|
|
||||||
} else {
|
|
||||||
const item = rows[0];
|
|
||||||
item.workflowConfig = item.workflowConfig ? JSON.parse(item.workflowConfig) : null;
|
|
||||||
item.workflowForm = item.workflowForm ? JSON.parse(item.workflowForm) : [];
|
|
||||||
item.mode = item.workflowConfig.mode || 'serial';
|
|
||||||
this.editItem = item;
|
|
||||||
}
|
|
||||||
setTimeout(() => {
|
|
||||||
this.loading = false;
|
|
||||||
}, 500)
|
|
||||||
},
|
|
||||||
|
|
||||||
async confirmCreateItemDialog() {
|
|
||||||
if (await window.confirmDialog({title: "新增", content: "确定新增吗?"}) === false) {
|
|
||||||
throw new Error("[confirmCreateFormDialog] 否");
|
throw new Error("[confirmCreateFormDialog] 否");
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增数据
|
|
||||||
*/
|
|
||||||
async doCreateItem() {
|
|
||||||
delete this.editItem.id;
|
|
||||||
const item = this.buildEditItem();
|
|
||||||
await window.vtoast.loading("新增数据");
|
|
||||||
const {rows} = (await window.jianghuAxios({
|
|
||||||
data: {
|
|
||||||
appData: {
|
|
||||||
pageId: 'workflowManagement',
|
|
||||||
actionId: 'insertItem',
|
|
||||||
actionData: item
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})).data.appData.resultData;
|
},
|
||||||
this.editItem.id = rows[0];
|
|
||||||
history.pushState({}, '', `?id=${rows[0]}`);
|
|
||||||
await window.vtoast.success("新增数据成功");
|
|
||||||
},
|
|
||||||
|
|
||||||
async confirmUpdateItemDialog() {
|
/**
|
||||||
if (await window.confirmDialog({title: "修改", content: "确定修改吗?"}) === false) {
|
* 新增数据
|
||||||
|
*/
|
||||||
|
async doCreateItem() {
|
||||||
|
delete this.editItem.id;
|
||||||
|
const item = this.buildEditItem();
|
||||||
|
await window.vtoast.loading("新增数据");
|
||||||
|
const { rows } = (await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: 'workflowManagement',
|
||||||
|
actionId: 'insertItem',
|
||||||
|
actionData: item
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})).data.appData.resultData;
|
||||||
|
this.editItem.id = rows[0];
|
||||||
|
history.pushState({}, '', `?id=${rows[0]}`);
|
||||||
|
await window.vtoast.success("新增数据成功");
|
||||||
|
},
|
||||||
|
|
||||||
|
async confirmUpdateItemDialog() {
|
||||||
|
if (await window.confirmDialog({ title: "修改", content: "确定修改吗?" }) === false) {
|
||||||
throw new Error("[confirmUpdateItemDialog] 否");
|
throw new Error("[confirmUpdateItemDialog] 否");
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改数据
|
|
||||||
*/
|
|
||||||
async doUpdateItem() {
|
|
||||||
const {id, ...item} = this.buildEditItem();
|
|
||||||
await window.vtoast.loading("修改数据");
|
|
||||||
await window.jianghuAxios({
|
|
||||||
data: {
|
|
||||||
appData: {
|
|
||||||
pageId: 'workflowManagement',
|
|
||||||
actionId: 'updateItem',
|
|
||||||
actionData: item,
|
|
||||||
where: {id: id}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
await window.vtoast.success("修改数据成功");
|
|
||||||
},
|
/**
|
||||||
}
|
* 修改数据
|
||||||
})
|
*/
|
||||||
|
async doUpdateItem() {
|
||||||
|
const { id, ...item } = this.buildEditItem();
|
||||||
|
await window.vtoast.loading("修改数据");
|
||||||
|
await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: 'workflowManagement',
|
||||||
|
actionId: 'updateItem',
|
||||||
|
actionData: item,
|
||||||
|
where: { id: id }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
await window.vtoast.success("修改数据成功");
|
||||||
|
},
|
||||||
|
// <!-- <<<<<<<<<<<<< 提交流程修改 -->
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.theme--light.v-data-table > .v-data-table__wrapper > table > tbody > tr > td:not(.v-data-table__mobile-row) {
|
.theme--light.v-data-table>.v-data-table__wrapper>table>tbody>tr>td:not(.v-data-table__mobile-row) {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.theme--light.v-data-table > .v-data-table__wrapper > table > tbody > tr {
|
.theme--light.v-data-table>.v-data-table__wrapper>table>tbody>tr {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -211,7 +211,6 @@
|
|||||||
group: '',
|
group: '',
|
||||||
},
|
},
|
||||||
workflowPersonList: [],
|
workflowPersonList: [],
|
||||||
workflowId: '6D7HV6Twfer_xtmbqUsDO'
|
|
||||||
},
|
},
|
||||||
watch: {},
|
watch: {},
|
||||||
created() {
|
created() {
|
||||||
@@ -269,7 +268,7 @@
|
|||||||
node.isNeedAllApproval = true;
|
node.isNeedAllApproval = true;
|
||||||
});
|
});
|
||||||
row.workflowPersonList = workflowNodeList.filter(node => node.id.includes('userTask-'));
|
row.workflowPersonList = workflowNodeList.filter(node => node.id.includes('userTask-'));
|
||||||
row.workflowForm = JSON.parse(row.workflowConfig);
|
row.workflowForm = JSON.parse(row.workflowForm);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.tableData = rows;
|
this.tableData = rows;
|
||||||
@@ -301,9 +300,10 @@
|
|||||||
// ---------- 斑马纹开关 uiAction >>>>>>>>>> --------
|
// ---------- 斑马纹开关 uiAction >>>>>>>>>> --------
|
||||||
|
|
||||||
// ---------- <<<<<<<<<< 申请项目审核 --------
|
// ---------- <<<<<<<<<< 申请项目审核 --------
|
||||||
async prepareCreateFormData({workflowForm, workflowPersonList}) {
|
async prepareCreateFormData({workflowForm, workflowPersonList, workflowId}) {
|
||||||
this.createFormList = workflowForm;
|
this.createFormList = workflowForm;
|
||||||
this.workflowPersonList = workflowPersonList;
|
this.workflowPersonList = workflowPersonList;
|
||||||
|
this.createItem.workflowId = workflowId;
|
||||||
},
|
},
|
||||||
|
|
||||||
async openCreateDrawer() {
|
async openCreateDrawer() {
|
||||||
@@ -340,11 +340,10 @@
|
|||||||
data: {
|
data: {
|
||||||
appData: {
|
appData: {
|
||||||
pageId: 'workflowManagement',
|
pageId: 'workflowManagement',
|
||||||
actionId: 'insertItem',
|
actionId: 'insertTask',
|
||||||
actionData: {
|
actionData: {
|
||||||
formItemList: this.createFormList,
|
formItemList: this.createFormList,
|
||||||
group: this.createItem.group,
|
workflowId: this.createItem.workflowId,
|
||||||
workflowId: this.workflowId,
|
|
||||||
workflowConfigCustom: JSON.stringify({ nodeListOfUserTaskNode: this.workflowPersonList })
|
workflowConfigCustom: JSON.stringify({ nodeListOfUserTaskNode: this.workflowPersonList })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user