7.15 党建攻坚管理端

This commit is contained in:
jl-zhoujl2
2022-07-15 08:58:51 +08:00
parent c98f3d1a71
commit 9ab4413e88
17 changed files with 796 additions and 346 deletions

View File

@ -4,7 +4,6 @@ import home from './HomePage/router_home';
import juryRoom from './JuryRoom/router_menuJury.config';
import approvalForm from './router_approval_form';
import partyMemberTopic from './router_partyMemberTopic';
import partyManagement from './router_partyManagement';
export default [
//========================================================================登陆
...transfer,//跳转、登陆
@ -112,7 +111,6 @@ export default [
},
...home,//各角色主页
...menuaZhaoBiao,//项目菜单所有路由
...partyManagement,//党建攻坚管理端
{//问卷调查
name: 'Questionnaire',
icon: 'UnorderedListOutlined',

View File

@ -1,23 +0,0 @@
export default [
{
name: 'partyMemberTopicManage',
path: '/partyMemberTopicManage',
routes: [
{//活动维护
name: 'EventMaintenance',
path: '/partyMemberTopicManage/EventMaintenance',
component: './PartyMemberTopic/Management/EventMaintenance',
},
{ //意见收集管理
name: 'OpinionCollection',
path: '/partyMemberTopicManage/OpinionCollection',
component: './PartyMemberTopic/Management/OpinionCollection',
},
{ //物资采购专业线数据维护
name: 'ProLineMaintenance',
path: '/partyMemberTopicManage/ProLineMaintenance',
component: './PartyMemberTopic/Management/ProLineMaintenance',
},
]
}
];

View File

@ -43,6 +43,11 @@ export default [
path: '/partyMemberTopic/newsDetail',
component: './PartyMemberTopic/NewsDetail',
},
{//管理端首页
name: 'manage',
path: '/partyMemberTopic/manage',
component: './PartyMemberTopic/Management/Manage',
},
]
}
},
];

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -196,13 +196,19 @@ const BraftText: React.FC<WangType> = (props) => {
// 重新设置编辑器内容
echo && editor.txt.html(echo);
value && editor.txt.html(value);
return () => {
// 组件销毁时销毁编辑器 注class写法需要在componentWillUnmount中调用
editor.destroy()
setLoading(false);
setContent('');
}
}, [value, echo]);
}, [echo]);
useEffect(() => {
// 重新设置编辑器内容
value && editor.txt.html(value);
}, [value])
/**
*提供给父级的内容
**/

View File

@ -340,6 +340,10 @@
color: #c9c9c9;
}
.right-manager {
margin-top: 12px;
}
// .right-graph {
// padding-top: 26px;

View File

