loulijun2021
2023-01-04 0c6473bcff72275f79cbc14843937ed8b26c6801
1.优化列展示功能
已修改5个文件
36 ■■■■ 文件已修改
src/components/DndList/index.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/ThemePicker/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Navbar.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Settings/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Sidebar/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/DndList/index.vue
@@ -9,7 +9,10 @@
        <draggable :set-data="setData" :list="list1" class="dragArea" animation="300" @end="draggableEnded">
          <div v-for="item in list1" :key="item.id" class="list-complete-item">
            <div style="display: flex">
              <div style="width: 20px;height: 20px;margin-right: 4px;cursor:move"><i class="el-icon-rank" /></div>
              <div style="width: 20px;height: 20px;margin-right: 4px;cursor:move;"><i
                style="font-weight: bolder"
                class="el-icon-rank"
              /></div>
              <el-checkbox :label="item.label" class="list-complete-item-handle" />
            </div>
            <div>
@@ -58,8 +61,9 @@
  data() {
    return {
      checkedList: this.list1.map(i => i.show ? i.label : '').filter(i => i !== ''), // 列展示值
      checkedListDefault: [...this.list1], // 重置默认值List
      checkedListDefaultLabel: this.list1.map(i => i.show ? i.label : '').filter(i => i !== ''), // 重置默认值label
      // checkedListDefaultFixed: this.list1.map(i => i.show ? i.label : '').filter(i => i !== ''), // 重置默认值fixed
      checkedListDefaultFixed: this.list1.map(i => i.fixed), // 重置默认值fixed
      checkedAll: true
    }
  },
@@ -76,8 +80,12 @@
    // 重置
    resetColumn() {
      this.checkedList = this.checkedListDefaultLabel
      this.list1.sort((a, b) => a.id - b.id)// 排序
      this.list1.forEach((i, j) => {
        i.show = !!this.checkedListDefaultLabel.includes(i.label)
      })
      this.checkedListDefaultFixed.forEach((i, j) => {
        this.list1[j].fixed = i
      })
      this.$emit('tableColumnUpdate', this.checkedListDefaultLabel)
    },
@@ -96,26 +104,25 @@
    },
    // 固定到左侧
    fixedToLeft(val) {
      console.log('fixedToLeft', val)
      if (this.list1.find(i => i.label === val).show) {
      this.list1.find(i => i.label === val).fixed = this.list1.find(i => i.label === val).fixed !== 'left' ? 'left' : false
      }
      this.$emit('tableColumnUpdate', this.checkedList)
    },
    // 固定到右侧
    fixedToRight(val) {
      console.log('fixedToRight', val)
      if (this.list1.find(i => i.label === val).show) {
      this.list1.find(i => i.label === val).fixed = this.list1.find(i => i.label === val).fixed !== 'right' ? 'right' : false
      }
      this.$emit('tableColumnUpdate', this.checkedList)
    },
    // 拖动结束事件
    draggableEnded({ to, from, item, clone, oldIndex, newIndex }) {
      console.log(to, from, item, clone, oldIndex, newIndex)
      // console.log(this.list1, 123456789)
      // console.log(to, from, item, clone, oldIndex, newIndex)
      this.$emit('tableColumnUpdate', this.list1, true)// 传给爷爷  isCopyTrue:复值给爷爷
    },
    // 多选框值改变事件
    checkedListChange(val) {
      console.log(val, 1)
      this.checkedAll = val.length !== 0
      this.list1.forEach((i, j) => {
        i.show = !!val.includes(i.label)
@@ -148,7 +155,7 @@
    .dragArea {
      margin-top: 15px;
      min-height: 50px;
      padding-bottom: 30px;
      //padding-bottom: 30px;
    }
  }
}
src/components/ThemePicker/index.vue
@@ -35,7 +35,6 @@
      if (typeof val !== 'string') return
      const themeCluster = this.getThemeCluster(val.replace('#', ''))
      const originalCluster = this.getThemeCluster(oldVal.replace('#', ''))
      console.log(themeCluster, originalCluster)
      const $message = this.$message({
        message: '  正在切换主题',
src/layout/components/Navbar.vue
@@ -202,7 +202,7 @@
      return path
    },
    variables() {
      console.log(variables, 2333)
      // console.log(variables, 2333)
      // 先输出这个variables值  然后修改其属性值
      variables.menuActiveText = this.$store.state.settings.theme
      // background: rgb(48, 65, 86);
src/layout/components/Settings/index.vue
@@ -52,7 +52,6 @@
          style="width: 120px;"
          placeholder="请选择"
          size="mini"
          @change="animationTypeChange"
        >
          <el-option
            v-for="item in animationTypeArr"
@@ -153,9 +152,6 @@
        key: 'theme',
        value: val
      })
    },
    animationTypeChange(val) {
      console.log(val, 1)
    }
  }
}
src/layout/components/Sidebar/index.vue
@@ -89,10 +89,10 @@
      return this.$store.state.settings.sidebarLogo
    },
    variables() {
      console.log(variables, 2333)
      // console.log(variables, 2333)
      // 先输出这个variables值  然后修改其属性值
      variables.menuActiveText = this.$store.state.settings.theme
      console.log(!this.$store.state.settings.menuIsHorizontal && !this.$store.state.settings.leftBackgroundColorValue, 1)
      // console.log(!this.$store.state.settings.menuIsHorizontal && !this.$store.state.settings.leftBackgroundColorValue, 1)
      if ((!this.$store.state.settings.menuIsHorizontal && !this.$store.state.settings.leftBackgroundColorValue)) {
        variables.menuHover = '#eee'
      }