<template>
  <div class="popupContentClass" :style="{'height':testHeight1+'px'}">
    <a-row class="rowClass">
      <a-col :span="6" class="nameClass">水库所属流域：</a-col>
      <a-col :span="6" class="valueClass" :style="{'height':testHeight+'px'}">
        {{ addObj.reverOrgName }}
      </a-col>
      <a-col :span="6" class="nameClass">所在县是否为贫困县：</a-col>
      <a-col :span="6" class="valueClass" :style="{'height':testHeight+'px'}">
        {{ addObj.poorCountry&&addObj.poorCountry == "1"?"是":
          addObj.poorCountry&&addObj.poorCountry == "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.waterRunInfo&&addObj.waterRunInfo == "1"?"能正常蓄水运行":
          addObj.waterRunInfo&&addObj.waterRunInfo == "2"?"有缺陷基本能正常蓄水运行":
          addObj.waterRunInfo&&addObj.waterRunInfo == "3"?"不具备正常蓄水运行条件仍高水位运行":
          addObj.waterRunInfo&&addObj.waterRunInfo == "4"?"不具备正常蓄水运行条件，已采取措施限制水位运行":
          addObj.waterRunInfo&&addObj.waterRunInfo == "5"?"不具备正常蓄水运行条件，已空库运行":"" }}
      </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.fsltdzInfo&&addObj.fsltdzInfo == "1"?"严格按汛限水位要求运行":
          addObj.fsltdzInfo&&addObj.fsltdzInfo == "2"?"超汛限水位运行":
          addObj.fsltdzInfo&&addObj.fsltdzInfo == "3"?"鉴定为三类坝的水库，采取限制运用措施":
          addObj.fsltdzInfo&&addObj.fsltdzInfo == "4"?"鉴定为三类坝的水库，未采取限制运用措施":"" }}
      </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.diskRunInfo&&addObj.diskRunInfo == "1"?"能正常运行":
          addObj.diskRunInfo&&addObj.diskRunInfo == "2"?"有缺陷能运行":
          addObj.diskRunInfo&&addObj.diskRunInfo == "3"?"不能运行":"" }}
      </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.hasSetMainFl&&addObj.hasSetMainFl == "1"?"是":
          addObj.hasSetMainFl&&addObj.hasSetMainFl == "2"?"否":"" }}
      </a-col>
      <a-col :span="6" class="nameClass">运行情况：</a-col>
      <a-col :span="6" class="valueClass" :style="{'height':testHeight+'px'}">
        {{ addObj.isMainFlNormal&&addObj.isMainFlNormal == "1"?"正常运行":
          addObj.isMainFlNormal&&addObj.isMainFlNormal == "2"?"能运行有缺陷":
          addObj.isMainFlNormal&&addObj.isMainFlNormal == "3"?"不能运行":"" }}
      </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.hasSetPourFl&&addObj.hasSetPourFl == "1"?"是":
          addObj.hasSetPourFl&&addObj.hasSetPourFl == "2"?"否":"" }}
      </a-col>
      <a-col :span="6" class="nameClass">运行情况：</a-col>
      <a-col :span="6" class="valueClass" :style="{'height':testHeight+'px'}">
        {{ addObj.pourFyIsNormal&&addObj.pourFyIsNormal == "1"?"正常运行":
          addObj.pourFyIsNormal&&addObj.pourFyIsNormal == "2"?"不能运行":
          addObj.pourFyIsNormal&&addObj.pourFyIsNormal == "3"?"能运行有缺陷":"" }}
      </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.hasExtDamSafeAppr&&addObj.hasExtDamSafeAppr == "1"?"是":
          addObj.hasExtDamSafeAppr&&addObj.hasExtDamSafeAppr == "2"?"否":"" }}
      </a-col>
      <a-col :span="6" v-if="addObj.hasExtDamSafeAppr == '1'" class="nameClass">开展情况：</a-col>
      <a-col :span="6" v-if="addObj.hasExtDamSafeAppr == '1'" class="valueClass" :style="{'height':testHeight+'px'}">
        {{ addObj.extDamSafeAppr&&addObj.extDamSafeAppr == "1"?"已按要求开展":
          addObj.extDamSafeAppr&&addObj.extDamSafeAppr == "2"?"未按要求开展":
          addObj.extDamSafeAppr&&addObj.extDamSafeAppr == "3"?"安全鉴定被鉴定为三类坝":"" }}
      </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.ifReinForce&&addObj.ifReinForce == "1"?"是":
          addObj.ifReinForce&&addObj.ifReinForce == "2"?"否":"" }}
      </a-col>
      <a-col :span="6" class="nameClass">实施情况：</a-col>
      <a-col :span="6" class="valueClass" :style="{'height':testHeight+'px'}">
        {{ addObj.ifComplateAccAll&&addObj.ifComplateAccAll == "1"?"已按批复内容实施":
          addObj.ifComplateAccAll&&addObj.ifComplateAccAll == "2"?"未按批复内容实施":
          addObj.ifComplateAccAll&&addObj.ifComplateAccAll == "3"?"实施后仍有隐患":
          addObj.ifComplateAccAll&&addObj.ifComplateAccAll == "4"?"已蓄水验收":"" }}
      </a-col>
    </a-row>
  </div>
</template>

<script>
import { getProjectlist } from '../../../../api/duChaTianBao';
import request from '../../../../utils/gw_ajax_request';
export default {
  components: {},
  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/rever/project/getBy/${this.currentObjectRgstrId}?repeat=0`;
      } else {
        url = `/dc/rever/project/getBy/${this.currentObjectRgstrId}`;
      }
      request.get(url).then((res) => {
        if (res.success) {
          if (res.data && Object.keys(res.data).length) {
            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>
