<template>
  <div class="content-main">
    <el-row>
      <el-form :inline="true" :model="formInline" class="search-bm-boder">
        <el-form-item label="企业名称:">
          <el-input
            clearable
            v-model="formInline.kdmc"
            placeholder="请输入"
          ></el-input>
        </el-form-item>

        <el-form-item>
          <div class="search-button">
            <span class="search-line"></span>
            <el-button
              type="primary"
              size="small"
              class="iconfont iconchaxun"
              @click="doSearch"
              >查询</el-button
            >
            <el-button
              type="primary"
              @click="
                formInline = {};
                doSearch();
              "
              size="small"
              class="iconfont iconzhongzhi"
              >重置</el-button
            >
          </div>
        </el-form-item>
      </el-form>
    </el-row>
    <el-row></el-row>
    <el-row>
      <el-table
        :data="tableData"
        stripe
        v-loading="listLoading"
        border
        fit
        highlight-current-row
        style="width: 100%"
      >
        <el-table-column align="center" label="序号" width="70" type="index">
        </el-table-column>
        <el-table-column
          align="center"
          prop="qymc"
          label="企业名称"
          show-overflow-tooltip
        >
        </el-table-column>
        <el-table-column
          align="center"
          prop="tyshxydm"
          label="统一社会信用代码"
          show-overflow-tooltip
        >
        </el-table-column>
        <el-table-column
          align="center"
          prop="qyxz"
          label="单位性质"
          show-overflow-tooltip
        >
        </el-table-column>

        <el-table-column align="center" label="操作" width="150">
          <template slot-scope="scope">
            <el-button
              @click="detailSubmit(scope.row)"
              type="primary"
              size="small"
              class="operate_show_btn iconfont iconchakan2"
            ></el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-row>
    <el-row>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page.sync="pageForm.page"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="pageForm.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="pageForm.total"
      ></el-pagination>
    </el-row>
  </div>
</template>

<script>
import { getYgQyxxList } from "@/api/grainReserves/accEmptywarehouse/applyManymentMaintain/index";
import {
  getCfQyxxList,
  getRyQyxxList,
  getSbQyxxList,
  getYpQyxxList,
} from "@/api/jcxxwh/jcxx";
import { dateFormat } from "@/utils/index";
// 设施, 仓房, 设备,器材, 药剂, 人员
// let list = ['ssxxsh', 'cfxxsh', 'sbxx', 'qcxxsh', 'yjxx', 'ryxx']
let list = ["cfxxsh", "ryxx", "yjxx", "ssxxsh", "sbxx", "qcxxsh"];
/*
/grainReserves/coInfo/jcxxsh/jcxx?id=1
*/
let titles = [
  "仓房信息",
  "人员信息",
  "药剂信息",
  "设施信息",
  "设备信息",
  "器材信息",
];
// 仓房, 人员, 药品, 设备,
let fns = ["getCfQyxxList", "getRyQyxxList", "getYpQyxxList", "getSbQyxxList"];
export default {
  data() {
    return {
      formInline: { kdmc: "" },
      listLoading: false,
      tableData: [],
      name: "",
      fn: "",
      pageForm: {
        pageNum: 1,
        pageSize: 10,
        total: 0,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    dateFormat: dateFormat,
    doSearch() {
      this.pageForm.page = 1;
      this.getList();
    },
    //获取列表
    getList() {
      this.listLoading = true;
      getYgQyxxList({ ...this.formInline, ...this.pageForm })
        .then((res) => {
          this.tableData = res.data.list;
          this.pageForm.total = res.data.total || 0;
          this.listLoading = false;
        })
        .catch((err) => {
          this.listLoading = false;
        });
    },

    //详情
    detailSubmit(row) {
      this.$router.push({
        name: "ygxx",
        query: {
          kddm: row.kddm,
        },
      });
      // detailsFn(id).then((res) => {
      // 	if (res.infoCode == 200) this.dialogForm = res.data
      // 	else this.$message.error(res.data)
      // })
      // this.disSign = true
      // this.addDialog = true
    },

    handleSizeChange(val) {
      this.pageForm.pageSize = val;
      this.getList();
    },
    handleCurrentChange(val) {
      this.pageForm.page = val;
      this.getList();
    },
  },
};
</script>
<style scoped>
.h3 {
  text-align: center;
  font-size: 1em;
  line-height: 2.5;
  color: #fff;
  background-color: #49a2fa;
  margin-bottom: 20px;
}
</style>
