table 表格实现左边固定 右边动态数据渲染

看看效果图吧
在这里插入图片描述
在这里插入图片描述
代码走起:

<template>

<div id="app">
  
  <el-button @click="isshoetancclick"> 打开弹窗</el-button>
  <!-- 日需求 -->
  <div class="app-box" style="margin:40 20px">
    <div class="xiaobox">
      <span>日需求</span>
      <span>2020
        <span></span>
        <span></span>
      </span>
    </div>
    <!-- toptable -->
    <el-form @submit.prevent.native="sunbmitclick" class="toptable">
      <el-table
        @row-click="rowClick"
        :header-cell-style="{background:'#eef1f6',color:'#606266',height:'50px',}"
        :row-style="{'height': '50px'}"
        align="center"
        fit
        :data="tableData" 
        border
        style="width: 100%">
        <!-- 左固定信息  第一列数据-->
           <el-table-column
            align="center"
            prop="date1"
            label="确定需求"
            width="200">
          </el-table-column>
        <!-- 表头信息 -->
         <!-- <template
            slot="header"
            slot-scope="slot"
            v-for="(intm,index) in arryue"
          > -->
          <el-table-column v-for="(item,index) in tableHead" 
            :key="index" 
            :label="item.label" 
            :property="item.property" 
            :index="item.index" 
            align="center"
            :width="item.width"
            @cell-click="cellClick"
        >
        <template slot-scope="scoped">
          <span>{{ item.property?item.property : "--"}}</span>
        </template>
        </el-table-column>
      </el-table>
    </el-form>
    <!--  xiatable -->
       <el-form @submit.prevent.native="sunbmitclick" class="xiatable">
      <el-table
        :header-cell-style="{background:'#eef1f6',color:'#606266',height:'50px',}"
        :row-style="{'height': '50px'}"
        align="center"
        fit
        :data="tableData" 
        border
        style="width: 100%">
        <!-- 左固定信息  第一列数据-->
           <el-table-column
            align="center"
            prop="date2"
            label="预计需求"
            width="200">
          </el-table-column>
        <!-- 表头信息 -->
         <!-- <template
            slot="header"
            slot-scope="slot"
            v-for="(intm,index) in arryue"
          > -->
          <el-table-column v-for="(item,index) in tableHead" 
            :key="index" 
            :label="item.label" 
            :property="item.property" 
            :index="item.index" 
            align="center"
            :width="item.width"
            @cell-click="cellClick"
        >
        <template slot-scope="scoped">
          <span>{{ item.property?item.property : "--"}}</span>
        </template>
        </el-table-column>
      </el-table>
    </el-form>
    
  </div>
 
    <!-- 周需求 -->
   <div class="app-box" style="margin:40 20px">
       <div class="xiaobox">
          <span>周需求</span>
          <span>2020
            <span></span>
            <span></span>
          </span>
      </div>
     <el-form @submit.prevent.native="sunbmitclick" class="toptable">
      <el-table
        :header-cell-style="{background:'#eef1f6',color:'#606266',height:'50px',}"
        :row-style="{'height': '50px'}"
        align="center"
        fit
        :data="tableData" 
        border
        style="width: 100%">
        <!-- 左固定信息  第一列数据-->
           <el-table-column
            align="center"
            prop="date1"
            label="确定需求"
            width="200">
          </el-table-column>
        <!-- 表头信息 -->
         <!-- <template
            slot="header"
            slot-scope="slot"
            v-for="(intm,index) in arryue"
          > -->
          <el-table-column v-for="(item,index) in tableHeadweek" 
            :key="index" 
            :label="item.label1" 
            :property="item.property1" 
            :index="item.index" 
            align="center"
            :width="item.width"
            @cell-click="cellClick"
        >
        <template slot-scope="scoped">
          <span>{{ item.property?item.property : "--"}}</span>
        </template>
        </el-table-column>
      </el-table>
    </el-form>
     
     <!-- xiatable -->
      <el-form @submit.prevent.native="sunbmitclick" class="xiatable">
      <el-table
        :header-cell-style="{background:'#eef1f6',color:'#606266',height:'50px',}"
        :row-style="{'height': '50px'}"
        align="center"
        fit
        :data="tableData" 
        border
        style="width: 100%">
        <!-- 左固定信息  第一列数据-->
           <el-table-column
            align="center"
            prop="date2"
            label="预计需求"
            width="200">
          </el-table-column>
        <!-- 表头信息 -->
          <el-table-column v-for="(item,index) in tableHeadweek" 
            :key="index" 
            :label="item.label1" 
            :property="item.property1" 
            :index="item.index" 
            align="center"
            :width="item.width"
            @cell-click="cellClick"
        >
        <template slot-scope="scoped">
          <span>{{ item.property?item.property : "--"}}</span>
        </template>
        </el-table-column>
      </el-table>
    </el-form>

   </div>
   <!-- yue需求 -->
    <div class="app-box" style="margin:40 20px">
    <div class="xiaobox">
      <span>月需求</span>
      <span>2020
        <span></span>
        <span></span>
      </span>
    </div>
    <!-- toptable -->
    <el-form @submit.prevent.native="sunbmitclick" class="toptable">
      <el-table
        :header-cell-style="{background:'#eef1f6',color:'#606266',height:'50px',}"
        :row-style="{'height': '50px'}"
        align="center"
        fit
        :data="tableData" 
        border
        style="width: 100%">
        <!-- 左固定信息  第一列数据-->
           <el-table-column
            align="center"
            prop="date1"
            label="确定需求"
            width="200">
          </el-table-column>
        <!-- 表头信息 -->
         <!-- <template
            slot="header"
            slot-scope="slot"
            v-for="(intm,index) in arryue"
          > -->
          <el-table-column v-for="(item,index) in tableHeadyue" 
            :key="index" 
            :label="item.label" 
            :property="item.property" 
            :index="item.index" 
            align="center"
            :width="item.width"
            @cell-click="cellClick"
        >
        <template slot-scope="scoped">
          <span>{{ item.property?item.property : "--"}}</span>
        </template>
        </el-table-column>
      </el-table>
    </el-form>
    <!--  xiatable -->
       <el-form @submit.prevent.native="sunbmitclick" class="xiatable">
      <el-table
        :header-cell-style="{background:'#eef1f6',color:'#606266',height:'50px',}"
        :row-style="{'height': '50px'}"
        align="center"
        fit
        :data="tableData" 
        border
        style="width: 100%">
        <!-- 左固定信息  第一列数据-->
           <el-table-column
            align="center"
            prop="date2"
            label="预计需求"
            width="200">
          </el-table-column>
        <!-- 表头信息 -->
         <!-- <template
            slot="header"
            slot-scope="slot"
            v-for="(intm,index) in arryue"
          > -->
          <el-table-column v-for="(item,index) in tableHeadyue" 
            :key="index" 
            :label="item.label" 
            :property="item.property" 
            :index="item.index" 
            align="center"
            :width="item.width"
            @cell-click="cellClick"
        >
        <template slot-scope="scoped">
          <span>{{ item.property?item.property : "--"}}</span>
        </template>
        </el-table-column>
      </el-table>
    </el-form>
    
  </div>
    
   <!-- 季度需求 -->
     <div class="app-box" style="margin:40 20px">
       <div class="xiaobox">
          <span>季度需求</span>
          <span>2020
            <span></span>
            <span></span>
          </span>
      </div>
     <el-form @submit.prevent.native="sunbmitclick" class="toptable">
      <el-table
        :header-cell-style="{background:'#eef1f6',color:'#606266',height:'50px',}"
        :row-style="{'height': '50px'}"
        align="center"
        fit
        :data="tableData" 
        border
        style="width: 100%">
        <!-- 左固定信息  第一列数据-->
           <el-table-column
            align="center"
            prop="date1"
            label="确定需求"
            width="200">
          </el-table-column>
        <!-- 表头信息 -->
          <el-table-column v-for="(item,index) in tableHeadjidu" 
            :key="index" 
            :label="item.label1" 
            :property="item.property2" 
            :index="item.index" 
            align="center"
            :width="item.width"
            @cell-click="cellClick"
        >
        <template slot-scope="scoped">
          <span>{{ item.property2?item.property2 : "--"}}</span>
        </template>
        </el-table-column>
      </el-table>
    </el-form>
     
     <!-- xiatable -->
      <el-form @submit.prevent.native="sunbmitclick" class="xiatable">
      <el-table
        :header-cell-style="{background:'#eef1f6',color:'#606266',height:'50px',}"
        :row-style="{'height': '50px'}"
        align="center"
        fit
        :data="tableData" 
        border
        style="width: 100%">
        <!-- 左固定信息  第一列数据-->
           <el-table-column
            align="center"
            prop="date2"
            label="预计需求"
            width="200">
          </el-table-column>
        <!-- 表头信息 -->
          <el-table-column v-for="(item,index) in tableHeadjidu" 
            :key="index" 
            :label="item.label1" 
            :property="item.property2" 
            :index="item.index" 
            align="center"
            :width="item.width"
            @cell-click="cellClick"
        >
        <template slot-scope="scoped">
          <span>{{ item.property2?item.property2 : "--"}}</span>
        </template>
        </el-table-column>
      </el-table>
    </el-form>

   </div>
  
  
  <!-- 弹框 -->
  <Tanchuang
  :gridData="gridData"
  @backclose="backclose"
  :titlename="titlename"
  :visibleisshow="ishow"
  ></Tanchuang>
  </div>
