fix: 性能任务激活停止放出,编辑删除放到更多

This commit is contained in:
TsMask
2024-04-10 18:40:56 +08:00
parent b8bff2a159
commit cd0633d519

View File

@@ -5,7 +5,6 @@ import { Form, message, Modal } from 'ant-design-vue/lib';
import { SizeType } from 'ant-design-vue/lib/config-provider'; import { SizeType } from 'ant-design-vue/lib/config-provider';
import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface'; import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface';
import { ColumnsType } from 'ant-design-vue/lib/table'; import { ColumnsType } from 'ant-design-vue/lib/table';
import { parseDateToStr } from '@/utils/date-utils';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import useI18n from '@/hooks/useI18n'; import useI18n from '@/hooks/useI18n';
import useDictStore from '@/store/modules/dict'; import useDictStore from '@/store/modules/dict';
@@ -196,7 +195,11 @@ function fnGetList(pageNum?: number) {
} }
tablePagination.total = res.total; tablePagination.total = res.total;
tableState.data = res.rows; tableState.data = res.rows;
if (tablePagination.total <=(queryParams.pageNum - 1) * tablePagination.pageSize &&queryParams.pageNum !== 1) { if (
tablePagination.total <=
(queryParams.pageNum - 1) * tablePagination.pageSize &&
queryParams.pageNum !== 1
) {
tableState.loading = false; tableState.loading = false;
fnGetList(queryParams.pageNum - 1); fnGetList(queryParams.pageNum - 1);
} }
@@ -311,7 +314,7 @@ function fnModalVisibleByEdit(id?: string) {
modalState.confirmLoading = false; modalState.confirmLoading = false;
hide(); hide();
if (res.code === RESULT_CODE_SUCCESS && res.data) { if (res.code === RESULT_CODE_SUCCESS && res.data) {
fnSelectPerformanceInit(res.data.neType) fnSelectPerformanceInit(res.data.neType);
modalState.from = Object.assign(modalState.from, res.data); modalState.from = Object.assign(modalState.from, res.data);
modalState.title = t('views.perfManage.perfThreshold.editThre'); modalState.title = t('views.perfManage.perfThreshold.editThre');
modalState.visibleByEdit = true; modalState.visibleByEdit = true;
@@ -468,6 +471,14 @@ function fnTaskModalVisible(type: string | number, row: Record<string, any>) {
} }
fnRecordStop(row); fnRecordStop(row);
} }
if (type === 'edit') {
fnModalVisibleByEdit(row.id);
}
if (type === 'delete') {
fnRecordDelete(row);
}
} }
onMounted(() => { onMounted(() => {
@@ -600,23 +611,25 @@ onMounted(() => {
<template v-if="column.key === 'id'"> <template v-if="column.key === 'id'">
<a-space :size="8" align="center"> <a-space :size="8" align="center">
<a-tooltip> <a-tooltip>
<template #title>{{ t('common.editText') }}</template> <template #title>
{{ t('views.configManage.softwareManage.runBtn') }}
</template>
<a-button <a-button
type="link" type="link"
@click.prevent="fnModalVisibleByEdit(record.id)" @click.prevent="fnTaskModalVisible('run', record)"
:disabled="record.status !== 'Inactive'"
> >
<template #icon><FormOutlined /></template> <template #icon><ThunderboltOutlined /></template>
</a-button> </a-button>
</a-tooltip> </a-tooltip>
<a-tooltip> <a-tooltip>
<template #title>{{ t('common.deleteText') }}</template> <template #title>
{{ t('views.perfManage.taskManage.stopTask') }}
</template>
<a-button <a-button
type="link" type="link"
@click.prevent="fnRecordDelete(record)" @click.prevent="fnTaskModalVisible('stop', record)"
:disabled="record.status !== 'Inactive'"
> >
<template #icon><DeleteOutlined /></template> <template #icon><StopOutlined /> </template>
</a-button> </a-button>
</a-tooltip> </a-tooltip>
<a-tooltip> <a-tooltip>
@@ -632,13 +645,19 @@ onMounted(() => {
<a-menu <a-menu
@click="({ key }:any) => fnTaskModalVisible(key, record)" @click="({ key }:any) => fnTaskModalVisible(key, record)"
> >
<a-menu-item key="run"> <a-menu-item
<ThunderboltOutlined /> key="edit"
{{ t('views.configManage.softwareManage.runBtn') }} :disabled="record.status !== 'Inactive'"
>
<FormOutlined />
{{ t('common.editText') }}
</a-menu-item> </a-menu-item>
<a-menu-item key="stop"> <a-menu-item
<UndoOutlined /> key="delete"
{{ t('views.perfManage.taskManage.stopTask') }} :disabled="record.status !== 'Inactive'"
>
<DeleteOutlined />
{{ t('common.deleteText') }}
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
</template> </template>