!681 feat: BPM-更多设置-摘要设置

Merge pull request !681 from Lesan/feature/bpm-摘要设置
pull/683/MERGE
芋道源码 2025-01-24 11:30:14 +00:00 committed by Gitee
commit ab83cee50f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 108 additions and 30 deletions

View File

@ -75,12 +75,12 @@
</el-radio-group> </el-radio-group>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item v-if="modelData.customTitleSetting" class="mb-20px"> <el-form-item v-if="modelData.titleSetting" class="mb-20px">
<template #label> <template #label>
<el-text size="large" tag="b">标题设置</el-text> <el-text size="large" tag="b">标题设置</el-text>
</template> </template>
<div class="flex flex-col"> <div class="flex flex-col">
<el-radio-group v-model="modelData.customTitleSetting.enable"> <el-radio-group v-model="modelData.titleSetting.enable">
<div class="flex flex-col"> <div class="flex flex-col">
<el-radio :value="false" <el-radio :value="false"
>系统默认 <el-text type="info"> 展示流程名称 </el-text></el-radio >系统默认 <el-text type="info"> 展示流程名称 </el-text></el-radio
@ -96,18 +96,50 @@
</div> </div>
</el-radio-group> </el-radio-group>
<el-mention <el-mention
v-if="modelData.customTitleSetting.enable" v-if="modelData.titleSetting.enable"
v-model="modelData.customTitleSetting.title" v-model="modelData.titleSetting.title"
type="textarea" type="textarea"
prefix="{" prefix="{"
split="}" split="}"
whole whole
:options="formFieldOptions" :options="formFieldOptions4Title"
placeholder="请插入表单字段或输入文本" placeholder="请插入表单字段(输入 '{' 可以选择表单字段)或输入文本"
class="w-600px!" class="w-600px!"
/> />
</div> </div>
</el-form-item> </el-form-item>
<el-form-item
v-if="modelData.summarySetting && modelData.formType === BpmModelFormType.NORMAL"
class="mb-20px"
>
<template #label>
<el-text size="large" tag="b">摘要设置</el-text>
</template>
<div class="flex flex-col">
<el-radio-group v-model="modelData.summarySetting.enable">
<div class="flex flex-col">
<el-radio :value="false">
系统默认 <el-text type="info"> 展示表单前 3 个字段 </el-text>
</el-radio>
<el-radio :value="true"> 自定义摘要 </el-radio>
</div>
</el-radio-group>
<el-select
class="w-500px!"
v-if="modelData.summarySetting.enable"
v-model="modelData.summarySetting.summary"
multiple
placeholder="请选择要展示的表单字段"
>
<el-option
v-for="item in formFieldOptions4Summary"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</el-form-item>
</el-form> </el-form>
</template> </template>
@ -174,21 +206,30 @@ const numberExample = computed(() => {
}) })
/** 表单选项 */ /** 表单选项 */
const formField = ref<Array<{ field: ProcessVariableEnum; title: string }>>([]) const formField = ref<Array<{ field: string; title: string }>>([])
const formFieldOptions = computed(() => { const formFieldOptions4Title = computed(() => {
let cloneFormField = formField.value.map((item) => {
return {
label: item.title,
value: item.field
}
})
// ID // ID
formField.value.unshift({ cloneFormField.unshift({
field: ProcessVariableEnum.PROCESS_DEFINITION_NAME, label: ProcessVariableEnum.PROCESS_DEFINITION_NAME,
title: '流程名称' value: '流程名称'
}) })
formField.value.unshift({ cloneFormField.unshift({
field: ProcessVariableEnum.START_TIME, label: ProcessVariableEnum.START_TIME,
title: '发起时间' value: '发起时间'
}) })
formField.value.unshift({ cloneFormField.unshift({
field: ProcessVariableEnum.START_USER_ID, label: ProcessVariableEnum.START_USER_ID,
title: '发起人' value: '发起人'
}) })
return cloneFormField
})
const formFieldOptions4Summary = computed(() => {
return formField.value.map((item) => { return formField.value.map((item) => {
return { return {
label: item.title, label: item.title,
@ -211,12 +252,18 @@ const initData = () => {
if (!modelData.value.autoApprovalType) { if (!modelData.value.autoApprovalType) {
modelData.value.autoApprovalType = BpmAutoApproveType.NONE modelData.value.autoApprovalType = BpmAutoApproveType.NONE
} }
if (!modelData.value.customTitleSetting) { if (!modelData.value.titleSetting) {
modelData.value.customTitleSetting = { modelData.value.titleSetting = {
enable: false, enable: false,
title: '' title: ''
} }
} }
if (!modelData.value.summarySetting) {
modelData.value.summarySetting = {
enable: false,
summary: []
}
}
} }
defineExpose({ initData }) defineExpose({ initData })
@ -224,9 +271,9 @@ defineExpose({ initData })
watch( watch(
() => modelData.value.formId, () => modelData.value.formId,
async (newFormId) => { async (newFormId) => {
if (newFormId && modelData.value.formType === BpmModelFormType.CUSTOM) { if (newFormId && modelData.value.formType === BpmModelFormType.NORMAL) {
const data = await FormApi.getForm(newFormId) const data = await FormApi.getForm(newFormId)
const result: Array<{ field: ProcessVariableEnum; title: string }> = [] const result: Array<{ field: string; title: string }> = []
if (data.fields) { if (data.fields) {
data.fields.forEach((fieldStr: string) => { data.fields.forEach((fieldStr: string) => {
parseFormFields(JSON.parse(fieldStr), result) parseFormFields(JSON.parse(fieldStr), result)

View File

@ -155,9 +155,13 @@ const formData: any = ref({
length: 5 length: 5
}, },
autoApprovalType: BpmAutoApproveType.NONE, autoApprovalType: BpmAutoApproveType.NONE,
customTitleSetting: { titleSetting: {
enable: false, enable: false,
title: '' title: ''
},
summarySetting: {
enable: false,
summary: []
} }
}) })

View File

@ -130,6 +130,15 @@
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="流程名称" align="center" prop="name" min-width="200px" fixed="left" /> <el-table-column label="流程名称" align="center" prop="name" min-width="200px" fixed="left" />
<el-table-column label="摘要" prop="summary" min-width="180" fixed="left">
<template #default="scope">
<div class="flex flex-col" v-if="scope.row.summary && scope.row.summary.length > 0">
<div v-for="(item, index) in scope.row.summary" :key="index">
<el-text type="info"> {{ item.key }} : {{ item.value }} </el-text>
</div>
</div>
</template>
</el-table-column>
<el-table-column <el-table-column
label="流程分类" label="流程分类"
align="center" align="center"

View File

@ -64,7 +64,7 @@
:value="dict.value" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 高级筛选 --> <!-- 高级筛选 -->
<el-form-item :style="{ position: 'absolute', right: '0px' }"> <el-form-item :style="{ position: 'absolute', right: '0px' }">
@ -77,9 +77,9 @@
> >
<template #reference> <template #reference>
<el-button @click="showPopover = !showPopover" > <el-button @click="showPopover = !showPopover" >
<Icon icon="ep:plus" class="mr-5px" />高级筛选 <Icon icon="ep:plus" class="mr-5px" />高级筛选
</el-button> </el-button>
</template> </template>
<el-form-item label="流程发起人" class="bold-label" label-position="top" prop="category"> <el-form-item label="流程发起人" class="bold-label" label-position="top" prop="category">
<el-select <el-select
@ -95,7 +95,7 @@
:value="category.code" :value="category.code"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="发起时间" class="bold-label" label-position="top" prop="createTime"> <el-form-item label="发起时间" class="bold-label" label-position="top" prop="createTime">
<el-date-picker <el-date-picker
v-model="queryParams.createTime" v-model="queryParams.createTime"
@ -122,6 +122,15 @@
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column align="center" label="流程" prop="processInstance.name" width="180" /> <el-table-column align="center" label="流程" prop="processInstance.name" width="180" />
<el-table-column label="摘要" prop="summary" min-width="180">
<template #default="scope">
<div class="flex flex-col" v-if="scope.row.summary && scope.row.summary.length > 0">
<div v-for="(item, index) in scope.row.summary" :key="index">
<el-text type="info"> {{ item.key }} : {{ item.value }} </el-text>
</div>
</div>
</template>
</el-table-column>
<el-table-column <el-table-column
align="center" align="center"
label="发起人" label="发起人"
@ -195,7 +204,7 @@ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
name: '', name: '',
category: undefined, category: undefined,
status: undefined, status: undefined,
createTime: [] createTime: []
}) })

View File

@ -60,9 +60,9 @@
> >
<template #reference> <template #reference>
<el-button @click="showPopover = !showPopover" > <el-button @click="showPopover = !showPopover" >
<Icon icon="ep:plus" class="mr-5px" />高级筛选 <Icon icon="ep:plus" class="mr-5px" />高级筛选
</el-button> </el-button>
</template> </template>
<el-form-item label="流程发起人" class="bold-label" label-position="top" prop="category"> <el-form-item label="流程发起人" class="bold-label" label-position="top" prop="category">
<el-select <el-select
@ -78,7 +78,7 @@
:value="category.code" :value="category.code"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="发起时间" class="bold-label" label-position="top" prop="createTime"> <el-form-item label="发起时间" class="bold-label" label-position="top" prop="createTime">
<el-date-picker <el-date-picker
v-model="queryParams.createTime" v-model="queryParams.createTime"
@ -105,6 +105,15 @@
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column align="center" label="流程" prop="processInstance.name" width="180" /> <el-table-column align="center" label="流程" prop="processInstance.name" width="180" />
<el-table-column label="摘要" prop="summary" min-width="180">
<template #default="scope">
<div class="flex flex-col" v-if="scope.row.summary && scope.row.summary.length > 0">
<div v-for="(item, index) in scope.row.summary" :key="index">
<el-text type="info"> {{ item.key }} : {{ item.value }} </el-text>
</div>
</div>
</template>
</el-table-column>
<el-table-column <el-table-column
align="center" align="center"
label="发起人" label="发起人"