【移除】简化项目,移除数据库文档、错误码、敏感词的管理功能

pull/42/head
YunaiV 2024-05-04 11:26:00 +08:00
parent a25e44d196
commit 699d1de0d3
13 changed files with 7 additions and 726 deletions

View File

@ -13,12 +13,12 @@ VITE_BUILD_COMPRESS = 'gzip'
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
# 基础页面地址,例如 swagger 等页面
VITE_GLOB_BASE_URL = "http://api-dashboard.yudao.iocoder.cn"
VITE_GLOB_BASE_URL = "http://127.0.0.1:48080"
# 接口地址,如果没有跨域问题,直接在这里配置即可
VITE_GLOB_API_URL = http://api-dashboard.yudao.iocoder.cn/admin-api
VITE_GLOB_API_URL = http://127.0.0.1:48080/admin-api
# 文件上传地址 可以由nginx做转发或者直接写实际地址
VITE_GLOB_UPLOAD_URL = http://api-dashboard.yudao.iocoder.cn/admin-api/infra/file/upload
VITE_GLOB_UPLOAD_URL = /upload
# 接口地址前缀,有些系统所有接口地址都有前缀,可以在这里统一加,方便切换
VITE_GLOB_API_URL_PREFIX =
@ -28,3 +28,6 @@ VITE_USE_PWA = false
# 百度统计
VITE_APP_BAIDU_CODE = eb21166668bf766b9d059a6fd1c10777
# 验证码的开关
VITE_GLOB_APP_CAPTCHA_ENABLE = false

View File

@ -1,16 +0,0 @@
import { defHttp } from '@/utils/http/axios'
// 导出Html
export function exportHtml() {
return defHttp.get({ url: '/infra/db-doc/export-html', responseType: 'blob' })
}
// 导出Word
export function exportWord() {
return defHttp.get({ url: '/infra/db-doc/export-word', responseType: 'blob' })
}
// 导出Markdown
export function exportMarkdown() {
return defHttp.get({ url: '/infra/db-doc/export-markdown', responseType: 'blob' })
}

View File

@ -1,49 +0,0 @@
import { defHttp } from '@/utils/http/axios'
export interface ErrorCodeVO {
id: number
type: number
applicationName: string
code: number
message: string
memo: string
createTime: Date
}
export interface ErrorCodePageReqVO extends PageParam {
type?: number
applicationName?: string
code?: number
message?: string
createTime?: Date[]
}
// 查询错误码列表
export function getErrorCodePage(params: ErrorCodePageReqVO) {
return defHttp.get({ url: '/system/error-code/page', params })
}
// 查询错误码详情
export function getErrorCode(id: number) {
return defHttp.get({ url: `/system/error-code/get?id=${id}` })
}
// 新增错误码
export function createErrorCode(data: ErrorCodeVO) {
return defHttp.post({ url: '/system/error-code/create', data })
}
// 修改错误码
export function updateErrorCode(data: ErrorCodeVO) {
return defHttp.put({ url: '/system/error-code/update', data })
}
// 删除错误码
export function deleteErrorCode(id: number) {
return defHttp.delete({ url: `/system/error-code/delete?id=${id}` })
}
// 导出错误码
export function excelErrorCode(params: ErrorCodePageReqVO) {
return defHttp.download({ url: '/system/error-code/export-excel', params }, '错误码.xls')
}

View File

@ -1,64 +0,0 @@
import { defHttp } from '@/utils/http/axios'
export interface SensitiveWordVO {
id: number
name: string
status: number
description: string
tags: string[]
createTime: Date
}
export interface SensitiveWordPageReqVO extends PageParam {
name?: string
tag?: string
status?: number
createTime?: Date[]
}
export interface SensitiveWordExportReqVO {
name?: string
tag?: string
status?: number
createTime?: Date[]
}
// 查询敏感词列表
export function getSensitiveWordPage(params: SensitiveWordPageReqVO) {
return defHttp.get({ url: '/system/sensitive-word/page', params })
}
// 查询敏感词详情
export function getSensitiveWord(id: number) {
return defHttp.get({ url: `/system/sensitive-word/get?id=${id}` })
}
// 新增敏感词
export function createSensitiveWord(data: SensitiveWordVO) {
return defHttp.post({ url: '/system/sensitive-word/create', data })
}
// 修改敏感词
export function updateSensitiveWord(data: SensitiveWordVO) {
return defHttp.put({ url: '/system/sensitive-word/update', data })
}
// 删除敏感词
export function deleteSensitiveWord(id: number) {
return defHttp.delete({ url: `/system/sensitive-word/delete?id=${id}` })
}
// 导出敏感词
export function exportSensitiveWord(params: SensitiveWordExportReqVO) {
return defHttp.download({ url: '/system/sensitive-word/export-excel', params }, '导出敏感词.xls')
}
// 获取所有敏感词的标签数组
export function getSensitiveWordTags() {
return defHttp.get({ url: '/system/sensitive-word/get-tags' })
}
// 获得文本所包含的不合法的敏感词数组
export function validateText(id: number) {
return defHttp.get({ url: `/system/sensitive-word/validate-text?${id}` })
}

