chore: 流程定义 激活改为switch
This commit is contained in:
parent
4439533b09
commit
31b7551852
@ -3,7 +3,7 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
|
|||||||
import { type FormSchemaGetter } from '#/adapter/form';
|
import { type FormSchemaGetter } from '#/adapter/form';
|
||||||
import { OptionsTag } from '#/components/table';
|
import { OptionsTag } from '#/components/table';
|
||||||
|
|
||||||
import { activityStatusOptions, publishStatusOptions } from './constant';
|
import { publishStatusOptions } from './constant';
|
||||||
|
|
||||||
export const querySchema: FormSchemaGetter = () => [
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
{
|
{
|
||||||
@ -38,18 +38,10 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'activityStatus',
|
field: 'activityStatus',
|
||||||
title: '状态',
|
title: '激活状态',
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
slots: {
|
slots: {
|
||||||
default: ({ row }) => {
|
default: 'activityStatus',
|
||||||
const cellValue = row.activityStatus;
|
|
||||||
return (
|
|
||||||
<OptionsTag
|
|
||||||
options={activityStatusOptions as any}
|
|
||||||
value={cellValue}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
|||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
import { getVxePopupContainer } from '@vben/utils';
|
import { getVxePopupContainer } from '@vben/utils';
|
||||||
|
|
||||||
import { message, Modal, Popconfirm, Space } from 'ant-design-vue';
|
import { message, Modal, Popconfirm, Space, Switch } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||||
import { vxeCheckboxChecked } from '#/adapter/vxe-table';
|
import { vxeCheckboxChecked } from '#/adapter/vxe-table';
|
||||||
@ -23,7 +23,6 @@ import {
|
|||||||
import { downloadByData } from '#/utils/file/download';
|
import { downloadByData } from '#/utils/file/download';
|
||||||
|
|
||||||
import CategoryTree from './category-tree.vue';
|
import CategoryTree from './category-tree.vue';
|
||||||
import { ActivityStatusEnum } from './constant';
|
|
||||||
import { columns, querySchema } from './data';
|
import { columns, querySchema } from './data';
|
||||||
import processDefinitionDeployModal from './process-definition-deploy-modal.vue';
|
import processDefinitionDeployModal from './process-definition-deploy-modal.vue';
|
||||||
import processDefinitionHistoryModal from './process-definition-history-modal.vue';
|
import processDefinitionHistoryModal from './process-definition-history-modal.vue';
|
||||||
@ -132,9 +131,15 @@ function handleDesign(row: any, disabled: boolean) {
|
|||||||
* 激活/挂起流程
|
* 激活/挂起流程
|
||||||
* @param row row
|
* @param row row
|
||||||
*/
|
*/
|
||||||
async function handleActive(row: any) {
|
async function handleActive(row: any, status: boolean | number | string) {
|
||||||
await workflowDefinitionActive(row.id, !row.activityStatus);
|
const lastStatus = status === 1 ? 0 : 1;
|
||||||
await tableApi.query();
|
try {
|
||||||
|
await workflowDefinitionActive(row.id, !!status);
|
||||||
|
await tableApi.query();
|
||||||
|
} catch (error) {
|
||||||
|
row.activityStatus = lastStatus;
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const [ProcessDefinitionHistoryModal, historyModalApi] = useVbenModal({
|
const [ProcessDefinitionHistoryModal, historyModalApi] = useVbenModal({
|
||||||
@ -258,25 +263,19 @@ function handleDeploy() {
|
|||||||
</a-button>
|
</a-button>
|
||||||
</Space>
|
</Space>
|
||||||
</template>
|
</template>
|
||||||
|
<template #activityStatus="{ row }">
|
||||||
|
<Switch
|
||||||
|
v-model:checked="row.activityStatus"
|
||||||
|
:checked-value="1"
|
||||||
|
:unchecked-value="0"
|
||||||
|
checked-children="激活"
|
||||||
|
un-checked-children="挂起"
|
||||||
|
@change="(status) => handleActive(row, status)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
<template #action="{ row }">
|
<template #action="{ row }">
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<div>
|
<div>
|
||||||
<a-button
|
|
||||||
v-if="row.activityStatus === ActivityStatusEnum.Active"
|
|
||||||
size="small"
|
|
||||||
type="link"
|
|
||||||
@click="() => handleActive(row)"
|
|
||||||
>
|
|
||||||
挂起流程
|
|
||||||
</a-button>
|
|
||||||
<a-button
|
|
||||||
v-if="row.activityStatus === ActivityStatusEnum.Suspended"
|
|
||||||
size="small"
|
|
||||||
type="link"
|
|
||||||
@click="() => handleActive(row)"
|
|
||||||
>
|
|
||||||
激活流程
|
|
||||||
</a-button>
|
|
||||||
<a-button size="small" type="link" @click="handleHistory(row)">
|
<a-button size="small" type="link" @click="handleHistory(row)">
|
||||||
历史版本
|
历史版本
|
||||||
</a-button>
|
</a-button>
|
||||||
|
@ -7,7 +7,7 @@ import { useVbenModal } from '@vben/common-ui';
|
|||||||
import { useVbenVxeGrid, type VxeGridProps } from '@vben/plugins/vxe-table';
|
import { useVbenVxeGrid, type VxeGridProps } from '@vben/plugins/vxe-table';
|
||||||
import { getVxePopupContainer } from '@vben/utils';
|
import { getVxePopupContainer } from '@vben/utils';
|
||||||
|
|
||||||
import { Popconfirm } from 'ant-design-vue';
|
import { Popconfirm, Switch } from 'ant-design-vue';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getHisListByKey,
|
getHisListByKey,
|
||||||
@ -17,7 +17,6 @@ import {
|
|||||||
workflowDefinitionPublish,
|
workflowDefinitionPublish,
|
||||||
} from '#/api/workflow/definition';
|
} from '#/api/workflow/definition';
|
||||||
|
|
||||||
import { ActivityStatusEnum } from './constant';
|
|
||||||
import { columns } from './data';
|
import { columns } from './data';
|
||||||
|
|
||||||
const [BasicModal, modalApi] = useVbenModal({
|
const [BasicModal, modalApi] = useVbenModal({
|
||||||
@ -111,9 +110,15 @@ async function handleCopy(row: any) {
|
|||||||
* 激活/挂起流程
|
* 激活/挂起流程
|
||||||
* @param row row
|
* @param row row
|
||||||
*/
|
*/
|
||||||
async function handleActive(row: any) {
|
async function handleActive(row: any, status: boolean | number | string) {
|
||||||
await workflowDefinitionActive(row.id, !row.activityStatus);
|
const lastStatus = status === 1 ? 0 : 1;
|
||||||
await tableApi.query();
|
try {
|
||||||
|
await workflowDefinitionActive(row.id, !!status);
|
||||||
|
await tableApi.query();
|
||||||
|
} catch (error) {
|
||||||
|
row.activityStatus = lastStatus;
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -121,25 +126,19 @@ async function handleActive(row: any) {
|
|||||||
<BasicModal>
|
<BasicModal>
|
||||||
<!-- TODO: 添加操作列 -->
|
<!-- TODO: 添加操作列 -->
|
||||||
<BasicTable>
|
<BasicTable>
|
||||||
|
<template #activityStatus="{ row }">
|
||||||
|
<Switch
|
||||||
|
v-model:checked="row.activityStatus"
|
||||||
|
:checked-value="1"
|
||||||
|
:unchecked-value="0"
|
||||||
|
checked-children="激活"
|
||||||
|
un-checked-children="挂起"
|
||||||
|
@change="(status) => handleActive(row, status)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
<template #action="{ row }">
|
<template #action="{ row }">
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<div>
|
<div>
|
||||||
<a-button
|
|
||||||
v-if="row.activityStatus === ActivityStatusEnum.Active"
|
|
||||||
size="small"
|
|
||||||
type="link"
|
|
||||||
@click="() => handleActive(row)"
|
|
||||||
>
|
|
||||||
挂起流程
|
|
||||||
</a-button>
|
|
||||||
<a-button
|
|
||||||
v-if="row.activityStatus === ActivityStatusEnum.Suspended"
|
|
||||||
size="small"
|
|
||||||
type="link"
|
|
||||||
@click="() => handleActive(row)"
|
|
||||||
>
|
|
||||||
激活流程
|
|
||||||
</a-button>
|
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
:get-popup-container="getVxePopupContainer"
|
:get-popup-container="getVxePopupContainer"
|
||||||
placement="left"
|
placement="left"
|
||||||
|
Loading…
Reference in New Issue
Block a user