Merge branch 'master' of codeup.aliyun.com:5f9118049cffa29cfdd3be1c/marketing/frontend

This commit is contained in:
姜棚 2021-12-09 18:10:01 +08:00
commit a64351e4b6
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) => {
return req('get', baseurl + "/auth/admin/adminRoleRules/"+id)
}
@ -535,8 +534,14 @@ export const postAddSubAcc = (params) => {
export const putAddSubAcc = (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) => {

View File

@ -32,7 +32,8 @@ export default class adduserinfo extends React.Component{
pwdtype:'text',
defaultFileList:[{src:''}],
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},
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={}
img.src=acceptData.head;
@ -101,8 +104,8 @@ export default class adduserinfo extends React.Component{
let iptVal=this.state.model;
let _this=this;
if(valiform){
if(!roleArr||roleArr.length<1){
console.log(!roleArr);
if(roleArr==undefined){
Notify.clear();
Notify.error('请设置子账号权限');
}else{
@ -464,7 +467,7 @@ export default class adduserinfo extends React.Component{
}} />
</FormItem>
<FormItem labelname="设置权限" myClassName="rolechoose" id="station">
<Tree ref="roletree"/>
<Tree ref="roletree" rules={this.state.ruleId}/>
</FormItem>
</Form>

View File

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