| | |
| | | import { PageContainer, ProTable } from '@ant-design/pro-components'; |
| | | import { buildProTableDataSource, sendRequest, showDelConfirm } from '@/utils/antdUtils'; |
| | | import { Button, message, Space, Select } from 'antd'; |
| | | import { useRef, useState } from 'react'; |
| | | import { Button, message, Space, Select, Cascader } from 'antd'; |
| | | import { useRef, useState, useEffect } from 'react'; |
| | | import { Access, history, useAccess } from 'umi'; |
| | | import { getList, setStatus } from './service' |
| | | import { getList, setStatus, getUnitList } from './service' |
| | | const Banner = () => { |
| | | |
| | | const actionRef = useRef(); |
| | | const access = useAccess(); |
| | | const [items, setItems] = useState([]); |
| | | |
| | | const columns = [ |
| | | { |
| | |
| | | }, |
| | | { |
| | | title: '所在单位', |
| | | dataIndex: 'department', |
| | | renderFormItem: (_, { type, defaultRender, ...rest }, form) => { |
| | | dataIndex: 'departmentId', |
| | | renderFormItem: () => { |
| | | return ( |
| | | <Select |
| | | key="searchSelect" |
| | | allowClear |
| | | <Cascader |
| | | options={items} |
| | | fieldNames={{ value: 'key', label: 'name' }} |
| | | placeholder="请选择" |
| | | filterOption={false} |
| | | options={[{ label: '市级', value: '1' }, { label: '区县', value: '2' }, { label: '街道', value: '3' }, { label: '社区', value: '4' }, { label: '党员', value: '5' }]} |
| | | > |
| | | </Select > |
| | | ) |
| | | displayRender={(label) => label[label.length - 1]} |
| | | changeOnSelect={true} |
| | | /> |
| | | ); |
| | | }, |
| | | render: (_, record) => { |
| | | return record.department |
| | |
| | | render: (text, record) => { |
| | | return ( |
| | | <Space> |
| | | <Access accessible={access['/message_notification/mark_read']}> |
| | | <Button |
| | | type="link" |
| | | onClick={() => { |
| | | showDelConfirm(async () => { |
| | | let status = await sendRequest(setStatus, record.id) |
| | | if (status) { |
| | | actionRef.current.reload(); |
| | | } |
| | | }, '确认将所选信息标记为已读吗?'); |
| | | }} |
| | | > |
| | | 标记已读 |
| | | </Button> |
| | | </Access> |
| | | {record.readStatus == 0 && ( |
| | | <Access accessible={access['/message_notification/mark_read']}> |
| | | <Button |
| | | type="link" |
| | | onClick={() => { |
| | | showDelConfirm(async () => { |
| | | let status = await sendRequest(setStatus, record.id) |
| | | if (status) { |
| | | actionRef.current.reload(); |
| | | } |
| | | }, '确认将所选信息标记为已读吗?', '确定', '取消', '操作提示'); |
| | | }} |
| | | > |
| | | 标记已读 |
| | | </Button> |
| | | </Access> |
| | | )} |
| | | |
| | | </Space > |
| | | ); |
| | | }, |
| | | }, |
| | | ] |
| | | useEffect(() => { |
| | | fetchUnit(); |
| | | }, []); |
| | | |
| | | const fetchUnit = () => { |
| | | getUnitList().then((res) => { |
| | | if (res.code == 200 && res.data) { |
| | | const traverseItems = (items) => { |
| | | return items.map((item) => { |
| | | item.key = item.id; |
| | | item.title = '1'; |
| | | if (item.child && item.child.length > 0) { |
| | | item.children = traverseItems(item.child); |
| | | } |
| | | return item; |
| | | }); |
| | | }; |
| | | setItems(traverseItems(res.data)); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | return <div> |
| | | <PageContainer title='消息通知'> |
| | |
| | | }} |
| | | search={{ labelWidth: 140 }} |
| | | request={(params) => { |
| | | params.bannerType = Number(params.bannerType) |
| | | if (params.departmentId) { |
| | | params.departmentId = params.departmentId[params.departmentId.length - 1]; |
| | | } |
| | | return buildProTableDataSource(getList, params) |
| | | }} |
| | | toolBarRender={false} |
| | |
| | | export const getList = async (data) => { |
| | | return request(`/api/huacheng-sangeshenbian/messageNotification/list`, { |
| | | method: 'GET', |
| | | data |
| | | params:data |
| | | }); |
| | | } |
| | | // 设置已读 |
| | |
| | | }); |
| | | } |
| | | |
| | | // 单位列表 |
| | | export const getUnitList = async (params) => { |
| | | return request(`/api/huacheng-sangeshenbian/department/list`, { |
| | | method: 'GET', |
| | | params |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 详情列表 |
| | | export const getDetailList = async (data) => { |
| | |
| | | import { forwardRef, useImperativeHandle, useState } from 'react'; |
| | | import { useEffect } from 'react'; |
| | | import { getDepartmentList, systemPostList, systemRoleList, getSystemUserInfo, getCityList, addSystemUserInfo, editSystemUserInfo } from '../service'; |
| | | import { Color } from 'antd/es/color-picker'; |
| | | import CryptoJS from 'crypto-js'; |
| | | const formItemLayout = { |
| | | labelCol: { span: 8 }, |
| | | wrapperCol: { span: 16 }, |
| | |
| | | const AddAndEdit = ({ visible, onSave, onUpdate, onCancel }, ref) => { |
| | | const [form] = Form.useForm(); |
| | | const [data, setData] = useState({}) |
| | | const [treeData, setTreeData] = useState([]);//权限树 |
| | | const [treeSeletKeys, setTreeSeletKeys] = useState([]); //勾选权限 |
| | | const [detailType, setDetailType] = useState(false);//是否详情 |
| | | const [spinning, setSpinning] = useState(false); |
| | | |
| | | const [oneCompanyList, setOneCompanyList] = useState([]) |
| | |
| | | const [levelList, setLevelList] = useState([{ name: '市级账号', value: 1 }, { name: '区县账号', value: 2 }, { name: '街道账号', value: 3 }, { name: '社区账号', value: 4 }, { name: '党员账号', value: 5 }]) |
| | | //所属区县 |
| | | const [countyList, setCountyList] = useState([]) |
| | | const [activeCounty, setActiveCounty] = useState('') |
| | | const [activeCounty, setActiveCounty] = useState({}) |
| | | //所属街道 |
| | | const [streetList, setStreetList] = useState([]) |
| | | const [activeStreet, setActiveStreet] = useState('') |
| | | const [activeStreet, setActiveStreet] = useState({}) |
| | | //所属社区 |
| | | const [communityList, setCommunityList] = useState([]) |
| | | // const [activeCommunity, setActiveCommunity] = useState({}) |
| | | const [activeCommunity, setActiveCommunity] = useState({}) |
| | | |
| | | |
| | | |
| | |
| | | setThreeCompanyList(() => res.data) |
| | | }) |
| | | getDepartmentList(4).then(res => { |
| | | setThreeCompanyList(() => res.data) |
| | | setFourCompanyList(() => res.data) |
| | | }) |
| | | }, 4000); |
| | | }, []) |
| | |
| | | useImperativeHandle(ref, () => { |
| | | return { |
| | | refreshData: (data, type) => { |
| | | setDetailType(type || false) |
| | | |
| | | getCountyList() |
| | | systemPostList({ pageNum: 1, pageSize: 10000 }).then(res => { |
| | | setPositionList(() => res.data.records) |
| | |
| | | if (data.id) { |
| | | getInfo(data.id) |
| | | } |
| | | setData(data) |
| | | setData(()=>data) |
| | | }, |
| | | clean: () => { |
| | | setSpinning(false) |
| | |
| | | // 保存 |
| | | const okHandle = () => { |
| | | form.validateFields().then((values) => { |
| | | console.log('value',values) |
| | | values.password = CryptoJS.MD5(values.password).toString(); |
| | | values.districts=activeCounty.name |
| | | values.street=activeStreet.name |
| | | values.community=activeCommunity.name |
| | | if (data.id) { |
| | | values.id = data.id |
| | | onUpdate(values) |
| | |
| | | }) |
| | | } |
| | | const changeCountry = (value, label) => { |
| | | console.log('区县', value,'11111111',label); |
| | | setActiveCounty(value) |
| | | setActiveCounty(label) |
| | | getStreetList(value) |
| | | |
| | | } |
| | | const changeStreet = (value) => { |
| | | console.log('街道', value); |
| | | setActiveStreet(value) |
| | | const changeStreet = (value, label) => { |
| | | setActiveStreet(label) |
| | | getcommunityList(value) |
| | | } |
| | | const changeCommunity = (value) => { |
| | | console.log('社区', value); |
| | | // setActiveCommunity(value) |
| | | const changeCommunity = (value, label) => { |
| | | setActiveCommunity(label) |
| | | } |
| | | const getInfo = (id) => { |
| | | getSystemUserInfo(id).then(res => { |
| | | |
| | | if (res.data.districtsCode) { |
| | | setActiveStreet({ name: res.data.districts, id: res.data.districtsCode }) |
| | | getStreetList(res.data.districtsCode) |
| | | } |
| | | if (res.data.streetId) { |
| | | setActiveCounty({ name: res.data.street, id: res.data.streetId }) |
| | | getcommunityList(res.data.streetId) |
| | | } |
| | | if (res.data.communityId) { |
| | | setActiveCommunity({ name: res.data.community, id: res.data.communityId }) |
| | | } |
| | | delete res.data.password |
| | | form.setFieldsValue(res.data) |
| | | }) |
| | | } |
| | | |
| | |
| | | getContainer={false} |
| | | width="65%" |
| | | destroyOnClose |
| | | title={detailType ? '人员详情' : data.id ? '编辑人员' : '添加人员'} |
| | | title={data.type == 'detail' ? '人员详情' : data.type == 'edit' ? '编辑人员' : '添加人员'} |
| | | open={visible} |
| | | onCancel={() => onCancel(false)} |
| | | afterClose={() => { |
| | | form.resetFields() |
| | | setTreeSeletKeys([]) |
| | | }} |
| | | footer={ |
| | | !detailType ? |
| | | (data.type == 'edit' || data.type == 'add') ? |
| | | [ |
| | | <Button key="back" onClick={() => onCancel(false)}>取消</Button>, |
| | | <Button key="submit" type="primary" onClick={okHandle}> |
| | |
| | | label="姓名" |
| | | rules={[{ required: true, message: '请输入人员姓名' }]} |
| | | > |
| | | <Input disabled={detailType} placeholder='请输入人员姓名' /> |
| | | <Input disabled={data.type == 'detail'} placeholder='请输入人员姓名' /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | |
| | | <Select |
| | | key="searchSelect" |
| | | allowClear |
| | | disabled={data.type == 'detail'} |
| | | placeholder="请选择" |
| | | options={oneCompanyList} |
| | | fieldNames={{ label: 'name', value: 'id' }} |
| | |
| | | <Select |
| | | key="searchSelect" |
| | | allowClear |
| | | disabled={data.type == 'detail'} |
| | | placeholder="请选择" |
| | | options={twoCompanyList} |
| | | fieldNames={{ label: 'name', value: 'id' }} |
| | |
| | | <Select |
| | | key="searchSelect" |
| | | allowClear |
| | | disabled={data.type == 'detail'} |
| | | placeholder="请选择" |
| | | options={threeCompanyList} |
| | | fieldNames={{ label: 'name', value: 'id' }} |
| | |
| | | <Select |
| | | key="searchSelect" |
| | | allowClear |
| | | disabled={data.type == 'detail'} |
| | | placeholder="请选择" |
| | | options={fourCompanyList} |
| | | fieldNames={{ label: 'name', value: 'id' }} |
| | |
| | | <Select |
| | | key="searchSelect" |
| | | allowClear |
| | | disabled={data.type == 'detail'} |
| | | placeholder="请选择" |
| | | options={positionList} |
| | | fieldNames={{ label: 'name', value: 'id' }} |
| | |
| | | <Select |
| | | key="searchSelect" |
| | | allowClear |
| | | disabled={data.type == 'detail'} |
| | | placeholder="请选择" |
| | | options={roleList} |
| | | fieldNames={{ label: 'name', value: 'id' }} |
| | |
| | | <Select |
| | | key="searchSelect" |
| | | allowClear |
| | | disabled={data.type == 'detail'} |
| | | placeholder="请选择" |
| | | options={levelList} |
| | | fieldNames={{ label: 'name', value: 'value' }} |
| | |
| | | rules={[{ required: true, message: '是否管理员' }]} |
| | | > |
| | | <Radio.Group |
| | | disabled={data.type == 'detail'} |
| | | // style={style} |
| | | // onChange={onChange} |
| | | // value={value} |
| | |
| | | <Select |
| | | key="searchSelect" |
| | | allowClear |
| | | disabled={data.type == 'detail'} |
| | | onChange={changeCountry} |
| | | value={activeCounty} |
| | | value={activeCounty.id} |
| | | placeholder="请选择" |
| | | options={countyList} |
| | | fieldNames={{ label: 'name', value: 'id' }} |
| | |
| | | > |
| | | <Select |
| | | onChange={changeStreet} |
| | | disabled={!activeCounty} |
| | | disabled={!activeCounty || data.type == 'detail'} |
| | | key="searchSelect" |
| | | allowClear |
| | | value={activeStreet.id} |
| | | placeholder="请选择" |
| | | options={streetList} |
| | | fieldNames={{ label: 'name', value: 'id' }} |
| | |
| | | rules={[{ required: true, message: '请选择所属社区' }]} |
| | | > |
| | | <Select |
| | | disabled={!activeStreet} |
| | | onChange={changeCommunity} |
| | | disabled={!activeStreet || data.type == 'detail'} |
| | | key="searchSelect" |
| | | allowClear |
| | | value={activeCommunity.id} |
| | | placeholder="请选择" |
| | | options={communityList} |
| | | fieldNames={{ label: 'name', value: 'id' }} |
| | |
| | | }, |
| | | }]} |
| | | > |
| | | <Input disabled={detailType} placeholder='请输入联系方式' /> |
| | | <Input disabled={data.type == 'detail'} placeholder='请输入联系方式' /> |
| | | </Form.Item> |
| | | <div style={{ fontSize: '12px', color: "rgba(0,0,0,0.5)", marginLeft: "10px" }}>联系方式将作为登录账号使用</div> |
| | | </div> |
| | |
| | | }, |
| | | }]} |
| | | > |
| | | <Input.Password disabled={detailType} placeholder='请输入' /> |
| | | <Input.Password disabled={data.type == 'detail'} placeholder='请输入' /> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={16}> |
| | |
| | | }, |
| | | },]} |
| | | > |
| | | <Input.Password disabled={detailType} placeholder='请输入' /> |
| | | <Input.Password disabled={data.type == 'detail'} placeholder='请输入' /> |
| | | </Form.Item> |
| | | <div style={{ fontSize: '12px', color: "rgba(0,0,0,0.5)", marginLeft: "10px" }}>密码需要包含大小写字母,数字和特殊符号,且长度为8位以上</div> |
| | | </div> |
| | |
| | | <a |
| | | type="link" |
| | | onClick={() => { |
| | | addViewRef.current.refreshData(record); |
| | | addViewRef.current.refreshData({...record,type:'edit'}); |
| | | handleModalVisibles(true); |
| | | }} |
| | | > |
| | |
| | | <a |
| | | type="link" |
| | | onClick={() => { |
| | | addViewRef.current.refreshData(record, true); |
| | | addViewRef.current.refreshData({...record,type:'detail'}); |
| | | handleModalVisibles(true); |
| | | }} |
| | | > |
| | |
| | | <Button |
| | | type="primary" |
| | | onClick={() => { |
| | | addViewRef.current.refreshData({}); |
| | | addViewRef.current.refreshData({type:'add'}); |
| | | handleModalVisibles(true); |
| | | }} |
| | | > |
| | |
| | | import { customRequest } from '@/utils/utils'; |
| | | const AddOrEditOrDetail = () => { |
| | | |
| | | const config = { |
| | | name: 'file', |
| | | action: 'https://huacheng.psciio.com/api/huacheng-communitybackstage/communitypartybuilding/uploadimage', |
| | | headers: { |
| | | Authorization: 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOjE4OTI0MjE4MjgwODU4Mzc4MjYsInR5cGUiOjEsImV4cCI6MTc0MTY1OTg5MywiY3JlYXRlZCI6MTc0MDM2Mzg5MzE2MH0.o3Gc0g1LAo_kkL3X3QrC6qKwztxsp6psoTcpTreDzQUXGqPzUXw89fNSR5YKz8gzhtSuSKI2d6TJJYPX1IQCgw', |
| | | }, |
| | | }; |
| | | |
| | | |
| | | |
| | |
| | | showUploadList={{ |
| | | showPreviewIcon: false, |
| | | }} |
| | | customRequest={customRequest} |
| | | // accept="image/png, image/jpeg, image/jpg" |
| | | // customRequest={customRequest} |
| | | accept="image/png, image/jpeg, image/jpg" |
| | | fileList={fileList} |
| | | disabled={searchParams.get('detail')} |
| | | > |
| | |
| | | import { LoadingOutlined, PlusOutlined } from '@ant-design/icons'; |
| | | import { forwardRef, useEffect, useImperativeHandle, useState } from 'react'; |
| | | import { customRequest } from '@/utils/utils'; |
| | | import { add, Edit, getDetail } from '../service' |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { span: 7 }, |
| | |
| | | name: 'file', |
| | | action: 'https://huacheng.psciio.com/api/huacheng-communitybackstage/communitypartybuilding/uploadimage', |
| | | headers: { |
| | | authorization: localStorage.getItem('token'), |
| | | Authorization: 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOjE4OTI0MjE4MjgwODU4Mzc4MjYsInR5cGUiOjEsImV4cCI6MTc0MTY1OTg5MywiY3JlYXRlZCI6MTc0MDM2Mzg5MzE2MH0.o3Gc0g1LAo_kkL3X3QrC6qKwztxsp6psoTcpTreDzQUXGqPzUXw89fNSR5YKz8gzhtSuSKI2d6TJJYPX1IQCgw', |
| | | }, |
| | | }; |
| | | const formItemLayout = { |
| | |
| | | delete values.image |
| | | if (editData.id) { |
| | | values.id = editData.id |
| | | let state = await sendRequest(add, values) |
| | | if (state) { |
| | | history.back() |
| | | } |
| | | onUpdate(values) |
| | | return |
| | | } |
| | | let state = await sendRequest(Edit, values) |
| | | if (state) { |
| | | history.back() |
| | | } |
| | | onSave(values) |
| | | }) |
| | | } |
| | | |
| | |
| | | import { useRef, useState } from 'react'; |
| | | import { Access, history, useAccess } from 'umi'; |
| | | import AddAndEdit from './components/index'; |
| | | import { getList, updateStatus, deleteBanner } from './service' |
| | | import { getList, updateStatus, deleteBanner,add,Edit } from './service' |
| | | const Banner = () => { |
| | | |
| | | const actionRef = useRef(); |
| | |
| | | <Button |
| | | type="link" |
| | | onClick={() => { |
| | | history.push(`/marketing/banner/add?id=${record.id}&edit=true`); |
| | | addViewRef.current.refreshData({...record, type: 'edit'}); |
| | | handleModalVisible(true); |
| | | }} |
| | | > |
| | | 编辑 |