liuyg
2021-12-29 666c61a8dca571045e422e6c85f1b7a8179f0df5
+搜索确认按钮位置 加上展开,  适应1366 768分辨率的缩放zoom ,
8 files modified
299 ■■■■ changed files
src/App.vue 6 ●●●●● patch | view | raw | blame | history
src/store/getters.js 1 ●●●● patch | view | raw | blame | history
src/store/modules/control.js 109 ●●●●● patch | view | raw | blame | history
src/store/onresize.js 3 ●●●●● patch | view | raw | blame | history
src/styles/element-ui.scss 6 ●●●●● patch | view | raw | blame | history
src/styles/tableSearchBut.scss 41 ●●●●● patch | view | raw | blame | history
src/views/securityGuard/data.js 22 ●●●● patch | view | raw | blame | history
src/views/securityGuard/securityGuard.vue 111 ●●●● patch | view | raw | blame | history
src/App.vue
@@ -11,11 +11,9 @@
    return {};
  },
  watch: {},
  created() {
  },
  created() {},
  methods: {},
  computed: {}
  computed: {},
};
</script>
<style lang="scss">
src/store/getters.js
@@ -30,5 +30,6 @@
  clearOtherBut: state => state.control.clearOtherBut,
  windowWidth: state => state.control.windowWidth,
  windowHeight: state => state.control.windowHeight,
  table_height: state => state.control.table_height,
}
export default getters
src/store/modules/control.js
@@ -2,7 +2,7 @@
// import {getDictionary} from '@/api/system/dict'
const dict = {
const control = {
  state: {
    clearOtherBut: {
      refreshBtn: false,
@@ -17,15 +17,102 @@
      pageSizes: [15, 30, 50, 100],
    },
    windowWidth: 1025,
    windowHeight: '',
    windowHeight: 990,
    heightTimesOut: '',
    table_height: "",
    butState: '',
    oldOpens: ''
  },
  actions: {
    WHchangeHight({ state, commit }, data) {
      if (data.fn) {
        data.fn();
        if (!state.heightTimesOut) {
          data.fn(state.windowHeight);
      }
      data.option.height = +state.windowHeight + +data.add;
      // console.log(data);
        state.heightTimesOut = setTimeout(() => {
          clearTimeout(state.heightTimesOut);
          state.heightTimesOut = '';
        }, 300);
      }
    },
    TABLE_CHANGEBUTPOSITION({ state, commit, dispatch }, data) {
      let changedom = function (val) {
        let table = document.getElementsByClassName("tablesss")[0];
        let heard = table.getElementsByClassName("avue-crud__search")[0];//获取搜索的长度
        let buts = table.getElementsByClassName("avue-form__menu--center")[0];
        let Open = buts.getElementsByClassName("el-button--text")[0]
        let butsheight = heard.clientHeight;
        let butX = 0;
        if (data.from == "mounted") {
          commit("setOldOpens", '')
          commit("setButOpens", '')
        }
        // console.log(state.butState, val, butsheight)
        if (state.butState == "展 开") {
          commit("setOldOpens", '')
        }
        if (val == "收 缩") {
          commit("setOldOpens", butsheight)
        } else if (val == undefined && state.oldOpens) {
          butsheight = state.oldOpens;
          butX = state.oldOpens - heard.clientHeight;
          // commit("setOldOpens", '')
        }
        // console.log(state.butState, val, butsheight, butX);
        let sets = window.innerWidth <= 1376 && window.innerHeight <= 778;
        let usNumOpens = sets ? -78 : -78;
        if (butX || sets) {
          Open.style.top = usNumOpens - +butX + "px";
        }
        buts.style.top = butsheight + "px";
        if (val != "收 缩") {
          let other = data.otherclass || [];
          if (other && state.windowWidth >= 1024)
            for (let k in other) {
              let otherbuts = document.getElementsByClassName(other[k])[0]
              otherbuts.style.top = butsheight + 27 + "px";
            }
        }
        if (state.butState == "收 缩" && !val) {
          Open.click();
        }
        if (data.haveOpen && !val) {// 是否有展开按钮
          Open.onclick = function (e) {
            changedom(e.srcElement.innerText);
            //固定高度
            //调用改变高度
            if (e.srcElement.innerText == "展 开") {
              state.windowHeight += 1;
            } else {
              state.windowHeight -= 1;
            }
            commit("setButOpens", e.srcElement.innerText)
          }
        }
      }
      changedom();
    },
    TABLE_CHANGEHEIGHT({ state, commit }, data) {
      let h = +state.windowHeight - (+data.searchHeight + +data.flowHeight);
      console.log(h)
      state.table_height = h;
      // commit("settable_height", h);
    },
    changeZoom({ state, commit }, data) {
      if (window.innerWidth <= 1396 && window.innerHeight <= 798) {
        // var devicewidth = document.documentElement.clientWidth; //获取当前分辨率下的可是区域宽度
        // console.log(devicewidth)
        let devicewidth = 1143;
        var scale = devicewidth / 1366; // 分母——设计稿的尺寸
        document.body.style.zoom = scale; //放大缩小相应倍数
        // console.log("应用1366*768")
      } else {
        if (document.body.style.zoom != 1) {
          document.body.style.zoom = 1;
          // console.log("还原缩放")
        }
      }
    }
  },
  mutations: {
@@ -34,8 +121,18 @@
      state.windowHeight = data.innerHeight;
      // console.log(data)
    },
    setWindowSizeHeightAdd: (state, data) => {
      state.windowHeight += 1;
    },
    setButOpens(state, data) {
      state.butState = data;
    },
    setOldOpens(state, data) {
      state.oldOpens = data;
      state.oldOpens = data;
    }
  }
};
export default dict;
export default control;
src/store/onresize.js
@@ -7,10 +7,13 @@
        let innerWH = {
            innerWidth: window.innerWidth,
            innerHeight: window.innerHeight,
            // innerWidth: document.documentElement.clientWidth,
            // innerHeight: document.documentElement.clientHeight,
        }
        _this.$store.commit('setWindowSize', innerWH);
        // console.log(' window.innerWidth', window.innerWidth);
        // console.log(' window.innerHeight', window.innerHeight);
        _this.$store.dispatch("changeZoom");
    }
}
src/styles/element-ui.scss
@@ -330,3 +330,9 @@
    height: 100% !important;
    box-sizing: border-box !important;
}
// 整体缩放
body {
    zoom: 0.997;
    // font-size: xx-small;
}
src/styles/tableSearchBut.scss
@@ -1,9 +1,27 @@
.ourOpen {
    .el-button.el-button--text.el-button--small {
        position: absolute;
        top: -78px;
        right: 10px;
    }
}
// :nth-child(2)
.tooRowSearch {
    position: relative;
}
.tooRowSearch .avue-crud__search .avue-form__group.avue-form__group--flex .avue-form__menu--center {
    width: 222px !important;
    position: absolute !important;
    right: 0 !important;
    top: 126px !important;
    z-index: 100 !important;
    // width: 264px !important;
    // position: absolute !important;
    // right: 0 !important;
    // top: 126px !important;
    // z-index: 100 !important;
    // width: 264px;
    position: absolute;
    right: 0;
    top: 91px;
    z-index: 100;
    @extend .ourOpen;
}
.tooRowSearch .el-card.is-never-shadow.avue-crud__search {
    overflow: visible;
@@ -19,3 +37,18 @@
.oneRowSearch .el-card.is-never-shadow.avue-crud__search {
    overflow: visible;
}
// $varHeight: var(--height-primary); //Sass变量的值从CSS变量里取,间接操作Sass变量
// .tablesss .avue-crud {
//     /deep/ el-table {
//         height: $varHeight !important;
//     }
// }
.el-card__body {
    //卡片减少padding
    padding: 10px !important;
}
.avue-crud__pagination {
    padding: 15px 0 5px 5px;
}
src/views/securityGuard/data.js
@@ -484,7 +484,7 @@
        prop: "realName",
        search: true,
        searchSpan: 3,
        width: 60,
    width: 65,
        searchLabelWidth: 50,
        display: false
    },
