| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <template>
- <div>
- <section class="dingflow-design">
- <el-row>
- <el-col :span="20" />
- <el-col :span="4">
- <el-button type="primary" size="small" @click="test">保存(用于测试,还未完成)</el-button>
- </el-col>
- </el-row>
- <div class="box-scale">
- <div class="start-event-node">
- <div class="start-event-node-circle">开始</div>
- </div>
- <div class="start-event-node-line"></div>
- <nodeWrap v-model:nodeConfig="nodeConfig" :defaultFieldsPermission="defaultFieldsPermission" />
- <!-- <div class="end-node">
- <div class="end-node-circle"></div>
- <div class="end-node-text">流程结束</div>
- </div> -->
- <div class="end-event">
- <div class="end-event-circle">结束</div>
- </div>
- </div>
- </section>
- </div>
- <approverDrawer/>
- <copyerDrawer />
- </template>
- <script lang="ts" setup>
- import nodeWrap from '@/components/SimpleProcessDesigner/src/nodeWrap.vue'
- import approverDrawer from '@/components/SimpleProcessDesigner/src/drawer/approverDrawer.vue'
- import copyerDrawer from '@/components/SimpleProcessDesigner/src/drawer/copyerDrawer.vue'
- import { WorkFlowNode } from '@/components/SimpleProcessDesigner/src/consts'
- import { ref } from 'vue'
- import { saveBpmSimpleModel, getBpmSimpleModel } from '@/api/bpm/simple'
- import { getModel } from '@/api/bpm/model'
- import { getForm, FormVO } from '@/api/bpm/form'
- defineOptions({ name: 'SimpleWorkflowDesignEditor' })
- const uid = getCurrentInstance().uid
- const router = useRouter() // 路由
- const { query } = useRoute() // 路由的查询
- const modelId = query.modelId
- const message = useMessage() // 国际化
- const nodeConfig = ref<WorkFlowNode>({
- name: '发起人',
- type: 0,
- id: 'StartEvent_' + uid,
- childNode: undefined,
- attributes: undefined,
- conditionNodes: []
- })
- // 默认的表单字段权限
- const defaultFieldsPermission: any[] = []
- const test = async () => {
- if (!modelId) {
- message.error('缺少模型 modelId 编号')
- return
- }
- const test = nodeConfig.value
- console.log('test is ', test)
- console.log('nodeConfig.value ', nodeConfig.value)
- const data1 = {
- modelId: modelId,
- simpleModelBody: toRaw(nodeConfig.value)
- }
- const data = {
- modelId: modelId,
- simpleModelBody: nodeConfig.value
- }
- console.log('request json data1 is ', data1)
- const result = await saveBpmSimpleModel(data)
- console.log('save the result is ', result)
- if (result) {
- message.success('修改成功')
- close()
- } else {
- message.alert('修改失败')
- }
- }
- const close = () => {
- router.push({ path: '/bpm/manager/model' })
- }
- onMounted(async () => {
- const bpmnModel = await getModel(modelId)
- if (bpmnModel) {
- const formType = bpmnModel.formType
- if (formType === 10) {
- 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);
- }
- }
- console.log('the modelId is ', modelId)
- const result = await getBpmSimpleModel(modelId)
- if (result) {
- console.log('get the result is ', result)
- nodeConfig.value = result
- }
- })
- </script>
- <style>
- @import url('@/components/SimpleProcessDesigner/theme/workflow.css');
- .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;
- background-image: linear-gradient(-30deg, #bbbbc4, #d5d5de), linear-gradient(#bcbcc5, #bcbcc5);
- 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;
- background-image: linear-gradient(90deg, #ff6a00, #f78b3e), linear-gradient(#ff6a00, #ff6a00);
- border-radius: 50%;
- }
- .start-event-node-line::before {
- position: absolute;
- inset: 0;
- z-index: -1;
- width: 2px;
- height: 100%;
- margin: auto;
- background-color: #cacaca;
- content: '';
- }
- .start-event-node-line {
- position: relative;
- padding: 20px 0 32px;
- }
- </style>
|