View File

@ -1,53 +0,0 @@
<script setup lang="ts" name="InfraDbDoc">
import { onMounted, ref } from 'vue'
import { PageWrapper } from '@/components/Page'
import { useI18n } from '@/hooks/web/useI18n'
import { IFrame } from '@/components/IFrame'
import * as DbDocApi from '@/api/infra/dbDoc'
import { downloadByData } from '@/utils/file/download'
const { t } = useI18n()
const src = ref('')
/** 页面加载 */
async function init() {
const res = await DbDocApi.exportHtml()
const blob = new Blob([res], { type: 'text/html' })
const blobUrl = window.URL.createObjectURL(blob)
src.value = blobUrl
}
/** 处理导出 */
async function handleExport(type: string) {
if (type === 'HTML') {
const res = await DbDocApi.exportHtml()
downloadByData(res, '数据库文档.html')
}
if (type === 'Word') {
const res = await DbDocApi.exportWord()
downloadByData(res, '数据库文档.doc')
}
if (type === 'Markdown') {
const res = await DbDocApi.exportMarkdown()
downloadByData(res, '数据库文档.md')
}
}
onMounted(async () => {
await init()
})
</script>
<template>
<PageWrapper>
<div class="mb-3">
<a-button type="primary" size="small" class="mr-1" @click="handleExport('HTML')">
{{ `${t('action.export')}Html` }}
</a-button>
<a-button type="primary" size="small" class="mr-1" @click="handleExport('Word')">
{{ `${t('action.export')}Word` }}
</a-button>
<a-button type="primary" size="small" @click="handleExport('Markdown')">
{{ `${t('action.export')}Markdown` }}
</a-button>
</div>
<IFrame :src="src" />
</PageWrapper>
</template>

View File

@ -1,3 +0,0 @@
<template>
<div>开发中 testDemo</div>
</template>

View File

@ -1,5 +1,5 @@
<script lang="ts" setup>
import 'video.js/dist/video-js.css'
// import 'video.js/dist/video-js.css'
import { VideoPlayer } from '@videojs-player/vue'
import { ref } from 'vue'
import { Modal } from 'ant-design-vue'

View File

@ -1,58 +0,0 @@
<script lang="ts" setup>
import { ref, unref } from 'vue'
import { formSchema } from './errorCode.data'
import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage'
import { BasicForm, useForm } from '@/components/Form'
import { BasicModal, useModalInner } from '@/components/Modal'
import { createErrorCode, getErrorCode, updateErrorCode } from '@/api/system/errorCode'
defineOptions({ name: 'SystemErrorCodeModal' })
const emit = defineEmits(['success', 'register'])
const { t } = useI18n()
const { createMessage } = useMessage()
const isUpdate = ref(true)
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
labelWidth: 120,
baseColProps: { span: 24 },
schemas: formSchema,
showActionButtonGroup: false,
actionColOptions: { span: 23 },
})
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
resetFields()
setModalProps({ confirmLoading: false })
isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) {
const res = await getErrorCode(data.record.id)
setFieldsValue({ ...res })
}
})
async function handleSubmit() {
try {
const values = await validate()
setModalProps({ confirmLoading: true })
if (unref(isUpdate))
await updateErrorCode(values)
else
await createErrorCode(values)
closeModal()
emit('success')
createMessage.success(t('common.saveSuccessText'))
}
finally {
setModalProps({ confirmLoading: false })
}
}
</script>
<template>
<BasicModal v-bind="$attrs" :title="isUpdate ? t('action.edit') : t('action.create')" @register="registerModal" @ok="handleSubmit">
<BasicForm @register="registerForm" />
</BasicModal>
</template>

View File

