Files
ss-crm-manage-web/src/views/Clue/Skill/index.vue

134 lines
3.2 KiB
Vue
Raw Normal View History

2024-04-28 16:20:45 +08:00
<template>
2024-05-14 11:45:46 +08:00
<div>
<el-form :model="searchForm" inline label-width="0">
<el-form-item>
<el-input
v-model="searchForm.question"
placeholder="请输入问题"
clearable
style="width: 200px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
2024-06-07 17:01:46 +08:00
<el-button type="primary" @click="handleQuery" v-hasPermi="['clue:skill:search']">
搜索
</el-button>
<el-button @click="resetQuery" v-hasPermi="['clue:skill:reset']">重置</el-button>
<el-button type="primary" plain @click="handleAdd" v-hasPermi="['clue:skill:add']">
新增
</el-button>
2024-05-14 11:45:46 +08:00
</el-form-item>
</el-form>
2024-06-16 16:03:15 +08:00
<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">
2024-05-14 11:45:46 +08:00
<template #default="scope">
<p v-dompurify-html="scope.row.content"></p>
</template>
</el-table-column>
2024-06-16 16:03:15 +08:00
<el-table-column label="关键词" prop="skillKey" />
<el-table-column label="操作">
2024-05-14 11:45:46 +08:00
<template #default="scope">
2024-06-07 17:01:46 +08:00
<el-button
type="primary"
text
@click="handleUpdate(scope.row)"
v-hasPermi="['clue:skill:update']"
>
修改
</el-button>
<el-button
type="primary"
text
@click="handleDelete(scope.row)"
v-hasPermi="['clue:skill:delete']"
>
删除
</el-button>
2024-05-14 11:45:46 +08:00
</template>
</el-table-column>
</el-table>
<Pagination
v-model:limit="searchForm.pageSize"
2024-06-16 16:03:15 +08:00
v-model:page="searchForm.pageNo"
2024-05-14 11:45:46 +08:00
:total="total"
@pagination="handleQuery"
/>
<DialogSkill ref="skillDialog" @success="handleQuery" />
</div>
2024-04-28 16:20:45 +08:00
</template>
2024-05-14 11:45:46 +08:00
<script setup name="ClueSkill">
2024-06-16 16:03:15 +08:00
import * as SkillApi from '@/api/clue/skill'
2024-05-14 11:45:46 +08:00
import DialogSkill from './Comp/DialogSkill.vue'
const skillDialog = ref()
const message = useMessage() // 消息弹窗
2024-06-16 16:03:15 +08:00
const { t } = useI18n() // 国际化
2024-05-14 11:45:46 +08:00
2024-06-16 16:03:15 +08:00
const loading = ref(false)
2024-05-14 11:45:46 +08:00
const searchForm = ref({
question: '',
pageSize: 20,
2024-06-16 16:03:15 +08:00
pageNo: 1
2024-05-14 11:45:46 +08:00
})
const total = ref(0)
const tableList = ref([])
function resetQuery() {
searchForm.value = {
question: '',
pageSize: 20,
2024-06-16 16:03:15 +08:00
pageNo: 1
2024-05-14 11:45:46 +08:00
}
getList()
}
function handleQuery() {
2024-06-16 16:03:15 +08:00
searchForm.value.pageNo = 1
2024-05-14 11:45:46 +08:00
getList()
}
2024-06-16 16:03:15 +08:00
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
}
2024-05-14 11:45:46 +08:00
}
function handleAdd() {
skillDialog.value.open('create', null)
}
function handleUpdate(row) {
2024-06-16 16:03:15 +08:00
skillDialog.value.open('update', row.id)
2024-05-14 11:45:46 +08:00
}
async function handleDelete(row) {
try {
// 删除的二次确认
await message.delConfirm()
// 发起删除
2024-06-16 16:03:15 +08:00
await SkillApi.deleteSkill(row.skillId)
2024-05-14 11:45:46 +08:00
message.success(t('common.delSuccess'))
// 刷新列表
await getList()
} catch {}
}
2024-06-16 16:03:15 +08:00
onMounted(() => {
handleQuery()
})
2024-05-14 11:45:46 +08:00
</script>
2024-04-28 16:20:45 +08:00
<style lang="scss" scoped></style>