Bottom.vue 9.47 KB
Newer Older
1 2
<!--
 * @Author: 纪泽龙 jizelong@qq.com
纪泽龙's avatar
纪泽龙 committed
3
 * @Date: 2024-07-15 10:26:41
4
 * @LastEditors: 纪泽龙 jizelong@qq.com
5
 * @LastEditTime: 2024-07-31 16:25:42
纪泽龙's avatar
纪泽龙 committed
6
 * @FilePath: /zh-baseversion-web/src/views/bigWindow/components/Bottom.vue
7 8 9
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
纪泽龙's avatar
纪泽龙 committed
10 11 12 13 14 15 16 17 18 19
  <div class="big-bottom">
    <div class="left">
      <img
        v-if="cont != list.length - 3"
        @click.stop="cont++"
        src="@/assets/firstimage/l.png"
        alt=""
      />
    </div>
    <div class="container">
20 21
      <transition name="fadeBottom" mode="out-in">
        <div v-if="activeCom.label" class="children" @click.stop="">
纪泽龙's avatar
纪泽龙 committed
22 23 24 25 26 27 28 29 30 31 32 33
          <div
            v-for="item in activeCom.children"
            :key="item.value"
            :title="'河北冉盛升新能源有限公123123123司'"
            class="child zzz"
            :class="[{ active: selectActive.includes(item.value) }]"
            @click.stop="selectActiveChange(item.value)"
          >
            {{ item.label }}
          </div>
        </div>
      </transition>
34
      <div
纪泽龙's avatar
纪泽龙 committed
35
        class="all"
36
        @click.stop="selectAll"
纪泽龙's avatar
纪泽龙 committed
37 38 39 40 41
        :class="{
          active:
            selectActive.length == listFlatArr.length &&
            selectActive.length > 1,
        }"
42 43 44
      >
        全部
      </div>
纪泽龙's avatar
纪泽龙 committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
      <div class="other">
        <div class="other2">
          <div class="move" :style="{ left: -cont * 144 + 'px' }">
            <div
              v-for="item in list"
              @click.stop="itemClick(item)"
              :key="item.value"
              class="item"
              :class="[
                { active: item.label == activeCom.label },
                { minOne: selectSome(item) },
                { maxAll: selectEvery(item) },
              ]"
            >
              {{ item.label }}
            </div>
61 62 63 64
          </div>
        </div>
      </div>
    </div>
纪泽龙's avatar
纪泽龙 committed
65 66 67 68 69 70 71 72
    <div class="right">
      <img
        v-if="cont != 0"
        @click.stop="cont--"
        src="@/assets/firstimage/r.png"
        alt=""
      />
    </div>
73 74 75 76 77
  </div>
</template>

<script>
import { mapGetters, mapActions } from "vuex";
纪泽龙's avatar
纪泽龙 committed
78

