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