代码调整

This commit is contained in:
joylink_cuiweidong 2020-11-12 14:06:13 +08:00
parent fee759e83b
commit d0421ff9fe
9 changed files with 22 additions and 22 deletions

View File

@ -159,7 +159,7 @@ export default {
const deviceList = []; const deviceList = [];
// //
let nameShow = this.nameLevels.indexOf(1) !== -1; let nameShow = this.nameLevels.includes(1);
const signalList = this.$store.getters['map/signalList']; const signalList = this.$store.getters['map/signalList'];
if (signalList && signalList.length > 0) { if (signalList && signalList.length > 0) {
signalList.forEach(elem => { signalList.forEach(elem => {
@ -168,11 +168,11 @@ export default {
} }
// //
nameShow = this.nameLevels.indexOf(3) !== -1; nameShow = this.nameLevels.includes(3);
// //
nameShow = this.nameLevels.indexOf(7) !== -1; // nameShow = this.nameLevels.includes(7); //
const switchSectionNameShow = this.nameLevels.indexOf(9) !== -1; // const switchSectionNameShow = this.nameLevels.includes(9); //
const switchList = this.$store.getters['map/switchList']; const switchList = this.$store.getters['map/switchList'];
if (switchList && switchList.length > 0) { if (switchList && switchList.length > 0) {
switchList.forEach(elem => { switchList.forEach(elem => {
@ -181,7 +181,7 @@ export default {
} }
// //
const indicatorShow = this.nameLevels.indexOf(8) !== -1; const indicatorShow = this.nameLevels.includes(8);
const control = this.$store.getters['map/stationControlList']; const control = this.$store.getters['map/stationControlList'];
if (control && control.length > 0) { if (control && control.length > 0) {
control.forEach(elem => { control.forEach(elem => {
@ -204,28 +204,28 @@ export default {
nameShow = false; nameShow = false;
} else if (elem.type === '01') { } else if (elem.type === '01') {
// //
nameShow = this.nameLevels.indexOf(11) !== -1; nameShow = this.nameLevels.includes(11);
} else if (elem.type === '02') { } else if (elem.type === '02') {
// //
nameShow = this.nameLevels.indexOf(5) !== -1; nameShow = this.nameLevels.includes(5);
} else if (elem.type === '04') { } else if (elem.type === '04') {
// //
nameShow = this.nameLevels.indexOf(9) !== -1; nameShow = this.nameLevels.includes(9);
} }
// //
if (elem.standTrack) { if (elem.standTrack) {
standTrackNameShow = this.nameLevels.indexOf(2) !== -1; standTrackNameShow = this.nameLevels.includes(2);
} }
// //
if (elem.reentryTrack) { if (elem.reentryTrack) {
reentryTrackNameShow = this.nameLevels.indexOf(4) !== -1; reentryTrackNameShow = this.nameLevels.includes(4);
} }
// //
if (elem.transferTrack) { if (elem.transferTrack) {
transferTrackNameShow = this.nameLevels.indexOf(6) !== -1; transferTrackNameShow = this.nameLevels.includes(6);
} }
deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, standTrackNameShow, reentryTrackNameShow, transferTrackNameShow })); deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, standTrackNameShow, reentryTrackNameShow, transferTrackNameShow }));
@ -233,7 +233,7 @@ export default {
} }
// //
const destCodeShow = this.nameLevels.indexOf(10) !== -1; const destCodeShow = this.nameLevels.includes(10);
const stopPointList = this.$store.getters['map/stopPointList']; const stopPointList = this.$store.getters['map/stopPointList'];
if (stopPointList && stopPointList.length > 0) { if (stopPointList && stopPointList.length > 0) {
stopPointList.forEach(elem => { stopPointList.forEach(elem => {
@ -242,7 +242,7 @@ export default {
} }
// //
const kmPostShow = this.nameLevels.indexOf(12) !== -1; const kmPostShow = this.nameLevels.includes(12);
const stationList = this.$store.getters['map/stationList']; const stationList = this.$store.getters['map/stationList'];
if (stationList && stationList.length > 0) { if (stationList && stationList.length > 0) {
stationList.forEach(elem => { stationList.forEach(elem => {

View File

@ -158,8 +158,8 @@ export default {
], ],
actions: [ actions: [
{ text: '地图排序', handler: this.mapSort }, { text: '地图排序', handler: this.mapSort },
{ text: '导出', handler: this.localExport, show: () => { return this.$store.state.user.roles.indexOf(superAdmin) > 0; }}, { text: '导出', handler: this.localExport, show: () => { return this.$store.state.user.roles.includes(superAdmin); }},
{ text: '导入', handler: this.localImport, fileType: 'file', show: () => { return this.$store.state.user.roles.indexOf(superAdmin) > 0; }} { text: '导入', handler: this.localImport, fileType: 'file', show: () => { return this.$store.state.user.roles.includes(superAdmin); }}
] ]
}, },

View File

@ -56,7 +56,7 @@ export default {
type: 'button', type: 'button',
title: this.$t('global.operate'), title: this.$t('global.operate'),
width: '450', width: '450',
hide: () => { return this.$store.state.user.roles.indexOf(superAdmin) < 0; }, hide: () => { return !this.$store.state.user.roles.includes(superAdmin); },
buttons: [ buttons: [
{ {
name: this.$t('global.preview'), name: this.$t('global.preview'),

View File

@ -66,7 +66,7 @@ export default {
type: 'button', type: 'button',
title: this.$t('global.operate'), title: this.$t('global.operate'),
width: '250', width: '250',
hide: (row) => { return this.$store.state.user.roles.indexOf(superAdmin) < 0; }, hide: (row) => { return !this.$store.state.user.roles.includes(superAdmin); },
buttons: [ buttons: [
{ {
name: this.$t('global.preview'), name: this.$t('global.preview'),

View File

@ -66,7 +66,7 @@ export default {
type: 'button', type: 'button',
title: this.$t('global.operate'), title: this.$t('global.operate'),
width: '550', width: '550',
hide: () => { return this.$store.state.user.roles.indexOf(superAdmin) < 0; }, hide: () => { return !this.$store.state.user.roles.includes(superAdmin); },
buttons: [ buttons: [
{ {
name: this.$t('publish.generateRunPlan'), name: this.$t('publish.generateRunPlan'),

View File

@ -80,7 +80,7 @@ export default {
}, },
methods:{ methods:{
filterNode(value, data) { filterNode(value, data) {
return data.label.indexOf(value) !== -1; return data.label.includes(value);
}, },
changeRole(member) { changeRole(member) {
if (member) { if (member) {

View File

@ -249,7 +249,7 @@ export default {
// } // }
}, },
covertButtonname() { covertButtonname() {
if (this.$store.getters.roles.indexOf(admin) >= 0 || this.$store.getters.roles.indexOf(superAdmin) >= 0) { if (this.$store.getters.roles.includes(admin) || this.$store.getters.roles.includes(superAdmin)) {
return this.$t('scriptRecord.publish'); return this.$t('scriptRecord.publish');
} else { } else {
return this.$t('scriptRecord.applyPublish'); return this.$t('scriptRecord.applyPublish');

View File

@ -178,7 +178,7 @@ export default {
}, },
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
return data.name.indexOf(value) !== -1; return data.name.includes(value);
}, },
buy() { buy() {
// this.disabled = true; // this.disabled = true;

View File

@ -95,7 +95,7 @@ export default {
methods: { methods: {
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
return data.name.indexOf(value) !== -1; return data.name.includes(value);
}, },
showContextMenu(e, obj, node, vueElem) { showContextMenu(e, obj, node, vueElem) {
if (obj) { if (obj) {