<template>
  <div id="">
    <a-layout>
      <a-layout-content style="border:1px solid #d5d5ff;margin-left:5px;padding:0px;">
        <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">信息填报</p>
        <a-form :model="addObj" :label-col="{span: 10}" :wrapper-col="{span: 14}" :rules="rules">
          <p style="margin-top:10px;margin-bottom: 10px">
            <a-icon type="caret-right" /><span style="width:120px;padding-left: 10px">挡水建筑物</span><span class="hrs"></span>
          </p>
          <a-form-item label="挡水建筑物是否能正常运行">
            <a-radio-group v-model:value="addObj.dsJzwyx">
              <a-radio value="1">能正常运行</a-radio>
              <a-radio value="2">有缺陷能运行</a-radio>
              <a-radio value="3">不能安全运行</a-radio>
            </a-radio-group>
          </a-form-item>
          <a-form-item label="是否存在突出问题" v-if="addObj.dsJzwyx != '1'">
            <a-radio-group v-model:value="addObj.dsTcwt">
              <a-radio value="1">存在明显漏水影响安全</a-radio>
              <a-radio value="2">存在变形或不稳定</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
          </a-form-item>
          <a-form-item label="混凝土或砌石坝坝身是否存在漏水现象，土石坝坝后是否存在散浸现象" v-if="addObj.dsJzwyx != '1'">
            <a-radio-group v-model:value="addObj.dsHntbls">
              <a-radio value="1">无</a-radio>
              <a-radio value="2">轻微渗漏</a-radio>
              <a-radio value="3">明显渗漏</a-radio>
              <a-radio value="4">渗漏范围和渗漏量不断增大，影响运行安全</a-radio>
            </a-radio-group>
            <a-button
              v-if="addObj.dsHntbls =='2' ||
                addObj.dsHntbls =='3' ||
                addObj.dsHntbls =='4'"
              type="link"
              @click="addProblem('dsHntbls',addObj.dsHntbls)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="土石坝是否出现渗流异常且出现流土、管涌或漏洞现象" v-if="addObj.dsJzwyx != '1'">
            <a-radio-group v-model:value="addObj.dsTsbsl">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.dsTsbsl =='1'" type="link" @click="addProblem('dsTsbsl',addObj.dsTsbsl)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="建筑物是否存在明显变形、不稳定或有滑坡迹象" v-if="addObj.dsJzwyx != '1'">
            <a-radio-group v-model:value="addObj.dsJzwbx">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.dsJzwbx =='1'" type="link" @click="addProblem('dsJzwbx',addObj.dsJzwbx)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="建筑物是否存在裂缝、塌坑、凹陷、隆起等现象" v-if="addObj.dsJzwyx != '1'">
            <a-radio-group v-model:value="addObj.dsJzwlf">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">是，并影响运行安全</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button
              v-if="addObj.dsJzwlf =='1' ||
                addObj.dsJzwlf =='2'"
              type="link"
              @click="addProblem('dsJzwlf',addObj.dsJzwlf)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="土石坝是否出现反滤排水缺失、破损、塌陷、淤堵等情况" v-if="addObj.dsJzwyx != '1'">
            <a-radio-group v-model:value="addObj.dsTsbps">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
          </a-form-item>
          <a-form-item label="土石坝高度" v-if="addObj.dsTsbps == '1' && addObj.dsJzwyx != '1'">
            <a-radio-group v-model:value="addObj.dsTsbgd">
              <a-radio value="1">15m以下低坝</a-radio>
              <a-radio value="2">坝高15m～30m</a-radio>
              <a-radio value="3">坝高30m以上</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.dsTsbgd != '0'" type="link" @click="addProblem('dsTsbgd',addObj.dsTsbgd)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="是否存在蚁害及动物洞穴等孔洞" v-if="addObj.dsJzwyx != '1'">
            <a-radio-group v-model:value="addObj.dsCzyh">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">是，并影响运行安全</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.dsCzyh =='1' || addObj.dsCzyh =='2'" type="link" @click="addProblem('dsCzyh',addObj.dsCzyh)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="近坝库岸是否存在不稳定边坡" v-if="addObj.dsJzwyx != '1'">
            <a-radio-group v-model:value="addObj.dsBwdbp">
              <a-radio value="1">存在裂缝、位移、危岩、落石等情况</a-radio>
              <a-radio value="2">已有失稳趋势</a-radio>
              <a-radio value="3">不存在</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.dsBwdbp =='1' || addObj.dsBwdbp =='2'" type="link" @click="addProblem('dsBwdbp',addObj.dsBwdbp)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="排水沟是否塌陷或存在淤堵" v-if="addObj.dsJzwyx != '1'">
            <a-radio-group v-model:value="addObj.dsPsgyd">
              <a-radio value="1">是，但不影响排水</a-radio>
              <a-radio value="2">是，已影响排水</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button
              v-if="addObj.dsPsgyd !='3'"
              type="link"
              @click="addProblem('dsPsgyd',addObj.dsPsgyd)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <p style="margin-top:10px;margin-bottom: 10px">
            <a-icon type="caret-right" /><span style="width:120px;padding-left: 10px">泄洪建筑物</span><span class="hrs"></span>
          </p>
          <a-form-item label="有无泄洪建筑物（如有要求）">
            <a-radio-group v-model:value="addObj.xhXhjzw">
              <a-radio value="1">有</a-radio>
              <a-radio value="0">无</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.xhXhjzw =='0'" type="link" @click="addProblem('xhXhjzw',addObj.xhXhjzw)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="行洪设施是否符合相关规定和要求" v-if="addObj.xhXhjzw == '1'">
            <a-radio-group v-model:value="addObj.xhSsfhgd">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.xhSsfhgd =='0'" type="link" @click="addProblem('xhSsfhgd',addObj.xhSsfhgd)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="泄洪建筑物是否能正常运行" v-if="addObj.xhXhjzw == '1'">
            <a-radio-group v-model:value="addObj.xhJzwyx">
              <a-radio value="1">能正常运行</a-radio>
              <a-radio value="2">有缺陷能运行</a-radio>
              <a-radio value="3">不能安全运行</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.xhJzwyx =='3'" type="link" @click="addProblem('xhJzwyx',addObj.xhJzwyx)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="泄洪建筑物是否存在明显变形、不稳定或有滑坡迹象" v-if="addObj.xhXhjzw == '1'">
            <a-radio-group v-model:value="addObj.xhJzwbx">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">泄洪建筑物位于土坝上或采用坝下泄洪洞</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.xhJzwbx != '3'" type="link" @click="addProblem('xhJzwbx',addObj.xhJzwbx)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="泄洪建筑物是否存在裂缝、塌坑、凹陷、隆起等" v-if="addObj.xhXhjzw == '1'">
            <a-radio-group v-model:value="addObj.xhJzwlf">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">泄洪建筑物位于土坝上或采用坝下泄洪洞</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.xhJzwlf != '3'" type="link" @click="addProblem('xhJzwlf',addObj.xhJzwlf)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="泄洪建筑物是否岸坡及边墙失稳" v-if="addObj.xhXhjzw == '1'">
            <a-radio-group v-model:value="addObj.xhJzwbqsw">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">泄洪建筑物位于土坝上或采用坝下泄洪洞</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.xhJzwbqsw != '3'" type="link" @click="addProblem('xhJzwbqsw',addObj.xhJzwbqsw)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="泄洪时是否会冲刷坝体及下游坝脚等" v-if="addObj.xhXhjzw == '1'">
            <a-radio-group v-model:value="addObj.xhCsbt">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.xhCsbt =='1'" type="link" @click="addProblem('xhCsbt',addObj.xhCsbt)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="溢洪道基础及边墙是否渗水" v-if="addObj.xhXhjzw == '1'">
            <a-radio-group v-model:value="addObj.xhYhdss">
              <a-radio value="1">轻微渗漏不影响运行安全</a-radio>
              <a-radio value="2">明显渗漏影响运行安全</a-radio>
              <a-radio value="3">泄洪建筑物位于土坝上或采用坝下泄洪洞</a-radio>
              <a-radio value="4">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.xhYhdss !='4'" type="link" @click="addProblem('xhYhdss', addObj.xhYhdss)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="泄洪通道是否畅通" v-if="addObj.xhXhjzw == '1'">
            <a-radio-group v-model:value="addObj.xhXhttct">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.xhXhttct =='1'" type="link" @click="addProblem('xhXhttct',addObj.xhXhttct)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <p style="margin-top:10px;margin-bottom: 10px">
            <a-icon type="caret-right" /><span style="width:120px;padding-left: 10px">放水建筑物</span><span class="hrs"></span>
          </p>
          <a-form-item label="是否设置放水建筑物">
            <a-radio-group v-model:value="addObj.fsFsjzw">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
          </a-form-item>
          <a-form-item label="放水建筑物能否正常运行" v-if="addObj.fsFsjzw == '1'">
            <a-radio-group v-model:value="addObj.fsJzwyx">
              <a-radio value="1">能</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.fsJzwyx =='0'" type="link" @click="addProblem('fsJzwyx',addObj.fsJzwyx)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="放水建筑物是否存在明显变形、不稳定或有滑坡迹象" v-if="addObj.fsFsjzw == '1'">
            <a-radio-group v-model:value="addObj.fsJzwbx">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">是，并且坝下埋涵（管）</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.fsJzwbx !='3'" type="link" @click="addProblem('fsJzwbx',addObj.fsJzwbx)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="放水建筑物是否存在裂缝、塌坑、凹陷、隆起等" v-if="addObj.fsFsjzw == '1'">
            <a-radio-group v-model:value="addObj.fsJzwlf">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">是，并且坝下埋涵（管）</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.fsJzwlf !='3'" type="link" @click="addProblem('fsJzwlf',addObj.fsJzwlf)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="放水建筑物涵（洞、虹吸管）出口附近是否有渗漏" v-if="addObj.fsFsjzw == '1'">
            <a-radio-group v-model:value="addObj.fsJzwsl">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">是，并且坝下埋涵（管）</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.fsJzwsl !='3'" type="link" @click="addProblem('fsJzwsl',addObj.fsJzwsl)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="放水建筑物管（洞）身是否有损坏、渗漏" v-if="addObj.fsFsjzw == '1'">
            <a-radio-group v-model:value="addObj.fsJzwsh">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">是，并且坝下埋涵（管）</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.fsJzwsh !='3'" type="link" @click="addProblem('fsJzwsh',addObj.fsJzwsh)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="放水建筑物出口段水流有杂物带出、浑浊" v-if="addObj.fsFsjzw == '1'">
            <a-radio-group v-model:value="addObj.fsCskhz">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">是，并且坝下埋涵（管）</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.fsCskhz !='3'" type="link" @click="addProblem('fsCskhz',addObj.fsCskhz)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <p style="margin-top:10px;margin-bottom: 10px">
            <a-icon type="caret-right" /><span style="width:120px;padding-left: 10px">除险加固</span><span class="hrs"></span>
          </p>
          <a-form-item label="是否按要求除险加固">
            <a-radio-group v-model:value="addObj.jgCxjg">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.jgCxjg =='0'" type="link" @click="addProblem('jgCxjg',addObj.jgCxjg)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="是否按批复内容实施除险加固" v-if="addObj.jgCxjg == '1'">
            <a-radio-group v-model:value="addObj.jgPfnrjg">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-radio value="3">否，并影响运行安全</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.jgPfnrjg =='3' || addObj.jgPfnrjg =='2'" type="link" @click="addProblem('jgPfnrjg',addObj.jgPfnrjg)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="除险加固后投入运行前是否蓄水验收" v-if="addObj.jgCxjg == '1'">
            <a-radio-group v-model:value="addObj.jgXsys">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.jgXsys =='0'" type="link" @click="addProblem('jgXsys',addObj.jgXsys)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="实施除险加固过程中是否存在违规行为" v-if="addObj.jgCxjg == '1'">
            <a-radio-group v-model:value="addObj.jgJgwgxw">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">是，并影响运行安全</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.jgJgwgxw !='3'" type="link" @click="addProblem('jgJgwgxw',addObj.jgJgwgxw)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="是否如期下达投资计划实施除险加固" v-if="addObj.jgCxjg == '1'">
            <a-radio-group v-model:value="addObj.jgRqcxjg">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-radio value="3">否，并影响运行安全</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.jgRqcxjg !='1'" type="link" @click="addProblem('jgRqcxjg',addObj.jgRqcxjg)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="除险加固是否超设计工期" v-if="addObj.jgCxjg == '1'">
            <a-radio-group v-model:value="addObj.jgCsjgq">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">是，并影响运行安全</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.jgCsjgq !='3'" type="link" @click="addProblem('jgCsjgq',addObj.jgCsjgq)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="水库实施除险加固后是否仍存在隐患" v-if="addObj.jgCxjg == '1'">
            <a-radio-group v-model:value="addObj.jgAqyh">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">是，并影响运行安全</a-radio>
              <a-radio value="3">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.jgAqyh !='3'" type="link" @click="addProblem('jgAqyh',addObj.jgAqyh)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <p style="margin-top:10px;margin-bottom: 10px">
            <a-icon type="caret-right" /><span style="width:120px;padding-left: 10px">其他</span><span class="hrs"></span>
          </p>
          <a-form-item label="是否擅自实施或未及时发现并制止各类影响工程泄洪能力的行为">
            <a-radio-group v-model:value="addObj.jgSzss">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.jgSzss =='1'" type="link" @click="addProblem('jgSzss',addObj.jgSzss)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="坝下建筑物与坝体连接部位是否有接触渗漏现象或失稳征兆">
            <a-radio-group v-model:value="addObj.jgBxsl">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.jgBxsl =='1'" type="link" @click="addProblem('jgBxsl',addObj.jgBxsl)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="工程存在其他实体缺陷">
            <a-radio-group v-model:value="addObj.jgStqx">
              <a-radio value="1">一般缺陷</a-radio>
              <a-radio value="2">较重缺陷</a-radio>
              <a-radio value="3">影响运行安全</a-radio>
              <a-radio value="4">无缺陷</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.jgStqx !='4'" type="link" @click="addProblem('jgStqx',addObj.jgStqx)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item :wrapper-col="{ span: 14, offset: 10 }">
            <a-button type="primary" @click="makesure" v-if="openType">保 存</a-button>
          </a-form-item>
        </a-form>
      </a-layout-content>
      <problem-dialog
        v-if="showAddProblemDialog && openType"
        :objType="pType"
        :villType="0"
        :objId="currentObjectId"
        :objName="currentObjectName"
        :problemMiddleType="'小水库'"
        :problData="probId"
        @closeDialog="closePlDialog"
        :currentObjectRgstrId="currentObjectRgstrId"> </problem-dialog>
    </a-layout>
  </div>
