This commit is contained in:
zyy 2019-12-20 10:54:35 +08:00
commit 4f5fe2c9bb
3 changed files with 156 additions and 146 deletions

View File

@ -121,7 +121,8 @@ export default {
buttons: [
{
name: this.$t('map.preview'),
handleClick: this.overlapSwitchDetail
handleClick: this.overlapSwitchDetail,
showControl: (row) => { return row.overlapCode; }
}
]
},
@ -245,7 +246,6 @@ export default {
this.$Dictionary.switchLocateType().then(list => {
this.SwitchLocateTypeList = list;
});
this.getProtectList();
this.acquireMapList();
},
methods: {
@ -284,7 +284,6 @@ export default {
that.$convertSpecifiedField(elem, that.signalList, 'code', 'uniqueName', ['startSignalCode', 'endSignalCode']);
that.$convertSpecifiedField(elem, that.stationList, 'code', 'name', ['stationCode']);
that.$convertSpecifiedField(elem, that.sectionList, 'code', 'name', ['nearSectionCode', 'autoTriggerSectionCode', 'turnBackSectionCode']);
that.$convertSpecifiedField(elem, that.ContinueProtectList, 'code', 'name', ['overlapCode']);
});
}
}
@ -469,12 +468,6 @@ export default {
selectedObj(index, row) {
this.$emit('setRouteCode', row, this.codeType);
this.show = false;
},
// list
getProtectList() {
getContinueProtectList(this.$route.params.mapId, {pageSize:9999, pageNum:1}).then((resp) => {
this.ContinueProtectList = resp.data.list;
});
}
}
};

View File

