rt-sim-training-client/src/views/newMap/newMapdraft/configMap.vue

168 lines
4.1 KiB
Vue
Raw Normal View History

2019-11-29 12:51:58 +08:00
<template>
2020-04-10 17:23:53 +08:00
<el-dialog v-dialogDrag title="隐藏元素" :visible.sync="dialogTableVisible" class="view_box" width="460px" :before-close="doClose" :modal-append-to-body="false">
2019-11-29 12:51:58 +08:00
<el-row type="flex" justify="center" class="content_box">
<el-form label-width="80px" class="demo-ruleForm">
<el-form-item :label="$t('map.contentShows')">
2020-01-13 17:31:58 +08:00
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">全选</el-checkbox>
2019-12-03 18:44:46 +08:00
<el-row class="physical-view" type="flex" justify="center" style="width: 100%;">
2019-11-29 12:51:58 +08:00
<el-checkbox-group v-model="physicalLevelsSelect" @change="handleSelectPhysicalView">
<el-checkbox v-for="view in PhysicalViewTypeList" :key="view.code" :label="view.code">
{{ view.name }}</el-checkbox>
</el-checkbox-group>
</el-row>
</el-form-item>
</el-form>
</el-row>
</el-dialog>
</template>
<script>
import { ViewMode } from '@/scripts/ConstDic';
export default {
name: 'ConfigMap',
data () {
return {
ViewMode: ViewMode,
dialogTableVisible: false,
viewSelect: [ViewMode.LOGIC, ViewMode.PHYSICAL],
PhysicalViewTypeList: [
{ code: 'Section', name: this.$t('map.section') },
{ code: 'Signal', name: this.$t('map.signal') },
{ code: 'Switch', name: this.$t('map.switch') }
],
2020-04-10 17:23:53 +08:00
checkAll: false,
2020-01-13 17:31:58 +08:00
isIndeterminate: false,
2019-12-03 18:44:46 +08:00
physicalLevelsSelect: [] // 选中list
2019-11-29 12:51:58 +08:00
};
},
mounted() {
this.initPage();
},
methods: {
doShow() {
this.dialogTableVisible = true;
},
doClose() {
this.dialogTableVisible = false;
},
initPage() {
this.$Dictionary.physicalViewType().then(list => {
this.PhysicalViewTypeList = list;
});
},
handleSelectPhysicalView(handle) {
this.$emit('handleSelectPhysicalView', handle);
2020-01-13 17:31:58 +08:00
const checkedCount = handle.length;
this.checkAll = checkedCount === this.PhysicalViewTypeList.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.PhysicalViewTypeList.length;
2019-11-29 12:51:58 +08:00
},
2020-01-13 17:31:58 +08:00
handleCheckAllChange(val) {
2020-04-10 17:23:53 +08:00
this.physicalLevelsSelect = val ? this.PhysicalViewTypeList.map(item => item.code) : [];
2020-01-13 17:31:58 +08:00
this.isIndeterminate = this.physicalLevelsSelect.length > 0 && this.physicalLevelsSelect.length < this.PhysicalViewTypeList.length;
this.$emit('handleSelectPhysicalView', this.physicalLevelsSelect);
2019-11-29 12:51:58 +08:00
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.demo-ruleForm{
width: 100%;
/deep/{
.el-form-item__label{
text-align: left;
height: 30px;
line-height: 30px;
}
.el-checkbox-group{
width: 100%;
display: flex;
flex-wrap: wrap;
}
}
}
.view_box{
/deep/ {
.el-dialog{
position: absolute;
right: 26px;
left: auto;
top: 7px;
}
.el-dialog__body{
padding: 0 15px;
}
.el-dialog__header{
padding: 10px 20px
}
.el-checkbox{
margin-right: 10px;
width: 75px;
height: 30px;
display: flex;
align-items: center;
}
.el-form-item{
margin-bottom: 6px;
}
// ckect框选中颜色
.content_box .el-checkbox__input.is-checked .el-checkbox__inner,
.content_box .el-checkbox__input.is-indeterminate .el-checkbox__inner {
background-color: #85bef9;
border-color: #85bef9;
}
// 文字选中颜色
.content_box .el-checkbox__input.is-checked+.el-checkbox__label {
color: #3c93ec;
}
}
}
.dialog-box{
background-color: #fff;
width: 460px;
box-shadow: 2px 2px 4px #c5c5c5;
position: absolute;
left: auto;
right: 24px;
top: 43px;
z-index: 10;
.title{
overflow: hidden;
border-bottom: 1px solid #ccc;
padding: 8px 15px;
.fl-title{
float: left;
}
.fr-title{
float: right;
cursor: pointer;
}
}
.content_box{
padding: 15px;
padding-top: 4px;
}
}
.fade-enter-active, .fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter, .fade-leave-to {
opacity: 0;
}
</style>