fix: refine sensitive word table actions
This commit is contained in:
@@ -151,15 +151,7 @@
|
|||||||
import { usePermission } from '@/hooks/web/usePermission';
|
import { usePermission } from '@/hooks/web/usePermission';
|
||||||
import { useUserStore } from '@/store/modules/user';
|
import { useUserStore } from '@/store/modules/user';
|
||||||
import { adaModalWidth, adaTableScrollX } from '@/utils/hotgo';
|
import { adaModalWidth, adaTableScrollX } from '@/utils/hotgo';
|
||||||
import {
|
import { BatchImport, Delete, Edit, GroupEdit, GroupList, List } from '@/api/imSensitiveWord';
|
||||||
BatchImport,
|
|
||||||
Delete,
|
|
||||||
Edit,
|
|
||||||
GroupEdit,
|
|
||||||
GroupList,
|
|
||||||
List,
|
|
||||||
Status,
|
|
||||||
} from '@/api/imSensitiveWord';
|
|
||||||
import { columns, groupOptions, loadOptions, schemas } from './model';
|
import { columns, groupOptions, loadOptions, schemas } from './model';
|
||||||
import {
|
import {
|
||||||
getDefaultTenantValue,
|
getDefaultTenantValue,
|
||||||
@@ -217,7 +209,7 @@
|
|||||||
const loadTable = (res) => List({ ...searchFormRef.value?.formModel, ...res });
|
const loadTable = (res) => List({ ...searchFormRef.value?.formModel, ...res });
|
||||||
const reload = () => tableRef.value?.reload();
|
const reload = () => tableRef.value?.reload();
|
||||||
const actionColumn = reactive({
|
const actionColumn = reactive({
|
||||||
width: 230,
|
width: 150,
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
@@ -226,11 +218,6 @@
|
|||||||
style: 'button',
|
style: 'button',
|
||||||
actions: [
|
actions: [
|
||||||
{ label: '编辑', auth: ['/imSensitiveWord/edit'], onClick: () => openEdit(row) },
|
{ label: '编辑', auth: ['/imSensitiveWord/edit'], onClick: () => openEdit(row) },
|
||||||
{
|
|
||||||
label: row.status === 1 ? '停用' : '启用',
|
|
||||||
auth: ['/imSensitiveWord/status'],
|
|
||||||
onClick: () => changeStatus(row),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: '删除',
|
label: '删除',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
@@ -264,12 +251,6 @@
|
|||||||
submitting.value = false;
|
submitting.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function changeStatus(row) {
|
|
||||||
Status({ id: row.id, status: row.status === 1 ? 2 : 1 }).then(() => {
|
|
||||||
message.success('操作成功');
|
|
||||||
reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function removeWord(row) {
|
function removeWord(row) {
|
||||||
dialog.error({
|
dialog.error({
|
||||||
title: '删除敏感词',
|
title: '删除敏感词',
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { computed, ref } from 'vue';
|
import { computed, h, ref } from 'vue';
|
||||||
|
import { NTag } from 'naive-ui';
|
||||||
import { FormSchema } from '@/components/Form';
|
import { FormSchema } from '@/components/Form';
|
||||||
import { useDictStore } from '@/store/modules/dict';
|
import { useDictStore } from '@/store/modules/dict';
|
||||||
import { policyTenantOptions } from '@/views/imPolicyShared';
|
import { policyTenantOptions } from '@/views/imPolicyShared';
|
||||||
|
import { renderOptionTag } from '@/utils';
|
||||||
|
|
||||||
const dict = useDictStore();
|
const dict = useDictStore();
|
||||||
export const groupOptions = ref<any[]>([]);
|
export const groupOptions = ref<any[]>([]);
|
||||||
@@ -89,15 +91,23 @@ export const columns = [
|
|||||||
title: '风险等级',
|
title: '风险等级',
|
||||||
key: 'riskLevel',
|
key: 'riskLevel',
|
||||||
width: 100,
|
width: 100,
|
||||||
render: (r) => dict.getLabel('ImRiskLevelOptions', r.riskLevel),
|
render: (r) => renderOptionTag('ImRiskLevelOptions', r.riskLevel),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
key: 'status',
|
key: 'status',
|
||||||
width: 90,
|
width: 90,
|
||||||
render: (r) => dict.getLabel('sys_normal_disable', r.status),
|
render: (r) =>
|
||||||
|
h(
|
||||||
|
NTag,
|
||||||
|
{
|
||||||
|
type: r.status === 1 ? 'success' : 'error',
|
||||||
|
bordered: false,
|
||||||
},
|
},
|
||||||
{ title: '更新时间', key: 'updatedAt', width: 180 },
|
{ default: () => (r.status === 1 ? '正常' : '停用') }
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ title: '创建时间', key: 'createdAt', width: 180 },
|
||||||
];
|
];
|
||||||
export function loadOptions() {
|
export function loadOptions() {
|
||||||
dict.loadOptions([
|
dict.loadOptions([
|
||||||
|
|||||||
Reference in New Issue
Block a user