Skip to content

Commit cb51da0

Browse files
YunaiVgitee-org
authored andcommitted
!397 Vue3 工作流的预览版
Merge pull request !397 from 芋道源码/feature/vue3-bpm
2 parents 1851d58 + 741ba0b commit cb51da0

File tree

3 files changed

+65
-57
lines changed

3 files changed

+65
-57
lines changed
Lines changed: 63 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,51 @@
11
<template>
22
<div class="panel-tab__content">
3-
<el-form size="mini" label-width="90px" :model="model" :rules="rules" @submit.native.prevent>
4-
<div v-if="elementBaseInfo.$type === 'bpmn:Process'"> <!-- 如果是 Process 信息的时候,使用自定义表单 -->
5-
<el-link href="https://doc.iocoder.cn/bpm/#_3-%E6%B5%81%E7%A8%8B%E5%9B%BE%E7%A4%BA%E4%BE%8B"
6-
type="danger" target="_blank">如何实现实现会签、或签?</el-link>
3+
<el-form
4+
size="mini"
5+
label-width="90px"
6+
:model="model"
7+
:rules="rules"
8+
@submit.native.prevent
9+
>
10+
<div v-if="elementBaseInfo.$type === 'bpmn:Process'">
11+
<!-- 如果是 Process 信息的时候,使用自定义表单 -->
12+
<el-link
13+
href="https://doc.iocoder.cn/bpm/#_3-%E6%B5%81%E7%A8%8B%E5%9B%BE%E7%A4%BA%E4%BE%8B"
14+
type="danger"
15+
target="_blank"
16+
>如何实现实现会签、或签?</el-link
17+
>
718
<el-form-item label="流程标识" prop="key">
8-
<el-input v-model="model.key" placeholder="请输入流标标识"
9-
:disabled="model.id !== undefined && model.id.length > 0" @change="handleKeyUpdate" />
19+
<el-input
20+
v-model="model.key"
21+
placeholder="请输入流标标识"
22+
:disabled="model.id !== undefined && model.id.length > 0"
23+
@change="handleKeyUpdate"
24+
/>
1025
</el-form-item>
1126
<el-form-item label="流程名称" prop="name">
12-
<el-input v-model="model.name" placeholder="请输入流程名称" clearable @change="handleNameUpdate" />
27+
<el-input
28+
v-model="model.name"
29+
placeholder="请输入流程名称"
30+
clearable
31+
@change="handleNameUpdate"
32+
/>
1333
</el-form-item>
1434
</div>
1535
<div v-else>
1636
<el-form-item label="ID">
17-
<el-input v-model="elementBaseInfo.id" clearable @change="updateBaseInfo('id')"/>
37+
<el-input
38+
v-model="elementBaseInfo.id"
39+
clearable
40+
@change="updateBaseInfo('id')"
41+
/>
1842
</el-form-item>
1943
<el-form-item label="名称">
20-
<el-input v-model="elementBaseInfo.name" clearable @change="updateBaseInfo('name')" />
44+
<el-input
45+
v-model="elementBaseInfo.name"
46+
clearable
47+
@change="updateBaseInfo('name')"
48+
/>
2149
</el-form-item>
2250
</div>
2351
</el-form>
@@ -31,7 +59,7 @@ export default {
3159
businessObject: Object,
3260
model: Object, // 流程模型的数据
3361
},
34-
data() {
62+
data () {
3563
return {
3664
elementBaseInfo: {},
3765
// 流程表单的下拉框的数据
@@ -41,14 +69,14 @@ export default {
4169
key: [{ required: true, message: "流程标识不能为空", trigger: "blur" }],
4270
name: [{ required: true, message: "流程名称不能为空", trigger: "blur" }],
4371
},
44-
};
72+
}
4573
},
4674
watch: {
4775
businessObject: {
4876
immediate: false,
49-
handler: function(val) {
77+
handler: function (val) {
5078
if (val) {
51-
this.$nextTick(() => this.resetBaseInfo());
79+
this.$nextTick(() => this.resetBaseInfo())
5280
}
5381
}
5482
},
@@ -59,61 +87,61 @@ export default {
5987
// }
6088
// }
6189
},
62-
created() {
90+
created () {
6391
// 针对上传的 bpmn 流程图时,需要延迟 1 秒的时间,保证 key 和 name 的更新
6492
setTimeout(() => {
6593
this.handleKeyUpdate(this.model.key)
6694
this.handleNameUpdate(this.model.name)
6795
}, 1000)
6896
},
6997
methods: {
70-
resetBaseInfo() {
71-
this.bpmnElement = window?.bpmnInstances?.bpmnElement;
72-
this.elementBaseInfo = JSON.parse(JSON.stringify(this.bpmnElement.businessObject));
98+
resetBaseInfo () {
99+
this.bpmnElement = window?.bpmnInstances?.bpmnElement
100+
this.elementBaseInfo = JSON.parse(JSON.stringify(this.bpmnElement.businessObject))
73101
},
74-
handleKeyUpdate(value) {
102+
handleKeyUpdate (value) {
75103
// 校验 value 的值,只有 XML NCName 通过的情况下,才进行赋值。否则,会导致流程图报错,无法绘制的问题
76104
if (!value) {
77-
return;
105+
return
78106
}
79107
if (!value.match(/[a-zA-Z_][\-_.0-9a-zA-Z$]*/)) {
80-
console.log('key 不满足 XML NCName 规则,所以不进行赋值');
81-
return;
108+
console.log('key 不满足 XML NCName 规则,所以不进行赋值')
109+
return
82110
}
83-
console.log('key 满足 XML NCName 规则,所以进行赋值');
111+
console.log('key 满足 XML NCName 规则,所以进行赋值')
84112
85113
// 在 BPMN 的 XML 中,流程标识 key,其实对应的是 id 节点
86-
this.elementBaseInfo['id'] = value;
87-
this.updateBaseInfo('id');
114+
this.elementBaseInfo['id'] = value
115+
this.updateBaseInfo('id')
88116
},
89-
handleNameUpdate(value) {
117+
handleNameUpdate (value) {
90118
if (!value) {
91119
return
92120
}
93-
this.elementBaseInfo['name'] = value;
94-
this.updateBaseInfo('name');
121+
this.elementBaseInfo['name'] = value
122+
this.updateBaseInfo('name')
95123
},
96-
handleDescriptionUpdate(value) {
124+
handleDescriptionUpdate (value) {
97125
// TODO 芋艿:documentation 暂时无法修改,后续在看看
98126
// this.elementBaseInfo['documentation'] = value;
99127
// this.updateBaseInfo('documentation');
100128
},
101-
updateBaseInfo(key) {
129+
updateBaseInfo (key) {
102130
// 触发 elementBaseInfo 对应的字段
103-
const attrObj = Object.create(null);
104-
attrObj[key] = this.elementBaseInfo[key];
131+
const attrObj = Object.create(null)
132+
attrObj[key] = this.elementBaseInfo[key]
105133
if (key === "id") {
106134
window.bpmnInstances.modeling.updateProperties(this.bpmnElement, {
107135
id: this.elementBaseInfo[key],
108136
di: { id: `${this.elementBaseInfo[key]}_di` }
109-
});
137+
})
110138
} else {
111-
window.bpmnInstances.modeling.updateProperties(this.bpmnElement, attrObj);
139+
window.bpmnInstances.modeling.updateProperties(this.bpmnElement, attrObj)
112140
}
113141
}
114142
},
115-
beforeDestroy() {
116-
this.bpmnElement = null;
143+
beforeDestroy () {
144+
this.bpmnElement = null
117145
}
118146
};
119147
</script>

src/views/bpm/processInstance/detail.vue

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,7 @@ export default {
163163
rules: {
164164
assigneeUserId: [{ required: true, message: "新审批人不能为空", trigger: "change" }],
165165
}
166-
},
167-
168-
// 数据字典
169-
categoryDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY),
166+
}
170167
};
171168
},
172169
created() {
@@ -275,23 +272,6 @@ export default {
275272
this.tasksLoad = false;
276273
});
277274
},
278-
/** 处理选择流程的按钮操作 **/
279-
handleSelect(row) {
280-
// 设置选择的流程
281-
this.selectProcessInstance = row;
282-
283-
// 流程表单
284-
if (row.formId) {
285-
// 设置对应的表单
286-
this.detailForm = {
287-
...JSON.parse(row.formConf),
288-
fields: decodeFields(row.formFields)
289-
}
290-
} else if (row.formCustomCreatePath) {
291-
this.$router.push({ path: row.formCustomCreatePath});
292-
// 这里暂时无需加载流程图,因为跳出到另外个 Tab;
293-
}
294-
},
295275
getDateStar(ms) {
296276
return getDate(ms);
297277
},

src/views/bpm/processInstance/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
</el-table-column>
5959
<el-table-column label="当前审批任务" align="center" prop="tasks">
6060
<template v-slot="scope">
61-
<el-button v-for="task in scope.row.tasks" :key="task.id" type="text" @click="handleFormDetail(task.id)">
61+
<el-button v-for="task in scope.row.tasks" :key="task.id" type="text"">
6262
<span>{{ task.name }}</span>
6363
</el-button>
6464
</template>

0 commit comments

Comments
 (0)