|
@@ -82,10 +82,7 @@
|
|
|
<div class="flex-column">
|
|
|
<el-tabs v-model="state.queryParams.Status" @tab-change="handleClick">
|
|
|
<el-tab-pane label="全部" name=" "></el-tab-pane>
|
|
|
- <el-tab-pane label="已上架" name="3"></el-tab-pane>
|
|
|
- <el-tab-pane label="已下架" name="4"></el-tab-pane>
|
|
|
- <el-tab-pane label="审核中" name="1"></el-tab-pane>
|
|
|
- <el-tab-pane label="审核不通过" name="2"></el-tab-pane>
|
|
|
+ <el-tab-pane :label="v.value" :name="v.key" v-for="(v, i) in state.statusOptions" :key="i"></el-tab-pane>
|
|
|
</el-tabs>
|
|
|
<!-- 搜索条件 -->
|
|
|
<el-form :model="state.queryParams" ref="ruleFormRef" :inline="true" @submit.native.prevent class="pl15 pr15 pt15">
|
|
@@ -148,14 +145,10 @@
|
|
|
<p class="table-title"></p>
|
|
|
<div>
|
|
|
<el-button type="primary" @click="onOpenAddUser"> <SvgIcon name="ele-Plus" class="mr5" />创建知识 </el-button>
|
|
|
- <el-button type="primary" @click="onImportTable" :disabled="!state.multipleSelection.length">
|
|
|
- <SvgIcon name="iconfont icon-daochu" class="mr5" />导出
|
|
|
- </el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 表格 -->
|
|
|
- <el-table :data="state.tableData" v-loading="state.tableLoading" row-key="id" @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" :reserve-selection="true" />
|
|
|
+ <el-table :data="state.tableData" v-loading="state.tableLoading" row-key="id">
|
|
|
<el-table-column prop="title" label="标题" show-overflow-tooltip width="120"></el-table-column>
|
|
|
<el-table-column prop="knowledgeTypeName" label="类型" show-overflow-tooltip width="200"></el-table-column>
|
|
|
<el-table-column prop="hotspotName" label="热点" show-overflow-tooltip width="200"></el-table-column>
|
|
@@ -184,18 +177,18 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="status" label="状态" show-overflow-tooltip width="100">
|
|
|
<template #default="{ row }">
|
|
|
- <span v-if="row.status === 1" style="color: var(--el-color-primary)">审核中</span>
|
|
|
- <span v-if="row.status === 2" style="color: var(--el-color-danger)">审核不通过</span>
|
|
|
- <span v-if="row.status === 3" style="color: var(--el-color-success)">已上架</span>
|
|
|
- <span v-if="row.status === 4" style="color: var(--el-color-info)">已下架</span>
|
|
|
+ <span v-if="row.status === 1" style="color: var(--el-color-primary)">{{ row.statusName }}</span>
|
|
|
+ <span v-if="row.status === 2" style="color: var(--el-color-danger)">{{ row.statusName }}</span>
|
|
|
+ <span v-if="row.status === 3" style="color: var(--el-color-success)">{{ row.statusName }}</span>
|
|
|
+ <span v-if="row.status === 4" style="color: var(--el-color-info)">{{ row.statusName }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" width="300" fixed="right" align="center">
|
|
|
<template #default="{ row }">
|
|
|
- <el-button link type="primary" @click="onPreview(row)" title="预览" v-if="[1, 2, 3, 4].includes(row.status)"> 预览 </el-button>
|
|
|
+ <el-button link type="info" @click="onPreview(row)" title="预览" v-if="[1, 2, 3, 4].includes(row.status)"> 预览 </el-button>
|
|
|
<el-button link type="primary" @click="onEdit(row)" title="编辑" v-if="[2, 3, 4].includes(row.status)"> 编辑 </el-button>
|
|
|
- <el-button link type="primary" @click="onOffshelf(row)" title="下架" v-if="[3].includes(row.status)"> 下架 </el-button>
|
|
|
- <el-button link type="primary" @click="ontheshelf(row)" title="上架" v-if="[4].includes(row.status)"> 上架 </el-button>
|
|
|
+ <el-button link type="warning" @click="onOffshelf(row)" title="下架" v-if="[3].includes(row.status)"> 下架 </el-button>
|
|
|
+ <el-button link type="success" @click="ontheshelf(row)" title="上架" v-if="[4].includes(row.status)"> 上架 </el-button>
|
|
|
<el-button link type="primary" @click="onRecord(row)" title="查看审核记录" v-if="[1, 2].includes(row.status)">
|
|
|
查看审核记录
|
|
|
</el-button>
|
|
@@ -234,17 +227,14 @@
|
|
|
<script lang="ts" setup name="knowledge">
|
|
|
import { ref, reactive, onMounted, watch, onActivated, defineAsyncComponent } from 'vue';
|
|
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
|
|
-import { useRouter, useRoute } from 'vue-router';
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
import type { FormInstance } from 'element-plus';
|
|
|
-import table2excel from 'js-table2excel';
|
|
|
import { formatDate } from '/@/utils/formatTime';
|
|
|
import { throttle, commonEeum } from '/@/utils/tools';
|
|
|
-import { KnowledgePaged, KnowledgeRevoke, KnowledgeOffshelf, KnowledgeOntheshelf } from '/@/api/knowledge';
|
|
|
+import { KnowledgePaged, KnowledgeRevoke, KnowledgeOffshelf, KnowledgeOntheshelf, baseData } from '/@/api/knowledge';
|
|
|
import { getOrgList } from '/@/api/system/organize';
|
|
|
import { treelist } from '/@/api/knowledge/type';
|
|
|
import { hotspottype } from '/@/api/business/order';
|
|
|
-import { storeToRefs } from 'pinia';
|
|
|
-import { useThemeConfig } from '/@/stores/themeConfig';
|
|
|
|
|
|
// 引入组件
|
|
|
const ProcessRecord = defineAsyncComponent(() => import('/@/views/knowledge/component/ProcessRecord.vue'));
|
|
@@ -292,20 +282,17 @@ const state = reactive<any>({
|
|
|
total: 0,
|
|
|
loading: false,
|
|
|
tableLoading: false,
|
|
|
- multipleSelection: [],
|
|
|
orgData: [],
|
|
|
knowledgeOptions: [],
|
|
|
options: [],
|
|
|
+ statusOptions: [],
|
|
|
});
|
|
|
const router = useRouter();
|
|
|
-const route = useRoute();
|
|
|
const ruleFormRef = ref<FormInstance>(); //表单ref
|
|
|
const rightScrollRef = ref();
|
|
|
const processRecordRef = ref();
|
|
|
const processRef = ref();
|
|
|
const updateKnowledge = ref();
|
|
|
-const storesThemeConfig = useThemeConfig();
|
|
|
-const { themeConfig } = storeToRefs(storesThemeConfig);
|
|
|
// 热点分类远程搜索
|
|
|
const HotspotProps = {
|
|
|
label: 'hotSpotFullName',
|
|
@@ -440,10 +427,6 @@ const handleNodeClick = (data: any) => {
|
|
|
}
|
|
|
getList();
|
|
|
};
|
|
|
-// 表格多选
|
|
|
-const handleSelectionChange = (val: any) => {
|
|
|
- state.multipleSelection = val;
|
|
|
-};
|
|
|
/** 重置按钮操作 */
|
|
|
const resetQuery = throttle((formEl: FormInstance | undefined) => {
|
|
|
if (!formEl) return;
|
|
@@ -465,7 +448,7 @@ const resetQuery = throttle((formEl: FormInstance | undefined) => {
|
|
|
// 创建知识
|
|
|
const onOpenAddUser = () => {
|
|
|
router.push({
|
|
|
- name:'knowledgeEdit',
|
|
|
+ name: 'knowledgeEdit',
|
|
|
params: {
|
|
|
tagsViewName: '创建知识',
|
|
|
},
|
|
@@ -581,30 +564,19 @@ const onRecall = (row: any) => {
|
|
|
const onRowDel = (row: any) => {
|
|
|
processRef.value.openDialog({ id: row.id, title: '删除知识', commonEeum: commonEeum.Seat, processType: 'deleteStart' });
|
|
|
};
|
|
|
-// 导出表格
|
|
|
-const onImportTable = () => {
|
|
|
- const tabeHeader = [
|
|
|
- { key: 'title', colWidth: '', title: '标题', type: 'text', isCheck: true },
|
|
|
- { key: 'knowledgeTypeName', colWidth: '', title: '类型', type: 'text', isCheck: true },
|
|
|
- { key: 'hotspotName', colWidth: '', title: '热点', type: 'text', isCheck: true },
|
|
|
- { key: 'creationName', colWidth: '', title: '创建人', type: 'text', isCheck: true },
|
|
|
- { key: 'creationBMName', colWidth: '', title: '创建部门', type: 'text', isCheck: true },
|
|
|
- { key: 'creationTime', colWidth: '', title: '创建时间', type: 'text', isCheck: true },
|
|
|
- { key: 'pageView', colWidth: '', title: '阅读次数', type: 'text', isCheck: true },
|
|
|
- { key: 'onShelfTime', colWidth: '', title: '上架时间', type: 'text', isCheck: true },
|
|
|
- { key: 'offShelfTime', colWidth: '', title: '下架时间', type: 'text', isCheck: true },
|
|
|
- { key: 'lastModificationTime', colWidth: '', title: '更新时间', type: 'text', isCheck: true },
|
|
|
- { key: 'status', colWidth: '', title: '状态', type: 'text', isCheck: true },
|
|
|
- ];
|
|
|
- table2excel(
|
|
|
- tabeHeader,
|
|
|
- state.multipleSelection,
|
|
|
- `${themeConfig.value.globalTitle}-${route.meta.title} ${formatDate(new Date(), 'YYYY-mm-dd HH-MM')}`
|
|
|
- );
|
|
|
+// 页面基础数据
|
|
|
+const getBaseData = async () => {
|
|
|
+ try {
|
|
|
+ const { result } = await baseData();
|
|
|
+ state.statusOptions = result;
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
};
|
|
|
onMounted(() => {
|
|
|
getList();
|
|
|
getOrgListApi();
|
|
|
+ getBaseData();
|
|
|
});
|
|
|
onActivated(() => {
|
|
|
getList();
|