<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      label-width="68px"
    >
      <el-form-item label="案件编号" prop="caseNum">
        <el-input
          v-model="queryParams.caseNum"
          placeholder="请输入案件编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!-- <el-form-item label="案件状态" prop="caseStatus">
        <el-select
          v-model="queryParams.caseStatus"
          placeholder="请选择案件状态"
          clearable
          @keyup.enter.native="handleQuery"
        >
          <el-option
            v-for="dict in dict.type.case_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          ></el-option>
        </el-select>
      </el-form-item> -->
      <el-form-item label="开庭日期" prop="hearDate">
        <el-date-picker
          v-model="queryParams.hearDate"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>
    <el-table v-loading="loading" :data="dataList" style="width: 100%">
      <el-table-column label="序号" type="index" align="center">
        <template slot-scope="scope">
          <span>{{
            (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="案件编号"
        align="center"
        prop="caseNum"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="案件标的"
        align="center"
        prop="caseSubjectAmount"
      />
      <el-table-column
        label="立案日期"
        align="center"
        prop="registerDate"
        :show-overflow-tooltip="true"
      />
      <el-table-column label="案件状态" align="center" prop="caseStatusName" />
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-reading"
            @click="showDetail(scope.row)"
            v-hasPermi="['caseFiles:list:detail']"
            >归档详情</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList(queryParams)"
    />
    <!-- 弹窗 -->
    <archiveDetailsDialog
      v-if="showarchiveDetails"
      :showarchiveDetails="showarchiveDetails"
      :detailform="detailform"
      :flagLoading="flagLoading"
      @cancelpaymentdetails="cancelpaymentdetails"
      @updataList="updataList"
    ></archiveDetailsDialog>
  </div>
</template>
  
<script>
import { caseApplicationList } from "@/api/awardManagement/awardManagement";
import { adjudicationArchives } from "@/api/caseFiling/caseFiling";
import archiveDetailsDialog from "./components/archiveDetailsDialog.vue";

export default {
  name: "archiveList",
  dicts: ["case_status"],
  components: { archiveDetailsDialog },
  data() {
    return {
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      // 遮罩层
      loading: false,
      // 总条数
      total: 0,
      // 表格数据
      list: [],
      // 是否显示弹出层
      // 弹出层内容
      form: {},
      // 校验表单
      rules: {},
      dataList: [],
      detailform: {}, //详情数据
      showarchiveDetails: false, //详情数据弹框
      flagLoading: false, //详情弹框loading
    };
  },
  created() {
    this.queryParams.caseStatusList = [17];
    this.getList(this.queryParams);
  },
  methods: {
    updataList() {
      this.getList(this.queryParams);
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList(this.queryParams);
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 查询列表数据
    getList(parms) {
      this.loading = true;
      caseApplicationList(parms).then((response) => {
        this.dataList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // model框显示
    showDetail(row) {
      this.getDetail({ id: row.id });
    },
    // 关闭弹窗
    cancelpaymentdetails() {
      this.showarchiveDetails = false;
    },
    /** 查询详情 */
    getDetail(parms) {
      adjudicationArchives(parms).then((res) => {
        this.detailform = res.data;
        this.showarchiveDetails = true;
      });
    },
  },
};
</script>
  
<style lang="scss" scoped></style>