feat: add permission

pull/3/head
xingyuv 2023-03-24 14:22:55 +08:00
parent d0dbb951cf
commit fc1d741b22
39 changed files with 259 additions and 293 deletions

View File

@ -15,7 +15,7 @@ const emit = defineEmits(['success', 'register'])
const title = ref('修改密码') const title = ref('修改密码')
const [registerForm, { resetFields, validate }] = useForm({ const [registerForm, { resetFields, validate }] = useForm({
labelWidth: 100, labelWidth: 120,
baseColProps: { span: 24 }, baseColProps: { span: 24 },
schemas: passwordSchema, schemas: passwordSchema,
showActionButtonGroup: false, showActionButtonGroup: false,

View File

@ -2,7 +2,9 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="warning" @click="handleExport"> {{ t('action.export') }} </a-button> <a-button type="warning" v-auth="['infra:api-access-log:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template> </template>
</BasicTable> </BasicTable>
</div> </div>
@ -11,6 +13,7 @@
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 { BasicTable, useTable } from '@/components/Table' import { BasicTable, useTable } from '@/components/Table'
import { IconEnum } from '@/enums/appEnum'
import { getApiAccessLogPage, exportApiAccessLog, ApiAccessLogExportReqVO } from '@/api/infra/apiAccessLog' import { getApiAccessLogPage, exportApiAccessLog, ApiAccessLogExportReqVO } from '@/api/infra/apiAccessLog'
import { columns, searchFormSchema } from './apiAccessLog.data' import { columns, searchFormSchema } from './apiAccessLog.data'
@ -20,10 +23,7 @@ const [registerTable, { getForm }] = useTable({
title: '访问日志列表', title: '访问日志列表',
api: getApiAccessLogPage, api: getApiAccessLogPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false showIndexColumn: false

View File

@ -2,7 +2,9 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="warning" @click="handleExport"> {{ t('action.export') }} </a-button> <a-button type="warning" v-auth="['infra:api-error-log:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
@ -11,12 +13,14 @@
{ {
icon: IconEnum.EDIT, icon: IconEnum.EDIT,
label: '已处理', label: '已处理',
auth: 'infra:api-error-log:update-status',
ifShow: () => record.processStatus === InfraApiErrorLogProcessStatusEnum.INIT, ifShow: () => record.processStatus === InfraApiErrorLogProcessStatusEnum.INIT,
onClick: handleProcessClick.bind(null, record, InfraApiErrorLogProcessStatusEnum.DONE, '已处理') onClick: handleProcessClick.bind(null, record, InfraApiErrorLogProcessStatusEnum.DONE, '已处理')
}, },
{ {
icon: IconEnum.EDIT, icon: IconEnum.EDIT,
label: '已忽略', label: '已忽略',
auth: 'infra:api-error-log:update-status',
ifShow: () => record.processStatus === InfraApiErrorLogProcessStatusEnum.INIT, ifShow: () => record.processStatus === InfraApiErrorLogProcessStatusEnum.INIT,
onClick: handleProcessClick.bind(null, record, InfraApiErrorLogProcessStatusEnum.IGNORE, '已忽略') onClick: handleProcessClick.bind(null, record, InfraApiErrorLogProcessStatusEnum.IGNORE, '已忽略')
} }
@ -42,10 +46,7 @@ const [registerTable, { getForm, reload }] = useTable({
title: '异常日志列表', title: '异常日志列表',
api: getApiErrorLogPage, api: getApiErrorLogPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,

View File

@ -2,18 +2,21 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.IMPORT" @click="openImportTableModal(true)"> {{ t('action.import') }} </a-button> <a-button type="primary" v-auth="['infra:codegen:create']" :preIcon="IconEnum.IMPORT" @click="openImportTableModal(true)">
{{ t('action.import') }}
</a-button>
</template> </template>
<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: '预览', onClick: handlePreview.bind(null, record) }, { icon: IconEnum.EDIT, label: '预览', auth: 'infra:codegen:preview', onClick: handlePreview.bind(null, record) },
{ icon: IconEnum.EDIT, label: t('action.edit'), onClick: handleEditTable.bind(null, record) }, { icon: IconEnum.EDIT, label: t('action.edit'), auth: 'infra:codegen:update', onClick: handleEditTable.bind(null, record) },
{ icon: IconEnum.DOWNLOAD, label: '生成', onClick: handleGenTable.bind(null, record) }, { icon: IconEnum.DOWNLOAD, label: '生成', auth: 'infra:codegen:download', onClick: handleGenTable.bind(null, record) },
{ {
icon: IconEnum.RESET, icon: IconEnum.RESET,
label: '同步', label: '同步',
auth: 'infra:codegen:update',
popConfirm: { popConfirm: {
title: '确认要强制同步' + record.tableName + '表结构吗?', title: '确认要强制同步' + record.tableName + '表结构吗?',
placement: 'left', placement: 'left',
@ -24,6 +27,7 @@
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'infra:codegen:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -61,10 +65,7 @@ const [registerTable, { reload }] = useTable({
title: '代码生成列表', title: '代码生成列表',
api: getCodegenTablePage, api: getCodegenTablePage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,

View File

@ -2,18 +2,23 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['infra:config:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
<a-button type="warning" :preIcon="IconEnum.EXPORT" @click="handleExport"> {{ t('action.export') }} </a-button> {{ t('action.create') }}
</a-button>
<a-button type="warning" v-auth="['infra:config:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template> </template>
<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'), onClick: handleEdit.bind(null, record) }, { icon: IconEnum.EDIT, label: t('action.edit'), auth: 'infra:config:update', onClick: handleEdit.bind(null, record) },
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'infra:config:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -46,10 +51,7 @@ const [registerTable, { getForm, reload }] = useTable({
title: '配置中心列表', title: '配置中心列表',
api: getConfigPage, api: getConfigPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
@ -62,16 +64,11 @@ const [registerTable, { getForm, reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleExport() { async function handleExport() {

View File

@ -2,18 +2,27 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['infra:data-source-config:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
</template> </template>
<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'), ifShow: record.id !== 0, onClick: handleEdit.bind(null, record) }, {
icon: IconEnum.EDIT,
label: t('action.edit'),
ifShow: record.id !== 0,
auth: 'infra:data-source-config:update',
onClick: handleEdit.bind(null, record)
},
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
ifShow: record.id !== 0, ifShow: record.id !== 0,
auth: 'infra:data-source-config:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -59,16 +68,11 @@ const [registerTable, { reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleDelete(record: Recordable) { async function handleDelete(record: Recordable) {

View File

@ -12,6 +12,7 @@
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'infra:file:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -40,10 +41,7 @@ const [registerTable, { reload }] = useTable({
title: '文件列表', title: '文件列表',
api: getFilePage, api: getFilePage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,

View File

@ -14,7 +14,7 @@ const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true) const isUpdate = ref(true)
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
labelWidth: 100, labelWidth: 120,
baseColProps: { span: 24 }, baseColProps: { span: 24 },
schemas: formSchema, schemas: formSchema,
showActionButtonGroup: false, showActionButtonGroup: false,

View File

@ -2,19 +2,22 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['infra:file-config:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
</template> </template>
<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'), onClick: handleEdit.bind(null, record) }, { icon: IconEnum.EDIT, label: t('action.edit'), auth: 'infra:file-config:update', onClick: handleEdit.bind(null, record) },
{ icon: IconEnum.TEST, label: t('action.test'), onClick: handleTest.bind(null, record) }, { icon: IconEnum.TEST, label: t('action.test'), auth: 'infra:file-config:update', onClick: handleTest.bind(null, record) },
{ icon: IconEnum.AUTH, label: '主配置', onClick: handleMaster.bind(null, record) }, { icon: IconEnum.AUTH, label: '主配置', auth: 'infra:file-config:update', onClick: handleMaster.bind(null, record) },
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'infra:file-config:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -47,10 +50,7 @@ const [registerTable, { reload }] = useTable({
title: '文件配置列表', title: '文件配置列表',
api: getFileConfigPage, api: getFileConfigPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
@ -63,16 +63,11 @@ const [registerTable, { reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleTest(record: Recordable) { async function handleTest(record: Recordable) {

View File

@ -14,7 +14,7 @@ const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true) const isUpdate = ref(true)
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
labelWidth: 100, labelWidth: 120,
baseColProps: { span: 24 }, baseColProps: { span: 24 },
schemas: formSchema, schemas: formSchema,
showActionButtonGroup: false, showActionButtonGroup: false,

View File

@ -2,23 +2,28 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['infra:job:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
<a-button type="warning" :preIcon="IconEnum.EXPORT" @click="handleExport"> {{ t('action.export') }} </a-button> {{ t('action.create') }}
</a-button>
<a-button type="warning" v-auth="['infra:job:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<TableAction <TableAction
:actions="[{ icon: IconEnum.EDIT, label: t('action.edit'), onClick: handleEdit.bind(null, record) }]" :actions="[{ icon: IconEnum.EDIT, label: t('action.edit'), onClick: handleEdit.bind(null, record) }]"
:dropDownActions="[ :dropDownActions="[
{ icon: IconEnum.EDIT, label: '开启', onClick: handleChangeStatus.bind(null, record, true) }, { icon: IconEnum.EDIT, label: '开启', auth: 'infra:job:update', onClick: handleChangeStatus.bind(null, record, true) },
{ icon: IconEnum.EDIT, label: '暂停', onClick: handleChangeStatus.bind(null, record, false) }, { icon: IconEnum.EDIT, label: '暂停', auth: 'infra:job:update', onClick: handleChangeStatus.bind(null, record, false) },
{ icon: IconEnum.EDIT, label: '执行一次', onClick: handleRun.bind(null, record) }, { icon: IconEnum.EDIT, label: '执行一次', auth: 'infra:job:trigger', onClick: handleRun.bind(null, record) },
{ icon: IconEnum.EDIT, label: '任务详细', onClick: handleView.bind(null, record) }, { icon: IconEnum.EDIT, label: '任务详细', auth: 'infra:job:query', onClick: handleView.bind(null, record) },
{ icon: IconEnum.EDIT, label: '调度日志', onClick: handleJobLog.bind(null, record) }, { icon: IconEnum.EDIT, label: '调度日志', auth: 'infra:job:query', onClick: handleJobLog.bind(null, record) },
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'infra:job:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -52,10 +57,7 @@ const [registerTable, { getForm, reload }] = useTable({
title: '定时任务列表', title: '定时任务列表',
api: getJobPage, api: getJobPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
@ -68,16 +70,11 @@ const [registerTable, { getForm, reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
function handleChangeStatus(record: Recordable, open: boolean) { function handleChangeStatus(record: Recordable, open: boolean) {

View File

@ -31,7 +31,7 @@ const ListItemMeta = List.Item.Meta
const listData = ref<any[]>([]) const listData = ref<any[]>([])
const [registerForm, { setFieldsValue, resetFields }] = useForm({ const [registerForm, { setFieldsValue, resetFields }] = useForm({
labelWidth: 100, labelWidth: 120,
baseColProps: { span: 24 }, baseColProps: { span: 24 },
schemas: formSchema, schemas: formSchema,
showActionButtonGroup: false, showActionButtonGroup: false,

View File

@ -10,7 +10,7 @@ import { formSchema } from './area.data'
import { getAreaByIp } from '@/api/system/area' import { getAreaByIp } from '@/api/system/area'
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
labelWidth: 100, labelWidth: 120,
baseColProps: { span: 24 }, baseColProps: { span: 24 },
schemas: formSchema, schemas: formSchema,
showActionButtonGroup: false, showActionButtonGroup: false,

View File

@ -57,10 +57,7 @@ const [register, { expandAll, collapseAll, getForm, reload }] = useTable({
api: getList, api: getList,
columns, columns,
rowKey: 'id', rowKey: 'id',
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
isTreeTable: true, isTreeTable: true,
pagination: false, pagination: false,
useSearchForm: true, useSearchForm: true,

View File

@ -13,7 +13,7 @@
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<TableAction <TableAction
:actions="[ :actions="[
{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:error-code:edit', onClick: handleEdit.bind(null, record) }, { icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:error-code:update', onClick: handleEdit.bind(null, record) },
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
@ -50,10 +50,7 @@ const [registerTable, { getForm, reload }] = useTable({
title: '错误码列表', title: '错误码列表',
api: getErrorCodePage, api: getErrorCodePage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,

View File

@ -20,10 +20,7 @@ const [registerTable, { getForm }] = useTable({
title: '登录日志列表', title: '登录日志列表',
api: getLoginLogPage, api: getLoginLogPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false showIndexColumn: false

View File

@ -47,10 +47,7 @@ const [registerTable, { reload }] = useTable({
title: '邮件列表', title: '邮件列表',
api: getMailAccountPage, api: getMailAccountPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,

View File

@ -12,10 +12,7 @@ const [registerTable] = useTable({
title: '邮件日志列表', title: '邮件日志列表',
api: getMailAccountPage, api: getMailAccountPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false showIndexColumn: false

View File

@ -2,17 +2,31 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['system:mail-template:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
</template> </template>
<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'), onClick: handleEdit.bind(null, record) }, {
icon: IconEnum.EDIT,
label: t('action.test'),
auth: 'system:mail-template:send-mail',
onClick: handleSend.bind(null, record)
},
{
icon: IconEnum.EDIT,
label: t('action.edit'),
auth: 'system:mail-template:update',
onClick: handleEdit.bind(null, record)
},
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'system:mail-template:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -34,7 +48,7 @@ import { useModal } from '@/components/Modal'
import TemplateModal from './TemplateModal.vue' import TemplateModal from './TemplateModal.vue'
import { IconEnum } from '@/enums/appEnum' import { IconEnum } from '@/enums/appEnum'
import { BasicTable, useTable, TableAction } from '@/components/Table' import { BasicTable, useTable, TableAction } from '@/components/Table'
import { deleteMailTemplate, getMailTemplatePage } from '@/api/system/mail/template' import { deleteMailTemplate, getMailTemplatePage, sendMail } from '@/api/system/mail/template'
import { columns, searchFormSchema } from './template.data' import { columns, searchFormSchema } from './template.data'
const { t } = useI18n() const { t } = useI18n()
@ -44,10 +58,7 @@ const [registerTable, { reload }] = useTable({
title: '邮件模板列表', title: '邮件模板列表',
api: getMailTemplatePage, api: getMailTemplatePage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
@ -60,16 +71,17 @@ const [registerTable, { reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false }
})
function handleSend(record: Recordable) {
console.info(record)
// TODO
sendMail(null)
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleDelete(record: Recordable) { async function handleDelete(record: Recordable) {

View File

@ -2,7 +2,9 @@
<div> <div>
<BasicTable @register="register"> <BasicTable @register="register">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['system:menu:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
<a-button type="info" @click="expandAll">{{ t('component.tree.expandAll') }}</a-button> <a-button type="info" @click="expandAll">{{ t('component.tree.expandAll') }}</a-button>
<a-button type="info" @click="collapseAll">{{ t('component.tree.unExpandAll') }}</a-button> <a-button type="info" @click="collapseAll">{{ t('component.tree.unExpandAll') }}</a-button>
</template> </template>
@ -10,11 +12,12 @@
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<TableAction <TableAction
:actions="[ :actions="[
{ icon: IconEnum.EDIT, label: t('action.edit'), onClick: handleEdit.bind(null, record) }, { icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:menu:update', onClick: handleEdit.bind(null, record) },
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'system:menu:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -49,10 +52,7 @@ const [register, { expandAll, collapseAll, getForm, reload }] = useTable({
api: getList, api: getList,
columns, columns,
rowKey: 'id', rowKey: 'id',
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
isTreeTable: true, isTreeTable: true,
pagination: false, pagination: false,
striped: false, striped: false,
@ -74,16 +74,11 @@ async function getList() {
} }
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleDelete(record: Recordable) { async function handleDelete(record: Recordable) {

View File

@ -2,17 +2,20 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['system:notice:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
</template> </template>
<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'), onClick: handleEdit.bind(null, record) }, { icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:notice:update', onClick: handleEdit.bind(null, record) },
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'system:notice:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -44,10 +47,7 @@ const [registerTable, { reload }] = useTable({
title: '公告列表', title: '公告列表',
api: getNoticePage, api: getNoticePage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
@ -60,16 +60,11 @@ const [registerTable, { reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleDelete(record: Recordable) { async function handleDelete(record: Recordable) {

View File

@ -12,10 +12,7 @@ const [registerTable] = useTable({
title: '站内信记录列表', title: '站内信记录列表',
api: getNotifyMessagePage, api: getNotifyMessagePage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false showIndexColumn: false

View File

@ -28,10 +28,7 @@ const [registerTable, { getSelectRowKeys, reload }] = useTable({
title: '我的站内信列表', title: '我的站内信列表',
api: getMyNotifyMessagePage, api: getMyNotifyMessagePage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
rowSelection: { type: 'checkbox' }, rowSelection: { type: 'checkbox' },
rowKey: 'id', rowKey: 'id',
useSearchForm: true, useSearchForm: true,

View File

@ -2,17 +2,25 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['system:notify-template:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
</template> </template>
<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'), onClick: handleEdit.bind(null, record) }, {
icon: IconEnum.EDIT,
label: t('action.edit'),
auth: 'system:notify-template:update',
onClick: handleEdit.bind(null, record)
},
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'system:notify-template:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -45,10 +53,7 @@ const [registerTable, { reload }] = useTable({
title: '站内信模板列表', title: '站内信模板列表',
api: getNotifyTemplatePage, api: getNotifyTemplatePage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
@ -61,16 +66,11 @@ const [registerTable, { reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleDelete(record: Recordable) { async function handleDelete(record: Recordable) {

View File

@ -2,17 +2,20 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['system:oauth2-client:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
</template> </template>
<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'), onClick: handleEdit.bind(null, record) }, { icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:oauth2-client:update', onClick: handleEdit.bind(null, record) },
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'system:oauth2-client:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -44,10 +47,7 @@ const [registerTable, { reload }] = useTable({
title: '应用列表', title: '应用列表',
api: getOAuth2ClientPage, api: getOAuth2ClientPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
@ -60,16 +60,11 @@ const [registerTable, { reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleDelete(record: Recordable) { async function handleDelete(record: Recordable) {

View File

@ -9,6 +9,7 @@
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: '强退', label: '强退',
auth: 'system:oauth2-token:delete',
popConfirm: { popConfirm: {
title: '是否确认强退', title: '是否确认强退',
placement: 'left', placement: 'left',
@ -36,10 +37,7 @@ const [registerTable, { reload }] = useTable({
title: 'Token列表', title: 'Token列表',
api: getAccessTokenPage, api: getAccessTokenPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,

View File

@ -21,10 +21,7 @@ const [registerTable, { getForm }] = useTable({
title: '操作日志列表', title: '操作日志列表',
api: getOperateLogPage, api: getOperateLogPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false showIndexColumn: false

View File

@ -51,10 +51,7 @@ const [registerTable, { getForm, reload }] = useTable({
title: '岗位列表', title: '岗位列表',
api: getPostPage, api: getPostPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
actionColumn: { actionColumn: {

View File

@ -14,7 +14,7 @@ const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true) const isUpdate = ref(true)
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
labelWidth: 100, labelWidth: 120,
baseColProps: { span: 24 }, baseColProps: { span: 24 },
schemas: dataScopeFormSchema, schemas: dataScopeFormSchema,
showActionButtonGroup: false, showActionButtonGroup: false,

View File

@ -2,20 +2,37 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['system:role:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
<a-button type="warning" :preIcon="IconEnum.EXPORT" @click="handleExport"> {{ t('action.export') }} </a-button> {{ t('action.create') }}
</a-button>
<a-button type="warning" v-auth="['system:role:create']" :preIcon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<TableAction <TableAction
:actions="[{ icon: IconEnum.EDIT, label: t('action.edit'), onClick: handleEdit.bind(null, record) }]" :actions="[
{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:role:update', onClick: handleEdit.bind(null, record) }
]"
:dropDownActions="[ :dropDownActions="[
{ icon: IconEnum.EDIT, label: '菜单权限', onClick: handleEdit.bind(null, record) }, {
{ icon: IconEnum.EDIT, label: '数据权限', onClick: handleEdit.bind(null, record) }, icon: IconEnum.EDIT,
label: '菜单权限',
auth: 'system:permission:assign-role-menu',
onClick: handleEdit.bind(null, record)
},
{
icon: IconEnum.EDIT,
label: '数据权限',
auth: 'system:permission:assign-role-data-scope',
onClick: handleEdit.bind(null, record)
},
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'system:role:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -47,10 +64,7 @@ const [registerTable, { getForm, reload }] = useTable({
title: '角色列表', title: '角色列表',
api: getRolePage, api: getRolePage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
@ -63,16 +77,11 @@ const [registerTable, { getForm, reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleExport() { async function handleExport() {

View File

@ -14,7 +14,7 @@ const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true) const isUpdate = ref(true)
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
labelWidth: 100, labelWidth: 120,
baseColProps: { span: 24 }, baseColProps: { span: 24 },
schemas: formSchema, schemas: formSchema,
showActionButtonGroup: false, showActionButtonGroup: false,

View File

@ -2,18 +2,28 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['system:sensitive-word:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
<a-button type="warning" :preIcon="IconEnum.EXPORT" @click="handleExport"> {{ t('action.export') }} </a-button> {{ t('action.create') }}
</a-button>
<a-button type="warning" v-auth="['system:sensitive-word:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template> </template>
<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'), onClick: handleEdit.bind(null, record) }, {
icon: IconEnum.EDIT,
label: t('action.edit'),
auth: 'system:sensitive-word:delete',
onClick: handleEdit.bind(null, record)
},
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'system:sensitive-word:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -45,10 +55,7 @@ const [registerTable, { getForm, reload }] = useTable({
title: '敏感词列表', title: '敏感词列表',
api: getSensitiveWordPage, api: getSensitiveWordPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
@ -61,16 +68,11 @@ const [registerTable, { getForm, reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleExport() { async function handleExport() {

View File

@ -14,7 +14,7 @@ const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true) const isUpdate = ref(true)
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
labelWidth: 100, labelWidth: 120,
baseColProps: { span: 24 }, baseColProps: { span: 24 },
schemas: formSchema, schemas: formSchema,
showActionButtonGroup: false, showActionButtonGroup: false,

View File

@ -2,17 +2,20 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['system:sms-channel:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
</template> </template>
<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'), onClick: handleEdit.bind(null, record) }, { icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:sms-channel:update', onClick: handleEdit.bind(null, record) },
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'system:sms-channel:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -45,10 +48,7 @@ const [registerTable, { reload }] = useTable({
title: '短信渠道列表', title: '短信渠道列表',
api: getSmsChannelPage, api: getSmsChannelPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
@ -61,16 +61,11 @@ const [registerTable, { reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleDelete(record: Recordable) { async function handleDelete(record: Recordable) {

View File

@ -2,13 +2,16 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="warning" @click="handleExport"> {{ t('action.export') }} </a-button> <a-button type="warning" v-auth="['system:sms-log:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template> </template>
</BasicTable> </BasicTable>
</div> </div>
</template> </template>
<script lang="ts" setup name="SmsLog"> <script lang="ts" setup name="SmsLog">
import { BasicTable, useTable } from '@/components/Table' import { BasicTable, useTable } from '@/components/Table'
import { IconEnum } from '@/enums/appEnum'
import { SmsLogExportReqVO, exportSmsLog, getSmsLogPage } from '@/api/system/sms/smsLog' import { SmsLogExportReqVO, exportSmsLog, getSmsLogPage } from '@/api/system/sms/smsLog'
import { columns, searchFormSchema } from './smsLog.data' import { columns, searchFormSchema } from './smsLog.data'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
@ -20,10 +23,7 @@ const [registerTable, { getForm }] = useTable({
title: '短信日志列表', title: '短信日志列表',
api: getSmsLogPage, api: getSmsLogPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false showIndexColumn: false

View File

@ -2,19 +2,29 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['system:sms-template:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
<a-button type="warning" :preIcon="IconEnum.EXPORT" @click="handleExport"> {{ t('action.export') }} </a-button> {{ t('action.create') }}
</a-button>
<a-button type="warning" v-auth="['system:sms-template:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template> </template>
<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.TEST, label: t('action.test'), onClick: handleSendSms.bind(null, record) }, {
{ icon: IconEnum.EDIT, label: t('action.edit'), onClick: handleEdit.bind(null, record) }, icon: IconEnum.TEST,
label: t('action.test'),
auth: 'system:sms-template:send-sms',
onClick: handleSendSms.bind(null, record)
},
{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:sms-template:update', onClick: handleEdit.bind(null, record) },
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'system:sms-template:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -46,10 +56,7 @@ const [registerTable, { getForm, reload }] = useTable({
title: '短信模版列表', title: '短信模版列表',
api: getSmsTemplatePage, api: getSmsTemplatePage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
@ -62,9 +69,7 @@ const [registerTable, { getForm, reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleSendSms(record: Recordable) { function handleSendSms(record: Recordable) {
@ -72,10 +77,7 @@ function handleSendSms(record: Recordable) {
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleExport() { async function handleExport() {

View File

@ -2,18 +2,23 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['system:tenant:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
<a-button type="warning" :preIcon="IconEnum.EXPORT" @click="handleExport"> {{ t('action.export') }} </a-button> {{ t('action.create') }}
</a-button>
<a-button type="warning" v-auth="['system:tenant:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template> </template>
<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'), onClick: handleEdit.bind(null, record) }, { icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:tenant:update', onClick: handleEdit.bind(null, record) },
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'system:tenant:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -45,10 +50,7 @@ const [registerTable, { getForm, reload }] = useTable({
title: '租户列表', title: '租户列表',
api: getTenantPage, api: getTenantPage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
@ -61,16 +63,11 @@ const [registerTable, { getForm, reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleExport() { async function handleExport() {

View File

@ -2,17 +2,25 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['system:tenant-package:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
</template> </template>
<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'), onClick: handleEdit.bind(null, record) }, {
icon: IconEnum.EDIT,
label: t('action.edit'),
auth: 'system:tenant-package:update',
onClick: handleEdit.bind(null, record)
},
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'system:tenant-package:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -44,10 +52,7 @@ const [registerTable, { reload }] = useTable({
title: '租户套餐列表', title: '租户套餐列表',
api: getTenantPackagePage, api: getTenantPackagePage,
columns, columns,
formConfig: { formConfig: { labelWidth: 120, schemas: searchFormSchema },
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
showIndexColumn: false, showIndexColumn: false,
@ -60,16 +65,11 @@ const [registerTable, { reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleDelete(record: Recordable) { async function handleDelete(record: Recordable) {

View File

@ -3,18 +3,23 @@
<DeptTree class="w-1/4 xl:w-1/5" @select="handleSelect" /> <DeptTree class="w-1/4 xl:w-1/5" @select="handleSelect" />
<BasicTable @register="registerTable" class="w-3/4 xl:w-4/5" :searchInfo="searchInfo"> <BasicTable @register="registerTable" class="w-3/4 xl:w-4/5" :searchInfo="searchInfo">
<template #toolbar> <template #toolbar>
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> <a-button type="primary" v-auth="['system:user:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
<a-button type="warning" :preIcon="IconEnum.EXPORT" @click="handleExport"> {{ t('action.export') }} </a-button> {{ t('action.create') }}
</a-button>
<a-button type="warning" v-auth="['system:user:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template> </template>
<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'), onClick: handleEdit.bind(null, record) }, { icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:user:update', onClick: handleEdit.bind(null, record) },
{ {
icon: IconEnum.DELETE, icon: IconEnum.DELETE,
color: 'error', color: 'error',
label: t('action.delete'), label: t('action.delete'),
auth: 'system:user:delete',
popConfirm: { popConfirm: {
title: t('common.delMessage'), title: t('common.delMessage'),
placement: 'left', placement: 'left',
@ -67,9 +72,7 @@ const [registerTable, { getForm, reload }] = useTable({
}) })
function handleCreate() { function handleCreate() {
openModal(true, { openModal(true, { isUpdate: false })
isUpdate: false
})
} }
async function handleExport() { async function handleExport() {
@ -85,10 +88,7 @@ async function handleExport() {
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true })
record,
isUpdate: true
})
} }
async function handleDelete(record: Recordable) { async function handleDelete(record: Recordable) {