| | |
| | | import { buildProTableDataSource, sendRequest, showDelConfirm } 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, Space } from 'antd'; |
| | | import { Button, Cascader, Col, Menu, Row, Select, Space } from 'antd'; |
| | | import { useEffect, useRef, useState } from 'react'; |
| | | import { Access, useAccess } from 'umi'; |
| | | import AddAndEdit from './components/addAndEdit'; |
| | | import AddUnit from './components/addUnit'; |
| | | import { add, addUnit, del, delUnit, edit, editUnit, getList, getUnitList ,editSystemUserInfo,addSystemUserInfo} from './service'; |
| | | import { |
| | | addSystemUserInfo, |
| | | addUnit, |
| | | del, |
| | | delUnit, |
| | | editSystemUserInfo, |
| | | editUnit, |
| | | getList, |
| | | getUnitList, |
| | | systemRoleList, |
| | | unfreezeApi, |
| | | freezeApi, |
| | | } from './service'; |
| | | |
| | | const Role = () => { |
| | | const actionRef = useRef(); |
| | |
| | | const addViewRef1 = useRef(); |
| | | const [modalVisible, handleModalVisibles] = useState(false); |
| | | const [modalVisible1, handleModalVisibles1] = useState(false); |
| | | const [roleList, setRoleList] = useState([]); |
| | | const [unitId, setUnitId] = useState(''); |
| | | const access = useAccess(); |
| | | const [items, setItems] = useState([]); |
| | | const { SubMenu } = Menu; |
| | | useEffect(() => { |
| | | fetchUnit(); |
| | | systemRoleList({ pageNum: 1, pageSize: 10000 }).then((res) => { |
| | | setRoleList(() => res.data.records); |
| | | }); |
| | | }, []); |
| | | const node = (item) => { |
| | | return ( |
| | |
| | | ); |
| | | }); |
| | | }; |
| | | const fetchUnit = () => { |
| | | getUnitList().then((res) => { |
| | | const fetchUnit = (params) => { |
| | | getUnitList(params).then((res) => { |
| | | if (res.code == 200 && res.data) { |
| | | const traverseItems = (items) => { |
| | | return items.map((item) => { |
| | |
| | | }, |
| | | { |
| | | title: '所属角色', |
| | | dataIndex:'systemRoleId', |
| | | dataIndex: 'systemRoleId', |
| | | hideInTable: true, |
| | | renderFormItem: () => { |
| | | return ( |
| | | <Select |
| | | key="searchSelect" |
| | | allowClear |
| | | placeholder="请选择" |
| | | options={roleList} |
| | | fieldNames={{ label: 'name', value: 'id' }} |
| | | filterOption={false} |
| | | ></Select> |
| | | ); |
| | | }, |
| | | }, |
| | | { |
| | | title: '账号层级', |
| | |
| | | <a |
| | | type="link" |
| | | onClick={() => { |
| | | addViewRef.current.refreshData(record, true); |
| | | handleModalVisibles(true); |
| | | showDelConfirm(async () => { |
| | | let status = await sendRequest( |
| | | record.status === 1 ? freezeApi : unfreezeApi, |
| | | record.id, |
| | | ); |
| | | if (status) { |
| | | actionRef.current.reload(); |
| | | } |
| | | }, `确认${record.status === 1 ? '冻结' : '解冻'}该人员吗?`,'确认'); |
| | | }} |
| | | > |
| | | 冻结 |
| | | {record.status === 1 ? '冻结' : '解冻'} |
| | | </a> |
| | | </Access> |
| | | </Space> |
| | |
| | | }} |
| | | > |
| | | <div style={{ background: '#fff' }}> |
| | | <QueryFilter> |
| | | <QueryFilter |
| | | onReset={(values) => { |
| | | fetchUnit(values); |
| | | setUnitId(''); |
| | | actionRef.current.reload(); |
| | | }} |
| | | onFinish={(values) => { |
| | | fetchUnit(values); |
| | | setUnitId(''); |
| | | actionRef.current.reload(); |
| | | }} |
| | | > |
| | | <ProFormText name="name" label="单位名称" /> |
| | | </QueryFilter> |
| | | </div> |
| | |
| | | |
| | | // 删除 |
| | | export const del = async (id) => { |
| | | return request(`/api/huacheng-sangeshenbian/systemRole/delete/${id}`, { |
| | | return request(`/api/huacheng-sangeshenbian/systemUser/delete/${id}`, { |
| | | method: 'DELETE', |
| | | }); |
| | | } |
| | |
| | | return request(`/api/huacheng-sangeshenbian/systemUser/getAdministrativeDivision/${data.id}/${data.tier}`, { |
| | | method: 'GET', |
| | | }); |
| | | } |
| | | |
| | | // 冻结 |
| | | export const freezeApi = async (id) => { |
| | | return request(`/api/huacheng-sangeshenbian/systemUser/freeze/${id}`, { |
| | | method: 'PUT', |
| | | }); |
| | | } |
| | | // 解冻 |
| | | export const unfreezeApi = async (id) => { |
| | | return request(`/api/huacheng-sangeshenbian/systemUser/unfreeze/${id}`, { |
| | | method: 'PUT', |
| | | }); |
| | | } |