79 80 81 82
export default {
  name: "",
  data() {
    return {
纪泽龙's avatar
纪泽龙 committed
83
      cont: 0,
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
      list: [
        {
          value: 1,
          label: "天然气公司",
          children: [
            // { value: 10, label: "东阿道夫阿" },
            // { value: 11, label: "阿发送到" },
            // { value: 19, label: "发打算发大水" },
          ],
        },
        {
          value: 2,
          label: "液化气公司",
          children: [
            // { value: 21, label: "2-1" },
            // { value: 22, label: "2-2" },
          ],
        },
        {
          value: 3,
          label: "加气站",
          children: [
            // { value: 31, label: "3-1" },
            // { value: 32, label: "3-2" },
          ],
        },
      ],
纪泽龙's avatar
纪泽龙 committed
111 112
      // 被选中的公司
      activeCom: {},
113 114 115 116 117 118 119 120 121 122 123 124
      selectShowNum: [],
      // 被选中的值
      selectActive: [],
      listFlatArr: [],
    };
  },
  computed: {
    ...mapGetters(["company", "systemSetting"]),
  },
  mounted() {
    this.GetCompany().then((res) => {
      this.company.forEach((item) => {
纪泽龙's avatar
纪泽龙 committed
125
        this.list[item.companyType - 1].children.push({
126 127 128 129 130 131 132 133 134 135 136
          value: item.conpanyId,
          label: item.companyName,
        });
      });
      this.selectAll();
    });
  },
  methods: {
    ...mapActions({
      GetCompany: "bigWindowCompany/GetCompany",
    }),
纪泽龙's avatar
纪泽龙 committed
137 138
    selectUpClear() {
      this.activeCom = {};
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
    },
    selectAll() {
      // 生成所有都选中的数组
      this.listFlatArr = this.list
        .map((item) => {
          return item.children.map((iten) => {
            return iten.value;
          });
        })
        .flat();

      // 如果是全选中状态,则全取消,否则全选

      if (this.selectActive.length == this.listFlatArr.length) {
        this.selectActive = [];
      } else {
        this.selectActive = [...this.listFlatArr];
      }
      this.$emit("listChange", this.selectActive);
    },
纪泽龙's avatar
纪泽龙 committed
159 160 161 162
    itemClick(item) {
      if (item.children.length == 0) return;
      if (this.activeCom == item) {
        this.activeCom = {};
163
      } else {
纪泽龙's avatar
纪泽龙 committed
164
        this.activeCom = item;
165 166 167 168 169 170 171 172 173 174 175
      }
    },
    selectActiveChange(value) {
      const num = this.selectActive.indexOf(value);
      if (num >= 0) {
        this.selectActive.splice(num, 1);
      } else {
        this.selectActive.push(value);
      }
      this.$emit("listChange", this.selectActive);
    },
纪泽龙's avatar
纪泽龙 committed
176
    selectSome(item) {
177
      return (
纪泽龙's avatar
纪泽龙 committed
178 179
        item.children.length > 0 &&
        item.children.some((item) => {
180 181 182 183 184
          return this.selectActive.includes(item.value);
        })
      );
    },
    // 都被选中
纪泽龙's avatar
纪泽龙 committed
185
    selectEvery(item) {
186
      return (
纪泽龙's avatar
纪泽龙 committed
187 188
        item.children.length > 0 &&
        item.children.every((item) => {
189 190 191 192 193 194 195 196
          return this.selectActive.includes(item.value);
        })
      );
    },
  },
};
</script>
<style lang="scss" scoped>
纪泽龙's avatar
纪泽龙 committed
197 198 199
.big-bottom {
  width: 810px;
  height: 50px;
200
  position: fixed;
201
  bottom: 5px;
纪泽龙's avatar
纪泽龙 committed
202 203 204 205 206 207
  left: 50%;
  margin-left: -405px;
  background: url("~@/assets/firstimage/btmA.png") no-repeat bottom center,
    url("~@/assets/firstimage/btmB.png") no-repeat bottom center;
  box-sizing: border-box;
  padding: 0 80px;
208
  display: flex;
纪泽龙's avatar
纪泽龙 committed
209 210 211 212 213 214 215 216
  justify-content: space-between;
  align-items: center;

  .container {
    // background: red;
    flex: 1;
    margin-right: 22px;
    height: 28px;
217
    display: flex;
纪泽龙's avatar
纪泽龙 committed
218 219 220 221
    .all {
      transition: all 0.2s linear;
      width: 128px;
      margin-right: 16px;
222
      text-align: center;
纪泽龙's avatar
纪泽龙 committed
223
      line-height: 28px;
224 225 226
      color: #fff;
      font-size: 16px;
      cursor: pointer;
纪泽龙's avatar
纪泽龙 committed
227 228 229 230 231
      background: url("~@/assets/firstimage/btm-item.png") no-repeat bottom
        center;
      &.active {
        background: url("~@/assets/firstimage/btm-item-active.png") no-repeat
          bottom center;
232
      }
纪泽龙's avatar
纪泽龙 committed
233 234 235 236 237 238 239 240 241 242 243 244
      &:hover {
        opacity: 0.7;
      }
    }
    .other {
      flex: 1;
      width: 0;
      position: relative;
      .other2 {
        width: 100%;
        height: 100%;
        overflow: hidden;
245

纪泽龙's avatar
纪泽龙 committed
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
        .move {
          transition: all 0.5s linear;
          width: 1000px;
          height: 100%;
          // background: blue;
          position: relative;
          display: flex;
          align-items: center;
          left: 0px;
          .item {
            transition: all 0.2s linear;

            width: 128px;
            margin-right: 16px;
            text-align: center;
            line-height: 28px;
            color: #fff;
            font-size: 16px;
            cursor: pointer;
            background: url("~@/assets/firstimage/btm-item.png") no-repeat
              bottom center;
267
            &.active {
268 269 270
              // color: #1ec9e3;
              background: url("~@/assets/firstimage/btm-item-two.png") no-repeat
                bottom center !important;
纪泽龙's avatar
纪泽龙 committed
271 272 273 274 275 276 277 278 279 280 281 282 283
            }
            // 最少选中一个
            &.minOne {
              background: url("~@/assets/firstimage/btm-item-one.png") no-repeat
                bottom center;
            }
            // 全选中
            &.maxAll {
              background: url("~@/assets/firstimage/btm-item-active.png")
                no-repeat bottom center;
            }
            &:hover {
              opacity: 0.7;
284 285 286 287 288
            }
          }
        }
      }
    }
纪泽龙's avatar
纪泽龙 committed
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335
    .children {
      transition: all 1s linear;
      width: 620px;
      max-height: 214px;
      position: absolute;
      // background: red;
      background: rgba(2, 26, 51, 0.9);
      border: 1px solid #127bd1;
      box-shadow: inset 0px 0px 10px 0px #164db2;
      left: 50%;
      margin-left: -310px;
      // top: -215px;
      bottom: 50px;
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      box-sizing: border-box;
      padding: 20px 20px 0px 20px;
      // 滚动条
      overflow-y: auto;
      &::-webkit-scrollbar {
        width: 10px;
        background: #012a53;
        position: absolute;
        top: 0;
      }
      &::-webkit-scrollbar-thumb {
        /*滚动条里面小方块*/
        // border-radius: 10px;
        // box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
        background: #00000052;
        border-radius: 8px;
      }
      &::-webkit-scrollbar-track {
        /*滚动条里面轨道*/
        // box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
        // border-radius: 10px;
        // background-color: red;
      }

      &::-webkit-scrollbar-button:start {
        // overflow: hidden;
      }
      &::-webkit-scrollbar-button:end {
        // overflow: hidden;
      }
      .child {
336
        transition: all 0.5s linear;
纪泽龙's avatar
纪泽龙 committed
337 338 339 340 341 342 343
        width: 275px;
        height: 32px;
        margin-bottom: 16px;
        background: #0b2d47;
        box-sizing: border-box;
        padding-left: 21px;
        line-height: 32px;
344
        color: #5ac8fb;
纪泽龙's avatar
纪泽龙 committed
345 346 347 348
        border: 1px solid rgba(54, 136, 255, 0.2392);
        cursor: pointer;

        &.active {
349
          background: rgba(23, 149, 234, 0.5);
纪泽龙's avatar
纪泽龙 committed
350
          box-sizing: border-box;
351 352
          border: 1px solid #408AD7;
          color: #fff;
纪泽龙's avatar
纪泽龙 committed
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
        }
        &:hover {
          opacity: 0.7;
        }
      }
    }
  }
  .left {
    margin-right: 32px;
    color: white;
  }
  .right {
    color: white;
  }
  .left,
  .right {
    width: 14px;
    height: 20px;

    img {
      transition: all 0.5s linear;
      width: 100%;
      height: 100%;
      cursor: pointer;
      &:hover {
        opacity: 0.7;
      }
    }
381
  }
纪泽龙's avatar
纪泽龙 committed
382 383

  // background: red;
384 385
}
</style>