地图绘制代码调整

This commit is contained in:
joylink_cuiweidong 2020-08-11 13:13:38 +08:00
parent 15ecca61a7
commit b0f238c655
3 changed files with 46 additions and 67 deletions

View File

@ -47,6 +47,9 @@ export default {
this.$refs['dataform'].validate((valid) => {
if (valid) {
const data = Object.assign({_type: this.type}, this.editModel);
if (this.type == 'Text') {
data.content = `${this.editModel.prepend}::${this.editModel.content}`;
}
this.$emit('updateMapModel', data);
} else {
this.$message('还有属性未填写,修改未生效!');
@ -68,7 +71,7 @@ export default {
this.$store.dispatch('map/delMapStandData', {models: [selected], type: 'espList'});
break;
}
case 'StationStand': {
case 'StationStand': case 'TrainWindow': {
this.$emit('updateMapModel', selected);
break;
}

View File

@ -1,15 +1,14 @@
<template>
<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="form" :form="form" :form-model="editModel" :rules="rules" />
</div>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button>
<el-button type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
</el-button-group>
</div>
<operate-property
ref="dataform"
:form="form"
:edit-model="editModel"
:rules="rules"
type="Text"
@updateMapModel="updateMapModel"
/>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
<create-operate
@ -28,14 +27,14 @@ import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid';
import ConfigList from './config/list';
import OperateProperty from './components/operateProperty';
import CreateOperate from './components/createOperate';
import { deepAssign } from '@/utils/index';
export default {
name: 'StationStandDraft',
components: {
ConfigList,
OperateProperty,
CreateOperate
},
props: {
@ -186,31 +185,15 @@ export default {
this.$refs.createForm.resetForm();
this.$emit('updateMapModel', model);
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs['form'].validate((valid) => {
if (valid) {
const data = Object.assign({_type: 'Text'}, this.editModel);
data.content = `${this.editModel.prepend}::${this.editModel.content}`;
this.$emit('updateMapModel', data);
}
});
this.$refs.dataform.edit();
},
//
deleteObj() {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
if (selected && selected._type.toUpperCase() === 'Text'.toUpperCase()) {
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
this.$emit('updateMapModel', {...selected, _dispose: true});
this.$refs.form && this.$refs.form.resetFields();
}).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete'));
});
}
updateMapModel(data) {
this.$emit('updateMapModel', data);
}
}
};

View File

@ -1,7 +1,7 @@
<template>
<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">
<!-- <div class="view-control-content">
<config-list ref="form" :form="form" :form-model="editModel" :rules="rules" />
</div>
<div class="button_box">
@ -9,7 +9,15 @@
<el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button>
<el-button type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
</el-button-group>
</div>
</div> -->
<operate-property
ref="dataform"
:form="form"
:edit-model="editModel"
:rules="rules"
type="TrainWindow"
@updateMapModel="updateMapModel"
/>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.batchOperation')" name="second" :lazy="lazy">
<div style="height: 100%; padding: 10px; box-sizing: border-box;overflow:auto;">
@ -64,13 +72,13 @@
import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid';
import JTriangle from '@/jmapNew/utils/JTriangle';
import ConfigList from './config/list';
import OperateProperty from './components/operateProperty';
import { deepAssign } from '@/utils/index';
export default {
name: 'TrainWindowDraft',
components: {
ConfigList
OperateProperty
},
props: {
selected: {
@ -326,39 +334,24 @@ export default {
this.$emit('updateMapModel', models);
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs['form'].validate((valid) => {
if (valid) {
const data = Object.assign({_type: 'TrainWindow'}, this.editModel);
this.$emit('updateMapModel', data);
this.$refs.dataform.edit();
},
updateMapModel(selected) {
const models = [];
this.sectionList.forEach(elem => {
if (elem.trainWindowCode == selected.code) {
const section = deepAssign({}, elem);
section.trainWindowCode = '';
models.push(section);
}
});
},
//
deleteObj() {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
if (selected && selected._type.toUpperCase() === 'TrainWindow'.toUpperCase()) {
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
const models = [];
this.sectionList.forEach(elem => {
if (elem.trainWindowCode == selected.code) {
const section = deepAssign({}, elem);
section.trainWindowCode = '';
models.push(section);
}
});
models.push(deepAssign(selected, { _dispose: true }));
this.$emit('updateMapModel', models);
this.$refs.form && this.$refs.form.resetFields();
}).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete'));
});
}
models.push(deepAssign(selected, { _dispose: true }));
this.$emit('updateMapModel', models);
},
editTrainWindow() {
this.$refs['addForm'].validate((valid) => {