@ -1,10 +1,62 @@
<template>
<div style="height: 100%;">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="form" :model="addModel" :rules="rules" label-width="190px" size="mini">
<div class="definition">
<el-form-item label="延续保护解锁区段:" prop="unlockSectionCode">
<el-select v-model="addModel.unlockSectionCode">
<div style="height: 100%; border: 1px solid #EBEEF5; position: relative; left: 8%; width: 88%">
<el-form ref="form" :model="addModel" :rules="rules" label-width="150px" size="mini" style="margin-top: 10px">
<div class="definition">
<el-form-item label="延续保护解锁区段:" prop="unlockSectionCode">
<el-select v-model="addModel.unlockSectionCode" clearable>
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'unlockSectionCode' ? 'danger' : 'primary'"
@click="hover('unlockSectionCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="延续保护解锁时间(s):" prop="unlockTime">
<el-input-number v-model="addModel.unlockTime" :min="0" />
</el-form-item>
<el-form-item label="延续保护线路:" prop="relSectionSwitchList">
<el-table :data="addModel.relSectionSwitchList" border style="width: 80%">
<el-table-column type="index" label="序号" width="100" />
<el-table-column fixed="right" :label="$t('map.operation')">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.prevent="deleteOverlab(addModel.relSectionSwitchList, scope.$index)"
>
移出
</el-button>
<el-button
type="text"
size="small"
@click.native.prevent="editOverlab(addModel.relSectionSwitchList, scope.$index)"
>
编辑
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
</div>
</el-form>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span style="font-size: 14px;">{{ cardTitle }}</span>
<el-button v-if="cardMode === 'generate'" style="float: right; padding: 3px 0" type="text" @click="generateOverlab">生成</el-button>
<el-button-group v-else-if=" cardMode === 'edit'" style="float: right;">
<el-button type="text" style="padding:3px 3px" @click="updateOverlab">修改</el-button>
<el-button type="text" style="padding:3px 0" @click="cancelOverlab">取消</el-button>
</el-button-group>
</div>
<div>
<el-form ref="overlabForm" :model="addOverlapModel" :rules="overLapRules" label-width="135px" size="mini" style="margin-top: 15px">
<el-form-item :label="$t('map.routeProtectsData') + ':'" prop="routeOverlapSectionList">
<el-select v-model="addOverlapModel.routeOverlapSectionList" multiple clearable :filterable="true">
<el-option
v-for="item in sectionList"
:key="item.code"
@ -13,119 +65,65 @@
/>
</el-select>
<el-button
:type=" field === 'unlockSectionCode' ? 'danger' : 'primary'"
@click="hover('unlockSectionCode')"
:type=" field === 'routeOverlapSectionList' ? 'danger' : 'primary'"
@click="hover('routeOverlapSectionList')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="延续保护解锁时间(s):" prop="unlockTime">
<el-input-number v-model="addModel.unlockTime" :min="0" />
</el-form-item>
<el-form-item label="延续保护线路:" prop="relSectionSwitchList">
<el-table :data="addModel.relSectionSwitchList" border style="width: 80%">
<el-table-column type="index" label="序号" width="100" />
<el-table-column fixed="right" :label="$t('map.operation')">
<el-form-item :label="$t('map.continueProtectSwitchData') + ':'" prop="routeOverlapSwitchList">
<el-select v-model="overlapCode" clearable :filterable="true" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in switchList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'routeOverlapSwitchList' ? 'danger' : 'primary'"
@click="hover('routeOverlapSwitchList')"
>{{ $t('map.activate') }}</el-button>
<el-button
type="primary"
@click="pushSwitch(addOverlapModel.routeOverlapSwitchList, {switchCode: overlapCode, normal: overlapType, switchType: overlapType ? '定位' : '反位'})"
>{{ $t('map.add') }}
</el-button>
<el-select v-model="overlapType" :filterable="true" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in SwitchLocateTypeList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
<el-table :data="addOverlapModel.routeOverlapSwitchList" border style="width: 97%">
<el-table-column prop="switchCode" :label="$t('map.switchId')" width="100">
<template slot-scope="scope">
<span>{{ swictchName(scope.row.switchCode) }}</span>
</template>
</el-table-column>
<el-table-column prop="switchType" :label="$t('map.switchType')" />
<el-table-column fixed="right" :label="$t('map.operation')" width="50">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.prevent="deleteOverlab(addModel.relSectionSwitchList, scope.$index)"
@click.native.prevent="deleteSwitch(addOverlapModel.routeOverlapSwitchList, scope.$index)"
>
移出
</el-button>
<el-button
type="text"
size="small"
@click.native.prevent="editOverlab(addModel.relSectionSwitchList, scope.$index)"
>
编辑
{{ $t('map.remove') }}
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
</div>
</el-form>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span style="font-size: 14px;">{{ cardTitle }}</span>
<el-button v-if="cardMode === 'generate'" style="float: right; padding: 3px 0" type="text" @click="generateOverlab">生成</el-button>
<el-button-group v-else-if=" cardMode === 'edit'" style="float: right;">
<el-button type="text" style="padding:3px 3px" @click="updateOverlab">修改</el-button>
<el-button type="text" style="padding:3px 0" @click="cancelOverlab">取消</el-button>
</el-button-group>
</div>
<div>
<el-form ref="overlabForm" :model="addOverlapModel" :rules="overLapRules" label-width="135px" size="mini" style="margin-top: 15px">
<el-form-item :label="$t('map.routeProtectsData') + ':'" prop="routeOverlapSectionList">
<el-select v-model="addOverlapModel.routeOverlapSectionList" multiple clearable :filterable="true">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'routeOverlapSectionList' ? 'danger' : 'primary'"
@click="hover('routeOverlapSectionList')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item :label="$t('map.continueProtectSwitchData') + ':'" prop="routeOverlapSwitchList">
<el-select v-model="overlapCode" clearable :filterable="true" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in switchList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'routeOverlapSwitchList' ? 'danger' : 'primary'"
@click="hover('routeOverlapSwitchList')"
>{{ $t('map.activate') }}</el-button>
<el-button
type="primary"
@click="pushSwitch(addOverlapModel.routeOverlapSwitchList, {switchCode: overlapCode, normal: overlapType, switchType: overlapType ? '定位' : '反位'})"
>{{ $t('map.add') }}
</el-button>
<el-select v-model="overlapType" :filterable="true" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in SwitchLocateTypeList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
<el-table :data="addOverlapModel.routeOverlapSwitchList" border style="width: 97%">
<el-table-column prop="switchCode" :label="$t('map.switchId')" width="100">
<template slot-scope="scope">
<span>{{ swictchName(scope.row.switchCode) }}</span>
</template>
</el-table-column>
<el-table-column prop="switchType" :label="$t('map.switchType')" />
<el-table-column fixed="right" :label="$t('map.operation')" width="50">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.prevent="deleteSwitch(addOverlapModel.routeOverlapSwitchList, scope.$index)"
>
{{ $t('map.remove') }}
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-form>
</div>
</el-card>
</el-scrollbar>
</el-form>
</div>
</el-card>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import { postContinueProtect, putContinueProtect } from '@/api/jmap/mapdraft';
import { postContinueProtect, putContinueProtect, delContinueProtect } from '@/api/jmap/mapdraft';
import { ViewMode } from '@/scripts/ConstDic';
import { deepAssign } from '@/utils/index';
@ -179,17 +177,6 @@ export default {
editShow: false,
overLapRules: {
},
rules: {
unlockSectionCode: [
{ required: true, message: '请选择解锁区段', trigger:'change'}
],
unlockTime: [
{ required: true, message: '请输入解锁时间', trigger:'blur'}
],
relSectionSwitchList: [
{ required: true, message: '请生成延续保护线路', trigger: 'change'}
]
},
cardMode: 'generate'
};
@ -218,6 +205,11 @@ export default {
protectData(val, old) {
if (val) {
this.addModel = val;
this.addModel.relSectionSwitchList && this.addModel.relSectionSwitchList.forEach(item => {
item.routeOverlapSwitchList.length && item.routeOverlapSwitchList.forEach( ele => {
ele.switchType = ele.normal ? '定位' : '反位';
});
});
this.editShow = true;
}
}
@ -228,6 +220,9 @@ export default {
methods: {
hover(field) {
this.field = field === this.field ? '' : field;
if (this.field) {
this.$emit('clearHover');
}
},
pushSwitch(list, data) {
const index = list.findIndex(elem => { return elem.switchCode == data.switchCode; });
@ -270,28 +265,45 @@ export default {
return model;
},
save() {
this.$refs.form.validate((valid) => {
if (valid) {
const model = this.buildModel(getUID('Protect'));
postContinueProtect(model).then(resp => {
this.$emit('saveProtectSuccess', model.code);
}).catch(() => {
this.$messageBox('创建延续保护失败!');
});
}
});
this.createProtect('saveProtectSuccess');
},
update() {
this.$refs.form.validate((valid) => {
if (valid) {
const model = this.buildModel();
putContinueProtect(model).then(resp => {
this.$emit('updateProtectSuccess', model.code);
}).catch(() => {
this.$messageBox('更新延续保护失败!');
});
if (this.addModel.code && this.addModel.unlockSectionCode && this.addModel.relSectionSwitchList.length) {
const model = this.buildModel();
putContinueProtect(model).then(resp => {
this.$emit('updateProtectSuccess', model.code);
}).catch(() => {
this.$messageBox('更新延续保护失败!');
});
} else if (this.addModel.code && !this.addModel.unlockSectionCode && !this.addModel.relSectionSwitchList.length) {
delContinueProtect(this.addModel.id).then(resp => {
this.$emit('updateProtectSuccess', '');
});
} else if (this.addModel.code && !this.addModel.unlockSectionCode && this.addModel.relSectionSwitchList.length) {
this.$messageBox('请填写延续保护解锁区段或清除延续保护相关数据!');
} else if (this.addModel.code && this.addModel.unlockSectionCode && !this.addModel.relSectionSwitchList.length) {
this.$messageBox('请生成延续保护线路或清除延续保护相关数据!');
} else {
this.createProtect('updateProtectSuccess');
}
},
createProtect(parentFunction) {
if (this.addModel.unlockSectionCode && this.addModel.relSectionSwitchList.length) {
const model = this.buildModel(getUID('Protect'));
postContinueProtect(model).then(resp => {
this.$emit(parentFunction, model.code);
}).catch(() => {
this.$messageBox('创建延续保护失败!');
});
} else if (!this.addModel.unlockSectionCode && !this.addModel.relSectionSwitchList.length) {
this.$emit(parentFunction, '');
} else {
if (!this.addModel.unlockSectionCode) {
this.$messageBox('请填写延续保护解锁区段或清除延续保护相关数据!');
} else if (!this.addModel.relSectionSwitchList.length) {
this.$messageBox('请生成延续保护线路或清除延续保护相关数据!');
}
});
}
},
clear() {
if (this.$refs && this.$refs.form) {
@ -376,8 +388,6 @@ export default {
}
}
.box-card {
width: 88%;
position: relative;
left: 8%;
}
</style>

View File

@ -193,7 +193,7 @@
</el-select>
</el-form-item>
</el-form>
<protect-operate ref="protect" :protect-data="protectData" @saveProtectSuccess="saveProtectSuccess" @updateProtectSuccess="updateProtectSuccess" />
<protect-operate ref="protect" :protect-data="protectData" @saveProtectSuccess="saveProtectSuccess" @updateProtectSuccess="updateProtectSuccess" @clearHover="clearHover" />
<div class="draft">
<el-button-group>
<el-button v-if="isSave" type="primary" size="small" :loading="loading" @click="save">{{ $t('map.save') }}
@ -331,7 +331,7 @@ export default {
routeData(val, old) {
if (val) {
this.addModel = val;
this.initProtectData(val);
val.overlapCode && this.initProtectData(val);
this.addModel.routeFlankProtectionList.forEach(item => {
item.normal ? item.switchType = '定位' : item.switchType = '反位';
});
@ -353,7 +353,9 @@ export default {
});
}
if (val && val.length) {
this.$refs.protect.addModel.unlockSectionCode = val[val.length - 1];
if (!this.addModel.code) {
this.$refs.protect.addModel.unlockSectionCode = val[val.length - 1];
}
val.forEach((item) => {
const section = this.$store.getters['map/getDeviceByCode'](item);
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
@ -394,6 +396,10 @@ export default {
},
hover(field) {
this.field = field === this.field ? '' : field;
this.$refs.protect.hover('');
},
clearHover() {
this.field = '';
},
pushSwitch(list, data) {
const index = list.findIndex(elem => { return elem.switchCode == data.switchCode; });
@ -459,6 +465,7 @@ export default {
this.addModel.routeSwitchList = [];
this.addModel.routeFlankProtectionList = [];
this.addModel.overlapCode = '';
this.addModel.code = '';
this.isSave = true;
this.$refs.protect.clear();
}