<template>
  <div class="app-container">
    <div>
      <!-- 筛选条件 -->
      <div>
        <Collapse :screen-form="screenForm">
          <template #right_btn>
            <el-button size="mini" @click="resetScreenForm">清空</el-button>
            <el-button size="mini" type="primary" @click="submitScreenForm">搜索</el-button>
          </template>
          <template #search>
            <el-form ref="screenForm" :model="screenForm" label-width="70px" size="mini" label-position="left">
              <el-row :gutter="20">
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="名称" prop="keyword">
                    <el-input placeholder="请输入名称" v-model="screenForm.keyword"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </template>
        </Collapse>
      </div>
      <div class="mymain-container">
        <div class="table">
          <el-table
            v-loading="listLoading"
            :data="dataList"
            element-loading-text="Loading"
            border
            fit
            highlight-current-row
            stripe
          >
            <el-table-column
              align="left"
              label="编码"
              prop="number"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="left"
              label="创建组织"
              prop="dictType"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="left"
              label="名称"
              prop="name"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="left"
              label="使用组织"
              prop="useOrgId"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column align="left" label="数据状态" prop="dataState" min-width="100"></el-table-column>
            <el-table-column align="left" label="禁用状态" prop="disableState" min-width="100">
              <template slot-scope="scope">
                <el-tag type="success" size="mini" v-if="scope.row.forbidStatus == 'A'">正常</el-tag>
                <el-tag type="danger" size="mini" v-else>禁用</el-tag>
              </template>
            </el-table-column>
            <el-table-column
              align="left"
              label="创建人"
              prop="createBy"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="left"
              label="创建日期"
              prop="createTime"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="left"
              label="修改人"
              prop="updateBy"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="left"
              label="修改日期"
              prop="updateTime"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <!-- <el-table-column
              align="left"
              label="审核人"
              prop="examine"
              min-width="100"
            ></el-table-column>
            <el-table-column
              align="left"
              label="审核日期"
              prop="examineDate"
              min-width="100"
            ></el-table-column>
            <el-table-column
              align="left"
              label="禁用人"
              prop="disable"
              min-width="100"
            ></el-table-column>
            <el-table-column
              align="left"
              label="禁用日期"
              prop="disableDate"
              min-width="100"
            ></el-table-column> -->
          </el-table>
        </div>
        <!-- 分页 -->
        <div class="fr">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[10, 20, 30, 50]"
            :page-size="10"
            layout="total, sizes, prev, pager, next, jumper"
            :total="listTotal"
          >
          </el-pagination>
        </div>
      </div>
    </div>
    <!-- <CategoryListDetail v-else /> -->
  </div>
</template>

<script>
import CategoryListDetail from './components/category_list-detail.vue'
import { getCategoryList } from '@/api/basic_data/material'
import Mixin from '@/mixin/index'

export default {
  mixins: [Mixin],
  data() {
    return {
      isShow: true,
      currentPage: 1, // 当前页码
      pageSize: 10, // 每页数量
      listTotal: 0, // 列表总数
      dataList: [
        {
          code: 'ASDVDS_ASD',
          createOrganize: '广州格匠机电工程',
          name: '原材料',
          useOrganize: '广州格匠机电工程',
          dataState: '已审核',
          disableState: '否',
          create: 'Administrator',
          createDate: '1993/8/8',
          modify: 'Administrator',
          modifyDate: '1993/8/8',
          examine: 'Administrator',
          examineDate: '1993/8/8',
          disable: '',
          disableDate: ''
        },
        {
          code: 'ASDVDS_ASD',
          createOrganize: '广州格匠机电工程',
          name: '原材料',
          useOrganize: '广州格匠机电工程',
          dataState: '已审核',
          disableState: '否',
          create: 'Administrator',
          createDate: '1993/8/8',
          modify: 'Administrator',
          modifyDate: '1993/8/8',
          examine: 'Administrator',
          examineDate: '1993/8/8',
          disable: '',
          disableDate: ''
        },
        {
          code: 'ASDVDS_ASD',
          createOrganize: '广州格匠机电工程',
          name: '原材料',
          useOrganize: '广州格匠机电工程',
          dataState: '已审核',
          disableState: '否',
          create: 'Administrator',
          createDate: '1993/8/8',
          modify: 'Administrator',
          modifyDate: '1993/8/8',
          examine: 'Administrator',
          examineDate: '1993/8/8',
          disable: '',
          disableDate: ''
        },
        {
          code: 'ASDVDS_ASD',
          createOrganize: '广州格匠机电工程',
          name: '原材料',
          useOrganize: '广州格匠机电工程',
          dataState: '已审核',
          disableState: '否',
          create: 'Administrator',
          createDate: '1993/8/8',
          modify: 'Administrator',
          modifyDate: '1993/8/8',
          examine: 'Administrator',
          examineDate: '1993/8/8',
          disable: '',
          disableDate: ''
        }
      ],
      screenForm: {
        keyword: ''
      },
      isCollapse: true
    }
  },
  components: {
    CategoryListDetail
  },
  methods: {
    editFn() {
      this.isShow = false
    },
    // 初始化数据
    getList() {
      this.listLoading = true
      let params = {
        pageNum: this.currentPage,
        pageSize: this.pageSize,
        keyword: this.screenForm.keyword
      }
      getCategoryList(params).then(res => {
        this.dataList = res.data.records
        this.listTotal = res.data.total
        this.listLoading = false
      })
    }
  }
}
</script>

<style></style>
