张涛
2024-08-30 082b572b91abd0d5ae8e409714553130448aa6d1
src/views/systemSetting/silkStandardSetting/components/silkTableList.vue
@@ -6,6 +6,7 @@
          
          <el-table
            ref="fromTable"
            v-if="tableShow"
            :data="tableList.tableData"
            style="width: 100%"
            @selection-change="handleSelectionChange"
@@ -46,7 +47,7 @@
                      }
                    "
                  ></el-input>
                  <div class="common-select-btn" @click="clearupColumn(item.prop)">
                  <div class="common-select-btn" @click="clearupColumn(item.prop,i)">
                    <i class="el-icon-remove" title="删除"></i>
                  </div>
                </div>
@@ -237,6 +238,11 @@
      type: Boolean,
      default: true
    },
    // 是否可以编辑表头
    isEdit: {
      type: Boolean,
      default: false
    },
    silkTableList: {
      type: Object,
      default: () => {
@@ -257,7 +263,8 @@
      productList: [],
      tableList: [],
      projectIndex: 0,
      projectOptions: getDataByType("projectOptions")
      projectOptions: getDataByType("projectOptions"),
      tableShow:true,
    }
  },
  created() {
@@ -272,7 +279,18 @@
        this.getTableInfo()
      },
      immediate: true
    }
    },
    'silkTableList.tableColumn': {
      handler() {
        this.tableShow=false;
        this.$nextTick(()=>{
          this.tableShow=true;
          this.$forceUpdate()
        })
      },
      immediate: true
    },
  },
  computed: {},
  methods: {
@@ -321,27 +339,25 @@
      this.$emit("addColumnInputChange", val, prop)
    },
    editColumnInput(item,i,prop){
      console.log(item,'===item')
      console.log(i,'===i')
      console.log(prop,'===prop')
      if(prop.indexOf('prop')!=-1){
      if(prop.indexOf('prop')!=-1&&this.isEdit){
        item.addColumn=true;
        this.$set(this.tableList.tableColumn[i],'addColumn',true)
        this.$forceUpdate()
        this.$emit("editColumnInput", item, i,prop)
      }
    },
    // 删除列
    clearupColumn(prop) {
    clearupColumn(prop,index) {
      console.log(prop)
      this.$emit("clearupColumn", prop)
      this.$emit("clearupColumn", prop,index)
    }
  },
  //解决表格抖动问题
  beforeUpdate() {
    this.$nextTick(() => {
      this.$refs["fromTable"].doLayout()
        if(this.$refs["fromTable"]){
            this.$refs["fromTable"].doLayout()
        }
    })
  }
}
@@ -426,7 +442,7 @@
 }
  .el-input__inner {
    // text-align: left;
    text-align: center !important;
    // text-align: center !important;
  }
}
</style>