update: 修改了一些TODO提到的问题

This commit is contained in:
puhui999 2023-03-23 00:08:14 +08:00
parent 5057e755e2
commit d44ceda588
3 changed files with 18 additions and 18 deletions

View File

@ -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 }) 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 }) 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 }) 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 }) 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 }) 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 }) 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' }) 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 }) return request.get({ url: '/system/sensitive-word/validate-text?' + id })
} }

View File

@ -45,7 +45,7 @@
</template> </template>
</Dialog> </Dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts" name="SensitiveWordForm">
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import * as SensitiveWordApi from '@/api/system/sensitiveWord' import * as SensitiveWordApi from '@/api/system/sensitiveWord'
import { CommonStatusEnum } from '@/utils/constants' import { CommonStatusEnum } from '@/utils/constants'
@ -81,7 +81,7 @@ const openModal = async (type: string, id?: number) => {
if (id) { if (id) {
formLoading.value = true formLoading.value = true
try { try {
formData.value = await SensitiveWordApi.getSensitiveWordApi(id) formData.value = await SensitiveWordApi.getSensitiveWord(id)
console.log(formData.value) console.log(formData.value)
} finally { } finally {
formLoading.value = false formLoading.value = false
@ -102,10 +102,10 @@ const submitForm = async () => {
try { try {
const data = formData.value as unknown as SensitiveWordApi.SensitiveWordVO const data = formData.value as unknown as SensitiveWordApi.SensitiveWordVO
if (formType.value === 'create') { 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')) message.success(t('common.createSuccess'))
} else { } else {
await SensitiveWordApi.updateSensitiveWordApi(data) // TODO @blue-syd API await SensitiveWordApi.updateSensitiveWord(data) // TODO @blue-syd API
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
modelVisible.value = false modelVisible.value = false

View File

@ -126,14 +126,14 @@
</content-wrap> </content-wrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<config-form ref="modalRef" @success="getList" /> <SensitiveWordForm ref="modalRef" @success="getList" />
</template> </template>
<script setup lang="ts" name="SensitiveWord"> <script setup lang="ts" name="SensitiveWord">
import { DICT_TYPE, getDictOptions } from '@/utils/dict' import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import * as SensitiveWordApi from '@/api/system/sensitiveWord' 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 message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
@ -156,7 +156,7 @@ const tags = ref([])
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
try { 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 list.value = data.list
total.value = data.total total.value = data.total
} finally { } finally {
@ -190,7 +190,7 @@ const handleDelete = async (id: number) => {
// //
await message.delConfirm() await message.delConfirm()
// //
await SensitiveWordApi.deleteSensitiveWordApi(id) await SensitiveWordApi.deleteSensitiveWord(id)
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
@ -204,7 +204,7 @@ const handleExport = async () => {
await message.exportConfirm() await message.exportConfirm()
// //
exportLoading.value = true 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') download.excel(data, '敏感词.xls')
} catch { } catch {
} finally { } finally {
@ -214,7 +214,7 @@ const handleExport = async () => {
/** 获得 Tag 标签列表 */ /** 获得 Tag 标签列表 */
const getTags = async () => { const getTags = async () => {
tags.value = await SensitiveWordApi.getSensitiveWordTagsApi() // TODO @blue-syd API tags.value = await SensitiveWordApi.getSensitiveWordTags() // TODO @blue-syd API
} }
/** 初始化 **/ /** 初始化 **/