Merge remote-tracking branch 'remotes/origin/test_thirdLogin' into test

This commit is contained in:
joylink_cuiweidong 2021-06-15 15:34:42 +08:00
commit eeb75b6a6d
4 changed files with 150 additions and 94 deletions

View File

@ -97,23 +97,24 @@ class MouseController extends Eventful {
}
mousemove(e) {
if (this._dragging) {
const oldX = this._x;
const oldY = this._y;
if (this._dragging) {
const oldX = this._x;
const oldY = this._y;
const dx = e.offsetX - oldX;
const dy = e.offsetY - oldY;
const dx = e.offsetX - oldX;
const dy = e.offsetY - oldY;
this._x = e.offsetX;
this._y = e.offsetY;
this._x = e.offsetX;
this._y = e.offsetY;
if (e.which == 1) {
this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
} else if (e.which === 3 && this._zoomOnMouseWheel && this._previewOrMapDraw) {
this.handleMouseMoveRight({x: e.offsetX, y: e.offsetY});
}
}
if (e.which == 1) {
this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
} else if (e.which === 3 && this._zoomOnMouseWheel && this._previewOrMapDraw) {
this.handleMouseMoveRight({x: e.offsetX, y: e.offsetY});
this.isMoveRight = true;
}
}
}
mouseup(e) {
@ -121,10 +122,23 @@ class MouseController extends Eventful {
this._dragging = false;
}
if (this._zoomOnMouseWheel && this.$jmap.mapDevice['check_box'] && this._previewOrMapDraw ) {
console.log(this.isMoveRight, 'mouseup');
this.eventTarget = this.$jmap.mapDevice['check_box'].instance;
this.handleBoundingRect(this.eventTarget);
var em = this.checkEvent(e);
let em;
if (!this.isMoveRight) {
em = this.checkEvent(e);
} else {
em = {
clientX:e.offsetX,
clientY:e.offsetY,
eventTarget:this.eventTarget,
deviceCode:'check_box',
deviceType:'CheckBox'
};
}
this.trigger(this.events.Selected, em);
}
}
@ -157,8 +171,13 @@ class MouseController extends Eventful {
}
contextmenu(e) {
var em = this.checkEvent(e);
this.trigger(this.events.Contextmenu, em);
// 判断是否正在右键拖选 若不是则弹出右键菜单
if (!this.isMoveRight) {
var em = this.checkEvent(e);
this.trigger(this.events.Contextmenu, em);
} else {
this.isMoveRight = false;
}
}
moveEvent(e) {

View File

@ -294,6 +294,30 @@
</div>
</div>
</template>
<template v-if="checkFieldType(item,'checkBoxDevice')">
<div :key="item.prop" class="coordinate">
<span class="title">{{ item.label }}</span>
<div class="list-box">
<div>
<el-button
size="small"
:type="item.buttonShowType ? 'danger' : 'primary'"
@click="item.hover(item.buttonType)"
>激活选择</el-button>
<el-button
size="small"
@click="item.clear()"
>清空</el-button>
</div>
<div class="list-content">
<div v-for="(nor,indexIn) in formModel[item.prop]" :key="nor" class="each-content" @mouseenter="item.mouseenter(nor)" @mouseleave="item.mouseleave(nor)">
<div class="name">{{ item.getName(nor) }}</div>
<div class="close" @click="formModel[item.prop].splice(indexIn, 1);"><i class="el-icon-close" /></div>
</div>
</div>
</div>
</div>
</template>
</template>
</fieldset>
</template>

View File

@ -196,11 +196,19 @@ export default {
} else if (controlLampTypeList.includes(type)) {
this.enabledTab = 'ControlLamp';
} else {
this.enabledTab = type;
if (this.$refs['ZcControl'] && this.$refs['ZcControl'][0].field == 'checkZcSection') {
this.enabledTab = 'ZcControl';
} else {
this.enabledTab = type;
}
}
},
deviceSelect(type) {
// if (this.$refs['ZcControl'].field != 'checkZcSection') {
this.selectDevice = type;
// } else {
// this.selectDevice = 'ZcControl';
// }
},
saveMapEvent() {
this.$emit('saveMapEvent');

View File

@ -1,5 +1,5 @@
<template>
<el-tabs v-model="activeName" class="card" @tab-click="handleClick">
<el-tabs v-model="activeName" class="card">
<el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy">
<div class="view-control-content">
<config-list ref="dataform" :form="form" :form-model="editModel" :rules="rules" />
@ -53,8 +53,9 @@ export default {
editModel: {
code: '',
name: '',
managedSectionList:[],
// visible: '',
concentrateStationList:[],
// concentrateStationList:[],
position: {
x: 0,
y: 0
@ -64,12 +65,13 @@ export default {
code: '',
name: '',
// visible: '',
concentrateStationList:[],
// concentrateStationList:[],
position: {
x: 0,
y: 0
}
},
field:'',
rules: {
code: [
{ required: true, message: this.$t('rules.pleaseSelectEncoding'), trigger: 'change' }
@ -80,9 +82,9 @@ export default {
// visible: [
// { required: true, message: this.$t('rules.visible'), trigger: 'change' }
// ],
concentrateStationList:[
{ required: true, message: this.$t('rules.selectConcentrateStation'), trigger: 'change' }
],
// concentrateStationList:[
// { required: true, message: this.$t('rules.selectConcentrateStation'), trigger: 'change' }
// ],
'position.x': [
{ required: true, message: this.$t('rules.trainPositionX'), trigger: 'blur' }
],
@ -95,8 +97,11 @@ export default {
computed: {
...mapGetters('map', [
'zcList',
'stationList'
'seclectDeviceList'
]),
isButtonType() {
return this.field == 'checkZcSection';
},
form() {
const form = {
labelWidth: '150px',
@ -115,7 +120,8 @@ export default {
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' }
] },
{ prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation, deviceChange: this.changeConcentrateStation }
{ prop:'managedSectionList', label:'管理区段列表: ', type: 'checkBoxDevice', getName:this.getName, mouseenter:this.mouseenter, mouseleave:this.mouseleave, buttonShowType:this.isButtonType, hover:this.hover, buttonType:'checkZcSection', clear:this.clear}
// { prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation, deviceChange: this.changeConcentrateStation }
]
}
}
@ -133,8 +139,9 @@ export default {
{ prop: 'position', label: this.$t('map.stateSignalsPlotCoordinates'), type: 'coordinate', width: '140px', children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' }
] },
{ prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation, deviceChange: this.changeConcentrateStation }
] }
//
// { prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation, deviceChange: this.changeConcentrateStation }
]
}
}
@ -143,51 +150,41 @@ export default {
}
},
watch: {
stationList() {
this.getConcertrateStation();
}
},
mounted() {
this.getConcertrateStation();
},
// mounted() {
// this.getConcertrateStation();
// },
methods: {
deviceChange(code) {
this.$emit('setCenter', code);
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
},
changeConcentrateStation() {},
handleClick() {
this.getConcertrateStation();
},
deviceSelect(selected) {
this.$refs.dataform && this.$refs.dataform.resetFields();
this.$refs.make && this.$refs.make.resetFields();
if (selected && selected._type.toUpperCase() === 'ZcControl'.toUpperCase()) {
//
// this.$refs.make && this.$refs.make.resetFields();
if (selected && selected._type.toUpperCase() === 'CheckBox'.toUpperCase()) {
this.activeName = 'first';
this.seclectDeviceList.forEach(item => {
if (item._type == 'Section' && (item.type == '01' || item.type == '04') && !this.editModel.managedSectionList.includes(selected.code)) {
this.editModel.managedSectionList.push(item.code);
}
});
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
if (selected._type == 'Section' && (selected.type == '01' || selected.type == '04') && !this.editModel.managedSectionList.includes(selected.code)) {
this.editModel.managedSectionList.push(selected.code);
}
} else if (selected && selected._type.toUpperCase() === 'ZcControl'.toUpperCase()) {
this.$refs.dataform && this.$refs.dataform.resetFields();
this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected);
this.getConcertrateStation();
}
},
getConcertrateStation() {
//
const beConcentrateStation = {};
this.zcList.forEach(data=>{
data.concentrateStationList.forEach(concentrate=>{
beConcentrateStation[concentrate] = data.code;
});
});
this.concertrateStation = this.stationList.filter(station=>{
// if (this.activeName == 'first') {
// return station.centralized && !( beConcentrateStation[station.code] && (beConcentrateStation[station.code] != this.editModel.code));
return station.centralized;
// } else {
// return station.centralized && !( beConcentrateStation[station.code]);
// }
});
clear() {
this.editModel.managedSectionList = [];
},
create() {
const uid = getUID('ZcControl', this.zcList);
let models = [];
const models = [];
const model = {
_type: 'ZcControl',
code: uid,
@ -195,16 +192,11 @@ export default {
position: {
x: this.addModel.position.x,
y: this.addModel.position.y
},
concentrateStationList:this.addModel.concentrateStationList
}
};
models.push(model);
model.concentrateStationList.forEach(stationCode=>{
const arr = this.setStationStand(stationCode, model.code);
models = [...models, ...arr];
});
this.$emit('updateMapModel', models);
this.getConcertrateStation();
this.$refs.createForm.resetForm();
},
//
@ -212,11 +204,7 @@ export default {
this.$refs['dataform'].validate((valid) => {
if (valid) {
const data = Object.assign({_type: 'ZcControl'}, this.editModel);
let models = [data];
data.concentrateStationList.forEach(stationCode=>{
const arr = this.setStationStand(stationCode, data.code);
models = [...models, ...arr];
});
const models = [data];
this.$emit('updateMapModel', models);
this.$emit('deviceSelect', '');
}
@ -231,16 +219,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
this.concertrateStation.forEach(station=>{
selected.concentrateStationList.forEach(stationCode=>{
switch (stationCode) {
case station.code: {
this.setStationStand(station.code, '');
break;
}
}
});
});
this.$emit('updateMapModel', {...selected, _dispose: true});
this.$refs.dataform && this.$refs.dataform.resetFields();
}).catch(() => {
@ -248,19 +226,18 @@ export default {
});
}
},
// ZC
setStationStand(stationCode, code) {
const arr = [];
this.stationList.forEach(elem=>{
if (elem.code == stationCode) {
const station = deepAssign({}, elem);
// const station = Object.assign({}, elem);
station.zcCode = code;
arr.push(station);
// this.$emit('updateMapModel', station);
}
});
return arr; // list
getName(code) {
const section = this.$store.getters['map/getDeviceByCode'](code);
return section.name || '';
},
mouseenter(code) {
},
mouseleave(code) {
},
hover(field) {
this.field = field === this.field ? '' : field;
}
// changeConcertrateStation(data) {
// if (data.length > 0) {
@ -300,3 +277,31 @@ export default {
color: #3E44BE;
}
</style>
<style lang="scss">
.view-control-content .list-box .list-content{
margin-left:10px;
margin-top:10px;
margin-right:10px;
padding:5px;
}
.view-control-content .list-box .each-content{
background: #e2e2e2;
margin: 5px;
border-radius: 5px;
height: 30px;
line-height: 30px;
padding-left: 10px;
padding-right: 7px;
display: inline-block;
cursor: pointer;
font-size: 14px;
}
.view-control-content .list-box .each-content .name{
display: inline-block;
}
.view-control-content .list-box .each-content .close{
display: inline-block;
cursor: pointer;
}
</style>