@@ -504,13 +504,13 @@
        searchSpan: 5,
        display: false,
        search: true,
        minWidth: 260
    minWidth: 160
    },
    {
        label: "性别",
        prop: "sexs",
        sortable: true,
        width: 70,
    width: 75,
        type: "select",
        dicData: [{
                label: "男",
@@ -594,7 +594,7 @@
    {
        label: "联系电话",
        prop: "phone",
        minWidth: 70,
    minWidth: 80,
        display: false
    },
    {
@@ -609,7 +609,7 @@
        search: true,
        searchLabelWidth: 90,
        sortable: true,
        width: 110,
    width: 118,
        searchSpan: 5,
        addDisplay: false,
        editDisplay: false,
@@ -628,8 +628,8 @@
        sortable: true,
        editDisplay: false,
        search: true,
        width: 80,
        searchSpan: 3,
    width: 110,
    searchSpan: 4,
        addDisplay: false,
        dicData: [{
                label: '全部',
@@ -651,8 +651,8 @@
        slot: true,
        sortable: true,
        search: true,
        searchSpan: 3,
        width: 69,
    searchSpan: 4,
    width: 110,
        type: "select",
        dicData: [{
                label: "是",
@@ -686,7 +686,7 @@
        editDisplay: false,
        addDisplay: false,
        searchSpan: 3,
        width: 69,
    width: 110,
        dicData: [{
                label: "已制证",
                value: 6,
@@ -799,7 +799,7 @@
        searchSpan: 3,
        search: false,
        hide: true,
        width: 80,
    width: 110,
        dicData: [{
                label: "全部",
                value: 6,
src/views/securityGuard/securityGuard.vue
@@ -20,6 +20,8 @@
        ]"
      >
        <avue-crud
          class="tablesss"
          :key="option.height"
          :option="option"
          :search.sync="search"
          :table-loading="loading"
@@ -168,7 +170,7 @@
              :type="type"
              v-if="permission.securityGuard_delete && row.status != 2"
              @click.stop="rowStatus(row)"
              >离职登记
              >离职
            </el-button>
            <el-button
              icon="el-icon-edit"
@@ -397,6 +399,7 @@
    </el-col>
    <div
      :class="[
        'downSFZ',
        $store.state.control.windowWidth >= 1024
          ? 'downSFZqudong'
          : 'downSFZqudongS',
@@ -601,6 +604,12 @@
        callback();
      }
    };
    // let table = document.getElementsByClassName("tablesss");
    // let heard = table[0].getElementsByClassName("avue-crud__search");
    // let usNum =
    //   this.windowWidth <= 1376 && this.windowHeight <= 778 ? 170 : 332;
    // // that.option.height = +h - (+heard[0].clientHeight + 332);
    // let optionHeight = +this.windowHeight - (+heard[0].clientHeight + +usNum);
    return {
      sort: "",
      sortName: "",
@@ -750,6 +759,8 @@
      },
      choiceList: [],
      option: {
        searchIndex: 5, //收缩展示数量
        searchIcon: true, //搜索是否收缩
        height: "auto",
        calcHeight: 80,
        tip: true,
@@ -998,11 +1009,13 @@
                prop: "securitynumber",
                hide: true,
                display:true,
                rules: [{
                rules: [
                  {
                    required: false,
                    message: "请输入保安员证编号",
                    trigger: "blur",
                  }],
                  },
                ],
              },
              // {
              //   label: "发证日期",
@@ -1275,19 +1288,54 @@
          },
        ],
      },
      tablevisible: true,
      isNotChangeSize: true, //取消表格loging
    };
  },
  watch: {
    // windowHeight() {
    //   let d = {
    //     option: this.option,
    //     fn: function () {
    //       console.log(123);
    //     },
    //     add: 100,
    //   };
    //   this.$store.dispatch("WHchangeHight", d);
    // },
    windowHeight() {
      let that = this;
      that.isNotChangeSize = false; //取消表格loging
      let d = {
        fn: function (h) {
          let table = document.getElementsByClassName("tablesss");
          let heard = table[0].getElementsByClassName("avue-crud__search");
          let usNum =
            that.windowWidth <= 1376 || that.windowHeight <= 778 ? 170 : 302;
          // // that.option.height = +h - (+heard[0].clientHeight + 332);
          // alert(h);
          let doit = (height) => {
            let hs = height || h;
            // alert(hs);
            // alert(heard[0].clientHeight);
            // alert(usNum);
            that.option.height = +hs - (+heard[0].clientHeight + +usNum);
            that.$nextTick(() => {
              that.refreshChange();
              setTimeout(() => {
                let d = {
                  that: this,
                  otherclass: ["downSFZ"],
                  haveOpen: true,
                };
                //刷新表格后再次调整按钮
                that.$store.dispatch("TABLE_CHANGEBUTPOSITION", d);
                that.isNotChangeSize = true; //恢复表格loging
              }, 10);
            });
          };
          if (that.option.height == "auto") {
            //解决第一次未渲染成功会报错的问题
            setTimeout(() => {
              doit(window.innerHeight);
            }, 150);
          } else {
            doit();
          }
        },
      };
      this.$store.dispatch("WHchangeHight", d);
    },
    radio() {
      if (this.radio) {
        this.SFZloding = true;
@@ -1308,7 +1356,10 @@
    },
    "form.hold":{
      handler(val){
        var securitynumbercolumn =this.findObject(this.option.group,'securitynumber')
        var securitynumbercolumn = this.findObject(
          this.option.group,
          "securitynumber"
        );
        // console.log(val,1234);
        if(val==1){
          securitynumbercolumn.display=true;
@@ -1317,7 +1368,7 @@
                    required: true,
                    message: "请输入保安员证编号",
                    trigger: "blur",
                  }
            },
          ];
        }else{
          securitynumbercolumn.display=false;
@@ -1326,11 +1377,11 @@
                    required: false,
                    message: "请输入保安员证编号",
                    trigger: "blur",
                  }
            },
          ];
        }
      },
      immediate: true
      immediate: true,
    },
    "form.fingerprint"() {
      let that = this;
@@ -1395,7 +1446,7 @@
    },
  },
  computed: {
    ...mapGetters(["userInfo", "permission", "windowHeight"]),
    ...mapGetters(["userInfo", "permission", "windowHeight", "windowWidth"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.securityGuard_add, false),
@@ -1483,6 +1534,15 @@
    }
  },
  mounted() {
    // let d = {
    //   that: this,
    //   otherclass: ["downSFZ"],
    //   haveOpen: true,
    //   flowHeight: 332,
    // };
    // this.$store.dispatch("TABLE_CHANGEBUTPOSITION", d);
    // console.log((this.$refs.crud._props.option.height = 200));
    this.changeButsPosition("TABLE_CHANGEBUTPOSITION");
    // this.option.column[0].hide = true
    // 非保安单位模式默认加载管理组数据
    if (!website.tenantMode) {
@@ -1498,6 +1558,17 @@
    // this.olondSFZ(); //检查身份证设备是否存在
  },
  methods: {
    changeButsPosition(val) {
      let d = {
        that: this,
        otherclass: ["downSFZ"],
        haveOpen: true,
        from: "mounted",
      };
      // 开始就适应高度
      this.$store.commit("setWindowSizeHeightAdd");
      this.$store.dispatch("TABLE_CHANGEBUTPOSITION", d);
    },
    openccc() {
      console.log(this.zhiwenImg);
      // console.log(this.zhiwenChart);
@@ -2477,6 +2548,9 @@
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      if (this.isNotChangeSize) {
        this.loading = true;
      }
      params = this.search;
      var that = this;
      //获取当前登录人员的角色信息
@@ -2569,7 +2643,6 @@
            ...that.query,
          };
          that.loading = true;
          getList(page.currentPage, page.pageSize, values).then((res) => {
            const data = res.data.data;
            that.page.total = data.total;