This commit is contained in:
fan 2020-08-11 14:34:27 +08:00
commit 6f4b6f0c3a
19 changed files with 185 additions and 155 deletions

View File

@ -338,6 +338,7 @@ export default {
case 'Delete': this.$store.dispatch('map/setDeleteCount');
break;
case 'Update':
debugger;
this.$refs.offsetX.focus();
this.$store.dispatch('map/setUpdateCount');
break;

View File

@ -194,6 +194,10 @@ export default {
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
}
}
};

View File

@ -79,10 +79,6 @@ export default {
const form = {
labelWidth: '120px',
items: {
code: {
name: '',
item: []
},
draw: {
name: this.$t('map.drawData'),
item: [
@ -127,11 +123,6 @@ export default {
return form;
}
},
watch: {
'$store.state.map.deleteCount': function (val) {
this.deleteObj();
}
},
methods: {
deviceChange(code) {
this.$emit('setCenter', code);
@ -158,6 +149,10 @@ export default {
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
}
}
};

View File

@ -36,12 +36,20 @@ export default {
required:true
}
},
data() {
return {
isDeleteHide:true
};
},
methods:{
//
edit() {
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('还有属性未填写,修改未生效!');
@ -51,16 +59,32 @@ export default {
//
deleteObj() {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
if (selected) {
if (selected && this.isDeleteHide) {
this.isDeleteHide = false;
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
switch (this.type) {
case 'Esp': {
this.$store.dispatch('map/delMapStandData', {models: [selected], type: 'espList'});
break;
}
case 'StationStand': case 'TrainWindow': {
this.$emit('updateMapModel', selected, true);
break;
}
default : {
this.$emit('updateMapModel', {...selected, _dispose: true});
break;
}
}
this.$refs.dataform && this.$refs.dataform.resetFields();
this.isDeleteHide = true;
}).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete'));
this.isDeleteHide = true;
});
}
},

View File

@ -471,6 +471,10 @@ export default {
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
}
}
};

View File

@ -191,6 +191,10 @@ export default {
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
}
}
};

View File

@ -186,6 +186,10 @@ export default {
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
}
}
};

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="dataform" :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="Esp"
@updateMapModel="updateMapModel"
/>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
<div class="view-control-content">
@ -22,13 +30,13 @@
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid';
import ConfigList from './config/list';
import OperateProperty from './components/operateProperty';
import { deepAssign } from '@/utils/index';
export default {
name: 'EspDraft',
components: {
ConfigList
OperateProperty
},
props: {
selected: {
@ -103,17 +111,12 @@ export default {
return rules;
}
},
watch: {
'$store.state.map.deleteCount': function (val) {
this.deleteObj();
}
},
mounted() {
},
methods: {
deviceChange(code) {
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
this.edit();
// this.edit();
},
hover(field) {
this.field = field === this.field ? '' : field;
@ -163,36 +166,20 @@ export default {
this.display = false;
this.$message('创建完成');
this.$store.dispatch('map/updateMapStandData', {models: arr, type: 'espList'});
this.deviceSelect();
// this.deviceSelect();
} else {
this.$message('暂无新车站或车站已有对应紧急停车按钮!');
}
},
updateMapModel(data) {
this.$emit('updateMapModel', data);
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.validate((valid) => {
if (valid) {
const data = Object.assign({_type: 'Esp'}, this.editModel);
this.$emit('updateMapModel', data);
}
});
},
//
deleteObj() {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
if (selected && selected._type.toUpperCase() === 'Esp'.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.$store.dispatch('map/delMapStandData', {models: [selected], type: 'espList'});
this.deviceSelect();
this.$refs.dataform && this.$refs.dataform.resetFields();
}).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete'));
});
}
this.$refs.dataform.edit();
}
}
};

View File

@ -169,6 +169,10 @@ export default {
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
}
}
};

View File

@ -198,6 +198,10 @@ export default {
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
}
}
};

View File

@ -179,6 +179,10 @@ export default {
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
}
}
};

View File

@ -191,6 +191,10 @@ export default {
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
}
}
};

View File

@ -250,6 +250,10 @@ export default {
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
}
}
};

View File

@ -605,6 +605,10 @@ export default {
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
}
}
};

View File

@ -166,6 +166,10 @@ export default {
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
}
}

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="dataform" :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="StationStand"
@updateMapModel="updateMapModel"
/>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
<create-operate
@ -42,7 +41,7 @@
import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid';
import CreateOperate from './components/createOperate';
import ConfigList from './config/list';
import OperateProperty from './components/operateProperty';
import { deepAssign } from '@/utils/index';
import getModel from './models.js';
@ -50,7 +49,7 @@ export default {
name: 'StationStandDraft',
components: {
CreateOperate,
ConfigList
OperateProperty
},
props: {
selected: {
@ -401,24 +400,10 @@ export default {
});
return beCentralizedStation[stationCode] || '';
},
//
edit() {
this.$refs.dataform.validate((valid) => {
if (valid) {
const data = Object.assign({_type: 'StationStand'}, this.editModel);
this.$emit('updateMapModel', data);
}
});
},
//
deleteObj() {
const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
if (selected && selected._type.toUpperCase() === 'StationStand'.toUpperCase()) {
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
updateMapModel(selected, isSpecialTreat) {
//
if (isSpecialTreat) {
//
const models = [];
models.push(deepAssign(selected, { _dispose: true }));
this.espList.forEach(item => {
@ -432,11 +417,18 @@ export default {
}
});
this.$emit('updateMapModel', models);
this.$refs.dataform && this.$refs.dataform.resetFields();
}).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete'));
});
} else {
//
this.$emit('updateMapModel', selected);
}
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
},
//
batchSettings() {

View File

@ -121,6 +121,10 @@ export default {
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
//
edit() {
this.$refs.dataform.edit();
}
}
};

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,24 +334,17 @@ 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();
},
//
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(() => {
updateMapModel(selected, isSpecialTreat) {
//
if (isSpecialTreat) {
//
const models = [];
this.sectionList.forEach(elem => {
if (elem.trainWindowCode == selected.code) {
@ -354,10 +355,9 @@ export default {
});
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'));
});
} else {
//
this.$emit('updateMapModel', selected);
}
},
editTrainWindow() {