From da0264d264f1c0d46edb5c87243117f0175c16f1 Mon Sep 17 00:00:00 2001 From: guoxin Date: Fri, 27 Oct 2023 10:25:24 +0800 Subject: [PATCH] =?UTF-8?q?fix():=E4=BF=AE=E6=94=B9=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=AE=A1=E7=90=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/css/base.scss | 7 +- src/components/layout/Header/index.jsx | 4 +- src/pages/SystemMgm/AdminMgm/index.scss | 1 + src/pages/SystemMgm/AdminMgm/loadable.jsx | 123 ++++++++++++++++----- .../SystemMgm/AreaManage/ModalAreaAdd/index.jsx | 9 +- src/pages/SystemMgm/AreaManage/loadable.jsx | 48 ++++---- .../BusinessConfig/BusinessConf/loadable.jsx | 63 +++++++---- src/pages/SystemMgm/RoleMgm/loadable.jsx | 59 ++++++---- src/services/system.js | 2 +- 9 files changed, 215 insertions(+), 101 deletions(-) diff --git a/src/assets/css/base.scss b/src/assets/css/base.scss index fd5707c..66a897a 100644 --- a/src/assets/css/base.scss +++ b/src/assets/css/base.scss @@ -26,7 +26,10 @@ body { & { overflow: -moz-scrollbars-none; } } - +.redLogo{ + color: red; + margin-right: 10px; +} .full-loading { height: 100%; width: 100%; @@ -54,7 +57,7 @@ a { background-color: #3e4557 !important; } .ant-table.ant-table-bordered > .ant-table-container > .ant-table-content { - max-height: 715px; + max-height: 680px; overflow: auto; } .ant-table-content::-webkit-scrollbar { diff --git a/src/components/layout/Header/index.jsx b/src/components/layout/Header/index.jsx index 51843ab..20b852a 100644 --- a/src/components/layout/Header/index.jsx +++ b/src/components/layout/Header/index.jsx @@ -237,9 +237,9 @@ export default function Header(props) { -
  • + {/*
  • -
  • + */} {/*
  • */} diff --git a/src/pages/SystemMgm/AdminMgm/index.scss b/src/pages/SystemMgm/AdminMgm/index.scss index 1da5b61..d159f5a 100644 --- a/src/pages/SystemMgm/AdminMgm/index.scss +++ b/src/pages/SystemMgm/AdminMgm/index.scss @@ -26,6 +26,7 @@ $color-primary: var(--color-primary); display: flex; label { line-height: 31px; + } } .yisa-time { diff --git a/src/pages/SystemMgm/AdminMgm/loadable.jsx b/src/pages/SystemMgm/AdminMgm/loadable.jsx index 042214d..ac3777e 100644 --- a/src/pages/SystemMgm/AdminMgm/loadable.jsx +++ b/src/pages/SystemMgm/AdminMgm/loadable.jsx @@ -99,6 +99,19 @@ function AdminMgm(props) { const handleDeptName = (v) => { setAddManage({ ...addManage, deptName: v }) }; + //添加角色 + const handleRole = (v) => { + setAddManage({ ...addManage, role: v }) + }; + //添加管辖方式 + const handleGovernmentType = (v) => { + setGetGovernment(v) + setAddManage({ ...addManage, government_style: v }) + } + //添加管辖区域 + const handleArea = (v) => { + setAddManage({ ...addManage, government_area: v }) + } //添加管辖车场接入方式 const onChangeCarType = (e) => { setAddManage({ ...addManage, car_type: e.target.value }) @@ -131,7 +144,7 @@ function AdminMgm(props) { }; //添加移动端管辖区域 const handleMoveArea = (e) => { - setAddManage({ ...addManage, moveArea:e }) + setAddManage({ ...addManage, moveArea: e }) }; //添加失效时间 const onChangeTime = (date, dateString) => { @@ -143,23 +156,32 @@ function AdminMgm(props) { let data = { ...addManage } - ajax.addAdminDate(data).then(res => { - if (res.status === 20000) { - setImgVisible(false) - setAddManage({ - mobile: '', - userName: '', - account: '', - email: '', - deptName: '', - sex: 1, - car_type: 1, - messageRole: 0, - failure_time: '' - }) - getData(formData) - } - }) + if (addManage.account == '') { + message.error('请输入登录名') + } else if (addManage.userName == '') { + message.error('请输入姓名') + } else if (addManage.deptName == '') { + message.error('请输入所属部门') + } else { + ajax.addAdminDate(data).then(res => { + if (res.status === 20000) { + setImgVisible(false) + setAddManage({ + mobile: '', + userName: '', + account: '', + email: '', + deptName: '', + sex: 1, + car_type: 1, + messageRole: 0, + failure_time: '' + }) + getData(formData) + } + }) + } + } //列表 const handleColumns = (tab) => { @@ -220,7 +242,7 @@ function AdminMgm(props) { title: '状态', render: (text, record) => { return <> - {record.workState === 1 ? '离职' : '在职'} + {record.workState === 1 ? '在职' : '离职'} } }, @@ -231,7 +253,7 @@ function AdminMgm(props) {
    { CheckApplyBtn(record) }}>编辑
    -
    { deleteApplyBtn(record) }}>{record.workState === 1 ? '在职' : '离职'}
    +
    { deleteApplyBtn(record) }}>{record.workState === 1 ? '离职' : '在职'}
    { applyBtn(record) }}>重置密码
    }> @@ -277,9 +299,9 @@ function AdminMgm(props) { messageRole: record.messageRole, failure_time: record.failure_time, role: record.role, - government_style:record.government_style, - government_area:record.government_area, - moveArea:record.moveArea + government_style: record.government_style, + government_area: record.government_area, + moveArea: record.moveArea })) } //管辖方式 @@ -584,7 +606,7 @@ function AdminMgm(props) { >
    - +
    +
    *
    - +
    *
    +
    @@ -619,7 +643,7 @@ function AdminMgm(props) {
    - +
    +
    *
    + + +
    +
    + + +
    +
    全部 diff --git a/src/pages/SystemMgm/AreaManage/ModalAreaAdd/index.jsx b/src/pages/SystemMgm/AreaManage/ModalAreaAdd/index.jsx index b447226..5bb07b0 100644 --- a/src/pages/SystemMgm/AreaManage/ModalAreaAdd/index.jsx +++ b/src/pages/SystemMgm/AreaManage/ModalAreaAdd/index.jsx @@ -16,7 +16,7 @@ function ModalAreaAdd (props) { level, onCancel } = props - + console.log(pid); const [form] = Form.useForm() const [areaType, setAreaType] = useState("1") @@ -100,16 +100,11 @@ function ModalAreaAdd (props) { ) : null } - + diff --git a/src/pages/SystemMgm/AreaManage/loadable.jsx b/src/pages/SystemMgm/AreaManage/loadable.jsx index f5eb16f..968da42 100644 --- a/src/pages/SystemMgm/AreaManage/loadable.jsx +++ b/src/pages/SystemMgm/AreaManage/loadable.jsx @@ -1,5 +1,5 @@ import React, { useState, useRef, useEffect } from "react"; -import { message, Pagination, Table, Input, Modal, Tree, Button } from "antd"; +import { message, Pagination, Table, Input, Modal, Tree, Button } from "antd"; import { DeleteOutlined, EditOutlined, PlusCircleOutlined } from '@ant-design/icons'; import ajax from "@/services" import { BaseMap } from "@/components" @@ -73,30 +73,31 @@ function AreaManage() { } }) } - const handleAreaAdd = ({level, pid, isCity}) => { + const handleAreaAdd = ({ level, id, isCity }) => { + let pid =id setIsCity(isCity) setPid(pid) - setLevel(Number(level)+1) + setLevel(Number(level) + 1) setEditStatus(false) setModalAreaVisible(true) } - const handleAreaEdit = ({name, id, virtually_code, code, lng_lat}) => { - setEditForm({name, id, virtually_code, code, lng_lat}) + const handleAreaEdit = ({ name, id, virtually_code, code, lng_lat }) => { + setEditForm({ name, id, virtually_code, code, lng_lat }) setEditStatus(true) setModalAreaVisible(true) } // 区域删除 - const handleAreaDel = ({name, id}) => { + const handleAreaDel = ({ name, id }) => { Modal.confirm({ title: '确认删除?', content: `是否确认删除区域: ${name}`, - icon: , + icon: , okText: '删除', cancelText: '取消', onOk: () => { - ajaxAreaDel({name, id}).then((msg) => { + ajaxAreaDel({ name, id }).then((msg) => { message.success(msg) getAreaTree() }).catch((err) => { @@ -112,12 +113,12 @@ function AreaManage() { setModalAreaVisible(false) setModalMapVisible(true) } - const handleMapClick = ({lat, lng}) => { + const handleMapClick = ({ lat, lng }) => { setLatlng([lat.toFixed(4), lng.toFixed(4)]) } // 区域新增 - const handleAreaConfirm = ({formData, editStatus}) => { + const handleAreaConfirm = ({ formData, editStatus }) => { if (editStatus) { // 编辑 ajaxAreaEdit(formData).then((msg) => { message.success(msg) @@ -146,19 +147,26 @@ function AreaManage() { setModalAreaVisible(true) } } - const treeTitleRender = ({name, children, level, pid, id, virtually_code, lng_lat, code}) => { + const treeTitleRender = ({ name, children, level, pid, id, virtually_code, lng_lat, code }) => { return <> {name} { - children ? ( - handleAreaAdd({level, pid, isCity: true})} /> + level === 1 ? ( + handleAreaAdd({ level, id, isCity: true })} /> ) : null } { + level === 2 ? <> + handleAreaAdd({ level, id, isCity: false })} /> + handleAreaDel({ name, id })} /> + handleAreaEdit({ name, id, virtually_code, code, lng_lat })} /> + : null + } + { level > 2 ? <> - handleAreaAdd({level, pid, isCity: false})} /> - handleAreaDel({name, id})} /> - handleAreaEdit({name, id, virtually_code, code, lng_lat})}/> + {/* handleAreaAdd({level, pid, isCity: false})} /> */} + handleAreaDel({ name, id })} /> + handleAreaEdit({ name, id, virtually_code, code, lng_lat })} /> : null } @@ -189,7 +197,7 @@ function AreaManage() { editForm={editForm} visible={modalAreaVisible} onMapSelect={modalMapSelct} - onOk={(formData, editStatus) => handleAreaConfirm({formData, editStatus})} + onOk={(formData, editStatus) => handleAreaConfirm({ formData, editStatus })} latlng={latlng} onCancel={() => handleModalClose()} /> @@ -202,12 +210,12 @@ function AreaManage() {
    handleMapClick(latlng)} + onClick={({ latlng }) => handleMapClick(latlng)} />
    - - + +
    diff --git a/src/pages/SystemMgm/BusinessConfig/BusinessConf/loadable.jsx b/src/pages/SystemMgm/BusinessConfig/BusinessConf/loadable.jsx index 34c0923..dd78a2e 100644 --- a/src/pages/SystemMgm/BusinessConfig/BusinessConf/loadable.jsx +++ b/src/pages/SystemMgm/BusinessConfig/BusinessConf/loadable.jsx @@ -45,7 +45,7 @@ function BusinessConf(props) { //添加 const [addManage, setAddManage] = useState({ area_name: 0, - operator_name: 0, + operator_name: "0", item_name: '' }) const addAdmin = () => { @@ -66,8 +66,11 @@ function BusinessConf(props) { const handleConfiguration = (v, option) => { setGetMessage(option); setGetConfiguration(v) - - setAddManage({ ...addManage, item_name: v }) + setAddManage({ + ...addManage, item_name: v , + area_name: 0, + operator_name: "0", + }) } //添加 const onChangeAdd = (e) => { @@ -113,20 +116,32 @@ function BusinessConf(props) { } //添加提交 const placeSaveBtn = () => { + console.log(addManage.parameter); let data = { ...addManage } - ajax.addBusiness(data).then(res => { - if (res.status === 20000) { - setImgVisible(false) - setAddManage({ - area_name: 0, - operator_name: 0, - item_name: '' - }) - getData(formData) - } - }) + if (addManage.area_name === '') { + message.error('请选择城市') + } else if (addManage.operator_name === '') { + message.error('请选择商户名称') + } else if (addManage.item_name === '') { + message.error('请选择配置项') + } else if (addManage.parameter === undefined && addManage.parameterValue === undefined) { + message.error('请选择参数项') + } else { + ajax.addBusiness(data).then(res => { + if (res.status === 20000) { + setImgVisible(false) + setAddManage({ + area_name: 0, + operator_name: "0", + item_name: '' + }) + getData(formData) + setGetConfiguration(0) + } + }) + } } //列表 const handleColumns = (tab) => { @@ -171,11 +186,11 @@ function BusinessConf(props) { title: '参数描述', dataIndex: 'parameter_dsc', key: 'parameter_dsc', - render:(text,record)=>{ - return<> + render: (text, record) => { + return <>
    - {/* {getMessage.message} */} -
    + {/* {getMessage.message} */} +
    } }, @@ -219,9 +234,10 @@ function BusinessConf(props) { setImgVisible(false) setAddManage({ area_name: 0, - operator_name: 0, + operator_name: '0', item_name: '' }) + setGetConfiguration(0) setGetMessage({}) } //编辑 @@ -274,7 +290,7 @@ function BusinessConf(props) { setImgVisible(false) setAddManage({ area_name: 0, - operator_name: 0, + operator_name: '0', item_name: '' }) setGetMessage({}) @@ -346,6 +362,7 @@ function BusinessConf(props) { if (res.status === 20000) { setEditVisible(false) getData(formData) + setGetConfiguration(0) } }) } @@ -448,6 +465,7 @@ function BusinessConf(props) { >
    +
    *
    +
    *
    + value={geteditData.parameterValue}> diff --git a/src/pages/SystemMgm/RoleMgm/loadable.jsx b/src/pages/SystemMgm/RoleMgm/loadable.jsx index 9eab8af..44951bf 100644 --- a/src/pages/SystemMgm/RoleMgm/loadable.jsx +++ b/src/pages/SystemMgm/RoleMgm/loadable.jsx @@ -134,21 +134,31 @@ function RoleMgm(props) { let data = { ...addManage } - console.log(data); - ajax.addAdmin(data).then(res => { - if (res.status === 20000) { - setImgVisible(false) - setAddManage({ - remark: '', - name: '', - depart_id: '', - auth: '' - }) - getData(formData) - }else{ - message.error(res.message) - } - }) + if(addManage.name===''){ + message.error('请输入角色名称') + }else if(addManage.depart_id===''){ + message.error('请选择所属部门') + }else if (addManage.auth === '') { + message.error('必须选择权限') + } else { + ajax.addAdmin(data).then(res => { + if (res.status === 20000) { + setImgVisible(false) + setAddManage({ + remark: '', + name: '', + depart_id: '', + auth: '' + }) + getData(formData) + setGetGovernment(0) + } else { + message.error(res.message) + setGetGovernment(0) + } + }) + } + } //列表 const handleColumns = (tab) => { @@ -281,13 +291,15 @@ function RoleMgm(props) { setAddManage({ remark: '', name: '', - depart_id: [], + depart_id: null, }) setCheckedKeys([]) + setGetGovernment(0) } const delcancelImg = () => { setEditVisible(false) setCheckedKeys([]) + setGetGovernment(0) } // 获取列表数据 const getData = (data = formData) => { @@ -366,14 +378,17 @@ function RoleMgm(props) { }) } useEffect(() => { - console.log(getGovernment); if (getGovernment != 0) { let data = { id: getGovernment } ajax.getDepartId(data).then(res => { - if (res.status === 20000) { - setGetGovernmentArea(res.data) + if(res.status === 20000){ + if (res.status == []) { + message.error('部门没有配置对应菜单权限') + }else{ + setGetGovernmentArea(res.data) + } } }) } @@ -450,6 +465,7 @@ function RoleMgm(props) { >
    +
    *
    - +
    +
    *
    { const getOrgTree = (params) => { return ajax({ url: '/api/manage/com/depart_tree', - type: 'post', + type: 'get', data: params }) }