<template>
  <div class="rule-type">
    <DialogCom
      @colse="onHide"
      title="查看"
      :visible.sync="isShow"
      width="1400px"
      destroy-on-close
      @open="openHandler"
    >
      <div class="page-body">
        <el-form
          :model="queryParams"
          size="small"
          ref="form"
          label-position="right"
          label-width="130px"
          label-prefix=":"
          :inline="true"
        >
          <el-form-item label="年月:"> {{ queryParams.date }}</el-form-item>
          <el-form-item label="机构名称:"
            >{{ queryParams.orgName }}
          </el-form-item>
        </el-form>

        <el-table :data="tableData" style="width: 100%" height="400px">
          <el-table-column label="序号" type="index" width="50">
          </el-table-column>
          <el-table-column prop="orgName" label="营业场所">
          </el-table-column>
          <el-table-column prop="orgTypeText" label="场所分类">
          </el-table-column>
          <el-table-column prop="orgScore" label="安全指数">
          </el-table-column>
          <el-table-column prop="levelName" label="安全等级">
          </el-table-column>
        </el-table>
        <pagination
          v-show="total > 0"
          :total="total"
          :page.sync="queryParams.page"
          :limit.sync="queryParams.size"
          @pagination="getDetailList"
        />
      </div>

      <div slot="footer" class="dialog-footer">
        <el-button @click="onHide">取消</el-button>
        <!-- <el-button type="primary" @click="onSubmit">确定</el-button> -->
      </div>
    </DialogCom>
  </div>
</template>

<script>
import dayjs from "dayjs";
import { mapGetters } from "vuex";
import { detail } from "@/api/scorestatistics/scorestatistics.js";
import { guid } from "@/utils/index.js";
import {
  addTargetEvaluate,
  getEvaluateById,
  editTargetEvaluate,
} from "@/api/evaluateRule/rule.js";

export default {
  dicts: ["evaluate_cycle", "sys_org_type"],
  data() {
    return {
      tableData: [],
      id: null,
      isShow: false,
      total: 0,
      queryParams: {
        page: 1,
        size: 10,
        orgId: "",
        date: null,
        levelId: "",
        orgName: null,
      },
    };
  },
  props: {
    targetList: {
      type: Array,
    },
  },
  watch: {},

  mounted() {},
  methods: {
    onOrgTypeChanged() {},
    show(row) {
     
      let month=row.dataMonth+''
      this.queryParams.date = row.dataYear + "-" + (row.dataMonth<10? '0'+month:month);
      this.queryParams.orgName = row.orgName;
      this.queryParams.orgId = row.orgId;
      this.queryParams.levelId = row.levelId;
      this.tableData = [];

      this.getDetailList();
    },
    //获取分页数据
    getDetailList() {
      detail(this.queryParams).then((res) => {
        let { code, msg, rows } = res;
        if (code == 200) {
          this.tableData = rows||[];
          this.isShow = true;
        } else {
          this.$message.error(msg);
        }
      });
    },
    // 事件
    onHide() {
      this.$refs.form.resetFields();
      this.isShow = false;
      this.queryParams = {
        page: 1,
        size: 10,
      };

      this.tableData = [];
    },
    //打开前的回调
    openHandler() {},

    // 事件
    //apimark//
  },
};
</script>

<style lang="scss" scoped>
.brand_info {
  .el-form {
    width: 600px;
    padding-top: 40px;
  }
}
.form-item-comment {
  font-size: 12px;
  color: #999;
  height: 10px;
}
.el-select {
  width: 100%;
}
</style>
