|
@@ -78,24 +78,45 @@
|
|
|
|
|
|
<el-col :xs="12" :sm="12" :md="14" :lg="14" :xl="14" class="center-container">
|
|
|
<div class="input-box">
|
|
|
- <el-select v-model="state.queryParams.RetrievalType" placeholder="请选择" style="width: 120px">
|
|
|
- <el-option v-for="item in state.typeList" :key="item.value" :label="item.label" :value="item.value" class="w1" />
|
|
|
+ <el-select v-model="state.queryParams.RetrievalType" placeholder="请选择" style="width: 120px" @change="queryList">
|
|
|
+ <el-option label="全文" :value="0" />
|
|
|
+ <el-option label="标题" :value="1" />
|
|
|
+ <el-option label="知识内容" :value="2" />
|
|
|
+ <el-option label="摘要" :value="3" />
|
|
|
</el-select>
|
|
|
<div class="input-with-button w100">
|
|
|
<div class="flex">
|
|
|
- <el-autocomplete
|
|
|
- v-model="state.queryParams.Keyword"
|
|
|
- :fetch-suggestions="querySearchAsync"
|
|
|
- placeholder="关键词"
|
|
|
- @select="handleSelect"
|
|
|
- class="mr10 w100"
|
|
|
- clearable
|
|
|
- value-key="title"
|
|
|
- >
|
|
|
- </el-autocomplete>
|
|
|
- <el-button type="primary" class="btn" :loading="state.loading" @click="queryList"><SvgIcon name="ele-Search" class="mr5" />搜索</el-button>
|
|
|
- <el-button @click="resetQuery" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置</el-button>
|
|
|
- </div>
|
|
|
+ <el-autocomplete
|
|
|
+ v-model="state.queryParams.Keyword"
|
|
|
+ :fetch-suggestions="querySearchAsync"
|
|
|
+ placeholder="关键词"
|
|
|
+ @select="handleSelect"
|
|
|
+ class="mr10 w100"
|
|
|
+ clearable
|
|
|
+ value-key="title"
|
|
|
+ >
|
|
|
+ <template #default="{ item }">
|
|
|
+ <template v-if="state.queryParams.RetrievalType === 0">
|
|
|
+ <div class="text-no-wrap">{{ item.title }}</div>
|
|
|
+ <span class="text-no-wrap color-info">{{ item.summary }}</span>
|
|
|
+ </template>
|
|
|
+ <template v-if="state.queryParams.RetrievalType === 1">
|
|
|
+ <div class="text-no-wrap">{{ item.title }}</div>
|
|
|
+ </template>
|
|
|
+ <template v-if="state.queryParams.RetrievalType === 2">
|
|
|
+ <div class="text-no-wrap">{{ item.title }}</div>
|
|
|
+ <span class="text-no-wrap color-info">{{ item.summary }}</span>
|
|
|
+ </template>
|
|
|
+ <template v-if="state.queryParams.RetrievalType === 3">
|
|
|
+ <span class="text-no-wrap color-info">{{ item.summary }}</span>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </el-autocomplete>
|
|
|
+ <el-button type="primary" class="btn" :loading="state.loading" @click="queryList"
|
|
|
+ ><SvgIcon name="ele-Search" class="mr5" />搜索</el-button
|
|
|
+ >
|
|
|
+ <el-button @click="resetQuery" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置</el-button>
|
|
|
+ </div>
|
|
|
<div class="flex-center-align mt5">
|
|
|
<div style="height: 32px; line-height: 32px">排序:</div>
|
|
|
<el-radio-group v-model="state.queryParams.Sort" @change="queryList">
|
|
@@ -111,18 +132,18 @@
|
|
|
<el-scrollbar>
|
|
|
<div v-for="(v, i) in state.retrievalList" :key="i" class="retrieval-content-item" @click="onPreview(v)" title="查看详情">
|
|
|
<h4 class="mb10 text-no-wrap">{{ v.title }}</h4>
|
|
|
- <div class="text-ellipsis2" >{{v.summary}}</div>
|
|
|
- <div class="flex-center-between mt10 color-info">
|
|
|
- <div>
|
|
|
- <span class="mr10">创建部门:{{ v.creatorOrgName }}</span>
|
|
|
- <span>创建时间:{{ formatDate(v.creationTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
|
|
|
- </div>
|
|
|
- <div class="flex-center-align">
|
|
|
- <span class="flex-center-align"><SvgIcon name="ele-StarFilled" size="18px" class="mr3"/>{{v.score}}</span>
|
|
|
- <span class="flex-center-align ml10"><SvgIcon name="ele-ChatDotSquare" size="16px" class="mr3"/>{{v.commentNum}}</span>
|
|
|
- <span class="flex-center-align ml10"><SvgIcon name="ele-View" size="16px" class="mr3"/>{{v.pageView}}</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div class="text-ellipsis2">{{ v.summary }}</div>
|
|
|
+ <div class="flex-center-between mt10 color-info">
|
|
|
+ <div>
|
|
|
+ <span class="mr10">创建部门:{{ v.creatorOrgName }}</span>
|
|
|
+ <span>创建时间:{{ formatDate(v.creationTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="flex-center-align">
|
|
|
+ <span class="flex-center-align"><SvgIcon name="ele-StarFilled" size="18px" class="mr3" />{{ v.score }}</span>
|
|
|
+ <span class="flex-center-align ml10"><SvgIcon name="ele-ChatDotSquare" size="16px" class="mr3" />{{ v.commentNum }}</span>
|
|
|
+ <span class="flex-center-align ml10"><SvgIcon name="ele-View" size="16px" class="mr3" />{{ v.pageView }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</el-scrollbar>
|
|
|
</template>
|
|
@@ -141,7 +162,7 @@
|
|
|
<el-col :xs="6" :sm="6" :md="6" :lg="6" :xl="6" class="right-container">
|
|
|
<p class="flex-center-between pt10">
|
|
|
<span class="font16">常用知识前10</span>
|
|
|
- <el-button link type="primary" @click="onRefresh"><SvgIcon name="ele-Refresh" class="mr4" /> 刷新</el-button>
|
|
|
+ <el-button link type="primary" @click="querySearchNum"><SvgIcon name="ele-Refresh" class="mr4" /> 刷新</el-button>
|
|
|
</p>
|
|
|
<el-divider />
|
|
|
<p class="flex-center-between">
|
|
@@ -155,7 +176,7 @@
|
|
|
<p class="flex-center-align top10-items-title" @click="onPreview(item)">
|
|
|
{{ index + 1 }}.<el-link type="primary" :underline="false">{{ item.title }}</el-link>
|
|
|
</p>
|
|
|
- <span class="top10-items-num">{{ item.num }}</span>
|
|
|
+ <span class="top10-items-num">{{ item.searchNum }}</span>
|
|
|
</div>
|
|
|
</el-scrollbar>
|
|
|
</template>
|
|
@@ -172,9 +193,9 @@
|
|
|
<script setup lang="ts" name="knowledgeRetrieval">
|
|
|
import { onMounted, reactive, ref, watch } from 'vue';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
-import {ElMessage, FormInstance} from 'element-plus';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
import { auth } from '/@/utils/authFunction';
|
|
|
-import { knowledgeRetrieval } from '/@/api/knowledge/retrieval';
|
|
|
+import { knowledgeRetrieval, searchNumList,searchNumAdd } from '/@/api/knowledge/retrieval';
|
|
|
import { hotSpotType } from '/@/api/business/order';
|
|
|
import { getOrgList } from '/@/api/system/organize';
|
|
|
import { treeList } from '/@/api/knowledge/type';
|
|
@@ -186,36 +207,17 @@ const state = reactive<any>({
|
|
|
// 查询条件
|
|
|
PageIndex: 1, // 当前页
|
|
|
PageSize: 10, // 每页条数
|
|
|
- Attribution: ' ',
|
|
|
+ Attribution: ' ',
|
|
|
Keyword: null, // 关键词
|
|
|
RetrievalType: 0, // 检索类型
|
|
|
- Sort: '1',
|
|
|
+ Sort: '1',
|
|
|
},
|
|
|
activeName: '0',
|
|
|
orgData: [], // 部门
|
|
|
knowledgeOptions: [], // 知识类型
|
|
|
total: 0, // 总条数
|
|
|
loading: false, // 加载状态
|
|
|
- typeList: [
|
|
|
- // 检索类型
|
|
|
- {
|
|
|
- label: '全文',
|
|
|
- value: 0,
|
|
|
- },
|
|
|
- {
|
|
|
- label: '标题',
|
|
|
- value: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- label: '知识内容',
|
|
|
- value: 2,
|
|
|
- },
|
|
|
- {
|
|
|
- label: '摘要',
|
|
|
- value: 3,
|
|
|
- }
|
|
|
- ],
|
|
|
- retrievalList: [], // 检索列表
|
|
|
+ retrievalList: [], // 检索列表
|
|
|
});
|
|
|
const router = useRouter(); // 路由
|
|
|
const topList = ref<EmptyArrayType>([]); // 常用知识前10
|
|
@@ -304,51 +306,58 @@ const onPreview = (row: any) => {
|
|
|
};
|
|
|
// 切换tab 查询列表
|
|
|
const rightLoading = ref(false); // 右侧加载状态
|
|
|
-const onRefresh = () => {
|
|
|
+// 常用知识前10
|
|
|
+const querySearchNum = () => {
|
|
|
rightLoading.value = true;
|
|
|
- setTimeout(() => {
|
|
|
- rightLoading.value = false;
|
|
|
- }, 1000);
|
|
|
+ searchNumList({ Keyword: state.queryParams.Keyword })
|
|
|
+ .then((res: any) => {
|
|
|
+ topList.value = res.result?.items ?? [];
|
|
|
+ rightLoading.value = false;
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ rightLoading.value = false;
|
|
|
+ });
|
|
|
};
|
|
|
const queryTitleLight = (titleInfo: string) => {
|
|
|
return titleInfo.replace(new RegExp(state.queryParams.Keyword, 'g'), `<span class="color-danger">${state.queryParams.Keyword}</span>`);
|
|
|
};
|
|
|
const centerLoading = ref(false); // 中间加载状态
|
|
|
const querySearchAsync = (queryString: string, cb: (arg: any) => void) => {
|
|
|
- if (queryString) {
|
|
|
- centerLoading.value = true;
|
|
|
- knowledgeRetrieval({
|
|
|
- ...state.queryParams,
|
|
|
- Keyword: queryString,
|
|
|
- })
|
|
|
- .then((res: any) => {
|
|
|
- centerLoading.value = false;
|
|
|
- cb(res.result?.items ?? []);
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- centerLoading.value = false;
|
|
|
- cb([]);
|
|
|
- });
|
|
|
- } else {
|
|
|
- cb([]);
|
|
|
- }
|
|
|
-}
|
|
|
+ if (queryString) {
|
|
|
+ centerLoading.value = true;
|
|
|
+ knowledgeRetrieval({
|
|
|
+ ...state.queryParams,
|
|
|
+ Keyword: queryString,
|
|
|
+ })
|
|
|
+ .then((res: any) => {
|
|
|
+ centerLoading.value = false;
|
|
|
+ cb(res.result?.items ?? []);
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ centerLoading.value = false;
|
|
|
+ cb([]);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ cb([]);
|
|
|
+ }
|
|
|
+};
|
|
|
const handleSelect = (item: Record<string, any>) => {
|
|
|
- state.queryParams.Keyword = item.title;
|
|
|
- queryList();
|
|
|
-}
|
|
|
+ state.queryParams.Keyword = item.title;
|
|
|
+ searchNumAdd({id: item.id});
|
|
|
+ queryList();
|
|
|
+};
|
|
|
const queryList = () => {
|
|
|
if (!auth('knowledge:retrieval')) ElMessage.error('抱歉,您没有权限知识检索');
|
|
|
else {
|
|
|
- centerLoading.value = true;
|
|
|
+ centerLoading.value = true;
|
|
|
knowledgeRetrieval(state.queryParams)
|
|
|
.then((res: any) => {
|
|
|
state.retrievalList = res.result?.items ?? [];
|
|
|
state.total = res.result?.total ?? 0;
|
|
|
- centerLoading.value = false;
|
|
|
+ centerLoading.value = false;
|
|
|
})
|
|
|
.catch(() => {
|
|
|
- centerLoading.value = false;
|
|
|
+ centerLoading.value = false;
|
|
|
state.retrievalList = [];
|
|
|
state.total = 0;
|
|
|
});
|
|
@@ -356,27 +365,28 @@ const queryList = () => {
|
|
|
};
|
|
|
/** 重置按钮操作 */
|
|
|
const resetQuery = throttle(() => {
|
|
|
- state.queryParams.PageIndex = 1;
|
|
|
- state.queryParams.PageSize = 10;
|
|
|
- state.queryParams.Keyword = null;
|
|
|
- state.queryParams.RetrievalType = 0;
|
|
|
- state.queryParams.Sort = '1';
|
|
|
- state.queryParams.Attribution = ' ';
|
|
|
- state.activeName = '0';
|
|
|
- state.queryParams.CreateOrgId = null;
|
|
|
- state.queryParams.KnowledgeTypeId = null;
|
|
|
- state.queryParams.HotspotId = null;
|
|
|
- filterOrg.value = '';
|
|
|
- filterType.value = '';
|
|
|
- filterHot.value = '';
|
|
|
- typeRef.value?.setCurrentKey(null);
|
|
|
- orgRef.value?.setCurrentKey(null);
|
|
|
- hotRef.value?.setCurrentKey(null);
|
|
|
- queryList();
|
|
|
+ state.queryParams.PageIndex = 1;
|
|
|
+ state.queryParams.PageSize = 10;
|
|
|
+ state.queryParams.Keyword = null;
|
|
|
+ state.queryParams.RetrievalType = 0;
|
|
|
+ state.queryParams.Sort = '1';
|
|
|
+ state.queryParams.Attribution = ' ';
|
|
|
+ state.activeName = '0';
|
|
|
+ state.queryParams.CreateOrgId = null;
|
|
|
+ state.queryParams.KnowledgeTypeId = null;
|
|
|
+ state.queryParams.HotspotId = null;
|
|
|
+ filterOrg.value = '';
|
|
|
+ filterType.value = '';
|
|
|
+ filterHot.value = '';
|
|
|
+ typeRef.value?.setCurrentKey(null);
|
|
|
+ orgRef.value?.setCurrentKey(null);
|
|
|
+ hotRef.value?.setCurrentKey(null);
|
|
|
+ queryList();
|
|
|
}, 500);
|
|
|
onMounted(() => {
|
|
|
getOrgListApi();
|
|
|
- queryList();
|
|
|
+ queryList();
|
|
|
+ querySearchNum();
|
|
|
});
|
|
|
</script>
|
|
|
|
|
@@ -392,24 +402,24 @@ onMounted(() => {
|
|
|
.input-box {
|
|
|
display: flex;
|
|
|
}
|
|
|
- .retrieval-content {
|
|
|
- &-item {
|
|
|
- border-bottom: var(--el-border);
|
|
|
- padding: 10px 15px;
|
|
|
- margin-bottom: 10px;
|
|
|
- cursor: pointer;
|
|
|
- &:last-child {
|
|
|
- margin-bottom: 0;
|
|
|
- border: none;
|
|
|
- }
|
|
|
- &:hover {
|
|
|
- color: var(--el-color-primary);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ .retrieval-content {
|
|
|
+ &-item {
|
|
|
+ border-bottom: var(--el-border);
|
|
|
+ padding: 10px 15px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ cursor: pointer;
|
|
|
+ &:last-child {
|
|
|
+ margin-bottom: 0;
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ &:hover {
|
|
|
+ color: var(--el-color-primary);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
.right-container {
|
|
|
- height: 100%;
|
|
|
+ height: 100%;
|
|
|
.top10 {
|
|
|
&-items {
|
|
|
margin-bottom: 20px;
|
|
@@ -436,6 +446,5 @@ onMounted(() => {
|
|
|
:deep(.el-card__body) {
|
|
|
height: 100%;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
</style>
|