13404089107
2 天以前 025c4c6e32a1c06ea604a9f2b67c4b8cbc29ce2c
新增迭代
11个文件已修改
1个文件已添加
1350 ■■■■■ 已修改文件
management/config/env.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/config/routes.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/src/pages/appeal-management/detail.jsx 235 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/src/pages/appeal-management/service.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/src/pages/party/manage/index.jsx 188 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/src/pages/setting/role/components/addAndEdit.jsx 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/src/pages/setting/role/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/src/pages/setting/user/components/addAndEdit.jsx 699 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/src/pages/setting/user/index.jsx 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/src/pages/setting/user/index.less 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/src/pages/setting/user/service.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/src/requestErrorConfig.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/config/env.ts
@@ -1,6 +1,6 @@
export default {
  dev: {
    SERVER_URL: 'http://192.168.110.188:6194',
    SERVER_URL: 'http://192.168.110.111:6194',
    // SERVER_URL: 'https://huacheng.psciio.com',
  },
  test: {
management/config/routes.ts
@@ -46,7 +46,7 @@
        access: '/system_setting/position_management',
      },
      {
        name: '角色管理',
        name: '权限管理',
        path: '/setting/role',
        component: './setting/role',
        access: '/system_setting/role_management',
management/src/pages/appeal-management/detail.jsx
@@ -1,13 +1,14 @@
import { buildProTableDataSource, sendRequest, showDelConfirm } from '@/utils/antdUtils';
import { PageContainer, ProTable } from '@ant-design/pro-components';
import { Button, Card, Select, Space, Descriptions, Divider, Steps, message } from 'antd';
import { Button, Card, Select, Space, Descriptions, Divider, Steps, message, Modal, Form, Input, Upload, Popconfirm } from 'antd';
import { useRef, useState, useEffect } from 'react';
import { Access, useAccess } from 'umi'
import { history, useLocation } from "@umijs/max"
import { getDetail } from './service';
import { getDetail, editProgress, deleteProgress } from './service';
import moment from 'moment';
import './index.less';
import {downLoad } from '@/utils/utils';
import {downLoad, customRequest } from '@/utils/utils';
import { PlusOutlined } from '@ant-design/icons';
const Account = () => {
    const actionRef = useRef();
@@ -16,6 +17,22 @@
    const [detail, setDetail] = useState({});
    const searchParams = new URLSearchParams(useLocation().search);
    const id = searchParams.get('id');
    const [editModalVisible, setEditModalVisible] = useState(false);
    const [editProgressData, setEditProgressData] = useState(null);
    const [editForm] = Form.useForm();
    const [loading, setLoading] = useState(false);
    const [imgFileList, setImgFileList] = useState([]);
    const [videoFileList, setVideoFileList] = useState([]);
    const [previewVisible, setPreviewVisible] = useState(false);
    const [previewImage, setPreviewImage] = useState('');
    const [previewType, setPreviewType] = useState('image'); // 'image' or 'video'
    const uploadConfig = {
        name: 'file',
        action: 'https://huacheng.psciio.com/api/huacheng-communitybackstage/communitypartybuilding/uploadimage',
        headers: {
            Authorization: 'Bearer ' + localStorage.getItem('token'),
        },
    };
    useEffect(() => {
        getDetail({ id: id }).then((res) => {
@@ -111,6 +128,117 @@
            span: 4,
        },
    ];
    // 上传前校验
    const beforeUpload = (file) => {
        return new Promise((resolve, reject) => {
            if (file.name.includes(',')) {
                message.warning('上传文件不能包含英文逗号(,)');
                return Upload.LIST_IGNORE;
            }
            setLoading(true);
            resolve(file);
        });
    };
    // 图片上传change
    const handleImgChange = ({ file, fileList: newFileList }) => {
        if (file.status === 'error' || (file.status === 'done' && file.response && file.response.code !== 200)) {
            setLoading(false);
            setImgFileList([]);
            message.error('上传失败');
            editForm.setFieldValue('imgUrl', []);
            return;
        }
        if (file.status === 'done' && file.response && file.response.code === 200) {
            setLoading(false);
            message.success('上传成功');
        }
        let urls = newFileList.map(item => {
            if (item.status === 'done' && item.response && item.response.data) {
                item.url = item.response.data;
            }
            return item.url || item.url;
        }).filter(Boolean);
        setImgFileList(newFileList);
        editForm.setFieldValue('imgUrl', urls);
    };
    // 视频上传change
    const handleVideoChange = ({ file, fileList: newFileList }) => {
        if (file.status === 'error' || (file.status === 'done' && file.response && file.response.code !== 200)) {
            setLoading(false);
            setVideoFileList([]);
            message.error('上传失败');
            editForm.setFieldValue('videoUrl', []);
            return;
        }
        if (file.status === 'done' && file.response && file.response.code === 200) {
            setLoading(false);
            message.success('上传成功');
        }
        let urls = newFileList.map(item => {
            if (item.status === 'done' && item.response && item.response.data) {
                item.url = item.response.data;
            }
            return item.url || item.url;
        }).filter(Boolean);
        setVideoFileList(newFileList);
        editForm.setFieldValue('videoUrl', urls);
    };
    // 办理进度编辑提交
    const handleEditProgress = async () => {
        try {
            setLoading(true);
            console.log('editProgressData', editProgressData);
            const values = await editForm.validateFields();
            await editProgress({
                complaintId: id,
                describe: values.describe,
                id: editProgressData.id,
                imgUrl: (values.imgUrl || []).join(','),
                video: (values.videoUrl || []).join(',')
            });
            message.success('编辑成功');
            setEditModalVisible(false);
            getDetail({ id }).then((res) => setDetail(res.data));
        } catch (e) {
            // 校验或请求失败
        } finally {
            setLoading(false);
        }
    };
    // 办理进度删除
    const handleDeleteProgress = async (progressId) => {
        try {
            await deleteProgress({ id: progressId });
            message.success('删除成功');
            getDetail({ id }).then((res) => setDetail(res.data));
        } catch (e) {
            message.error('删除失败');
        }
    };
    // 在弹窗打开时同步 fileList
    useEffect(() => {
        if (editModalVisible && editProgressData) {
            setImgFileList((editProgressData.imgUrl ? editProgressData.imgUrl.split(',') : []).map((url, idx) => ({ uid: idx, url, status: 'done' })));
            setVideoFileList((editProgressData.video ? editProgressData.video.split(',') : []).map((url, idx) => ({ uid: idx, url, status: 'done' })));
            editForm.setFieldsValue({
                describe: editProgressData.describe,
                imgUrl: editProgressData.imgUrl ? editProgressData.imgUrl.split(',') : [],
                videoUrl: editProgressData.video ? editProgressData.video.split(',') : [],
            });
        }
        if (!editModalVisible) {
            setImgFileList([]);
            setVideoFileList([]);
        }
    }, [editModalVisible, editProgressData]);
    return (
        <div>
            <PageContainer className={'appeal-management-detail'} header={{ breadcrumb: {} }} title="述求详情" >
@@ -121,22 +249,34 @@
                        <Descriptions title="办理进度" column={1}>
                            {detail.complaintProgresses?.length > 0 ? detail.complaintProgresses.map((item, index) => (
                                <Descriptions.Item key={index}>
                                    <Card style={{ width: '800px' }} title={item.createByName} extra={moment(item.createTime).format('YYYY-MM-DD HH:mm:ss')}>
                                    <Card style={{ width: '800px', position: 'relative' }} title={item.createByName} extra={moment(item.createTime).format('YYYY-MM-DD HH:mm:ss')}>
                                        <Descriptions column={1} >
                                            <Descriptions.Item>
                                                {item.describe}
                                            </Descriptions.Item>
                                            <Descriptions.Item>{item.describe}</Descriptions.Item>
                                            <Descriptions.Item label={'上传图片'}>
                                                {item.imgUrl && (item.imgUrl || '').split(',').map((item, index) => (
                                                    <img width={80} style={{ marginRight: '10px' }} height={80} src={item} key={index} alt="example" />
                                                {item.imgUrl && (item.imgUrl || '').split(',').map((img, idx) => (
                                                    <img width={80} style={{ marginRight: '10px' }} height={80} src={img} key={idx} alt="example" />
                                                ))}
                                            </Descriptions.Item>
                                            <Descriptions.Item label={'上传视频'}>
                                                {item.videoUrl && (item.videoUrl || '').split(',').map((item, index) => (
                                                    <video width={280} style={{ marginRight: '10px' }} src={item} key={index} controls></video>
                                                {item.video && item.video.split(',').map((video, idx) => (
                                                    <video width={280} style={{ marginRight: '10px' }} src={video} key={idx} controls></video>
                                                ))}
                                            </Descriptions.Item>
                                        </Descriptions>
                                        <div style={{ position: 'absolute', right: 24, bottom: 16 }}>
                                            <Button size="small" type="primary" style={{ marginRight: 8 }} onClick={() => {
                                                setEditProgressData(item);
                                                setEditModalVisible(true);
                                                editForm.setFieldsValue({
                                                    describe: item.describe,
                                                    imgUrl: item.imgUrl ? item.imgUrl.split(',') : [],
                                                    videoUrl: item.video ? item.video.split(',') : [],
                                                });
                                            }}>编辑</Button>
                                            <Popconfirm title="确定要删除该办理进度吗?" onConfirm={() => handleDeleteProgress(item.id)} okText="确定" cancelText="取消">
                                                <Button size="small" danger>删除</Button>
                                            </Popconfirm>
                                        </div>
                                    </Card>
                                </Descriptions.Item>
                            )) : <Descriptions.Item span={4} >暂无办理进度</Descriptions.Item>}
@@ -252,7 +392,80 @@
                    </div>
                </Card>
                <Modal
                    title="编辑办理进度"
                    open={editModalVisible}
                    onCancel={() => setEditModalVisible(false)}
                    onOk={handleEditProgress}
                    confirmLoading={loading}
                    destroyOnClose
                    width={600}
                >
                    <Form form={editForm} layout="vertical" initialValues={{ describe: '', imgUrl: [], videoUrl: [] }}>
                        <Form.Item name="describe" label="办理进度描述" rules={[{ required: true, message: '请输入办理进度描述' }]}>
                            <Input.TextArea rows={4} maxLength={500} showCount />
                        </Form.Item>
                        <Form.Item name="imgUrl" label="图片:">
                            <Upload
                                {...uploadConfig}
                                listType="picture-card"
                                maxCount={9}
                                beforeUpload={beforeUpload}
                                onChange={handleImgChange}
                                onRemove={() => {
                                    setImgFileList([]);
                                    editForm.setFieldValue('imgUrl', []);
                                }}
                                showUploadList={{ showPreviewIcon: true }}
                                accept="image/*"
                                fileList={imgFileList}
                                onPreview={file => {
                                    setPreviewType('image');
                                    setPreviewImage(file.url || file.thumbUrl);
                                    setPreviewVisible(true);
                                }}
                            >
                                {imgFileList.length < 9 && <PlusOutlined />}
                            </Upload>
                        </Form.Item>
                        <Form.Item name="videoUrl" label="视频:">
                            <Upload
                                {...uploadConfig}
                                listType="picture-card"
                                maxCount={9}
                                beforeUpload={beforeUpload}
                                onChange={handleVideoChange}
                                onRemove={() => {
                                    setVideoFileList([]);
                                    editForm.setFieldValue('videoUrl', []);
                                }}
                                showUploadList={{ showPreviewIcon: true }}
                                accept="video/*"
                                fileList={videoFileList}
                                onPreview={file => {
                                    setPreviewType('video');
                                    setPreviewImage(file.url || file.thumbUrl);
                                    setPreviewVisible(true);
                                }}
                            >
                                {videoFileList.length < 9 && <PlusOutlined />}
                            </Upload>
                        </Form.Item>
                    </Form>
                </Modal>
                <Modal
                    open={previewVisible}
                    footer={null}
                    onCancel={() => setPreviewVisible(false)}
                    width={previewType === 'video' ? 800 : 600}
                >
                    {previewType === 'image' ? (
                        <img alt="预览" style={{ width: '100%' }} src={previewImage} />
                    ) : (
                        <video style={{ width: '100%' }} src={previewImage} controls autoPlay />
                    )}
                </Modal>
            </PageContainer>
        </div>
    );
management/src/pages/appeal-management/service.js
@@ -15,3 +15,19 @@
        data
    });
}
//编辑办理进度
export const editProgress = async (data) => {
    return request(`/api/huacheng-sangeshenbian/complaint/update-progress`, {
        method: 'POST',
        data
    });
}
//删除办理进度
export const deleteProgress = async (data) => {
    return request(`/api/huacheng-sangeshenbian/complaint/del-progress/${data.id}`, {
        method: 'DELETE',
        data
    });
}
management/src/pages/party/manage/index.jsx
@@ -66,6 +66,18 @@
      }
    },
    {
      title: '创建时间',
      dataIndex: 'createTime',
      sorter: true,
      hideInSearch: true,
    },
    {
      title: '更新时间',
      dataIndex: 'updateTime',
      sorter: true,
      hideInSearch: true,
    },
    {
      title: '状态',
      dataIndex: 'freezeStatus',
      valueEnum: {
@@ -75,80 +87,84 @@
      }
    },
    {
      title: '身份证号',
      dataIndex: 'idNumber',
    },
    {
      title: '操作',
      hideInSearch: true,
      render: (text, record) => {
        return (
          <Space>
            <Access accessible={access['/party_member/edit']}>
            <Button
              type="link"
              onClick={() => {
                history.push(`/party/manage/add?type=edit&id=${record.id}`)
              }}
            >
              编辑
            </Button>
            </Access>
            <Access accessible={access['/party_member/del']}>
            <Button
              type="link"
              onClick={() => {
                showDelConfirm(async () => {
                  let status = await sendRequest(deleteBanner, {id:record.id})
                  if (status) {
                    actionRef.current.reload();
                  }
                }, '确认删除所选信息吗?');
              }}
            >
              删除
            </Button>
            </Access>
            <Access accessible={access['/party_member/detail']}>
            <Button
              type="link"
              onClick={() => {
                history.push(`/party/manage/add?detail=true&id=${record.id}`)
              }}
            >
              查看详情
            </Button>
            </Access>
            <Access accessible={access['/party_member/freeze']}>
            {record.freezeStatus == 0 && (
              <Button
                type="link"
                onClick={() => {
                  showDelConfirm1(async () => {
                    let status = await sendRequest(freeze, { id: record.id })
                  history.push(`/party/manage/add?type=edit&id=${record.id}`)
                }}
              >
                编辑
              </Button>
            </Access>
            <Access accessible={access['/party_member/del']}>
              <Button
                type="link"
                onClick={() => {
                  showDelConfirm(async () => {
                    let status = await sendRequest(deleteBanner, { id: record.id })
                    if (status) {
                      actionRef.current.reload();
                    }
                  }, '确认冻结该党员信息吗?', '冻结', '', '确认冻结该党员信息吗?');
                  }, '确认删除所选信息吗?');
                }}
              >
                冻结
                删除
              </Button>
            )}
            </Access>
            <Access accessible={access['/party_member/detail']}>
              <Button
                type="link"
                onClick={() => {
                  history.push(`/party/manage/add?detail=true&id=${record.id}`)
                }}
              >
                查看详情
              </Button>
            </Access>
            <Access accessible={access['/party_member/freeze']}>
              {record.freezeStatus == 0 && (
                <Button
                  type="link"
                  onClick={() => {
                    showDelConfirm1(async () => {
                      let status = await sendRequest(freeze, { id: record.id })
                      if (status) {
                        actionRef.current.reload();
                      }
                    }, '确认冻结该党员信息吗?', '冻结', '', '确认冻结该党员信息吗?');
                  }}
                >
                  冻结
                </Button>
              )}
            </Access>
            <Access accessible={access['/party_member/freeze']}>
            {record.freezeStatus == 1 && (
              <Button
                type="link"
                onClick={() => {
                  showDelConfirm1(async () => {
                    let status = await sendRequest(freeze, { id: record.id })
                    if (status) {
                      actionRef.current.reload();
                    }
                  }, '确认解冻该党员信息吗?', '解冻', '', '确认解冻该党员信息吗?');
                }}
              >
                解冻
              </Button>
            )}
              {record.freezeStatus == 1 && (
                <Button
                  type="link"
                  onClick={() => {
                    showDelConfirm1(async () => {
                      let status = await sendRequest(freeze, { id: record.id })
                      if (status) {
                        actionRef.current.reload();
                      }
                    }, '确认解冻该党员信息吗?', '解冻', '', '确认解冻该党员信息吗?');
                  }}
                >
                  解冻
                </Button>
              )}
            </Access>
          </Space >
@@ -175,7 +191,15 @@
          showQuickJumper: true,
          defaultPageSize: 10,
        }}
        request={(params) => {
        request={(params, sorter) => {
          console.log('weqweqeqwe', sorter);
          if (sorter.createTime) {
            params.createTimeSort = sorter.createTime === 'ascend' ? 2 : 1;
          }
          if (sorter.updateTime) {
            params.updateTimeSort = sorter.updateTime === 'ascend' ? 2 : 1;
          }
          params.communityId = params.community ? params.community[params.community.length - 1] : ''
          params.auditStatus = 1
          setExcelParams(() => params)
@@ -184,35 +208,35 @@
        toolBarRender={(action, selectRows) => [
          <Space>
            <Access accessible={access['/party_member/add']}>
            <Button
              type="primary"
              onClick={() => {
                history.push('/party/manage/add?type=add')
              }}
            >
              添加
            </Button>
              <Button
                type="primary"
                onClick={() => {
                  history.push('/party/manage/add?type=add')
                }}
              >
                添加
              </Button>
            </Access>
            <Access accessible={access['/party_member/export']}>
            <Button
              type="primary"
              onClick={() => {
                exportExcell('党员列表', excelParams, '/api/huacheng-sangeshenbian/party-member/export')
              }}
            >
              导出
            </Button>
              <Button
                type="primary"
                onClick={() => {
                  exportExcell('党员列表', excelParams, '/api/huacheng-sangeshenbian/party-member/export')
                }}
              >
                导出
              </Button>
            </Access>
            <Access accessible={access['/party_member/import']}>
            <Button
              type="primary"
              onClick={() => {
                handleModalExport(true)
                modalExportRef.current.clean()
              }}
            >
              导入
            </Button>
              <Button
                type="primary"
                onClick={() => {
                  handleModalExport(true)
                  modalExportRef.current.clean()
                }}
              >
                导入
              </Button>
            </Access>
          </Space>
        ]}
management/src/pages/setting/role/components/addAndEdit.jsx
@@ -128,7 +128,7 @@
            getContainer={false}
            width="20%"
            destroyOnClose
            title={detailType ? '角色详情' : data.id ? '编辑角色' : '添加角色'}
            title={detailType ? '权限详情' : data.id ? '编辑权限' : '添加权限'}
            open={visible}
            onCancel={() => onCancel(false)}
            afterClose={() => {
@@ -150,10 +150,10 @@
            <Form layout="horizontal" {...formItemLayout} form={form} scrollToFirstError>
                <Form.Item
                    name="name"
                    label="角色名称"
                    rules={[{ required: true, message: '请输入角色名称' }]}
                    label="权限名称"
                    rules={[{ required: true, message: '请输入权限名称' }]}
                >
                    <Input disabled={detailType} placeholder='请输入角色名称' />
                    <Input disabled={detailType} placeholder='请输入权限名称' />
                </Form.Item>
                <Form.Item
                    name="tree"
management/src/pages/setting/role/index.jsx
@@ -14,7 +14,7 @@
    const columns = [
        {
            title: '角色名称',
            title: '权限名称',
            dataIndex: 'name',
        },
        {
management/src/pages/setting/user/components/addAndEdit.jsx
@@ -1,7 +1,9 @@
import { Form, Input, Modal, Tree, Button, Spin, Row, Col, Select, Radio, Cascader } from 'antd';
import { Form, Input, Modal, Tree, Button, Spin, Row, Col, Select, Radio, Cascader, Card } from 'antd';
import { forwardRef, useImperativeHandle, useState } from 'react';
import { useEffect } from 'react';
import { getDepartmentList, systemPostList, systemRoleList, getSystemUserInfo, getCityList, addSystemUserInfo, editSystemUserInfo } from '../service';
import { DeleteOutlined } from '@ant-design/icons';
import '../index.less'
import { getDepartmentList, systemPostList, systemRoleList, getSystemUserInfo, getCityList, addSystemUserInfo, editSystemUserInfo, getCascaderData } from '../service';
import CryptoJS from 'crypto-js';
const formItemLayout = {
    labelCol: { span: 8 },
@@ -27,7 +29,10 @@
    //所属角色
    const [roleList, setRoleList] = useState([])
    //账号层级
    const [levelList, setLevelList] = useState([{ name: '市级账号', value: 1 }, { name: '区县账号', value: 2 }, { name: '街道账号', value: 3 }, { name: '社区账号', value: 4 }, { name: '党员账号', value: 5 }])
    const [levelList, setLevelList] = useState([])
    //级联数据
    const [cascaderData, setCascaderData] = useState([])
    //选择的层级
    const [activeLevel, setActiveLevel] = useState('')
    //所属区县
@@ -37,11 +42,11 @@
    const [streetList, setStreetList] = useState([])
    const [activeStreet, setActiveStreet] = useState({})
    //所属社区
    const [communityList, setCommunityList] = useState([])
    const [activeCommunity, setActiveCommunity] = useState({})
    const [accountLevels, setAccountLevels] = useState([
        { area: [], isDiscipline: 0, options: [] }
    ]);
    useEffect(() => {
        // 获取单位
@@ -51,63 +56,14 @@
    useImperativeHandle(ref, () => {
        return {
            refreshData: (data, companyList) => {
                getCountyList()
                getCascaderDatas()
                setOneCompanyList(() => companyList)
                console.log('companyList', companyList)
                systemPostList({ pageNum: 1, pageSize: 10000 }).then(res => {
                    setPositionList(() => res.data.records)
                })
                systemRoleList({ pageNum: 1, pageSize: 10000 }).then(res => {
                    setRoleList(() => res.data.records)
                })
                // 权限判断
                let adminInfo = JSON.parse(localStorage.getItem('userInfo'))
                setAdminLevel(() => adminInfo.accountLevel)
                switch (adminInfo.accountLevel) {
                    case 1:
                        setLevelList(() => [{ name: '市级账号', value: 1 }, { name: '区县账号', value: 2 }, { name: '街道账号', value: 3 }, { name: '社区账号', value: 4 }, { name: '党员账号', value: 5 }])
                        break;
                    case 2:
                        getStreetList(adminInfo.districtsCode)
                        setLevelList(() => [{ name: '区县账号', value: 2 }, { name: '街道账号', value: 3 }, { name: '社区账号', value: 4 }, { name: '党员账号', value: 5 }])
                        this.$nextTick(() => {
                            form.setFieldsValue({ districtsCode: adminInfo.districtsCode })
                        })
                        break;
                    case 3:
                        getStreetList(adminInfo.districtsCode)
                        getcommunityList(adminInfo.streetId)
                        setLevelList(() => [{ name: '街道账号', value: 3 }, { name: '社区账号', value: 4 }, { name: '党员账号', value: 5 }])
                        form.setFieldsValue({ districtsCode: adminInfo.districtsCode })
                        form.setFieldsValue({ streetId: adminInfo.streetId })
                        break;
                    case 4:
                        getStreetList(adminInfo.districtsCode)
                        getcommunityList(adminInfo.streetId)
                        setLevelList(() => [{ name: '社区账号', value: 4 }, { name: '党员账号', value: 5 }])
                        // this.$nextTick(() => {
                        form.setFieldsValue({ districtsCode: adminInfo.districtsCode })
                        form.setFieldsValue({ streetId: adminInfo.streetId })
                        form.setFieldsValue({ communityId: adminInfo.communityId * 1 })
                        // })
                        break;
                    case 5:
                        getStreetList(adminInfo.districtsCode)
                        getcommunityList(adminInfo.streetId)
                        setLevelList(() => [{ name: '党员账号', value: 5 }])
                        form.setFieldsValue({ districtsCode: adminInfo.districtsCode })
                        form.setFieldsValue({ streetId: adminInfo.streetId })
                        form.setFieldsValue({ communityId: adminInfo.communityId * 1 })
                        break;
                    default:
                        break;
                }
                if (data.id) {
                    getInfo(data.id)
@@ -128,9 +84,51 @@
    // 保存
    const okHandle = () => {
        form.validateFields().then((values) => {
            if(values.password){
            // 校验accountLevels必填
            if (!accountLevels.length || accountLevels.some(item => !item.area || item.area.length === 0)) {
                if (window?.antd?.message?.error) {
                    window.antd.message.error('请完整选择账号所属层级区域!');
                } else {
                    alert('请完整选择账号所属层级区域!');
                }
                return;
            }
            // 打印提交时的accountLevels数组
            console.log('提交时的accountLevels:', accountLevels);
            // 组装 systemUserLevels,严格按照接口字段,优先用原始字段
            const systemUserLevels = accountLevels.map(item => {
                // Get the first selected option's id as the level
                const firstSelectedOption = item.selectedOptions?.[0];
                const level = firstSelectedOption?.id || item.level || '';
                // 判断不同级别(假设市级别id为1,区县级别id为2,街道级别id为3,社区级别id为4)
                const isCityLevel = level === '1';
                const isDistrictLevel = level === '2';
                const isStreetLevel = level === '3';
                const isCommunityLevel = level === '4';
                return {
                    // 市级别:所有下级字段为空
                    // 区县级别:街道和社区字段为空
                    // 街道级别:社区字段为空
                    // 社区级别:不做处理
                    community: (isCityLevel || isDistrictLevel || isStreetLevel) ? '' : (item.community || item.selectedOptions?.[3]?.name || ''),
                    communityId: (isCityLevel || isDistrictLevel || isStreetLevel) ? '' : (item.communityId || item.selectedOptions?.[3]?.id || ''),
                    districts: isCityLevel ? '' : (item.districts || item.selectedOptions?.[1]?.name || ''),
                    districtsCode: isCityLevel ? '' : (item.districtsCode || item.selectedOptions?.[1]?.id || ''),
                    id: item.id || '', // 编辑时可用
                    level: level, // Use the determined level value
                    status: 1,
                    street: (isCityLevel || isDistrictLevel) ? '' : (item.street || item.selectedOptions?.[2]?.name || ''),
                    streetId: (isCityLevel || isDistrictLevel) ? '' : (item.streetId || item.selectedOptions?.[2]?.id || ''),
                    superviseFlag: typeof item.isDiscipline === 'number' ? item.isDiscipline : (item.isDiscipline ? 1 : 0),
                    // systemUserId: 可选,如有需要补充
                };
            });
            values.systemUserLevels = systemUserLevels;
            if (values.password) {
                values.password = CryptoJS.MD5(values.password).toString();
            }else{
            } else {
                delete values.password
            }
            if (values.DepartmentId) {
@@ -144,54 +142,73 @@
                onUpdate(values)
            } else {
                onSave(values);
                setAccountLevels([{ area: [], isDiscipline: 0, options: [] }]); // 清空
            }
        });
    };
    const getCountyList = (id) => {
        getCityList({ id: '510400', tier: 2 }).then(res => {
            setCountyList(() => res.data)
        })
    }
    const getStreetList = (id) => {
        getCityList({ id: id, tier: 3 }).then(res => {
            setStreetList(() => res.data)
        })
    }
    const getcommunityList = (id) => {
        getCityList({ id: id, tier: 4 }).then(res => {
            setCommunityList(() => res.data)
        })
    }
    const changeCountry = (value, label) => {
        setActiveCounty(label)
        getStreetList(value)
        form.setFieldsValue({ streetId: '', communityId: '' })
        setActiveCommunity({ name: '', id: '' })
        setActiveStreet({ name: '', id: '' })
    // 获取级联数据
    const getCascaderDatas = () => {
        getCascaderData().then(res => {
            // 处理级联数据
            const processedData = res.data.map(item => {
                // 根据第一级类型处理数据
                if (item.children) {
                    // 区县级别
                    if (item.id == 2) { // 假设type=2表示区县
                        // 只保留第一级children
                        item.children = item.children.map(child => {
                            const { children, ...childWithoutChildren } = child;
                            return childWithoutChildren;
                        });
                    }
                    // 街道级别
                    else if (item.id == 3) { // 假设type=3表示街道
                        // 保留区县和街道两级
                        item.children = item.children.map(child => {
                            if (child.children) {
                                child.children = child.children.map(street => {
                                    const { children, ...streetWithoutChildren } = street;
                                    return streetWithoutChildren;
                                });
                            }
                            return child;
                        });
                    }
                    // 社区级别
                    else if (item.id == 4) { // 假设type=4表示社区
                        // 保留所有层级数据
                        return item;
                    }
                }
                return item;
            });
            let arr = JSON.parse(JSON.stringify(processedData))
            let accountLevels = localStorage.getItem('userInfo')
            let accountLevel = JSON.parse(accountLevels).accountLevel
            if (accountLevel == 2) {
                arr = arr.filter(item => item.id != 1)
            } else if (accountLevel == 3) {
                arr = arr.filter(item => item.id != 1 && item.id != 2)
            } else if (accountLevel == 4) {
                arr = arr.filter(item => item.id != 1 && item.id != 2 && item.id != 3)
            }
            setCascaderData(() => arr);
        });
    }
    const changeStreet = (value, label) => {
        setActiveStreet(label)
        getcommunityList(value)
        form.setFieldsValue({ communityId: '' })
        setActiveCommunity({ name: '', id: '' })
    }
    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
            let departmentId = []
@@ -208,8 +225,89 @@
                departmentId.push(res.data.fourDepartmentId)
            }
            res.data.DepartmentId = departmentId
            console.log('departmentId', departmentId)
            setActiveLevel(() => res.data.accountLevel)
            // 先获取级联数据再回显
            getCascaderData().then(cascadeRes => {
                // 处理级联数据
                const processedData = cascadeRes.data.map(item => {
                    // 根据第一级类型处理数据
                    if (item.children) {
                        // 区县级别
                        if (item.id == 2) { // 假设type=2表示区县
                            // 只保留第一级children
                            item.children = item.children.map(child => {
                                const { children, ...childWithoutChildren } = child;
                                return childWithoutChildren;
                            });
                        }
                        // 街道级别
                        else if (item.id == 3) { // 假设type=3表示街道
                            // 保留区县和街道两级
                            item.children = item.children.map(child => {
                                if (child.children) {
                                    child.children = child.children.map(street => {
                                        const { children, ...streetWithoutChildren } = street;
                                        return streetWithoutChildren;
                                    });
                                }
                                return child;
                            });
                        }
                        // 社区级别
                        else if (item.id == 4) { // 假设type=4表示社区
                            // 保留所有层级数据
                            return item;
                        }
                    }
                    return item;
                });
                let arr = JSON.parse(JSON.stringify(processedData))
                let accountLevels = localStorage.getItem('userInfo')
                let accountLevel = JSON.parse(accountLevels).accountLevel
                if (accountLevel == 2) {
                    arr = arr.filter(item => item.id != 1)
                } else if (accountLevel == 3) {
                    arr = arr.filter(item => item.id != 1 && item.id != 2)
                } else if (accountLevel == 4) {
                    arr = arr.filter(item => item.id != 1 && item.id != 2 && item.id != 3)
                }
                setCascaderData(() => arr);
                // 回显accountLevels,area始终为4级,id类型统一
                if (res.data.systemUserLevels && Array.isArray(res.data.systemUserLevels)) {
                    const newAccountLevels = res.data.systemUserLevels.map(level => {
                        const toId = v => (v === undefined || v === null) ? undefined : String(v);
                        const area = [
                            toId(level.level),
                            toId(level.twoLevelId || level.districtsCode),
                            toId(level.threeLevelId || level.streetId),
                            toId(level.fourLevelId || level.communityId)
                        ].filter(v => v !== undefined && v !== null && v !== '');
                        return {
                            area,
                            isDiscipline: Number(level.superviseFlag) === 1 ? 1 : 0,
                            options: [],
                            selectedOptions: [
                                level.level ? { id: toId(level.level), name: '' } : undefined,
                                level.twoLevelName ? { id: toId(level.twoLevelId), name: level.twoLevelName } : undefined,
                                level.threeLevelName ? { id: toId(level.threeLevelId), name: level.threeLevelName } : undefined,
                                level.fourLevelName ? { id: toId(level.fourLevelId), name: level.fourLevelName } : undefined,
                            ].filter(Boolean),
                            level: toId(level.level) || '',
                            community: level.community || '',
                            communityId: level.communityId || '',
                            districts: level.districts || '',
                            districtsCode: level.districtsCode || '',
                            id: level.id || '',
                            street: level.street || '',
                            streetId: level.streetId || '',
                        };
                    });
                    setAccountLevels(newAccountLevels.length ? newAccountLevels : [{ area: [], isDiscipline: 0, options: [], level: '', community: '', communityId: '', districts: '', districtsCode: '', id: '', street: '', streetId: '' }]);
                }
            });
            form.setFieldsValue({ ...res.data, password: '' })
        })
@@ -235,13 +333,32 @@
        return false
    }
    // 动态添加账号层级项
    const addAccountLevel = () => {
        setAccountLevels([...accountLevels, { area: [], isDiscipline: 0, options: [] }]);
    };
    // 删除账号层级项
    const removeAccountLevel = (idx) => {
        if (accountLevels.length === 1) return;
        setAccountLevels(accountLevels.filter((_, i) => i !== idx));
    };
    // 纪检委单选变更
    const handleDisciplineChange = (e, idx) => {
        setAccountLevels(levels => {
            const newLevels = [...levels];
            newLevels[idx].isDiscipline = e.target.value;
            return newLevels;
        });
    };
    return (
        <Modal
            getContainer={false}
            width="65%"
            width="75%"
            destroyOnClose
            title={data.type == 'detail' ? '人员详情' : data.type == 'edit' ? '编辑人员' : '添加人员'}
            open={visible}
            className='addAndEditModal'
            onCancel={() => onCancel(false)}
            afterClose={() => {
                form.resetFields()
@@ -258,8 +375,8 @@
                    <Button key="back" onClick={() => onCancel(false)}>关闭</Button>
            }
        >
            <Form layout="horizontal" {...formItemLayout} form={form} scrollToFirstError>
                <Row>
            <Form layout="horizontal" form={form} scrollToFirstError labelCol={{ span: 6 }} wrapperCol={{ span: 20 }}>
                <Row gutter={16}>
                    <Col span={8}>
                        <Form.Item
                            name="name"
@@ -269,90 +386,6 @@
                            <Input disabled={data.type == 'detail'} placeholder='请输入人员姓名' />
                        </Form.Item>
                    </Col>
                </Row>
                <Row>
                    <Col span={16}>
                        <Form.Item
                            name="DepartmentId"
                            label="所属单位"
                            labelCol={{ span: 4 }}
                            rules={[{ required: true, message: '请选择所属单位' }]}
                        >
                            {/* <Select
                                key="searchSelect"
                                allowClear
                                disabled={data.type == 'detail'}
                                placeholder="请选择"
                                options={oneCompanyList}
                                fieldNames={{ label: 'name', value: 'id' }}
                                filterOption={false}
                            >
                            </Select > */}
                            <Cascader
                                changeSelect
                                options={oneCompanyList}
                                fieldNames={{ value: 'key', label: 'name' }}
                                placeholder="请选择"
                                // displayRender={(label) => label[label.length - 1]}
                                changeOnSelect={true}
                            />
                        </Form.Item>
                    </Col>
                    {/* <Col span={8}>
                        <Form.Item
                            name="twoDepartmentId"
                            label="所属二级单位"
                        >
                            <Select
                                key="searchSelect"
                                allowClear
                                disabled={data.type == 'detail'}
                                placeholder="请选择"
                                options={twoCompanyList}
                                fieldNames={{ label: 'name', value: 'id' }}
                                filterOption={false}
                            >
                            </Select >
                        </Form.Item>
                    </Col>
                    <Col span={8}>
                        <Form.Item
                            name="threeDepartmentId"
                            label="所属三级单位"
                        >
                            <Select
                                key="searchSelect"
                                allowClear
                                disabled={data.type == 'detail'}
                                placeholder="请选择"
                                options={threeCompanyList}
                                fieldNames={{ label: 'name', value: 'id' }}
                                filterOption={false}
                            >
                            </Select >
                        </Form.Item>
                    </Col> */}
                </Row>
                {/* <Row>
                    <Col span={8}>
                        <Form.Item
                            name="fourDepartmentId"
                            label="所属四级单位"
                        >
                            <Select
                                key="searchSelect"
                                allowClear
                                disabled={data.type == 'detail'}
                                placeholder="请选择"
                                options={fourCompanyList}
                                fieldNames={{ label: 'name', value: 'id' }}
                                filterOption={false}
                            >
                            </Select >
                        </Form.Item>
                    </Col>
                </Row> */}
                <Row>
                    <Col span={8}>
                        <Form.Item
                            name="systemPostId"
@@ -360,197 +393,120 @@
                            rules={[{ required: true, message: '请选择所属职位' }]}
                        >
                            <Select
                                key="searchSelect"
                                allowClear
                                disabled={data.type == 'detail'}
                                placeholder="请选择"
                                options={positionList}
                                fieldNames={{ label: 'name', value: 'id' }}
                                filterOption={false}
                            >
                            </Select >
                            />
                        </Form.Item>
                    </Col>
                    <Col span={8}>
                        <Form.Item
                            name="systemRoleId"
                            label="所属角色"
                            rules={[{ required: true, message: '请选择所属角色' }]}
                            label="后台权限"
                            rules={[{ required: true, message: '请选择后台权限' }]}
                        >
                            <Select
                                key="searchSelect"
                                allowClear
                                disabled={data.type == 'detail'}
                                placeholder="请选择"
                                options={roleList}
                                fieldNames={{ label: 'name', value: 'id' }}
                                filterOption={false}
                            >
                            </Select >
                            />
                        </Form.Item>
                    </Col>
                </Row>
                <Row>
                <Row gutter={16}>
                    <Col span={24}>
                        <Form.Item
                            label="账号所属层级"
                            colon={true}
                            required
                            labelCol={{ span: 2 }}
                            wrapperCol={{ span: 12 }}
                            style={{ marginBottom: 0 }}
                        >
                            <Button type={'primary'} onClick={addAccountLevel} style={{ marginBottom: 8 }}>添加</Button>
                            {accountLevels.map((item, idx) => (
                                <Card key={idx} style={{ marginBottom: 8 }} size='small' >
                                    <div style={{ display: 'flex', alignItems: 'center' }}>
                                        <Cascader
                                            style={{ width: 320, marginRight: 16 }}
                                            placeholder="请选择区域"
                                            options={cascaderData}
                                            fieldNames={{ label: 'name', value: 'id' }}
                                            value={item.area}
                                            onChange={(value, selectedOptions) => {
                                                setAccountLevels(levels => {
                                                    const newLevels = [...levels];
                                                    newLevels[idx] = {
                                                        ...newLevels[idx],
                                                        area: value,
                                                        selectedOptions: selectedOptions,
                                                        // 清空原有数据,确保新选择的数据生效
                                                        community: '',
                                                        communityId: '',
                                                        districts: '',
                                                        districtsCode: '',
                                                        street: '',
                                                        streetId: '',
                                                        level: selectedOptions?.[0]?.id || ''
                                                    };
                                                    return newLevels;
                                                });
                                            }}
                                        />
                                        <div style={{ marginLeft: 16, marginTop: 22 }}>
                                            <span style={{ marginRight: 8 }}>是否为纪检委账号:</span>
                                            <Radio.Group
                                                style={{ marginRight: 16 }}
                                                value={item.isDiscipline ?? 0}
                                                onChange={e => handleDisciplineChange(e, idx)}
                                                options={[
                                                    { label: '否', value: 0 },
                                                    { label: '是', value: 1 }
                                                ]}
                                            />
                                        </div>
                                        {idx > 0 && <DeleteOutlined style={{ marginRight: 16 }} onClick={() => removeAccountLevel(idx)} disabled={accountLevels.length === 1} />}
                                    </div>
                                </Card>
                            ))}
                        </Form.Item>
                    </Col>
                </Row>
                <Row gutter={16}>
                    <Col span={8}>
                        <Form.Item
                            name="accountLevel"
                            label="账号层级"
                            rules={[{ required: true, message: '请选择账号层级' }]}
                        >
                            <Select
                                key="searchSelect"
                                allowClear
                                onChange={(e) => setActiveLevel(e)}
                                disabled={data.type == 'detail'}
                                placeholder="请选择"
                                options={levelList}
                                fieldNames={{ label: 'name', value: 'value' }}
                            // filterOption={false}
                            >
                            </Select >
                        </Form.Item>
                    </Col>
                    <Col span={16}>
                        <Form.Item
                            label="是否管理员"
                            labelCol={{ span: 4 }}
                            wrapperCol={{ span: 20 }}
                            style={{ marginBottom: 0 }}
                        >
                            <div style={{ display: "flex", flex: 1 }}>
                                <Form.Item
                                    name="isAdmin"
                                    rules={[{ required: true, message: '是否管理员' }]}
                                >
                                    <Radio.Group
                                        disabled={data.type == 'detail'}
                                        // style={style}
                                        // onChange={onChange}
                                        // value={value}
                                        options={[{ value: 0, label: '否', }, { value: 1, label: '是', },
                                        ]}
                                    />
                                </Form.Item>
                                <div style={{ fontSize: '12px', color: "rgba(0,0,0,0.5)", marginLeft: "10px" }}>管理员主要用于接收实现临期提醒,以及上级端登录</div>
                            </div>
                        </Form.Item>
                    </Col>
                </Row>
                {activeLevel != 1 && (
                    <Row>
                        {[2, 3, 4, 5].includes(activeLevel) && (
                            <Col span={8}>
                                <Form.Item
                                    name="districtsCode"
                                    label="所属区县"
                                    rules={[{ required: true, message: '请选择所属区县' }]}
                                >
                                    {/* <Select
                                // onChange={changeCountry}
                                // value={activeCounty}
                                placeholder="请选择"
                                options={levelList}
                                fieldNames={{ label: 'name', value: 'id' }}
                            >
                            </Select > */}
                                    <Select
                                        key="searchSelect"
                                        allowClear
                                        disabled={data.type == 'detail' || [2, 3, 4, 5].includes(adminLevel)}
                                        onChange={changeCountry}
                                        value={activeCounty.id}
                                        placeholder="请选择"
                                        options={countyList}
                                        fieldNames={{ label: 'name', value: 'id' }}
                                    // filterOption={false}
                                    >
                                    </Select >
                                </Form.Item>
                            </Col>
                        )}
                        {[3, 4, 5].includes(activeLevel) && (
                            <Col span={8}>
                                <Form.Item
                                    name="streetId"
                                    label="所属街道"
                                    rules={[{ required: true, message: '请选择所属街道' }]}
                                >
                                    <Select
                                        onChange={changeStreet}
                                        disabled={!activeCounty || data.type == 'detail' || [3, 4, 5].includes(adminLevel)}
                                        key="searchSelect"
                                        allowClear
                                        value={activeStreet.id}
                                        placeholder="请选择"
                                        options={streetList}
                                        fieldNames={{ label: 'name', value: 'id' }}
                                    >
                                    </Select >
                                </Form.Item>
                            </Col>
                        )}
                        {[4, 5].includes(activeLevel) && (
                            <Col span={8}>
                                <Form.Item
                                    name="communityId"
                                    label="所属社区"
                                    rules={[{ required: true, message: '请选择所属社区' }]}
                                >
                                    <Select
                                        onChange={changeCommunity}
                                        disabled={!activeStreet || data.type == 'detail' || [4, 5].includes(adminLevel)}
                                        key="searchSelect"
                                        allowClear
                                        value={activeCommunity.id}
                                        placeholder="请选择"
                                        options={communityList}
                                        fieldNames={{ label: 'name', value: 'id' }}
                                    >
                                    </Select >
                                </Form.Item>
                            </Col>
                        )}
                    </Row>
                )}
                <Row>
                    <Col span={16}>
                        <Form.Item
                            label="联系方式"
                            required
                            labelCol={{ span: 4 }}
                            wrapperCol={{ span: 20 }}
                            style={{ marginBottom: 0 }}
                            name="phone"
                            extra={'联系方式将作为登录账号使用'}
                            rules={[{
                                validator: (rule, value) => {
                                    return new Promise((resolve, reject) => {
                                        if (!value) {
                                            reject('请输入联系方式');
                                        }
                                        const phoneRegex = /^((\+86)?(13|14|15|16|17|18|19)[0-9]{9})|((\+86)?(0[0-9]{2,3})?([2-9][0-9]{6,7}))$/;
                                        if (!phoneRegex.test(value)) {
                                            reject('请输入正确的电话号码');
                                        }
                                        resolve('');
                                    });
                                },
                            }]}
                        >
                            <div style={{ display: "flex", flex: 1 }}>
                                <Form.Item
                                    name="phone"
                                    rules={[{
                                        validator: (rule, value) => {
                                            return new Promise((resolve, reject) => {
                                                if (!value) {
                                                    reject('请输入联系方式');
                                                }
                                                const phoneRegex = /^((\+86)?(13|14|15|16|17|18|19)[0-9]{9})|((\+86)?(0[0-9]{2,3})?([2-9][0-9]{6,7}))$/;
                                                if (!phoneRegex.test(value)) {
                                                    reject('请输入正确的电话号码');
                                                }
                                                resolve('');
                                            });
                                        },
                                    }]}
                                >
                                    <Input disabled={data.type == 'detail'} placeholder='请输入联系方式' />
                                </Form.Item>
                                <div style={{ fontSize: '12px', color: "rgba(0,0,0,0.5)", marginLeft: "10px" }}>联系方式将作为登录账号使用</div>
                            </div>
                            <Input disabled={data.type == 'detail'} placeholder='请输入联系方式' />
                        </Form.Item>
                    </Col>
                </Row>
                <Row>
                <Row gutter={16}>
                    <Col span={8}>
                        <Form.Item
                            required={data.type == 'add'}
@@ -574,39 +530,32 @@
                            <Input.Password disabled={data.type == 'detail'} placeholder='请输入' />
                        </Form.Item>
                    </Col>
                    <Col span={16}>
                </Row>
                <Row gutter={16}>
                    <Col span={8}>
                        <Form.Item
                            label="确认密码"
                            name="surePassword"
                            extra={'密码需要包含大小写字母,数字和特殊符号,且长度为8位以上'}
                            required={data.type == 'add'}
                            labelCol={{ span: 4 }}
                            wrapperCol={{ span: 20 }}
                            style={{ marginBottom: 0 }}
                            rules={[{
                                validator: (rule, value) => {
                                    return new Promise((resolve, reject) => {
                                        if (!value && data.type == 'add') {
                                            reject('请再次输入新密码');
                                        }
                                        if (value != form.getFieldValue('password') && data.type == 'add') {
                                            reject('两次密码请保持一致');
                                        }
                                        resolve('');
                                    });
                                },
                            }]}
                        >
                            <div style={{ display: "flex", flex: 1 }}>
                                <Form.Item
                                    name="surePassword"
                                    rules={[{
                                        validator: (rule, value) => {
                                            return new Promise((resolve, reject) => {
                                                if (!value && data.type == 'add') {
                                                    reject('请再次输入新密码');
                                                }
                                                if (value != form.getFieldValue('password') && data.type == 'add') {
                                                    reject('两次密码请保持一致');
                                                }
                                                resolve('');
                                            });
                                        },
                                    },]}
                                >
                                    <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>
                            <Input.Password disabled={data.type == 'detail'} placeholder='请输入' />
                        </Form.Item>
                    </Col>
                </Row>
            </Form>
            <Spin spinning={spinning} fullscreen />
management/src/pages/setting/user/index.jsx
@@ -1,7 +1,7 @@
import { buildProTableDataSource, sendRequest, showDelConfirm, showConfirm } from '@/utils/antdUtils';
import { DeleteOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons';
import { PageContainer, ProFormText, ProTable, QueryFilter } from '@ant-design/pro-components';
import { Button, Cascader, Col, Menu, Row, Select, Space } from 'antd';
import { PageContainer, ProFormText, ProTable, QueryFilter, ProFormSelect } from '@ant-design/pro-components';
import { Button, Cascader, Col, Menu, Row, Select, Space, Form } from 'antd';
import { useEffect, useRef, useState } from 'react';
import { Access, useAccess } from 'umi';
import AddAndEdit from './components/addAndEdit';
@@ -21,6 +21,7 @@
} from './service';
const Role = () => {
  const [form] = Form.useForm();
  const actionRef = useRef();
  const addViewRef = useRef();
  const addViewRef1 = useRef();
@@ -48,7 +49,7 @@
        }}
      >
        <span>{item.name}</span>
        <div>
        {/* <div>
          {item.tier < 4 && (
            <Access accessible={access['/system_setting/unit_management/add']}>
              <PlusOutlined
@@ -82,31 +83,40 @@
              }}
            />
          </Access>
        </div>
        </div> */}
      </div >
    );
  };
  const renderMenuItems = (items) => {
  const renderMenuItems = (items, level = 0) => {
    return items.map((item) => {
      if (item.children && item.children.length > 0) {
        return (
          <SubMenu
            key={item.key}
            title={node(item)}
            onTitleClick={(item) => {
              setUnitId(item.key);
              actionRef.current.reload();
            onTitleClick={(e) => {
              if (e && e.domEvent) {
                e.domEvent.stopPropagation();
              }
              setUnitId(item.id);
              const values = form.getFieldsValue();
              actionRef.current.reload(values);
            }}
          >
            {renderMenuItems(item.children)}
            {renderMenuItems(item.children, level + 1)}
          </SubMenu>
        );
      }
      return (
        <Menu.Item
          onClick={(item) => {
            setUnitId(item.key);
            actionRef.current.reload();
          onClick={(e) => {
            if (e && e.domEvent) {
              e.domEvent.stopPropagation();
            }
            const itemId = item.id || item.key;
            setUnitId(itemId);
            const values = form.getFieldsValue();
            actionRef.current.reload(values);
          }}
          key={item.key}
        >
@@ -120,6 +130,8 @@
      if (res.code == 200 && res.data) {
        const traverseItems = (items) => {
          return items.map((item) => {
            if (!item.id) {
            }
            item.key = item.id;
            item.title = '1';
            if (item.child && item.child.length > 0) {
@@ -128,7 +140,8 @@
            return item;
          });
        };
        setItems(traverseItems(res.data));
        const processedItems = traverseItems(res.data);
        setItems(processedItems);
      }
    });
  };
@@ -141,50 +154,50 @@
      title: '联系方式',
      dataIndex: 'phone',
    },
    {
      title: '所在单位',
      dataIndex: 'departmentName',
      hideInSearch: true,
      renderFormItem: () => {
        return (
          <Cascader
            options={items}
            fieldNames={{ value: 'key', label: 'name' }}
            placeholder="请选择"
            displayRender={(label) => label[label.length - 1]}
            changeOnSelect={true}
          />
        );
      },
    },
    {
      hideInTable: true,
      title: '所在单位',
      dataIndex: 'departmentId',
      renderFormItem: () => {
        return (
          <Cascader
            options={items}
            fieldNames={{ value: 'key', label: 'name' }}
            placeholder="请选择"
            displayRender={(label) => label[label.length - 1]}
            changeOnSelect={true}
          />
        );
      },
    },
    // {
    //   title: '所在单位',
    //   dataIndex: 'departmentName',
    //   hideInSearch: true,
    //   renderFormItem: () => {
    //     return (
    //       <Cascader
    //         options={items}
    //         fieldNames={{ value: 'key', label: 'name' }}
    //         placeholder="请选择"
    //         displayRender={(label) => label[label.length - 1]}
    //         changeOnSelect={true}
    //       />
    //     );
    //   },
    // },
    // {
    //   hideInTable: true,
    //   title: '所属权限',
    //   dataIndex: 'departmentId',
    //   renderFormItem: () => {
    //     return (
    //       <Cascader
    //         options={items}
    //         fieldNames={{ value: 'key', label: 'name' }}
    //         placeholder="请选择"
    //         displayRender={(label) => label[label.length - 1]}
    //         changeOnSelect={true}
    //       />
    //     );
    //   },
    // },
    {
      title: '所属职位',
      dataIndex: 'systemPostName',
      hideInSearch: true,
    },
    {
      title: '所属角色',
      title: '后台权限',
      dataIndex: 'systemRoleName',
      hideInSearch: true,
    },
    {
      title: '所属角色',
      title: '所属权限',
      dataIndex: 'systemRoleId',
      hideInTable: true,
      renderFormItem: () => {
@@ -201,31 +214,24 @@
      },
    },
    {
      title: '账号层级',
      title: '账号所属层级',
      dataIndex: 'accountLevel',
      // (1=市级账号,2=区县账号,3=街道账号,4=社区账号)
      render: (text, record) => {
        let role = '';
        switch (record.accountLevel) {
          case 1:
            role = '市';
            break;
          case 2:
            role = '区县';
            break;
          case 3:
            role = '街道';
            break;
          case 4:
            role = '社区';
            break;
          case 5:
            role = '党员';
            break;
          default:
            role = '';
        }
        return role;
        record.list.length>0&&record.list.map(item=>{
          item.str = ''
          if(item.level==1){
           item.str = '市'
          }else if(item.level==2){
           item.str = '区县' + '/' + item.districts
          }else if(item.level==3){
            item.str = '街道' + '/' + item.districts + '/' + item.street
          }else{
            item.str = '社区' + '/' + item.districts + '/' + item.street + '/' + item.community
          }
          return item.str;
        })
        return record.list.map(item=>item.str).join('、');
      },
      valueEnum: {
        1: '市',
@@ -265,7 +271,7 @@
              <Access accessible={access['/system_setting/people_management/edit']}>
                <a
                  onClick={() => {
                    addViewRef.current.refreshData({ ...record, type: 'edit' },items);
                    addViewRef.current.refreshData({ ...record, type: 'edit' }, items);
                    handleModalVisibles(true);
                  }}
                >
@@ -292,7 +298,7 @@
            <Access accessible={access['/system_setting/people_management/detail']}>
              <a
                onClick={() => {
                  addViewRef.current.refreshData({ ...record, type: 'detail' },items);
                  addViewRef.current.refreshData({ ...record, type: 'detail' }, items);
                  handleModalVisibles(true);
                }}
              >
@@ -302,7 +308,7 @@
            <Access accessible={access['/system_setting/people_management/freeze']}>
              <a
                onClick={() => {
                  showConfirm(`确认${record.status === 1 ? '冻结' : '解冻'}该人员吗?`,'', async () => {
                  showConfirm(`确认${record.status === 1 ? '冻结' : '解冻'}该人员吗?`, '', async () => {
                    let status = await sendRequest(
                      record.status === 1 ? freezeApi : unfreezeApi,
                      record.id,
@@ -331,6 +337,8 @@
    >
      <div style={{ background: '#fff' }}>
        <QueryFilter
          form={form}
          labelWidth={100}
          onReset={(values) => {
            fetchUnit(values);
            setUnitId('');
@@ -342,14 +350,21 @@
            actionRef.current.reload();
          }}
        >
          <ProFormText name="name" label="单位名称" />
          <ProFormText name="name" label="组织结构名称" />
          <ProFormSelect name="type" label="筛选维度" options={[{
            label: '当前组织结构',
            value: 1,
          }, {
            label: '当前及下级组织结构',
            value: 2,
          }]} />
        </QueryFilter>
      </div>
      <Row style={{ marginTop: 20, background: '#fff' }}>
        <Col span={4}>
          <Space style={{ margin: '10px 0' }}>
            <span style={{ margin: '0 27px' }}>单位管理</span>
            <Button
            <span style={{ margin: '0 27px' }}>组织结构</span>
            {/* <Button
              type="primary"
              onClick={() => {
                addViewRef1.current.refreshData({});
@@ -357,10 +372,17 @@
              }}
            >
              添加
            </Button>
            </Button> */}
          </Space>
          <Menu mode="inline">{renderMenuItems(items)}</Menu>
          <Menu
            mode="inline"
            onClick={({ key, domEvent }) => {
              domEvent.stopPropagation();
            }}
          >
            {renderMenuItems(items)}
          </Menu>
        </Col>
        <Col span={20} style={{ minHeight: 650 }}>
          <ProTable
@@ -385,6 +407,9 @@
              if (params.departmentId) {
                obj.departmentId = params.departmentId[params.departmentId.length - 1];
              }
              if (form.getFieldValue('type')) {
                obj.type = form.getFieldValue('type');
              }
              return buildProTableDataSource(getList, obj);
            }}
            toolBarRender={(action, selectRows) => [
@@ -393,7 +418,7 @@
                  <Button
                    type="primary"
                    onClick={() => {
                      addViewRef.current.refreshData({ type: 'add', unitId : unitId  },items);
                      addViewRef.current.refreshData({ type: 'add', unitId: unitId }, items);
                      handleModalVisibles(true);
                    }}
                  >
management/src/pages/setting/user/index.less
New file
@@ -0,0 +1,5 @@
.addAndEditModal{
    .ant-modal-body{
        padding: 0 !important;
    }
}
management/src/pages/setting/user/service.js
@@ -134,4 +134,12 @@
    return request(`/api/huacheng-sangeshenbian/systemUser/unfreeze/${id}`, {
        method: 'PUT',
    });
}
}
//获取级联数据
export const getCascaderData = async (data) => {
    return request(`/api/huacheng-sangeshenbian/systemUser/getAdministrativeDivisionTwo`, {
        method: 'GET',
    });
}
management/src/requestErrorConfig.ts
@@ -26,7 +26,7 @@
 * @doc https://umijs.org/docs/max/request#配置
 */
export const errorConfig: RequestConfig = {
  baseURL: BASE_URL,
  // baseURL: BASE_URL,
  // 请求拦截器
  requestInterceptors: [