zuozhengqing
2024-03-27 7fbfeddedebd05e2d23ce411be887106d31e8eff
src/components/makepager/CommonFormTableView.vue
@@ -3,6 +3,7 @@
    <el-form ref="form" :model="tableList" :show-message="false" label-position="right">
      <el-table
        ref="fromTable"
        :border="isBorder"
        :data="tableList.tableData"
        :show-summary="showSummary.show"
        :summary-method="getSummaries"
@@ -21,6 +22,7 @@
          :label="item.label"
          :width="item.width"
          :min-width="item.min"
          v-if="item.isShowColumn"
          align="center"
        >
          <!-- 表头样式 -->
@@ -205,6 +207,12 @@
        </el-table-column>
        <slot name="tableButton" />
      </el-table>
      <div class="styleBtn">
        <i @click="checkCol()" class="label">...</i>
        <el-checkbox-group v-model="showcol" v-show="iscolopen" class="checkbox-group" @change="selectCheckBoxList">
          <el-checkbox v-for="item in tableList.allcol" :label="item" :key="item">{{ item }} </el-checkbox>
        </el-checkbox-group>
      </div>
    </el-form>
    <div v-if="!detailEnter" style="margin: 10px">
      <el-button size="small" type="primary" :disabled="!isOperate" @click="add">新增</el-button>
@@ -273,12 +281,18 @@
      type: Boolean,
      default: true
    },
    isBorder:{
      type: Boolean,
      default: false
    },
    productTableList: {
      type: Object,
      default: () => {
        return {
          tableData: [], // 接口返回数据
          isReturn: false,
          allcol: [],
          showcol: [],
          tableColumn: [
            // table表单
            { label: "", prop: "", min: 200, tooltip: true }
@@ -311,7 +325,9 @@
        infomation: {}
      },
      productIndex: 0,
      isRecalculate: true
      isRecalculate: true,
      iscolopen: false,
      showcol: []
    }
  },
  created() {
@@ -326,10 +342,22 @@
        this.getTableInfo()
      },
      immediate: true
    },
    "productTableList.showcol": {
      handler(newVal) {
        this.showcol = newVal
      },
      immediate: true
    }
  },
  computed: {},
  methods: {
    checkCol() {
      this.iscolopen = !this.iscolopen
    },
    selectCheckBoxList(val) {
      this.$emit("selTableCol", val)
    },
    getTableInfo(){
      this.tableList = this.productTableList
      if (this.tableList.tableData.length === 1 && this.tableList.tableData[0].name === "") {
@@ -612,6 +640,7 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.page-view {
  position: relative;
  .el-form-item {
    margin-bottom: 0;
    .custom-name {
@@ -644,5 +673,40 @@
    // text-align: left;
    text-align: center !important;
  }
  .styleBtn {
    position: absolute;
    width: 30px;
    height: 36px;
    // line-height: 26px;
    // background: #06c062;
    top: 0;
    right: -6px;
    z-index: 11;
    .label {
      position: absolute;
      top: 6px;
      font-size: 20px;
      // line-height: 5px;
      cursor: pointer;
      color: #000;
      transform: rotate(-90deg);
    }
    .checkbox-group {
      width: 160px;
      height: 300px;
      overflow: auto;
      display: flex;
      flex-direction: column;
      line-height: 25px;
      background: #ffffff;
      border-radius: 16px;
      padding: 12px;
      position: absolute;
      right: 0;
      top: 30px;
      z-index: 99;
      box-shadow: 0 0 2px 2px #f8f8f8;
    }
  }
}
</style>