Skip to content

Commit d0f7334

Browse files
committed
BPM:增强 model 流程模型部署时,各种参数校验
1 parent 08dd4ed commit d0f7334

File tree

7 files changed

+69
-29
lines changed

7 files changed

+69
-29
lines changed

src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ const initBpmnModeler = () => {
436436
437437
// bpmnModeler.createDiagram()
438438
439-
console.log(bpmnModeler, 'bpmnModeler111111')
439+
// console.log(bpmnModeler, 'bpmnModeler111111')
440440
emit('init-finished', bpmnModeler)
441441
initModelListeners()
442442
}
@@ -666,10 +666,10 @@ const previewProcessJson = () => {
666666
}
667667
/* ------------------------------------------------ 芋道源码 methods ------------------------------------------------------ */
668668
const processSave = async () => {
669-
console.log(bpmnModeler, 'bpmnModelerbpmnModelerbpmnModelerbpmnModeler')
669+
// console.log(bpmnModeler, 'bpmnModelerbpmnModelerbpmnModelerbpmnModeler')
670670
const { err, xml } = await bpmnModeler.saveXML()
671-
console.log(err, 'errerrerrerrerr')
672-
console.log(xml, 'xmlxmlxmlxmlxml')
671+
// console.log(err, 'errerrerrerrerr')
672+
// console.log(xml, 'xmlxmlxmlxmlxml')
673673
// 读取异常时抛出异常
674674
if (err) {
675675
// this.$modal.msgError('保存模型失败,请重试!')

src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ const elementHover = (element) => {
368368
html += `<p>结束时间:${formatDate(processInstance.value.endTime)}</p>`
369369
}
370370
}
371-
console.log(html, 'html111111111111111')
371+
// console.log(html, 'html111111111111111')
372372
elementOverlayIds.value[element.value.id] = toRaw(overlays.value)?.add(element.value, {
373373
position: { left: 0, bottom: 0 },
374374
html: `<div class="element-overlays">${html}</div>`

src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ const resetBaseInfo = () => {
6868
console.log(bpmnElement.value, 'bpmnElement')
6969
7070
bpmnElement.value = bpmnInstances()?.bpmnElement
71-
console.log(bpmnElement.value, 'resetBaseInfo11111111111')
71+
// console.log(bpmnElement.value, 'resetBaseInfo11111111111')
7272
elementBaseInfo.value = bpmnElement.value.businessObject
7373
needProps.value['type'] = bpmnElement.value.businessObject.$type
7474
// elementBaseInfo.value['typess'] = bpmnElement.value.businessObject.$type
7575
7676
// elementBaseInfo.value = JSON.parse(JSON.stringify(bpmnElement.value.businessObject))
77-
console.log(elementBaseInfo.value, 'elementBaseInfo22222222222')
77+
// console.log(elementBaseInfo.value, 'elementBaseInfo22222222222')
7878
}
7979
const handleKeyUpdate = (value) => {
8080
// 校验 value 的值,只有 XML NCName 通过的情况下,才进行赋值。否则,会导致流程图报错,无法绘制的问题
@@ -121,11 +121,11 @@ const updateBaseInfo = (key) => {
121121
// id: elementBaseInfo.value[key]
122122
// // di: { id: `${elementBaseInfo.value[key]}_di` }
123123
// }
124-
console.log(elementBaseInfo, 'elementBaseInfo11111111111')
124+
// console.log(elementBaseInfo, 'elementBaseInfo11111111111')
125125
needProps.value = { ...elementBaseInfo.value, ...needProps.value }
126126
127127
if (key === 'id') {
128-
console.log('jinru')
128+
// console.log('jinru')
129129
console.log(window, 'window')
130130
console.log(bpmnElement.value, 'bpmnElement')
131131
console.log(toRaw(bpmnElement.value), 'bpmnElement')
@@ -139,28 +139,29 @@ const updateBaseInfo = (key) => {
139139
}
140140
}
141141
142-
// TODO 芋艿:这里延迟,可能存在覆盖 userTask 的问题。。例如说,打开的时候,立马选中某个 usertask,则它的 id 会被覆盖。。。
143-
onMounted(() => {
144-
// 针对上传的 bpmn 流程图时,需要延迟 1 秒的时间,保证 key 和 name 的更新
145-
setTimeout(() => {
146-
console.log(props.model, 'props.model')
147-
handleKeyUpdate(props.model.key)
148-
handleNameUpdate(props.model.name)
149-
console.log(props, 'propsssssssssssssssssssss')
150-
}, 1000)
151-
})
152-
153142
watch(
154143
() => props.businessObject,
155144
(val) => {
156-
console.log(val, 'val11111111111111111111')
145+
// console.log(val, 'val11111111111111111111')
157146
if (val) {
158147
// nextTick(() => {
159148
resetBaseInfo()
160149
// })
161150
}
162151
}
163152
)
153+
154+
watch(
155+
() => props.model?.key,
156+
(val) => {
157+
// 针对上传的 bpmn 流程图时,保证 key 和 name 的更新
158+
if (val) {
159+
handleKeyUpdate(props.model.key)
160+
handleNameUpdate(props.model.name)
161+
}
162+
}
163+
)
164+
164165
// watch(
165166
// () => ({ ...props }),
166167
// (oldVal, newVal) => {

src/components/bpmnProcessDesigner/package/penal/form/ElementForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ const saveField = () => {
429429
430430
// 移除某个 字段的 配置项
431431
const removeFieldOptionItem = (option, index, type) => {
432-
console.log(option, 'option')
432+
// console.log(option, 'option')
433433
if (type === 'property') {
434434
fieldPropertiesList.value.splice(index, 1)
435435
return

src/views/bpm/model/editor/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ onMounted(async () => {
8989
}
9090
// 查询模型
9191
const data = await ModelApi.getModel(modelId)
92-
xmlString.value = data.bpmnXml
9392
model.value = {
9493
...data,
9594
bpmnXml: undefined // 清空 bpmnXml 属性
9695
}
96+
xmlString.value = data.bpmnXml
9797
})
9898
</script>
9999
<style lang="scss">

src/views/bpm/processInstance/detail/ProcessInstanceTaskList.vue

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,21 @@
1616
任务:{{ item.name }}
1717
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="item.status" />
1818
<el-button
19-
style="margin-left: 5px"
19+
class="ml-10px"
2020
v-if="!isEmpty(item.children)"
2121
@click="openChildrenTask(item)"
22+
size="small"
2223
>
2324
<Icon icon="ep:memo" /> 子任务
2425
</el-button>
26+
<el-button
27+
class="ml-10px"
28+
size="small"
29+
v-if="item.formId > 0"
30+
@click="handleFormDetail(item)"
31+
>
32+
<Icon icon="ep:document" /> 查看表单
33+
</el-button>
2534
</p>
2635
<el-card :body-style="{ padding: '10px' }">
2736
<label v-if="item.assigneeUser" style="margin-right: 30px; font-weight: normal">
@@ -50,17 +59,28 @@
5059
</el-timeline>
5160
</div>
5261
</el-col>
53-
54-
<!-- 弹窗:子任务 -->
55-
<TaskSignList ref="taskSignListRef" @success="refresh" />
5662
</el-card>
63+
64+
<!-- 弹窗:子任务 -->
65+
<TaskSignList ref="taskSignListRef" @success="refresh" />
66+
<!-- 弹窗:表单 -->
67+
<Dialog title="表单详情" v-model="taskFormVisible" width="600">
68+
<form-create
69+
ref="fApi"
70+
v-model="taskForm.value"
71+
:option="taskForm.option"
72+
:rule="taskForm.rule"
73+
/>
74+
</Dialog>
5775
</template>
5876
<script lang="ts" setup>
5977
import { formatDate, formatPast2 } from '@/utils/formatTime'
6078
import { propTypes } from '@/utils/propTypes'
6179
import { DICT_TYPE } from '@/utils/dict'
6280
import { isEmpty } from '@/utils/is'
6381
import TaskSignList from './dialog/TaskSignList.vue'
82+
import type { ApiAttrs } from '@form-create/element-ui/types/config'
83+
import { setConfAndFields2 } from '@/utils/formCreate'
6484
6585
defineOptions({ name: 'BpmProcessInstanceTaskList' })
6686
@@ -122,6 +142,26 @@ const openChildrenTask = (item: any) => {
122142
taskSignListRef.value.open(item)
123143
}
124144
145+
/** 查看表单 */
146+
const fApi = ref<ApiAttrs>() // form-create 的 API 操作类
147+
const taskForm = ref({
148+
rule: [],
149+
option: {},
150+
value: {}
151+
}) // 流程任务的表单详情
152+
const taskFormVisible = ref(false)
153+
const handleFormDetail = async (row) => {
154+
// 设置表单
155+
setConfAndFields2(taskForm, row.formConf, row.formFields, row.formVariables)
156+
// 弹窗打开
157+
taskFormVisible.value = true
158+
// 隐藏提交、重置按钮,设置禁用只读
159+
await nextTick()
160+
fApi.value.fapi.btn.show(false)
161+
fApi.value?.fapi?.resetBtn.show(false)
162+
fApi.value?.fapi?.disabled(true)
163+
}
164+
125165
/** 刷新数据 */
126166
const emit = defineEmits(['refresh']) // 定义 success 事件,用于操作成功后的回调
127167
const refresh = () => {

src/views/bpm/processInstance/detail/index.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,10 @@ const approveFormFApis = ref<ApiAttrs[]>([]) // approveForms 的 fAPi
168168
// ========== 申请信息 ==========
169169
const fApi = ref<ApiAttrs>() //
170170
const detailForm = ref({
171-
// 流程表单详情
172171
rule: [],
173172
option: {},
174173
value: {}
175-
})
174+
}) // 流程实例的表单详情
176175
177176
/** 监听 approveFormFApis,实现它对应的 form-create 初始化后,隐藏掉对应的表单提交按钮 */
178177
watch(

0 commit comments

Comments
 (0)