调整单位信息

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_SOCKET_URL=wss://server.websoft.top
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_SERVER_URL=http://127.0.0.1:8000/api

View File

@@ -1,7 +1,7 @@
<template>
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
<template #subTitle>
<div style="width: 300px;margin-left: 100px">
<div style="width: 300px; margin-left: 100px">
<a-steps :current="0" size="small">
<a-step title="单位信息" />
<a-step title="项目管理" />
@@ -42,14 +42,15 @@
<template v-if="column.key === 'action'">
<a-space>
<a @click="openEdit(record)">修改</a>
<a-divider type="vertical"/>
<a-divider type="vertical" />
<!-- 文档管理按钮 -->
<a
:class="{ 'disabled-text': !record.kbId }"
:style="!record.kbId ? 'cursor: not-allowed; color: #999' : ''"
@click="record.kbId && openDocManage(record)"
>文档管理</a>
<a-divider type="vertical"/>
>文档管理</a
>
<a-divider type="vertical" />
<a-popconfirm
title="确定要删除此记录吗?"
@confirm="remove(record)"
@@ -63,7 +64,7 @@
</a-card>
<!-- 编辑弹窗 -->
<OaCompanyEdit v-model:visible="showEdit" :data="current" @done="reload"/>
<OaCompanyEdit v-model:visible="showEdit" :data="current" @done="reload" />
<!-- 文档管理弹窗 -->
<a-modal
@@ -72,8 +73,24 @@
width="800px"
:footer="null"
>
<div style="margin-bottom: 16px;">
<div style="margin-bottom: 16px">
<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>
<a-table
:dataSource="docList"
@@ -87,7 +104,12 @@
showSizeChanger: false,
showTotal: (total) => `共 ${total} 条`
}"
@change="(pag) => { currentPage = pag.current; loadDocuments(); }"
@change="
(pag) => {
currentPage = pag.current;
loadDocuments();
}
"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
@@ -105,66 +127,77 @@
</a-modal>
<!-- 导入弹窗 -->
<Import v-model:visible="showImport" @done="loadDocuments" :kbId="currentKbId"/>
<Import
v-model:visible="showImport"
@done="loadDocuments"
:kbId="currentKbId"
/>
</a-page-header>
</template>
<script lang="ts" setup>
import {createVNode, ref} from 'vue';
import {message, Modal} from 'ant-design-vue';
import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
import type {EleProTable} from 'ele-admin-pro';
import {toDateString} from 'ele-admin-pro';
import type {
import { createVNode, ref } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro';
import { toDateString } from 'ele-admin-pro';
import type {
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import OaCompanyEdit from './components/oaCompanyEdit.vue';
// 导入Import组件和API
import Import from './components/Import.vue';
import {pageOaCompany, removeOaCompany, removeBatchOaCompany} 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路径
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import OaCompanyEdit from './components/oaCompanyEdit.vue';
// 导入Import组件和API
import Import from './components/Import.vue';
import {
pageOaCompany,
removeOaCompany,
removeBatchOaCompany
} 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 current = ref<OaCompany | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 是否显示批量移动弹窗
const showMove = ref(false);
// 文档管理相关响应式变量
const showDocManage = ref(false); // 是否显示文档管理弹窗
const showImport = ref(false); // 是否显示导入弹窗
// 加载状态
const loading = ref(true);
// 新增分页状态变量
const currentPage = ref(1);
const total = ref(0);
// 表格选中数据
const selection = ref<OaCompany[]>([]);
// 当前编辑数据
const current = ref<OaCompany | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 是否显示批量移动弹窗
const showMove = ref(false);
// 文档管理相关响应式变量
const showDocManage = ref(false); // 是否显示文档管理弹窗
const showImport = ref(false); // 是否显示导入弹窗
// 加载状态
const loading = ref(true);
// 新增分页状态变量
const currentPage = ref(1);
const total = ref(0);
// 文档管理相关变量
const currentKbId = ref(''); // 当前知识库ID
const currentKbName = ref(''); // 当前知识库名称
const docList = ref<any[]>([]); // 文档列表数据
const docLoading = ref(false); // 文档加载状态
// 文档表格列配置
const docColumns = ref([
// 文档管理相关变量
const currentKbId = ref(''); // 当前知识库ID
const currentKbName = ref(''); // 当前知识库名称
const docList = ref<any[]>([]); // 文档列表数据
const docLoading = ref(false); // 文档加载状态
// 文档表格列配置
const docColumns = ref([
{
title: '文件名',
dataIndex: 'name', // 改为接口返回的name字段
key: 'fileName',
key: 'fileName'
},
{
title: '文件大小',
dataIndex: 'size', // 改为接口返回的size字段
key: 'fileSize',
key: 'fileSize'
},
{
title: '上传时间',
@@ -175,12 +208,12 @@ const docColumns = ref([
{
title: '操作',
key: 'action',
width: 100,
width: 100
}
]);
]);
// 表格数据源
const datasource: DatasourceFunction = ({
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit,
where,
@@ -196,35 +229,35 @@ const datasource: DatasourceFunction = ({
page,
limit
});
};
};
// 表格列配置
const columns = ref<ColumnItem[]>([
// 表格列配置
const columns = ref<ColumnItem[]>([
{
title: 'ID',
dataIndex: 'companyId',
key: 'companyId',
align: 'center',
hideInTable: true,
width: 90,
width: 90
},
{
title: 'LOGO',
dataIndex: 'companyLogo',
key: 'companyLogo',
align: 'center',
align: 'center'
},
{
title: '单位名称',
dataIndex: 'companyName',
key: 'companyName',
align: 'center',
align: 'center'
},
{
title: '单位标识',
dataIndex: 'companyCode',
key: 'companyCode',
align: 'center',
align: 'center'
},
// {
// title: '类型',
@@ -236,13 +269,13 @@ const columns = ref<ColumnItem[]>([
title: '推荐',
dataIndex: 'recommend',
key: 'recommend',
align: 'center',
align: 'center'
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
align: 'center',
align: 'center'
},
// {
// title: '备注',
@@ -254,7 +287,7 @@ const columns = ref<ColumnItem[]>([
title: '排序号',
dataIndex: 'sortNumber',
key: 'sortNumber',
align: 'center',
align: 'center'
},
{
title: '创建时间',
@@ -272,36 +305,36 @@ const columns = ref<ColumnItem[]>([
align: 'center',
hideInSetting: true
}
]);
]);
/* 搜索 */
const reload = (where?: OaCompanyParam) => {
/* 搜索 */
const reload = (where?: OaCompanyParam) => {
selection.value = [];
tableRef?.value?.reload({where: where});
};
tableRef?.value?.reload({ where: where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: OaCompany) => {
/* 打开编辑弹窗 */
const openEdit = (row?: OaCompany) => {
current.value = row ?? null;
showEdit.value = true;
};
};
/* 打开批量移动弹窗 */
const openMove = () => {
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
};
};
// 打开文档管理弹窗
const openDocManage = (record: OaCompany) => {
// 打开文档管理弹窗
const openDocManage = (record: OaCompany) => {
currentKbId.value = record.kbId; // 使用record中的kbId
currentKbName.value = record.companyName; // 使用单位名称作为知识库名称
currentPage.value = 1;
showDocManage.value = true;
loadDocuments();
};
};
// 加载文档列表
const loadDocuments = async () => {
// 加载文档列表
const loadDocuments = async () => {
docLoading.value = true;
try {
const response = await getKnowledgeBaseDocuments(
@@ -317,16 +350,16 @@ const loadDocuments = async () => {
} finally {
docLoading.value = false;
}
};
};
// 删除文档
const deleteDoc = async (record: any) => {
// 删除文档
const deleteDoc = async (record: any) => {
try {
// 执行删除操作
await deleteKnowledgeBaseDocument(currentKbId.value, record.id);
// 立即本地删除(核心修改)
const index = docList.value.findIndex(item => item.id === record.id);
const index = docList.value.findIndex((item) => item.id === record.id);
if (index > -1) {
docList.value.splice(index, 1);
total.value -= 1;
@@ -338,15 +371,15 @@ const deleteDoc = async (record: any) => {
message.error('删除失败');
console.error(error);
}
};
};
// 打开导入弹窗
const openImport = () => {
// 打开导入弹窗
const openImport = () => {
showImport.value = true;
};
};
/* 删除单个 */
const remove = (row: OaCompany) => {
/* 删除单个 */
const remove = (row: OaCompany) => {
const hide = message.loading('请求中..', 0);
removeOaCompany(row.companyId)
.then((msg) => {
@@ -358,10 +391,10 @@ const remove = (row: OaCompany) => {
hide();
message.error(e.message);
});
};
};
/* 批量删除 */
const removeBatch = () => {
/* 批量删除 */
const removeBatch = () => {
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
@@ -385,15 +418,15 @@ const removeBatch = () => {
});
}
});
};
};
/* 查询 */
const query = () => {
/* 查询 */
const query = () => {
loading.value = true;
};
};
/* 自定义行属性 */
const customRow = (record: OaCompany) => {
/* 自定义行属性 */
const customRow = (record: OaCompany) => {
return {
// 行点击事件
onClick: () => {
@@ -404,19 +437,101 @@ const customRow = (record: OaCompany) => {
openEdit(record);
}
};
};
query();
};
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 lang="ts">
export default {
export default {
name: 'OaCompany'
};
};
</script>
<style scoped>
/* 修改已完成步骤的连接线颜色 */
.ant-steps-item-finish > .ant-steps-item-container > .ant-steps-item-tail::after {
/* 修改已完成步骤的连接线颜色 */
.ant-steps-item-finish
> .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>