This commit is contained in:
qsh
2024-06-16 16:03:15 +08:00
parent 4c692c48e3
commit c1cd205267
11 changed files with 900 additions and 47 deletions

View File

@@ -20,16 +20,16 @@
</el-button>
</el-form-item>
</el-form>
<el-table :data="tableList">
<el-table-column type="index" width="55" align="center" />
<el-table-column label="问题" align="center" prop="question" />
<el-table-column label="答案" align="center" prop="content">
<el-table v-loading="loading" :data="tableList">
<el-table-column type="index" width="55" />
<el-table-column label="问题" prop="question" />
<el-table-column label="答案" prop="content">
<template #default="scope">
<p v-dompurify-html="scope.row.content"></p>
</template>
</el-table-column>
<el-table-column label="关键词" align="center" prop="skillKey" />
<el-table-column label="操作" align="center">
<el-table-column label="关键词" prop="skillKey" />
<el-table-column label="操作">
<template #default="scope">
<el-button
type="primary"
@@ -52,7 +52,7 @@
</el-table>
<Pagination
v-model:limit="searchForm.pageSize"
v-model:page="searchForm.pageNum"
v-model:page="searchForm.pageNo"
:total="total"
@pagination="handleQuery"
/>
@@ -61,16 +61,19 @@
</template>
<script setup name="ClueSkill">
import * as SkillApi from '@/api/clue/skill'
import DialogSkill from './Comp/DialogSkill.vue'
const skillDialog = ref()
const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化
const loading = ref(false)
const searchForm = ref({
question: '',
pageSize: 20,
pageNum: 1
pageNo: 1
})
const total = ref(0)
@@ -81,18 +84,25 @@ function resetQuery() {
searchForm.value = {
question: '',
pageSize: 20,
pageNum: 1
pageNo: 1
}
getList()
}
function handleQuery() {
searchForm.value.pageNum = 1
searchForm.value.pageNo = 1
getList()
}
function getList() {
tableList.value = [{ question: '测试' }]
async function getList() {
loading.value = true
try {
const data = await SkillApi.getSkillPage(searchForm.value)
tableList.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
function handleAdd() {
@@ -100,21 +110,24 @@ function handleAdd() {
}
function handleUpdate(row) {
skillDialog.value.open('update', row)
skillDialog.value.open('update', row.id)
}
async function handleDelete(row) {
try {
console.log(row)
// 删除的二次确认
await message.delConfirm()
// 发起删除
// await UserApi.deleteUser(row.id)
await SkillApi.deleteSkill(row.skillId)
message.success(t('common.delSuccess'))
// 刷新列表
await getList()
} catch {}
}
onMounted(() => {
handleQuery()
})
</script>
<style lang="scss" scoped></style>