<template>
  <div class="popupContentClass" :style="{'height':testHeight1+'px'}">
    <div style="margin-top:20px;">
      <div style="display: flex;align-items: center;margin-bottom: 10px">
        <div style="width: 4px;height: 14px;background: rgba(44,158,255,1);border-radius: 1px;margin-right: 10px;"></div>
        <span style="font-size:14px;font-family:MicrosoftYaHei;color:rgba(51,51,51,1);">管理机构及经费</span>
      </div>
    </div>
    <a-row class="rowClass">
      <a-col :span="6" class="nameClass">是否有管理机构：</a-col>
      <a-col :span="6" class="valueClass" :style="{'height':testHeight+'px'}">
        {{ addObj.hasSpeManage&&addObj.hasSpeManage == "1"?"是":
          addObj.hasSpeManage&&addObj.hasSpeManage == "2"?"否":"" }}
      </a-col>
      <a-col :span="6" v-if="addObj.hasSpeManage == '1'" class="nameClass">是否有稳定经费来源：</a-col>
      <a-col :span="6" v-if="addObj.hasSpeManage == '1'" class="valueClass" :style="{'height':testHeight+'px'}">
        {{ addObj.hasWdEmnic&&addObj.hasWdEmnic == "1"?"是":
          addObj.hasWdEmnic&&addObj.hasWdEmnic == "2"?"否":"" }}
      </a-col>
    </a-row>
    <div style="margin-top:20px;">
      <div style="display: flex;align-items: center;margin-bottom: 10px">
        <div style="width: 4px;height: 14px;background: rgba(44,158,255,1);border-radius: 1px;margin-right: 10px;"></div>
        <span style="font-size:14px;font-family:MicrosoftYaHei;color:rgba(51,51,51,1);">注册登记情况</span>
      </div>
    </div>
    <a-row class="rowClass">
      <a-col :span="6" class="nameClass">是否注册登记：</a-col>
      <a-col :span="6" class="valueClass" :style="{'height':testHeight+'px'}">
        {{ addObj.ifManageReg&&addObj.ifManageReg == "1"?"是":
          addObj.ifManageReg&&addObj.ifManageReg == "2"?"否":""
        }}
      </a-col>
      <a-col :span="6" v-if="addObj.ifManageReg == '1'" class="nameClass">注册登记信息准确情况：</a-col>
      <a-col :span="6" v-if="addObj.ifManageReg == '1'" class="valueClass" :style="{'height':testHeight+'px'}">
        {{ addObj.ifManageRegRel&&addObj.ifManageRegRel == "1"?"信息准确":
          addObj.ifManageRegRel&&addObj.ifManageRegRel == "2"?"存在错误或虚假信息":"" }}
      </a-col>
    </a-row>
    <div style="margin-top:20px;">
      <div style="display: flex;align-items: center;margin-bottom: 10px">
        <div style="width: 4px;height: 14px;background: rgba(44,158,255,1);border-radius: 1px;margin-right: 10px;"></div>
        <span style="font-size:14px;font-family:MicrosoftYaHei;color:rgba(51,51,51,1);">公示情况</span>
      </div>
    </div>
    <a-row class="rowClass">
      <a-col :span="6" class="nameClass">是否设置水库公示牌：</a-col>
      <a-col :span="18" class="valueClass" :style="{'height':testHeight+'px'}">
        {{ addObj.ifDamWarnLogo&&addObj.ifDamWarnLogo == "1"?"已设置水库公示牌":
          addObj.ifDamWarnLogo&&addObj.ifDamWarnLogo == "2"?"未设置水库公示牌":"" }}
      </a-col>
    </a-row>
    <div style="margin-top:20px;">
      <div style="display: flex;align-items: center;margin-bottom: 10px">
        <div style="width: 4px;height: 14px;background: rgba(44,158,255,1);border-radius: 1px;margin-right: 10px;"></div>
        <span style="font-size:14px;font-family:MicrosoftYaHei;color:rgba(51,51,51,1);">安全运行总体评价</span>
      </div>
    </div>
    <a-row class="rowClass">
      <a-col :span="6" class="nameClass">安全评价：</a-col>
      <a-col :span="18" class="valueClass" :style="{'height':testHeight+'px'}">
        {{ addObj.safeComment&&addObj.safeComment == "1"?"正常安全运行":
          addObj.safeComment&&addObj.safeComment == "2"?"存在一定安全隐患但能正常运行":
          addObj.safeComment&&addObj.safeComment == "3"?"存在重大安全隐患不能安全运行":"" }}
      </a-col>
    </a-row>
  </div>
