|
@@ -46,7 +46,7 @@
|
|
|
<div v-for="(v, i) in state.knowledgeList" :key="i" class="retrieval-content-item" @click="onPreview(v)">
|
|
|
<div class="mb10" style="display: flex">
|
|
|
<p class="text-no-wrap" style="flex: 1">{{ v.title }}</p>
|
|
|
- <el-button type="primary" size="small" @click.stop="changeYYType(v)" v-if="['ZiGong','YiBin'].includes(themeConfig.appScope)">{{
|
|
|
+ <el-button type="primary" size="small" @click.stop="changeYYType(v)" v-if="['ZiGong', 'YiBin'].includes(themeConfig.appScope)">{{
|
|
|
v.isChoose ? '取消引用' : '引用'
|
|
|
}}</el-button>
|
|
|
</div>
|
|
@@ -75,30 +75,65 @@
|
|
|
class="pt10"
|
|
|
v-if="['', '中心知识库', '部门知识库'].includes(state.queryParams.Attribution)"
|
|
|
/>
|
|
|
- <div v-if="['guide'].includes(state.queryParams.Attribution)">
|
|
|
- <el-input v-model="guideKeyword" placeholder="请输入搜索内容" clearable class="mr10 w100" @keyup.enter="sendGuide">
|
|
|
- <template #prepend>
|
|
|
- <el-select v-model="selectType" style="width: 80px">
|
|
|
- <el-option label="个人" value="1" />
|
|
|
- <el-option label="企业" value="2" />
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
+ <!-- 办事指南 -->
|
|
|
+ <div v-if="['guide'].includes(state.queryParams.Attribution)" class="guide">
|
|
|
+ <div class="flex flex-center-between mt10">
|
|
|
+ <el-radio-group v-model="selectType" @change="getGuideType">
|
|
|
+ <el-radio-button label="个人" value="1" />
|
|
|
+ <el-radio-button label="企业" value="2" />
|
|
|
+ </el-radio-group>
|
|
|
+ <el-select v-model="guideType" placeholder="请选择办事分类" style="width: 240px" @change="handleQueryGuide">
|
|
|
+ <el-option v-for="item in guideTypeList" :key="item.code" :label="item.describe" :value="item.code" />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <el-input v-model="guideKeyword" placeholder="请输入文档名称" clearable class="mr10 mt10 w100" @keyup.enter="sendGuide">
|
|
|
<template #append>
|
|
|
<el-button type="primary" @click="sendGuide" size="small" round>搜索</el-button>
|
|
|
</template>
|
|
|
</el-input>
|
|
|
- <el-empty description="暂无数据" v-if="!guideList.length" class="mb20"> </el-empty>
|
|
|
- <el-scrollbar max-height="400px"> </el-scrollbar>
|
|
|
+ <div v-loading="state.loading" class="guide-content">
|
|
|
+ <el-empty description="暂无数据" v-if="!guideList.length" class="mb20"> </el-empty>
|
|
|
+ <el-scrollbar max-height="350px">
|
|
|
+ <div v-for="(item, index) in guideList" :key="index" class="guide-content-item">
|
|
|
+ <el-button link type="primary" @click="guideDetail(item)">{{ item.name }}</el-button>
|
|
|
+ </div>
|
|
|
+ </el-scrollbar>
|
|
|
+ <pagination
|
|
|
+ @pagination="getGuideDataList"
|
|
|
+ :total="guideListTotal"
|
|
|
+ v-model:current-page="guidePageIndex"
|
|
|
+ v-model:page-size="guidePageSize"
|
|
|
+ class="pt10"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div v-if="['recommend'].includes(state.queryParams.Attribution)">
|
|
|
+ <!-- 推荐知识 -->
|
|
|
+ <div v-if="['recommend'].includes(state.queryParams.Attribution)" class="recommend">
|
|
|
<el-input v-model="recommendKeyword" placeholder="请输入问题内容" clearable class="mr10 w100" @keyup.enter="sendRecommend">
|
|
|
<template #append>
|
|
|
<el-button type="primary" @click="sendRecommend" size="small" round>搜索</el-button>
|
|
|
</template>
|
|
|
</el-input>
|
|
|
- <el-empty description="暂无数据" v-if="!recommendList.length" class="mb20"> </el-empty>
|
|
|
- <el-scrollbar max-height="400px"> </el-scrollbar>
|
|
|
+ <div v-loading="state.loading" class="recommend-content">
|
|
|
+ <el-empty description="暂无数据" v-if="!recommendList.length" class="mb20"> </el-empty>
|
|
|
+ <el-scrollbar max-height="400px">
|
|
|
+ <div v-for="(item, index) in recommendList" :key="index" class="recommend-content-item">
|
|
|
+ <div class="recommend-content-item-question">问:{{ item.question }}</div>
|
|
|
+ <div class="recommend-content-item-answer" v-html="item.answer" style="text-indent: 1em"></div>
|
|
|
+ </div>
|
|
|
+ </el-scrollbar>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ <el-dialog :title="dialogTitle" v-model="dialogVisible" draggable destroy-on-close append-to-body>
|
|
|
+ <div v-loading="loading" class="formatted-text">
|
|
|
+ {{documentContent}}
|
|
|
+ </div>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="dialogVisible = false" class="default-button">关闭</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</template>
|
|
|
<script setup lang="ts" name="orderAcceptKnowledge">
|
|
|
// 定义变量内容
|
|
@@ -110,8 +145,9 @@ import { throttle } from '@/utils/tools';
|
|
|
import { useThemeConfig } from '@/stores/themeConfig';
|
|
|
import { storeToRefs } from 'pinia';
|
|
|
import { removeDuplicate } from '@/utils/arrayOperation';
|
|
|
-import { lzRXFZAuth } from '@/api/business/lzRXFZ';
|
|
|
+import { lzRXFZAuth, lzRXFZDocumentDetail, lzRXFZDocumentList, lzRXFZDocumentType, lzRXFZKnowledge } from '@/api/business/lzRXFZ';
|
|
|
import { useUserInfo } from '@/stores/userInfo';
|
|
|
+import { Cookie } from '@/utils/storage';
|
|
|
|
|
|
const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
|
|
|
|
|
@@ -148,7 +184,11 @@ const state = reactive<any>({
|
|
|
});
|
|
|
// 手动查询,将页码设置为1
|
|
|
const handleQuery = () => {
|
|
|
- if (['guide', 'recommend'].includes(state.queryParams.Attribution)) return;
|
|
|
+ if (['recommend'].includes(state.queryParams.Attribution)) return;
|
|
|
+ if (state.queryParams.Attribution === 'guide') {
|
|
|
+ getGuideType();
|
|
|
+ return;
|
|
|
+ }
|
|
|
state.queryParams.PageIndex = 1;
|
|
|
knowledgeRetrievalPaged();
|
|
|
};
|
|
@@ -267,12 +307,70 @@ watch(
|
|
|
// 指南关键词
|
|
|
const guideKeyword = ref('');
|
|
|
const selectType = ref('1'); // 选择类型 1 个人 2 企业
|
|
|
-// 发送问题
|
|
|
+const guideType = ref(null); // 指南类型
|
|
|
+const guideTypeList = ref<EmptyArrayType>([]); // 指南类型列表
|
|
|
+// 获取指南类型列表
|
|
|
+const getGuideType = () => {
|
|
|
+ lzRXFZDocumentType({ type: selectType.value })
|
|
|
+ .then((res: any) => {
|
|
|
+ guideTypeList.value = res.data;
|
|
|
+ guideType.value = res.data[0].code;
|
|
|
+ handleQueryGuide();
|
|
|
+ })
|
|
|
+ .catch((err: any) => {
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+};
|
|
|
+// 根据分类获取指南数据列表
|
|
|
+const guideListTotal = ref(0);
|
|
|
+const guidePageIndex = ref(1);
|
|
|
+const guidePageSize = ref(10);
|
|
|
const guideList = ref<EmptyArrayType>([]); // 指南列表
|
|
|
+const handleQueryGuide = () => {
|
|
|
+ guidePageIndex.value = 1;
|
|
|
+ getGuideDataList();
|
|
|
+};
|
|
|
+const getGuideDataList = () => {
|
|
|
+ state.loading = true;
|
|
|
+ lzRXFZDocumentList({
|
|
|
+ type: selectType.value,
|
|
|
+ contentType: guideType.value,
|
|
|
+ pageNum: guidePageIndex.value,
|
|
|
+ pageSize: guidePageSize.value,
|
|
|
+ name: guideKeyword.value,
|
|
|
+ })
|
|
|
+ .then((res: any) => {
|
|
|
+ guideListTotal.value = parseInt(res.data?.total);
|
|
|
+ guideList.value = res.data.rows;
|
|
|
+ state.loading = false;
|
|
|
+ })
|
|
|
+ .catch((err: any) => {
|
|
|
+ console.log(err);
|
|
|
+ state.loading = false;
|
|
|
+ });
|
|
|
+};
|
|
|
+// 发送问题
|
|
|
const sendGuide = () => {
|
|
|
- if (!guideKeyword.value) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ handleQueryGuide();
|
|
|
+};
|
|
|
+// 点击查看文档详情
|
|
|
+const dialogVisible = ref(false);
|
|
|
+const dialogTitle = ref('文档详情');
|
|
|
+const loading = ref(false); // 加载
|
|
|
+const documentContent = ref(null);
|
|
|
+const guideDetail = (item: any) => {
|
|
|
+ dialogVisible.value = true;
|
|
|
+ loading.value = true;
|
|
|
+ dialogTitle.value = `文档详情(${item.name})`;
|
|
|
+ lzRXFZDocumentDetail({ documentId: item.id })
|
|
|
+ .then((res: any) => {
|
|
|
+ documentContent.value = res.data.content;
|
|
|
+ loading.value = false;
|
|
|
+ })
|
|
|
+ .catch((err: any) => {
|
|
|
+ console.log(err);
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
};
|
|
|
// 推荐知识关键词
|
|
|
const recommendKeyword = ref('');
|
|
@@ -280,17 +378,27 @@ const recommendKeyword = ref('');
|
|
|
const recommendList = ref<EmptyArrayType>([]); // 推荐列表
|
|
|
const sendRecommend = () => {
|
|
|
if (!recommendKeyword.value) {
|
|
|
+ recommendList.value = [];
|
|
|
return;
|
|
|
}
|
|
|
+ state.loading = true;
|
|
|
+ lzRXFZKnowledge({ content: recommendKeyword.value })
|
|
|
+ .then((res: any) => {
|
|
|
+ recommendList.value = res.data;
|
|
|
+ state.loading = false;
|
|
|
+ })
|
|
|
+ .catch((err: any) => {
|
|
|
+ console.log(err);
|
|
|
+ state.loading = false;
|
|
|
+ });
|
|
|
};
|
|
|
// 热线赋值授权
|
|
|
const stores = useUserInfo(); // 用户信息
|
|
|
const { userInfos } = storeToRefs(stores); // 用户信息
|
|
|
const getRXFZAuth = () => {
|
|
|
- console.log(userInfos.value, '111');
|
|
|
- lzRXFZAuth({ uuid: '08dbba85-02b4-4c0d-83e9-a6e35977c105' })
|
|
|
+ lzRXFZAuth({ uuid: userInfos.value.id })
|
|
|
.then((res: any) => {
|
|
|
- console.log(res);
|
|
|
+ Cookie.set('lzRXFZToken', res.data.accessToken);
|
|
|
})
|
|
|
.catch((err: any) => {
|
|
|
console.log(err);
|
|
@@ -334,4 +442,28 @@ defineExpose({
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+.recommend-content {
|
|
|
+ margin-top: 10px;
|
|
|
+ .recommend-content-item {
|
|
|
+ padding: 5px;
|
|
|
+ border-bottom: var(--el-border);
|
|
|
+ &:last-child {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ .recommend-content-item-question {
|
|
|
+ font-weight: bold;
|
|
|
+ margin-bottom: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.guide-content {
|
|
|
+ margin-top: 10px;
|
|
|
+ .guide-content-item {
|
|
|
+ padding: 5px;
|
|
|
+ border-bottom: var(--el-border);
|
|
|
+ &:last-child {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|