From dc4c2b8d1b07137ca99445de9c0b2888b716abc5 Mon Sep 17 00:00:00 2001 From: lishenfeng Date: Thu, 19 Dec 2024 18:00:13 +0800 Subject: [PATCH] =?UTF-8?q?feat():=20=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DashboardLayout/HeaderUser.tsx | 145 ++++++++++-------- src/service/apiurl.js | 17 +- .../InformationSearch/OperateLog/index.js | 25 ++- .../InformationSearch/OperateLog/toolbar.js | 22 +-- .../Sbwh/Spbjgl/AdcdTreeSelector/index.tsx | 2 +- src/views/Sbwh/Ssgcjl/index.js | 3 +- src/views/SystemMangant/UserInfo1/form.js | 97 ++++++------ src/views/SystemMangant/UserInfo1/index.js | 46 ++++-- src/views/SystemMangant/menuM/index.js | 19 --- src/views/WatchData/Jcsj/index.js | 7 +- 10 files changed, 197 insertions(+), 186 deletions(-) diff --git a/src/components/DashboardLayout/HeaderUser.tsx b/src/components/DashboardLayout/HeaderUser.tsx index 3be8a43..84090c4 100644 --- a/src/components/DashboardLayout/HeaderUser.tsx +++ b/src/components/DashboardLayout/HeaderUser.tsx @@ -1,14 +1,15 @@ import { RollbackOutlined, LogoutOutlined } from '@ant-design/icons'; 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 { LoginUser, removeLoginInfo } from "../../models/auth/_"; import { RootState } from "../../models/store"; import React, { useState } from "react"; -import {divIcon} from "leaflet"; +import { divIcon } from "leaflet"; import { httppost2 } from '../../utils/request'; import apiurl from '../../service/apiurl'; import CryptoJS from 'crypto-js'; +import { createCrudService } from '../../components/crud/_'; const { SubMenu } = Menu; @@ -19,7 +20,7 @@ const HeaderUser: React.FC<{ const navigate = useNavigate(); const dispatch = useDispatch(); - const [open,setOpen] = useState(false) + const [open, setOpen] = useState(false) const logout = () => { removeLoginInfo(); @@ -31,93 +32,111 @@ const HeaderUser: React.FC<{ window.location.reload(); }; - //AES加密 - const encryptData = (data:any) => { - const encryptedData = CryptoJS.MD5(data).toString(); - return encryptedData; - } - - - const onFinish = async(val:any)=>{ - 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) - } + //AES加密 + const encryptData = (data: any) => { + const encryptedData = CryptoJS.MD5(data).toString(); + return encryptedData; } - + + + const onFinish = async (val: any) => { + const path = `${apiurl.systemM.userM.updatePassword}?oldPassword=${val.oldPassword}&newPassword=${val.newPassword}`; + createCrudService(path).userEdit().then((result) => { + if (result?.code === 200) { + message.success('修改成功,即将重新登录') + setOpen(false) + setTimeout(() => { + logout() + }, 1500); + } + }) + + // 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) + // } + } + return (
-
- - {/*icon={}*/} -
} title={ - - {localStorage.getItem('userName')??'-'} - {/* 咸丰测试 */} - } > - setOpen(true)} className="userBox">修改密码 - } key="logout" onClick={logout} className="userBox2">登出 - - -
+
+ + {/*icon={}*/} +
} title={ + + {localStorage.getItem('userName') ?? '-'} + {/* 咸丰测试 */} + } > + setOpen(true)} className="userBox">修改密码 + } key="logout" onClick={logout} className="userBox2">登出 + + + { - localStorage.getItem('getInfoAdcd') === "420000000000000"? -
- - + localStorage.getItem('getInfoAdcd') === "420000000000000" ? +
+ + -
:null +
: null } - setOpen(false)} onCancel={()=>setOpen(false)} footer={null}> + setOpen(false)} + onCancel={() => setOpen(false)} + footer={null} + destroyOnClose + >
+ name="oldPassword" + rules={[{ required: true }]}> + name="newPassword" + rules={[{ required: true }]}> - - + */} { - const types = { - 0: "设备维修", - 1: '设备更换', - 2:"结构加固" - } const [searchVal, setSearchVal] = useState(false) const columns = [ { title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align:"center" }, - { title: '闸孔编号', key: 'name', dataIndex: 'name', width: 150, ellipsis: true }, - { title: '操作人员', key: 'adress', dataIndex: 'adress', width: 200, ellipsis: true }, + { title: '闸孔编号', key: 'gatePoreCode', dataIndex: 'gatePoreCode', width: 150, 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: 'type', dataIndex: 'type', width: 140}, - { title: 'ip', key: 'type', dataIndex: 'type', width: 140}, + { title: '设定开度(m)', key: 'setValue', dataIndex: 'setValue', width: 140}, + { title: '操作前开度(m)', key: 'beforeValue', dataIndex: 'beforeValue', width: 140}, + { title: 'ip', key: 'ipAddr', dataIndex: 'ipAddr', width: 140}, ]; 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 = () => { let params = { ...searchVal, } - httppost5(apiurl.pxjh.export, params).then(res => { - exportFile(`统计报表.xlsx`,res.data) + httppost5(apiurl.gcyx.czrz.export, params).then(res => { + exportFile(`操作日志.xlsx`,res.data) }) } useEffect(() => { diff --git a/src/views/Gcyx/InformationSearch/OperateLog/toolbar.js b/src/views/Gcyx/InformationSearch/OperateLog/toolbar.js index 67a32fc..f6277e0 100644 --- a/src/views/Gcyx/InformationSearch/OperateLog/toolbar.js +++ b/src/views/Gcyx/InformationSearch/OperateLog/toolbar.js @@ -6,23 +6,23 @@ import moment from 'moment'; const { RangePicker } = DatePicker; const ToolBar = ({ setSearchVal, onSave, storeData, exportFile1 }) => { - const types = Array(10).fill(0).map((item,i) => ({ - label: `${i + 1}#闸孔`, - value: i + 1 - })) + // const types = Array(10).fill(0).map((item,i) => ({ + // label: `${i + 1}#闸孔`, + // value: i + 1 + // })) const [form] = Form.useForm(); const onFinish = (values) => { - let dateSo; + let dateTimeRangeSo; if (values.tm) { - dateSo = { + dateTimeRangeSo = { start: moment(values.tm[0]).format('YYYY-MM-DD HH:mm:ss'), end: moment(values.tm[1]).format('YYYY-MM-DD HH:mm:ss') } } delete values.tm - setSearchVal({...values, dateSo}); + setSearchVal({...values, dateTimeRangeSo}); } @@ -30,10 +30,12 @@ const ToolBar = ({ setSearchVal, onSave, storeData, exportFile1 }) => { <>
- - + + {/* */} + + - + diff --git a/src/views/Sbwh/Spbjgl/AdcdTreeSelector/index.tsx b/src/views/Sbwh/Spbjgl/AdcdTreeSelector/index.tsx index f5400e5..290fee4 100644 --- a/src/views/Sbwh/Spbjgl/AdcdTreeSelector/index.tsx +++ b/src/views/Sbwh/Spbjgl/AdcdTreeSelector/index.tsx @@ -217,7 +217,7 @@ const AdcdTreeSelector: React.FC = ({ onSelectFun, setAdcd, showCheckbox textAlign: 'center', fontWeight:700 }} - // onClick={saveJd} + onClick={saveJd} >备品备件分类
{ loading ? diff --git a/src/views/Sbwh/Ssgcjl/index.js b/src/views/Sbwh/Ssgcjl/index.js index b714959..b40181e 100644 --- a/src/views/Sbwh/Ssgcjl/index.js +++ b/src/views/Sbwh/Ssgcjl/index.js @@ -13,7 +13,8 @@ const Page = () => { const refModal = useRef(); const [searchVal, setSearchVal] = useState(false) 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: 'processName', dataIndex: 'processName', width: 200, ellipsis: true }, { title: '记录人', key: 'createUserName', dataIndex: 'createUserName', width: 140,}, diff --git a/src/views/SystemMangant/UserInfo1/form.js b/src/views/SystemMangant/UserInfo1/form.js index 3246b4a..c35618e 100644 --- a/src/views/SystemMangant/UserInfo1/form.js +++ b/src/views/SystemMangant/UserInfo1/form.js @@ -11,7 +11,7 @@ import NormalSelect from '../../../components/Form/NormalSelect'; const { Dragger } = Upload; 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) { record.myTm = moment(record.prodDate) } @@ -19,7 +19,6 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => { const [form] = Form.useForm(); const [fileList, setFileList] = useState([]) //上传文件列表 const [fileIds, setFileIds] = useState('') - const [flag, setFlag] = useState(true) const [loading, setLoading] = useState(false) const [userParams, setUserParams] = useState({}) const [roleOptions, setRoleOptions] = useState([]) @@ -43,7 +42,6 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => { setFileIds(info.file?.response?.imgUrl) setFileList(info.fileList) - setFlag(false) getImgFlow(info.file?.response?.imgUrl) } @@ -70,34 +68,13 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => { let values = form.getFieldsValue() values.avatar = fileIds; if (mode === 'edit') { - onEdit(apiurl.systemM.userM.save, { ...userParams, ...values }) + onUerEdit(apiurl.systemM.userM.save, { ...userParams, ...values,password:'' }) } if (mode === 'save') { 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(() => { console.log(record); if (mode != "save") { - // getFileInfo() getImgFlow(record.avatar) } }, [record, mode]) @@ -130,10 +106,9 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => { }, [record]) useEffect(() => { - if (mode != 'save') { - form.setFieldValue("password", localStorage.getItem("password") || "") - } else { - form.setFieldValue('sex','0') + if (mode == 'save') { + form.setFieldValue('sex', '0') + form.setFieldValue('status', '0') } getroleList() }, []) @@ -147,8 +122,9 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => { - + @@ -160,9 +136,10 @@ const ModalForm = ({ mode, record, onEdit, onSave }) => {
- - - + + { + mode == 'save' && + { + } + { - - + { - - - - - - - - - - + + { /> + + + + 启用 + 禁用 + + + + + + + + + +
{ const [form] = Form.useForm(); const refModal = useRef(); const [searchVal, setSearchVal] = useState({}) const [selectedRowKeys, setselectedRowKeys] = useState([]) - const [dropItem, setDropItem] = useState({}) - const [passwordOpen, setPasswordOpen] = useState(false) const [dashOpen, setDashOpen] = useState(false) const columns = [ { title: '用户帐号', key: 'userName', dataIndex: 'userName', width: 150, align: "center" }, @@ -30,7 +25,15 @@ const Page = () => { title: '部门', key: 'departmentName', dataIndex: 'departmentName', width: 150, align: "center", render: (v, r) => {r?.dept?.deptName} }, - { title: '状态', key: 'status', dataIndex: 'status', width: 100, align: "center", render: (v) => {!v ? "正常" : "异常"} }, + { + title: '状态', key: 'status', dataIndex: 'status', width: 100, align: "center", + render: (v, r) => { + onEdit(apiurl.systemM.userM.change, {userId:r.userId,status: e ? "0" : "1",userName:r.userName }) + }} /> + }, { 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 onEdit = (path, values) => { + const statusText = values.status == "0" ? "启用" : '停用'; + const userName = values.userName; + confirm({ + title: '系统提示', + icon: , + 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) => { if (type === 'save') { refModal.current.showSave(); diff --git a/src/views/SystemMangant/menuM/index.js b/src/views/SystemMangant/menuM/index.js index 95a395d..9569983 100644 --- a/src/views/SystemMangant/menuM/index.js +++ b/src/views/SystemMangant/menuM/index.js @@ -19,19 +19,9 @@ const Page = () => { const [allOpen, setAllOpen] = useState(false) const columns = [ { title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align: "center", render: (v, r, i) => {i + 1}}, - // { title: '类型', key: 'type', dataIndex: 'type', width: 100, align:"center" }, { title: '名称', key: 'menuName', dataIndex: 'menuName', width: 150, align:"center" }, { title: '地址', key: 'path', dataIndex: 'path', width: 230,align:"center" }, { title: '排序号', key: 'orderNum', dataIndex: 'orderNum', width: 80,align:"center" }, - { - title: '状态', key: 'status', dataIndex: 'status', width: 100, align: "center", - render: (v, r) => { - onEdit(apiurl.systemM.menuM.menu,{...r, status:e ? 0 : 1}) - }} /> - }, { title: '数据更新时间', key: 'createTime', dataIndex: 'createTime', width: 150,align:"center", }, @@ -52,15 +42,6 @@ const Page = () => { 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 result = []; const map = {}; diff --git a/src/views/WatchData/Jcsj/index.js b/src/views/WatchData/Jcsj/index.js index 05b443c..8503fc7 100644 --- a/src/views/WatchData/Jcsj/index.js +++ b/src/views/WatchData/Jcsj/index.js @@ -88,7 +88,6 @@ const Page = () => { search(params) }, [searchVal]) - return ( <>
@@ -116,11 +115,11 @@ const Page = () => { exportFile1={exportExcel} /> -
-
+
+
-
+