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'); case 'Delete': this.$store.dispatch('map/setDeleteCount');
break; break;
case 'Update': case 'Update':
debugger;
this.$refs.offsetX.focus(); this.$refs.offsetX.focus();
this.$store.dispatch('map/setUpdateCount'); this.$store.dispatch('map/setUpdateCount');
break; break;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<template> <template>
<el-tabs v-model="activeName" class="card"> <el-tabs v-model="activeName" class="card">
<el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy"> <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" /> <config-list ref="dataform" :form="form" :form-model="editModel" :rules="rules" />
</div> </div>
<div class="button_box"> <div class="button_box">
@ -9,7 +9,15 @@
<el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button> <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 type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
</el-button-group> </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>
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy"> <el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
<div class="view-control-content"> <div class="view-control-content">
@ -22,13 +30,13 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid'; import { getUID } from '@/jmapNew/utils/Uid';
import ConfigList from './config/list'; import OperateProperty from './components/operateProperty';
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
export default { export default {
name: 'EspDraft', name: 'EspDraft',
components: { components: {
ConfigList OperateProperty
}, },
props: { props: {
selected: { selected: {
@ -103,17 +111,12 @@ export default {
return rules; return rules;
} }
}, },
watch: {
'$store.state.map.deleteCount': function (val) {
this.deleteObj();
}
},
mounted() { mounted() {
}, },
methods: { methods: {
deviceChange(code) { deviceChange(code) {
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code)); this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
this.edit(); // this.edit();
}, },
hover(field) { hover(field) {
this.field = field === this.field ? '' : field; this.field = field === this.field ? '' : field;
@ -163,36 +166,20 @@ export default {
this.display = false; this.display = false;
this.$message('创建完成'); this.$message('创建完成');
this.$store.dispatch('map/updateMapStandData', {models: arr, type: 'espList'}); this.$store.dispatch('map/updateMapStandData', {models: arr, type: 'espList'});
this.deviceSelect(); // this.deviceSelect();
} else { } else {
this.$message('暂无新车站或车站已有对应紧急停车按钮!'); this.$message('暂无新车站或车站已有对应紧急停车按钮!');
} }
}, },
updateMapModel(data) {
this.$emit('updateMapModel', data);
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
// //
edit() { edit() {
this.$refs.dataform.validate((valid) => { this.$refs.dataform.edit();
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'));
});
}
} }
} }
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,15 +1,14 @@
<template> <template>
<el-tabs v-model="activeName" class="card"> <el-tabs v-model="activeName" class="card">
<el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy"> <el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy">
<div class="view-control-content"> <operate-property
<config-list ref="dataform" :form="form" :form-model="editModel" :rules="rules" /> ref="dataform"
</div> :form="form"
<div class="button_box"> :edit-model="editModel"
<el-button-group class="map-draft-group"> :rules="rules"
<el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button> type="StationStand"
<el-button type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button> @updateMapModel="updateMapModel"
</el-button-group> />
</div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy"> <el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
<create-operate <create-operate
@ -42,7 +41,7 @@
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid'; import { getUID } from '@/jmapNew/utils/Uid';
import CreateOperate from './components/createOperate'; import CreateOperate from './components/createOperate';
import ConfigList from './config/list'; import OperateProperty from './components/operateProperty';
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
import getModel from './models.js'; import getModel from './models.js';
@ -50,7 +49,7 @@ export default {
name: 'StationStandDraft', name: 'StationStandDraft',
components: { components: {
CreateOperate, CreateOperate,
ConfigList OperateProperty
}, },
props: { props: {
selected: { selected: {
@ -401,42 +400,35 @@ export default {
}); });
return beCentralizedStation[stationCode] || ''; return beCentralizedStation[stationCode] || '';
}, },
updateMapModel(selected, isSpecialTreat) {
//
if (isSpecialTreat) {
//
const models = [];
models.push(deepAssign(selected, { _dispose: true }));
this.espList.forEach(item => {
if (item.standCode == selected.code) {
models.push(deepAssign(item, { _dispose: true }));
}
});
this.psdList.forEach(item => {
if (item.standCode == selected.code) {
models.push(deepAssign(item, { _dispose: true }));
}
});
this.$emit('updateMapModel', models);
} else {
//
this.$emit('updateMapModel', selected);
}
},
deleteObj() {
this.$refs.dataform.deleteObj();
},
// //
edit() { edit() {
this.$refs.dataform.validate((valid) => { this.$refs.dataform.edit();
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(() => {
const models = [];
models.push(deepAssign(selected, { _dispose: true }));
this.espList.forEach(item => {
if (item.standCode == selected.code) {
models.push(deepAssign(item, { _dispose: true }));
}
});
this.psdList.forEach(item => {
if (item.standCode == selected.code) {
models.push(deepAssign(item, { _dispose: true }));
}
});
this.$emit('updateMapModel', models);
this.$refs.dataform && this.$refs.dataform.resetFields();
}).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete'));
});
}
}, },
// //
batchSettings() { batchSettings() {

View File

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

View File

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

View File

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