@ -11,6 +11,7 @@ import topic_other from '@/assets/topic/topic_other.png'
import topic_project_picture from '@/assets/topic/topic_project_picture.jpg'
import topic_bottom_button from '@/assets/topic/topic_bottom_button.png'
import topic_right_material from '@/assets/topic/topic_right_material.png'
import topic_right_manager from '@/assets/topic/topic_right_manager.jpg'
import topic_partymember from '@/assets/topic/topic_partymember.png'
import topic_partybranch from '@/assets/topic/topic_partybranch.png'
import topic_totalamount from '@/assets/topic/topic_totalamount.png'
@ -25,7 +26,7 @@ import topic_interview from '@/assets/topic/topic_interview.png'
import topic_assure from '@/assets/topic/topic_assure.png'
import topic_difficult from '@/assets/topic/topic_difficult.png'
import { getHomeActivity, getHomeBanner, getHomeContact, getHomeGraceful, getHomeProject, getHomeRight, submitAdvice } from './service';
import { chunk, formatTime, getImageUrl } from '../utils';
import { chunk, formatTime, getImageUrl, managerAuthority } from '../utils';
import ExtendUpload from '@/utils/ExtendUpload';
import { getSessionUserData } from '@/utils/session';
@ -589,6 +590,14 @@ const Home: React.FC<{}> = () => {
<RightDisplayContent index={8} data={rightList} img={topic_assure} color="number-purple" />
<RightDisplayContent index={9} data={rightList} img={topic_difficult} color="number-purple" />
</div>
{managerAuthority("ebtp-party-admin") ? null : (
<>
<Divider className='right-divider' />
<div className='right-manager'>
<img src={topic_right_manager} className='right-material' onClick={() => window.open("/partyMemberTopic/manage")} />
</div>
</>
)}
</div>
</div>
<div className='bottom-global'>

View File

@ -1,7 +1,11 @@
import React, { useRef } from 'react';
import { Modal, Card, Col, Form, Input, Row, Space, Typography, Select } from 'antd';
import React, { useEffect, useRef, useState } from 'react';
import { Modal, Col, Form, Input, Row, Select, Spin, message } from 'antd';
import BraftText from '@/components/richText/wang';
import ExtendUpload from '@/utils/ExtendUpload';
import { isEmpty, isNotEmpty } from '@/pages/PartyMemberTopic/utils';
import { getSessionUserData } from '@/utils/session';
import moment from 'moment';
import { saveEventData } from '../service';
const layout = {
labelCol: { span: 3 },
@ -17,23 +21,95 @@ const modalHeight = window.innerHeight * 96 / 100;
interface EventMaintenanceModalProps {
modalVisible: boolean;
onCancel: () => void;
record: any;
}
const EventMaintenanceModal: React.FC<EventMaintenanceModalProps> = (props) => {
const { modalVisible, onCancel } = props;
const { modalVisible, onCancel, record } = props;
const [form] = Form.useForm();
const { Option } = Select;
const { TextArea } = Input;
const braftRef = useRef<any>(null);
const onFinish = (values: any) => {
console.log(values);
//userData
const userData = getSessionUserData();
//只读 true只读 false编辑
const readOnly: boolean = record.editCode == "2";
//上传文件id
const [imageId, setImageId] = useState<string>('');
//富文本正文图片objectId
const [contentImageId, setContentImageId] = useState<string>('');
//活动类型选择
const [typeSelect, setTypeSelect] = useState<string>('');
//loading
const [loading, setLoading] = useState<boolean>(false);
//保存
const onSubmit = () => {
if (isNotEmpty(typeSelect) && typeSelect != "3" && isEmpty(form.getFieldValue("image"))) {
message.error("请上传主图");
return;
}
form.validateFields().then(values => {
const data = {
banner: null,
createBy: null,
id: null,
image: null,
secordTitle: null,
sendTime: null,
sort: null,
status: null,
title: null,
type: null,
...values,
content: braftRef.current.getHtml(),
contentImageId: braftRef.current.getImageId(),
createTime: null,
}
setLoading(true);
saveEventData(data).then(res => {
if (res?.code == 200) {
message.success('保存成功');
onCancel();
}
}).finally(() => {
setLoading(false);
})
})
};
const onTypeChage = (value: any) => {
setTypeSelect(value);
};
useEffect(() => {
if (record.editCode == "0") {//新建
form.setFieldsValue({
id: null,
createBy: userData?.fullName,
createTime: moment().format("YYYY-MM-DD HH:mm:ss"),
});
} else if (record.editCode == "1" || record.editCode == "2") {//编辑 查看
form.setFieldsValue(record);
setImageId(record?.image);
setContentImageId(record?.contentImageId);
onTypeChage(record?.type);
}
return () => {
setImageId('');
setContentImageId('');
setTypeSelect('');
setLoading(false);
};
}, [record?.id])
return (
<Modal
destroyOnClose
title="新建"
title={record.editCode == "0" ? "新建" : record.editCode == "1" ? "编辑" : "查看"}
visible={modalVisible}
onCancel={() => onCancel()}
onOk={() => onSubmit()}
okButtonProps={{ loading: loading, hidden: readOnly }}
okText="保存"
maskClosable={false}
style={{ maxHeight: modalHeight }}
@ -42,58 +118,73 @@ const EventMaintenanceModal: React.FC<EventMaintenanceModalProps> = (props) => {
cancelText="返回"
width={'70%'}
>
<Form {...layout} name="nest-messages" form={form} onFinish={onFinish} validateMessages={validateMessages}>
<Form.Item name="id" hidden>
<Input />
</Form.Item>
<Form.Item name="num" label="活动类型" rules={[{ required: true }]}>
<Select style={{ width: 150 }}>
<Option value="0"></Option>
<Option value="1"></Option>
<Option value="2"></Option>
</Select>
</Form.Item>
<Form.Item
name="title"
label="标题名称"
rules={[{ required: true }]}
tooltip="此项不超过18个汉字"
<Spin spinning={loading}>
<Form
{...layout}
name="nest-messages"
form={form}
validateMessages={validateMessages}
preserve={false}
>
<Input maxLength={18} />
</Form.Item>
<Form.Item
name="subtitle"
label="副标题名称"
rules={[{ required: true }]}
tooltip="此项不超过120个汉字"
>
<Input maxLength={120} />
</Form.Item>
<Form.Item
name="file"
label="主图"
extra="注为了避免页面进入加载时间过长照片尽量压缩至500K左右"
>
<ExtendUpload bid={''} btnName="上传" maxCount={1} maxSize={0.6} uploadProps={{ name: "file", disabled: false, accept: ".jfif,.pjpeg,.jpeg,.pjp,.jpg,.png,.gif,.bmp,.dib" }} />
</Form.Item>
<Form.Item label="编制人员" style={{ margin: 0 }}>
<Row>
<Col span={10}>
<Form.Item name="people">
<Input readOnly />
</Form.Item>
</Col>
<Col span={12} offset={2}>
<Form.Item name="date" label="编制日期">
<Input readOnly />
</Form.Item>
</Col>
</Row>
</Form.Item>
<Form.Item name="col" label="正文内容" rules={[{ required: true }]}>
<BraftText braftRef={braftRef} echo={null} disabled={false} />
</Form.Item>
</Form>
<Form.Item name="id" hidden>
<Input />
</Form.Item>
<Form.Item name="type" label="活动类型" rules={[{ required: !readOnly }]}>
<Select style={{ width: 150 }} onChange={onTypeChage} disabled={readOnly}>
<Option value="1"></Option>
<Option value="2"></Option>
<Option value="3"></Option>
</Select>
</Form.Item>
<Form.Item
name="title"
label="标题名称"
rules={[{ required: !readOnly }]}
tooltip="此项不超过18个汉字"
>
<Input maxLength={18} disabled={readOnly} />
</Form.Item>
{typeSelect == "2" && <Form.Item
name="secordTitle"
label="副标题名称"
rules={[{ required: typeSelect == "2" && !readOnly }]}
tooltip="此项不超过120个汉字"
>
<TextArea autoSize maxLength={120} disabled={readOnly} />
</Form.Item>}
{(isNotEmpty(typeSelect) && typeSelect != "3") && <Form.Item
name="image"
label="主图"
extra="注为了避免页面进入加载时间过长照片尽量压缩至500K左右"
required={!readOnly}
>
<ExtendUpload bid={imageId} btnName="上传" maxCount={1} maxSize={0.6} uploadProps={{ name: "file", disabled: readOnly, accept: ".jfif,.pjpeg,.jpeg,.pjp,.jpg,.png,.gif,.bmp,.dib" }} />
</Form.Item>}
<Form.Item label="编制人员" style={{ margin: 0 }}>
<Row>
<Col span={10}>
<Form.Item name="createBy">
<Input readOnly disabled={readOnly} />
</Form.Item>
</Col>
<Col span={12} offset={2}>
<Form.Item name="createTime" label="编制日期">
<Input readOnly disabled={readOnly} />
</Form.Item>
</Col>
</Row>
</Form.Item>
<Form.Item name="content" label="正文内容" rules={[{ required: !readOnly }]}>
{readOnly ? (
<div style={{ border: '1px solid #c9d8db', padding: '16px' }}>
<div dangerouslySetInnerHTML={{ __html: record?.content }}></div>
</div>
) : (
<BraftText braftRef={braftRef} disabled={false} useImage imageId={contentImageId} />
)}
</Form.Item>
</Form>
</Spin>
</Modal>
);
};

View File

@ -1,151 +1,236 @@
import { PlusOutlined } from '@ant-design/icons';
import { ActionType, ProColumns } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import { Button, Card } from 'antd';
import { Button, Card, message, Popconfirm } from 'antd';
import React, { useState } from 'react';
import { useRef } from 'react';
import EventMaintenanceModal from './components/EventMaintenanceModal';
import { changeEventStatus, deleteEvent, getEventList } from './service';
import { managerAuthority } from '../../utils';
const data = [
{
id: 1,
index: 1,
title: 1,
type: 0,
},
{
id: 2,
index: 2,
title: 2,
type: 1,
},
{
id: 3,
index: 3,
title: 3,
type: 2,
},
{
id: 4,
index: 4,
title: 4,
type: 2,
},
]
const columns: ProColumns<any>[] = [
{
title: '序号',
dataIndex: 'index',
valueType: 'index',
width: 48,
},
{
title: '标题名称',
dataIndex: 'title',
ellipsis: true,
},
{
title: '类型',
dataIndex: 'type',
valueType: 'select',
valueEnum: {
0: { text: '首页' },
1: { text: '活动风采' },
2: { text: '攻坚克难项目' },
},
},
{
title: '发布时间',
key: 'showTime',
dataIndex: 'created_at',
valueType: 'dateTime',
hideInSearch: true,
},
{
title: '状态',
dataIndex: 'state',
valueType: 'select',
valueEnum: {
0: { text: '草稿' },
1: { text: '发布' },
},
},
{
title: '开始时间',
dataIndex: 'starttime',
valueType: 'date',
hideInTable: true,
},
{
title: '结束时间',
dataIndex: 'endtime',
valueType: 'date',
hideInTable: true,
},
{
title: '发布人',
dataIndex: 'people',
hideInSearch: true,
},
{
title: '操作',
hideInSearch: true,
render: (text, record, _, action) => [
<Button type='text' key="view">
</Button>,
<Button type='text' key="withdraw">
</Button>,
<Button
type='text'
key="editable"
>
</Button>,
<Button type='text' key="delete">
</Button>,
<Button type='text' key="release">
</Button>,
],
},
];
export default () => {
const EventMaintenance: React.FC<{}> = () => {
const actionRef = useRef<ActionType>();
//新建 编辑 查看
const [modalVisible, setModalVisible] = useState<boolean>(false);
//行数据
const [recordData, setRecordData] = useState<any>({});
//loading
const [loading, setLoading] = useState<boolean>(false);
//新建 编辑 查看
const editClick = (record: any, code: string) => {
record["editCode"] = code; //新建0 编辑1 查看2
setRecordData(record);
setModalVisible(true);
}
//撤回 发布
const changeClick = async (record: any, code: string) => {
const params = {
id: record.id,
status: code,//草稿0 发布1
}
setLoading(true);
await changeEventStatus(params).then(res => {
if (res?.code == 200) {
message.success("操作成功");
actionRef.current?.reload();
}
}).finally(() => {
setLoading(false);
})
}
//删除
const deleteClick = async (record: any) => {
setLoading(true);
await deleteEvent({ id: record.id }).then(res => {
if (res?.code == 200) {
message.success("删除成功");
actionRef.current?.reload();
}
}).finally(() => {
setLoading(false);
})
}
//modal关闭
const onCancel = () => {
setModalVisible(false);
setRecordData({});
actionRef.current?.reload();
}
const columns: ProColumns<any>[] = [
{
title: '序号',
dataIndex: 'index',
valueType: 'index',
width: 48,
},
{
title: '标题名称',
dataIndex: 'title',
},
{
title: '类型',
dataIndex: 'type',
valueType: 'select',
valueEnum: {
"1": { text: '首页' },
"2": { text: '活动风采' },
"3": { text: '攻坚克难项目' },
},
},
{
title: '发布时间',
key: 'sendTime',
dataIndex: 'sendTime',
valueType: 'dateTime',
hideInSearch: true,
},
{
title: '状态',
dataIndex: 'status',
valueType: 'select',
valueEnum: {
"0": { text: '草稿' },
"1": { text: '发布' },
},
},
{
title: '开始时间',
dataIndex: 'startTime',
valueType: 'date',
hideInTable: true,
},
{
title: '结束时间',
dataIndex: 'endTime',
valueType: 'date',
hideInTable: true,
},
{
title: '发布人',
dataIndex: 'createBy',
hideInSearch: true,
},
{
title: '操作',
hideInSearch: true,
render: (text, record, _, action) =>
record.status == "1" ? [
<Button
type='text'
key="view"
onClick={() => editClick(record, "2")}
>
</Button>,
<Popconfirm
title="撤回后,活动将不再发布,确认撤回?"
onConfirm={() => changeClick(record, "0")}
okText="确认"
cancelText="取消"
>
<Button
type='text'
key="withdraw"
hidden={managerAuthority("ebtp-party-admin")}
>
</Button>
</Popconfirm>,
] : [
<Button
type='text'
key="editable"
onClick={() => editClick(record, "1")}
hidden={managerAuthority("ebtp-party-admin")}
>
</Button>,
<Popconfirm
title="此活动将彻底删除,确认删除?"
onConfirm={() => deleteClick(record)}
okText="确认"
cancelText="取消"
>
<Button
type='text'
key="delete"
hidden={managerAuthority("ebtp-party-admin")}
>
</Button>
</Popconfirm>,
<Popconfirm
title="活动将发布,确认发布?"
onConfirm={() => changeClick(record, "1")}
okText="确认"
cancelText="取消"
>
<Button
type='text'
key="release"
hidden={managerAuthority("ebtp-party-admin")}
>
</Button>
</Popconfirm>,
],
},
];
return (
<Card className="zjl-entrust confirm">
<Card className="zjl-entrust confirm" bodyStyle={{ padding: '16px 24px 0px', height: window.innerHeight - 105, overflowY: 'auto' }}>
<ProTable<any>
columns={columns}
actionRef={actionRef}
loading={loading}
request={async (params) => {
return {
data: data,
success: true,
};
setLoading(true);
return await getEventList(params).then(res => {
if (res?.success) {
return {
data: res?.data.records,
success: res?.success,
total: res?.data.total
};
}
return {
data: [],
success: false,
total: 0,
};
}).finally(() => {
setLoading(false);
})
}}
rowKey="id"
options={false}
pagination={{
pageSize: 10,
onChange: (page) => console.log(page),
}}
search={{
defaultCollapsed: false,//默认展开
}}
dateFormatter="string"
toolBarRender={() => [
<Button key="button" icon={<PlusOutlined />} type="primary" onClick={() => setModalVisible(true)}>
<Button
key="button"
icon={<PlusOutlined />}
type="primary"
onClick={() => editClick({}, "0")}
loading={loading}
hidden={managerAuthority("ebtp-party-admin")}
>
</Button>
]}
/>
<EventMaintenanceModal modalVisible={modalVisible} onCancel={() => setModalVisible(false)} />
{modalVisible && <EventMaintenanceModal modalVisible={modalVisible} onCancel={() => onCancel()} record={recordData} />}
</Card>
);
};
};
export default EventMaintenance

View File

@ -0,0 +1,36 @@
import request from '@/utils/request';
//活动维护列表
export async function getEventList(data: any) {
return request('/api/biz-service-ebtp-extend/v1/eventmaintain/styleProject/list', {
method: 'POST',
data: {
...data,
pageNo: data.current,
},
});
}
//发布或撤回维护数据
export async function changeEventStatus(params: any) {
return request('/api/biz-service-ebtp-extend/v1/eventmaintain/styleProject/send', {
method: 'GET',
params: { ...params },
});
}
//删除维护数据
export async function deleteEvent(params: any) {
return request('/api/biz-service-ebtp-extend/v1/eventmaintain/styleProject/delete', {
method: 'GET',
params: { ...params },
});
}
//保存维护数据
export async function saveEventData(data: any) {
return request('/api/biz-service-ebtp-extend/v1/eventmaintain/styleProject/save', {
method: 'POST',
data: { ...data },
});
}

View File

@ -0,0 +1,42 @@
.header {
background-color: #b30000;
color: white;
font-size: 20px;
height: 56px;
display: flex;
.headerAlign {
align-self: center;
margin-left: 20px;
font-weight: 400;
}
.rightBtns {
position: absolute;
right: 0;
li {
float: left;
line-height: 56px;
font-size: 14px;
color: #fff;
padding: 0 14px;
font-weight: 400 !important;
list-style: none;
span {
padding-right: 6px;
font-size: 16px;
}
a {
color: #fff;
}
}
}
}
.topic-manager-tabs .ant-tabs-nav {
background: #fff;
margin: 0 0 0 24px
}

View File

@ -0,0 +1,57 @@
import React, { useState } from 'react';
import { Avatar, Tabs } from 'antd';
import { UserSwitchOutlined, CarryOutOutlined } from '@ant-design/icons';
import moment from 'moment'
import logo from '@/assets/logo.svg';
import styles from './index.less';
import './index.less';
import { getSessionUserData } from "@/utils/session";
import EventMaintenance from '../EventMaintenance';
import OpinionCollection from '../OpinionCollection';
import ProLineMaintenance from '../ProLineMaintenance';
const Dashboard: React.FC<{}> = () => {
let data = getSessionUserData();
const { TabPane } = Tabs;
const [tabsSelect, setTabsSelect] = useState<string>("1")
const onChange = (key: string) => {
setTabsSelect(key)
};
return (
<>
<div className={styles.header}>
<div className={styles.headerAlign} style={{ position: "relative", top: "2px", fontSize: "16px", fontWeight: "600" }}>
<img src={logo} style={{ height: "30px", marginRight: "10px", position: 'relative', top: '-2px' }} />
</div>
<ul className={styles.rightBtns}>
<li><CarryOutOutlined />{moment().format("YYYY-MM-DD")}</li>
{data?.organizationName == null ? null : (<li><UserSwitchOutlined />{data.organizationName}</li>)}
<li>
<Avatar size="small" src="https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png" style={{ width: '30px' }} />
<a className="antd-dropdown-link" style={{ color: "#fff", marginRight: "36px" }}>
{data.fullName}
</a>
</li>
</ul>
</div>
<div className="topic-manager-tabs" style={{ background: '#fff' }}>
<Tabs defaultActiveKey="1" onChange={onChange}>
<TabPane tab="活动维护" key="1">
{tabsSelect == "1" && <EventMaintenance />}
</TabPane>
<TabPane tab="意见收集管理" key="2">
{tabsSelect == "2" && <OpinionCollection />}
</TabPane>
<TabPane tab="物资采购专业线数据维护" key="3">
{tabsSelect == "3" && <ProLineMaintenance />}
</TabPane>
</Tabs>
</div>
</>
);
};
export default Dashboard;

View File

@ -1,133 +1,196 @@
import { UploadOutlined } from '@ant-design/icons';
import { ActionType, ProColumns } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import { Button, Card } from 'antd';
import React from 'react';
import { Button, Card, Space, Typography } from 'antd';
import React, { useState } from 'react';
import { useRef } from 'react';
import { getOpinionList } from './service';
import { isEmpty, managerAuthority } from '../../utils';
import { downloadFileObjectId } from '@/utils/DownloadUtils';
const data = [
{
id: 1,
index: 1,
title: 1,
type: 0,
},
{
id: 2,
index: 2,
title: 2,
type: 1,
},
{
id: 3,
index: 3,
title: 3,
type: 2,
},
{
id: 4,
index: 4,
title: 4,
type: 2,
},
]
const columns: ProColumns<any>[] = [
{
title: '序号',
dataIndex: 'index',
valueType: 'index',
width: 48,
},
{
title: '意见类型',
dataIndex: 'type',
valueType: 'select',
valueEnum: {
0: { text: '网络运营' },
1: { text: '综合行政' },
2: { text: '市场' },
},
},
{
title: '意见内容',
dataIndex: 'title',
ellipsis: true,
hideInSearch: true,
},
{
title: '补充信息',
dataIndex: 'other',
ellipsis: true,
hideInSearch: true,
},
{
title: '提交时间',
key: 'showTime',
dataIndex: 'created_at',
valueType: 'dateTime',
hideInSearch: true,
},
{
title: '开始时间',
dataIndex: 'starttime',
valueType: 'date',
hideInTable: true,
},
{
title: '结束时间',
dataIndex: 'endtime',
valueType: 'date',
hideInTable: true,
},
{
title: '提交人员',
dataIndex: 'people',
hideInSearch: true,
},
{
title: '附件管理',
hideInSearch: true,
render: (text, record, _, action) => [
<Button type='text' key="download">
</Button>,
],
},
];
export default () => {
const OpinionCollection: React.FC<{}> = () => {
const actionRef = useRef<ActionType>();
const { Text, Link } = Typography;
//loading
const [loading, setLoading] = useState<boolean>(false);
//select
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
const onSelectChange = (newSelectedRowKeys: React.Key[]) => {
setSelectedRowKeys(newSelectedRowKeys);
};
//下载附件
const downloadClick = (e: any, record: any) => {
e.preventDefault();
downloadFileObjectId(record.attachmentImage);
}
//导出&全量导出
const exportData = (ids?: any[]) => {
let url = "/api/biz-service-ebtp-extend/v1/eventmaintain/suggestion/export/";
let params = '';
if (ids) {
for (let i = 0, length = ids.length; i < length; i++) {
if (i == 0) {
params += `?ids=${ids[i]}`;
} else {
params += `&ids=${ids[i]}`;
}
}
}
url += params;
window.location.href = url;
actionRef.current?.reloadAndRest?.();
}
const columns: ProColumns<any>[] = [
{
title: '序号',
dataIndex: 'index',
valueType: 'index',
width: 48,
},
{
title: '意见类型',
dataIndex: 'suggestionType',
valueType: 'select',
valueEnum: {
"网络运营": { text: '网络运营' },
"IT": { text: 'IT' },
"市场": { text: '市场' },
"综合行政": { text: '综合行政' },
"其他": { text: '其他' },
},
},
{
title: '意见内容',
dataIndex: 'suggestionContent',
width: '30%',
hideInSearch: true,
},
{
title: '补充信息',
dataIndex: 'instructions',
width: '20%',
hideInSearch: true,
},
{
title: '提交时间',
key: 'createTime',
dataIndex: 'createTime',
valueType: 'dateTime',
hideInSearch: true,
},
{
title: '开始时间',
dataIndex: 'startTime',
valueType: 'date',
hideInTable: true,
},
{
title: '结束时间',
dataIndex: 'endTime',
valueType: 'date',
hideInTable: true,
},
{
title: '提交人员',
dataIndex: 'suggestionSponsor',
hideInSearch: true,
},
{
title: '附件管理',
hideInSearch: true,
render: (text, record, _, action) =>
isEmpty(record.attachmentImage) ? [
<Text
key="download"
disabled
>
</Text>,
] : [
<Link
key="download"
href='#'
onClick={(e) => downloadClick(e, record)}
hidden={managerAuthority("ebtp-party-admin")}
>
</Link>,
]
},
];
return (
<Card className="zjl-entrust confirm">
<Card className="zjl-entrust confirm" bodyStyle={{ padding: '16px 24px 0px', height: window.innerHeight - 105, overflowY: 'auto' }}>
<ProTable<any>
columns={columns}
actionRef={actionRef}
loading={loading}
request={async (params) => {
return {
data: data,
success: true,
};
setLoading(true);
return await getOpinionList(params).then(res => {
if (res?.success) {
return {
data: res?.data.records,
success: res?.success,
total: res?.data.total
};
}
return {
data: [],
success: false,
total: 0,
};
}).finally(() => {
setLoading(false);
})
}}
rowKey="id"
options={false}
pagination={{
pageSize: 10,
onChange: (page) => console.log(page),
}}
search={{
span: 6,
defaultCollapsed: false,//默认展开
}}
rowSelection={{}}
rowSelection={{
selectedRowKeys,
onChange: onSelectChange,
preserveSelectedRowKeys: true,
}}
tableAlertRender={({ selectedRowKeys, selectedRows, onCleanSelected }) => (
<Space size={24}>
<span>
{selectedRowKeys.length}
<a
style={{ marginLeft: 8 }}
onClick={() => exportData(selectedRowKeys)}
hidden={managerAuthority("ebtp-party-admin")}
>
</a>
</span>
</Space>
)}
dateFormatter="string"
toolBarRender={() => [
<Button key="button" icon={<UploadOutlined />} type="primary">
<Button
key="button"
icon={<UploadOutlined />}
type="primary"
onClick={() => exportData()}
loading={loading}
hidden={managerAuthority("ebtp-party-admin")}
>
</Button>
]}
/>
</Card>
);
};
};
export default OpinionCollection

View File

@ -0,0 +1,12 @@
import request from '@/utils/request';
//意见列表
export async function getOpinionList(data: any) {
return request('/api/biz-service-ebtp-extend/v1/eventmaintain/suggestion/list', {
method: 'POST',
data: {
...data,
pageNo: data.current,
},
});
}

View File

@ -1,6 +1,8 @@
import { Button, Card, Col, Form, Input, Row, Space, Typography } from 'antd';
import React from 'react';
import { Button, Card, Col, Form, Input, message, Row, Space, Spin, Typography } from 'antd';
import React, { useEffect, useState } from 'react';
import { managerAuthority } from '../../utils';
import { getRightData, saveRightData } from './service';
const layout = {
labelCol: { span: 6 },
@ -10,42 +12,75 @@ const validateMessages = {
required: '请填写此项',
};
export default () => {
const ProLineMaintenance: React.FC<{}> = () => {
const { Title } = Typography;
const onFinish = (values: any) => {
console.log(values);
const [form] = Form.useForm();
//按钮显隐 查看-true 编辑-false
const [display, setDisplay] = useState<boolean>(true);
//loading
const [loading, setLoading] = useState<boolean>(false);
const onSubmit = () => {
form.validateFields().then(value => {
setLoading(true);
saveRightData(value).then(res => {
if (res?.code == 200) {
message.success("发布成功");
}
}).finally(() => {
setLoading(false);
})
})
};
//取数据
const getData = () => {
getRightData().then(res => {
if (res?.code == 200) {
form.setFieldsValue(res?.data);
}
})
}
useEffect(() => {
getData();
}, [])
return (
<Card>
<Space>
<Button type='primary'></Button>
<Button></Button>
</Space>
<Title level={3}></Title>
<Form {...layout} name="nest-messages" onFinish={onFinish} validateMessages={validateMessages}>
<Row>
<Col span={12}>
<Form.Item name="num" label="一线调研次数" rules={[{ required: true }]}>
<Input />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="name" label="访问人数" rules={[{ required: true }]}>
<Input />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="req" label="保障需求条数" rules={[{ required: true }]}>
<Input />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="bumb" label="攻坚克难项目个数" rules={[{ required: true }]}>
<Input />
</Form.Item>
</Col>
</Row>
</Form>
<Card bodyStyle={{ padding: '16px 24px 0px', height: window.innerHeight - 105, overflowY: 'auto' }}>
<Spin spinning={loading}>
<Space>
<Button onClick={() => setDisplay(value => !value)}>{display ? '编辑' : '查看'}</Button>
<Button type='primary' disabled={display} onClick={() => onSubmit()} hidden={managerAuthority("ebtp-party-admin")}></Button>
</Space>
<Title level={3} style={{ margin: '16px 0 24px' }}></Title>
<Form {...layout} name="nest-messages" form={form} validateMessages={validateMessages}>
<Row>
<Col span={12}>
<Form.Item name="yxdy" label="一线调研次数" rules={[{ required: true }]}>
<Input disabled={display} />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="ftrs" label="访谈人数" rules={[{ required: true }]}>
<Input disabled={display} />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="bzxq" label="保障需求条数" rules={[{ required: true }]}>
<Input disabled={display} />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="gjknxm" label="攻坚克难项目个数" rules={[{ required: true }]}>
<Input disabled={display} />
</Form.Item>
</Col>
</Row>
</Form>
</Spin>
</Card>
);
};
};
export default ProLineMaintenance

View File

@ -0,0 +1,16 @@
import request from '@/utils/request';
//查询右侧专业线数据
export async function getRightData() {
return request('/api/biz-service-ebtp-extend/v1/eventmaintain/query/rightData', {
method: 'POST',
});
}
//保存右侧专业线数据
export async function saveRightData(data: any) {
return request('/api/biz-service-ebtp-extend/v1/eventmaintain/save/rightData', {
method: 'POST',
data: { ...data },
});
}

View File

@ -1,4 +1,5 @@
import { pictureDisplayPath } from "@/utils/DownloadUtils";
import { getSessionUserData } from "@/utils/session";
import moment from "moment";
/**
* 图片路径拼接
@ -56,4 +57,17 @@ export function chunk(arr: any[], size: number) {
result.push(arr.slice(i, i + size));
}
return result;
}
/**
* 权限校验(党建管理员)
* @returns
*/
export const managerAuthority = (authority: string) => {
const authorityList = getSessionUserData().authorityList;
for (const ite of authorityList) {
if (ite.roleCode === authority) {
return false;
}
}
return true;
}