FlowVue/src/views/bpm/definition/index.vue

175 lines
5.2 KiB
Vue
Raw Normal View History

<template>
<ContentWrap>
2023-03-26 08:46:04 +08:00
<el-table v-loading="loading" :data="list">
<el-table-column label="定义编号" align="center" prop="id" width="400" />
<el-table-column label="流程名称" align="center" prop="name" width="200">
<template #default="scope">
2023-04-09 13:08:19 +08:00
<el-button type="primary" link @click="handleBpmnDetail(scope.row)">
2023-03-26 08:46:04 +08:00
<span>{{ scope.row.name }}</span>
</el-button>
</template>
</el-table-column>
<el-table-column label="定义分类" align="center" prop="category" width="100">
<template #default="scope">
<dict-tag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="scope.row.category" />
</template>
</el-table-column>
<el-table-column label="表单信息" align="center" prop="formType" width="200">
<template #default="scope">
<el-button
v-if="scope.row.formType === 10"
type="primary"
link
2023-03-26 08:46:04 +08:00
@click="handleFormDetail(scope.row)"
>
<span>{{ scope.row.formName }}</span>
</el-button>
2023-04-09 13:08:19 +08:00
<el-button v-else type="primary" link @click="handleFormDetail(scope.row)">
2023-03-26 08:46:04 +08:00
<span>{{ scope.row.formCustomCreatePath }}</span>
</el-button>
</template>
</el-table-column>
<el-table-column label="流程版本" align="center" prop="processDefinition.version" width="80">
<template #default="scope">
<el-tag v-if="scope.row">v{{ scope.row.version }}</el-tag>
<el-tag type="warning" v-else>未部署</el-tag>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="version" width="80">
<template #default="scope">
<el-tag type="success" v-if="scope.row.suspensionState === 1">激活</el-tag>
<el-tag type="warning" v-if="scope.row.suspensionState === 2">挂起</el-tag>
</template>
</el-table-column>
<el-table-column
label="部署时间"
align="center"
prop="deploymentTime"
width="180"
:formatter="dateFormatter"
/>
2023-03-26 08:46:04 +08:00
<el-table-column
label="定义描述"
align="center"
prop="description"
width="300"
show-overflow-tooltip
2023-02-27 17:39:14 +08:00
/>
2023-03-26 08:46:04 +08:00
<el-table-column label="操作" align="center" width="150" fixed="right">
<template #default="scope">
<el-button
link
type="primary"
@click="handleAssignRule(scope.row)"
v-hasPermi="['bpm:task-assign-rule:query']"
>
分配规则
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
2023-03-26 08:46:04 +08:00
<!-- 弹窗表单详情 -->
<Dialog title="表单详情" v-model="formDetailVisible" width="800">
<form-create :rule="formDetailPreview.rule" :option="formDetailPreview.option" />
</Dialog>
<!-- 弹窗流程模型图的预览 -->
<Dialog title="流程图" v-model="bpmnDetailVisible" width="800">
<MyProcessViewer
2023-03-26 08:46:04 +08:00
key="designer"
v-model="bpmnXML"
2023-04-23 19:35:14 +08:00
:value="bpmnXML as any"
2023-03-26 08:46:04 +08:00
v-bind="bpmnControlForm"
:prefix="bpmnControlForm.prefix"
/>
</Dialog>
</template>
2023-03-26 08:46:04 +08:00
2023-06-21 19:35:11 +08:00
<script lang="ts" setup>
2023-03-26 08:46:04 +08:00
import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import { MyProcessViewer } from '@/components/bpmnProcessDesigner/package'
import * as DefinitionApi from '@/api/bpm/definition'
import { setConfAndFields2 } from '@/utils/formCreate'
2023-06-21 19:14:34 +08:00
defineOptions({ name: 'BpmProcessDefinition' })
2023-03-26 08:46:04 +08:00
const { push } = useRouter() // 路由
const { query } = useRoute() // 查询参数
2023-03-26 08:46:04 +08:00
const loading = ref(true) // 列表的加载中
const total = ref(0) // 列表的总页数
const list = ref([]) // 列表的数据
const queryParams = reactive({
2023-03-26 08:46:04 +08:00
pageNo: 1,
pageSize: 10,
key: query.key
})
2023-03-28 23:18:10 +08:00
/** 查询列表 */
2023-03-26 08:46:04 +08:00
const getList = async () => {
loading.value = true
try {
const data = await DefinitionApi.getProcessDefinitionPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 点击任务分配按钮 */
const handleAssignRule = (row) => {
push({
name: 'BpmTaskAssignRuleList',
query: {
modelId: row.id
}
})
}
/** 流程表单的详情按钮操作 */
const formDetailVisible = ref(false)
const formDetailPreview = ref({
rule: [],
option: {}
})
const handleFormDetail = async (row) => {
if (row.formType == 10) {
// 设置表单
setConfAndFields2(formDetailPreview, row.formConf, row.formFields)
// 弹窗打开
formDetailVisible.value = true
} else {
2023-03-26 08:46:04 +08:00
await push({
path: row.formCustomCreatePath
})
}
}
2023-03-26 08:46:04 +08:00
/** 流程图的详情按钮操作 */
const bpmnDetailVisible = ref(false)
const bpmnXML = ref(null)
const bpmnControlForm = ref({
prefix: 'flowable'
})
const handleBpmnDetail = async (row) => {
bpmnXML.value = await DefinitionApi.getProcessDefinitionBpmnXML(row.id)
bpmnDetailVisible.value = true
}
2023-03-26 08:46:04 +08:00
/** 初始化 **/
onMounted(() => {
getList()
})
</script>