增加站台紧急按钮批量删除,增加区段批量删除范围

This commit is contained in:
zyy 2020-12-08 11:09:02 +08:00
parent 5088838db6
commit 085990f755
4 changed files with 48 additions and 23 deletions

View File

@ -16,6 +16,11 @@
<el-button type="primary" style="margin: 0 auto;display: block;" @click="create">批量创建</el-button>
</div>
</el-tab-pane>
<el-tab-pane class="view-control" label="批量操作" name="three" :lazy="lazy">
<div class="view-control-content">
<el-button type="primary" style="margin: 0 auto;display: block;" @click="handleDelete">一键删除无效数据</el-button>
</div>
</el-tab-pane>
</el-tabs>
</template>
@ -166,6 +171,26 @@ export default {
this.$message('暂无新车站或车站已有对应紧急停车按钮!');
}
},
//
handleDelete() {
this.$confirm('您是否确定一键删除无用数据?', this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
const models = [];
this.espList.forEach(item => {
const model = this.$store.getters['map/getDeviceByCode'](item.standCode);
if (!model) {
models.push(deepAssign(item, { _dispose: true }));
}
});
models.length && this.$emit('updateMapModel', models);
this.$message.success('删除成功!');
}).catch(() => {
this.$message.info('删除失败');
});
},
updateMapModel(data) {
this.$emit('updateMapModel', data);
this.field = '';

View File

@ -406,7 +406,7 @@ export default {
models.push(deepAssign(item, { _dispose: true }));
}
});
const arrList = ['signalList', 'stationList', 'stationStandList', 'psdList', 'axleCounterResetButtonList', 'tbStrategyList', 'zcList', 'cycleButtonList', 'totalGuideLockButtonVOList', 'automaticRouteButtonList', 'outerFrameList', 'directionRodList', 'textList'];
const arrList = ['signalList', 'stationList', 'psdList', 'axleCounterResetButtonList', 'tbStrategyList', 'zcList', 'cycleButtonList', 'totalGuideLockButtonVOList', 'automaticRouteButtonList', 'outerFrameList', 'directionRodList', 'textList'];
arrList.forEach(itemName => {
map[itemName] && map[itemName].forEach(item => {
const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
@ -415,6 +415,14 @@ export default {
}
});
});
map.stationStandList.forEach(item => {
const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
if (flag) {
models.push(deepAssign(item, { _dispose: true }));
const esp = map.espList.find(ele => ele.standCode == item.code);
esp && models.push(deepAssign(esp, { _dispose: true }));
}
});
// map.signalList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
@ -427,14 +435,6 @@ export default {
// models.push(deepAssign(item, { _dispose: true }));
// }
// });
// map.stationStandList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {
// models.push(deepAssign(item, { _dispose: true }));
// const esp = map.espList.find(ele => ele.standCode == item.code);
// esp && models.push(deepAssign(esp, { _dispose: true }));
// }
// });
// map.psdList && map.psdList.forEach(item => {
// const flag = this.fromModel.right ? item.position.x > pointX : item.position.x < pointX;
// if (flag) {