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 })
}
// 查询敏感词详情
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 })
}

View File

@ -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

View File

@ -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
}
/** 初始化 **/