Commit ae007036 authored by zhengjiangtao's avatar zhengjiangtao

修改首页告警轮播不出来bug

parent 34675421
......@@ -188,105 +188,21 @@ class IndexMap extends Component {
* 初始化登录用户权限
*/
getPermissionsCompany = () => {
//let selectedCompany = lsTool.read('selectedCompany');
let depName = null;
let sequenceNbr = null;
let city = null;
let userCity = null;
let department = lsTool.read('department');
if (department !== "undefined" && department !== null) {
let jsonObjDep = JSON.parse(department);
depName = jsonObjDep.departmentName;
sequenceNbr = this.getCompanyId(jsonObjDep);
}
if (depName !== null) {
city = depName && depName.indexOf('西安') === 0 ? 'xian' : 'xianyang';
userCity = city;
} else {
//如没有部门,则西安和咸阳查看的权限都有(带班领导、二线业务员、二线技术)
city = 'xian-xianyang';
userCity = 'xian-xianyang';
}
if (sequenceNbr === null) {
sequenceNbr = lsTool.read('companySequenceNbr');
}
//公司orgCode selectedCompanyOrg
let orgCode = lsTool.read('selectedCompanyOrg');
//公司uuid
let sequenceNbr = lsTool.read('companySequenceNbr');
let reginCompany = JSON.parse(lsTool.read('company'));
let companys = this.initCompanysData(reginCompany || []);
//let { orgCode, sequenceNbr } = this.getOrgCode(city, companys);
//let { orgCode, sequenceNbr } = this.getOrgCode(jsonObjDep);
//let orgCode = this.getOrgCode(jsonObjDep);
let dictionaryList = lsTool.read('dictionaryList');
let dicCodeList = JSON.parse(dictionaryList);
let orgCode = this.getSelectOrgCode(city, dicCodeList);
// if (depName.indexOf('西安') === 0){
// this.setState({
// city,
// orgCode,
// sequenceNbr,
// companys,
// currentCard: 1,
// depName,
// userCity,
// reginCompany
// });
// } else if (depName.indexOf('咸阳') === 0) {
// this.setState({
// city,
// orgCode,
// sequenceNbr,
// companys,
// depName,
// userCity,
// reginCompany,
// currentCard: 2
// });
// }
if (userCity.indexOf('xian-xianyang') !== -1) {
this.setState({
city,
orgCode,
sequenceNbr,
companys,
currentCard: 1,
depName,
userCity,
reginCompany
});
} else if (userCity.indexOf('xianyang') !== -1) {
this.setState({
city,
orgCode,
sequenceNbr,
companys,
currentCard: 2,
depName,
userCity,
reginCompany
});
}
else {
this.setState({
city,
orgCode,
sequenceNbr,
companys,
depName,
userCity,
//companys,
reginCompany,
currentCard: 1
});
}
lsTool.write('orgCode', orgCode);
console.log('选择的公司: ' + department);
}
/**
......@@ -313,18 +229,18 @@ class IndexMap extends Component {
/**
* 初始化数据,判断权限
*/
initCompanysData = (companys) => {
if (companys.length === 2 && companys[0].companyName.indexOf('咸阳') === 0) {
companys = companys.reverse();
}
if (companys.length === 1) {
if (companys[0].companyName.indexOf('西安') === 0) {
let xianyangCompany = { "companyOrgCode": "3", "companyName": "咸阳备份中心", "level": "subsidiary", "orgCode": "1*3", "sequenceNbr": "1251083542213996546" }
companys.push(xianyangCompany);
}
}
return companys;
}
// initCompanysData = (companys) => {
// if (companys.length === 2 && companys[0].companyName.indexOf('咸阳') === 0) {
// companys = companys.reverse();
// }
// if (companys.length === 1) {
// if (companys[0].companyName.indexOf('西安') === 0) {
// let xianyangCompany = { "companyOrgCode": "3", "companyName": "咸阳备份中心", "level": "subsidiary", "orgCode": "1*3", "sequenceNbr": "1251083542213996546" }
// companys.push(xianyangCompany);
// }
// }
// return companys;
// }
/**
* 查询通道信息及状态
......@@ -444,23 +360,23 @@ class IndexMap extends Component {
/**
* 根据传入的名称查询匹配orgCode
*/
getOrgCode = (city, companys) => {
let company;
if (city === 'xian') {
companys.map(o => {
if (o.companyName.indexOf('西安') === 0) {
company = o;
}
});
} else {
companys.map(o => {
if (o.companyName.indexOf('咸阳') === 0) {
company = o;
}
});
}
return company;
}
// getOrgCode = (city, companys) => {
// let company;
// if (city === 'xian') {
// companys.map(o => {
// if (o.companyName.indexOf('西安') === 0) {
// company = o;
// }
// });
// } else {
// companys.map(o => {
// if (o.companyName.indexOf('咸阳') === 0) {
// company = o;
// }
// });
// }
// return company;
// }
// getOrgCode = (jsonObjDep) => {
// if(jsonObjDep && jsonObjDep !==null ){
......@@ -539,41 +455,41 @@ class IndexMap extends Component {
/**
* 切换城市
*/
showCityInfo = (city, currentCard) => {
// let { companys } = this.state;
let userCity = this.state.userCity;
let company = this.state.reginCompany;
let dictionaryList = lsTool.read('dictionaryList');
let dicCodeList = JSON.parse(dictionaryList);
let orgCode = this.getSelectOrgCode(city, dicCodeList);
// if((userCity ==="xian" && city ==="xian") ||(userCity ==="xianyang" && city ==="xianyang") ){
// this.setState({
// city,
// orgCode: company.orgCode,
// sequenceNbr: company.sequenceNbr,
// currentCard
// });
// }else if(userCity ==="xian-xianyang"){
// showCityInfo = (city, currentCard) => {
// // let { companys } = this.state;
// let userCity = this.state.userCity;
// let company = this.state.reginCompany;
// let dictionaryList = lsTool.read('dictionaryList');
// let dicCodeList = JSON.parse(dictionaryList);
// let orgCode = this.getSelectOrgCode(city, dicCodeList);
// // if((userCity ==="xian" && city ==="xian") ||(userCity ==="xianyang" && city ==="xianyang") ){
// // this.setState({
// // city,
// // orgCode: company.orgCode,
// // sequenceNbr: company.sequenceNbr,
// // currentCard
// // });
// // }else if(userCity ==="xian-xianyang"){
// // this.setState({
// // city,
// // orgCode: company.orgCode,
// // sequenceNbr: company.sequenceNbr,
// // currentCard
// // });
// // console.log("您是所属西安CCPC,西安和咸阳数据都可以查看")
// // }else if(userCity ==="xian" && city ==="xianyang"){
// // message.danger('您没有咸阳的权限,请联系管理员');
// // }else if(userCity ==="xianyang" && city ==="xian"){
// // message.danger('您没有西安的权限,请联系管理员');
// // }
// this.setState({
// city,
// orgCode: company.orgCode,
// orgCode: orgCode,
// sequenceNbr: company.sequenceNbr,
// currentCard
// });
// console.log("您是所属西安CCPC,西安和咸阳数据都可以查看")
// }else if(userCity ==="xian" && city ==="xianyang"){
// message.danger('您没有咸阳的权限,请联系管理员');
// }else if(userCity ==="xianyang" && city ==="xian"){
// message.danger('您没有西安的权限,请联系管理员');
// }
this.setState({
city,
orgCode: orgCode,
sequenceNbr: company.sequenceNbr,
currentCard
});
}
/**
* 展示陕西省地图
......@@ -802,9 +718,10 @@ class IndexMap extends Component {
let dictionaryList = lsTool.read('dictionaryList');
let dicCodeList = JSON.parse(dictionaryList);
let orgCode = this.getSelectOrgCode(city, dicCodeList);
let selectedCompany = lsTool.read('selectedCompany');
let selectedCompanyOrg = lsTool.read('selectedCompanyOrg');
let companyName = this.getSelectCityByOrgCode(selectedCompanyOrg, dicCodeList);
let map = null;
if (selectedCompany.indexOf("西安CCPC") !== -1 || selectedCompany.indexOf("清算中心") !== -1) {
if (companyName.indexOf("清算中心") !== -1) {
map = { 'is3DPage': true, 'city': city, 'orgCode': orgCode };
} else {
//如果不是西安CCPC,orgCode为空
......@@ -820,9 +737,11 @@ class IndexMap extends Component {
let dictionaryList = lsTool.read('dictionaryList');
let dicCodeList = JSON.parse(dictionaryList);
let orgCode = this.getSelectOrgCode(city,dicCodeList);
let selectedCompany = lsTool.read('selectedCompany');
// let selectedCompany = lsTool.read('selectedCompany');
let selectedCompanyOrg = lsTool.read('selectedCompanyOrg');
let companyName = this.getSelectCityByOrgCode(selectedCompanyOrg, dicCodeList);
let map = null;
if (selectedCompany.indexOf("西安CCPC")!==-1){
if (companyName.indexOf("清算中心")!==-1){
map = { 'is3DPage': true, 'city': city, 'orgCode': orgCode ,'flag':flag,'pid':id,'pointName':pointName,'pointAttrs':pointAttrs};
} else {
//如果不是西安CCPC,orgCode为空
......
......@@ -65,9 +65,11 @@ class RegionSelect extends Component {
const { state } = this.props.location;
const { sequenceNbr } = reginParams.role || {};
const { companyName } = reginParams.company || {};
const companyOrgCode = reginParams.company.orgCode || {};
const companySequenceNbr = reginParams.sequenceNbr || {};
lsTool.write('selectedRole', sequenceNbr);
lsTool.write('selectedCompany', companyName);
lsTool.write('selectedCompanyOrg', companyOrgCode);
lsTool.write('companySequenceNbr', companySequenceNbr);
if (state) {
browserHistory.push('/main/3dview');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment