<template>
  <div class="changeApply">
    <div class="applyList" v-if="isList">
    <el-row :gutter="10" class="mb10">
      <el-col :span="1.5">

        <el-select size="small" v-model="textValue" placeholder="请选择">
        <el-option
          v-for="item in text"
          :key="item.value"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>

      <el-select size="small" v-model="ruleValue" placeholder="请选择">
        <el-option
          v-for="item in rule"
          :key="item.value"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>

      <el-input
        v-model="input"
        size="small"
        placeholder="请输入"
        clearable
        style="width: 240px"
      />

      </el-col>

      <el-col :span="1.5">
        <el-button type="primary" size="small" plain>查询</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" size="small" plain>高级查询</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" size="small" plain>重置</el-button>
      </el-col>

    </el-row>

    <el-row :gutter="10" class="mb10">
      <el-col :span="1.5">
        <el-button type="primary" size="small" plain @click="addApply">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" size="small" plain>导入</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" size="small" plain>导出</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" size="small" plain>批量提交</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" size="small" plain>批量删除</el-button>
      </el-col>
    </el-row>

    <el-card>
      <el-table 
        :data="tableList" 
        class="request-table"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column label="序号" align="center" prop="sort" />
        <el-table-column label="申请组织" align="center" prop="attributeName" />
        <el-table-column label="单据编码" align="center" prop="classCode" />
        <el-table-column label="申请人" align="center" prop="fieldType" />
        <el-table-column label="申请时间" align="center" prop="dictId" />
        <el-table-column label="单据状态" align="center" prop="fieldDesc" />
        <el-table-column label="物料编码" align="center" prop="fieldDesc" />
        <el-table-column label="物料名称" align="center" prop="fieldDesc" />
        <el-table-column label="最后审批人" align="center" prop="fieldDesc" />
        <el-table-column label="最后审核时间" align="center" prop="fieldDesc" />
        <el-table-column label="创建人" align="center" prop="fieldDesc" />
        <el-table-column label="创建时间" align="center" prop="fieldDesc" />
        <el-table-column label="最后修改人" align="center" prop="fieldDesc" />
        <el-table-column label="最后修改时间" align="center" prop="fieldDesc" />
        <el-table-column
          fixed="right"
          label="操作"
          align="center"
          >
          <template slot-scope="scope">
            <el-button type="text" size="small">查看</el-button>
            <el-button @click="edit(scope.row)" type="text" size="small">修改</el-button>
            <el-button type="text" size="small">更多</el-button>
          </template>
        </el-table-column>
      </el-table>

      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[100, 200, 300, 400]"
        :page-size="100"
        layout="total, sizes, prev, pager, next, jumper"
        :total="100"
        style="text-align: center;">
      </el-pagination>
    </el-card>
    </div>

    <component :is="isComponent" v-model="isList" v-if="!isList"/>
  </div>
</template>

<script>
import addApply from './add.vue';
export default {
  name: 'changeApply',
  components: {
    addApply
  },
  data() {
    return{
      textValue: 1,
      text: [{label: '文本字段', value: 1}, {label: '字典字段', value: 2}],
      ruleValue: 1,
      rule:[{label: '包含', value: 1}, {label: '不包含', value: 2}, {label: '等于', value: 3}, {label: '不等于', value: 4}],
      input: '',
      // 
      tableList: [],
      currentPage: 2,
      // isComponent
      isComponent:'addApply',
      isList: true
    }
  },
  methods: {
    addApply() {
      this.isList = false
      this.isComponent = 'addApply'
    },
    // 
    handleSelectionChange () {

    },
    edit() {

    },
    handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    }
  }
}
</script>

<style scoped lang="scss">
.changeApply {
  height: calc(100vh - 84px);
  padding: 12px;
  box-sizing: border-box;
}
</style>