<template>
  <basic-container>
  <el-alert
    title="可独立修改私有项目的归档规则，不会影响其他项目归档规则"
    type="warning"
    :closable="false">
  </el-alert>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
               :permission="permissionList"
              
               v-model="form"
               ref="crud"
             
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
       <template slot-scope="{type,size,row}" slot="menu">
        <el-button icon="el-icon-setting" :size="size" :type="type" @click="configurationClick(row)">配置规则</el-button>
       
      </template>
    </avue-crud>
  </basic-container>
</template>

<script>
// import {getList, getDetail, add, update, remove} from "@/api/tentative/testcollect";
import { getProjectList } from "@/api/manager/projectinfo";
import {mapGetters} from "vuex";

export default {
  data() {
    return {
      form: {},
      query: {},
      loading: true,
      page: {
        pageSize: 20,
        currentPage: 1,
        total: 0
      },
      search:{},
      selectionList: [],
      option: {
        
        addBtn:false,
        editBtn:false,
        delBtn:false,
        menuWidth:330,
        height:'auto',
        calcHeight: 30,
        tip: false,
        searchShow: false,
        searchMenuSpan: 0,
        border: true,
        index: true,
       
        selection: false,
        dialogClickModal: false,
        labelWidth:150,
        column: [
          {
            label: "项目名称",
            prop: "projectName",
            rules: [{
              required: true,
              message: "请输入分类名称",
              trigger: "blur"
            }]
          }
        ]
      },
      data: [],
    };
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        viewBtn: false,
        //addBtn: this.vaildData(this.permission.imageclassificationconfig_add, false),
        //viewBtn: this.vaildData(this.permission.imageclassificationconfig_view, false),
        //delBtn: this.vaildData(this.permission.imageclassificationconfig_delete, false),
       // editBtn: this.vaildData(this.permission.imageclassificationconfig_edit, false)
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    }
  },
  methods: {




  
 
    currentChange(currentPage){
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize){
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    // onLoad(page, params = {}) {
    //   this.loading = true;
    //   getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
    //     const data = res.data.data;
         
    //     this.page.total = data.total;
    //     // this.data = data.records;
    //      this.data = [{name:'重庆乌江白马枢纽工程项目'}]
    //     this.loading = false;
    //     this.selectionClear();
    //   });
    // },
    onLoad(page, params = {}) {
      this.loading = true;
      getProjectList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
        const data = res.data.data;
         
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
      });
    },
    configurationClick(row){
      //console.log(row);
      //return;
      this.$router.push({
        path: '/manager/projectinfo/archivetreeRule',
        query: {
          projectId:row.id,
        }
      });
    },
 
  }
};
</script>

<style>
</style>