</template>

<script>
import { getGcstlist, getLyjglist } from '../../../api/duChaTianBao';
import request from '../../../utils/gw_ajax_request';
import problemDialog from '../../duChaWenTi/problemDialog.vue';
export default {
  components: {
    problemDialog,
  },
  props: [
    'currentObjectId',
    'currentObjectName',
    'currentObjectRgstrId',
    'pType',
    'openType',
  ],
  data() {
    return {
      objtbStatu: {
        reverStat: '',
        rgstrId: '',
      },
      dxdcMainHeight: window.innerHeight - 197,
      dialogFormVisible: false,
      formLabelWidth: '350px',
      loading: true,
      addObj: {
        // 注意有几个字段无法确认，需要掉接口查看
        rgstrId: '',
        dsJzwyx: '',
        // waterRunInfo: "",
        // fsltdzInfo: "",
        dsTcwt: '',
        dsHntbls: '',
        dsTsbsl: '',
        dsJzwbx: '',
        dsJzwlf: '',
        dsTsbps: '',
        dsTsbgd: '',
        dsCzyh: '',
        dsBwdbp: '',
        dsPsgyd: '',
        xhXhjzw: '',
        xhSsfhgd: '',
        xhJzwyx: '',
        xhJzwbx: '',
        xhJzwlf: '',
        xhJzwbqsw: '',
        xhCsbt: '',
        xhYhdss: '',
        xhXhttct: '',
        fsFsjzw: '',
        fsJzwyx: '',
        fsJzwbx: '',
        fsJzwlf: '',
        fsJzwsl: '',
        fsJzwSH: '',
        fsCskhz: '',
        jgCxjg: '',
        jgPfnrjg: '',
        jgJgwgxw: '',
        jgRqcxjg: '',
        jgCsjgq: '',

        jgAqyh: '',
        jgSzss: '',
        jgBxsl: '',
        jgStqx: '',
        jgXsys: '',
        recPersId: '',
        recPers2: '',
        recPersTel: '',
        createTime: '',
        updateTime: '',
        status: '',
        // 注意有几个字段无法确认，需要掉接口查看
      },
      operationType1: '',
      lyjg: [],
      placeholder: '',
      rsvrRules: null,
      probId: '',
      showAddProblemDialog: false,
    };
  },
  computed: {
    recPersId() {
      return localStorage.getItem('persId')
        ? localStorage.getItem('persId')
        : '1098101939614724096';
    },
  },
  created() {
    this.findItemByType();
  },
  mounted() {
    this.getLyList();
    this.getformList();
  },
  watch: {
    currentObjectRgstrId(n, o) {
      this.getformList();
    },
  },
  methods: {
    // 获取流域信息
    getLyList() {
      request.get(`/dc/insp/base/getInspByPid?pid=''`).then((res) => {
        if (res.success) {
          this.lyjg = res.data;
          this.placeholder = this.lyjg[0].pnm;
          this.addObj.reverOrg = this.lyjg[0].id;
          this.getformList();
        } else {
          this.getformList();
        }
      });
    },
    getformList() {
      getGcstlist(this.currentObjectRgstrId).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;
      this.objtbStatu.rgstrId = this.currentObjectRgstrId;
      if (
        this.addObj.reverOrg ||
        this.addObj.poorCountry ||
        this.addObj.diskRunInfo ||
        this.addObj.hasSetMainFl ||
        this.addObj.hasSetPourFl
      ) {
        this.objtbStatu.reverStat = '1';
      }
      if (
        this.addObj.reverOrg &&
        this.addObj.poorCountry &&
        this.addObj.diskRunInfo &&
        this.addObj.hasSetMainFl &&
        this.addObj.hasSetPourFl
      ) {
        this.objtbStatu.reverStat = '2';
      }
      if (
        this.addObj.reverOrg == undefined &&
        this.addObj.poorCountry == undefined &&
        this.addObj.diskRunInfo == undefined &&
        this.addObj.hasSetMainFl == undefined &&
        this.addObj.hasSetPourFl == undefined
      ) {
        this.objtbStatu.reverStat = '0';
      }

      this.$confirm({
        title: '提示',
        content: '确认保存水库工程实体信息吗？',
        okType: 'warning',
        onOk: () => {
          if (this.operationType1 == 'add') {
            request.post('/dc/insp/xskaqGcst', this.addObj).then((res) => {
              if (res.success) {
                this.$message.success('添加成功');
                /* request
                  .post("/dc/insp/rsvrRgstr/update", _self.objtbStatu)
                  .then(res => {
                    res;
                  }); */
                this.$emit('addShuiKuSuccess');
                this.getformList();
              }
            });
          } else {
            request
              .post('/dc/insp/xskaqGcst/update', this.addObj)
              .then((res) => {
                if (res.success) {
                  this.$message.success('修改成功');
                  /* request
                    .post("/dc/insp/rsvrRgstr/update", _self.objtbStatu)
                    .then(res => {
                      res;
                    }); */
                  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');
    },
    findItemByType() {
      const obj = {
        tname: 'BIS_INSP_XSKAQ_GCST',
        type: this.pType,
      };
      request
        .post('/bis/insp/item/ques/info/findItemByType', obj)
        .then((res) => {
          this.rsvrRules = res.data;
        });
    },
    addProblem(item, iValue) {
      const rest = this.rsvrRules.filter((e) => {
        return e.iValue === iValue && e.eName === item;
      });
      if (rest[0]) {
        this.probId = rest[0].id;
      }
      this.showAddProblemDialog = true;
    },
    closePlDialog(val) {
      this.showAddProblemDialog = false;
    },
    dsTsbpschangeHandler(value) {
      // TODO:根据基础信息中的最大坝高自动选择土石坝高度选项
      console.log('dsTsbpschangeHandler -' + value);
      /* if (value === '1'){
        console.log("this.addObj.damSizeHig -" + this.addObj.damSizeHig);
        if (this.addObj.damSizeHig < 15){
          this.addObj.dsTsbgd=1;
        }
        if (this.addObj.damSizeHig >= 15 && this.addObj.damSizeHig <= 30){
          this.addObj.dsTsbgd=2;
        }
        if (this.addObj.damSizeHig >30){
          this.addObj.dsTsbgd=3;
        }
      } */
    },
  },
};
</script>

<style lang='less' scoped>

</style>
