子账号管理新增/编辑/列表/状态/重置密码处理

This commit is contained in:
red-deng-deng 2021-12-09 17:18:53 +08:00
parent 4e4b9def52
commit 486fdbec33
3 changed files with 80 additions and 27 deletions

View File

@ -523,7 +523,6 @@ export const putAddAcc = (id,params) => {
//子账号 //子账号
//获取子账号权限 //获取子账号权限
// /auth/admin/adminRoleRules/:id
export const getsubAccount = (id) => { export const getsubAccount = (id) => {
return req('get', baseurl + "/auth/admin/adminRoleRules/"+id) return req('get', baseurl + "/auth/admin/adminRoleRules/"+id)
} }
@ -535,8 +534,14 @@ export const postAddSubAcc = (params) => {
export const putAddSubAcc = (id,data) => { export const putAddSubAcc = (id,data) => {
return req('put', baseurl + "/auth/admin/editSon/"+id,data) return req('put', baseurl + "/auth/admin/editSon/"+id,data)
} }
//子账号列表
export const getSubAccList = (params) => {
return req('get', baseurl + "/auth/admin/sonIndex", params)
}
//获取指定账号下的子账号列表
export const getsubAppoint = (id,params) => {
return req('get', baseurl + "/auth/admin/accountSonIndex/"+id,params)
}
// 角色管理 // 角色管理
//角色管理列表 //角色管理列表
export const getRoleList = (params) => { export const getRoleList = (params) => {

View File

@ -32,7 +32,8 @@ export default class adduserinfo extends React.Component{
pwdtype:'text', pwdtype:'text',
defaultFileList:[{src:''}], defaultFileList:[{src:''}],
disabled:false, disabled:false,
id:'' id:'',
ruleId:[]
} }
} }
@ -61,6 +62,8 @@ export default class adduserinfo extends React.Component{
deparment:{key:acceptData.department.id,text:acceptData.department.department_name}, deparment:{key:acceptData.department.id,text:acceptData.department.department_name},
post:{key:acceptData.job.id,text:acceptData.job.job_name}, post:{key:acceptData.job.id,text:acceptData.job.job_name},
} }
let ruleIds=formInfo.rowData.rule.map(item=>item.id);
this.setState({ruleId:ruleIds});
let img={} let img={}
img.src=acceptData.head; img.src=acceptData.head;
@ -101,8 +104,8 @@ export default class adduserinfo extends React.Component{
let iptVal=this.state.model; let iptVal=this.state.model;
let _this=this; let _this=this;
if(valiform){ if(valiform){
console.log(!roleArr); if(!roleArr||roleArr.length<1){
if(roleArr==undefined){ console.log(!roleArr);
Notify.clear(); Notify.clear();
Notify.error('请设置子账号权限'); Notify.error('请设置子账号权限');
}else{ }else{
@ -464,7 +467,7 @@ export default class adduserinfo extends React.Component{
}} /> }} />
</FormItem> </FormItem>
<FormItem labelname="设置权限" myClassName="rolechoose" id="station"> <FormItem labelname="设置权限" myClassName="rolechoose" id="station">
<Tree ref="roletree"/> <Tree ref="roletree" rules={this.state.ruleId}/>
</FormItem> </FormItem>
</Form> </Form>

View File

@ -5,7 +5,7 @@ import "./list.less"
import {Switch ,Icon ,Sweetalert, Notify,Dialog,Button} from 'zent'; import {Switch ,Icon ,Sweetalert, Notify,Dialog,Button} from 'zent';
import TabPage from "../../../../components/tabPage/main.js" import TabPage from "../../../../components/tabPage/main.js"
import "../../../../assets/comm.css" import "../../../../assets/comm.css"
import {getAccountList,handelResponse,getCompany,putAccountStatus,delAccount} from "../../../../assets/api.js" import {getSubAccList,handelResponse,getCompany,getsubAppoint,putAccountStatus,delAccount} from "../../../../assets/api.js"
import Grid from "../../../../components/gird/main.js" import Grid from "../../../../components/gird/main.js"
import Ipt from "../../../../components/input/main" import Ipt from "../../../../components/input/main"
import Modifypwd from "./modifypwd" import Modifypwd from "./modifypwd"
@ -23,13 +23,6 @@ const Column = [
name: 'mobile', name: 'mobile',
width:'10%', width:'10%',
type: "normal", type: "normal",
}, {
title: '角色',
name: 'role',
prop:'role.role_name',
type: "normal",
defaultText: 0,
width:'10%'
}, },
{ {
title: '岗位', title: '岗位',
@ -127,7 +120,12 @@ export default class acclistDom extends React.Component{
handelResponse(res,(response,msg)=>{ handelResponse(res,(response,msg)=>{
Notify.clear(); Notify.clear();
Notify.success(msg); Notify.success(msg);
self.getAccountFn();
if(!window.location.href.includes('aid')){
self.getAccountFn();
}else{
self.getsubAppointFn();
}
},(err)=>{ },(err)=>{
Notify.error(err) Notify.error(err)
}) })
@ -160,7 +158,11 @@ export default class acclistDom extends React.Component{
handelResponse(res,(response,msg)=>{ handelResponse(res,(response,msg)=>{
Notify.clear(); Notify.clear();
Notify.success(msg); Notify.success(msg);
self.getAccountFn(); if(!window.location.href.includes('aid')){
this.getAccountFn();
}else{
this.getsubAppointFn();
}
},(err)=>{ },(err)=>{
Notify.error(err) Notify.error(err)
}) })
@ -204,6 +206,26 @@ export default class acclistDom extends React.Component{
resetpwd(e,row){ resetpwd(e,row){
this.setState({visible:true,id:row.id}); this.setState({visible:true,id:row.id});
} }
//获取指定账号下的子账号列表
getsubAppointFn(){
let _self=this;
let {page,limit,search}=_self.state;
let data={page,limit}
if(search){
data.search=search;
}
getsubAppoint(sessionStorage.getItem('subaid'),data).then(res=>{
handelResponse(res,(response,msg)=>{
const accList_data=response.data;
const {total}=response;
_self.setState({accList:accList_data,total});
},(err)=>{
Notify.error(err)
})
}).catch(err=>{
});
}
//获取用户列表 //获取用户列表
getAccountFn(){ getAccountFn(){
let _self=this; let _self=this;
@ -212,7 +234,7 @@ export default class acclistDom extends React.Component{
if(search){ if(search){
data.search=search; data.search=search;
} }
getAccountList(data).then(res=>{ getSubAccList(data).then(res=>{
handelResponse(res,(response,msg)=>{ handelResponse(res,(response,msg)=>{
const accList_data=response.data; const accList_data=response.data;
const {total}=response; const {total}=response;
@ -230,27 +252,46 @@ export default class acclistDom extends React.Component{
//page //page
pageChange(e){ pageChange(e){
this.setState({page:e}); this.setState({page:e});
setTimeout(() => { if(!window.location.href.includes('aid')){
this.getAccountFn(); setTimeout(() => {
}, 10); this.getAccountFn();
}, 10);
}else{
setTimeout(() => {
this.getsubAppointFn();
}, 10);
}
} }
//limit //limit
countChange(e){ countChange(e){
this.setState({page:1,limit:e}); this.setState({page:1,limit:e});
setTimeout(() => { if(!window.location.href.includes('aid')){
this.getAccountFn(); setTimeout(() => {
}, 10); this.getAccountFn();
}, 10);
}else{
setTimeout(() => {
this.getsubAppointFn();
}, 10);
}
} }
//敲回车查询 //敲回车查询
iptsureFn(){ iptsureFn(){
this.getAccountFn(); if(!window.location.href.includes('aid')){
this.getAccountFn();
}else{
this.getsubAppointFn();
}
} }
componentWillMount(){ componentWillMount(){
this.getAccountFn();
this.setState({tableHeight:window.innerHeight-390}); this.setState({tableHeight:window.innerHeight-390});
if(!window.location.href.includes('aid')){ if(!window.location.href.includes('aid')){
sessionStorage.setItem('subaid',JSON.parse(sessionStorage.getItem('userInfo')).id); sessionStorage.setItem('subaid',JSON.parse(sessionStorage.getItem('userInfo')).id);
this.getAccountFn();
}else{
this.getsubAppointFn();
} }
} }
componentDidMount(){ componentDidMount(){
@ -266,7 +307,11 @@ export default class acclistDom extends React.Component{
componentDidUpdate(prevProps,prevState){ componentDidUpdate(prevProps,prevState){
// 参数分别为改变之前的数据状态对象 // 参数分别为改变之前的数据状态对象
if(prevState.search!=this.state.search &&!this.state.search){ if(prevState.search!=this.state.search &&!this.state.search){
this.getAccountFn(); if(!window.location.href.includes('aid')){
this.getAccountFn();
}else{
this.getsubAppointFn();
}
} }
} }
sureFn(){ sureFn(){