This commit is contained in:
2024-05-20 18:48:15 +08:00
parent 15bdac1c99
commit 2bd07d1e78

View File

@@ -1,31 +1,31 @@
<!--流程模型管理界面--> <!--流程模型管理界面-->
<template> <template>
<div class='default-main'> <div class='default-main'>
<TableHeader> <TableHeader>
<template v-slot:select> <template v-slot:select>
<!-- <el-form-item label='用户'>--> <!-- <el-form-item label='用户'>-->
<!-- <el-select v-model='tableStore.table.params.userId' filterable clearable>--> <!-- <el-select v-model='tableStore.table.params.userId' filterable clearable>-->
<!-- <el-option--> <!-- <el-option-->
<!-- v-for='item in userListData'--> <!-- v-for='item in userListData'-->
<!-- :key='item.id'--> <!-- :key='item.id'-->
<!-- :label='item.userName'--> <!-- :label='item.userName'-->
<!-- :value='item.id'--> <!-- :value='item.id'-->
<!-- />--> <!-- />-->
<!-- </el-select>--> <!-- </el-select>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
</template> </template>
<template v-slot:operation> <template v-slot:operation>
<el-button type='primary' @click='add' class='ml10' :icon='Plus'>新增模型</el-button> <el-button type='primary' @click='add' class='ml10' :icon='Plus'>新增模型</el-button>
</template> </template>
</TableHeader> </TableHeader>
<!--表格--> <!--表格-->
<Table ref='tableRef' isGroup></Table> <Table ref='tableRef' isGroup></Table>
<model-popup ref='modelPopup' /> <model-popup ref='modelPopup' />
<!-- 弹窗表单详情 --> <!-- 弹窗表单详情 -->
<el-dialog title='表单详情' v-model='formDetailVisible' width='800'> <el-dialog title='表单详情' v-model='formDetailVisible' width='800'>
<form-create :rule='formDetailPreview.rule' :option='formDetailPreview.option' /> <form-create :rule='formDetailPreview.rule' :option='formDetailPreview.option' />
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script setup lang='ts'> <script setup lang='ts'>
@@ -43,156 +43,157 @@ import { setConfAndFields2 } from '@/utils/formCreate'
import { getSignSimpleList } from '@/api/bpm-boot/sign' import { getSignSimpleList } from '@/api/bpm-boot/sign'
defineOptions({ defineOptions({
name: 'governSchemeHistory' name: 'governSchemeHistory'
}) })
const { push } = useRouter() const { push } = useRouter()
const modelPopup = ref() const modelPopup = ref()
const tableStore = new TableStore({ const tableStore = new TableStore({
url: '/bpm-boot/bpm/model/list', url: '/bpm-boot/bpm/model/list',
method: 'POST', method: 'POST',
column: [ column: [
{ title: '序号', type: 'seq', width: 80 }, { title: '序号', type: 'seq', width: 80 },
{ title: '模型标识', field: 'key', width: 160 }, { title: '模型标识', field: 'key', width: 160 },
{ title: '模型名称', field: 'name', width: 160 }, { title: '模型名称', field: 'name', width: 160 },
{ title: '流程分类', field: 'categoryName', width: 150 }, { title: '流程分类', field: 'categoryName', width: 150 },
{
title: '表单信息', field: 'formName', width: 170,
formatter: (obj: any) => {
const formType = obj.row.formType
if (formType == 20) {
return getFormNameByViewPath(obj.row.formCustomViewPath)
} else {
return obj.row.formName
}
}
},
{
title: '创建时间',
field: 'createTime',
width: 150
},
{
title: '最新部署的流程定义',
children: [
{ {
title: '模型版本', title: '表单信息', field: 'formName', width: 170,
width: '150', formatter: (obj: any) => {
field: 'processDefinition.version', const formType = obj.row.formType
type: 'html', if (formType == 20) {
formatter: (obj: any) => { return getFormNameByViewPath(obj.row.formCustomViewPath)
if (obj.row.processDefinition) { } else {
const val = obj.row.processDefinition.version return obj.row.formName
return `<a href='javascript:void(0);' style='color: #409EFF;text-decoration: none'>v${val}</a>` }
} else {
return '未部署'
} }
}
}, },
{ {
title: '激活状态', title: '创建时间',
width: '150', field: 'createTime',
field: 'processDefinition.suspensionState', width: 150
// render: 'switch',
// activeValue: '1',
// inactiveValue: '0',
// onChangeField: (row: any, value) => {
// console.log(row, 444123, value)
// value == 0 ? (value = 1) : (value = 0)
// }
render: 'tag',
custom: {
2: 'danger',
1: 'success'
},
replaceValue: {
2: '关闭',
1: '开启'
}
},
{ title: '部署时间', width: '150', field: 'processDefinition.deploymentTime' }
]
},
{
title: '操作',
align: 'center',
minWidth: '200',
render: 'buttons',
fixed: 'right',
buttons: [
{
name: 'productSetting',
title: '设计流程',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
handleDesign(row.id)
}
}, },
{ {
name: 'productSetting', title: '最新部署的流程定义',
title: '部署流程', children: [
type: 'primary', {
icon: 'el-icon-EditPen', title: '模型版本',
render: 'basicButton', width: '150',
click: row => { field: 'processDefinition.version',
handleDeployConfirm(row.id) type: 'html',
} formatter: (obj: any) => {
if (obj.row.processDefinition) {
const val = obj.row.processDefinition.version
return `<a href='javascript:void(0);' style='color: #409EFF;text-decoration: none'>v${val}</a>`
} else {
return '未部署'
}
}
},
{
title: '激活状态',
width: '150',
field: 'processDefinition.suspensionState',
// render: 'switch',
// activeValue: '1',
// inactiveValue: '0',
// onChangeField: (row: any, value) => {
// console.log(row, 444123, value)
// value == 0 ? (value = 1) : (value = 0)
// }
render: 'tag',
custom: {
2: 'danger',
1: 'success'
},
replaceValue: {
2: '关闭',
1: '开启'
}
},
{ title: '部署时间', width: '150', field: 'processDefinition.deploymentTime' }
]
}, },
{ {
name: 'productSetting', title: '操作',
title: '表单预览', align: 'center',
type: 'primary', minWidth: '200',
icon: 'el-icon-EditPen', render: 'buttons',
render: 'basicButton', fixed: 'right',
click: row => { buttons: [
handleFormDetail(row.formId) {
} name: 'productSetting',
}, title: '设计流程',
{ type: 'primary',
name: 'update', icon: 'el-icon-EditPen',
title: '删除', render: 'basicButton',
type: 'danger', click: row => {
icon: 'el-icon-Delete', handleDesign(row.id)
render: 'confirmButton', }
popconfirm: { },
confirmButtonText: '确认', {
cancelButtonText: '取消', name: 'productSetting',
confirmButtonType: 'danger', title: '部署流程',
title: '确定删除吗?' type: 'primary',
}, icon: 'el-icon-EditPen',
click: row => { render: 'basicButton',
deleteModel(row.id).then(res => { click: row => {
ElMessage.success('删除成功') handleDeployConfirm(row.id)
tableStore.index() }
}) },
} {
name: 'productSetting',
title: '表单预览',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
handleFormDetail(row.formId)
}
},
{
name: 'update',
title: '删除',
type: 'danger',
icon: 'el-icon-Delete',
render: 'confirmButton',
popconfirm: {
confirmButtonText: '确认',
cancelButtonText: '取消',
confirmButtonType: 'danger',
title: '确定删除吗?'
},
click: row => {
deleteModel(row.id).then(res => {
ElMessage.success('删除成功')
tableStore.index()
})
}
}
]
}
],
beforeSearchFun: () => {
if (tableStore.table.params.addr) {
tableStore.table.params.addrStrOption = tableStore.table.params.addr.map(tempArray => tempArray.join('/'))
}
for (let key in tableStore.table.params) {
if (tableStore.table.params[key] === '') {
delete tableStore.table.params[key]
}
} }
]
} }
],
beforeSearchFun: () => {
if (tableStore.table.params.addr) {
tableStore.table.params.addrStrOption = tableStore.table.params.addr.map(tempArray => tempArray.join('/'))
}
for (let key in tableStore.table.params) {
if (tableStore.table.params[key] === '') {
delete tableStore.table.params[key]
}
}
}
}) })
const flowInfo = ref() const flowInfo = ref()
onMounted(async () => { onMounted(async () => {
// 加载数据 //加载流程标识
tableStore.index() await getSignSimpleList().then(res => {
//加载流程标识 flowInfo.value = res.data
await getSignSimpleList().then(res => { })
flowInfo.value = res.data
}) // 加载数据
tableStore.index()
}) })
tableStore.table.params.userId = '' tableStore.table.params.userId = ''
@@ -200,69 +201,69 @@ provide('tableStore', tableStore)
//获取流程标识的名称 //获取流程标识的名称
const getFormNameByViewPath = (viewPath: string) => { const getFormNameByViewPath = (viewPath: string) => {
const nameItem = flowInfo.value.filter(item => item.viewPath == viewPath) const nameItem = flowInfo.value.filter(item => item.viewPath == viewPath)
if (nameItem.length > 0) { if (nameItem.length > 0) {
return nameItem[0].name return nameItem[0].name
} else { } else {
return '' return ''
} }
} }
//新增用户信息 //新增用户信息
const add = () => { const add = () => {
modelPopup.value.open('新增流程模型') modelPopup.value.open('新增流程模型')
} }
/** 设计流程 */ /** 设计流程 */
const handleDesign = (rowId: string) => { const handleDesign = (rowId: string) => {
push({ push({
name: 'BpmModelEditor', name: 'BpmModelEditor',
query: { query: {
modelId: rowId modelId: rowId
} }
}) })
} }
/** 发布流程 */ /** 发布流程 */
const handleDeployConfirm = (rowId: string) => { const handleDeployConfirm = (rowId: string) => {
try { try {
// 删除的二次确认 // 删除的二次确认
ElMessageBox.confirm('是否部署该流程?', '提示', { ElMessageBox.confirm('是否部署该流程?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
draggable: true, draggable: true,
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
handleDeploy(rowId) handleDeploy(rowId)
}) })
.catch(() => { .catch(() => {
}) })
} catch { } catch {
} }
} }
const handleDeploy = async (rowId: string) => { const handleDeploy = async (rowId: string) => {
// 发起部署 // 发起部署
await deployModel(rowId) await deployModel(rowId)
ElMessage.success('部署成功') ElMessage.success('部署成功')
tableStore.index() tableStore.index()
} }
/** 流程表单的详情按钮操作 */ /** 流程表单的详情按钮操作 */
const formDetailVisible = ref(false) const formDetailVisible = ref(false)
const formDetailPreview = ref({ const formDetailPreview = ref({
rule: [], rule: [],
option: {} option: {}
}) })
const handleFormDetail = async (formId: string) => { const handleFormDetail = async (formId: string) => {
// 设置表单 // 设置表单
await getById(formId).then(res => { await getById(formId).then(res => {
const data = res.data const data = res.data
setConfAndFields2(formDetailPreview, data.conf, data.fields) setConfAndFields2(formDetailPreview, data.conf, data.fields)
// 弹窗打开 // 弹窗打开
formDetailVisible.value = true formDetailVisible.value = true
}) })
} }
</script> </script>