# Conflicts:
#	src/views/newMap/newMapdraft/mapoperate/station.vue
This commit is contained in:
joylink_cuiweidong 2019-12-17 16:24:24 +08:00
commit cd549d57fc
8 changed files with 91 additions and 73 deletions

View File

@ -75,7 +75,7 @@ class SkinCode extends defaultStyle {
textVerticalAlign: 'middle' // 文字垂直对齐方式 textVerticalAlign: 'middle' // 文字垂直对齐方式
}, },
destinationText: { destinationText: {
show: true, // 目的码名称显示 show: false, // 目的码名称显示
opposite: true, // 对称相反 opposite: true, // 对称相反
position: 0, // 区段名称位置 1 上面 -1 下面 0 对称 position: 0, // 区段名称位置 1 上面 -1 下面 0 对称
distance: 12, // 文字离区段距离 distance: 12, // 文字离区段距离

View File

@ -199,16 +199,17 @@
<el-form-item :label="$t('map.hostileApproachData') + ':'" prop="conflictingRouteList"> <el-form-item :label="$t('map.hostileApproachData') + ':'" prop="conflictingRouteList">
<el-select v-model="addModel.conflictingRouteList" multiple clearable :filterable="true"> <el-select v-model="addModel.conflictingRouteList" multiple clearable :filterable="true">
<el-option <el-option
v-for="item in sectionList" v-for="item in routeList"
:key="item.code" :key="item.code"
:label="item.name + ' (' + item.code+ ')'" :label="item.name"
:value="item.code" :value="item.code"
/> />
</el-select> </el-select>
<el-button <!-- <el-button type="primary" @click="selectedConflictingRouteList">选择</el-button> -->
<!-- <el-button
:type=" field === 'conflictingRouteList' ? 'danger' : 'primary'" :type=" field === 'conflictingRouteList' ? 'danger' : 'primary'"
@click="hover('conflictingRouteList')" @click="hover('conflictingRouteList')"
>{{ $t('map.activate') }}</el-button> >{{ $t('map.activate') }}</el-button> -->
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button-group> <el-button-group>
@ -219,19 +220,22 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-scrollbar> </el-scrollbar>
<protect-detail ref="routeDetail" :map-info="mapInfo" @setOverlapCode="setOverlapCode" /> <protect-detail ref="protectDetail" :map-info="mapInfo" @setOverlapCode="setOverlapCode" />
<route-detail ref="routeDetail" :map-info="mapInfo" @setRouteCode="setRouteCode" />
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid'; import { getUID } from '@/jmap/utils/Uid';
import { postRouteNew, putRouteNew, getContinueProtectList } from '@/api/jmap/mapdraft'; import { postRouteNew, putRouteNew, getContinueProtectList, getRouteNewList } from '@/api/jmap/mapdraft';
import ProtectDetail from '../protectoperate/detail'; import ProtectDetail from '../protectoperate/detail';
import RouteDetail from './detail';
export default { export default {
name: 'RouteOperation', name: 'RouteOperation',
components: { components: {
ProtectDetail ProtectDetail,
RouteDetail
}, },
props: { props: {
selected: { selected: {
@ -262,7 +266,7 @@ export default {
routeCode: '', routeCode: '',
routeType: '', routeType: '',
loading: false, loading: false,
interBlockStationList:[], // interBlockStationList:[],
SwitchLocateTypeList: [ SwitchLocateTypeList: [
{ name: '定位', code: true }, { name: '定位', code: true },
{ name: '反位', code: false } { name: '反位', code: false }
@ -288,7 +292,8 @@ export default {
overlapCode:'', overlapCode:'',
conflictingRouteList: [] // conflictingRouteList: [] //
}, },
overlapName: '' overlapName: '',
routeList: [] //
}; };
}, },
computed: { computed: {
@ -337,6 +342,11 @@ export default {
] ]
}; };
return baseRules; return baseRules;
},
interBlockStationList() { //
return this.stationList.filter(station=>{
return station.isCIStation;
});
} }
}, },
watch: { watch: {
@ -366,11 +376,13 @@ export default {
// this.$Dictionary.normal().then(list => { // this.$Dictionary.normal().then(list => {
// this.SwitchLocateTypeList = list; // this.SwitchLocateTypeList = list;
// }); // });
this.interBlockStationList = this.stationList.filter(station=>{ this.getRouteList();
return station.isCIStation;
});
}, },
methods: { methods: {
async getRouteList() {
const response = await getRouteNewList(this.$route.params.mapId, { pageSize: 9999, pageNum: 1 });
this.routeList = response.data.list;
},
swictchName(code) { swictchName(code) {
let name = ''; let name = '';
if (code) { if (code) {
@ -389,7 +401,7 @@ export default {
this.overlapName = data.name; this.overlapName = data.name;
}, },
selectedOverlapCode() { selectedOverlapCode() {
this.$refs.routeDetail.doShow('select'); this.$refs.protectDetail.doShow('select');
}, },
hover(field) { hover(field) {
this.field = field === this.field ? '' : field; this.field = field === this.field ? '' : field;
@ -418,6 +430,7 @@ export default {
postRouteNew(this.buildModel(getUID('Route'))).then(response => { postRouteNew(this.buildModel(getUID('Route'))).then(response => {
this.$message.success('创建成功'); this.$message.success('创建成功');
this.loading = false; this.loading = false;
this.routeList.push(this.buildModel(getUID('Route')));
this.clear(); this.clear();
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('tip.operationAbnormal')); this.$messageBox(this.$t('tip.operationAbnormal'));
@ -434,6 +447,7 @@ export default {
this.$message.success(this.$t('map.updateSuccessfully')); this.$message.success(this.$t('map.updateSuccessfully'));
this.loading = false; this.loading = false;
this.clear(); this.clear();
this.getRouteList();
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('tip.operationAbnormal')); this.$messageBox(this.$t('tip.operationAbnormal'));
this.loading = false; this.loading = false;
@ -450,24 +464,35 @@ export default {
this.addModel.routeFlankProtectionList = []; this.addModel.routeFlankProtectionList = [];
this.overlapName = ''; this.overlapName = '';
this.addModel.overlapCode = ''; this.addModel.overlapCode = '';
if (this.selected && this.selected._type.toUpperCase() === 'Station'.toUpperCase()) { // if (this.selected && this.selected._type.toUpperCase() === 'Station'.toUpperCase()) {
this.addModel.stationCode = this.selected.code; // this.addModel.stationCode = this.selected.code;
} // }
this.isSave = true; this.isSave = true;
} }
}, },
selectedConflictingRouteList() {
this.$refs.routeDetail.doShow('select');
},
setRouteCode(data) {
console.log(data);
if (this.addModel.conflictingRouteList.indexOf(data.code) === -1) {
this.addModel.conflictingRouteList.push(data.code);
}
},
setSelected(selected) { setSelected(selected) {
if (selected) { if (selected) {
if (selected._type.toUpperCase() === 'Station'.toUpperCase()) { // if (selected._type.toUpperCase() === 'Station'.toUpperCase()) {
this.addModel.stationCode = selected.code; // this.addModel.stationCode = selected.code;
} else if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'startSignalCode'.toUpperCase()) { // } else
// else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'conflictingRouteList'.toUpperCase()) {
// if (this.addModel.conflictingRouteList.indexOf(selected.code) === -1) {
// this.addModel.conflictingRouteList.push(selected.code);
// }
// }
if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'startSignalCode'.toUpperCase()) {
this.addModel.startSignalCode = selected.code; this.addModel.startSignalCode = selected.code;
} else if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'endSignalCode'.toUpperCase()) { } else if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'endSignalCode'.toUpperCase()) {
this.addModel.endSignalCode = selected.code; this.addModel.endSignalCode = selected.code;
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'conflictingRouteList'.toUpperCase()) {
if (this.addModel.conflictingRouteList.indexOf(selected.code) === -1) {
this.addModel.conflictingRouteList.push(selected.code);
}
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'routeSectionList'.toUpperCase()) { } else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'routeSectionList'.toUpperCase()) {
if (this.addModel.routeSectionList.indexOf(selected.code) === -1) { if (this.addModel.routeSectionList.indexOf(selected.code) === -1) {
this.addModel.routeSectionList.push(selected.code); this.addModel.routeSectionList.push(selected.code);

View File

@ -180,8 +180,8 @@ export default {
edit() { edit() {
this.$refs.dataform.validate((valid) => { this.$refs.dataform.validate((valid) => {
if (valid) { if (valid) {
// const data = Object.assign({_type: 'Esp'}, this.editModel); const data = Object.assign({_type: 'Esp'}, this.editModel);
// console.log(data); this.$emit('updateMapModel', data);
} }
}); });
}, },

View File

@ -77,11 +77,14 @@ export default {
const sectionPoints = [...this.editModel.points]; // const sectionPoints = [...this.editModel.points]; //
let allNotZeros = true; let allNotZeros = true;
let count = 0; let count = 0;
let lineLength = 0;
this.tableData.forEach((ele, index) => { this.tableData.forEach((ele, index) => {
models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts)]; const triangle = new JTriangle(sectionPoints[index], sectionPoints[index + 1]);
models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts, lineLength)];
allNotZeros = Number(ele.num) && allNotZeros; allNotZeros = Number(ele.num) && allNotZeros;
count += Number(ele.num); count += Number(ele.num);
logicSectionNumList.push(Number(ele.num)); logicSectionNumList.push(Number(ele.num));
lineLength += Math.sqrt(triangle.abspowz);
counts += parseInt(ele.num); counts += parseInt(ele.num);
}); });
if (count === 0 || allNotZeros) { if (count === 0 || allNotZeros) {
@ -105,7 +108,7 @@ export default {
row.num = 0; row.num = 0;
}, },
// //
createLogicalSections(num, beg, end, model, counts) { createLogicalSections(num, beg, end, model, counts, lineLength) {
const models = []; const models = [];
const triangle = new JTriangle(beg, end); const triangle = new JTriangle(beg, end);
const offset = Math.sqrt(triangle.abspowz) / num; const offset = Math.sqrt(triangle.abspowz) / num;
@ -114,14 +117,14 @@ export default {
{ x: beg.x + triangle.getCos(offset * i), y: beg.y + triangle.getSin(offset * i) }, { x: beg.x + triangle.getCos(offset * i), y: beg.y + triangle.getSin(offset * i) },
{ x: beg.x + triangle.getCos(offset * (i + 1)), y: beg.y + triangle.getSin(offset * (i + 1)) } { x: beg.x + triangle.getCos(offset * (i + 1)), y: beg.y + triangle.getSin(offset * (i + 1)) }
]; ];
const param = this.addLogicalSection(model, points, counts + i, offset, i); const param = this.addLogicalSection(model, points, counts + i, offset, i, lineLength);
models.push(param); models.push(param);
this.addList.push(param); this.addList.push(param);
} }
return models; return models;
}, },
// //
addLogicalSection(model, points, index, offset, i) { addLogicalSection(model, points, index, offset, i, lineLength) {
const data = { const data = {
_type: 'Section', _type: 'Section',
code: getUID('T', [...this.sectionList, ...this.addList]), code: getUID('T', [...this.sectionList, ...this.addList]),
@ -168,8 +171,8 @@ export default {
kmRangeRight: model.kmRangeRight, kmRangeRight: model.kmRangeRight,
kmRangeLeft: model.kmRangeLeft, kmRangeLeft: model.kmRangeLeft,
region: model.region, region: model.region,
logicSectionStartOffset:offset * i, logicSectionStartOffset:lineLength + offset * i,
logicSectionEndOffset:offset * (i + 1), logicSectionEndOffset: lineLength + offset * (i + 1),
relevanceSectionList: [] relevanceSectionList: []
}; };
if (this.isDelimiter) { if (this.isDelimiter) {

View File

@ -97,7 +97,7 @@ export default {
editModel: { editModel: {
centralized: false, centralized: false,
// concentrateStationCode: '', // // concentrateStationCode: '', //
isCIStation:false, // isCIStation: false, //
number:'', // number:'', //
code: '', code: '',
zcCode: '', zcCode: '',

View File

@ -45,6 +45,7 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid'; import { getUID } from '@/jmapNew/utils/Uid';
export default { export default {
@ -70,6 +71,9 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters('map', [
'trainList'
]),
rules() { rules() {
return { return {
range: [ range: [

View File

@ -102,7 +102,7 @@ export default {
} }
}, },
create(list) { create(list) {
this.$emit('addOrUpdateMapModel', list); this.$emit('updateMapModel', list);
}, },
// //
edit(elem) { edit(elem) {

View File

@ -118,8 +118,8 @@ export default {
field: '', field: '',
addModel: { addModel: {
pointY: '', pointY: '',
width: '', width: 40,
height: '', height: 15,
modelList: [] modelList: []
}, },
mergeRules: { mergeRules: {
@ -289,6 +289,13 @@ export default {
_dispose: true _dispose: true
}); });
}); });
this.sectionList.forEach(elem => {
if (elem.trainWindowCode) {
const section = deepAssign({}, elem);
section.trainWindowCode = '';
remove.push(section);
}
});
this.$emit('updateMapModel', remove); this.$emit('updateMapModel', remove);
} }
}).catch(() => { }).catch(() => {
@ -298,24 +305,10 @@ export default {
// //
createTrainWindow() { createTrainWindow() {
const models = []; const models = [];
const switchSectionList = []; this.addList = []; // codelist
// const PhysicalSectionList = [];
this.addList = [];
const remove = []; //
if (this.trainWindowList && this.trainWindowList.length) {
this.trainWindowList.forEach(elem => {
remove.push({
_type: 'TrainWindow',
code: elem.code,
_dispose: true
});
});
this.$emit('updateMapModel', remove);
}
if (this.sectionList && this.sectionList.length) { if (this.sectionList && this.sectionList.length) {
this.sectionList.forEach(elem => { this.sectionList.forEach(elem => {
if (elem.type !== '04' && !elem.isSwitchSection && (elem.logicSectionNum.length == 0 || elem.logicSectionNum.length == 1 && elem.logicSectionNum[0] == 0)) { if (elem.type !== '04' && !elem.isSwitchSection && !elem.trainWindowCode && (elem.logicSectionNum.length == 0 || elem.logicSectionNum.length == 1 && elem.logicSectionNum[0] == 0)) {
const triangle = new JTriangle(elem.points[0], elem.points[elem.points.length - 1]); const triangle = new JTriangle(elem.points[0], elem.points[elem.points.length - 1]);
const param = this.createModel({ const param = this.createModel({
triangle: triangle, triangle: triangle,
@ -323,36 +316,19 @@ export default {
}); });
models.push(param); models.push(param);
const section = deepAssign(elem, { trainWindowCode: param.code }); const section = deepAssign(elem, { trainWindowCode: param.code });
// if (section.type == '02') { models.push(section);
// if (!switchSectionList.find(ele => { return ele.code == section.parentCode; })) {
// const sectionParent = deepAssign({}, this.$store.getters['map/getDeviceByCode'](section.parentCode));
// sectionParent['trainWindowCode'] = section.trainWindowCode;
// switchSectionList.push(sectionParent);
// }
// }
switchSectionList.push(section);
this.addList.push(param); this.addList.push(param);
} else if (elem.type === '04') { } else if (elem.type === '04' && !elem.trainWindowCode) {
const param = this.createModel({ const param = this.createModel({
section: elem section: elem
}); });
models.push(param); models.push(param);
const section = deepAssign(elem, { trainWindowCode: param.code }); const section = deepAssign(elem, { trainWindowCode: param.code });
switchSectionList.push(section); models.push(section);
this.addList.push(param); this.addList.push(param);
} }
}); });
} }
switchSectionList.forEach(elem => {
if (elem.type === '04') {
elem.relevanceSectionList.forEach(item => {
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](item));
section['trainWindowCode'] = elem.trainWindowCode;
models.push(section);
});
}
models.push(elem);
});
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
}, },
@ -375,7 +351,17 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
_that.$emit('updateMapModel', {...selected, _dispose: true}); 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 }));
console.log(models);
_that.$emit('updateMapModel', models);
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {
_that.$message.info(this.$t('tip.cancelledDelete')); _that.$message.info(this.$t('tip.cancelledDelete'));