2024-03-20 22:25:24 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<section class="dingflow-design">
|
2024-04-18 15:56:49 +08:00
|
|
|
|
<div class="sticky right-0 top-0 z-10 w-full flex justify-end bg-white p-2 pr-4">
|
|
|
|
|
<el-button type="primary" size="small" @click="test">保存(测试中,待完善)</el-button>
|
|
|
|
|
</div>
|
2024-03-20 22:25:24 +08:00
|
|
|
|
<div class="box-scale">
|
2024-04-02 20:56:51 +08:00
|
|
|
|
<div class="start-event-node">
|
|
|
|
|
<div class="start-event-node-circle">开始</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="start-event-node-line"></div>
|
2024-04-18 15:56:49 +08:00
|
|
|
|
<nodeWrap v-model:nodeConfig="nodeConfig"/>
|
|
|
|
|
|
2024-04-02 20:56:51 +08:00
|
|
|
|
<div class="end-event">
|
|
|
|
|
<div class="end-event-circle">结束</div>
|
2024-03-20 22:25:24 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
</div>
|
2024-04-14 10:26:42 +08:00
|
|
|
|
<approverDrawer/>
|
2024-04-05 13:04:12 +08:00
|
|
|
|
<copyerDrawer />
|
2024-03-20 22:25:24 +08:00
|
|
|
|
</template>
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import nodeWrap from '@/components/SimpleProcessDesigner/src/nodeWrap.vue'
|
2024-03-24 20:35:53 +08:00
|
|
|
|
import approverDrawer from '@/components/SimpleProcessDesigner/src/drawer/approverDrawer.vue'
|
2024-04-05 13:04:12 +08:00
|
|
|
|
import copyerDrawer from '@/components/SimpleProcessDesigner/src/drawer/copyerDrawer.vue'
|
2024-04-02 20:56:51 +08:00
|
|
|
|
import { WorkFlowNode } from '@/components/SimpleProcessDesigner/src/consts'
|
2024-03-24 20:35:53 +08:00
|
|
|
|
import { ref } from 'vue'
|
2024-03-29 19:56:45 +08:00
|
|
|
|
import { saveBpmSimpleModel, getBpmSimpleModel } from '@/api/bpm/simple'
|
2024-04-14 10:26:42 +08:00
|
|
|
|
import { getModel } from '@/api/bpm/model'
|
|
|
|
|
import { getForm, FormVO } from '@/api/bpm/form'
|
2024-03-20 22:25:24 +08:00
|
|
|
|
defineOptions({ name: 'SimpleWorkflowDesignEditor' })
|
2024-03-29 19:56:45 +08:00
|
|
|
|
const uid = getCurrentInstance().uid
|
2024-03-27 09:27:14 +08:00
|
|
|
|
const router = useRouter() // 路由
|
|
|
|
|
const { query } = useRoute() // 路由的查询
|
2024-03-29 19:56:45 +08:00
|
|
|
|
const modelId = query.modelId
|
2024-03-27 09:27:14 +08:00
|
|
|
|
const message = useMessage() // 国际化
|
2024-04-02 20:56:51 +08:00
|
|
|
|
const nodeConfig = ref<WorkFlowNode>({
|
2024-04-14 10:26:42 +08:00
|
|
|
|
name: '发起人',
|
|
|
|
|
type: 0,
|
|
|
|
|
id: 'StartEvent_' + uid,
|
|
|
|
|
childNode: undefined,
|
|
|
|
|
attributes: undefined,
|
|
|
|
|
conditionNodes: []
|
|
|
|
|
})
|
|
|
|
|
// 默认的表单字段权限
|
|
|
|
|
const defaultFieldsPermission: any[] = []
|
2024-04-18 15:56:49 +08:00
|
|
|
|
const formType = ref(20);
|
|
|
|
|
provide('defaultFieldsPermission', defaultFieldsPermission)
|
|
|
|
|
provide('formType', formType)
|
2024-03-29 19:56:45 +08:00
|
|
|
|
const test = async () => {
|
2024-03-27 09:27:14 +08:00
|
|
|
|
if (!modelId) {
|
|
|
|
|
message.error('缺少模型 modelId 编号')
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-04-14 10:26:42 +08:00
|
|
|
|
const test = nodeConfig.value
|
2024-04-02 20:56:51 +08:00
|
|
|
|
console.log('test is ', test)
|
|
|
|
|
console.log('nodeConfig.value ', nodeConfig.value)
|
2024-04-14 10:26:42 +08:00
|
|
|
|
const data1 = {
|
2024-03-27 09:27:14 +08:00
|
|
|
|
modelId: modelId,
|
|
|
|
|
simpleModelBody: toRaw(nodeConfig.value)
|
|
|
|
|
}
|
2024-04-14 10:26:42 +08:00
|
|
|
|
const data = {
|
2024-04-02 20:56:51 +08:00
|
|
|
|
modelId: modelId,
|
|
|
|
|
simpleModelBody: nodeConfig.value
|
|
|
|
|
}
|
|
|
|
|
console.log('request json data1 is ', data1)
|
2024-04-14 10:26:42 +08:00
|
|
|
|
const result = await saveBpmSimpleModel(data)
|
2024-03-29 19:56:45 +08:00
|
|
|
|
console.log('save the result is ', result)
|
|
|
|
|
if (result) {
|
2024-03-27 09:27:14 +08:00
|
|
|
|
message.success('修改成功')
|
2024-03-29 19:56:45 +08:00
|
|
|
|
close()
|
2024-03-27 09:27:14 +08:00
|
|
|
|
} else {
|
2024-03-29 19:56:45 +08:00
|
|
|
|
message.alert('修改失败')
|
2024-03-27 09:27:14 +08:00
|
|
|
|
}
|
2024-03-24 20:35:53 +08:00
|
|
|
|
}
|
2024-03-27 09:27:14 +08:00
|
|
|
|
const close = () => {
|
|
|
|
|
router.push({ path: '/bpm/manager/model' })
|
|
|
|
|
}
|
2024-03-29 19:56:45 +08:00
|
|
|
|
onMounted(async () => {
|
2024-04-14 10:26:42 +08:00
|
|
|
|
const bpmnModel = await getModel(modelId)
|
|
|
|
|
if (bpmnModel) {
|
2024-04-18 15:56:49 +08:00
|
|
|
|
formType.value = bpmnModel.formType
|
|
|
|
|
if (formType.value === 10) {
|
2024-04-14 10:26:42 +08:00
|
|
|
|
const bpmnForm = await getForm(bpmnModel.formId) as unknown as FormVO
|
|
|
|
|
const formFields = bpmnForm?.fields
|
|
|
|
|
if (formFields) {
|
|
|
|
|
formFields.forEach((fieldStr: string) => {
|
|
|
|
|
const { field, title } = JSON.parse(fieldStr)
|
|
|
|
|
defaultFieldsPermission.push({
|
|
|
|
|
field,
|
|
|
|
|
title,
|
|
|
|
|
permission: '2'
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
console.log('defaultFieldsPermissions', defaultFieldsPermission);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-29 19:56:45 +08:00
|
|
|
|
console.log('the modelId is ', modelId)
|
|
|
|
|
const result = await getBpmSimpleModel(modelId)
|
2024-04-14 10:26:42 +08:00
|
|
|
|
if (result) {
|
2024-03-29 19:56:45 +08:00
|
|
|
|
console.log('get the result is ', result)
|
2024-04-14 10:26:42 +08:00
|
|
|
|
nodeConfig.value = result
|
2024-03-29 19:56:45 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
2024-03-20 22:25:24 +08:00
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
@import url('@/components/SimpleProcessDesigner/theme/workflow.css');
|
2024-04-02 20:56:51 +08:00
|
|
|
|
|
|
|
|
|
.end-event {
|
|
|
|
|
display: flex;
|
|
|
|
|
direction: columns;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.end-event-circle {
|
|
|
|
|
display: flex;
|
|
|
|
|
width: 40px;
|
|
|
|
|
height: 40px;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #f8f8fa;
|
2024-04-14 10:26:42 +08:00
|
|
|
|
background-image: linear-gradient(-30deg, #bbbbc4, #d5d5de), linear-gradient(#bcbcc5, #bcbcc5);
|
2024-04-02 20:56:51 +08:00
|
|
|
|
border-radius: 50%;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* .start-event-node {
|
|
|
|
|
color: #191f2566;
|
|
|
|
|
text-align: left;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
} */
|
|
|
|
|
.start-event-node {
|
|
|
|
|
display: flex;
|
|
|
|
|
direction: columns;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.start-event-node-circle {
|
|
|
|
|
display: flex;
|
|
|
|
|
width: 40px;
|
|
|
|
|
height: 40px;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #f8f8fa;
|
2024-04-14 10:26:42 +08:00
|
|
|
|
background-image: linear-gradient(90deg, #ff6a00, #f78b3e), linear-gradient(#ff6a00, #ff6a00);
|
2024-04-02 20:56:51 +08:00
|
|
|
|
border-radius: 50%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.start-event-node-line::before {
|
2024-04-14 10:26:42 +08:00
|
|
|
|
position: absolute;
|
|
|
|
|
inset: 0;
|
|
|
|
|
z-index: -1;
|
|
|
|
|
width: 2px;
|
|
|
|
|
height: 100%;
|
|
|
|
|
margin: auto;
|
|
|
|
|
background-color: #cacaca;
|
|
|
|
|
content: '';
|
2024-04-02 20:56:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.start-event-node-line {
|
|
|
|
|
position: relative;
|
|
|
|
|
padding: 20px 0 32px;
|
|
|
|
|
}
|
2024-03-29 19:56:45 +08:00
|
|
|
|
</style>
|