<style lang="scss">
    
</style>
<template>
    <section>
        <p>公司管理  >  资料列表</p>
        <div class="filter">
            <el-form label-width="70px" :inline="true" size="small" label-position="left">
                <el-form-item label="名称">
                        <el-input clearable placeholder="请输入名称" v-model="form.name"></el-input>
                </el-form-item>
                <el-form-item>
                       <el-button @click="form.page=1,getData()" type="primary" icon="el-icon-search">搜索</el-button>
                       <el-button icon="el-icon-plus" @click="$router.push({path:'/company/add'})"  type="primary">新增资料</el-button>
                </el-form-item>
            </el-form>
        </div>


        <el-table
                class="table"
                :data="list" height="64vh"
                border  v-loading="loading"
                style="width: 100%">
                <el-table-column
                type="selection" fixed="left"
                width="40">
                </el-table-column>
                <el-table-column
                prop="name" 
                label="宣传资料名称">
                </el-table-column>
                <el-table-column
                prop="ctime"  width="200"
                label="时间">
                </el-table-column>
                <el-table-column fixed="right"
                prop="zip"  width="170"
                label="操作">
                <template slot-scope="scope">
                    <el-button icon="el-icon-edit" @click="$router.push({path:'/company/add',query:{id:scope.row.id}})" size="mini" type="warning">编辑</el-button>
                    <el-button icon="el-icon-delete" @click="del(scope.row.id)" size="mini"  type="danger">删除</el-button>
                </template>
                </el-table-column>
        </el-table>
        <Page  ref="pageButton"  :total='total' @pageChange='gopage'/>
    </section>
</template>
<script>
import Page from '../../components/Page';
export default {
  components:{
        Page
  },
  data(){
    return{
      form:{name:'',page:1,page_size:20},
      activeName:"1",
      total:1,
      list:[{name:'2333'}],
      loading:false
    }
  },
  methods:{
        gopage(size){
            if(size){
                this.form.page_size=size
            }
            this.form.page=this.$refs.pageButton.page
            this.getData()
        },
        getData(){
            var parm=this.form;
            this.loading=true
            // this.$api.getClass(parm).then(res=>{
            //     this.list=res.data.data.list
            //     this.total=res.data.data.total
            //     this.loading=false
            // })
        },
        del(id){
                this.$confirm('确定删除吗', '提示', {
                        type: 'warning'
                    }).then(() => {
                    this.$api.deleteClass({id:id}).then((res)=>{
                            this.$message({
                                message: '删除成功',
                                type: 'success'
                            })
                            this.getData()
                    })
                })
        },
  },
  created(){
    //   this.getData()
  }
}
</script>
