update: 修改了一些TODO提到的问题
parent
5057e755e2
commit
d44ceda588
|
@ -24,41 +24,41 @@ export interface SensitiveWordExportReqVO {
|
|||
}
|
||||
|
||||
// 查询敏感词列表
|
||||
export const getSensitiveWordPageApi = (params: SensitiveWordPageReqVO) => {
|
||||
export const getSensitiveWordPage = (params: SensitiveWordPageReqVO) => {
|
||||
return request.get({ url: '/system/sensitive-word/page', params })
|
||||
}
|
||||
|
||||
// 查询敏感词详情
|
||||
export const getSensitiveWordApi = (id: number) => {
|
||||
export const getSensitiveWord = (id: number) => {
|
||||
return request.get({ url: '/system/sensitive-word/get?id=' + id })
|
||||
}
|
||||
|
||||
// 新增敏感词
|
||||
export const createSensitiveWordApi = (data: SensitiveWordVO) => {
|
||||
export const createSensitiveWord = (data: SensitiveWordVO) => {
|
||||
return request.post({ url: '/system/sensitive-word/create', data })
|
||||
}
|
||||
|
||||
// 修改敏感词
|
||||
export const updateSensitiveWordApi = (data: SensitiveWordVO) => {
|
||||
export const updateSensitiveWord = (data: SensitiveWordVO) => {
|
||||
return request.put({ url: '/system/sensitive-word/update', data })
|
||||
}
|
||||
|
||||
// 删除敏感词
|
||||
export const deleteSensitiveWordApi = (id: number) => {
|
||||
export const deleteSensitiveWord = (id: number) => {
|
||||
return request.delete({ url: '/system/sensitive-word/delete?id=' + id })
|
||||
}
|
||||
|
||||
// 导出敏感词
|
||||
export const exportSensitiveWordApi = (params: SensitiveWordExportReqVO) => {
|
||||
export const exportSensitiveWord = (params: SensitiveWordExportReqVO) => {
|
||||
return request.download({ url: '/system/sensitive-word/export-excel', params })
|
||||
}
|
||||
|
||||
// 获取所有敏感词的标签数组
|
||||
export const getSensitiveWordTagsApi = () => {
|
||||
export const getSensitiveWordTags = () => {
|
||||
return request.get({ url: '/system/sensitive-word/get-tags' })
|
||||
}
|
||||
|
||||
// 获得文本所包含的不合法的敏感词数组
|
||||
export const validateTextApi = (id: number) => {
|
||||
export const validateText = (id: number) => {
|
||||
return request.get({ url: '/system/sensitive-word/validate-text?' + id })
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts" name="SensitiveWordForm">
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import * as SensitiveWordApi from '@/api/system/sensitiveWord'
|
||||
import { CommonStatusEnum } from '@/utils/constants'
|
||||
|
@ -81,7 +81,7 @@ const openModal = async (type: string, id?: number) => {
|
|||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await SensitiveWordApi.getSensitiveWordApi(id)
|
||||
formData.value = await SensitiveWordApi.getSensitiveWord(id)
|
||||
console.log(formData.value)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
|
@ -102,10 +102,10 @@ const submitForm = async () => {
|
|||
try {
|
||||
const data = formData.value as unknown as SensitiveWordApi.SensitiveWordVO
|
||||
if (formType.value === 'create') {
|
||||
await SensitiveWordApi.createSensitiveWordApi(data) // TODO @blue-syd:去掉 API 后缀
|
||||
await SensitiveWordApi.createSensitiveWord(data) // TODO @blue-syd:去掉 API 后缀
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await SensitiveWordApi.updateSensitiveWordApi(data) // TODO @blue-syd:去掉 API 后缀
|
||||
await SensitiveWordApi.updateSensitiveWord(data) // TODO @blue-syd:去掉 API 后缀
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
modelVisible.value = false
|
||||
|
|
|
@ -126,14 +126,14 @@
|
|||
</content-wrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<config-form ref="modalRef" @success="getList" />
|
||||
<SensitiveWordForm ref="modalRef" @success="getList" />
|
||||
</template>
|
||||
<script setup lang="ts" name="SensitiveWord">
|
||||
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import * as SensitiveWordApi from '@/api/system/sensitiveWord'
|
||||
import ConfigForm from './form.vue' // TODO @blue-syd:组件名不对
|
||||
import SensitiveWordForm from './form.vue' // TODO @blue-syd:组件名不对
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
|
@ -156,7 +156,7 @@ const tags = ref([])
|
|||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await SensitiveWordApi.getSensitiveWordPageApi(queryParams) // TODO @blue-syd:去掉 API 后缀哈
|
||||
const data = await SensitiveWordApi.getSensitiveWordPage(queryParams) // TODO @blue-syd:去掉 API 后缀哈
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
|
@ -190,7 +190,7 @@ const handleDelete = async (id: number) => {
|
|||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await SensitiveWordApi.deleteSensitiveWordApi(id)
|
||||
await SensitiveWordApi.deleteSensitiveWord(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
|
@ -204,7 +204,7 @@ const handleExport = async () => {
|
|||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await SensitiveWordApi.exportSensitiveWordApi(queryParams) // TODO @blue-syd:去掉 API 后缀哈
|
||||
const data = await SensitiveWordApi.exportSensitiveWord(queryParams) // TODO @blue-syd:去掉 API 后缀哈
|
||||
download.excel(data, '敏感词.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
|
@ -214,7 +214,7 @@ const handleExport = async () => {
|
|||
|
||||
/** 获得 Tag 标签列表 */
|
||||
const getTags = async () => {
|
||||
tags.value = await SensitiveWordApi.getSensitiveWordTagsApi() // TODO @blue-syd:去掉 API 后缀哈
|
||||
tags.value = await SensitiveWordApi.getSensitiveWordTags() // TODO @blue-syd:去掉 API 后缀哈
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
|
|
Loading…
Reference in New Issue