删除无用代码, 工具类和 组件 没有删除 , 以后可以借鉴写法和创建规则
This commit is contained in:
@ -1,31 +0,0 @@
|
||||
import React from 'react';
|
||||
import { HeartTwoTone, SmileTwoTone } from '@ant-design/icons';
|
||||
import { Card, Typography, Alert } from 'antd';
|
||||
import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
||||
|
||||
export default (): React.ReactNode => (
|
||||
<PageHeaderWrapper content=" 这个页面只有 admin 权限才能查看">
|
||||
<Card>
|
||||
<Alert
|
||||
message="umi ui 现已发布,欢迎使用 npm run ui 启动体验。"
|
||||
type="success"
|
||||
showIcon
|
||||
banner
|
||||
style={{
|
||||
margin: -12,
|
||||
marginBottom: 48,
|
||||
}}
|
||||
/>
|
||||
<Typography.Title level={2} style={{ textAlign: 'center' }}>
|
||||
<SmileTwoTone /> Ant Design Pro <HeartTwoTone twoToneColor="#eb2f96" /> You
|
||||
</Typography.Title>
|
||||
</Card>
|
||||
<p style={{ textAlign: 'center', marginTop: 24 }}>
|
||||
Want to add more pages? Please refer to{' '}
|
||||
<a href="https://pro.ant.design/docs/block-cn" target="_blank" rel="noopener noreferrer">
|
||||
use block
|
||||
</a>
|
||||
。
|
||||
</p>
|
||||
</PageHeaderWrapper>
|
||||
);
|
@ -1,51 +0,0 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 字典项类型定义
|
||||
export interface DictionaryItem {
|
||||
id: string;
|
||||
code: string;
|
||||
dicName: string;
|
||||
dictTypeCode: string,
|
||||
dictTypeName: string,
|
||||
parentCode: string,
|
||||
parentType: string,
|
||||
orderFlag: number;
|
||||
description: string;
|
||||
createTime: string;
|
||||
updateTime: string;
|
||||
}
|
||||
|
||||
// 获取字典列表
|
||||
// export const fetchDictionaries = async (): Promise<DictionaryItem[]> => {
|
||||
// const response = await axios.get('/api/sys-manager-ebtp-project/v1/dictProject/getDictList?parentCode=procurement_type&toParentCode=entrust');
|
||||
// return response.data.data;
|
||||
// };
|
||||
|
||||
const prefix = '/api/sys-manager-ebtp-project/';
|
||||
|
||||
export async function fetchDictionaries(params: any) {
|
||||
return request(prefix + 'v1/dictProject/selectDictList', {
|
||||
params: params,
|
||||
method: 'GET'
|
||||
});
|
||||
}
|
||||
|
||||
export async function createDictionary(params: any) {
|
||||
return request(prefix + 'v1/dictProject', {
|
||||
data: params,
|
||||
method: 'POST'
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateDictionary(params: any) {
|
||||
return request(prefix + 'v1/dictProject', {
|
||||
data: params,
|
||||
method: 'POST'
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteDictionary(param: any) {
|
||||
return request(prefix + 'v1/dictProject/delete/' + param, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
@ -1,386 +0,0 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Table, Space, Button, Modal, Form, Input, Popconfirm, message, Tag } from 'antd';
|
||||
import { DeleteOutlined, EditOutlined, PlusOutlined, SearchOutlined, CheckCircleOutlined, CaretRightOutlined, CaretDownOutlined } from '@ant-design/icons';
|
||||
import {DictionaryItem, createDictionary, updateDictionary, deleteDictionary, fetchDictionaries} from './DictService';
|
||||
|
||||
interface DictionaryListProps {}
|
||||
|
||||
const DictionaryList: React.FC<DictionaryListProps> = () => {
|
||||
const [dataSource, setDataSource] = useState<DictionaryItem[]>([]);
|
||||
const [form] = Form.useForm();
|
||||
const [searchForm] = Form.useForm();
|
||||
const [isModalVisible, setIsModalVisible] = useState(false);
|
||||
const [modalTitle, setModalTitle] = useState('');
|
||||
const [currentId, setCurrentId] = useState<string | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [searchParams, setSearchParams] = useState({
|
||||
parentCode: '',
|
||||
parentType: ''
|
||||
});
|
||||
// 选中的行ID
|
||||
const [selectedRowId, setSelectedRowId] = useState<string | null>(null);
|
||||
// 选中的行数据
|
||||
const [selectedRow, setSelectedRow] = useState<DictionaryItem | null>(null);
|
||||
// 展开的行ID
|
||||
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
||||
// 是否为新增子节点模式
|
||||
const [isChildAddMode, setIsChildAddMode] = useState(false);
|
||||
|
||||
// const tableData: DictionaryItem[] = [
|
||||
// {
|
||||
// "id": '1164',
|
||||
// "code": "code",
|
||||
// "dicName": "行政区划",
|
||||
// "parentCode": '',
|
||||
// "parentType": "",
|
||||
// "orderFlag": 0,
|
||||
// "description": '',
|
||||
// "children": [
|
||||
// {
|
||||
// "id": 1163,
|
||||
// "code": "province",
|
||||
// "dicName": "省份",
|
||||
// "parentCode": "code",
|
||||
// "parentType": "行政区划",
|
||||
// "orderFlag": 1,
|
||||
// "description": ''
|
||||
// },
|
||||
// {
|
||||
// "id": 1162,
|
||||
// "code": "city",
|
||||
// "dicName": "地市",
|
||||
// "parentCode": "code",
|
||||
// "parentType": "行政区域",
|
||||
// "orderFlag": 3,
|
||||
// "description": ''
|
||||
// },
|
||||
// {
|
||||
// "id": 1161,
|
||||
// "code": "distict",
|
||||
// "dicName": "区县",
|
||||
// "parentCode": "code",
|
||||
// "parentType": "行政区域",
|
||||
// "orderFlag": 4,
|
||||
// "description": "区县级"
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// ];
|
||||
|
||||
const fetchData = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const result = await fetchDictionaries(searchParams); // 传递搜索参数
|
||||
setDataSource(result.data);
|
||||
} catch (error) {
|
||||
message.error('获取字典列表失败');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchData();
|
||||
}, [searchParams]);
|
||||
|
||||
const handleAdd = () => {
|
||||
form.resetFields();
|
||||
setModalTitle('新增字典');
|
||||
setIsModalVisible(true);
|
||||
setCurrentId(null);
|
||||
setIsChildAddMode(false);
|
||||
};
|
||||
|
||||
const handleChildAdd = (record: DictionaryItem) =>{
|
||||
// 先清空表单
|
||||
form.resetFields();
|
||||
// 使用 setTimeout 确保表单重置完成后再设置值
|
||||
setTimeout(() => {
|
||||
form.setFieldsValue({
|
||||
code: '',
|
||||
dicName: '',
|
||||
parentCode: record.code,
|
||||
parentType: record.dicName,
|
||||
orderFlag: '',
|
||||
description: '',
|
||||
});
|
||||
}, 0);
|
||||
|
||||
setModalTitle(`新增${record.dicName}的子字典`);
|
||||
setIsModalVisible(true);
|
||||
setCurrentId(null);
|
||||
setIsChildAddMode(true);
|
||||
}
|
||||
|
||||
const handleEdit = (record: DictionaryItem) => {
|
||||
form.resetFields();
|
||||
|
||||
setTimeout(() => {
|
||||
form.setFieldsValue({
|
||||
code: record.code,
|
||||
dicName: record.dicName,
|
||||
parentCode: record.parentCode,
|
||||
parentType: record.parentType,
|
||||
orderFlag: record.orderFlag,
|
||||
description: record.description,
|
||||
});
|
||||
}, 0);
|
||||
|
||||
setModalTitle('编辑字典');
|
||||
setIsModalVisible(true);
|
||||
setCurrentId(record.id);
|
||||
setIsChildAddMode(false);
|
||||
};
|
||||
|
||||
const handleDelete = async (id: string) => {
|
||||
try {
|
||||
await deleteDictionary(id);
|
||||
message.success('删除成功');
|
||||
setSelectedRowId(null);
|
||||
setSelectedRow(null);
|
||||
fetchData();
|
||||
} catch (error) {
|
||||
message.error('删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
const handleRowClick = (record: DictionaryItem) => {
|
||||
if (selectedRowId === record.id) {
|
||||
setSelectedRowId(null);
|
||||
setSelectedRow(null);
|
||||
} else {
|
||||
setSelectedRowId(record.id);
|
||||
setSelectedRow(record);
|
||||
}
|
||||
};
|
||||
|
||||
const handleExpand = (expanded: boolean, record: DictionaryItem) => {
|
||||
if (expanded) {
|
||||
setExpandedRowKeys([...expandedRowKeys, record.id]);
|
||||
} else {
|
||||
setExpandedRowKeys(expandedRowKeys.filter(key => key !== record.id));
|
||||
}
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
const values = await form.validateFields();
|
||||
if (currentId) {
|
||||
values.id = currentId;
|
||||
await updateDictionary(values);
|
||||
message.success('更新成功');
|
||||
} else {
|
||||
await createDictionary(values);
|
||||
message.success('创建成功');
|
||||
}
|
||||
setIsModalVisible(false);
|
||||
fetchData();
|
||||
} catch (error) {
|
||||
message.error(error.message || '操作失败');
|
||||
}
|
||||
};
|
||||
|
||||
const handleSearch = (values: any) => {
|
||||
setSearchParams({
|
||||
parentCode: values.parentCode || '',
|
||||
parentType: values.parentType || ''
|
||||
});
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
searchForm.resetFields();
|
||||
setSearchParams({
|
||||
parentCode: '',
|
||||
parentType: ''
|
||||
});
|
||||
};
|
||||
|
||||
const expandIcon = ({ expanded, onExpand, record }: any) => {
|
||||
if (record.children && record.children.length > 0) {
|
||||
return (
|
||||
<span onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onExpand(record);
|
||||
}}>
|
||||
{expanded ? <CaretDownOutlined /> : <CaretRightOutlined />}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '字典编号',
|
||||
dataIndex: 'code',
|
||||
key: 'code',
|
||||
},
|
||||
{
|
||||
title: '字典名称',
|
||||
dataIndex: 'dicName',
|
||||
key: 'dicName',
|
||||
},
|
||||
{
|
||||
title: '分组编码',
|
||||
dataIndex: 'parentCode',
|
||||
key: 'parentCode',
|
||||
},
|
||||
{
|
||||
title: '分组名称',
|
||||
dataIndex: 'parentType',
|
||||
key: 'parentType',
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'orderFlag',
|
||||
key: 'orderFlag',
|
||||
},
|
||||
{
|
||||
title: '描述',
|
||||
dataIndex: 'description',
|
||||
key: 'description',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
render: (_: any, record: DictionaryItem) => (
|
||||
<Space size="middle">
|
||||
<Button icon={<PlusOutlined />} onClick={() => handleChildAdd(record)}>
|
||||
新增
|
||||
</Button>
|
||||
<Button icon={<EditOutlined />} onClick={() => handleEdit(record)}>
|
||||
编辑
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除吗?"
|
||||
onConfirm={() => handleDelete(record.id)}
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<Button icon={<DeleteOutlined />} danger>
|
||||
删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Form
|
||||
form={searchForm}
|
||||
layout="inline"
|
||||
onFinish={handleSearch}
|
||||
style={{ marginBottom: 16 }}
|
||||
>
|
||||
<Form.Item name="parentCode" label="分组编码">
|
||||
<Input placeholder="请输入分组编码" />
|
||||
</Form.Item>
|
||||
<Form.Item name="parentType" label="分组名称">
|
||||
<Input placeholder="请输入分组名称" />
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button type="primary" htmlType="submit" icon={<SearchOutlined />}>
|
||||
搜索
|
||||
</Button>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button onClick={handleReset}>重置</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
|
||||
<div style={{ marginBottom: 16, display: 'flex', alignItems: 'center' }}>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={handleAdd} style={{ marginRight: 8 }}>
|
||||
新增字典
|
||||
</Button>
|
||||
|
||||
|
||||
{selectedRow && (
|
||||
<Tag color="blue" style={{ marginLeft: 'auto' }}>
|
||||
已选择: {selectedRow.dicName} <CheckCircleOutlined />
|
||||
</Tag>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Table
|
||||
dataSource={dataSource}
|
||||
columns={columns}
|
||||
rowKey="id"
|
||||
loading={loading}
|
||||
pagination={{
|
||||
pageSize: 10,
|
||||
}}
|
||||
onRow={(record) => ({
|
||||
onClick: () => handleRowClick(record),
|
||||
style: {
|
||||
cursor: 'pointer',
|
||||
backgroundColor: selectedRowId === record.id ? '#e6f7ff' : 'transparent',
|
||||
},
|
||||
})}
|
||||
expandable={{
|
||||
expandedRowKeys,
|
||||
onExpand: handleExpand,
|
||||
expandIcon,
|
||||
}}
|
||||
/>
|
||||
|
||||
<Modal
|
||||
title={modalTitle}
|
||||
visible={isModalVisible}
|
||||
onCancel={() => setIsModalVisible(false)}
|
||||
onOk={handleSubmit}
|
||||
okText="保存"
|
||||
cancelText="取消"
|
||||
>
|
||||
<Form
|
||||
form={form}
|
||||
name="dictionaryForm"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
initialValues={{ remember: true }}
|
||||
autoComplete="off"
|
||||
>
|
||||
<Form.Item
|
||||
label="分组名称"
|
||||
name="parentType"
|
||||
>
|
||||
{/* 使用 readOnly 替代 disabled,并添加灰色背景 */}
|
||||
<Input
|
||||
readOnly={isChildAddMode}
|
||||
style={isChildAddMode ? { backgroundColor: '#f5f5f5' } : {}}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label="分组编码" name="parentCode">
|
||||
<Input
|
||||
readOnly={isChildAddMode}
|
||||
style={isChildAddMode ? { backgroundColor: '#f5f5f5' } : {}}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="字典名称"
|
||||
name="dicName"
|
||||
rules={[{ required: true, message: '请输入字典名称' }]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="字典编号"
|
||||
name="code"
|
||||
rules={[{ required: true, message: '请输入字典编号' }]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label="排序" name="orderFlag">
|
||||
<Input type="number" />
|
||||
</Form.Item>
|
||||
<Form.Item label="描述" name="description">
|
||||
<Input.TextArea />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default DictionaryList;
|
@ -1,28 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Layout, Breadcrumb } from 'antd';
|
||||
import DictionaryList from './DictionaryList';
|
||||
|
||||
const { Content } = Layout;
|
||||
|
||||
const DictionaryPage: React.FC = () => {
|
||||
return (
|
||||
<Layout style={{ padding: '0 24px 24px' }}>
|
||||
<Breadcrumb style={{ margin: '16px 0' }}>
|
||||
<Breadcrumb.Item>系统管理</Breadcrumb.Item>
|
||||
<Breadcrumb.Item>字典管理</Breadcrumb.Item>
|
||||
</Breadcrumb>
|
||||
<Content
|
||||
style={{
|
||||
background: '#fff',
|
||||
padding: 24,
|
||||
margin: 0,
|
||||
minHeight: 280,
|
||||
}}
|
||||
>
|
||||
<DictionaryList />
|
||||
</Content>
|
||||
</Layout>
|
||||
);
|
||||
};
|
||||
|
||||
export default DictionaryPage;
|
@ -1,189 +0,0 @@
|
||||
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
|
||||
import { Button, Form, Input, message, Modal, PageHeader, Select, Spin, Tree, TreeSelect } from 'antd';
|
||||
import { useRef, useState } from 'react';
|
||||
import { fetchAllDepartment, addOrg, deleteOrg, updateOrg, getDataById } from './service';
|
||||
import React from 'react';
|
||||
const Index: React.FC<{}> = () => {
|
||||
const [spin, spinSet] = useState<boolean>(false);
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [form] = Form.useForm();
|
||||
const [title, setTitle] = useState<string>('');
|
||||
const [open, setOpen] = useState<boolean>(false);
|
||||
const [org, orgSet] = useState<any>([]);
|
||||
const layout = {
|
||||
labelCol: { span: 6 },
|
||||
wrapperCol: { span: 13 },
|
||||
};
|
||||
const columns: ProColumns[] = [
|
||||
{
|
||||
title: '组织编码',
|
||||
dataIndex: 'orgNum',
|
||||
width: '10%',
|
||||
},
|
||||
{
|
||||
title: '组织名称',
|
||||
dataIndex: 'orgName',
|
||||
width: '30%',
|
||||
},
|
||||
{
|
||||
title: '组织全称',
|
||||
dataIndex: 'orgFullName',
|
||||
width: '45%',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '操作', width: '10%',
|
||||
valueType: 'option',
|
||||
render: (_, record) => [
|
||||
<Button type='text' onClick={() => { handleUpdate(record) }}>修改</Button>,
|
||||
<Button type='text' onClick={() => { handleDelete(record.orgId) }}>删除</Button>
|
||||
]
|
||||
},
|
||||
// {
|
||||
// title: '部门负责人',
|
||||
// dataIndex: 'leaderName',
|
||||
// width: '15%',
|
||||
// },
|
||||
];
|
||||
const handleAdd = async () => {
|
||||
setOpen(true);
|
||||
setTitle('添加组织');
|
||||
};
|
||||
|
||||
const handleUpdate = async (record: any) => {
|
||||
form.resetFields();
|
||||
const org = await getDataById(record.orgId);
|
||||
form.setFieldsValue(org.data);
|
||||
setOpen(true);
|
||||
setTitle('修改组织');
|
||||
};
|
||||
// 删除操作
|
||||
const handleDelete = (id: string) => {
|
||||
Modal.confirm({
|
||||
title: '确认删除该组织?',
|
||||
onOk: async () => {
|
||||
await deleteOrg(id).then((r: any) => {
|
||||
if (r.code == 200) {
|
||||
message.success('删除成功');
|
||||
}
|
||||
})
|
||||
.finally(() => actionRef.current?.reload());
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
const values = await form.validateFields();
|
||||
if (values.orgId) {
|
||||
await updateOrg(values).then((r: any) => {
|
||||
if (r.code == 200) {
|
||||
message.success('修改成功');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
await addOrg(values).then((r: any) => {
|
||||
if (r.code == 200) {
|
||||
message.success('新增成功');
|
||||
}
|
||||
});
|
||||
}
|
||||
closeModal();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
const closeModal = async () => {
|
||||
actionRef.current?.reload();
|
||||
form.resetFields();
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
const addModal = (
|
||||
<Modal
|
||||
title={title}
|
||||
visible={open}
|
||||
width="70%"
|
||||
centered
|
||||
destroyOnClose={true}
|
||||
bodyStyle={{ maxHeight: window.innerHeight * 0.96 - 108, overflowY: 'auto', paddingTop: 0 }}
|
||||
// footer={<Button onClick={() => setOpen(false)}>关闭</Button>}
|
||||
onOk={handleSubmit}
|
||||
onCancel={() => closeModal()}
|
||||
>
|
||||
<Form form={form} {...layout}>
|
||||
<Form.Item label="组织id" name="orgId" hidden>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label="上级部门" name="upOrgId" >
|
||||
<TreeSelect
|
||||
style={{ width: '100%' }}
|
||||
// treeDefaultExpandedKeys={['OR1000000000']}
|
||||
placeholder="请选择部门,可搜索"
|
||||
treeData={org}
|
||||
showSearch={true}
|
||||
treeNodeFilterProp={'title'}
|
||||
allowClear
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label="组织名称" name="orgName" rules={[{ required: true }]}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label="组织编码" name="orgNum" rules={[{ required: true }]}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
|
||||
//表格请求
|
||||
async function request(params: any) {
|
||||
console.log('org params:', params);
|
||||
const { data } = await fetchAllDepartment(params);
|
||||
console.log('org data:', data);
|
||||
// orgSet(data.children);
|
||||
orgSet(data);
|
||||
let result = {
|
||||
// data: data.children,
|
||||
data: data,
|
||||
success: true,
|
||||
total: data.length,
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<Spin spinning={spin}>
|
||||
<PageHeader title="组织管理" />
|
||||
<div style={{ maxHeight: innerHeight - 130, height: innerHeight - 130 }} className='xsy-entrust bgCWhite'>
|
||||
<ProTable
|
||||
actionRef={actionRef}//action触发后更新表格
|
||||
columns={columns}
|
||||
search={{ labelWidth: 'auto', span: 6 }}
|
||||
options={false}
|
||||
rowKey="orgId"
|
||||
size="small"
|
||||
pagination={{
|
||||
defaultPageSize: 10,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
size: 'default',
|
||||
showTotal: (total) => <>{`共${total}条`}</>,
|
||||
}}
|
||||
pagination={false}
|
||||
toolBarRender={() => [
|
||||
<Button onClick={() => { handleAdd() }} type="primary">
|
||||
新增
|
||||
</Button>,
|
||||
]
|
||||
}
|
||||
request={request}
|
||||
/>
|
||||
{addModal}
|
||||
</div>
|
||||
</Spin >
|
||||
);
|
||||
}
|
||||
|
||||
export default Index;
|
@ -1,50 +0,0 @@
|
||||
import { request } from 'umi';
|
||||
|
||||
export async function fetchAllDepartment(params: any) {
|
||||
return request(`/api/sys-manager-ebtp-project/v1/sysorg/queryAll`, {
|
||||
method: 'get',
|
||||
params: params,
|
||||
});
|
||||
}
|
||||
export async function addOrg(params: any) {
|
||||
return request('/api/sys-manager-ebtp-project/v1/sysorg/insert', {
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
export async function deleteOrg(id: any) {
|
||||
return request(`/api/sys-manager-ebtp-project/v1/sysorg/del/${id}`, {
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
export async function updateOrg(params: any) {
|
||||
return request('/api/sys-manager-ebtp-project/v1/sysorg/update', {
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
export async function getDataById(id: any) {
|
||||
return request(`/api/sys-manager-ebtp-project/v1/sysorg/${id}`, {
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export async function departmentList(options?: { [key: string]: any }): Promise<{ data: any }> {
|
||||
return request('/api/system/departmentList', {
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
//根据部门id 查部门下所属部门及人员,立项用
|
||||
export async function getOrgUserIF(orgId: any) {
|
||||
return request(`/api/sysorg/user?orgId=${orgId}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
//查部门下所属部门及人员 全量
|
||||
export async function getAllOrgUserIF() {
|
||||
return request(` /api/sysorg/user/all`, {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
@ -1,272 +0,0 @@
|
||||
import React, { useState, useRef } from 'react';
|
||||
import { message, Modal, Input, Form, PageHeader, Button, Spin, Select, Tree } from 'antd';
|
||||
import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';
|
||||
import { getPage, getDataById, deleteRole, addRole, updateRole } from './service';
|
||||
// import './styles.less';
|
||||
import { getDicData } from '@/utils/session';
|
||||
import TextArea from 'antd/lib/input/TextArea';
|
||||
|
||||
const entrust: React.FC<{}> = () => {
|
||||
//获取字典
|
||||
const getDict: any = getDicData();
|
||||
const [form] = Form.useForm();
|
||||
const [title, setTitle] = useState<string>('');
|
||||
const [open, setOpen] = useState<boolean>(false);
|
||||
|
||||
const [checkedKeys, setCheckedKeys] = useState<React.Key[]>([]);
|
||||
const [currentRoleId, setCurrentRoleId] = useState<number | null>(null);
|
||||
const dictData = JSON.parse(getDict);
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [spin, spinSet] = useState<boolean>(false);
|
||||
//查询分页数据
|
||||
const [pageData, pageDataSet] = useState<any>({
|
||||
pageNo: 1,
|
||||
pageSize: 10
|
||||
});
|
||||
const layout = {
|
||||
labelCol: { span: 6 },
|
||||
wrapperCol: { span: 13 },
|
||||
};
|
||||
interface DictType {
|
||||
value: string;
|
||||
label: string;
|
||||
}
|
||||
const sys_normal_scope: DictType[] = [
|
||||
{ value: 'EBTP', label: '招标采购中心' },
|
||||
];
|
||||
|
||||
//委托列表
|
||||
const columns: ProColumns<any>[] = [
|
||||
{ title: '序号', valueType: 'index', width: 50, },
|
||||
{ title: '角色名称', dataIndex: 'roleName', },//, ellipsis: true
|
||||
{ title: '权限字符', dataIndex: 'roleCode', width: '10%' },
|
||||
{
|
||||
title: '角色范围', dataIndex: 'roleScope',
|
||||
valueEnum: { 'EBTP': { text: '招标采购中心', status: 'EBTP' }, },
|
||||
render: (_, record) => {
|
||||
if (record.roleScope === 'EBTP') {
|
||||
return (<>招标采购中心</>)
|
||||
} else {
|
||||
return (<></>)
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '创建时间', dataIndex: 'createDate', width: '10%', valueType: 'dateTime', search: false },
|
||||
{
|
||||
title: '操作', width: '9%',
|
||||
valueType: 'option',
|
||||
render: (_, record) => [
|
||||
<Button type='text' onClick={() => { handleUpdate(record) }}>修改</Button>,
|
||||
<Button type='text' onClick={() => { handleDelete(record.roleId) }}>删除</Button>
|
||||
]
|
||||
},
|
||||
];
|
||||
// 删除操作
|
||||
const handleDelete = (id: string) => {
|
||||
Modal.confirm({
|
||||
title: '确认删除该角色?',
|
||||
onOk: async () => {
|
||||
await deleteRole(id).then((r: any) => {
|
||||
if (r?.code == 200) {
|
||||
message.success('删除成功');
|
||||
} else {
|
||||
message.error('删除失败');
|
||||
}
|
||||
})
|
||||
.finally(() => actionRef.current?.reload());
|
||||
},
|
||||
});
|
||||
};
|
||||
const handleAdd = async () => {
|
||||
form.resetFields();
|
||||
// const menus = await menuTreeselect();
|
||||
// setMenuOptions(menus.data || []);
|
||||
// setMenuOptions(menu || []);
|
||||
|
||||
// 使用时转换
|
||||
setMenuOptions(formatMenuOptions(menu) || []);
|
||||
setOpen(true);
|
||||
setTitle('添加角色');
|
||||
};
|
||||
|
||||
const [menuOptions, setMenuOptions] = useState<any[]>([]);
|
||||
let menu = [{
|
||||
"id": '1', "parentId": '0', "label": "系统管理", "weight": 1,
|
||||
"children": [{
|
||||
"id": '101', "parentId": '1', "label": "角色管理", "weight": 2,
|
||||
"children": [{ "id": '1008', "parentId": '101', "label": "角色查询", "weight": 1 },
|
||||
{ "id": '1009', "parentId": '101', "label": "角色新增", "weight": 2 },
|
||||
{ "id": '1010', "parentId": '101', "label": "角色修改", "weight": 3 },
|
||||
{ "id": '1011', "parentId": '101', "label": "角色删除", "weight": 4 },
|
||||
{ "id": '1012', "parentId": '101', "label": "角色导出", "weight": 5 }]
|
||||
},
|
||||
{
|
||||
"id": '105', "parentId": '1', "label": "字典管理", "weight": 6,
|
||||
"children": [{ "id": '1026', "parentId": '105', "label": "字典查询", "weight": 1 },
|
||||
{ "id": '1027', "parentId": '105', "label": "字典新增", "weight": 2 },
|
||||
{ "id": '1028', "parentId": '105', "label": "字典修改", "weight": 3 },
|
||||
{ "id": '1029', "parentId": '105', "label": "字典删除", "weight": 4 },
|
||||
{ "id": '1030', "parentId": '105', "label": "字典导出", "weight": 5 }]
|
||||
}]
|
||||
},
|
||||
{ "id": '4', "parentId": '0', "label": "PLUS官网", "weight": 4 },
|
||||
{
|
||||
"id": "1494925781048545281", "parentId": '0', "label": "个人待办", "weight": 18,
|
||||
"children": [{ "id": "1494926258733633538", "parentId": "1494925781048545281", "label": "待办任务", "weight": 1 },
|
||||
{ "id": "1494926586677874690", "parentId": "1494925781048545281", "label": "已办任务", "weight": 2 }]
|
||||
}];
|
||||
const formatMenuOptions = (data: any[]) => {
|
||||
return data.map(item => ({
|
||||
title: item.label,
|
||||
key: item.id,
|
||||
children: item.children ? formatMenuOptions(item.children) : undefined,
|
||||
}));
|
||||
};
|
||||
|
||||
const handleUpdate = async (record: any) => {
|
||||
form.resetFields();
|
||||
const role = await getDataById(record.roleId);
|
||||
// const menus = await roleMenuTreeselect(record.roleId);
|
||||
// setMenuOptions(menus.data.menus || []);
|
||||
setMenuOptions(formatMenuOptions(menu) || []);
|
||||
setCheckedKeys(role.data.menuIds || []);
|
||||
form.setFieldsValue({
|
||||
...role.data,
|
||||
menuIds: role.data.menuIds || [],
|
||||
});
|
||||
// form.setFieldsValue(role.data);
|
||||
setCurrentRoleId(record.roleId);
|
||||
setOpen(true);
|
||||
setTitle('修改角色');
|
||||
};
|
||||
|
||||
const closeModal = async () => {
|
||||
actionRef.current?.reload();
|
||||
form.resetFields();
|
||||
setCheckedKeys([]);
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
const values = await form.validateFields();
|
||||
if (values.roleId) {
|
||||
await updateRole(values).then((r: any) => {
|
||||
if (r?.code == 200) {
|
||||
message.success('修改成功');
|
||||
} else {
|
||||
message.error('修改失败');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
await addRole(values).then((r: any) => {
|
||||
console.log("r?.code", r?.code)
|
||||
if (r?.code == 200) {
|
||||
message.success('新增成功');
|
||||
} else {
|
||||
message.error('新增失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
closeModal();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
const checkSupModal = (
|
||||
<Modal
|
||||
title={title}
|
||||
visible={open}
|
||||
width="70%"
|
||||
centered
|
||||
destroyOnClose={true}
|
||||
bodyStyle={{ maxHeight: window.innerHeight * 0.96 - 108, overflowY: 'auto', paddingTop: 0 }}
|
||||
// footer={<Button onClick={() => setOpen(false)}>关闭</Button>}
|
||||
onOk={handleSubmit}
|
||||
onCancel={() => closeModal()}
|
||||
>
|
||||
<Form form={form} {...layout}>
|
||||
<Form.Item label="角色id" name="roleId" hidden>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label="角色名称" name="roleName" rules={[{ required: true }]}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label="角色编码" name="roleCode" rules={[{ required: true }]}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label="角色范围" name="roleScope" rules={[{ required: true }]}>
|
||||
<Select>
|
||||
{sys_normal_scope.map((item) => (
|
||||
<Option key={item.value} value={item.value}>
|
||||
{item.label}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item label="角色描述" name="roleDesc" rules={[{ required: true }]}>
|
||||
<TextArea />
|
||||
</Form.Item>
|
||||
<Form.Item label="菜单权限" name="menuIds" >
|
||||
<Tree
|
||||
defaultExpandAll
|
||||
checkable
|
||||
checkedKeys={checkedKeys}
|
||||
onCheck={(checkedKeys) => {
|
||||
setCheckedKeys(checkedKeys as React.Key[]);
|
||||
form.setFieldsValue({ menuIds: checkedKeys });
|
||||
}}
|
||||
treeData={menuOptions}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
return (
|
||||
<Spin spinning={spin}>
|
||||
<PageHeader title="角色管理" />
|
||||
<div style={{ maxHeight: innerHeight - 130, height: innerHeight - 130 }} className='xsy-entrust bgCWhite'>
|
||||
<ProTable<any>
|
||||
actionRef={actionRef}//action触发后更新表格
|
||||
columns={columns}//表格
|
||||
options={false}
|
||||
bordered={false}
|
||||
className='tableSearch'
|
||||
size='small'
|
||||
search={{ labelWidth: 'auto', span: 6 }}
|
||||
request={(params) =>
|
||||
getPage({
|
||||
...params,
|
||||
basePageRequest: { pageNo: pageData.pageNo, pageSize: pageData.pageSize },
|
||||
}).then((res) => {
|
||||
const result = {
|
||||
data: res.data.records,
|
||||
total: res.data.total,
|
||||
success: res.success,
|
||||
pageSize: res.data.size,
|
||||
current: res.data.current
|
||||
}
|
||||
return result;
|
||||
})
|
||||
}
|
||||
toolBarRender={() => [
|
||||
<Button onClick={() => { handleAdd() }} type="primary">
|
||||
新增
|
||||
</Button>,
|
||||
]
|
||||
}
|
||||
pagination={{
|
||||
defaultPageSize: 10,
|
||||
showSizeChanger: false,
|
||||
onChange: (page, pageSize) => pageDataSet({ pageNo: page, pageSize: pageSize }),
|
||||
onShowSizeChange: (current, size) => pageDataSet({ pageNo: current, pageSize: size }),
|
||||
}}
|
||||
onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }}
|
||||
/>
|
||||
{checkSupModal}
|
||||
</div>
|
||||
{/* 查看 */}
|
||||
</Spin >
|
||||
)
|
||||
};
|
||||
export default entrust;
|
@ -1,31 +0,0 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
// 分页查询角色
|
||||
export async function getPage(params: any) {
|
||||
return request('/api/sys-manager-ebtp-project/v1/sysrole/getPage', {
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
export async function getDataById(id: any) {
|
||||
return request(`/api/sys-manager-ebtp-project/v1/sysrole/${id}`, {
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
export async function deleteRole(id: any) {
|
||||
return request(`/api/sys-manager-ebtp-project/v1/sysrole/del/${id}`, {
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
export async function addRole(params: any) {
|
||||
return request('/api/sys-manager-ebtp-project/v1/sysrole/insert', {
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
export async function updateRole(params: any) {
|
||||
return request('/api/sys-manager-ebtp-project/v1/sysrole/update', {
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
}
|
@ -1,290 +0,0 @@
|
||||
import React, { useState, useRef, useMemo, useEffect } from 'react';
|
||||
import { message, Modal, Input, Form, PageHeader, Button, Spin, Tree, Checkbox, Row, Col } from 'antd';
|
||||
import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';
|
||||
import { getPage, getDataById, allocationIF, assignsRoles, updateRole } from './service';
|
||||
import { fetchAllDepartment } from '../Department/service';
|
||||
import { getDicData } from '@/utils/session';
|
||||
const { Search } = Input;
|
||||
const entrust: React.FC<{}> = () => {
|
||||
const [roleModalForm] = Form.useForm();
|
||||
const [open, setOpen] = useState<boolean>(false);
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [spin, spinSet] = useState<boolean>(false);
|
||||
const [roles, setRoles] = useState<any>([]);
|
||||
//查询分页数据
|
||||
const [pageData, pageDataSet] = useState<any>({
|
||||
pageNo: 1,
|
||||
pageSize: 10
|
||||
});
|
||||
const layout = {
|
||||
labelCol: { span: 6 },
|
||||
wrapperCol: { span: 13 },
|
||||
};
|
||||
useEffect(() => {
|
||||
getDepartmentList();
|
||||
}, []);
|
||||
|
||||
//委托列表
|
||||
const columns: ProColumns<any>[] = [
|
||||
{ title: '序号', valueType: 'index', width: 50, },
|
||||
{ title: '用户名', dataIndex: 'name', },
|
||||
{ title: '用户账号', dataIndex: 'employeeNumber' },
|
||||
{ title: '用户Id', dataIndex: 'userId' },
|
||||
{ title: '部门', dataIndex: 'orgName', hideInSearch: true },
|
||||
{ title: '邮箱', dataIndex: 'email' },
|
||||
{
|
||||
title: '操作', width: '9%',
|
||||
valueType: 'option',
|
||||
render: (_, record) => [
|
||||
<Button type='text' onClick={() => { chooseRole(record) }}>分配角色</Button>
|
||||
// <Button type='text' onClick={() => { handleUpdate(record) }}>修改</Button>,
|
||||
// <Button type='text' onClick={() => { handleDelete(record.roleId) }}>删除</Button>
|
||||
]
|
||||
},
|
||||
];
|
||||
//分配角色查询数据
|
||||
const chooseRole = (record: any) => {
|
||||
roleModalForm.resetFields();
|
||||
spinSet(true);
|
||||
allocationIF(record.userId)
|
||||
.then((res: any) => {
|
||||
if (res?.code === 200) {
|
||||
console.log("roleIds",res?.data?.roleIds);
|
||||
setRoles(
|
||||
res?.data?.allRole?.map((item: any) => ({ label: item.roleName, value: item.roleId })),
|
||||
);
|
||||
roleModalForm.setFieldsValue({ ...record, roleIds: res?.data?.roleIds });
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
spinSet(false);
|
||||
});
|
||||
setOpen(true);
|
||||
};
|
||||
|
||||
const closeModal = async () => {
|
||||
actionRef.current?.reload();
|
||||
roleModalForm.resetFields();
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
const onAssignsRoles = async () => {
|
||||
const values = await roleModalForm.validateFields();
|
||||
try {
|
||||
const { success } = await assignsRoles(values );
|
||||
if (success) {
|
||||
message.success('操作成功!');
|
||||
}
|
||||
closeModal();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
const setRoleModal = (
|
||||
<Modal
|
||||
title={"分配角色"}
|
||||
visible={open}
|
||||
width="70%"
|
||||
centered
|
||||
destroyOnClose={true}
|
||||
bodyStyle={{ maxHeight: window.innerHeight * 0.96 - 108, overflowY: 'auto', paddingTop: 0 }}
|
||||
// footer={<Button onClick={() => setOpen(false)}>关闭</Button>}
|
||||
onOk={onAssignsRoles}
|
||||
onCancel={() => closeModal()}
|
||||
>
|
||||
<Form form={roleModalForm} {...layout}>
|
||||
<Form.Item label="id" name="userId" hidden>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label="名称" name="name" >
|
||||
<Input disabled />
|
||||
</Form.Item>
|
||||
<Form.Item label="部门" name="orgName" >
|
||||
<Input disabled />
|
||||
</Form.Item>
|
||||
<Form.Item label="角色信息" name="roleIds">
|
||||
<Checkbox.Group>
|
||||
<Row>
|
||||
{roles?.map((v: any, i: number) => (
|
||||
<Col span={8} key={`col-${i}`}>
|
||||
<Checkbox value={v.value}>{v.label}</Checkbox>
|
||||
</Col>
|
||||
))}
|
||||
</Row>
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
const [treeDataList, treeDataListSet] = useState<any>([]);
|
||||
const [orgId, setOrgId] = useState<any>('');
|
||||
const [expandedKeys, setExpandedKeys] = useState<React.Key[]>([]);
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
const [autoExpandParent, setAutoExpandParent] = useState(true);
|
||||
const [allData, allDataSet] = useState<any>([]);
|
||||
const onChange: (e: any) => void = (e) => {
|
||||
const { value } = e.target;
|
||||
let keys: any = [];
|
||||
if (value !== '') {
|
||||
const newExpandedKeys = treeDataList
|
||||
.map((item: { title: string | any[]; key: any }) => {
|
||||
if (item.title.indexOf(value) > -1) {
|
||||
return getParentKey(item.key, allData);
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter((item: any, i: any, self: string | any[]) => {
|
||||
return item && self.indexOf(item) === i;
|
||||
});
|
||||
keys = newExpandedKeys;
|
||||
}
|
||||
setExpandedKeys(keys as React.Key[]);
|
||||
setSearchValue(value);
|
||||
setAutoExpandParent(value !== '');
|
||||
};
|
||||
const getDepartmentList = async () => {
|
||||
try {
|
||||
const { data } = await fetchAllDepartment({});
|
||||
allDataSet(data);
|
||||
const dataList: { key: React.Key; title: string }[] = [];
|
||||
const generateList = (data: any[]) => {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const node = data[i];
|
||||
const { key } = node;
|
||||
dataList.push({ key, title: node.title });
|
||||
if (node.children) {
|
||||
generateList(node.children);
|
||||
}
|
||||
}
|
||||
};
|
||||
generateList(data);
|
||||
treeDataListSet(dataList);
|
||||
} catch (e) { }
|
||||
};
|
||||
|
||||
const getParentKey = (key: React.Key, tree: any): React.Key => {
|
||||
let parentKey: React.Key;
|
||||
for (let i = 0; i < tree.length; i++) {
|
||||
const node = tree[i];
|
||||
if (node.children) {
|
||||
if (node.children.some((item) => item.key === key)) {
|
||||
parentKey = node.key;
|
||||
} else if (getParentKey(key, node.children)) {
|
||||
parentKey = getParentKey(key, node.children);
|
||||
}
|
||||
}
|
||||
}
|
||||
return parentKey!;
|
||||
};
|
||||
const onExpand = (newExpandedKeys: any[]) => {
|
||||
setExpandedKeys(newExpandedKeys);
|
||||
setAutoExpandParent(false);
|
||||
};
|
||||
const onDepartmentClick = (selectedKeys: any, e: any) => {
|
||||
setOrgId(selectedKeys[0]);
|
||||
setTimeout(() => {
|
||||
actionRef.current?.reload();
|
||||
}, 200);
|
||||
};
|
||||
const treeData = useMemo(() => {
|
||||
const loop = (data: any): any[] => {
|
||||
console.log('data', data);
|
||||
let res: any[] = [];
|
||||
data.map((item: any, i: any) => {
|
||||
const strTitle = item.title as string;
|
||||
const index = strTitle.indexOf(searchValue);
|
||||
const beforeStr = strTitle.substring(0, index);
|
||||
const afterStr = strTitle.slice(index + searchValue.length);
|
||||
const title =
|
||||
index > -1 ? (
|
||||
<span>
|
||||
{beforeStr}
|
||||
<span style={{ color: 'red' }}>{searchValue}</span>
|
||||
{afterStr}
|
||||
</span>
|
||||
) : (
|
||||
<span>{strTitle}</span>
|
||||
);
|
||||
if (expandedKeys.includes(item.key) || index > -1) {
|
||||
if (item.children) {
|
||||
res.push({ title, key: item.key, children: loop(item.children) });
|
||||
} else {
|
||||
res.push({ title, key: item.key });
|
||||
}
|
||||
}
|
||||
});
|
||||
return res;
|
||||
};
|
||||
if (searchValue !== '') {
|
||||
let returnData = loop(allData);
|
||||
return returnData;
|
||||
} else {
|
||||
return allData;
|
||||
}
|
||||
}, [searchValue, allData]);
|
||||
return (
|
||||
<Spin spinning={spin}>
|
||||
<PageHeader title="用户管理" />
|
||||
<div style={{ maxHeight: innerHeight - 130, height: innerHeight - 130 }} className='xsy-entrust bgCWhite'>
|
||||
<div style={{ display: 'flex', }}>
|
||||
<div style={{ backgroundColor: '#FFF', width: '220px', marginRight: '8px', }}>
|
||||
<Search style={{ marginBottom: 2 }} placeholder="关键字查询" onChange={onChange} />
|
||||
<div style={{ height: 'calc(100vh - 96px)', overflowY: 'auto', }}>
|
||||
<Tree
|
||||
// fieldNames={{ title: 'orgName', key: 'orgId', children: 'children' }}
|
||||
onExpand={onExpand}
|
||||
expandedKeys={expandedKeys}
|
||||
autoExpandParent={autoExpandParent}
|
||||
treeData={treeData}
|
||||
onSelect={onDepartmentClick}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ backgroundColor: '#FFF', flex: '1', width: '100%', }} >
|
||||
<ProTable<any>
|
||||
actionRef={actionRef}//action触发后更新表格
|
||||
columns={columns}//表格
|
||||
options={false}
|
||||
bordered={false}
|
||||
className='tableSearch'
|
||||
size='small'
|
||||
search={{ labelWidth: 'auto', span: 6 }}
|
||||
request={(params) =>
|
||||
getPage({
|
||||
...params,
|
||||
orgId: orgId,
|
||||
basePageRequest: { pageNo: pageData.pageNo, pageSize: pageData.pageSize },
|
||||
}).then((res) => {
|
||||
const result = {
|
||||
data: res.data.records,
|
||||
total: res.data.total,
|
||||
success: res.success,
|
||||
pageSize: res.data.size,
|
||||
current: res.data.current
|
||||
}
|
||||
return result;
|
||||
})
|
||||
}
|
||||
toolBarRender={() => [
|
||||
// <Button onClick={() => { handleAdd() }} type="primary">
|
||||
// 新增
|
||||
// </Button>,
|
||||
]
|
||||
}
|
||||
pagination={{
|
||||
defaultPageSize: 10,
|
||||
showSizeChanger: false,
|
||||
onChange: (page, pageSize) => pageDataSet({ pageNo: page, pageSize: pageSize }),
|
||||
onShowSizeChange: (current, size) => pageDataSet({ pageNo: current, pageSize: size }),
|
||||
}}
|
||||
onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }); setOrgId(''); }}
|
||||
/>
|
||||
{setRoleModal}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* 查看 */}
|
||||
</Spin >
|
||||
)
|
||||
};
|
||||
export default entrust;
|
@ -1,89 +0,0 @@
|
||||
import { request } from 'umi';
|
||||
|
||||
// 分页查询角色
|
||||
export async function getPage(params: any) {
|
||||
return request('/api/sys-manager-ebtp-project/v1/sysuser/getPage', {
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
export async function getDataById(id: any) {
|
||||
return request(`/api/sys-manager-ebtp-project/v1/sysuser/${id}`, {
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
export async function deleteRole(id: any) {
|
||||
return request(`/api/sys-manager-ebtp-project/v1/sysuser/del/${id}`, {
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
export async function addRole(params: any) {
|
||||
return request('/api/sys-manager-ebtp-project/v1/sysuser/insert', {
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
export async function updateRole(params: any) {
|
||||
return request('/api/sys-manager-ebtp-project/v1/sysuser/update', {
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
|
||||
//分配人员查询数据
|
||||
export async function allocationIF(userId: any) {
|
||||
return request(`/api/sys-manager-ebtp-project/v1/sysrole/role/assign/${userId}`, {
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
export async function assignsRoles(params: any) {
|
||||
return request('/api/sys-manager-ebtp-project/v1/sysuserrole/assignsRoles', {
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
// import { TreeDataNode } from 'antd';
|
||||
|
||||
// export function userList(options?: { [key: string]: any }): Promise<{ data: any }> {
|
||||
// return request('/api/system/userList', {
|
||||
// method: 'GET',
|
||||
// ...(options || {}),
|
||||
// });
|
||||
// }
|
||||
|
||||
// export function treeData(options?: { [key: string]: any }): Promise<{ data: TreeDataNode[] }> {
|
||||
// return request('/api/system/treeData', {
|
||||
// method: 'GET',
|
||||
// ...(options || {}),
|
||||
// });
|
||||
// }
|
||||
|
||||
// export function fetchUserList(options?: any) {
|
||||
// return request('/api/sysuser/getPage', {
|
||||
// method: 'POST',
|
||||
// data: options,
|
||||
// });
|
||||
// }
|
||||
// //获取用户数据
|
||||
// export function getUser(userId?: any) {
|
||||
// return request(`/api/sysuser/${userId}`, {
|
||||
// method: 'get',
|
||||
// });
|
||||
// }
|
||||
|
||||
// export function assignsRoles(options?: { [key: string]: any }): Promise<any> {
|
||||
// return request('/api/sysuser/assignsRoles', {
|
||||
// method: 'post',
|
||||
// ...(options || {}),
|
||||
// });
|
||||
// }
|
||||
|
||||
// //查询用户详情
|
||||
// export function getOneUserAll(options?: { [key: string]: any }): Promise<{ data: TreeDataNode[] }> {
|
||||
// return request(`/api/sysuser/getOneUserAll/${options?.id}`, {
|
||||
// method: 'GET',
|
||||
// params: options,
|
||||
// ...(options || {}),
|
||||
// });
|
||||
// }
|
@ -1,179 +0,0 @@
|
||||
import { Button, Form, Input, Modal } from "antd"
|
||||
import React, { useEffect, useState } from "react"
|
||||
import { describeSiteMsgDetail, getProjectById, selectMsgRead } from '../service'
|
||||
import '@/assets/ld_style.less'
|
||||
import { history } from 'umi';
|
||||
import { followUpAProjectManager, getDefId } from '@/utils/session';
|
||||
|
||||
const { TextArea } = Input;
|
||||
|
||||
interface ApprovalDetailProps {
|
||||
modalVisible: boolean;
|
||||
approvalId: string;
|
||||
dateNum: Number;
|
||||
trelist: any[];
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
const layout = {
|
||||
labelCol: { span: 6 },
|
||||
wrapperCol: { span: 15 },
|
||||
};
|
||||
|
||||
const ApprovalDetail: React.FC<ApprovalDetailProps> = (props) => {
|
||||
const { modalVisible, approvalId, onCancel, trelist, dateNum } = props;
|
||||
const [form] = Form.useForm();
|
||||
const [detailId, setDetailId] = useState<any>(approvalId); // 详情id
|
||||
const [lastVisible, setLastVisible] = useState<boolean>(trelist?.indexOf(approvalId) == 0 ? true : false); // 上一条禁用
|
||||
const [nextVisible, setNextVisible] = useState<boolean>(trelist?.indexOf(approvalId) == trelist?.length - 1 ? true : false); // 下一条禁用
|
||||
const [knowVisible, setKnowVisible] = useState<any>(false); // 知道了禁用
|
||||
const [projectId, setProjectId] = useState<any>(); // 项目id
|
||||
const [roomType, setRoomType] = useState<any>(); // 判断资审候审
|
||||
const [disFollowUp, setDisFollowUp] = useState<boolean>(false) //跟进按钮隐藏
|
||||
|
||||
useEffect(() => {
|
||||
Int(approvalId);
|
||||
setDetailId(approvalId)
|
||||
}, [approvalId]);
|
||||
const Int = (detailId: any) => {
|
||||
describeSiteMsgDetail(detailId).then(res => {
|
||||
// if(res.code == 200){
|
||||
if (res?.servicecode) {
|
||||
let detailMess = JSON.parse(res.servicecode)
|
||||
setProjectId(detailMess.tp_id)
|
||||
setRoomType(detailMess.room_type)
|
||||
} else {
|
||||
// message.error('项目数据错误,无法获取流程,请联系管理员!')
|
||||
setDisFollowUp(true)
|
||||
}
|
||||
res.authorizestate == '0' ? setKnowVisible(false) : setKnowVisible(true)
|
||||
form.setFieldsValue({
|
||||
"title": res.title,
|
||||
"createtime": res.createtime,
|
||||
"content": res.content
|
||||
});
|
||||
// }
|
||||
});
|
||||
};
|
||||
|
||||
const next = () => { // 下一条
|
||||
setLastVisible(false)
|
||||
let current = trelist.indexOf(detailId)
|
||||
if (current < trelist.length - 2 && current != trelist.length - 2) {
|
||||
setDetailId(trelist[current + 1])
|
||||
Int(trelist[current + 1])
|
||||
} else if (current == trelist.length - 2) {
|
||||
setDetailId(trelist[current + 1])
|
||||
Int(trelist[current + 1])
|
||||
setNextVisible(true)
|
||||
} else {
|
||||
setNextVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
const last = () => { // 上一条
|
||||
setNextVisible(false)
|
||||
let current: any = trelist.indexOf(detailId)
|
||||
if (current > 0 && current != 1) {
|
||||
setDetailId(trelist[current - 1])
|
||||
Int(trelist[current - 1])
|
||||
} else if (current == 1) {
|
||||
setDetailId(trelist[current - 1])
|
||||
Int(trelist[current - 1])
|
||||
setLastVisible(true)
|
||||
} else {
|
||||
setLastVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
const getRead = () => { // 知道了
|
||||
selectMsgRead(detailId).then(res => {
|
||||
setKnowVisible(true)
|
||||
});
|
||||
}
|
||||
|
||||
const getFollow = async () => { // 跟进
|
||||
await getProjectById(projectId).then(async response => {
|
||||
if (response?.code == 200 && response?.success == true) {
|
||||
const resData = response?.data
|
||||
await followUpAProjectManager(resData);
|
||||
const defId = getDefId();
|
||||
if (roomType == '1' && (defId == 'bid_prequalification' || defId == 'comparison_one_prequalification')) { //公开招标资格预审,公开比选一阶段资格预审
|
||||
history.push('/ProjectLayout/ZYuShen/senior/Notice?roomType=1')
|
||||
} else if (roomType == '2' && (defId == 'bid_prequalification' || defId == 'comparison_one_prequalification')) { //公开招标资格预审后审阶段,公开比选一阶段资格预审后审阶段
|
||||
history.push('/ProjectLayout/biddingAnnouncement/BiddingInvitationList?roomType=2')
|
||||
} else if (
|
||||
defId == 'bid_qualification' ||
|
||||
defId == 'comparison_one' ||
|
||||
defId == 'comparison_multi' ||
|
||||
defId == 'recruit' ||
|
||||
defId == 'negotiation_competitive_public'
|
||||
) { //公开招标后审,公开比选一阶段后审,公开比选多阶段,招募单轮,竞争性谈判发公告
|
||||
history.push('/ProjectLayout/biddingAnnouncement/BiddingAnnouncementList')
|
||||
} else if (
|
||||
defId == 'bid_invitation' ||
|
||||
defId == 'negotiation_competitive_invite' ||
|
||||
defId == 'negotiation_single'
|
||||
) { //邀请招标,竞争性谈判发邀请函,单一来源
|
||||
history.push('/ProjectLayout/biddingAnnouncement/BiddingInvitationList')
|
||||
} else if (
|
||||
defId == 'recruit_multi'
|
||||
) { //多轮招募
|
||||
history.push('/ProjectLayout/ZZhaoMu/Bid/BiddingAnnouncement/BiddingAnnouncementList')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
destroyOnClose={true}
|
||||
getContainer={false}
|
||||
title='消息详情'
|
||||
visible={modalVisible}
|
||||
onCancel={() => onCancel()}
|
||||
width={800}
|
||||
centered
|
||||
footer={[
|
||||
<Button onClick={onCancel}>关闭</Button>,
|
||||
<Button disabled={knowVisible} type="primary" onClick={() => getRead()}>知道了</Button>,
|
||||
<Button disabled={disFollowUp} onClick={() => getFollow()} type="primary">跟进</Button>]}
|
||||
>
|
||||
<p>您有 <text className="tips">{dateNum}</text> 条公告审批结束消息,当前只显示 <text className="tips">6</text> 条最新的公告审批结束提示,请到<a onClick={() => history.push('/SystemMessage/message')}> 这里 </a>查看全部提示信息</p>
|
||||
<Form
|
||||
{...layout}
|
||||
name="basic"
|
||||
form={form}
|
||||
>
|
||||
|
||||
<Form.Item
|
||||
label="项目名称"
|
||||
name="title"
|
||||
>
|
||||
<Input readOnly bordered={false} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="内容"
|
||||
name="content"
|
||||
>
|
||||
<TextArea readOnly bordered={false} autoSize />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="审批结束时间"
|
||||
name="createtime"
|
||||
>
|
||||
<Input readOnly bordered={false} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
<div className="btnBox">
|
||||
<Button disabled={lastVisible} className="last" onClick={() => last()}>上一条</Button>
|
||||
<Button disabled={nextVisible} onClick={() => next()}>下一条</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default ApprovalDetail
|
||||
|
@ -1,172 +0,0 @@
|
||||
import { followUpAProjectManager, followUpAProjectSupplier, getDefId, getSessionRoleData } from "@/utils/session";
|
||||
import { Button, Form, Input, Modal } from "antd"
|
||||
import React, { useEffect, useState } from "react"
|
||||
import { describeSiteMsgDetail, selectMsgRead, getProjectById } from '../service'
|
||||
import { history } from 'umi';
|
||||
|
||||
const { TextArea } = Input;
|
||||
|
||||
interface filesManageComponents {
|
||||
modalVisible: boolean;
|
||||
messId: string;
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
const layout = {
|
||||
labelCol: { span: 6 },
|
||||
wrapperCol: { span: 15 },
|
||||
};
|
||||
|
||||
const filesManageComponents: React.FC<filesManageComponents> = (props) => {
|
||||
const { modalVisible, messId, onCancel } = props;
|
||||
const [form] = Form.useForm();
|
||||
const [knowVisible, setKnowVisible] = useState<any>(false); // 知道了禁用
|
||||
const [detailId, setDetailId] = useState<any>(); // 详情id
|
||||
const [projectId, setProjectId] = useState<any>(); // 项目id
|
||||
const [roomType, setRoomType] = useState<any>(); // 判断资审候审
|
||||
const [routeType, setRouteType] = useState<any>(); // 判断澄清提疑
|
||||
const [disFollowUp, setDisFollowUp] = useState<boolean>(false) //跟进按钮隐藏
|
||||
const role = getSessionRoleData().roleCode;
|
||||
|
||||
useEffect(() => {
|
||||
Int();
|
||||
}, [messId]);
|
||||
const Int = () => {
|
||||
describeSiteMsgDetail(messId).then(res => {
|
||||
// if(res.code == 200){
|
||||
res.authorizestate == '0' ? setKnowVisible(false) : setKnowVisible(true)
|
||||
form.setFieldsValue({
|
||||
"title": res.title,
|
||||
"createtime": res.createtime,
|
||||
"content": res.content
|
||||
});
|
||||
setDetailId(res.msgId)
|
||||
if (res?.servicecode) {
|
||||
let detailMess = JSON.parse(res?.servicecode)
|
||||
setProjectId(detailMess.tp_id)
|
||||
setRoomType(detailMess.room_type)
|
||||
setRouteType(detailMess.type)
|
||||
} else {
|
||||
// message.error('项目数据错误,无法获取流程,请联系管理员!')
|
||||
setDisFollowUp(true)
|
||||
}
|
||||
// }
|
||||
});
|
||||
};
|
||||
|
||||
const getRead = () => { // 知道了
|
||||
selectMsgRead(detailId).then(res => {
|
||||
setKnowVisible(true)
|
||||
});
|
||||
}
|
||||
|
||||
const getFollow = async () => { // 跟进
|
||||
if (role == "ebtp-supplier") { // 供应商
|
||||
await getProjectById(projectId).then(async response => {
|
||||
if (response?.code == 200 && response?.success == true) {
|
||||
const resData = response?.data
|
||||
await followUpAProjectSupplier(resData);
|
||||
|
||||
if (routeType == 'clarify') {
|
||||
if (roomType == '1') {
|
||||
history.push('/ProjectLayout/ZYuShen/Tender/supplier/SupplierClarificationList?roomType=1')
|
||||
} else {
|
||||
history.push('/ProjectLayout/Tender/supplier/SupplierClarificationList?roomType=2')
|
||||
}
|
||||
} else {
|
||||
history.push('/ProjectLayout/Tender/supplier/SupplierQuestionsOrObjections')
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (role == "ebtp-agency-project-manager" || role == 'ebtp-purchase') { // 项目经理、采购经理
|
||||
await getProjectById(projectId).then(async response => {
|
||||
if (response?.code == 200 && response?.success == true) {
|
||||
const resData = response?.data
|
||||
await followUpAProjectManager(resData);
|
||||
|
||||
if (routeType == 'clarify') {
|
||||
if (roomType == '1') {
|
||||
history.push('/ProjectLayout/ZYuShen/Tender/ProjectManager/ClarifyTheList?roomType=1')
|
||||
} else {
|
||||
history.push('/ProjectLayout/Tender/ProjectManager/ClarifyTheList?roomType=2')
|
||||
}
|
||||
} else if (routeType == 'approval') { //公告审批
|
||||
const defId = getDefId();
|
||||
if (roomType == '1' && (defId == 'bid_prequalification' || defId == 'comparison_one_prequalification')) { //公开招标资格预审,公开比选一阶段资格预审
|
||||
history.push('/ProjectLayout/ZYuShen/senior/Notice?roomType=1')
|
||||
} else if (roomType == '2' && (defId == 'bid_prequalification' || defId == 'comparison_one_prequalification')) { //公开招标资格预审后审阶段,公开比选一阶段资格预审后审阶段
|
||||
history.push('/ProjectLayout/biddingAnnouncement/BiddingInvitationList?roomType=2')
|
||||
} else if (
|
||||
defId == 'bid_qualification' ||
|
||||
defId == 'comparison_one' ||
|
||||
defId == 'comparison_multi' ||
|
||||
defId == 'recruit' ||
|
||||
defId == 'negotiation_competitive_public'
|
||||
) { //公开招标后审,公开比选一阶段后审,公开比选多阶段,招募单轮,竞争性谈判发公告
|
||||
history.push('/ProjectLayout/biddingAnnouncement/BiddingAnnouncementList')
|
||||
} else if (
|
||||
defId == 'bid_invitation' ||
|
||||
defId == 'negotiation_competitive_invite' ||
|
||||
defId == 'negotiation_single'
|
||||
) { //邀请招标,竞争性谈判发邀请函,单一来源
|
||||
history.push('/ProjectLayout/biddingAnnouncement/BiddingInvitationList')
|
||||
} else if (
|
||||
defId == 'recruit_multi'
|
||||
) { //多轮招募
|
||||
history.push('/ProjectLayout/ZZhaoMu/Bid/BiddingAnnouncement/BiddingAnnouncementList')
|
||||
}
|
||||
} else {
|
||||
history.push('/ProjectLayout/Tender/ProjectManager/MentionDoubtReply')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
destroyOnClose={true}
|
||||
getContainer={false}
|
||||
title='消息详情'
|
||||
visible={modalVisible}
|
||||
onCancel={() => onCancel()}
|
||||
width={800}
|
||||
centered
|
||||
footer={[
|
||||
<Button onClick={onCancel}>关闭</Button>,
|
||||
<Button disabled={knowVisible} type="primary" onClick={() => getRead()}>知道了</Button>,
|
||||
<Button disabled={disFollowUp} onClick={() => getFollow()} type="primary">跟进</Button>
|
||||
]}
|
||||
>
|
||||
<Form
|
||||
{...layout}
|
||||
name="basic"
|
||||
form={form}
|
||||
>
|
||||
|
||||
<Form.Item
|
||||
label="标题"
|
||||
name="title"
|
||||
>
|
||||
<Input readOnly bordered={false} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="创建时间"
|
||||
name="createtime"
|
||||
>
|
||||
<Input readOnly bordered={false} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="内容"
|
||||
name="content"
|
||||
>
|
||||
<TextArea readOnly bordered={false} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default filesManageComponents
|
@ -1,162 +0,0 @@
|
||||
import { Button, Form, Input, message, Modal } from "antd"
|
||||
import { Color } from "chalk";
|
||||
import React, { useEffect, useState } from "react"
|
||||
import { describeSiteMsgDetail, getProjectById, selectMsgRead } from '../service'
|
||||
import '@/assets/ld_style.less'
|
||||
import { history } from 'umi';
|
||||
import { followUpAProjectSupplier } from '@/utils/session';
|
||||
|
||||
const { TextArea } = Input;
|
||||
|
||||
interface filesManageComponents {
|
||||
modalVisible: boolean;
|
||||
clarifyId: string;
|
||||
dateNum: Number;
|
||||
trelist: [];
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
const layout = {
|
||||
labelCol: { span: 6 },
|
||||
wrapperCol: { span: 15 },
|
||||
};
|
||||
|
||||
const filesManageComponents: React.FC<filesManageComponents> = (props) => {
|
||||
const { modalVisible, clarifyId, onCancel, trelist, dateNum } = props;
|
||||
const [form] = Form.useForm();
|
||||
const [detailId, setDetailId] = useState<any>(clarifyId); // 详情id
|
||||
const [lastVisible, setLastVisible] = useState<boolean>(trelist?.indexOf(clarifyId) == 0 ? true : false); // 上一条禁用
|
||||
const [nextVisible, setNextVisible] = useState<boolean>(trelist?.indexOf(clarifyId) == trelist?.length - 1 ? true : false); // 下一条禁用
|
||||
const [knowVisible, setKnowVisible] = useState<any>(false); // 知道了禁用
|
||||
const [projectId, setProjectId] = useState<any>(); // 项目id
|
||||
const [roomType, setRoomType] = useState<any>(); // 判断资审候审
|
||||
const [disFollowUp, setDisFollowUp] = useState<boolean>(false) //跟进按钮隐藏
|
||||
|
||||
useEffect(() => {
|
||||
Int(clarifyId);
|
||||
setDetailId(clarifyId)
|
||||
}, [clarifyId]);
|
||||
const Int = (detailId: any) => {
|
||||
describeSiteMsgDetail(detailId).then(res => {
|
||||
// if(res.code == 200){
|
||||
if (res?.servicecode) {
|
||||
let detailMess = JSON.parse(res.servicecode)
|
||||
setProjectId(detailMess.tp_id)
|
||||
setRoomType(detailMess.room_type)
|
||||
} else {
|
||||
// message.error('项目数据错误,无法获取流程,请联系管理员!')
|
||||
setDisFollowUp(true)
|
||||
}
|
||||
res.authorizestate == '0' ? setKnowVisible(false) : setKnowVisible(true)
|
||||
form.setFieldsValue({
|
||||
"title": res.title,
|
||||
"createtime": res.createtime,
|
||||
"content": res.content
|
||||
});
|
||||
// }
|
||||
});
|
||||
};
|
||||
|
||||
const next = () => { // 下一条
|
||||
setLastVisible(false)
|
||||
let current = trelist.indexOf(detailId)
|
||||
if (current < trelist.length - 2 && current != trelist.length - 2) {
|
||||
setDetailId(trelist[current + 1])
|
||||
Int(trelist[current + 1])
|
||||
} else if (current == trelist.length - 2) {
|
||||
setDetailId(trelist[current + 1])
|
||||
Int(trelist[current + 1])
|
||||
setNextVisible(true)
|
||||
} else {
|
||||
setNextVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
const last = () => { // 上一条
|
||||
setNextVisible(false)
|
||||
let current: any = trelist.indexOf(detailId)
|
||||
if (current > 0 && current != 1) {
|
||||
setDetailId(trelist[current - 1])
|
||||
Int(trelist[current - 1])
|
||||
} else if (current == 1) {
|
||||
setDetailId(trelist[current - 1])
|
||||
Int(trelist[current - 1])
|
||||
setLastVisible(true)
|
||||
} else {
|
||||
setLastVisible(true)
|
||||
}
|
||||
}
|
||||
|
||||
const getRead = () => { // 知道了
|
||||
selectMsgRead(detailId).then(res => {
|
||||
setKnowVisible(true)
|
||||
});
|
||||
}
|
||||
|
||||
const getFollow = async () => { // 跟进
|
||||
await getProjectById(projectId).then(async response => {
|
||||
if (response?.code == 200 && response?.success == true) {
|
||||
const resData = response?.data
|
||||
await followUpAProjectSupplier(resData);
|
||||
|
||||
if (roomType == '1') {
|
||||
history.push('/ProjectLayout/ZYuShen/Tender/supplier/SupplierClarificationList?roomType=1')
|
||||
} else {
|
||||
history.push('/ProjectLayout/Tender/supplier/SupplierClarificationList?roomType=2')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
destroyOnClose={true}
|
||||
getContainer={false}
|
||||
title='消息详情'
|
||||
visible={modalVisible}
|
||||
onCancel={() => onCancel()}
|
||||
width={800}
|
||||
centered
|
||||
footer={[
|
||||
<Button onClick={onCancel}>关闭</Button>,
|
||||
<Button disabled={knowVisible} type="primary" onClick={() => getRead()}>知道了</Button>,
|
||||
<Button disabled={disFollowUp} onClick={() => getFollow()} type="primary">跟进</Button>]}
|
||||
>
|
||||
<p className="tips">您有 {dateNum} 条未读澄清信息,当前只显示 6 条最近的澄清,请到<span onClick={() => history.push('/SystemMessage/message')}> 这里 </span>查看全部澄清信息</p>
|
||||
<Form
|
||||
{...layout}
|
||||
name="basic"
|
||||
form={form}
|
||||
>
|
||||
|
||||
<Form.Item
|
||||
label="标题"
|
||||
name="title"
|
||||
>
|
||||
<Input readOnly bordered={false} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="创建时间"
|
||||
name="createtime"
|
||||
>
|
||||
<Input readOnly bordered={false} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="内容"
|
||||
name="content"
|
||||
>
|
||||
<TextArea readOnly bordered={false} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
<div className="btnBox">
|
||||
<Button disabled={lastVisible} className="last" onClick={() => last()}>上一条</Button>
|
||||
<Button disabled={nextVisible} onClick={() => next()}>下一条</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default filesManageComponents
|
||||
|
@ -1,81 +0,0 @@
|
||||
import { Form, Input, Modal } from "antd"
|
||||
import React, { useEffect } from "react"
|
||||
import pageBg from '../../../../images/answer/bg.png'
|
||||
|
||||
const { TextArea } = Input;
|
||||
|
||||
interface QuestDetailProps {
|
||||
modalVisible: boolean;
|
||||
questData: any;
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
const layout = {
|
||||
labelCol: { span: 6 },
|
||||
wrapperCol: { span: 15 },
|
||||
};
|
||||
|
||||
const QuestDetail: React.FC<QuestDetailProps> = (props) => {
|
||||
const { modalVisible, questData, onCancel } = props;
|
||||
const [form] = Form.useForm();
|
||||
|
||||
useEffect(() => {
|
||||
Int();
|
||||
}, [questData?.id]);
|
||||
|
||||
const Int = () => {
|
||||
form.setFieldsValue({
|
||||
...questData
|
||||
})
|
||||
};
|
||||
|
||||
const getFollow = async () => { // 跟进
|
||||
window.open(`/QuestAnswer/Answer?code=${questData?.id}`);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
className="model-container"
|
||||
destroyOnClose={true}
|
||||
getContainer={false}
|
||||
title='参与调研'
|
||||
visible={modalVisible}
|
||||
onOk={() => getFollow()}
|
||||
onCancel={() => onCancel()}
|
||||
width={800}
|
||||
centered
|
||||
okText='参与'
|
||||
cancelText='返回'
|
||||
>
|
||||
<Form
|
||||
name="basic"
|
||||
form={form}
|
||||
>
|
||||
|
||||
<Form.Item
|
||||
name="title"
|
||||
className="model-title"
|
||||
>
|
||||
<Input readOnly bordered={false} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="截止时间"
|
||||
name="endTime"
|
||||
className="model-time"
|
||||
>
|
||||
<Input readOnly bordered={false} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="desc"
|
||||
>
|
||||
<TextArea className="remarks" readOnly bordered={false} autoSize />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
<div><img src={pageBg} /></div>
|
||||
</Modal>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default QuestDetail
|
@ -1,122 +0,0 @@
|
||||
import React, { useRef, useState } from 'react';
|
||||
import ProTable, { ActionType } from '@ant-design/pro-table';
|
||||
import { describeSiteMsg, getQuestList } from './service';
|
||||
import { Button, Card, Spin } from 'antd';
|
||||
import MessageDetail from "./components/messageDetail"
|
||||
import QuestDetail from './components/questDetail';
|
||||
|
||||
const FilesList: React.FC<{}> = () => {
|
||||
const checkRelationRef = useRef<ActionType>(); //操作数据后刷新列表
|
||||
const [messageDetail, setMessageDetail] = useState<boolean>(false);
|
||||
const [messId, setMessId] = useState<string>('');//公告id
|
||||
const [questVisible, setQuestVisible] = useState<boolean>(false);//问卷visible
|
||||
const [questData, setQuestData] = useState<any>({});//问卷数据
|
||||
const [loading, setLoading] = useState<boolean>(false);//loading
|
||||
|
||||
const columns: any = [
|
||||
{
|
||||
title: '序号',
|
||||
valueType: 'index',
|
||||
},
|
||||
{
|
||||
title: '标题',
|
||||
dataIndex: 'title',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createtime',
|
||||
valueType: 'dateTime',
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'templatetype',
|
||||
valueEnum: {
|
||||
1: { text: '提疑消息' },
|
||||
2: { text: '澄清消息' },
|
||||
3: { text: '调查问卷' },
|
||||
4: { text: '公告审批' },
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'authorizestate',
|
||||
initialValue: 'noRead',
|
||||
valueEnum: {
|
||||
0: { text: '未读' },
|
||||
1: { text: '已读' },
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 100,
|
||||
fixed: 'right',
|
||||
render: (record: any) => {
|
||||
return (
|
||||
record.templatetype == '3' ? (
|
||||
<Button type="text" key="participate" onClick={() => toParticipate(record.servicecode)}>参与调研</Button>
|
||||
) : (
|
||||
<Button type="text" key="detail" onClick={() => lookDetail(record.msgId)}>查看</Button>
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
const lookDetail = (id: any) => {
|
||||
setMessId(id)
|
||||
setMessageDetail(true)
|
||||
}
|
||||
|
||||
const toParticipate = async (servicecode: any) => {
|
||||
const { questId } = JSON.parse(servicecode);
|
||||
setLoading(true);
|
||||
await getQuestList({ id: questId }).then(res => {
|
||||
if (res?.code == 200 && res?.success) {
|
||||
setQuestData(res?.data)
|
||||
setQuestVisible(true)
|
||||
}
|
||||
}).finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card title="系统消息">
|
||||
<Spin spinning={loading}>
|
||||
<ProTable
|
||||
actionRef={checkRelationRef}
|
||||
columns={columns}
|
||||
size='small'
|
||||
className="searchH"
|
||||
search={false}
|
||||
request={async (params) =>
|
||||
await describeSiteMsg(params).then((res) => {
|
||||
if (res.code == 200) {
|
||||
return Promise.resolve({
|
||||
data: res.records,
|
||||
// success: res.success,
|
||||
total: res.total,
|
||||
current: res.current,
|
||||
});
|
||||
}
|
||||
return Promise.resolve({
|
||||
data: [],
|
||||
success: false,
|
||||
total: 0,
|
||||
current: 1,
|
||||
});
|
||||
})
|
||||
}
|
||||
pagination={{ defaultPageSize: 10, showSizeChanger: false }}//默认显示条数
|
||||
toolBarRender={false}
|
||||
/>
|
||||
</Spin>
|
||||
</Card>
|
||||
{messageDetail ? <MessageDetail messId={messId} onCancel={() => { setMessageDetail(false), checkRelationRef.current?.reload() }} modalVisible={messageDetail} /> : null}
|
||||
{questVisible ? <QuestDetail questData={questData} onCancel={() => { setQuestVisible(false), checkRelationRef.current?.reload() }} modalVisible={questVisible} /> : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default FilesList;
|
@ -1,46 +0,0 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
//系统消息列表
|
||||
export async function describeSiteMsg(data: any) {
|
||||
return request('/api/biz-service-ebtp-extend/v1/message/describeSiteMsg', {
|
||||
method: 'post',
|
||||
data: {
|
||||
pageNo: data?.current,
|
||||
pageSize: data?.pageSize
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
//新增角色列表
|
||||
export async function describeSiteMsgDetail(msId: any) {
|
||||
return request('/api/biz-service-ebtp-extend/v1/message/describeSiteMsgDetail/' + msId, {
|
||||
method: 'GET',
|
||||
})
|
||||
}
|
||||
|
||||
// 系统消息已读
|
||||
export async function selectMsgRead(id: any) {
|
||||
return request('/api/biz-service-ebtp-extend/v1/message/selectMsgRead/' + id, {
|
||||
method: 'GET',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询项目信息
|
||||
* @param id
|
||||
*/
|
||||
export function getProjectById(id: any) {
|
||||
return request('/api/biz-service-ebtp-project/v1/projectRecord/' + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询问卷数据
|
||||
* @param params {id: string}
|
||||
*/
|
||||
export async function getQuestList(params?: any) {
|
||||
return request(`/api/biz-service-ebtp-quest/mongdb/questForm/findQuestFormForUser`, {
|
||||
method: 'POST',
|
||||
requestType: 'form',
|
||||
data: params,
|
||||
});
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
@import '~antd/lib/style/themes/default.less';
|
||||
|
||||
.pre {
|
||||
margin: 12px 0;
|
||||
padding: 12px 20px;
|
||||
background: @input-bg;
|
||||
box-shadow: @card-shadow;
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
import React from 'react';
|
||||
import { PageContainer } from '@ant-design/pro-layout';
|
||||
import { Card, Alert, Typography } from 'antd';
|
||||
import styles from './Welcome.less';
|
||||
|
||||
const CodePreview: React.FC<{}> = ({ children }) => (
|
||||
<pre className={styles.pre}>
|
||||
<code>
|
||||
<Typography.Text copyable>{children}</Typography.Text>
|
||||
</code>
|
||||
</pre>
|
||||
);
|
||||
|
||||
export default (): React.ReactNode => (
|
||||
<PageContainer>
|
||||
<Card>
|
||||
<Alert
|
||||
message="更快更强的重型组件,已经发布。"
|
||||
type="success"
|
||||
showIcon
|
||||
banner
|
||||
style={{
|
||||
margin: -12,
|
||||
marginBottom: 24,
|
||||
}}
|
||||
/>
|
||||
<Typography.Text strong>
|
||||
高级表格{' '}
|
||||
<a href="https://protable.ant.design/" rel="noopener noreferrer" target="__blank">
|
||||
欢迎使用
|
||||
</a>
|
||||
</Typography.Text>
|
||||
<CodePreview>yarn add @ant-design/pro-table</CodePreview>
|
||||
<Typography.Text
|
||||
strong
|
||||
style={{
|
||||
marginBottom: 12,
|
||||
}}
|
||||
>
|
||||
高级布局{' '}
|
||||
<a href="https://prolayout.ant.design/" rel="noopener noreferrer" target="__blank">
|
||||
欢迎使用
|
||||
</a>
|
||||
</Typography.Text>
|
||||
<CodePreview>yarn add @ant-design/pro-layout</CodePreview>
|
||||
</Card>
|
||||
</PageContainer>
|
||||
);
|
5
src/pages/about/about.tsx
Normal file
5
src/pages/about/about.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
import React from 'react';
|
||||
const AboutPage: React.FC = () => {
|
||||
return <>AboutPage</>;
|
||||
};
|
||||
export default AboutPage;
|
5
src/pages/announce/announce.tsx
Normal file
5
src/pages/announce/announce.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
import React from 'react';
|
||||
const AnnouncePage: React.FC = () => {
|
||||
return <>announcePage</>;
|
||||
};
|
||||
export default AnnouncePage;
|
@ -10,8 +10,8 @@
|
||||
<meta name="description" content="
|
||||
开箱即用的中台前端/设计解决方案。" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> -->
|
||||
<title></title>
|
||||
<script>
|
||||
<title>中远海运</title>
|
||||
<!-- <script>
|
||||
if (document.URL.includes('partyMemberTopic')) {
|
||||
document.getElementsByTagName('title')[0].innerText = "党建攻坚";
|
||||
} else if (document.URL.includes('highQualityOperation')) {
|
||||
@ -19,7 +19,7 @@
|
||||
} else {
|
||||
document.getElementsByTagName('title')[0].innerText = "中国联通电子招投标系统";
|
||||
}
|
||||
</script>
|
||||
</script> -->
|
||||
<!-- <script type="text/javascript" src="https://customer.unib.cn:8080/dl/js/b2b/ntkfstat.js?siteid=bl_1000"
|
||||
charset="utf-8"></script> -->
|
||||
<script type="text/javascript" src="<%= context.config.publicPath +'officecontrol/ntkobackground.min.20220624.js'%>"
|
||||
@ -27,7 +27,7 @@
|
||||
<script type="text/javascript" src="<%= context.config.publicPath +'screen/jsencrypt.min.js'%>"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%= context.config.publicPath +'screen/jsWebControl-1.0.0.min.js'%>"
|
||||
charset="utf-8"></script>
|
||||
charset="utf-8"></script>
|
||||
<link rel="icon" href="<%= context.config.publicPath +'favicon.ico'%>" type="image/x-icon" />
|
||||
<!-- <link rel="icon" href="./../assets/logo.svg"/> -->
|
||||
</head>
|
||||
|
5
src/pages/download/download.tsx
Normal file
5
src/pages/download/download.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
import React from 'react';
|
||||
const DownloadPage: React.FC = () => {
|
||||
return <>DownloadPage</>;
|
||||
};
|
||||
export default DownloadPage;
|
10
src/pages/index/index.tsx
Normal file
10
src/pages/index/index.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
import React from 'react';
|
||||
const IndexPage:React.FC = () => {
|
||||
return (
|
||||
<div>IndexPage</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export default IndexPage;
|
10
src/pages/login.tsx
Normal file
10
src/pages/login.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
import React from 'react';
|
||||
const LoginPage:React.FC = () => {
|
||||
return (
|
||||
<div>LoginPage</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export default LoginPage;
|
5
src/pages/notice/notice.tsx
Normal file
5
src/pages/notice/notice.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
import React from 'react';
|
||||
const NoticePage: React.FC = () => {
|
||||
return <>NoticePage</>;
|
||||
};
|
||||
export default NoticePage;
|
5
src/pages/policy/policy.tsx
Normal file
5
src/pages/policy/policy.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
import React from 'react';
|
||||
const PolicyPage: React.FC = () => {
|
||||
return <>PolicyPage</>;
|
||||
};
|
||||
export default PolicyPage;
|
Reference in New Issue
Block a user