feat: model style

pull/12/head
xingyu 2023-05-15 18:46:45 +08:00
parent 08666c841f
commit 479cbdd5d3
1 changed files with 43 additions and 5 deletions

View File

@ -9,7 +9,7 @@
:maxSize="20" :maxSize="20"
:maxNumber="1" :maxNumber="1"
:emptyHidePreview="true" :emptyHidePreview="true"
@change="handleChange" @change="reload"
:uploadParams="uploadParams" :uploadParams="uploadParams"
:api="importModel" :api="importModel"
class="my-5" class="my-5"
@ -19,8 +19,26 @@
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<TableAction <TableAction
:actions="[ :actions="[{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'bpm:model:update', onClick: handleEdit.bind(null, record) }]"
{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'bpm:model:update', onClick: handleEdit.bind(null, record) }, :dropDownActions="[
{ icon: IconEnum.EDIT, label: '设计流程', auth: 'bpm:model:update', onClick: handleDesign.bind(null, record) },
{ icon: IconEnum.EDIT, label: '分配规则', auth: 'bpm:task-assign-rule:query', onClick: handleAssignRule.bind(null, record) },
{
icon: IconEnum.EDIT,
label: '发布流程',
auth: 'bpm:model:deploy',
popConfirm: {
title: t('common.delMessage'),
placement: 'left',
confirm: handleDeploy.bind(null, record)
}
},
{
icon: IconEnum.EDIT,
label: '流程定义',
auth: 'bpm:process-definition:query',
onClick: handleDefinitionList.bind(null, record)
},
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
@ -42,6 +60,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue' import { ref } from 'vue'
import { useGo } from '@/hooks/web/usePage'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage' import { useMessage } from '@/hooks/web/useMessage'
import { useModal } from '@/components/Modal' import { useModal } from '@/components/Modal'
@ -49,12 +68,13 @@ import ModelModal from './ModelModal.vue'
import { IconEnum } from '@/enums/appEnum' import { IconEnum } from '@/enums/appEnum'
import { BasicUpload } from '@/components/Upload' import { BasicUpload } from '@/components/Upload'
import { BasicTable, useTable, TableAction } from '@/components/Table' import { BasicTable, useTable, TableAction } from '@/components/Table'
import { deleteModel, getModelPage, importModel } from '@/api/bpm/model' import { deleteModel, deployModel, getModelPage, importModel } from '@/api/bpm/model'
import { columns, searchFormSchema } from './model.data' import { columns, searchFormSchema } from './model.data'
import { getAccessToken, getTenantId } from '@/utils/auth' import { getAccessToken, getTenantId } from '@/utils/auth'
defineOptions({ name: 'BpmModel' }) defineOptions({ name: 'BpmModel' })
const go = useGo()
const { t } = useI18n() const { t } = useI18n()
const { createMessage } = useMessage() const { createMessage } = useMessage()
const [registerModal, { openModal }] = useModal() const [registerModal, { openModal }] = useModal()
@ -87,10 +107,28 @@ function handleEdit(record: Recordable) {
openModal(true, { record, isUpdate: true }) openModal(true, { record, isUpdate: true })
} }
function handleChange() { /** 设计流程 */
function handleDesign(record: Recordable) {
go({ name: 'BpmModelEditor', query: { modelId: record.id } })
}
/** 点击任务分配按钮 */
function handleAssignRule(record: Recordable) {
go({ name: 'BpmTaskAssignRuleList', query: { modelId: record.id } })
}
/** 发布流程 */
async function handleDeploy(record: Recordable) {
await deployModel(record.id)
createMessage.success(t('common.successText'))
reload() reload()
} }
/** 跳转到指定流程定义列表 */
function handleDefinitionList(record: Recordable) {
go({ name: 'BpmProcessDefinition', query: { modelId: record.key } })
}
async function handleDelete(record: Recordable) { async function handleDelete(record: Recordable) {
await deleteModel(record.id) await deleteModel(record.id)
createMessage.success(t('common.delSuccessText')) createMessage.success(t('common.delSuccessText'))