BPM:增强 model 流程模型部署时,各种参数校验
This commit is contained in:
parent
08dd4ed072
commit
d0f73344bf
@ -436,7 +436,7 @@ const initBpmnModeler = () => {
|
|||||||
|
|
||||||
// bpmnModeler.createDiagram()
|
// bpmnModeler.createDiagram()
|
||||||
|
|
||||||
console.log(bpmnModeler, 'bpmnModeler111111')
|
// console.log(bpmnModeler, 'bpmnModeler111111')
|
||||||
emit('init-finished', bpmnModeler)
|
emit('init-finished', bpmnModeler)
|
||||||
initModelListeners()
|
initModelListeners()
|
||||||
}
|
}
|
||||||
@ -666,10 +666,10 @@ const previewProcessJson = () => {
|
|||||||
}
|
}
|
||||||
/* ------------------------------------------------ 芋道源码 methods ------------------------------------------------------ */
|
/* ------------------------------------------------ 芋道源码 methods ------------------------------------------------------ */
|
||||||
const processSave = async () => {
|
const processSave = async () => {
|
||||||
console.log(bpmnModeler, 'bpmnModelerbpmnModelerbpmnModelerbpmnModeler')
|
// console.log(bpmnModeler, 'bpmnModelerbpmnModelerbpmnModelerbpmnModeler')
|
||||||
const { err, xml } = await bpmnModeler.saveXML()
|
const { err, xml } = await bpmnModeler.saveXML()
|
||||||
console.log(err, 'errerrerrerrerr')
|
// console.log(err, 'errerrerrerrerr')
|
||||||
console.log(xml, 'xmlxmlxmlxmlxml')
|
// console.log(xml, 'xmlxmlxmlxmlxml')
|
||||||
// 读取异常时抛出异常
|
// 读取异常时抛出异常
|
||||||
if (err) {
|
if (err) {
|
||||||
// this.$modal.msgError('保存模型失败,请重试!')
|
// this.$modal.msgError('保存模型失败,请重试!')
|
||||||
|
@ -368,7 +368,7 @@ const elementHover = (element) => {
|
|||||||
html += `<p>结束时间:${formatDate(processInstance.value.endTime)}</p>`
|
html += `<p>结束时间:${formatDate(processInstance.value.endTime)}</p>`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(html, 'html111111111111111')
|
// console.log(html, 'html111111111111111')
|
||||||
elementOverlayIds.value[element.value.id] = toRaw(overlays.value)?.add(element.value, {
|
elementOverlayIds.value[element.value.id] = toRaw(overlays.value)?.add(element.value, {
|
||||||
position: { left: 0, bottom: 0 },
|
position: { left: 0, bottom: 0 },
|
||||||
html: `<div class="element-overlays">${html}</div>`
|
html: `<div class="element-overlays">${html}</div>`
|
||||||
|
@ -68,13 +68,13 @@ const resetBaseInfo = () => {
|
|||||||
console.log(bpmnElement.value, 'bpmnElement')
|
console.log(bpmnElement.value, 'bpmnElement')
|
||||||
|
|
||||||
bpmnElement.value = bpmnInstances()?.bpmnElement
|
bpmnElement.value = bpmnInstances()?.bpmnElement
|
||||||
console.log(bpmnElement.value, 'resetBaseInfo11111111111')
|
// console.log(bpmnElement.value, 'resetBaseInfo11111111111')
|
||||||
elementBaseInfo.value = bpmnElement.value.businessObject
|
elementBaseInfo.value = bpmnElement.value.businessObject
|
||||||
needProps.value['type'] = bpmnElement.value.businessObject.$type
|
needProps.value['type'] = bpmnElement.value.businessObject.$type
|
||||||
// elementBaseInfo.value['typess'] = bpmnElement.value.businessObject.$type
|
// elementBaseInfo.value['typess'] = bpmnElement.value.businessObject.$type
|
||||||
|
|
||||||
// elementBaseInfo.value = JSON.parse(JSON.stringify(bpmnElement.value.businessObject))
|
// elementBaseInfo.value = JSON.parse(JSON.stringify(bpmnElement.value.businessObject))
|
||||||
console.log(elementBaseInfo.value, 'elementBaseInfo22222222222')
|
// console.log(elementBaseInfo.value, 'elementBaseInfo22222222222')
|
||||||
}
|
}
|
||||||
const handleKeyUpdate = (value) => {
|
const handleKeyUpdate = (value) => {
|
||||||
// 校验 value 的值,只有 XML NCName 通过的情况下,才进行赋值。否则,会导致流程图报错,无法绘制的问题
|
// 校验 value 的值,只有 XML NCName 通过的情况下,才进行赋值。否则,会导致流程图报错,无法绘制的问题
|
||||||
@ -121,11 +121,11 @@ const updateBaseInfo = (key) => {
|
|||||||
// id: elementBaseInfo.value[key]
|
// id: elementBaseInfo.value[key]
|
||||||
// // di: { id: `${elementBaseInfo.value[key]}_di` }
|
// // di: { id: `${elementBaseInfo.value[key]}_di` }
|
||||||
// }
|
// }
|
||||||
console.log(elementBaseInfo, 'elementBaseInfo11111111111')
|
// console.log(elementBaseInfo, 'elementBaseInfo11111111111')
|
||||||
needProps.value = { ...elementBaseInfo.value, ...needProps.value }
|
needProps.value = { ...elementBaseInfo.value, ...needProps.value }
|
||||||
|
|
||||||
if (key === 'id') {
|
if (key === 'id') {
|
||||||
console.log('jinru')
|
// console.log('jinru')
|
||||||
console.log(window, 'window')
|
console.log(window, 'window')
|
||||||
console.log(bpmnElement.value, 'bpmnElement')
|
console.log(bpmnElement.value, 'bpmnElement')
|
||||||
console.log(toRaw(bpmnElement.value), 'bpmnElement')
|
console.log(toRaw(bpmnElement.value), 'bpmnElement')
|
||||||
@ -139,21 +139,10 @@ const updateBaseInfo = (key) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 芋艿:这里延迟,可能存在覆盖 userTask 的问题。。例如说,打开的时候,立马选中某个 usertask,则它的 id 会被覆盖。。。
|
|
||||||
onMounted(() => {
|
|
||||||
// 针对上传的 bpmn 流程图时,需要延迟 1 秒的时间,保证 key 和 name 的更新
|
|
||||||
setTimeout(() => {
|
|
||||||
console.log(props.model, 'props.model')
|
|
||||||
handleKeyUpdate(props.model.key)
|
|
||||||
handleNameUpdate(props.model.name)
|
|
||||||
console.log(props, 'propsssssssssssssssssssss')
|
|
||||||
}, 1000)
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.businessObject,
|
() => props.businessObject,
|
||||||
(val) => {
|
(val) => {
|
||||||
console.log(val, 'val11111111111111111111')
|
// console.log(val, 'val11111111111111111111')
|
||||||
if (val) {
|
if (val) {
|
||||||
// nextTick(() => {
|
// nextTick(() => {
|
||||||
resetBaseInfo()
|
resetBaseInfo()
|
||||||
@ -161,6 +150,18 @@ watch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.model?.key,
|
||||||
|
(val) => {
|
||||||
|
// 针对上传的 bpmn 流程图时,保证 key 和 name 的更新
|
||||||
|
if (val) {
|
||||||
|
handleKeyUpdate(props.model.key)
|
||||||
|
handleNameUpdate(props.model.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
// watch(
|
// watch(
|
||||||
// () => ({ ...props }),
|
// () => ({ ...props }),
|
||||||
// (oldVal, newVal) => {
|
// (oldVal, newVal) => {
|
||||||
|
@ -429,7 +429,7 @@ const saveField = () => {
|
|||||||
|
|
||||||
// 移除某个 字段的 配置项
|
// 移除某个 字段的 配置项
|
||||||
const removeFieldOptionItem = (option, index, type) => {
|
const removeFieldOptionItem = (option, index, type) => {
|
||||||
console.log(option, 'option')
|
// console.log(option, 'option')
|
||||||
if (type === 'property') {
|
if (type === 'property') {
|
||||||
fieldPropertiesList.value.splice(index, 1)
|
fieldPropertiesList.value.splice(index, 1)
|
||||||
return
|
return
|
||||||
|
@ -89,11 +89,11 @@ onMounted(async () => {
|
|||||||
}
|
}
|
||||||
// 查询模型
|
// 查询模型
|
||||||
const data = await ModelApi.getModel(modelId)
|
const data = await ModelApi.getModel(modelId)
|
||||||
xmlString.value = data.bpmnXml
|
|
||||||
model.value = {
|
model.value = {
|
||||||
...data,
|
...data,
|
||||||
bpmnXml: undefined // 清空 bpmnXml 属性
|
bpmnXml: undefined // 清空 bpmnXml 属性
|
||||||
}
|
}
|
||||||
|
xmlString.value = data.bpmnXml
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@ -16,12 +16,21 @@
|
|||||||
任务:{{ item.name }}
|
任务:{{ item.name }}
|
||||||
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="item.status" />
|
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="item.status" />
|
||||||
<el-button
|
<el-button
|
||||||
style="margin-left: 5px"
|
class="ml-10px"
|
||||||
v-if="!isEmpty(item.children)"
|
v-if="!isEmpty(item.children)"
|
||||||
@click="openChildrenTask(item)"
|
@click="openChildrenTask(item)"
|
||||||
|
size="small"
|
||||||
>
|
>
|
||||||
<Icon icon="ep:memo" /> 子任务
|
<Icon icon="ep:memo" /> 子任务
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
class="ml-10px"
|
||||||
|
size="small"
|
||||||
|
v-if="item.formId > 0"
|
||||||
|
@click="handleFormDetail(item)"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:document" /> 查看表单
|
||||||
|
</el-button>
|
||||||
</p>
|
</p>
|
||||||
<el-card :body-style="{ padding: '10px' }">
|
<el-card :body-style="{ padding: '10px' }">
|
||||||
<label v-if="item.assigneeUser" style="margin-right: 30px; font-weight: normal">
|
<label v-if="item.assigneeUser" style="margin-right: 30px; font-weight: normal">
|
||||||
@ -50,10 +59,19 @@
|
|||||||
</el-timeline>
|
</el-timeline>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<!-- 弹窗:子任务 -->
|
|
||||||
<TaskSignList ref="taskSignListRef" @success="refresh" />
|
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
|
<!-- 弹窗:子任务 -->
|
||||||
|
<TaskSignList ref="taskSignListRef" @success="refresh" />
|
||||||
|
<!-- 弹窗:表单 -->
|
||||||
|
<Dialog title="表单详情" v-model="taskFormVisible" width="600">
|
||||||
|
<form-create
|
||||||
|
ref="fApi"
|
||||||
|
v-model="taskForm.value"
|
||||||
|
:option="taskForm.option"
|
||||||
|
:rule="taskForm.rule"
|
||||||
|
/>
|
||||||
|
</Dialog>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { formatDate, formatPast2 } from '@/utils/formatTime'
|
import { formatDate, formatPast2 } from '@/utils/formatTime'
|
||||||
@ -61,6 +79,8 @@ import { propTypes } from '@/utils/propTypes'
|
|||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
import { isEmpty } from '@/utils/is'
|
import { isEmpty } from '@/utils/is'
|
||||||
import TaskSignList from './dialog/TaskSignList.vue'
|
import TaskSignList from './dialog/TaskSignList.vue'
|
||||||
|
import type { ApiAttrs } from '@form-create/element-ui/types/config'
|
||||||
|
import { setConfAndFields2 } from '@/utils/formCreate'
|
||||||
|
|
||||||
defineOptions({ name: 'BpmProcessInstanceTaskList' })
|
defineOptions({ name: 'BpmProcessInstanceTaskList' })
|
||||||
|
|
||||||
@ -122,6 +142,26 @@ const openChildrenTask = (item: any) => {
|
|||||||
taskSignListRef.value.open(item)
|
taskSignListRef.value.open(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 查看表单 */
|
||||||
|
const fApi = ref<ApiAttrs>() // form-create 的 API 操作类
|
||||||
|
const taskForm = ref({
|
||||||
|
rule: [],
|
||||||
|
option: {},
|
||||||
|
value: {}
|
||||||
|
}) // 流程任务的表单详情
|
||||||
|
const taskFormVisible = ref(false)
|
||||||
|
const handleFormDetail = async (row) => {
|
||||||
|
// 设置表单
|
||||||
|
setConfAndFields2(taskForm, row.formConf, row.formFields, row.formVariables)
|
||||||
|
// 弹窗打开
|
||||||
|
taskFormVisible.value = true
|
||||||
|
// 隐藏提交、重置按钮,设置禁用只读
|
||||||
|
await nextTick()
|
||||||
|
fApi.value.fapi.btn.show(false)
|
||||||
|
fApi.value?.fapi?.resetBtn.show(false)
|
||||||
|
fApi.value?.fapi?.disabled(true)
|
||||||
|
}
|
||||||
|
|
||||||
/** 刷新数据 */
|
/** 刷新数据 */
|
||||||
const emit = defineEmits(['refresh']) // 定义 success 事件,用于操作成功后的回调
|
const emit = defineEmits(['refresh']) // 定义 success 事件,用于操作成功后的回调
|
||||||
const refresh = () => {
|
const refresh = () => {
|
||||||
|
@ -168,11 +168,10 @@ const approveFormFApis = ref<ApiAttrs[]>([]) // approveForms 的 fAPi
|
|||||||
// ========== 申请信息 ==========
|
// ========== 申请信息 ==========
|
||||||
const fApi = ref<ApiAttrs>() //
|
const fApi = ref<ApiAttrs>() //
|
||||||
const detailForm = ref({
|
const detailForm = ref({
|
||||||
// 流程表单详情
|
|
||||||
rule: [],
|
rule: [],
|
||||||
option: {},
|
option: {},
|
||||||
value: {}
|
value: {}
|
||||||
})
|
}) // 流程实例的表单详情
|
||||||
|
|
||||||
/** 监听 approveFormFApis,实现它对应的 form-create 初始化后,隐藏掉对应的表单提交按钮 */
|
/** 监听 approveFormFApis,实现它对应的 form-create 初始化后,隐藏掉对应的表单提交按钮 */
|
||||||
watch(
|
watch(
|
||||||
|
Loading…
Reference in New Issue
Block a user