@ -1,115 +0,0 @@
import type { BasicColumn, FormSchema } from '@/components/Table'
import { useRender } from '@/components/Table'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
export const columns: BasicColumn[] = [
{
title: '编号',
dataIndex: 'id',
width: 100,
},
{
title: '类型',
dataIndex: 'type',
width: 80,
customRender: ({ text }) => {
return useRender.renderDict(text, DICT_TYPE.SYSTEM_ERROR_CODE_TYPE)
},
},
{
title: '应用名',
dataIndex: 'applicationName',
width: 200,
},
{
title: '错误码编码',
dataIndex: 'code',
width: 120,
},
{
title: '错误码提示',
dataIndex: 'message',
width: 300,
},
{
title: '备注',
dataIndex: 'memo',
width: 200,
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 180,
customRender: ({ text }) => {
return useRender.renderDate(text)
},
},
]
export const searchFormSchema: FormSchema[] = [
{
label: '错误码类型',
field: 'type',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.SYSTEM_ERROR_CODE_TYPE),
},
colProps: { span: 8 },
},
{
label: '应用名',
field: 'applicationName',
component: 'Input',
colProps: { span: 8 },
},
{
label: '错误码编码',
field: 'code',
component: 'Input',
colProps: { span: 8 },
},
{
label: '错误码提示',
field: 'message',
component: 'Input',
colProps: { span: 8 },
},
{
label: '创建时间',
field: 'createTime',
component: 'RangePicker',
colProps: { span: 8 },
},
]
export const formSchema: FormSchema[] = [
{
label: '编号',
field: 'id',
show: false,
component: 'Input',
},
{
label: '应用名',
field: 'applicationName',
required: true,
component: 'Input',
},
{
label: '错误码编码',
field: 'code',
required: true,
component: 'Input',
},
{
label: '错误码提示',
field: 'message',
required: true,
component: 'Input',
},
{
label: '备注',
field: 'memo',
component: 'InputTextArea',
},
]

View File

@ -1,94 +0,0 @@
<script lang="ts" setup>
import ErrorCodeModal from './ErrorCodeModal.vue'
import { columns, searchFormSchema } from './errorCode.data'
import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage'
import { useModal } from '@/components/Modal'
import { IconEnum } from '@/enums/appEnum'
import { BasicTable, TableAction, useTable } from '@/components/Table'
import type { ErrorCodePageReqVO } from '@/api/system/errorCode'
import { deleteErrorCode, excelErrorCode, getErrorCodePage } from '@/api/system/errorCode'
defineOptions({ name: 'SystemErrorCode' })
const { t } = useI18n()
const { createConfirm, createMessage } = useMessage()
const [registerModal, { openModal }] = useModal()
const [registerTable, { getForm, reload }] = useTable({
title: '错误码列表',
api: getErrorCodePage,
columns,
formConfig: { labelWidth: 120, schemas: searchFormSchema },
useSearchForm: true,
showTableSetting: true,
showIndexColumn: false,
actionColumn: {
width: 140,
title: t('common.action'),
dataIndex: 'action',
fixed: 'right',
},
})
function handleCreate() {
openModal(true, { isUpdate: false })
}
function handleEdit(record: Recordable) {
openModal(true, { record, isUpdate: true })
}
async function handleExport() {
createConfirm({
title: t('common.exportTitle'),
iconType: 'warning',
content: t('common.exportMessage'),
async onOk() {
await excelErrorCode(getForm().getFieldsValue() as ErrorCodePageReqVO)
createMessage.success(t('common.exportSuccessText'))
},
})
}
async function handleDelete(record: Recordable) {
await deleteErrorCode(record.id)
createMessage.success(t('common.delSuccessText'))
reload()
}
</script>
<template>
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button v-auth="['system:error-code:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
<a-button v-auth="['system:error-code:export']" :pre-icon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:error-code:update', onClick: handleEdit.bind(null, record) },
{
icon: IconEnum.DELETE,
danger: true,
label: t('action.delete'),
auth: 'system:error-code:delete',
popConfirm: {
title: t('common.delMessage'),
placement: 'left',
confirm: handleDelete.bind(null, record),
},
},
]"
/>
</template>
</template>
</BasicTable>
<ErrorCodeModal @register="registerModal" @success="reload()" />
</div>
</template>

View File

@ -1,58 +0,0 @@
<script lang="ts" setup>
import { ref, unref } from 'vue'
import { formSchema } from './sensitiveWord.data'
import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage'
import { BasicForm, useForm } from '@/components/Form'
import { BasicModal, useModalInner } from '@/components/Modal'
import { createSensitiveWord, getSensitiveWord, updateSensitiveWord } from '@/api/system/sensitiveWord'
defineOptions({ name: 'SystemSensitiveWordModal' })
const emit = defineEmits(['success', 'register'])
const { t } = useI18n()
const { createMessage } = useMessage()
const isUpdate = ref(true)
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
labelWidth: 120,
baseColProps: { span: 24 },
schemas: formSchema,
showActionButtonGroup: false,
actionColOptions: { span: 23 },
})
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
resetFields()
setModalProps({ confirmLoading: false })
isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) {
const res = await getSensitiveWord(data.record.id)
setFieldsValue({ ...res })
}
})
async function handleSubmit() {
try {
const values = await validate()
setModalProps({ confirmLoading: true })
if (unref(isUpdate))
await updateSensitiveWord(values)
else
await createSensitiveWord(values)
closeModal()
emit('success')
createMessage.success(t('common.saveSuccessText'))
}
finally {
setModalProps({ confirmLoading: false })
}
}
</script>
<template>
<BasicModal v-bind="$attrs" :title="isUpdate ? t('action.edit') : t('action.create')" @register="registerModal" @ok="handleSubmit">
<BasicForm @register="registerForm" />
</BasicModal>
</template>

