调整单位信息

This commit is contained in:
2025-10-27 10:34:30 +08:00
parent 5e34284eb2
commit ec1ca90d90
2 changed files with 433 additions and 317 deletions

View File

@@ -1,7 +1,8 @@
VITE_APP_NAME=后台管理系统 VITE_APP_NAME=后台管理系统
VITE_SOCKET_URL=wss://server.websoft.top VITE_SOCKET_URL=wss://server.websoft.top
VITE_SERVER_URL=https://server.websoft.top/api VITE_SERVER_URL=https://server.websoft.top/api
VITE_API_URL=https://cms-api.websoft.top/api #VITE_API_URL=https://cms-api.websoft.top/api
VITE_API_URL=http://1.14.159.185:9200/api
#VITE_SOCKET_URL=ws://127.0.0.1:9191 #VITE_SOCKET_URL=ws://127.0.0.1:9191
#VITE_SERVER_URL=http://127.0.0.1:8000/api #VITE_SERVER_URL=http://127.0.0.1:8000/api

View File

@@ -1,7 +1,7 @@
<template> <template>
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)"> <a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
<template #subTitle> <template #subTitle>
<div style="width: 300px;margin-left: 100px"> <div style="width: 300px; margin-left: 100px">
<a-steps :current="0" size="small"> <a-steps :current="0" size="small">
<a-step title="单位信息" /> <a-step title="单位信息" />
<a-step title="项目管理" /> <a-step title="项目管理" />
@@ -42,14 +42,15 @@
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<a-space> <a-space>
<a @click="openEdit(record)">修改</a> <a @click="openEdit(record)">修改</a>
<a-divider type="vertical"/> <a-divider type="vertical" />
<!-- 文档管理按钮 --> <!-- 文档管理按钮 -->
<a <a
:class="{ 'disabled-text': !record.kbId }" :class="{ 'disabled-text': !record.kbId }"
:style="!record.kbId ? 'cursor: not-allowed; color: #999' : ''" :style="!record.kbId ? 'cursor: not-allowed; color: #999' : ''"
@click="record.kbId && openDocManage(record)" @click="record.kbId && openDocManage(record)"
>文档管理</a> >文档管理</a
<a-divider type="vertical"/> >
<a-divider type="vertical" />
<a-popconfirm <a-popconfirm
title="确定要删除此记录吗?" title="确定要删除此记录吗?"
@confirm="remove(record)" @confirm="remove(record)"
@@ -63,38 +64,59 @@
</a-card> </a-card>
<!-- 编辑弹窗 --> <!-- 编辑弹窗 -->
<OaCompanyEdit v-model:visible="showEdit" :data="current" @done="reload"/> <OaCompanyEdit v-model:visible="showEdit" :data="current" @done="reload" />
<!-- 文档管理弹窗 --> <!-- 文档管理弹窗 -->
<a-modal <a-modal
v-model:visible="showDocManage" v-model:visible="showDocManage"
:title="`文档管理 - ${currentKbName}`" :title="`文档管理 - ${currentKbName}`"
width="800px" width="800px"
:footer="null" :footer="null"
> >
<div style="margin-bottom: 16px;"> <div style="margin-bottom: 16px">
<a-button type="primary" @click="openImport">新增文档</a-button> <p class="text-red-500 mb-1" style="padding-left: calc(88px + 0.5rem)">请选择分类上传资料</p>
<div class="flex justify-start items-start">
<a-button type="primary" @click="openImport">新增文档</a-button>
<div class="ml-2">
<div class="flex justify-start items-center flex-wrap">
<span
@click="activeTag = item.id"
:class="[activeTag === item.id ? 'tag-active' : '']"
class="tag"
v-for="(item, index) in tagList"
:key="index"
:title="item.description"
>{{ item.title }}</span
>
</div>
</div>
</div>
</div> </div>
<a-table <a-table
:dataSource="docList" :dataSource="docList"
:columns="docColumns" :columns="docColumns"
:loading="docLoading" :loading="docLoading"
rowKey="id" rowKey="id"
:pagination="{ :pagination="{
current: currentPage, current: currentPage,
pageSize: 10, pageSize: 10,
total: total, total: total,
showSizeChanger: false, showSizeChanger: false,
showTotal: (total) => `共 ${total} 条` showTotal: (total) => `共 ${total} 条`
}" }"
@change="(pag) => { currentPage = pag.current; loadDocuments(); }" @change="
(pag) => {
currentPage = pag.current;
loadDocuments();
}
"
> >
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<a-space> <a-space>
<a-popconfirm <a-popconfirm
title="确定要删除此文档吗?" title="确定要删除此文档吗?"
@confirm="deleteDoc(record)" @confirm="deleteDoc(record)"
> >
<a class="ele-text-danger">删除</a> <a class="ele-text-danger">删除</a>
</a-popconfirm> </a-popconfirm>
@@ -105,318 +127,411 @@
</a-modal> </a-modal>
<!-- 导入弹窗 --> <!-- 导入弹窗 -->
<Import v-model:visible="showImport" @done="loadDocuments" :kbId="currentKbId"/> <Import
v-model:visible="showImport"
@done="loadDocuments"
:kbId="currentKbId"
/>
</a-page-header> </a-page-header>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {createVNode, ref} from 'vue'; import { createVNode, ref } from 'vue';
import {message, Modal} from 'ant-design-vue'; import { message, Modal } from 'ant-design-vue';
import {ExclamationCircleOutlined} from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type {EleProTable} from 'ele-admin-pro'; import type { EleProTable } from 'ele-admin-pro';
import {toDateString} from 'ele-admin-pro'; import { toDateString } from 'ele-admin-pro';
import type { import type {
DatasourceFunction, DatasourceFunction,
ColumnItem ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types'; } from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue'; import Search from './components/search.vue';
import OaCompanyEdit from './components/oaCompanyEdit.vue'; import OaCompanyEdit from './components/oaCompanyEdit.vue';
// 导入Import组件和API // 导入Import组件和API
import Import from './components/Import.vue'; import Import from './components/Import.vue';
import {pageOaCompany, removeOaCompany, removeBatchOaCompany} from '@/api/oa/oaCompany'; import {
import type {OaCompany, OaCompanyParam} from '@/api/oa/oaCompany/model'; pageOaCompany,
import {getPageTitle,isImage} from "@/utils/common"; removeOaCompany,
// 导入知识库API removeBatchOaCompany
import {getKnowledgeBaseDocuments, deleteKnowledgeBaseDocument} from '@/api/ai/knowledgeBase'; // 请修改为正确的API路径 } from '@/api/oa/oaCompany';
import type { OaCompany, OaCompanyParam } from '@/api/oa/oaCompany/model';
import { getPageTitle, isImage } from '@/utils/common';
// 导入知识库API
import {
getKnowledgeBaseDocuments,
deleteKnowledgeBaseDocument
} from '@/api/ai/knowledgeBase'; // 请修改为正确的API路径
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格选中数据 // 表格选中数据
const selection = ref<OaCompany[]>([]); const selection = ref<OaCompany[]>([]);
// 当前编辑数据 // 当前编辑数据
const current = ref<OaCompany | null>(null); const current = ref<OaCompany | null>(null);
// 是否显示编辑弹窗 // 是否显示编辑弹窗
const showEdit = ref(false); const showEdit = ref(false);
// 是否显示批量移动弹窗 // 是否显示批量移动弹窗
const showMove = ref(false); const showMove = ref(false);
// 文档管理相关响应式变量 // 文档管理相关响应式变量
const showDocManage = ref(false); // 是否显示文档管理弹窗 const showDocManage = ref(false); // 是否显示文档管理弹窗
const showImport = ref(false); // 是否显示导入弹窗 const showImport = ref(false); // 是否显示导入弹窗
// 加载状态 // 加载状态
const loading = ref(true); const loading = ref(true);
// 新增分页状态变量 // 新增分页状态变量
const currentPage = ref(1); const currentPage = ref(1);
const total = ref(0); const total = ref(0);
// 文档管理相关变量 // 文档管理相关变量
const currentKbId = ref(''); // 当前知识库ID const currentKbId = ref(''); // 当前知识库ID
const currentKbName = ref(''); // 当前知识库名称 const currentKbName = ref(''); // 当前知识库名称
const docList = ref<any[]>([]); // 文档列表数据 const docList = ref<any[]>([]); // 文档列表数据
const docLoading = ref(false); // 文档加载状态 const docLoading = ref(false); // 文档加载状态
// 文档表格列配置 // 文档表格列配置
const docColumns = ref([ const docColumns = ref([
{ {
title: '文件名', title: '文件名',
dataIndex: 'name', // 改为接口返回的name字段 dataIndex: 'name', // 改为接口返回的name字段
key: 'fileName', key: 'fileName'
}, },
{ {
title: '文件大小', title: '文件大小',
dataIndex: 'size', // 改为接口返回的size字段 dataIndex: 'size', // 改为接口返回的size字段
key: 'fileSize', key: 'fileSize'
}, },
{ {
title: '上传时间', title: '上传时间',
dataIndex: 'gmtModified', // 改为接口返回的gmtModified字段 dataIndex: 'gmtModified', // 改为接口返回的gmtModified字段
key: 'createTime', key: 'createTime',
customRender: ({ text }) => toDateString(text) // 添加时间格式化 customRender: ({ text }) => toDateString(text) // 添加时间格式化
}, },
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
width: 100, width: 100
} }
]); ]);
// 表格数据源 // 表格数据源
const datasource: DatasourceFunction = ({ const datasource: DatasourceFunction = ({
page,
limit,
where,
orders,
filters
}) => {
if (filters) {
where.status = filters.status;
}
return pageOaCompany({
...where,
...orders,
page, page,
limit limit,
}); where,
}; orders,
filters
}) => {
if (filters) {
where.status = filters.status;
}
return pageOaCompany({
...where,
...orders,
page,
limit
});
};
// 表格列配置 // 表格列配置
const columns = ref<ColumnItem[]>([ const columns = ref<ColumnItem[]>([
{ {
title: 'ID', title: 'ID',
dataIndex: 'companyId', dataIndex: 'companyId',
key: 'companyId', key: 'companyId',
align: 'center', align: 'center',
hideInTable: true, hideInTable: true,
width: 90, width: 90
}, },
{ {
title: 'LOGO', title: 'LOGO',
dataIndex: 'companyLogo', dataIndex: 'companyLogo',
key: 'companyLogo', key: 'companyLogo',
align: 'center', align: 'center'
}, },
{ {
title: '单位名称', title: '单位名称',
dataIndex: 'companyName', dataIndex: 'companyName',
key: 'companyName', key: 'companyName',
align: 'center', align: 'center'
}, },
{ {
title: '单位标识', title: '单位标识',
dataIndex: 'companyCode', dataIndex: 'companyCode',
key: 'companyCode', key: 'companyCode',
align: 'center', align: 'center'
}, },
// { // {
// title: '类型', // title: '类型',
// dataIndex: 'companyType', // dataIndex: 'companyType',
// key: 'companyType', // key: 'companyType',
// align: 'center', // align: 'center',
// }, // },
{ {
title: '推荐', title: '推荐',
dataIndex: 'recommend', dataIndex: 'recommend',
key: 'recommend', key: 'recommend',
align: 'center', align: 'center'
}, },
{ {
title: '状态', title: '状态',
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
align: 'center', align: 'center'
}, },
// { // {
// title: '备注', // title: '备注',
// dataIndex: 'comments', // dataIndex: 'comments',
// key: 'comments', // key: 'comments',
// align: 'center', // align: 'center',
// }, // },
{ {
title: '排序号', title: '排序号',
dataIndex: 'sortNumber', dataIndex: 'sortNumber',
key: 'sortNumber', key: 'sortNumber',
align: 'center', align: 'center'
}, },
{ {
title: '创建时间', title: '创建时间',
dataIndex: 'createTime', dataIndex: 'createTime',
key: 'createTime', key: 'createTime',
align: 'center', align: 'center',
sorter: true, sorter: true,
ellipsis: true ellipsis: true
}, },
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
width: 220, width: 220,
fixed: 'right', fixed: 'right',
align: 'center', align: 'center',
hideInSetting: true hideInSetting: true
} }
]); ]);
/* 搜索 */ /* 搜索 */
const reload = (where?: OaCompanyParam) => { const reload = (where?: OaCompanyParam) => {
selection.value = []; selection.value = [];
tableRef?.value?.reload({where: where}); tableRef?.value?.reload({ where: where });
}; };
/* 打开编辑弹窗 */ /* 打开编辑弹窗 */
const openEdit = (row?: OaCompany) => { const openEdit = (row?: OaCompany) => {
current.value = row ?? null; current.value = row ?? null;
showEdit.value = true; showEdit.value = true;
}; };
/* 打开批量移动弹窗 */ /* 打开批量移动弹窗 */
const openMove = () => { const openMove = () => {
showMove.value = true; showMove.value = true;
}; };
// 打开文档管理弹窗 // 打开文档管理弹窗
const openDocManage = (record: OaCompany) => { const openDocManage = (record: OaCompany) => {
currentKbId.value = record.kbId; // 使用record中的kbId currentKbId.value = record.kbId; // 使用record中的kbId
currentKbName.value = record.companyName; // 使用单位名称作为知识库名称 currentKbName.value = record.companyName; // 使用单位名称作为知识库名称
currentPage.value = 1; currentPage.value = 1;
showDocManage.value = true; showDocManage.value = true;
loadDocuments(); loadDocuments();
}; };
// 加载文档列表 // 加载文档列表
const loadDocuments = async () => { const loadDocuments = async () => {
docLoading.value = true; docLoading.value = true;
try { try {
const response = await getKnowledgeBaseDocuments( const response = await getKnowledgeBaseDocuments(
currentKbId.value, currentKbId.value,
10, 10,
currentPage.value currentPage.value
); );
docList.value = Array.isArray(response?.list) ? response.list : []; docList.value = Array.isArray(response?.list) ? response.list : [];
total.value = response?.count || 0; total.value = response?.count || 0;
} catch (error) { } catch (error) {
message.error('加载文档列表失败'); message.error('加载文档列表失败');
console.error('加载文档错误:', error); console.error('加载文档错误:', error);
} finally { } finally {
docLoading.value = false; docLoading.value = false;
}
};
// 删除文档
const deleteDoc = async (record: any) => {
try {
// 执行删除操作
await deleteKnowledgeBaseDocument(currentKbId.value, record.id);
// 立即本地删除(核心修改)
const index = docList.value.findIndex(item => item.id === record.id);
if (index > -1) {
docList.value.splice(index, 1);
total.value -= 1;
}
message.success('删除成功');
// 阿里云异步删除,需等待异步删除完成再重新查询
// await loadDocuments();
} catch (error) {
message.error('删除失败');
console.error(error);
}
};
// 打开导入弹窗
const openImport = () => {
showImport.value = true;
};
/* 删除单个 */
const remove = (row: OaCompany) => {
const hide = message.loading('请求中..', 0);
removeOaCompany(row.companyId)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
}
Modal.confirm({
title: '提示',
content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchOaCompany(selection.value.map((d) => d.oaCompanyId))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
};
/* 查询 */
const query = () => {
loading.value = true;
};
/* 自定义行属性 */
const customRow = (record: OaCompany) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
},
// 行双击事件
onDblclick: () => {
openEdit(record);
} }
}; };
};
query(); // 删除文档
const deleteDoc = async (record: any) => {
try {
// 执行删除操作
await deleteKnowledgeBaseDocument(currentKbId.value, record.id);
// 立即本地删除(核心修改)
const index = docList.value.findIndex((item) => item.id === record.id);
if (index > -1) {
docList.value.splice(index, 1);
total.value -= 1;
}
message.success('删除成功');
// 阿里云异步删除,需等待异步删除完成再重新查询
// await loadDocuments();
} catch (error) {
message.error('删除失败');
console.error(error);
}
};
// 打开导入弹窗
const openImport = () => {
showImport.value = true;
};
/* 删除单个 */
const remove = (row: OaCompany) => {
const hide = message.loading('请求中..', 0);
removeOaCompany(row.companyId)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
}
Modal.confirm({
title: '提示',
content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchOaCompany(selection.value.map((d) => d.oaCompanyId))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
};
/* 查询 */
const query = () => {
loading.value = true;
};
/* 自定义行属性 */
const customRow = (record: OaCompany) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
},
// 行双击事件
onDblclick: () => {
openEdit(record);
}
};
};
query();
const activeTag = ref(1);
const tagList = ref([
{
id: 1,
description:
'贯彻执行党和国家有关经济方针政策和决策部署,落实局党组、局工作部署要求,推动单位可持续发展情况;',
title: '贯彻决策部署'
},
{
id: 2,
description: '单位发展战略规划的制定、执行和效果情况;',
title: '单位发展战略执行'
},
{
id: 3,
description:
'重大经济事项的决策、执行和效果情况,具体包括重大预算管理、重大项目实施、重大采购项目、重大投资项目、重大外包业务、重大资产处置、大额资金使用的决策和执行情况等;',
title: '三重一大执行'
},
{
id: 4,
description: '有关目标责任制完成情况;',
title: '目标完成'
},
{
id: 5,
description:
'财政财务管理情况。包括预算编制的完整准确、预算调整审批的合规,以及预算支出的真实合法合规情况;财务收支的真实、合法和效益情况;自然资源资产管理和生态环境保护责任的履行情况;对外投资经济活动的真实、合法和效益情况;',
title: '财务管理'
},
{
id: 6,
description: '国有资产采购、管理、使用和处置情况;',
title: '国资管理'
},
{
id: 7,
description: '重要经济项目的投资、建设、管理及效益情况;',
title: '重大投资情况'
},
{
id: 8,
description:
'企业法人治理结构、内部控制和风险管理情况。主要包括企业法人治理结构的建立、健全和运行情况,以及财务管理、业务管理、风险管理、内部审计等内部控制制度的制定和执行情况,以及对所属单位有关经济活动的管理和监督情况。业务管理主要包括采购业务、收支业务、资产管理、勘察项目管理、筹资与担保业务管理、合同管理、业务外包、信息系统管理、全面预算等;',
title: '治理结构'
},
{
id: 9,
description:
'在预算管理中执行机构编制管理规定情况(主要是对借用人员和编外用工管理,规范人员经费的使用);',
title: '人员编制'
},
{
id: 10,
description:
'在经济活动中落实有关党风廉政建设责任和遵守廉洁从业规定情况,主要是在经济活动中领导干部落实职责范围内党风廉政建设责任、遵守中央八项规定及实施细则精神和廉洁从业有关规定情况。',
title: '廉政情况'
},
{
id: 11,
description:
'以往审计发现问题的整改情况。包括整改制度的制定、整改工作的实施、整改措施的落实和整改效果等情况。',
title: '历史审计问题'
}
]);
</script> </script>
<script lang="ts"> <script lang="ts">
export default { export default {
name: 'OaCompany' name: 'OaCompany'
}; };
</script> </script>
<style scoped> <style scoped>
/* 修改已完成步骤的连接线颜色 */ /* 修改已完成步骤的连接线颜色 */
.ant-steps-item-finish > .ant-steps-item-container > .ant-steps-item-tail::after { .ant-steps-item-finish
background-color: red !important; /* 自定义颜色 */ > .ant-steps-item-container
} > .ant-steps-item-tail::after {
background-color: red !important; /* 自定义颜色 */
}
.tag {
color: grey;
border: 1px solid grey;
padding: 2px 5px;
border-radius: 5px;
margin: 0 8px 8px 0;
cursor: pointer;
}
.tag-active {
color: #3b82f6 !important;
border: 1px solid #3b82f6 !important;
}
</style> </style>