|
@@ -14,11 +14,11 @@
|
|
|
</el-input>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="热点" name="2" :disabled="state.tableLoading">
|
|
|
- <el-input v-model="filterHot" placeholder="请填写热点名称" class="input-with-select mb10" clearable> </el-input>
|
|
|
+ <el-input v-model="filterHot" placeholder="请填写热点名称" class="input-with-select mb10" clearable @input="inputHotspot"> </el-input>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
<el-scrollbar style="height: calc(100% - 100px);'" ref="scrollBarRef">
|
|
|
- <el-skeleton :loading="state.loading" animated :rows="10" v-if="state.activeName === '0'">
|
|
|
+ <el-skeleton :loading="state.orgLoading" animated :rows="10" v-if="state.activeName === '0'">
|
|
|
<template #default>
|
|
|
<el-auto-resizer>
|
|
|
<template #default="{ height, width }">
|
|
@@ -35,7 +35,7 @@
|
|
|
:height="height"
|
|
|
>
|
|
|
<template #default="{ node }">
|
|
|
- <text-tooltip :content="node.label" effect="dark" placement="top"></text-tooltip>
|
|
|
+ <text-tooltip :content="node.label+'('+node.data.knowledgeNum+')'" effect="dark" placement="top"></text-tooltip>
|
|
|
</template>
|
|
|
</el-tree-v2>
|
|
|
</template>
|
|
@@ -67,7 +67,7 @@
|
|
|
</el-auto-resizer>
|
|
|
</template>
|
|
|
</el-skeleton>
|
|
|
- <el-skeleton :loading="state.loading" animated :rows="10" v-if="state.activeName === '2'">
|
|
|
+ <el-skeleton :loading="state.hotspotLoading" animated :rows="10" v-if="state.activeName === '2'">
|
|
|
<template #default>
|
|
|
<el-tree
|
|
|
node-key="id"
|
|
@@ -85,7 +85,10 @@
|
|
|
check-strictly
|
|
|
:expand-on-click-node="false"
|
|
|
ref="hotRef"
|
|
|
- />
|
|
|
+ > <template #default="{ node }">
|
|
|
+ <text-tooltip :content="node.label + '(' + node.data.knowledgeNum + ')'" effect="dark" placement="top"></text-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-tree>
|
|
|
<el-tree
|
|
|
ref="hotRef"
|
|
|
:data="state.hotSpotData"
|
|
@@ -101,7 +104,11 @@
|
|
|
@node-click="handleNodeClick"
|
|
|
:expand-on-click-node="false"
|
|
|
check-strictly
|
|
|
- />
|
|
|
+ >
|
|
|
+ <template #default="{ node }">
|
|
|
+ <text-tooltip :content="node.label + '(' + node.data.knowledgeNum + ')'" effect="dark" placement="top"></text-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-tree>
|
|
|
</template>
|
|
|
</el-skeleton>
|
|
|
</el-scrollbar>
|
|
@@ -369,14 +376,14 @@ import {
|
|
|
knowledgeDetailExport,
|
|
|
} from '@/api/knowledge';
|
|
|
import { getOrgListByUser } from '@/api/system/organize';
|
|
|
-import { treeList } from '@/api/knowledge/type';
|
|
|
+import { knowledgeDepartmentList, knowledgeHotSpotList, knowledgeHotSpotSearch, treeList } from '@/api/knowledge/type';
|
|
|
import { hotSpotSearch, hotSpotType } from '@/api/business/order';
|
|
|
import { Splitpanes, Pane } from 'splitpanes';
|
|
|
import 'splitpanes/dist/splitpanes.css';
|
|
|
import { useUserInfo } from '@/stores/userInfo';
|
|
|
import { storeToRefs } from 'pinia';
|
|
|
import Other from '@/utils/other';
|
|
|
-import { downloadFileByStream } from '@/utils/tools';
|
|
|
+import { debounce, downloadFileByStream, throttle } from '@/utils/tools';
|
|
|
import { useThemeConfig } from '@/stores/themeConfig';
|
|
|
import { VxeUI } from 'vxe-pc-ui';
|
|
|
|
|
@@ -387,6 +394,14 @@ const TextTooltip = defineAsyncComponent(() => import('@/components/TextTooltip/
|
|
|
const ToEnd = defineAsyncComponent(() => import('@/views/knowledge/index/components/To-end.vue')); // 批量审批
|
|
|
const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
|
|
|
|
|
|
+const router = useRouter(); //路由
|
|
|
+const ruleFormRef = ref<FormInstance>(); //表单ref
|
|
|
+const horizontal = ref(false);
|
|
|
+const storesUserInfo = useUserInfo();
|
|
|
+const { userInfos } = storeToRefs(storesUserInfo); // 用户信息
|
|
|
+const storesThemeConfig = useThemeConfig();
|
|
|
+const { themeConfig } = storeToRefs(storesThemeConfig);
|
|
|
+
|
|
|
// 定义变量内容
|
|
|
const state = reactive<any>({
|
|
|
queryParams: {
|
|
@@ -401,6 +416,7 @@ const state = reactive<any>({
|
|
|
Summary: null, //摘要
|
|
|
ModuleCode: '',
|
|
|
NewDraftsStatus: -1,
|
|
|
+ Attribution: userInfos.value.isCenter ? '中心知识库' : '部门知识库',
|
|
|
},
|
|
|
activeName: '1', //tab切换 默认知识分类
|
|
|
tableData: [], //表格数据
|
|
@@ -411,15 +427,11 @@ const state = reactive<any>({
|
|
|
knowledgeOptions: [], //知识库类型数据
|
|
|
statusOptions: [], //状态数据
|
|
|
hotSpotData: [], //热点数据
|
|
|
+ hotspotLoading:false, // 热点loading
|
|
|
+ orgLoading:false, // 部门loading
|
|
|
typeLoading: false, // 知识类型loading
|
|
|
});
|
|
|
-const router = useRouter(); //路由
|
|
|
-const ruleFormRef = ref<FormInstance>(); //表单ref
|
|
|
-const horizontal = ref(false);
|
|
|
-const storesUserInfo = useUserInfo();
|
|
|
-const { userInfos } = storeToRefs(storesUserInfo); // 用户信息
|
|
|
-const storesThemeConfig = useThemeConfig();
|
|
|
-const { themeConfig } = storeToRefs(storesThemeConfig);
|
|
|
+
|
|
|
// 部门查询
|
|
|
const filterOrg = ref('');
|
|
|
const orgRef = ref<RefType>();
|
|
@@ -456,31 +468,39 @@ const hotRef = ref<RefType>();
|
|
|
watch(filterHot, (val) => {
|
|
|
if (val) {
|
|
|
lazyShow.value = false; //当填写框有值时关闭懒加载
|
|
|
- hotSpotSearch(val)
|
|
|
+ } else if (val == '' || val == ' ' || val == null) {
|
|
|
+ lazyShow.value = true; // 懒加载树显示
|
|
|
+ }
|
|
|
+});
|
|
|
+const filterNodeHot = (value: string, data: any) => {
|
|
|
+ if (!value) return true;
|
|
|
+ return data.hotSpotName.includes(value);
|
|
|
+};
|
|
|
+const lazyShow = ref(true);
|
|
|
+const inputHotspot = debounce((val:string)=>{
|
|
|
+ state.hotspotLoading = true;
|
|
|
+ if (val) {
|
|
|
+ knowledgeHotSpotSearch({name:val,Attribution:state.queryParams.Attribution})
|
|
|
.then((res) => {
|
|
|
//获取后端搜索的数据
|
|
|
state.hotSpotData.length = 0;
|
|
|
state.hotSpotData = res.result ?? [];
|
|
|
- hotRef.value!.filter(val);
|
|
|
+ state.hotspotLoading = false;
|
|
|
})
|
|
|
.catch((e) => {
|
|
|
console.log(e);
|
|
|
+ state.hotspotLoading = false;
|
|
|
});
|
|
|
} else if (val == '' || val == ' ' || val == null) {
|
|
|
- lazyShow.value = true; // 懒加载树显示
|
|
|
+ state.hotspotLoading = false;
|
|
|
}
|
|
|
-});
|
|
|
-const filterNodeHot = (value: string, data: any) => {
|
|
|
- if (!value) return true;
|
|
|
- return data.hotSpotName.includes(value);
|
|
|
-};
|
|
|
+},500)
|
|
|
// 热点分类懒加载
|
|
|
-const lazyShow = ref(true);
|
|
|
const loadNode = async (node: any, resolve: any) => {
|
|
|
try {
|
|
|
if (node.isLeaf) return resolve([]);
|
|
|
- const res: any = await hotSpotType({ id: node.data.id ? node.data.id : null });
|
|
|
- resolve(res.result);
|
|
|
+ const {result} = await knowledgeHotSpotList({ id: node.data.id ? node.data.id : null,Attribution:state.queryParams.Attribution });
|
|
|
+ resolve(result);
|
|
|
} catch (error) {
|
|
|
resolve([]);
|
|
|
}
|
|
@@ -499,19 +519,38 @@ const handleQuery = () => {
|
|
|
// 获取所有组织结构 和基础数据
|
|
|
const exportType = ref<EmptyArrayType>([]);
|
|
|
const getOrgListApi = async () => {
|
|
|
- state.loading = true;
|
|
|
+ state.orgLoading = true;
|
|
|
+ try {
|
|
|
+ const { result } = await knowledgeDepartmentList({ Attribution: state.queryParams.Attribution });
|
|
|
+ state.orgData = result ?? []; //部门
|
|
|
+ state.orgLoading = false;
|
|
|
+ } catch (error) {
|
|
|
+ state.orgLoading = false;
|
|
|
+ }
|
|
|
+};
|
|
|
+// 获取知识分类
|
|
|
+const getKnowledgeType = async () => {
|
|
|
+ state.typeLoading = true;
|
|
|
+ try {
|
|
|
+ const { result } = await treeList({ IsEnable: true,Attribution: state.queryParams.Attribution });
|
|
|
+ state.knowledgeOptions = result ?? [];
|
|
|
+ state.typeLoading = false;
|
|
|
+ } catch (error) {
|
|
|
+ state.typeLoading = false;
|
|
|
+ }
|
|
|
+};
|
|
|
+const getBaseDataFn = async () => {
|
|
|
try {
|
|
|
- const res: any = await Promise.all([getOrgListByUser(), baseData()]);
|
|
|
- state.orgData = res[0].result ?? []; //部门
|
|
|
- state.statusOptions = res[1].result?.tabNames ?? []; // 列表状态
|
|
|
- exportType.value = res[1].result?.fileType ?? []; // 导出文件类型
|
|
|
- state.tabNewDraftsNames = res[1].result?.tabNewDraftsNames.map((item: any) => {
|
|
|
+ const { result } = await baseData();
|
|
|
+ state.statusOptions = result?.tabNames ?? []; // 列表状态
|
|
|
+ exportType.value = result?.fileType ?? []; // 导出文件类型
|
|
|
+ state.tabNewDraftsNames = result?.tabNewDraftsNames.map((item: any) => {
|
|
|
return {
|
|
|
label: item.value,
|
|
|
value: item.key,
|
|
|
};
|
|
|
});
|
|
|
- state.tabAuditingNames = res[1].result?.tabAuditingNames.map((item: any) => {
|
|
|
+ state.tabAuditingNames = result?.tabAuditingNames.map((item: any) => {
|
|
|
return {
|
|
|
label: item.value,
|
|
|
value: item.key,
|
|
@@ -522,17 +561,6 @@ const getOrgListApi = async () => {
|
|
|
state.loading = false;
|
|
|
}
|
|
|
};
|
|
|
-// 获取知识分类
|
|
|
-const getKnowledgeType = async () => {
|
|
|
- state.typeLoading = true;
|
|
|
- try {
|
|
|
- const { result } = await treeList({ IsEnable: true });
|
|
|
- state.knowledgeOptions = result ?? [];
|
|
|
- state.typeLoading = false;
|
|
|
- } catch (error) {
|
|
|
- state.typeLoading = false;
|
|
|
- }
|
|
|
-};
|
|
|
/** 获取知识列表 */
|
|
|
const requestParams = ref<EmptyObjectType>({});
|
|
|
const queryList = () => {
|
|
@@ -796,6 +824,7 @@ onMounted(() => {
|
|
|
if (tableRef.value && toolbarRef.value) {
|
|
|
tableRef.value.connect(toolbarRef.value);
|
|
|
}
|
|
|
+ getBaseDataFn();
|
|
|
getKnowledgeType();
|
|
|
getOrgListApi();
|
|
|
});
|