修改技术监督bug

This commit is contained in:
GGJ
2024-06-18 09:03:53 +08:00
parent 8233b13927
commit f33aed9b89
18 changed files with 233 additions and 178 deletions

View File

@@ -3,7 +3,7 @@
padding: 0 8px; padding: 0 8px;
border-left: 1px solid #eeeeee; border-left: 1px solid #eeeeee;
box-shadow: 0 0 8px #cccccc; box-shadow: 0 0 8px #cccccc;
max-height: 100%; max-height: calc(100vh - 200px);
overflow-y: scroll; overflow-y: scroll;
} }
.panel-tab__title { .panel-tab__title {

View File

@@ -117,7 +117,8 @@ onMounted(async () => {
<style lang="scss"> <style lang="scss">
.process-panel__container { .process-panel__container {
position: absolute; position: absolute;
top: 90px; top: 62px;
right: 60px; right: 60px;
background-color: #fff;
} }
</style> </style>

View File

@@ -694,7 +694,7 @@ defineExpose({ open })
} }
.conclusion { .conclusion {
display: inline-block; display: inline-block;
padding: 0 5px; padding: 2px 5px;
height: 20px; height: 20px;
border-radius: 4px; border-radius: 4px;
} }

View File

@@ -172,6 +172,6 @@ onMounted(() => {
<style lang="scss" scoped> <style lang="scss" scoped>
.elView { .elView {
cursor: pointer; cursor: pointer;
margin-right: 5px; margin-right: 10px;
} }
</style> </style>

View File

@@ -652,17 +652,17 @@ onMounted(() => {
</script> </script>
<style lang="scss"> <style lang="scss">
::v-deep.el-icon svg { ::v-deep.el-icon svg {
margin: 5px !important; // margin: 5px !important;
position: absolute !important; // position: absolute !important;
top: 20px !important; // top: 20px !important;
}
.details {
width: 100%;
display: flex;
flex-wrap: wrap;
} }
// .details {
// width: 100%;
// display: flex;
// flex-wrap: wrap;
// }
.elView { .elView {
cursor: pointer; cursor: pointer;
margin-right: 5px; margin-right: 10px;
} }
</style> </style>

View File

@@ -47,7 +47,7 @@ import { getUserReportById } from '@/api/supervision-boot/userReport/form'
import BpmUserReportDetail from '../../components/undocumented/detail.vue' import BpmUserReportDetail from '../../components/undocumented/detail.vue'
import { useAdminInfo } from '@/stores/adminInfo' import { useAdminInfo } from '@/stores/adminInfo'
const dictData = useDictData() const dictData = useDictData()
const areaOptionList = dictData.getBasicData('jibei_area') const areaOptionList = dictData.getBasicData('jibei_area').filter(item => !(item.name == '超高压' || item.name == '风光储'))
const statusSelect = dictData.statusSelect() const statusSelect = dictData.statusSelect()
//获取登陆用户姓名和部门 //获取登陆用户姓名和部门
const adminInfo = useAdminInfo() const adminInfo = useAdminInfo()

View File

@@ -630,20 +630,21 @@ onMounted(() => {
</script> </script>
<style lang="scss"> <style lang="scss">
::v-deep.el-icon svg { ::v-deep.el-icon svg {
margin: 5px !important; // margin: 5px !important;
position: absolute !important; // position: absolute !important;
top: 20px !important; // top: 20px !important;
// float: right;
} }
// .el-icon { // .el-icon {
// float: left; // float: left;
// } // }
a { // a {
display: block; // display: block;
width: 200px; // width: 200px;
float: left; // float: right;
} // }
.elView { .elView {
cursor: pointer; cursor: pointer;
margin-right: 5px; margin-right:10px;
} }
</style> </style>

View File

@@ -61,7 +61,7 @@ const dictData = useDictData()
const { push, options, currentRoute } = useRouter() const { push, options, currentRoute } = useRouter()
const TableHeaderRef = ref() const TableHeaderRef = ref()
const tableRef = ref() const tableRef = ref()
const areaOptionList = dictData.getBasicData('jibei_area') const areaOptionList = dictData.getBasicData('jibei_area').filter(item => !(item.name == '超高压' || item.name == '风光储'))
const statusSelect = dictData.statusSelect() const statusSelect = dictData.statusSelect()
const addRef = ref() const addRef = ref()
const AuditRef = ref() const AuditRef = ref()

View File

@@ -104,42 +104,42 @@
{{ detailData.otherRemark }} {{ detailData.otherRemark }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="盖章报告" v-if="detailData.factoryInspectionReport"> <el-descriptions-item label="盖章报告" v-if="detailData.factoryInspectionReport">
<el-icon> <el-icon class="elView" v-if="detailData?.factoryInspectionReport.name">
<Link /> <View @click="openFile(detailData?.factoryInspectionReport.name)" />
</el-icon> </el-icon>
<a :href="detailData?.factoryInspectionReport.url"> <a :href="detailData?.factoryInspectionReport.url">
{{ detailData?.factoryInspectionReport.name }} {{ detailData?.factoryInspectionReport.name }}
</a> </a>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="佐证材料" v-if="detailData?.informationSecurityTestReport"> <el-descriptions-item label="佐证材料" v-if="detailData?.informationSecurityTestReport">
<el-icon> <el-icon class="elView" v-if="detailData?.informationSecurityTestReport.name">
<Link /> <View @click="openFile(detailData?.informationSecurityTestReport.name)" />
</el-icon> </el-icon>
<a :href="detailData?.informationSecurityTestReport.url"> <a :href="detailData?.informationSecurityTestReport.url">
{{ detailData?.informationSecurityTestReport.name }} {{ detailData?.informationSecurityTestReport.name }}
</a> </a>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="计划变更材料" v-if="detailData?.otherAttachments"> <el-descriptions-item label="计划变更材料" v-if="detailData?.otherAttachments">
<el-icon> <el-icon class="elView" v-if="detailData?.otherAttachments.name">
<Link /> <View @click="openFile(detailData?.otherAttachments.name)" />
</el-icon> </el-icon>
<a :href="detailData?.otherAttachments.url">{{ detailData?.otherAttachments.name }}</a> <a :href="detailData?.otherAttachments.url">{{ detailData?.otherAttachments.name }}</a>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="告预警单材料" v-if="detailData?.performanceTestReport"> <el-descriptions-item label="告预警单材料" v-if="detailData?.performanceTestReport">
<el-icon> <el-icon class="elView" v-if="detailData?.performanceTestReport.name">
<Link /> <View @click="openFile(detailData?.performanceTestReport.name)" />
</el-icon> </el-icon>
<a :href="detailData?.performanceTestReport.url">{{ detailData?.performanceTestReport.name }}</a> <a :href="detailData?.performanceTestReport.url">{{ detailData?.performanceTestReport.name }}</a>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="告预警单反馈材料" v-if="detailData?.typeExperimentReport"> <el-descriptions-item label="告预警单反馈材料" v-if="detailData?.typeExperimentReport">
<el-icon> <el-icon class="elView" v-if="detailData?.typeExperimentReport.name">
<Link /> <View @click="openFile(detailData?.typeExperimentReport.name)" />
</el-icon> </el-icon>
<a :href="detailData?.typeExperimentReport.url">{{ detailData?.typeExperimentReport.name }}</a> <a :href="detailData?.typeExperimentReport.url">{{ detailData?.typeExperimentReport.name }}</a>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="评估报告" v-if="detailData?.performanceTestReport"> <el-descriptions-item label="评估报告" v-if="detailData?.performanceTestReport">
<el-icon> <el-icon class="elView" v-if="detailData?.performanceTestReport.name">
<Link /> <View @click="openFile(detailData?.performanceTestReport.name)" />
</el-icon> </el-icon>
<a :href="detailData?.performanceTestReport.url">{{ detailData?.performanceTestReport.name }}</a> <a :href="detailData?.performanceTestReport.url">{{ detailData?.performanceTestReport.name }}</a>
</el-descriptions-item> </el-descriptions-item>
@@ -153,14 +153,14 @@ import { propTypes } from '@/utils/propTypes'
import { useDictData } from '@/stores/dictData' import { useDictData } from '@/stores/dictData'
import { getFileNameAndFilePath } from '@/api/system-boot/file' import { getFileNameAndFilePath } from '@/api/system-boot/file'
import { getUserByDeptId, getPlanDetailsById } from '@/api/supervision-boot/plan/index' import { getUserByDeptId, getPlanDetailsById } from '@/api/supervision-boot/plan/index'
import { Link } from '@element-plus/icons-vue' import { Link, View } from '@element-plus/icons-vue'
import { useAdminInfo } from '@/stores/adminInfo' import { useAdminInfo } from '@/stores/adminInfo'
defineOptions({ name: 'BpmUserReportDetail' }) defineOptions({ name: 'BpmUserReportDetail' })
const { query } = useRoute() // 查询参数 const { query } = useRoute() // 查询参数
const props = defineProps({ const props = defineProps({
id: propTypes.string.def(undefined) id: propTypes.string.def(undefined)
}) })
console.log(propTypes.string.def(undefined),"999999999999传参"); console.log(propTypes.string.def(undefined), '999999999999传参')
const detailLoading = ref(false) // 表单的加载中 const detailLoading = ref(false) // 表单的加载中
const detailData = ref<any>({}) // 详情数据 const detailData = ref<any>({}) // 详情数据
const queryId = query.id as unknown as string // 从 URL 传递过来的 id 编号 const queryId = query.id as unknown as string // 从 URL 传递过来的 id 编号
@@ -199,7 +199,7 @@ getEffectUserList()
/** 获得数据 */ /** 获得数据 */
const getInfo = async () => { const getInfo = async () => {
detailLoading.value = true detailLoading.value = true
console.log(props.id , queryId ,"流程详情内部的id"); console.log(props.id, queryId, '流程详情内部的id')
try { try {
await getPlanDetailsById({ id: props.id || queryId }).then(res => { await getPlanDetailsById({ id: props.id || queryId }).then(res => {
detailData.value = res.data detailData.value = res.data
@@ -287,6 +287,10 @@ const getFileNamePath = async (val: any, pathName: any) => {
} }
}) })
} }
const openFile = (name: any) => {
window.open(window.location.origin + '/#/previewFile?' + name)
}
defineExpose({ open: getInfo }) // 提供 open 方法,用于打开弹窗 defineExpose({ open: getInfo }) // 提供 open 方法,用于打开弹窗
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {
@@ -299,8 +303,12 @@ onMounted(() => {
overflow: auto; overflow: auto;
} }
::v-deep.el-icon svg { ::v-deep.el-icon svg {
margin: 5px !important; // margin: 5px !important;
position: absolute !important; // position: absolute !important;
top: 20px !important; // top: 20px !important;
}
.elView {
cursor: pointer;
margin-right: 10px;
} }
</style> </style>

View File

@@ -106,6 +106,6 @@ onMounted(() => {
<style lang="scss" scoped> <style lang="scss" scoped>
.elView { .elView {
cursor: pointer; cursor: pointer;
margin-right: 5px; margin-right: 10px;
} }
</style> </style>

View File

@@ -230,6 +230,6 @@ const uploadFileName = val => {
} }
.elView { .elView {
cursor: pointer; cursor: pointer;
margin-right: 5px; margin-right: 10px;
} }
</style> </style>

View File

@@ -118,6 +118,6 @@ onMounted(() => {
<style lang="scss" scoped> <style lang="scss" scoped>
.elView { .elView {
cursor: pointer; cursor: pointer;
margin-right: 5px; margin-right: 10px;
} }
</style> </style>

View File

@@ -59,8 +59,12 @@ onMounted(() => {
} }
::v-deep.el-icon svg { ::v-deep.el-icon svg {
margin: 5px !important; // margin: 5px !important;
position: absolute !important; // position: absolute !important;
top: 20px !important; // top: 20px !important;
}
.elView {
cursor: pointer;
margin-right: 10px;
} }
</style> </style>

View File

@@ -246,7 +246,6 @@
<el-form-item for="-" label="干扰源类型:" prop="loadType"> <el-form-item for="-" label="干扰源类型:" prop="loadType">
<el-select <el-select
v-model="form.loadType" v-model="form.loadType"
clearable
style="width: 100%" style="width: 100%"
placeholder="请选择干扰源类型" placeholder="请选择干扰源类型"
@change="changeLoadType" @change="changeLoadType"
@@ -260,7 +259,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item for="-" label="干扰源类别:" prop="businessType"> <el-form-item for="-" label="干扰源类别:" prop="businessType">
<el-select v-model="form.businessType" clearable style="width: 100%" placeholder="请选择干扰源类别"> <el-select v-model="form.businessType" style="width: 100%" placeholder="请选择干扰源类别">
<el-option <el-option
v-for="item in businessTypeList" v-for="item in businessTypeList"
:key="item.id" :key="item.id"
@@ -370,7 +369,7 @@ import { getDeviceList } from '@/api/supervision-boot/terminal/index'
import { addMointorPointFormData, getList, updateMointorPointFormData } from '@/api/supervision-boot/monitorpoint/index' import { addMointorPointFormData, getList, updateMointorPointFormData } from '@/api/supervision-boot/monitorpoint/index'
import { queryByAllCode } from '@/api/system-boot/dictTree' import { queryByAllCode } from '@/api/system-boot/dictTree'
import { getUserReportById } from '@/api/supervision-boot/userReport/form' import { getUserReportById } from '@/api/supervision-boot/userReport/form'
import { object } from 'vue-types' import { getDictTreeById } from '@/api/system-boot/dictTree'
const emits = defineEmits(['onSubmit']) const emits = defineEmits(['onSubmit'])
const dictData = useDictData() const dictData = useDictData()
const dialogFormVisible = ref(false) const dialogFormVisible = ref(false)
@@ -583,8 +582,7 @@ const resetForm = () => {
ptType: ptTypeList[0].id, //接线方式 ptType: ptTypeList[0].id, //接线方式
num: numList[0].id //线路号 num: numList[0].id //线路号
} }
let obj = {} getList({}).then(res => {
getList(obj).then(res => {
projectList.value = res.data projectList.value = res.data
userNameList.value = res.data userNameList.value = res.data
//初始化 //初始化
@@ -599,10 +597,11 @@ const resetForm = () => {
orgId: obj?.orgId, orgId: obj?.orgId,
orgName: obj?.orgName, orgName: obj?.orgName,
expectedProductionDate: obj?.expectedProductionDate, expectedProductionDate: obj?.expectedProductionDate,
userName: userNameList.value[0]?.projectName, userName: userNameList.value[0]?.id,
userId: userNameList.value[0]?.id, userId: userNameList.value[0]?.id,
objName: userNameList.value[0]?.projectName objName: userNameList.value[0]?.projectName
} }
changeUserName()
} }
}) })
changevoltageDeviationLimit() changevoltageDeviationLimit()
@@ -662,15 +661,16 @@ getTreeList()
const changeLoadType = async () => { const changeLoadType = async () => {
businessTypeList.value = loadTypeList.value.find(item => { businessTypeList.value = loadTypeList.value.find(item => {
return item.id == form.value.loadType return item.id == form.value.loadType
}).children })?.children
form.value.businessType = businessTypeList.value[0]?.id // form.value.businessType = businessTypeList.value[0]?.id
} }
//选择关联干扰源回显数据 //选择关联干扰源回显数据
const changeUserName = () => { const changeUserName = () => {
let obj: any = projectList.value.find((item: any) => { let obj: any = projectList.value.find((item: any) => {
return form.value.userName == item.id return form.value.userName == item.id
}) })
console.log(obj, '88888888') // console.log('🚀 ~ letobj:any=projectList.value.find ~ projectList.value.find:', projectList.value)
// console.log(obj, '88888888')
form.value = { form.value = {
...form.value, ...form.value,
city: obj?.city, city: obj?.city,
@@ -689,7 +689,7 @@ const changeUserName = () => {
//回显数据 //回显数据
if (obj.userType == '2' || obj.userType == '3' || obj.userType == '4' || obj.userType == '5') { if (obj.userType == '2' || obj.userType == '3' || obj.userType == '4' || obj.userType == '5') {
getUserReportById(obj.id).then(res => { getUserReportById(obj.id).then(res => {
console.log(res.data, '继续查询数据') // console.log(res.data, '继续查询数据')
const obj = res.data const obj = res.data
form.value = { form.value = {
...form.value, ...form.value,
@@ -698,7 +698,47 @@ const changeUserName = () => {
devCapacity: obj.userReportSubstationPO?.pccEquipmentCapacity, //终端容量 devCapacity: obj.userReportSubstationPO?.pccEquipmentCapacity, //终端容量
standardCapacity: obj.userReportSubstationPO?.baseShortCircuitCapacity //基准容量 standardCapacity: obj.userReportSubstationPO?.baseShortCircuitCapacity //基准容量
} }
getDictTree(obj.userReportSubstationPO?.nonlinearLoadType)
}) })
} else if (obj.userType == '0' || obj.userType == '1') {
getUserReportById(obj.id).then(res => {
// console.log(res.data, '继续查询数据')
const obj = res.data
form.value = {
...form.value,
shortCapacity: 0, // 短路容量
dealCapacity: obj.userReportProjectPO?.agreementCapacity, //协议容量
devCapacity: 0, //终端容量
standardCapacity: 0 //基准容量
}
getDictTree(obj.userReportProjectPO?.nonlinearDeviceType)
})
} else if (obj.userType == '6') {
getUserReportById(obj.id).then(res => {
// console.log(res.data, '继续查询数据')
const obj = res.data
form.value = {
...form.value,
shortCapacity: 0, // 短路容量
dealCapacity: 0, //协议容量
devCapacity: 0, //终端容量
standardCapacity: 0 //基准容量
}
getDictTree()
})
}
}
const getDictTree = (e?: string) => {
if (e) {
getDictTreeById(e).then(res => {
form.value.loadType = res.data.pids.split(',')[1] || ''
form.value.businessType = res.data.pids.split(',')[2] || ''
changeLoadType()
})
} else {
form.value.businessType = ''
form.value.loadType = ''
businessTypeList.value = []
} }
} }
//定义校验规则 //定义校验规则
@@ -918,16 +958,17 @@ const rules = ref({
}) })
const resendId = ref('') const resendId = ref('')
const rowValue: any = ref({}) const rowValue: any = ref({})
const open = (row: any) => { const open = async (row: any) => {
resetForm()
dialogFormVisible.value = true dialogFormVisible.value = true
title.value = row.title title.value = row.title
//初始化数据 //初始化数据
resetForm()
nextTick(() => { nextTick(async () => {
if (row.row) { if (row.row) {
resendId.value = row.row.id resendId.value = row.row.id
rowValue.value = row.row rowValue.value = row.row
getTempLineDetailsById({ id: row.row.id }).then(res => { await getTempLineDetailsById({ id: row.row.id }).then(res => {
form.value = res.data form.value = res.data
form.value.loadType = loadTypeList.value.filter((item: any) => item.name == res.data.loadType)[0]?.id form.value.loadType = loadTypeList.value.filter((item: any) => item.name == res.data.loadType)[0]?.id
form.value.businessType = businessTypeList.value.filter( form.value.businessType = businessTypeList.value.filter(
@@ -955,9 +996,7 @@ const close = () => {
emits('onSubmit') emits('onSubmit')
resetForm() resetForm()
} }
onMounted(() => { onMounted(() => {})
console.log()
})
watch( watch(
() => projectList.value, () => projectList.value,
@@ -966,7 +1005,7 @@ watch(
let obj: any = projectList.value.find((item: any) => { let obj: any = projectList.value.find((item: any) => {
return rowValue.value.createBy == item.createBy return rowValue.value.createBy == item.createBy
}) })
console.log(projectList.value, '000000', obj, rowValue.value.createBy) // console.log(projectList.value, '000000', obj, rowValue.value.createBy)
form.value = { form.value = {
...form.value, ...form.value,
reporter: obj?.reporter, reporter: obj?.reporter,
@@ -994,7 +1033,7 @@ const uploadFileName = val => {
} }
//移除文件上传 //移除文件上传
const removeFile = (file: any, uploadFiles: any) => { const removeFile = (file: any, uploadFiles: any) => {
console.log(file, uploadFiles) // console.log(file, uploadFiles)
} }
//监测点台账信息 //监测点台账信息
const lineFilePath = ref('') const lineFilePath = ref('')
@@ -1059,7 +1098,7 @@ const confirmForm = () => {
}) })
} else { } else {
confirmFormData.id = resendId.value confirmFormData.id = resendId.value
console.log(confirmFormData, '99999999999') // console.log(confirmFormData, '99999999999')
updateMointorPointFormData(confirmFormData).then(res => { updateMointorPointFormData(confirmFormData).then(res => {
if (res.code == 'A0000') { if (res.code == 'A0000') {
ElMessage({ ElMessage({
@@ -1073,7 +1112,7 @@ const confirmForm = () => {
}) })
} }
} else { } else {
console.log('表单验证失败') // // console.log('表单验证失败')
return false return false
} }
}) })

View File

@@ -265,12 +265,12 @@ onMounted(() => {
} }
::v-deep.el-icon svg { ::v-deep.el-icon svg {
margin: 5px !important; // margin: 5px !important;
position: absolute !important; // position: absolute !important;
top: 20px !important; // top: 20px !important;
} }
.elView { .elView {
cursor: pointer; cursor: pointer;
margin-right: 5px; margin-right: 10px;
} }
</style> </style>

View File

@@ -487,12 +487,12 @@ onMounted(() => {
} }
::v-deep.el-icon svg { ::v-deep.el-icon svg {
margin: 5px !important; // margin: 5px !important;
position: absolute !important; // position: absolute !important;
top: 20px !important; // top: 20px !important;
} }
.elView { .elView {
cursor: pointer; cursor: pointer;
margin-right: 5px; margin-right: 10px;
} }
</style> </style>

View File

@@ -68,8 +68,12 @@ onMounted(() => {
} }
::v-deep.el-icon svg { ::v-deep.el-icon svg {
margin: 5px !important; // margin: 5px !important;
position: absolute !important; // position: absolute !important;
top: 20px !important; // top: 20px !important;
}
.elView {
cursor: pointer;
margin-right: 10px;
} }
</style> </style>

View File

@@ -1,32 +1,32 @@
<template> <template>
<div class='default-main'> <div class="default-main" >
<ContentWrap> <ContentWrap style="height: calc(100vh - 135px)">
<!-- 流程设计器负责绘制流程等 --> <!-- 流程设计器负责绘制流程等 -->
<MyProcessDesigner <MyProcessDesigner
key='designer' key="designer"
v-if='xmlString !== undefined' v-if="xmlString !== undefined"
v-model='xmlString' v-model="xmlString"
:value='xmlString' :value="xmlString"
v-bind='controlForm' v-bind="controlForm"
keyboard keyboard
ref='processDesigner' ref="processDesigner"
@init-finished='initModeler' @init-finished="initModeler"
:additionalModel='controlForm.additionalModel' :additionalModel="controlForm.additionalModel"
@save='save' @save="save"
/> />
<!-- 流程属性器负责编辑每个流程节点的属性 --> <!-- 流程属性器负责编辑每个流程节点的属性 -->
<MyProcessPenal <MyProcessPenal
key='penal' key="penal"
:bpmnModeler='modeler as any' :bpmnModeler="modeler as any"
:prefix='controlForm.prefix' :prefix="controlForm.prefix"
class='process-panel' class="process-panel"
:model='model' :model="model"
/> />
</ContentWrap> </ContentWrap>
</div> </div>
</template> </template>
<script lang='ts' setup> <script lang="ts" setup>
import ContentWrap from '@/components/ContentWrap/src/ContentWrap.vue' import ContentWrap from '@/components/ContentWrap/src/ContentWrap.vue'
import { onMounted, provide, ref } from 'vue' import { onMounted, provide, ref } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
@@ -43,109 +43,107 @@ defineOptions({ name: 'BpmModelEditor' })
const { push, currentRoute, go } = useRouter() // 路由 const { push, currentRoute, go } = useRouter() // 路由
const { query } = useRoute() // 路由信息 const { query } = useRoute() // 路由信息
const xmlString = ref(undefined) // BPMN XML const xmlString = ref(undefined) // BPMN XML
const modeler = ref(null) // BPMN Modeler const modeler = ref(null) // BPMN Modeler
const controlForm = ref({ const controlForm = ref({
simulation: true, simulation: true,
labelEditing: false, labelEditing: false,
labelVisible: false, labelVisible: false,
prefix: 'flowable', prefix: 'flowable',
headerButtonSize: 'mini', headerButtonSize: 'mini',
additionalModel: [CustomContentPadProvider, CustomPaletteProvider] additionalModel: [CustomContentPadProvider, CustomPaletteProvider]
}) })
type ProcessDefinitionVO = { type ProcessDefinitionVO = {
id: string id: string
version: number version: number
deploymentTIme: string deploymentTIme: string
suspensionState: number suspensionState: number
} }
type ModelVO = { type ModelVO = {
id: number id: number
formName: string formName: string
key: string key: string
name: string name: string
description: string description: string
category: string category: string
formType: number formType: number
formId: number formId: number
formCustomCreatePath: string formCustomCreatePath: string
formCustomViewPath: string formCustomViewPath: string
processDefinition: ProcessDefinitionVO processDefinition: ProcessDefinitionVO
status: number status: number
remark: string remark: string
createTime: string createTime: string
bpmnXml: string bpmnXml: string
} }
const model = ref<ModelVO>() // 流程模型的信息 const model = ref<ModelVO>() // 流程模型的信息
/** 初始化 modeler */ /** 初始化 modeler */
const initModeler = (item: any) => { const initModeler = (item: any) => {
setTimeout(() => { setTimeout(() => {
modeler.value = item modeler.value = item
}, 10) }, 10)
} }
/** 添加/修改模型 */ /** 添加/修改模型 */
const save = async (bpmnXml: any) => { const save = async (bpmnXml: any) => {
const data = { const data = {
...model.value, ...model.value,
bpmnXml: bpmnXml // bpmnXml 只是初始化流程图,后续修改无法通过它获得 bpmnXml: bpmnXml // bpmnXml 只是初始化流程图,后续修改无法通过它获得
} as unknown as ModelVO } as unknown as ModelVO
// 提交 // 提交
if (data.id) { if (data.id) {
await updateModel(data) await updateModel(data)
ElMessage.success('修改成功') ElMessage.success('修改成功')
} else { } else {
await addModel(data) await addModel(data)
ElMessage.success('新增成功') ElMessage.success('新增成功')
} }
// 跳转回去 // 跳转回去
go(-1) go(-1)
} }
/** 初始化 */ /** 初始化 */
onMounted(async () => { onMounted(async () => {
const modelId = query.modelId as unknown as string const modelId = query.modelId as unknown as string
if (!modelId) { if (!modelId) {
ElMessage.error('缺少模型 modelId 编号') ElMessage.error('缺少模型 modelId 编号')
return return
} }
// 查询模型 // 查询模型
let data = { let data = {
bpmnXml: '', bpmnXml: '',
key: '', key: '',
name: '' name: ''
} }
await getById(modelId).then(res => { await getById(modelId).then(res => {
data = res.data data = res.data
}) })
if (!data.bpmnXml) { if (!data.bpmnXml) {
// 首次创建的 Model 模型,它是没有 bpmnXml此时需要给它一个默认的 // 首次创建的 Model 模型,它是没有 bpmnXml此时需要给它一个默认的
data.bpmnXml = ` <?xml version="1.0" encoding="UTF-8"?> data.bpmnXml = ` <?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.activiti.org/processdef"> <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.activiti.org/processdef">
<process id="${data.key}" name="${data.name}" isExecutable="true" /> <process id="${data.key}" name="${data.name}" isExecutable="true" />
<bpmndi:BPMNDiagram id="BPMNDiagram"> <bpmndi:BPMNDiagram id="BPMNDiagram">
<bpmndi:BPMNPlane id="${data.key}_di" bpmnElement="${data.key}" /> <bpmndi:BPMNPlane id="${data.key}_di" bpmnElement="${data.key}" />
</bpmndi:BPMNDiagram> </bpmndi:BPMNDiagram>
</definitions>` </definitions>`
} }
model.value = { model.value = {
...data, ...data,
bpmnXml: undefined // 清空 bpmnXml 属性 bpmnXml: undefined // 清空 bpmnXml 属性
} }
xmlString.value = data.bpmnXml xmlString.value = data.bpmnXml
}) })
</script> </script>
<style lang='scss'> <style lang="scss">
.process-panel__container { .process-panel__container {
position: absolute; position: absolute;
top: 190px; top: 62px;
right: 20px; right: 20px;
background-color: #fff;
} }
</style> </style>