<template>
  <div>
    <el-container>
        <el-header>
            <div id="step1">
              <mySearch style="width:500px" :SearchFields="searchFiled" @search="search" :searchValue="searchOption" :disabled="!$permission('/workspace/project/check')"></mySearch>  
            </div>
            <div style="display:flex;margin-right:10px">
                <!-- <div>
                    <span>分组查询：</span>
                    <el-select v-model="queryParams.group" :disabled="!$permission('/workspace/project/check')" multiple clearable collapse-tags size="small" @change="onChange" style="width:200px">
                        <el-option v-for="item in commonData.QUERY_GROUP" :key="item.value" :label="item.label" :value="parseInt(item.value)">
                        </el-option>
                    </el-select>
                </div> -->
                <el-button-group class="margin-left_10">
                  <el-button :type="queryShowType === '0' ? 'primary' : ''" @click="onChange2('0')" size="small">列表</el-button>
                  <el-button :type="queryShowType === '1' ? 'primary' : ''" @click="onChange2('1')" size="small">卡片</el-button>
                </el-button-group>
                <el-dropdown trigger="click" split-button type="primary" size="small" id="step2">
                    <p @click="handleAdd" v-disabled="!$permission('/workspace/project/add')">新增其他企业专利数据库</p>
                    <el-dropdown-menu slot="dropdown" class="text-align_center">
                        <!-- <el-dropdown-item @click.native="handleExport">导出列表</el-dropdown-item> -->
                        <!-- <el-dropdown-item @click.native="handleImport" :disabled="!$permission('/workspace/project/import')">导入数据包</el-dropdown-item>
                        <el-dropdown-item @click.native="handleField">显示栏位管理</el-dropdown-item> -->
                    </el-dropdown-menu>
                </el-dropdown>
            </div>
        </el-header>
        <el-main>
            <component :is="viewType" :data="dataList" :group="queryParams.group" :params="queryParams" @option="handleOption" @sort="handleSort"></component> 
        </el-main>
        <el-footer>
            <div>
                <el-pagination
                    backgroundx
                    layout="total, prev, pager, next, jumper"
                    :current-page.sync="queryParams.current"
                    :page-size.sync="queryParams.size"
                    @current-change="handleCurrentChange"
                    :total="total">
                </el-pagination>
            </div>
        </el-footer>
    </el-container>
    <addAndEditDB ref="addAndEditDB"></addAndEditDB>
  </div>
</template>

<script>

import addAndEditDB from './components/dialog/addAndEditDB.vue';
import commonTable from './components/view/commonTable.vue';
export default {
  components: {
    commonTable,
    addAndEditDB
  },
  props: {},
  data() {
    return {
        viewType:'commonTable',
        queryShowType:'0',
        dataList:[],
        queryParams:{
            size:10,
            current:0,
        },
        total:0,
        searchFiled:[
            {
                label:'企业名称',
                value:'name',
                type:1,
                placeholder:'请输入企业名称'
            },
            {
                label:'企业专利数据库类型',
                value:'type',
                type:1,
                placeholder:'请输入企业专利数据库类型'
            },
        ],
        searchOption:{}
    };
  },
  watch: {},
  computed: {},
  created() {},
  mounted() {},
  methods: {
    search(){

    },
    handleSort(sort) {
      this.queryParams.sort = { ...sort }
      this.getList()
    },
    handleOption({ option, row }) {
      switch (option) {
        case '0'://设置定时任务
            this.$refs.addAndEditDB.open(row,true)
            break;
        case '1'://删除
            break;
        case 'e'://编辑
            this.$refs.addAndEditDB.open(row)
          break;
      }
    },
    handleCurrentChange(val) {
      this.queryParams.current = val;
      this.getList();
    },
    getList(){

    },
    //添加其他企业专利数据库
    handleAdd(){
        this.$refs.addAndEditDB.open({})
    },
  },
};
</script>
<style lang="scss" scoped>
</style>