From e46c7f58112c13ed09b325bf164f0d2a440f1012 Mon Sep 17 00:00:00 2001 From: 徐旺旺 <11530253@qq.com> Date: 星期四, 13 五月 2021 16:13:17 +0800 Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop --- src/components/LayerController/modules/LcServiceLayer.vue | 95 +++++++++++++++++++++++++++++++++++------------ 1 files changed, 71 insertions(+), 24 deletions(-) diff --git a/src/components/LayerController/modules/LcServiceLayer.vue b/src/components/LayerController/modules/LcServiceLayer.vue index 323d75a..7ec8aa9 100644 --- a/src/components/LayerController/modules/LcServiceLayer.vue +++ b/src/components/LayerController/modules/LcServiceLayer.vue @@ -3,28 +3,25 @@ <div class="panel-title"> 鍥惧眰鎺у埗 </div> <div class="wms-panel"> <el-scrollbar class="wms-panel-scrollbar"> - <div v-for="item in serviceLayers" :key="item.code" class="layerbox"> + <div v-for="(item,index1) in serviceLayers" :key="index1" class="layerbox"> <i class="downUp el-icon-caret-bottom" @click="item.isShow=!item.isShow" :class="item.isShow?'':'active'" ></i><!-- el-icon-arrow-down --> <!-- 涓�绾у浘灞傞亶鍘� --> <div style="padding-left:25px;padding-top:10px;color:#fff;font-size: 16px;"> - <input type="checkbox" :name="'wmsLayer_'+item.code" :checked="item.checked" :value="item.code" @change="swAllLayers(item,'')"/>{{ item.name }} + <input type="checkbox" :class="item.type==1?'active':''" :name="'wmsLayer_'+item.code" :checked="item.checked" :value="item.code" @change="swAllLayers(item)"/>{{ item.name }} </div> - <div class="layerbox-item" v-show="item.isShow"> + <div class="layerbox-item" v-show="item.isShow" > <!-- 浜岀骇鍥惧眰閬嶅巻 --> - <div class="basemap-layer-item" v-for="itm in item.layers" :key="itm.code"> - <input type="checkbox" - :name="'wmsSublayers_'+item.code+'_'+itm.code" - :checked="itm.checked" - :value="itm.code" - @change="swAllLayers(itm,item.name)"/>{{ itm.name }} + <div class="basemap-layer-item" v-for="(itm,index2) in item.layers" :key="index2" :class="!itm.layers?'felxs':''" > + <input type="checkbox" :class="itm.type==1?'active':''" :name="'wmsSublayers_'+item.code+'_'+itm.code" :checked="itm.checked" :value="itm.code" @change="swAllLayers(itm)"/>{{ itm.name }} <!-- 涓夌骇鍥惧眰閬嶅巻 --> - <div class="layerbox-item-3"> - <div class="basemap-layer-item" v-for="layer in itm.layers" :key="layer.code"> + <div class="layerbox-item-3" v-show="itm.layers"> + <div class="basemap-layer-item" v-for="(layer,index3) in itm.layers" :key="index3"> <input type="checkbox" + :class="layer.type==1?'active':''" :name="'wmsSublayers_'+item.code+'_'+layer.code" :checked="layer.checked" :value="layer.code" - @change="swAllLayers(layer,'')"/> + @change="swAllLayers(layer)"/> <span :style="'color:'+layer.color">{{ layer.name }}</span> </div> </div> @@ -51,14 +48,52 @@ mounted () { }, methods: { - swAllLayers (item, v) { + swAllLayers (item) { // eslint-disable-next-line no-debugger item.checked = !item.checked this.toggleLayer(item) this.swLayers(item.layers, item.checked) - if (v === '涓撻鍥惧眰') { - bus.$emit('changeSearchBar', item) - } + this.serviceLayers.forEach(function (item1, index1) { + if (item1.layers) { + item1.istrue = 0 + item1.isfalse = 0 + item1.layers.forEach(function (item2, index2) { + if (item2.layers) { + item2.istrue = 0 + item2.isfalse = 0 + item2.layers.forEach(function (item3, index3) { + if (item3.checked) { item2.istrue += 1 } else { item2.isfalse += 1 } + }) + // console.log(item2.layers.length, item2.istrue, item2.isfalse, item2.type) + if (item2.istrue === item2.layers.length) { + item2.type = 2 + item2.checked = true + } else if (item2.isfalse === item2.layers.length) { + item2.type = 0 + item2.checked = false + } else { + item2.type = 1 + } + if (item1.name === '涓撻鍥惧眰') { + bus.$emit('changeSearchBar', item2) + // console.log(item2, 'item2') + } + if (item2.checked) { item1.istrue += 1 } else { item1.isfalse += 1 } + } + }) + if (item1.istrue === item1.layers.length) { + item1.type = 2 // 鍏ㄩ�� + item1.checked = true + } else if (item1.isfalse === item1.layers.length) { + item1.type = 0 // 涓嶉�� + item1.checked = false + } else { + item1.type = 1 // 鍗婇�� + } + // console.log(item1.layers.length, item1.istrue, item1.isfalse, item1.type) + } + }) + console.log(this.serviceLayers) }, swLayers (layers, checked) { if (layers) { @@ -90,13 +125,20 @@ cursor: pointer; color: #ffffff; } + .felxs{ + display: flex; + flex-wrap:wrap; + width: 50% !important; + } .wms-panel { .wms-panel-scrollbar{ - height: 457px; - width: 285px; - //width: 2.5rem; + // height: 600px; + //width: 285px; + // width: 1.79rem; + height: 70vh; + width:2.1rem; font-size: 14px; } .layerbox { @@ -119,14 +161,19 @@ } .downUp:hover{font-size: 26px;font-weight: 900} .layerbox-item { - padding-left: 30px; + padding-left: 25px; padding-top: 5px; - .basemap-layer-item { - margin-bottom: 5px; + display: flex; + flex-wrap:wrap; + .basemap-layer-item {margin-bottom: 5px; + width: 100%; input[type="checkbox"]{width:10px;height:10px;display: inline-block;text-align: center;vertical-align: middle; line-height: 10px;position: relative;} input[type="checkbox"]::before{content: "";position: absolute;top: 0;left: 0;background: #fff;width: 100%;height: 100%;border: 1px solid #d9d9d9} - input[type="checkbox"]:checked::before{content: "\2713";background-color: @color-highlight;position: absolute;top: 0;left: 0;width:100%;border: 1px solid #fff700;color:@background-color;font-size: 10px;font-weight: bold;} - + input[type="checkbox"]:checked::before{content: "\2713";background-color: @color-highlight;position: absolute;top: 0;left: 0;width:100%;border: 1px solid #fff700; + color:@background-color;font-size: 10px;font-weight: bold;} + input.active[type="checkbox"]::before, + input.active[type="checkbox"]:checked::before{content: "\2713";background: @background-color;position: absolute;top: 0;left: 0;width:100%;border: 1px solid @background-color; + color:@color-highlight;font-size: 10px;font-weight: bold;} } } .layerbox-item-3{ -- Gitblit v1.8.0