</template>

<script>
import { getManagelist } from '../../../../api/duChaTianBao';
import request from '../../../../utils/gw_ajax_request';
export default {
  props: ['currentObjectRgstrId', 'dialogHeightA', 'isJiangXi'],
  data() {
    return {
      testHeight: (window.innerHeight * 0.5 - 114) / 6,
      testHeight1: window.innerHeight * 0.5,
      dialogFormVisible: false,
      formLabelWidth: '180px',
      loading: true,
      addObj: {
        // 注意有几个字段无法确认，需要掉接口查看
        mngrnId: '',
        rgstrId: '',
        recPersId: '',
        safeCommontNote: '',
        safeComment: '',
        retainRegular: '',
        hasRetainRegular: '',
        hasWdEmnic: '',
        hasManagePers: '',
        hasSpeManage: '',
        noRetainRegular: '',
        canNotRetainWater: '',
        dikeHasLeak: '',
        leakMakeSafe: '',
        hasAstable: '',
        hasSetMainFl: '',
        isMainFlNormal: '',
        hasSetPourFl: '',
        pourFyIsNormal: '',
        havFlLowLimLev: '',
        gtFlLowLimLev: '',
        extDamSafeAppr: '',
        ifReinForce: '',
        ifComplateAccAll: '',
        ifManageRegRel: '',
        manageRegRelNote: '',
        ifDamWarnLogo: '',
        recPers2: '',
        recPersTel: '',
        status: '',
        // 注意有几个字段无法确认，需要掉接口查看
      },
      operationType1: '',
    };
  },
  computed: {
    recPersId() {
      return localStorage.getItem('persId')
        ? localStorage.getItem('persId')
        : '1098101939614724096';
    },
  },
  mounted() {
    this.getformList();
  },
  watch: {
    currentObjectRgstrId(n, o) {
      this.getformList();
    },
  },
  methods: {
    getformList() {
      let url;
      if (this.isJiangXi) {
        url = `/dc/insp/safeExtManage/get/${this.currentObjectRgstrId}?repeat=0`;
      } else {
        url = `/dc/insp/safeExtManage/get/${this.currentObjectRgstrId}`;
      }
      request.get(url).then((res) => {
        if (res.success) {
          if (res.data) {
            this.addObj = res.data;
            this.operationType1 = 'update';
          } else {
            this.addObj = {};
            this.operationType1 = 'add';
          }
        } else {
        }
      });
    },
    // 保存
    makesure() {
      this.addObj['rgstrId'] = this.currentObjectRgstrId;
      this.addObj['recPersId'] = this.recPersId;
      var params = {
        bisInspSafeExtManage: this.addObj,
      };
      if (this.operationType1 == 'add') {
        request.post('/dc/insp/safeExtManage', this.addObj).then((res) => {
          if (res.success) {
            this.$message.success('添加成功');
            this.$emit('addShuiKuSuccess');
          }
        });
      } else if (this.operationType1 == 'update') {
        request
          .post('/dc/insp/safeExtManage/update', this.addObj)
          .then((res) => {
            if (res.success) {
              this.$message.success('修改成功');
              this.$emit('addShuiKuSuccess');
            }
          });
      }
    },
    // 查看
    makeshow(type, row) {
      this.dialogFormVisible = true;
    },
    formatRadio(val) {
      if (val == '1') {
        return '是';
      } else if (val == '0') {
        return '否';
      } else {
        return val;
      }
    },
    cancelHandler() {
      this.$emit('cancelHandler');
    },
  },
};
</script>

<style lang='less' scoped>
@import "../../../../assets/style/popup.css";
</style>