</template>
<script type="text/javascript">
import Tanchuang from './components/tanchaung'
// 调用接口 获取数据
export default {
  name: 'app',
  components: {
    Tanchuang
    // elTableColumn
  },
  data () {
    return {
      
      titlename:"今晚打老虎",
      ishow:false,
      loading:false,
      // 天数据
      tableHead:[{
          label:"1" ,
          property:"9" ,
         
          width:'100px'
      },
      {
         label:"2" ,
        
          property:"99" ,
          width:'50px'

      },
      {
         label:"3" ,
         
         property:"999" ,
           width:'70px'
      },
      {
         label:"4" ,
       
         property:"9" ,
           width:'60px'

      },
      {
         label:"5" ,
         property:"11" ,
         width:'60px'
      },
       {
         label:"6" ,
         property:"" ,
         width:'60px'
      },
      {
         label:"7" ,
         property:"" ,
          width:'60px'
      },
      {
         label:"8" ,
         property:"" ,
          width:'60px'

      },
      {
         label:"9" ,
         property:"919" ,
          width:'60px'
        
      },
      {
         label:"10" ,
         property:"12" ,
          width:'60px'
      },
      {
         label:"11" ,
         property:"93239" ,
          width:'60px'

      },
      {
         label:"12" ,
         property:"994" ,
          width:'auto'
        
      },
      {
          label:"13" ,
          property:"9" ,
         
          width:'100px'
      },
      {
         label:"14" ,
        
          property:"99" ,
          width:'50px'

      },
      {
         label:"15" ,
         
         property:"999" ,
           width:'70px'
      },
      {
         label:"16" ,
       
         property:"9" ,
           width:'60px'

      },
      {
         label:"17" ,
         property:"11" ,
         width:'60px'
      },
       {
         label:"18" ,
         property:"" ,
         width:'60px'
      },
      {
         label:"19" ,
         property:"" ,
          width:'60px'
      },
      {
         label:"20" ,
         property:"" ,
          width:'60px'

      },
      {
         label:"20" ,
         property:"919" ,
          width:'60px'
        
      },
      {
         label:"22" ,
         property:"12" ,
          width:'60px'
      },
      {
         label:"23" ,
         property:"93239" ,
          width:'60px'

      },
      {
         label:"24" ,
         property:"994" ,
          width:'auto'
        
      },
      {
         label:"25" ,
         property:"919" ,
          width:'60px'
        
      },
      {
         label:"26" ,
         property:"12" ,
          width:'60px'
      },
      {
         label:"28" ,
         property:"93239" ,
          width:'60px'

      },
      {
         label:"31" ,
         property:"994" ,
          width:'auto'
        
      }
      ],
      //  月需求数据data
       tableHeadyue:[{
          label:"1" ,
          property:"9" ,
         
          width:'100px'
      },
      {
         label:"2" ,
        
          property:"99" ,
          width:'50px'

      },
      {
         label:"3" ,
         
         property:"999" ,
           width:'70px'
      },
      {
         label:"4" ,
       
         property:"9" ,
           width:'60px'

      },
      {
         label:"5" ,
         property:"11" ,
         width:'60px'
      },
       {
         label:"6" ,
         property:"" ,
         width:'60px'
      },
      {
         label:"7" ,
         property:"" ,
          width:'60px'
      },
      {
         label:"8" ,
         property:"" ,
          width:'60px'

      },
      {
         label:"9" ,
         property:"919" ,
          width:'60px'
        
      },
      {
         label:"10" ,
         property:"12" ,
          width:'60px'
      },
      {
         label:"11" ,
         property:"93239" ,
          width:'60px'

      },
      {
         label:"12" ,
         property:"994" ,
          width:'auto'
        
      }],
      // 季度需求 数据
      tableHeadjidu:[
        {
          label1:"第一季度" ,
          property2:"9" ,
          width:'auto'
        },
        {
          label1:"第二季度" ,
          property2:"" ,
          width:'auto'
        },
          {
          label1:"第三季度" ,
          property2:"94" ,
          width:'auto'
        },
        {
          label1:"第四季度" ,
          property2:"98" ,
          width:'auto'
        }
      ],
      // 周数据
         tableHeadweek:[{
          label1:"第一周" ,
          property1:"9" ,
          width:'100px'
      },
      {
         label:"2" ,
         label1:"第二周" ,
          property1:"94" ,
          
          width:'100px'

      },
      {
         label:"3" ,
         label1:"第三周" ,
          property1:"19" ,
         property:"999" ,
           width:'70px'
      },
      {
         label:"4" ,
         label1:"第四周" ,
          property1:"9" ,
         property:"9" ,
           width:'160px'

      },
      {
          label1:"第五周" ,
          property1:"9" ,
           width:'100px'
      },
       {
          label1:"第六周" ,
          property1:"9" ,
           width:'100px'
      },
      {
          label1:"第六周" ,
          property1:"9" ,
           width:'100px'
      },
      {
         label1:"第六周" ,
          property1:"9" ,
           width:'100px'

      },
      {
          label1:"第六周" ,
          property1:"9" ,
           width:'100px'
        
      },
      {
        label1:"第六周" ,
          property1:"9" ,
           width:'100px'
      },
      {
        label1:"第六周" ,
          property1:"9" ,
           width:'100px'

      },
      {
          label1:"第十周" ,
          property1:"9" ,
           width:'100px'
        
      }
      ],
       tableData: [
         // 固定值
         {  
            date1: '不许师傅金额(万)',
              date2: '金收入金额(万)',
            propindexerty:"2" ,
        }, 
         {
           date1: '炽然傅金额(万)',
            propindexerty:"2" ,
             date2: '一年营业饿(万)',
          },
        ],

       value: null,
        dialogImageUrl: '',
        active: 0,
        defaultProps: {
          children: 'children',
          label: 'label'
        },
      todos: [
        {
          id: 0,
          text: 'ziwei0',
          isComplete: false
        },
        {
          text: 'ziwei1',
          id: 1,
          isComplete: true
        },
        {
          text: 'ziwei2',
          id: 2,
          isComplete: false
        },
        {
          text: 'ziwei3',
          id: 3,
          isComplete: false
        }
      ],
     
    }
  },
  active:{

  },
  methods: {
    // 表头 tianjia
   adddataheaderlist(){

   },

    // 弹窗出现事件
    isshoetancclick(){
      console.log('点击了')
      //  this.ishow=true
       this.ishow=!this.ishow
    },
    backclose( val){
      // console.log(val)
      this.ishow=val
    },
    // 点击每一项时触发的函数
    cellClick(row, column, cell, event){
     console.log('点击了1111',row, column, cell, event)
    },
      btnclick(){
              this.dialogVisible=!this.dialogVisible
      },
      goBack() {
        console.log('go back');
      },
      handleRemove(file, fileList) {
        console.log(file, fileList);
      },
      handlePictureCardPreview(file) {
        this.dialogImageUrl = file.url;
        this.dialogVisible = true;
      },
          handleRemove(file, fileList) {
        console.log(file, fileList);
      },
      handlePreview(file) {
        console.log(file);
      },
      handleExceed(files, fileList) {
        this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
      },
      beforeRemove(file, fileList) {
        return this.$confirm(`确定移除 ${ file.name }?`);
      },
     
     next() {
        if (this.active++ > 3) this.active = 0;
      },
    cliclww(){
     console.log(123)
    },
    changesclick(e){
        console.log(e)
    },
    addclick(a,s,d){
      console.log('123',a,s,d)
    },
    callbackclick(){
      console.log('GUANBIL')
    },
    rowClick(val,index){
     console.log("rowClick",val,index)
    }
  }



}
</script>
<style lang="scss" scoped>
.app-box{
  margin: 40px 40px;
  .xuqiu-pageintion{
     float: right;
     .xiaobox{
       height: 30px;
       line-height: 30px;
       text-align: center;
       display: flex;
       justify-content: flex-start;
       color: aqua;
       font-size: 20px;
       margin-bottom: 20px;
     }
  }
   .el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  
  }
  .el-table__header-wrapper {
    table-layout: fixed;
    border-collapse: separate;
    text-align: center;
    background-color: pink !important;
    height:80px;
  }
  .headerCell-classname{
    background: #abcdef;
  
  }
  .el-aside {
    color: #333;
  }
    .el-dropdown {
    vertical-align: top;
  }
  .el-dropdown + .el-dropdown {
    margin-left: 15px;
  }
  .el-icon-arrow-down {
    font-size: 12px;
  }
  // xiatable
  .xiatable{
    margin-top: 30px;
  } 




}
</style>

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值