View File

@ -1,99 +0,0 @@
<script lang="ts" setup>
import SensitiveWordModal from './SensitiveWordModal.vue'
import { columns, searchFormSchema } from './sensitiveWord.data'
import { BasicTable, TableAction, useTable } from '@/components/Table'
import type { SensitiveWordExportReqVO } from '@/api/system/sensitiveWord'
import { deleteSensitiveWord, exportSensitiveWord, getSensitiveWordPage } from '@/api/system/sensitiveWord'
import { useModal } from '@/components/Modal'
import { IconEnum } from '@/enums/appEnum'
import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage'
defineOptions({ name: 'SystemSensitiveWord' })
const { t } = useI18n()
const { createConfirm, createMessage } = useMessage()
const [registerModal, { openModal }] = useModal()
const [registerTable, { getForm, reload }] = useTable({
title: '敏感词列表',
api: getSensitiveWordPage,
columns,
formConfig: { labelWidth: 120, schemas: searchFormSchema },
useSearchForm: true,
showTableSetting: true,
showIndexColumn: false,
actionColumn: {
width: 140,
title: t('common.action'),
dataIndex: 'action',
fixed: 'right',
},
})
function handleCreate() {
openModal(true, { isUpdate: false })
}
function handleEdit(record: Recordable) {
openModal(true, { record, isUpdate: true })
}
async function handleExport() {
createConfirm({
title: t('common.exportTitle'),
iconType: 'warning',
content: t('common.exportMessage'),
async onOk() {
await exportSensitiveWord(getForm().getFieldsValue() as SensitiveWordExportReqVO)
createMessage.success(t('common.exportSuccessText'))
},
})
}
async function handleDelete(record: Recordable) {
await deleteSensitiveWord(record.id)
createMessage.success(t('common.delSuccessText'))
reload()
}
</script>
<template>
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button v-auth="['system:sensitive-word:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
<a-button v-auth="['system:sensitive-word:export']" :pre-icon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
icon: IconEnum.EDIT,
label: t('action.edit'),
auth: 'system:sensitive-word:delete',
onClick: handleEdit.bind(null, record),
},
{
icon: IconEnum.DELETE,
danger: true,
label: t('action.delete'),
auth: 'system:sensitive-word:delete',
popConfirm: {
title: t('common.delMessage'),
placement: 'left',
confirm: handleDelete.bind(null, record),
},
},
]"
/>
</template>
</template>
</BasicTable>
<SensitiveWordModal @register="registerModal" @success="reload()" />
</div>
</template>

View File

@ -1,113 +0,0 @@
import type { BasicColumn, FormSchema } from '@/components/Table'
import { useRender } from '@/components/Table'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
export const columns: BasicColumn[] = [
{
title: '编号',
dataIndex: 'id',
width: 100,
},
{
title: '敏感词',
dataIndex: 'name',
width: 180,
},
{
title: '状态',
dataIndex: 'status',
width: 180,
customRender: ({ text }) => {
return useRender.renderDict(text, DICT_TYPE.COMMON_STATUS)
},
},
{
title: '描述',
dataIndex: 'description',
width: 200,
},
{
title: '标签',
dataIndex: 'tags',
width: 180,
customRender: ({ text }) => {
return useRender.renderTags(text)
},
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 180,
customRender: ({ text }) => {
return useRender.renderDate(text)
},
},
]
export const searchFormSchema: FormSchema[] = [
{
label: '敏感词',
field: 'name',
component: 'Input',
colProps: { span: 8 },
},
{
label: '标签',
field: 'tag',
component: 'Input',
colProps: { span: 8 },
},
{
label: '状态',
field: 'status',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.COMMON_STATUS),
},
colProps: { span: 8 },
},
{
label: '创建时间',
field: 'createTime',
component: 'RangePicker',
colProps: { span: 8 },
},
]
export const formSchema: FormSchema[] = [
{
label: '编号',
field: 'id',
show: false,
component: 'Input',
},
{
label: '敏感词',
field: 'name',
required: true,
component: 'Input',
},
{
label: '状态',
field: 'status',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.COMMON_STATUS),
},
},
{
label: '备注',
field: 'remark',
component: 'InputTextArea',
},
{
label: '标签',
field: 'tags',
required: true,
component: 'Select',
componentProps: {
mode: 'tags',
options: [],
},
},
]