<template>
  <div class="data-list">


      <el-table :data="dataList" style="width: 100%" header-row-class-name="headerBg" empty-text="没有项目信息">
        <el-table-column prop="id" label="ID" align="center" width="80"/>
        <el-table-column prop="title" label="名称" align="left" min-width="180"/>
        <el-table-column prop="createTime" label="创建时间" align="center" width="150"/>
        <el-table-column prop="statusName" label="状态" align="center" width="150"/>
        <el-table-column label="操作" align="center" width="150">
          <template #default="scope">
            <div class="btns">
              <el-button type="primary" size="small" @click="btnEdit(scope.row)"><svg-icon icon-class="edit"/>编辑</el-button>
              <el-button type="danger" size="small"><svg-icon icon-class="delete"/>删除</el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>



      <div class="page-info">
      	<el-pagination
      	v-model:currentPage="queryForm.page"
      	:page-size="queryForm.pageSize"
      	:total="recordCount"
      	:page-count="pageTotal"
      	 background
      	 layout="prev, pager, next"
      	 @current-change="ChangePage"
      	 >
      	 </el-pagination>
      </div>

     <el-dialog  :visible.sync="dialogVisible" append-to-body v-el-drag-dialog  width="80%" custom-class="prod-verify" title="创建项目信息">

          <dataInfo ></dataInfo>
      </el-dialog>

  </div>


</template>

<script>
  import{searchProject} from'@/api/project';
  import dataInfo from './dataInfo.vue';
  import elDragDialog from '@/directive/el-drag-dialog'
  export default{
    components:{
      dataInfo,
    },
    directives: { elDragDialog },
    props:{
      queryForm:{
        type:Object,
        default:()=>{
          return {
            page:1,
            pageSize:10,
            name:'',
            sign:'',
          }
        }
      }
    },
    watch:{

        'queryForm': {
          handler: function(val) {

            this.search();
          },
          // immediate: true,//立即执行
          deep: true

        },
    },
    data(){
      return{
        dialogVisible:false,//控制产品审核
        currentDataId:0,
        recordCount:0,
        pageTotal:1,
        dataList:[],
        currentData:{},
      }
    },
    mounted() {
      this.search();
    },
    methods:{

      onFocusVal(e){
        let _this=this;
        _this.currentDataId=e.target.dataset.id;
      },

      onChangeVal(e){
        let _this=this;
        let par={
          id:_this.currentDataId,
          val:e,
        };

      },

      searchData(){
        let _this=this;
        _this.dialogVisible=false;
        _this.search();
      },


      //编辑
      btnEdit(e){
        let _this=this;
        _this.currentData=_this.dataList[e];
        _this.dialogVisible=true;
      },

      handleClose(){
        let _this=this;
        _this.currentData={};
        _this.dialogVisible=false;
      },

      //搜索
      search(){
        let _this=this;

        _this.dataList=[{
          id:1,
          title:'项目001',
          intro:'介绍',
          statusName:"启用",
          createTime:"2023-10-11"
        }];
        _this.recordCount=1;
        _this.pageTotal=1;
        // searchProject(_this.queryForm).then(res=>{
        //   if(!res)return;
        //   _this.dataList=res.data.data;
        //   _this.recordCount=res.data.recordCount;
        //   _this.pageTotal=res.data.pageTotal;
        // })
      },
      //修改分页
      ChangePage(e){
      	let _this=this;
      	_this.queryForm.page=e;
      	_this.search();
      },
    }
  }
</script>

<style lang="scss">
@import './dataList.scss';
</style>
