|
@@ -1,11 +1,287 @@
|
|
|
-<script setup lang="ts">
|
|
|
+<template>
|
|
|
+ <div class="knowledge-audit-container layout-padding">
|
|
|
+ <div class="layout-padding-auto layout-padding-view pd20">
|
|
|
+ <el-tabs v-model="state.queryParams.HasApproved" @tab-change="handleQuery">
|
|
|
+ <el-tab-pane name="false" label="待审批" :disabled="state.loading"></el-tab-pane>
|
|
|
+ <el-tab-pane name="true" label="已审批" :disabled="state.loading"></el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ <div style="overflow: hidden; width: 100%; height: 100%; flex: 1">
|
|
|
+ <vxe-grid v-bind="gridOptions" ref="gridRef" v-on="gridEvents" @checkbox-all="selectAllChangeEvent" @checkbox-change="selectChangeEvent">
|
|
|
+ <template #form>
|
|
|
+ <el-form :model="state.queryParams" ref="ruleFormRef" inline @submit.native.prevent :disabled="gridOptions.loading">
|
|
|
+ <el-form-item label="姓名" prop="Name">
|
|
|
+ <el-input v-model="state.queryParams.Name" placeholder="请填写姓名" clearable @keyup.enter="handleQuery" class="keyword-input" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="联系方式" prop="PhoneNumber">
|
|
|
+ <el-input
|
|
|
+ v-model="state.queryParams.PhoneNumber"
|
|
|
+ placeholder="请填写联系方式"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ class="keyword-input"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所属区县" prop="SystemAreaName">
|
|
|
+ <el-input
|
|
|
+ v-model="state.queryParams.SystemAreaName"
|
|
|
+ placeholder="请填写所属区县"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ class="keyword-input"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
|
|
|
+ <el-button @click="resetQuery(ruleFormRef)" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </template>
|
|
|
+ <template #toolbar_buttons>
|
|
|
+ <el-button type="primary" @click="onAuditBatch" v-auth="'knowledge:audit:batch'" :disabled="isChecked" :loading="state.loading"
|
|
|
+ ><SvgIcon name="ele-Edit" class="mr5" />批量审核<span v-if="checkTable.length">({{ checkTable.length }})</span>
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <template #title="{ row }">
|
|
|
+ <el-button link type="primary" @click="onPreview(row)">{{ row.title }}</el-button>
|
|
|
+ </template>
|
|
|
+ <template #action="{ row }">
|
|
|
+ <el-button link type="primary" @click="onAudit(row)" v-auth="'knowledge:audit:audit'"> 审核 </el-button>
|
|
|
+ <el-button link type="primary" @click="onHistory(row)"> 审核历史 </el-button>
|
|
|
+ </template>
|
|
|
+ <template #pager>
|
|
|
+ <pagination
|
|
|
+ @pagination="queryList"
|
|
|
+ :total="state.total"
|
|
|
+ v-model:current-page="state.queryParams.PageIndex"
|
|
|
+ v-model:page-size="state.queryParams.PageSize"
|
|
|
+ :disabled="state.loading"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </vxe-grid>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 审批 -->
|
|
|
+ <knowledge-audit ref="knowledgeAuditRef" @updateList="queryList" />
|
|
|
+ <!-- 审批历史 -->
|
|
|
+ <audit-history ref="auditHistoryRef" />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
|
|
|
-</script>
|
|
|
+<script lang="tsx" setup name="knowledgeAudit">
|
|
|
+import { computed, defineAsyncComponent, onMounted, reactive, ref } from 'vue';
|
|
|
+import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
+import { knowledgeAuditList } from '@/api/knowledge/audit';
|
|
|
|
|
|
-<template>
|
|
|
+// 引入组件
|
|
|
+const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
|
|
|
+const KnowledgeAudit = defineAsyncComponent(() => import('@/views/knowledge/audit/components/Knowledge-audit.vue')); // 审批
|
|
|
+const AuditHistory = defineAsyncComponent(() => import('@/views/knowledge/audit/components/Audit-history.vue')); // 审核历史
|
|
|
|
|
|
-</template>
|
|
|
+// 定义变量内容
|
|
|
+const state = reactive<any>({
|
|
|
+ loading: false,
|
|
|
+ queryParams: {
|
|
|
+ // 查询参数
|
|
|
+ PageIndex: 1,
|
|
|
+ PageSize: 20,
|
|
|
+ Name: null, // 姓名
|
|
|
+ PhoneNumber: null, // 联系方式
|
|
|
+ SystemAreaName: null, // 所属区县
|
|
|
+ HasApproved: 'false', // 是否已审批
|
|
|
+ },
|
|
|
+ total: 0, // 总条数
|
|
|
+});
|
|
|
|
|
|
-<style scoped lang="scss">
|
|
|
+const gridOptions = reactive<any>({
|
|
|
+ loading: false,
|
|
|
+ border: true,
|
|
|
+ showOverflow: true,
|
|
|
+ columnConfig: {
|
|
|
+ resizable: true,
|
|
|
+ },
|
|
|
+ scrollY: {
|
|
|
+ enabled: true,
|
|
|
+ gt: 100,
|
|
|
+ },
|
|
|
+ toolbarConfig: {
|
|
|
+ zoom: true,
|
|
|
+ custom: true,
|
|
|
+ refresh: {
|
|
|
+ queryMethod: () => {
|
|
|
+ handleQuery();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ slots: {
|
|
|
+ buttons: 'toolbar_buttons',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ customConfig: {
|
|
|
+ storage: true,
|
|
|
+ },
|
|
|
+ id: 'snapshotConfigAreaUser',
|
|
|
+ rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
|
|
|
+ height: 'auto',
|
|
|
+ columns: [
|
|
|
+ { type: 'checkbox', width: 50, align: 'center' },
|
|
|
+ {
|
|
|
+ field: 'name',
|
|
|
+ title: '审核类型',
|
|
|
+ width: 120,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'title',
|
|
|
+ title: '标题',
|
|
|
+ slots: { default: 'title' },
|
|
|
+ minWidth: 200,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'knowledgeTypeText',
|
|
|
+ title: '知识分类',
|
|
|
+ width: 150,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'attribution',
|
|
|
+ title: '知识归属',
|
|
|
+ width: 140,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'isPublic',
|
|
|
+ title: '是否公开',
|
|
|
+ width: 100,
|
|
|
+ slots: {
|
|
|
+ default: ({ row }) => {
|
|
|
+ return row.isPublic ? '是' : '否';
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'versionDescription',
|
|
|
+ title: '版本说明',
|
|
|
+ minWidth: 200,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'pageView',
|
|
|
+ title: '阅读次数',
|
|
|
+ width: 100,
|
|
|
+ sortable: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'creatorName',
|
|
|
+ title: '创建人',
|
|
|
+ width: 140,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'creatorOrgName',
|
|
|
+ title: '创建部门',
|
|
|
+ width: 140,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'creationTime',
|
|
|
+ title: '创建时间',
|
|
|
+ width: 160,
|
|
|
+ sortable: true,
|
|
|
+ formatter: 'formatDate',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'lastModificationTime',
|
|
|
+ title: '更新时间',
|
|
|
+ width: 160,
|
|
|
+ sortable: true,
|
|
|
+ formatter: 'formatDate',
|
|
|
+ },
|
|
|
+ { title: '操作', width: 140, fixed: 'right', align: 'center', slots: { default: 'action' } },
|
|
|
+ ],
|
|
|
+ data: [],
|
|
|
+});
|
|
|
+const gridEvents = {
|
|
|
+ sortChange(val: any) {
|
|
|
+ state.queryParams.SortField = val.order ? val.field : null;
|
|
|
+ // 0 升序 1 降序
|
|
|
+ state.queryParams.SortRule = val.order ? (val.order == 'desc' ? 1 : 0) : null;
|
|
|
+ handleQuery();
|
|
|
+ },
|
|
|
+};
|
|
|
+const ruleFormRef = ref<any>(null); // 表单ref
|
|
|
+/** 搜索按钮操作 节流操作 */
|
|
|
+const handleQuery = () => {
|
|
|
+ state.queryParams.PageIndex = 1;
|
|
|
+ queryList();
|
|
|
+};
|
|
|
+// 获取参数列表
|
|
|
+const queryList = () => {
|
|
|
+ state.loading = true;
|
|
|
+ gridOptions.loading = true;
|
|
|
+ knowledgeAuditList(state.queryParams)
|
|
|
+ .then((res) => {
|
|
|
+ state.loading = false;
|
|
|
+ gridOptions.data = res.result.items ?? [];
|
|
|
+ state.total = res.result.total ?? 0;
|
|
|
+ gridOptions.loading = false;
|
|
|
+ gridRef.value.clearCheckboxRow();
|
|
|
+ checkTable.value = [];
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ state.loading = false;
|
|
|
+ gridOptions.loading = false;
|
|
|
+ gridRef.value.clearCheckboxRow();
|
|
|
+ checkTable.value = [];
|
|
|
+ });
|
|
|
+};
|
|
|
+// 重置表单
|
|
|
+const resetQuery = (formEl: FormInstance | undefined) => {
|
|
|
+ if (!formEl) return;
|
|
|
+ formEl.resetFields();
|
|
|
+ queryList();
|
|
|
+};
|
|
|
+// 预览
|
|
|
+const router = useRouter();
|
|
|
+const onPreview = (row: any) => {
|
|
|
+ router.push({
|
|
|
+ name: 'knowledgePreview',
|
|
|
+ params: {
|
|
|
+ id: row.id,
|
|
|
+ tagsViewName: row.title,
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+// 审批
|
|
|
+const knowledgeAuditRef = ref<RefType>();
|
|
|
+const onAudit = (row: any) => {
|
|
|
+ knowledgeAuditRef.value.openDialog(row.id);
|
|
|
+};
|
|
|
+// 批量审核
|
|
|
+const onAuditBatch = () => {
|
|
|
+ const ids = checkTable.value.map((item: any) => item.id);
|
|
|
+ knowledgeAuditRef.value.openDialog(ids, true);
|
|
|
+};
|
|
|
+// 查看历史记录
|
|
|
+const auditHistoryRef = ref<RefType>();
|
|
|
+const onHistory = (row: any) => {
|
|
|
+ auditHistoryRef.value.openDialog(row);
|
|
|
+};
|
|
|
+const checkTable = ref<EmptyArrayType>([]);
|
|
|
+const gridRef = ref<RefType>();
|
|
|
+const selectAllChangeEvent = ({ checked }) => {
|
|
|
+ if (gridRef.value) {
|
|
|
+ const records = gridRef.value.getCheckboxRecords();
|
|
|
+ checkTable.value = records;
|
|
|
+ console.log(checked ? '所有勾选事件' : '所有取消事件', records);
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
-</style>
|
|
|
+const selectChangeEvent = ({ checked }) => {
|
|
|
+ if (gridRef.value) {
|
|
|
+ const records = gridRef.value.getCheckboxRecords();
|
|
|
+ checkTable.value = records;
|
|
|
+ console.log(checked ? '勾选事件' : '取消事件', records);
|
|
|
+ }
|
|
|
+};
|
|
|
+const isChecked = computed(() => {
|
|
|
+ return !Boolean(checkTable.value.length);
|
|
|
+});
|
|
|
+// 页面加载时
|
|
|
+onMounted(() => {
|
|
|
+ queryList();
|
|
|
+});
|
|
|
+</script>
|