feat(): 系统管理模块开发
parent
7a17832dbe
commit
dc4c2b8d1b
|
|
@ -1,14 +1,15 @@
|
||||||
import { RollbackOutlined, LogoutOutlined } from '@ant-design/icons';
|
import { RollbackOutlined, LogoutOutlined } from '@ant-design/icons';
|
||||||
import { Avatar, Menu, Typography, Modal, Form, Input, Button, message } from 'antd';
|
import { Avatar, Menu, Typography, Modal, Form, Input, Button, message } from 'antd';
|
||||||
import {useDispatch, useSelector} from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { LoginUser, removeLoginInfo } from "../../models/auth/_";
|
import { LoginUser, removeLoginInfo } from "../../models/auth/_";
|
||||||
import { RootState } from "../../models/store";
|
import { RootState } from "../../models/store";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import {divIcon} from "leaflet";
|
import { divIcon } from "leaflet";
|
||||||
import { httppost2 } from '../../utils/request';
|
import { httppost2 } from '../../utils/request';
|
||||||
import apiurl from '../../service/apiurl';
|
import apiurl from '../../service/apiurl';
|
||||||
import CryptoJS from 'crypto-js';
|
import CryptoJS from 'crypto-js';
|
||||||
|
import { createCrudService } from '../../components/crud/_';
|
||||||
|
|
||||||
const { SubMenu } = Menu;
|
const { SubMenu } = Menu;
|
||||||
|
|
||||||
|
|
@ -19,7 +20,7 @@ const HeaderUser: React.FC<{
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const [open,setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
|
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
removeLoginInfo();
|
removeLoginInfo();
|
||||||
|
|
@ -32,32 +33,43 @@ const HeaderUser: React.FC<{
|
||||||
};
|
};
|
||||||
|
|
||||||
//AES加密
|
//AES加密
|
||||||
const encryptData = (data:any) => {
|
const encryptData = (data: any) => {
|
||||||
const encryptedData = CryptoJS.MD5(data).toString();
|
const encryptedData = CryptoJS.MD5(data).toString();
|
||||||
return encryptedData;
|
return encryptedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const onFinish = async(val:any)=>{
|
const onFinish = async (val: any) => {
|
||||||
if(val.newSecretKey!==val.secondSecretKey){
|
const path = `${apiurl.systemM.userM.updatePassword}?oldPassword=${val.oldPassword}&newPassword=${val.newPassword}`;
|
||||||
message.error('确认密码错误')
|
createCrudService(path).userEdit().then((result) => {
|
||||||
return
|
if (result?.code === 200) {
|
||||||
}
|
message.success('修改成功,即将重新登录')
|
||||||
const params = {
|
setOpen(false)
|
||||||
oldSecretKey:encryptData(val.oldSecretKey),
|
|
||||||
newSecretKey:encryptData(val.newSecretKey),
|
|
||||||
secondSecretKey:encryptData(val.secondSecretKey),
|
|
||||||
userId: localStorage.getItem('userId')
|
|
||||||
}
|
|
||||||
const res = await httppost2(apiurl.setPassword,params)
|
|
||||||
if(res.code===200){
|
|
||||||
message.success('修改成功')
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
logout()
|
logout()
|
||||||
}, 1500);
|
}, 1500);
|
||||||
}else{
|
|
||||||
message.error(res.description)
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// if(val.newSecretKey!==val.secondSecretKey){
|
||||||
|
// message.error('确认密码错误')
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// const params = {
|
||||||
|
// oldSecretKey:encryptData(val.oldSecretKey),
|
||||||
|
// newSecretKey:encryptData(val.newSecretKey),
|
||||||
|
// secondSecretKey:encryptData(val.secondSecretKey),
|
||||||
|
// userId: localStorage.getItem('userId')
|
||||||
|
// }
|
||||||
|
// const res = await httppost2(apiurl.setPassword,params)
|
||||||
|
// if(res.code===200){
|
||||||
|
// message.success('修改成功')
|
||||||
|
// setTimeout(() => {
|
||||||
|
// logout()
|
||||||
|
// }, 1500);
|
||||||
|
// }else{
|
||||||
|
// message.error(res.description)
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -67,57 +79,64 @@ const HeaderUser: React.FC<{
|
||||||
<Menu
|
<Menu
|
||||||
mode="horizontal"
|
mode="horizontal"
|
||||||
theme="dark"
|
theme="dark"
|
||||||
style={{width:"130px", color:"#fff"}}
|
style={{ width: "130px", color: "#fff" }}
|
||||||
>
|
>
|
||||||
{/*icon={<Avatar><UserOutlined /></Avatar>}*/}
|
{/*icon={<Avatar><UserOutlined /></Avatar>}*/}
|
||||||
<SubMenu key="pm" icon={<div className="user topMenuIcon1"></div>} title={
|
<SubMenu key="pm" icon={<div className="user topMenuIcon1"></div>} title={
|
||||||
<span style={{fontSize:"12px"}}>
|
<span style={{ fontSize: "12px" }}>
|
||||||
{localStorage.getItem('userName')??'-'}
|
{localStorage.getItem('userName') ?? '-'}
|
||||||
{/* 咸丰测试 */}
|
{/* 咸丰测试 */}
|
||||||
</span>} >
|
</span>} >
|
||||||
<Menu.Item key="logout2" onClick={()=>setOpen(true)} className="userBox">修改密码</Menu.Item>
|
<Menu.Item key="logout2" onClick={() => setOpen(true)} className="userBox">修改密码</Menu.Item>
|
||||||
<Menu.Item icon={<LogoutOutlined />} key="logout" onClick={logout} className="userBox2">登出</Menu.Item>
|
<Menu.Item icon={<LogoutOutlined />} key="logout" onClick={logout} className="userBox2">登出</Menu.Item>
|
||||||
</SubMenu>
|
</SubMenu>
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{
|
{
|
||||||
localStorage.getItem('getInfoAdcd') === "420000000000000"?
|
localStorage.getItem('getInfoAdcd') === "420000000000000" ?
|
||||||
<div className="lf" style={{width:"30px", height:"30px", lineHeight:"32px", background:"#fff", borderRadius:"50%", textAlign:"center", marginTop:"17px"}}>
|
<div className="lf" style={{ width: "30px", height: "30px", lineHeight: "32px", background: "#fff", borderRadius: "50%", textAlign: "center", marginTop: "17px" }}>
|
||||||
<a href="http://223.75.53.141:8000/home" target="_self" style={{color:"#4677FF"}}>
|
<a href="http://223.75.53.141:8000/home" target="_self" style={{ color: "#4677FF" }}>
|
||||||
<RollbackOutlined style={{fontSize:"18px"}}/>
|
<RollbackOutlined style={{ fontSize: "18px" }} />
|
||||||
</a>
|
</a>
|
||||||
</div>:null
|
</div> : null
|
||||||
}
|
}
|
||||||
|
|
||||||
<Modal title="修改密码" open={open} onOk={()=>setOpen(false)} onCancel={()=>setOpen(false)} footer={null}>
|
<Modal
|
||||||
|
title="修改密码"
|
||||||
|
open={open}
|
||||||
|
onOk={() => setOpen(false)}
|
||||||
|
onCancel={() => setOpen(false)}
|
||||||
|
footer={null}
|
||||||
|
destroyOnClose
|
||||||
|
>
|
||||||
<Form
|
<Form
|
||||||
name="basic"
|
name="basic"
|
||||||
labelCol={{span: 5}}
|
labelCol={{ span: 5 }}
|
||||||
wrapperCol={{span: 18}}
|
wrapperCol={{ span: 18 }}
|
||||||
initialValues={{remember: true}}
|
initialValues={{ remember: true }}
|
||||||
onFinish={onFinish}
|
onFinish={onFinish}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
>
|
>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="原密码"
|
label="原密码"
|
||||||
name="oldSecretKey"
|
name="oldPassword"
|
||||||
rules={[{required: true}]}>
|
rules={[{ required: true }]}>
|
||||||
<Input.Password />
|
<Input.Password />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="新密码"
|
label="新密码"
|
||||||
name="newSecretKey"
|
name="newPassword"
|
||||||
rules={[{required: true}]}>
|
rules={[{ required: true }]}>
|
||||||
<Input.Password />
|
<Input.Password />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
{/* <Form.Item
|
||||||
label="确认密码"
|
label="确认密码"
|
||||||
name="secondSecretKey"
|
name="secondSecretKey"
|
||||||
rules={[{required: true}]}>
|
rules={[{required: true}]}>
|
||||||
<Input.Password />
|
<Input.Password />
|
||||||
</Form.Item>
|
</Form.Item> */}
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
wrapperCol={{
|
wrapperCol={{
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,10 @@ const apiurl = {
|
||||||
list: service_ykz + '/projectBasicInfo/list',
|
list: service_ykz + '/projectBasicInfo/list',
|
||||||
edit: service_ykz + '/projectBasicInfo/update',
|
edit: service_ykz + '/projectBasicInfo/update',
|
||||||
export:service_ykz + '/projectBasicInfo/export'
|
export:service_ykz + '/projectBasicInfo/export'
|
||||||
|
},
|
||||||
|
czrz: {
|
||||||
|
page: service_ykz + '/gatePoreOpLog/page',
|
||||||
|
export:service_ykz + '/gatePoreOpLog/export'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
systemM: {
|
systemM: {
|
||||||
|
|
@ -105,20 +109,13 @@ const apiurl = {
|
||||||
list: service_ykz + "/system/role/list",
|
list: service_ykz + "/system/role/list",
|
||||||
update: service_ykz + "/system/user/profile/updatePwd",
|
update: service_ykz + "/system/user/profile/updatePwd",
|
||||||
profile: service_ykz + "/system/user/profile",
|
profile: service_ykz + "/system/user/profile",
|
||||||
avatar:service_ykz + "/common/download/resource"
|
avatar: service_ykz + "/common/download/resource",
|
||||||
|
change: service_ykz + '/system/user/changeStatus',
|
||||||
|
updatePassword:service_ykz + '/system/user/profile/updatePwd'
|
||||||
},
|
},
|
||||||
menuM: {
|
menuM: {
|
||||||
page: service_ykz + "/system/menu/list",
|
page: service_ykz + "/system/menu/list",
|
||||||
menu:service_ykz + "/system/menu"
|
menu:service_ykz + "/system/menu"
|
||||||
},
|
|
||||||
log: {
|
|
||||||
page: service_ykz + "/monitor/operlog/list"
|
|
||||||
},
|
|
||||||
action: {
|
|
||||||
todayData: service_fxdd + "/userLoginLog/todayCount",
|
|
||||||
activeCount: service_fxdd + "/userLoginLog/userCount",
|
|
||||||
userCount: service_fxdd + "/userLoginLog/visitCount",
|
|
||||||
hotData:service_fxdd + "/visitMenuLog/count"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//系统管理
|
//系统管理
|
||||||
|
|
|
||||||
|
|
@ -8,37 +8,32 @@ import { httppost5 } from '../../../../utils/request';
|
||||||
import { exportFile } from '../../../../utils/tools.js';
|
import { exportFile } from '../../../../utils/tools.js';
|
||||||
const url = "http://223.75.53.141:9102/test.by-lyf.tmp"
|
const url = "http://223.75.53.141:9102/test.by-lyf.tmp"
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
const types = {
|
|
||||||
0: "设备维修",
|
|
||||||
1: '设备更换',
|
|
||||||
2:"结构加固"
|
|
||||||
}
|
|
||||||
const [searchVal, setSearchVal] = useState(false)
|
const [searchVal, setSearchVal] = useState(false)
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align:"center" },
|
{ title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align:"center" },
|
||||||
{ title: '闸孔编号', key: 'name', dataIndex: 'name', width: 150, ellipsis: true },
|
{ title: '闸孔编号', key: 'gatePoreCode', dataIndex: 'gatePoreCode', width: 150, ellipsis: true },
|
||||||
{ title: '操作人员', key: 'adress', dataIndex: 'adress', width: 200, ellipsis: true },
|
{ title: '操作人员', key: 'createUserName', dataIndex: 'createUserName', width: 200, ellipsis: true },
|
||||||
{
|
{
|
||||||
title: '操作时间', key: 'eventsDate', dataIndex: 'eventsDate', width: 140,
|
title: '操作时间', key: 'createTime', dataIndex: 'createTime', width: 140,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作内容', key: 'eventsDate', dataIndex: 'eventsDate', width: 140,
|
title: '操作内容', key: 'opContent', dataIndex: 'opContent', width: 140,
|
||||||
},
|
},
|
||||||
{ title: '设定开度(m)', key: 'type', dataIndex: 'type', width: 140},
|
{ title: '设定开度(m)', key: 'setValue', dataIndex: 'setValue', width: 140},
|
||||||
{ title: '操作前开度(m)', key: 'type', dataIndex: 'type', width: 140},
|
{ title: '操作前开度(m)', key: 'beforeValue', dataIndex: 'beforeValue', width: 140},
|
||||||
{ title: 'ip', key: 'type', dataIndex: 'type', width: 140},
|
{ title: 'ip', key: 'ipAddr', dataIndex: 'ipAddr', width: 140},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
const width = useMemo(() => columns.reduce((total, cur) => total + (cur.width), 0), [columns]);
|
const width = useMemo(() => columns.reduce((total, cur) => total + (cur.width), 0), [columns]);
|
||||||
const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.sbwh.whfabz.page).find_noCode);
|
const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.gcyx.czrz.page).find_noCode);
|
||||||
|
|
||||||
const exportExcel = () => {
|
const exportExcel = () => {
|
||||||
let params = {
|
let params = {
|
||||||
...searchVal,
|
...searchVal,
|
||||||
}
|
}
|
||||||
httppost5(apiurl.pxjh.export, params).then(res => {
|
httppost5(apiurl.gcyx.czrz.export, params).then(res => {
|
||||||
exportFile(`统计报表.xlsx`,res.data)
|
exportFile(`操作日志.xlsx`,res.data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -6,23 +6,23 @@ import moment from 'moment';
|
||||||
const { RangePicker } = DatePicker;
|
const { RangePicker } = DatePicker;
|
||||||
const ToolBar = ({ setSearchVal, onSave, storeData, exportFile1 }) => {
|
const ToolBar = ({ setSearchVal, onSave, storeData, exportFile1 }) => {
|
||||||
|
|
||||||
const types = Array(10).fill(0).map((item,i) => ({
|
// const types = Array(10).fill(0).map((item,i) => ({
|
||||||
label: `${i + 1}#闸孔`,
|
// label: `${i + 1}#闸孔`,
|
||||||
value: i + 1
|
// value: i + 1
|
||||||
}))
|
// }))
|
||||||
|
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
const onFinish = (values) => {
|
const onFinish = (values) => {
|
||||||
let dateSo;
|
let dateTimeRangeSo;
|
||||||
if (values.tm) {
|
if (values.tm) {
|
||||||
dateSo = {
|
dateTimeRangeSo = {
|
||||||
start: moment(values.tm[0]).format('YYYY-MM-DD HH:mm:ss'),
|
start: moment(values.tm[0]).format('YYYY-MM-DD HH:mm:ss'),
|
||||||
end: moment(values.tm[1]).format('YYYY-MM-DD HH:mm:ss')
|
end: moment(values.tm[1]).format('YYYY-MM-DD HH:mm:ss')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete values.tm
|
delete values.tm
|
||||||
setSearchVal({...values, dateSo});
|
setSearchVal({...values, dateTimeRangeSo});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -30,10 +30,12 @@ const ToolBar = ({ setSearchVal, onSave, storeData, exportFile1 }) => {
|
||||||
<>
|
<>
|
||||||
<div style={{display:'flex',justifyContent:'space-between'}}>
|
<div style={{display:'flex',justifyContent:'space-between'}}>
|
||||||
<Form form={form} className='toolbarBox' layout="inline" onFinish={onFinish}>
|
<Form form={form} className='toolbarBox' layout="inline" onFinish={onFinish}>
|
||||||
<Form.Item label="闸孔编号" name="type">
|
<Form.Item label="闸孔编号" name="gatePoreCode">
|
||||||
<NormalSelect allowClear style={{ width: '150px' }} options={types} />
|
{/* <NormalSelect allowClear style={{ width: '150px' }} options={types} /> */}
|
||||||
|
<Input allowClear style={{width:'150px'}}/>
|
||||||
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="操作人员" name="name">
|
<Form.Item label="操作人员" name="createUserName">
|
||||||
<Input allowClear style={{width:'150px'}}/>
|
<Input allowClear style={{width:'150px'}}/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="操作时间" name="tm">
|
<Form.Item label="操作时间" name="tm">
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ const AdcdTreeSelector: React.FC<IProps> = ({ onSelectFun, setAdcd, showCheckbox
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
fontWeight:700
|
fontWeight:700
|
||||||
}}
|
}}
|
||||||
// onClick={saveJd}
|
onClick={saveJd}
|
||||||
>备品备件分类</div>
|
>备品备件分类</div>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@ const Page = () => {
|
||||||
const refModal = useRef();
|
const refModal = useRef();
|
||||||
const [searchVal, setSearchVal] = useState(false)
|
const [searchVal, setSearchVal] = useState(false)
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align:"center" },
|
{ title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align: "center" },
|
||||||
|
{ title: '项目名称', key: 'projectName', dataIndex: 'projectName', width: 150, ellipsis: true },
|
||||||
{ title: '方案名称', key: 'planName', dataIndex: 'planName', width: 150, ellipsis: true },
|
{ title: '方案名称', key: 'planName', dataIndex: 'planName', width: 150, ellipsis: true },
|
||||||
{ title: '过程名称', key: 'processName', dataIndex: 'processName', width: 200, ellipsis: true },
|
{ title: '过程名称', key: 'processName', dataIndex: 'processName', width: 200, ellipsis: true },
|
||||||
{ title: '记录人', key: 'createUserName', dataIndex: 'createUserName', width: 140,},
|
{ title: '记录人', key: 'createUserName', dataIndex: 'createUserName', width: 140,},
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import NormalSelect from '../../../components/Form/NormalSelect';
|
||||||
|
|
||||||
const { Dragger } = Upload;
|
const { Dragger } = Upload;
|
||||||
const url = "http://223.75.53.141:9102/test.by-lyf.tmp"
|
const url = "http://223.75.53.141:9102/test.by-lyf.tmp"
|
||||||
const ModalForm = ({ mode, record, onEdit, onSave }) => {
|
const ModalForm = ({ mode, record, onUerEdit, onSave }) => {
|
||||||
if (record.prodDate) {
|
if (record.prodDate) {
|
||||||
record.myTm = moment(record.prodDate)
|
record.myTm = moment(record.prodDate)
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,6 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [fileList, setFileList] = useState([]) //上传文件列表
|
const [fileList, setFileList] = useState([]) //上传文件列表
|
||||||
const [fileIds, setFileIds] = useState('')
|
const [fileIds, setFileIds] = useState('')
|
||||||
const [flag, setFlag] = useState(true)
|
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [userParams, setUserParams] = useState({})
|
const [userParams, setUserParams] = useState({})
|
||||||
const [roleOptions, setRoleOptions] = useState([])
|
const [roleOptions, setRoleOptions] = useState([])
|
||||||
|
|
@ -43,7 +42,6 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => {
|
||||||
|
|
||||||
setFileIds(info.file?.response?.imgUrl)
|
setFileIds(info.file?.response?.imgUrl)
|
||||||
setFileList(info.fileList)
|
setFileList(info.fileList)
|
||||||
setFlag(false)
|
|
||||||
getImgFlow(info.file?.response?.imgUrl)
|
getImgFlow(info.file?.response?.imgUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,34 +68,13 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => {
|
||||||
let values = form.getFieldsValue()
|
let values = form.getFieldsValue()
|
||||||
values.avatar = fileIds;
|
values.avatar = fileIds;
|
||||||
if (mode === 'edit') {
|
if (mode === 'edit') {
|
||||||
onEdit(apiurl.systemM.userM.save, { ...userParams, ...values })
|
onUerEdit(apiurl.systemM.userM.save, { ...userParams, ...values,password:'' })
|
||||||
}
|
}
|
||||||
if (mode === 'save') {
|
if (mode === 'save') {
|
||||||
onSave(apiurl.systemM.userM.save, values)
|
onSave(apiurl.systemM.userM.save, values)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @description 获取查看时文件
|
|
||||||
* @param {*} type
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const getFileInfo = async (params) => {
|
|
||||||
try {
|
|
||||||
const res = xyt_httpget2(apiurl.systemM.userM.profile)
|
|
||||||
setImageSrc(res.data?.avatar)
|
|
||||||
// return {
|
|
||||||
// name: item.data.fileName,
|
|
||||||
// response: {
|
|
||||||
// data: {
|
|
||||||
// filePath: item.data.filePath,
|
|
||||||
// fileId:item.data.fileId
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 获取用户头像
|
// 获取用户头像
|
||||||
|
|
@ -118,7 +95,6 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log(record);
|
console.log(record);
|
||||||
if (mode != "save") {
|
if (mode != "save") {
|
||||||
// getFileInfo()
|
|
||||||
getImgFlow(record.avatar)
|
getImgFlow(record.avatar)
|
||||||
}
|
}
|
||||||
}, [record, mode])
|
}, [record, mode])
|
||||||
|
|
@ -130,10 +106,9 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => {
|
||||||
}, [record])
|
}, [record])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (mode != 'save') {
|
if (mode == 'save') {
|
||||||
form.setFieldValue("password", localStorage.getItem("password") || "")
|
form.setFieldValue('sex', '0')
|
||||||
} else {
|
form.setFieldValue('status', '0')
|
||||||
form.setFieldValue('sex','0')
|
|
||||||
}
|
}
|
||||||
getroleList()
|
getroleList()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
@ -147,8 +122,9 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => {
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="用户账号"
|
label="用户账号"
|
||||||
name="userName"
|
name="userName"
|
||||||
|
rules={[{ required: true }]}
|
||||||
>
|
>
|
||||||
<Input disabled={mode === 'view'} style={{ width: '100%' }} allowClear />
|
<Input disabled={mode != 'save'} style={{ width: '100%' }} allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
|
|
@ -160,8 +136,9 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => {
|
||||||
<Input disabled={mode === 'view'} style={{ width: '100%' }} allowClear />
|
<Input disabled={mode === 'view'} style={{ width: '100%' }} allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
|
||||||
<Row>
|
{
|
||||||
|
mode == 'save' &&
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="登录密码"
|
label="登录密码"
|
||||||
|
|
@ -171,6 +148,8 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => {
|
||||||
<Input.Password disabled={mode === 'view'} style={{ width: '100%' }} allowClear />
|
<Input.Password disabled={mode === 'view'} style={{ width: '100%' }} allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
|
}
|
||||||
|
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="手机号码"
|
label="手机号码"
|
||||||
|
|
@ -180,8 +159,7 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => {
|
||||||
<Input disabled={mode === 'view'} style={{ width: '100%' }} allowClear />
|
<Input disabled={mode === 'view'} style={{ width: '100%' }} allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
|
||||||
<Row>
|
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="性别"
|
label="性别"
|
||||||
|
|
@ -201,26 +179,12 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => {
|
||||||
<Input disabled={mode === 'view'} style={{ width: '100%' }} allowClear />
|
<Input disabled={mode === 'view'} style={{ width: '100%' }} allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
|
||||||
<Row>
|
<Col span={12}>
|
||||||
<Col span={24}>
|
|
||||||
<Form.Item
|
|
||||||
label="部门分配"
|
|
||||||
name="deptId"
|
|
||||||
labelCol={{ span: 3 }}
|
|
||||||
wrapperCol={{ span: 19 }}
|
|
||||||
>
|
|
||||||
<DeptTreeSelect disabled={mode === 'view'}/>
|
|
||||||
</Form.Item>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
<Row>
|
|
||||||
<Col span={24}>
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="角色分配"
|
label="角色分配"
|
||||||
name="roleIds"
|
name="roleIds"
|
||||||
labelCol={{ span: 3 }}
|
rules={[{ required: true }]}
|
||||||
wrapperCol={{ span: 19 }}
|
|
||||||
>
|
>
|
||||||
<NormalSelect
|
<NormalSelect
|
||||||
disabled={mode === 'view'}
|
disabled={mode === 'view'}
|
||||||
|
|
@ -232,7 +196,32 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => {
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Form.Item
|
||||||
|
label="状态"
|
||||||
|
name="status"
|
||||||
|
rules={[{ required: true }]}
|
||||||
|
>
|
||||||
|
<Radio.Group>
|
||||||
|
<Radio value={"0"}>启用</Radio>
|
||||||
|
<Radio value={"1"}>禁用</Radio>
|
||||||
|
</Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
|
||||||
|
<Col span={24}>
|
||||||
|
<Form.Item
|
||||||
|
label="部门分配"
|
||||||
|
name="deptId"
|
||||||
|
labelCol={{ span: 3 }}
|
||||||
|
wrapperCol={{ span: 19 }}
|
||||||
|
rules={[{ required: true }]}
|
||||||
|
>
|
||||||
|
<DeptTreeSelect disabled={mode === 'view'} />
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
<div style={{
|
<div style={{
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,19 @@
|
||||||
import React, { Fragment, useRef, useMemo, useEffect, useState } from 'react';
|
import React, { Fragment, useRef, useMemo, useEffect, useState } from 'react';
|
||||||
import BasicCrudModal from '../../../components/crud/BasicCrudModal';
|
import BasicCrudModal from '../../../components/crud/BasicCrudModal';
|
||||||
import { Table, Card, Dropdown, Space, Divider, Form, Row, Col, Input, Button, Modal, Popconfirm, message } from 'antd';
|
import { Table, Card, Modal, Space, Divider, Form, Row, Col, Input, Button, Switch, Popconfirm, message } from 'antd';
|
||||||
import { DownOutlined } from "@ant-design/icons"
|
import { ExclamationCircleOutlined } from "@ant-design/icons"
|
||||||
import ToolBar from './toolbar';
|
import ToolBar from './toolbar';
|
||||||
import ModalForm from './form';
|
import ModalForm from './form';
|
||||||
import apiurl from '../../../service/apiurl';
|
import apiurl from '../../../service/apiurl';
|
||||||
import usePageTable from '../../../components/crud/usePageTable2';
|
import usePageTable from '../../../components/crud/usePageTable2';
|
||||||
import { createCrudService } from '../../../components/crud/_';
|
import { createCrudService } from '../../../components/crud/_';
|
||||||
import { formItemLayout, btnItemLayout } from '../../../components/crud/FormLayoutProps';
|
const { confirm } = Modal;
|
||||||
import moment from 'moment';
|
|
||||||
import { xyt_httpput1 } from '../../../utils/request';
|
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const refModal = useRef();
|
const refModal = useRef();
|
||||||
const [searchVal, setSearchVal] = useState({})
|
const [searchVal, setSearchVal] = useState({})
|
||||||
|
|
||||||
const [selectedRowKeys, setselectedRowKeys] = useState([])
|
const [selectedRowKeys, setselectedRowKeys] = useState([])
|
||||||
const [dropItem, setDropItem] = useState({})
|
|
||||||
const [passwordOpen, setPasswordOpen] = useState(false)
|
|
||||||
const [dashOpen, setDashOpen] = useState(false)
|
const [dashOpen, setDashOpen] = useState(false)
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: '用户帐号', key: 'userName', dataIndex: 'userName', width: 150, align: "center" },
|
{ title: '用户帐号', key: 'userName', dataIndex: 'userName', width: 150, align: "center" },
|
||||||
|
|
@ -30,7 +25,15 @@ const Page = () => {
|
||||||
title: '部门', key: 'departmentName', dataIndex: 'departmentName', width: 150, align: "center",
|
title: '部门', key: 'departmentName', dataIndex: 'departmentName', width: 150, align: "center",
|
||||||
render: (v, r) => <span>{r?.dept?.deptName}</span>
|
render: (v, r) => <span>{r?.dept?.deptName}</span>
|
||||||
},
|
},
|
||||||
{ title: '状态', key: 'status', dataIndex: 'status', width: 100, align: "center", render: (v) => <span>{!v ? "正常" : "异常"}</span> },
|
{
|
||||||
|
title: '状态', key: 'status', dataIndex: 'status', width: 100, align: "center",
|
||||||
|
render: (v, r) => <Switch
|
||||||
|
checkedChildren="启用"
|
||||||
|
unCheckedChildren="禁用"
|
||||||
|
checked={v == 0 ? true : false} onChange={(e) => {
|
||||||
|
onEdit(apiurl.systemM.userM.change, {userId:r.userId,status: e ? "0" : "1",userName:r.userName })
|
||||||
|
}} />
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '创建日期', key: 'createTime', dataIndex: 'createTime', width: 150, align: "center",
|
title: '创建日期', key: 'createTime', dataIndex: 'createTime', width: 150, align: "center",
|
||||||
},
|
},
|
||||||
|
|
@ -48,6 +51,31 @@ const Page = () => {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const width = useMemo(() => columns.reduce((total, cur) => total + (cur.width), 0), [columns]);
|
const width = useMemo(() => columns.reduce((total, cur) => total + (cur.width), 0), [columns]);
|
||||||
|
|
||||||
|
const onEdit = (path, values) => {
|
||||||
|
const statusText = values.status == "0" ? "启用" : '停用';
|
||||||
|
const userName = values.userName;
|
||||||
|
confirm({
|
||||||
|
title: '系统提示',
|
||||||
|
icon: <ExclamationCircleOutlined />,
|
||||||
|
content: `确认要${statusText}${userName}用户吗?`,
|
||||||
|
okText: '确定',
|
||||||
|
okType: 'primary',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: () => {
|
||||||
|
createCrudService(path).userEdit(values).then((result) => {
|
||||||
|
if (result?.code === 200) {
|
||||||
|
message.success('操作成功')
|
||||||
|
refresh()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
console.log('Cancel');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
const command = (type) => (params) => {
|
const command = (type) => (params) => {
|
||||||
if (type === 'save') {
|
if (type === 'save') {
|
||||||
refModal.current.showSave();
|
refModal.current.showSave();
|
||||||
|
|
|
||||||
|
|
@ -19,19 +19,9 @@ const Page = () => {
|
||||||
const [allOpen, setAllOpen] = useState(false)
|
const [allOpen, setAllOpen] = useState(false)
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align: "center", render: (v, r, i) => <span>{i + 1}</span>},
|
{ title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align: "center", render: (v, r, i) => <span>{i + 1}</span>},
|
||||||
// { title: '类型', key: 'type', dataIndex: 'type', width: 100, align:"center" },
|
|
||||||
{ title: '名称', key: 'menuName', dataIndex: 'menuName', width: 150, align:"center" },
|
{ title: '名称', key: 'menuName', dataIndex: 'menuName', width: 150, align:"center" },
|
||||||
{ title: '地址', key: 'path', dataIndex: 'path', width: 230,align:"center" },
|
{ title: '地址', key: 'path', dataIndex: 'path', width: 230,align:"center" },
|
||||||
{ title: '排序号', key: 'orderNum', dataIndex: 'orderNum', width: 80,align:"center" },
|
{ title: '排序号', key: 'orderNum', dataIndex: 'orderNum', width: 80,align:"center" },
|
||||||
{
|
|
||||||
title: '状态', key: 'status', dataIndex: 'status', width: 100, align: "center",
|
|
||||||
render: (v, r) => <Switch
|
|
||||||
checkedChildren="启用"
|
|
||||||
unCheckedChildren="禁用"
|
|
||||||
checked={v == 0 ? true : false} onChange={(e) => {
|
|
||||||
onEdit(apiurl.systemM.menuM.menu,{...r, status:e ? 0 : 1})
|
|
||||||
}} />
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: '数据更新时间', key: 'createTime', dataIndex: 'createTime', width: 150,align:"center",
|
title: '数据更新时间', key: 'createTime', dataIndex: 'createTime', width: 150,align:"center",
|
||||||
},
|
},
|
||||||
|
|
@ -52,15 +42,6 @@ const Page = () => {
|
||||||
refModal.current.onUerDeleteGet(`${apiurl.systemM.menuM.menu}/${params.menuId}`);
|
refModal.current.onUerDeleteGet(`${apiurl.systemM.menuM.menu}/${params.menuId}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const onEdit = (path,values) => {
|
|
||||||
createCrudService(path).edit(values).then((result) => {
|
|
||||||
if (result?.code === 200) {
|
|
||||||
getData()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const convertToTree = (flatData, parentId = null) => {
|
const convertToTree = (flatData, parentId = null) => {
|
||||||
const result = [];
|
const result = [];
|
||||||
const map = {};
|
const map = {};
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,6 @@ const Page = () => {
|
||||||
search(params)
|
search(params)
|
||||||
}, [searchVal])
|
}, [searchVal])
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className='content-root clearFloat xybm' style={{ paddingBottom: "0" }}>
|
<div className='content-root clearFloat xybm' style={{ paddingBottom: "0" }}>
|
||||||
|
|
@ -116,11 +115,11 @@ const Page = () => {
|
||||||
exportFile1={exportExcel}
|
exportFile1={exportExcel}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
<div className="ant-card-body" style={{ padding: "20px 0 0 0", display: 'flex', columnGap: 10,overflow:'hidden' }}>
|
<div className="ant-card-body" style={{ width:"100%", padding: "20px 0 0 0", display: 'flex', columnGap: 10,overflow:'hidden' }}>
|
||||||
<div style={{ width: 800 }}>
|
<div style={{ width: '45%' }}>
|
||||||
<Table columns={columns} rowKey="inx" {...tableProps} scroll={{ x: width, y: "calc( 100vh - 400px )" }} />
|
<Table columns={columns} rowKey="inx" {...tableProps} scroll={{ x: width, y: "calc( 100vh - 400px )" }} />
|
||||||
</div>
|
</div>
|
||||||
<div style={{ width: 750,height:570 }} >
|
<div style={{ width: '55%',height:570}} >
|
||||||
<ReactEcharts
|
<ReactEcharts
|
||||||
option={pxOptions || {}}
|
option={pxOptions || {}}
|
||||||
style={{ width: "100%", height: '100%' }}
|
style={{ width: "100%", height: '100%' }}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue