<template>
  <div id="">
    <a-layout style="height:520px;">
      <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.xzZrr">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
            </a-radio-group>
            <a-button v-if="addObj.xzZrr =='2'" type="link" @click="addProblem('xzZrr')">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="责任人姓名">
            <a-input v-model:value="formObj.xzZrrnm" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="责任人电话" prop="xzZrrtel" v-if="formObj.xzZrr == '1'">
            <a-input v-model:value="formObj.xzZrrtel" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="责任人职务" v-if="formObj.xzZrr == '1'">
            <a-input v-model:value="formObj.xzZrrzw" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="行政责任人是否正式发文明确" v-if="formObj.xzZrr == '1'">
            <a-radio-group v-model:value="addObj.xzFwmq">
              <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="formObj.xzFwmq =='2' || formObj.xzFwmq =='3'" type="link" @click="addProblem('xzFwmq',formObj.xzFwmq)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="行政责任人履责能力" v-if="formObj.xzZrr == '1'">
            <a-radio-group v-model:value="addObj.xzLznl">
              <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="formObj.xzLznl =='3'"
              type="link"
              @click="addProblem('xzLznl',formObj.xzLznl)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="行政责任人是否接受岗位培训" v-if="formObj.xzZrr == '1'">
            <a-radio-group v-model:value="addObj.xzGwpx">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button
              v-if="formObj.xzGwpx =='0'"
              type="link"
              @click="addProblem('xzGwpx',formObj.xzGwpx)">
              <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.zgZrr">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button
              v-if="formObj.zgZrr =='0'"
              type="link"
              @click="addProblem('zgZrr',formObj.zgZrr)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="责任人姓名" v-if="formObj.zgZrr == '1'">
            <a-input v-model:value="formObj.zgZrrnm" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="责任人电话" prop="superPersTel" v-if="formObj.zgZrr == '1'">
            <a-input v-model:value="formObj.zgZrrtel" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="责任人职务" v-if="formObj.zgZrr == '1'">
            <a-input v-model:value="formObj.zgZrrzw" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="主管责任人是否正式发文明确" v-if="formObj.zgZrr == '1'">
            <a-radio-group v-model:value="addObj.zgFwmq">
              <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="formObj.zgFwmq =='2' || formObj.zgFwmq =='3'"
              type="link"
              @click="addProblem('zgFwmq',formObj.zgFwmq)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="主管责任人履责能力" v-if="formObj.zgZrr == '1'">
            <a-radio-group v-model:value="addObj.zgLznl">
              <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="formObj.zgLznl =='3'" type="link" @click="addProblem('zgLznl',formObj.zgLznl)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="主管责任人是否接受过岗位培训" v-if="formObj.zgZrr == '1'">
            <a-radio-group v-model:value="addObj.zgGwpx">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="formObj.zgGwpx =='0'" type="link" @click="addProblem('zgGwpx',formObj.zgGwpx)">
              <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.glZrr">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="formObj.glZrr =='0'" type="link" @click="addProblem('glZrr',formObj.glZrr)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="责任人姓名" v-if="formObj.glZrr == '1'">
            <a-input v-model:value="formObj.glZrrnm" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="责任人电话" prop="superPersTel" v-if="formObj.glZrr == '1'">
            <a-input v-model:value="formObj.glZrrtel" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="责任人职务" v-if="formObj.glZrr == '1'">
            <a-input v-model:value="formObj.glZrrzw" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="管理责任人是否正式发文明确" v-if="formObj.glZrr == '1'">
            <a-radio-group v-model:value="addObj.glFwmq">
              <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="formObj.glFwmq =='2' || formObj.glFwmq =='3'"
              type="link"
              @click="addProblem('glFwmq',formObj.glFwmq)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="管理责任人履责能力" v-if="formObj.glZrr == '1'">
            <a-radio-group v-model:value="addObj.glLznl">
              <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="formObj.glLznl =='3'" type="link" @click="addProblem('glLznl',formObj.glLznl)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="管理责任人是否接受过岗位培训" v-if="formObj.glZrr == '1'">
            <a-radio-group v-model:value="addObj.glGwpx">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="formObj.glGwpx =='0'" type="link" @click="addProblem('glGwpx',formObj.glGwpx)">
              <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.jsZrr">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="formObj.jsZrr =='0'" type="link" @click="addProblem('jsZrr',formObj.jsZrr)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="责任人姓名" v-if="formObj.jsZrr == '1'">
            <a-input v-model:value="formObj.jsZrrnm" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="责任人电话" prop="jsZrrtel" v-if="formObj.jsZrr == '1'">
            <a-input v-model:value="formObj.jsZrrtel" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="责任人职务" v-if="formObj.jsZrr == '1'">
            <a-input v-model:value="formObj.jsZrrzw" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="技术责任人是否正式发文明确" v-if="formObj.jsZrr == '1'">
            <a-radio-group v-model:value="addObj.jsFwmq">
              <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="formObj.jsFwmq =='2' || formObj.jsFwmq =='3'"
              type="link"
              @click="addProblem('jsFwmq',formObj.jsFwmq)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="技术责任人履责能力" v-if="formObj.jsZrr == '1'">
            <a-radio-group v-model:value="addObj.jsLznl">
              <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="formObj.jsLznl =='3'" type="link" @click="addProblem('jsLznl',formObj.jsLznl)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="技术责任人是否接受过岗位培训" v-if="formObj.jsZrr == '1'">
            <a-radio-group v-model:value="addObj.jsGwpx">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="formObj.jsGwpx =='0'" type="link" @click="addProblem('jsGwpx',formObj.jsGwpx)">
              <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.xcZrr">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="formObj.xcZrr =='0'" type="link" @click="addProblem('xcZrr',formObj.xcZrr)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="责任人姓名" v-if="formObj.xcZrr == '1'">
            <a-input v-model:value="formObj.xcZrrnm" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="责任人电话" prop="xcZrrtel" v-if="formObj.xcZrr == '1'">
            <a-input v-model:value="formObj.xcZrrtel" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="责任人职务" v-if="formObj.xcZrr == '1'">
            <a-input v-model:value="formObj.xcZrrzw" autocomplete="off" style="width:70%;"></a-input>
          </a-form-item>
          <a-form-item label="巡查责任人是否正式发文明确" v-if="formObj.xcZrr == '1'">
            <a-radio-group v-model:value="addObj.xcFwmq">
              <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="formObj.xcFwmq =='2' || formObj.xcFwmq =='3'"
              type="link"
              @click="addProblem('xcFwmq',formObj.xcFwmq)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="巡查责任人履责能力" v-if="formObj.xcZrr == '1'">
            <a-radio-group v-model:value="addObj.xcLznl">
              <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="formObj.xcLznl =='3'" type="link" @click="addProblem('xcLznl',formObj.xcLznl)">
              <a-icon type="plus-circle" theme="filled" />
            </a-button>
          </a-form-item>
          <a-form-item label="巡查责任人是否接受过岗位培训" v-if="formObj.xcZrr == '1'">
            <a-radio-group v-model:value="addObj.xcGwpx">
              <a-radio value="1">是</a-radio>
              <a-radio value="0">否</a-radio>
            </a-radio-group>
            <a-button v-if="formObj.xcGwpx =='0'" type="link" @click="addProblem('xcGwpx',formObj.xcGwpx)">
              <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="addHandler" 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 { addBasePres, getWgzrrlist } from '../../../api/duChaTianBao';
import request from '../../../utils/gw_ajax_request';
import { formatDateTimeD } from '../../../utils/gw_date';
import inputWith from '../../../widgets/inuptWith.vue';
import problemDialog from '../../duChaWenTi/problemDialog.vue';
export default {
  components: {
    inputWith: inputWith,
    problemDialog,
  },
  props: [
    'currentObjectId',
    'currentObjectName',
    'currentObjectRgstrId',
    'pType',
    'openType',
  ],
  data() {
    var checkTel = (rule, value, callback) => {
      var isPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/; // 座机
      var isMob = /^[1][3,4,5,7,8][0-9]{9}$/; // 座机格式
      if (value && !isMob.test(value) && !isPhone.test(value)) {
        callback(new Error('请输入合理电话'));
      } else if (value && (isMob.test(value) || isPhone.test(value))) {
        callback();
      }
      // setTimeout(() => {

      // }, 1000);
    };
    return {
      objtbStatu: {
        presStat: '',
        rgstrId: '',
      },
      rules: {
        wiunWaoLegPersTel: [{ validator: checkTel, trigger: 'blur' }],
        techPersTel: [{ validator: checkTel, trigger: 'blur' }],
        patrolPersTel: [{ validator: checkTel, trigger: 'blur' }],
      },
      formObj: {
        rgstrId: '',
        xzZrr: '', // 是否有巡查责任人
        xzZrrnm: '', // 是否有技术责任人
        xzZrrtel: '', // 是否有行政责任人
        xzZrrzw: '', // 是否有主管责任人
        xzFwmq: '', // 是否有管理责任人
        xzLznl: '', // 巡查责任人姓名
        xzGwpx: '', // 巡查责任人是否接受岗位培训
        zgZrr: '', // 巡查责任人规范性履职标准
        zgZrrnm: '', // 巡查责任人履职情况 0  1  2
        zgZrrtel: '', // 巡查责任人电话
        zgZrrzw: '', // 水库督查登记ID
        zgFwmq: '', // 技术责任人姓名
        zgLznl: '', // 技术责任人职务
        zgGwpx: '', // 技术责任人履职情况
        glZrr: '', // 技术责任人电话
        glZrrnm: '', // 技术责任人是否接受岗位培训
        glZrrtel: '', // 技术责任人规范性履职标准
        glZrrzw: '', // 行政责任人姓名
        glFwmq: '', // 行政责任人职务
        glLznl: '', // 行政责任人履职情况
        glGwpx: '', // 行政责任人电话
        jsZrr: '', // 行政责任人是否接受岗位培训
        jsZrrnm: '', // 行政责任人规范性履职标准
        // 新添加两个责任人  主管责任人和管理责任人
        jsZrrtel: '', // 主管责任人姓名
        jsZrrzw: '', // 主管责任人职务
        jsFwmq: '', // 主管责任人履职情况
        jsLznl: '', // 主管责任人电话
        jsGwpx: '', // 主管责任人是否接受岗位培训
        xcZrr: '', // 主管责任人规范性履职标准
        xcZrrnm: '', // 管理责任人姓名
        xcZrrtel: '', // 管理责任人职务
        xcZrrzw: '', // 管理责任人履职情况
        xcFwmq: '', // 管理责任人电话
        xcLznl: '',
        xcGwpx: '',

        recPersId: '',
        recPers2: '',
        recPersTel: '',
        createTime: '',
        updateTime: '',
        status: '',
      },
      dialogFormVisible: false,
      formLabelWidth: '230px',
      loading: true,
      operationType1: '',
      rsvrRules: null,
      probId: '',
      showAddProblemDialog: false,
    };
  },
  computed: {
    recPersId() {
      return localStorage.getItem('persId')
        ? localStorage.getItem('persId')
        : '';
    },
  },
  created() {
    this.findItemByType();
    this.getRgstridObj();
  },
  mounted() {
    this.getRgstridObj();
  },
  watch: {
    currentObjectRgstrId(n, o) {
      this.getRgstridObj();
    },
  },
  methods: {
    getRgstridObj() {
      getWgzrrlist(this.currentObjectRgstrId).then((res) => {
        if (res.data && Object.keys(res.data).length) {
          this.formObj = res.data;
          this.operationType1 = 'update';
        } else {
          this.formObj = {};
          this.operationType1 = 'add';
        }
      });
    },
    addHandler() {
      this.formObj['rgstrId'] = this.currentObjectRgstrId;
      this.formObj['recPersId'] = this.recPersId;
      console.log(this.formObj);
      this.objtbStatu.rgstrId = this.currentObjectRgstrId;

      if (
        this.formObj.hasWiunWaoLegPers == '2' &&
        this.formObj.jsZrr == '2' &&
        this.formObj.xcZrr == '2' &&
        this.formObj.hasSuperPers == '2' &&
        this.formObj.hasManagePers == '2'
      ) {
        this.objtbStatu.presStat = '2';
      } else {
        if (
          this.formObj.hasWiunWaoLegPers ||
          this.formObj.jsZrr ||
          this.formObj.xcZrr ||
          this.formObj.hasSuperPers ||
          this.formObj.hasManagePers
        ) {
          this.objtbStatu.presStat = '1';
        }
        if (
          this.formObj.hasWiunWaoLegPers == undefined &&
          this.formObj.hasSuperPers == undefined &&
          this.formObj.jsZrr == undefined &&
          this.formObj.hasManagePers == undefined &&
          this.formObj.xcZrr == undefined
        ) {
          this.objtbStatu.presStat = '0';
        }
        if (
          this.formObj.hasWiunWaoLegPers == '1' &&
          this.formObj.jsZrr == '2' &&
          this.formObj.xcZrr == '2' &&
          this.formObj.hasSuperPers == '2' &&
          this.formObj.hasManagePers == '2'
        ) {
          if (
            this.formObj.wiunWaoLegPersCnps &&
            this.formObj.wiunWaoLegPersTrain &&
            this.formObj.wiunWaoLegPersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '2' &&
          this.formObj.jsZrr == '1' &&
          this.formObj.xcZrr == '2' &&
          this.formObj.hasSuperPers == '2' &&
          this.formObj.hasManagePers == '2'
        ) {
          if (
            this.formObj.techPersTrain &&
            this.formObj.techPersCnps &&
            this.formObj.techPersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '2' &&
          this.formObj.jsZrr == '2' &&
          this.formObj.xcZrr == '1' &&
          this.formObj.hasSuperPers == '2' &&
          this.formObj.hasManagePers == '2'
        ) {
          if (
            this.formObj.patrolPersTrain &&
            this.formObj.patrolPersCnps &&
            this.formObj.patrolPersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '2' &&
          this.formObj.jsZrr == '2' &&
          this.formObj.xcZrr == '2' &&
          this.formObj.hasSuperPers == '1' &&
          this.formObj.hasManagePers == '2'
        ) {
          if (
            this.formObj.superPersTrain &&
            this.formObj.superPersCnps &&
            this.formObj.superPersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '2' &&
          this.formObj.jsZrr == '2' &&
          this.formObj.xcZrr == '2' &&
          this.formObj.hasSuperPers == '2' &&
          this.formObj.hasManagePers == '1'
        ) {
          if (
            this.formObj.managePersTrain &&
            this.formObj.managePersCnps &&
            this.formObj.managePersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '2' &&
          this.formObj.jsZrr == '1' &&
          this.formObj.xcZrr == '1' &&
          this.formObj.hasSuperPers == '2' &&
          this.formObj.hasManagePers == '2'
        ) {
          if (
            this.formObj.techPersTrain &&
            this.formObj.techPersCnps &&
            this.formObj.techPersResu &&
            this.formObj.patrolPersTrain &&
            this.formObj.patrolPersCnps &&
            this.formObj.patrolPersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '1' &&
          this.formObj.jsZrr == '2' &&
          this.formObj.xcZrr == '1' &&
          this.formObj.hasSuperPers == '2' &&
          this.formObj.hasManagePers == '2'
        ) {
          if (
            this.formObj.wiunWaoLegPersCnps &&
            this.formObj.wiunWaoLegPersTrain &&
            this.formObj.wiunWaoLegPersResu &&
            this.formObj.patrolPersTrain &&
            this.formObj.patrolPersCnps &&
            this.formObj.patrolPersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '1' &&
          this.formObj.jsZrr == '1' &&
          this.formObj.xcZrr == '2' &&
          this.formObj.hasSuperPers == '2' &&
          this.formObj.hasManagePers == '2'
        ) {
          if (
            this.formObj.wiunWaoLegPersCnps &&
            this.formObj.wiunWaoLegPersTrain &&
            this.formObj.wiunWaoLegPersResu &&
            this.formObj.techPersTrain &&
            this.formObj.techPersCnps &&
            this.formObj.techPersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '1' &&
          this.formObj.jsZrr == '2' &&
          this.formObj.xcZrr == '2' &&
          this.formObj.hasSuperPers == '1' &&
          this.formObj.hasManagePers == '2'
        ) {
          if (
            this.formObj.wiunWaoLegPersCnps &&
            this.formObj.wiunWaoLegPersTrain &&
            this.formObj.wiunWaoLegPersResu &&
            this.formObj.superPersTrain &&
            this.formObj.superPersCnps &&
            this.formObj.superPersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '1' &&
          this.formObj.jsZrr == '2' &&
          this.formObj.xcZrr == '2' &&
          this.formObj.hasSuperPers == '2' &&
          this.formObj.hasManagePers == '1'
        ) {
          if (
            this.formObj.wiunWaoLegPersCnps &&
            this.formObj.wiunWaoLegPersTrain &&
            this.formObj.wiunWaoLegPersResu &&
            this.formObj.managePersTrain &&
            this.formObj.managePersCnps &&
            this.formObj.managePersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '2' &&
          this.formObj.jsZrr == '1' &&
          this.formObj.xcZrr == '2' &&
          this.formObj.hasSuperPers == '1' &&
          this.formObj.hasManagePers == '2'
        ) {
          if (
            this.formObj.techPersCnps &&
            this.formObj.techPersTrain &&
            this.formObj.techPersResu &&
            this.formObj.superPersTrain &&
            this.formObj.superPersCnps &&
            this.formObj.superPersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '2' &&
          this.formObj.jsZrr == '1' &&
          this.formObj.xcZrr == '2' &&
          this.formObj.hasSuperPers == '2' &&
          this.formObj.hasManagePers == '1'
        ) {
          if (
            this.formObj.techPersCnps &&
            this.formObj.techPersTrain &&
            this.formObj.techPersResu &&
            this.formObj.managePersTrain &&
            this.formObj.managePersCnps &&
            this.formObj.managePersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '2' &&
          this.formObj.jsZrr == '2' &&
          this.formObj.xcZrr == '1' &&
          this.formObj.hasSuperPers == '1' &&
          this.formObj.hasManagePers == '2'
        ) {
          if (
            this.formObj.patrolPersCnps &&
            this.formObj.patrolPersTrain &&
            this.formObj.patrolPersResu &&
            this.formObj.superPersTrain &&
            this.formObj.superPersCnps &&
            this.formObj.superPersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '2' &&
          this.formObj.jsZrr == '2' &&
          this.formObj.xcZrr == '1' &&
          this.formObj.hasSuperPers == '2' &&
          this.formObj.hasManagePers == '1'
        ) {
          if (
            this.formObj.patrolPersCnps &&
            this.formObj.patrolPersTrain &&
            this.formObj.patrolPersResu &&
            this.formObj.managePersTrain &&
            this.formObj.managePersCnps &&
            this.formObj.managePersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
        if (
          this.formObj.hasWiunWaoLegPers == '1' &&
          this.formObj.jsZrr == '1' &&
          this.formObj.xcZrr == '1' &&
          this.formObj.hasSuperPers == '1' &&
          this.formObj.hasManagePers == '1'
        ) {
          if (
            this.formObj.techPersTrain &&
            this.formObj.techPersCnps &&
            this.formObj.techPersResu &&
            this.formObj.wiunWaoLegPersCnps &&
            this.formObj.wiunWaoLegPersTrain &&
            this.formObj.wiunWaoLegPersResu &&
            this.formObj.patrolPersTrain &&
            this.formObj.patrolPersCnps &&
            this.formObj.patrolPersResu &&
            this.formObj.superPersTrain &&
            this.formObj.superPersCnps &&
            this.formObj.superPersResu &&
            this.formObj.managePersTrain &&
            this.formObj.managePersCnps &&
            this.formObj.managePersResu
          ) {
            this.objtbStatu.presStat = '2';
          }
        }
      }

      this.$confirm({
        title: '提示',
        content: '确认保存责任人落实情况信息？',
        okType: 'warning',
        onOk: () => {
          // this.objtbStatu.presStat = "2";
          if (this.operationType1 == 'add') {
            try {
              request.post('/dc/insp/xskaqWgzrr', this.formObj).then((res) => {
                if (res.success) {
                  this.$message.success('添加成功');
                  /* request.post("/dc/insp/rsvrRgstr/update",_self.objtbStatu).then((res)=>{
                  res;
                  }) */
                  this.$emit('addShuiKuSuccess');
                }
              });
            } catch (e) {}
          } else if (this.operationType1 == 'update') {
            try {
              request
                .post('/dc/insp/xskaqWgzrr/update', this.formObj)
                .then((res) => {
                  if (res.success) {
                    this.$message.success('修改成功');
                    /* request.post("/dc/insp/rsvrRgstr/update",_self.objtbStatu).then((res)=>{
                  res;
                  }) */
                    this.$emit('addShuiKuSuccess');
                  }
                });
            } catch (e) {}
          }
        },
      });
    },
    cancelHandler() {
      this.$emit('cancelHandler');
    },
    findItemByType() {
      const obj = {
        tname: 'BIS_INSP_XSKAQ_WGZRR',
        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;
    },
    formatRadio(val) {
      if (val == '1') {
        return '是';
      } else if (val == '2') {
        return '否';
      } else {
        return val;
      }
    },
    closePlDialog(val) {
      this.showAddProblemDialog = false;
    },
  },
};
</script>

<style lang='less' scoped>

</style>
