<template>
  <div id="">
    <a-layout>
      <a-layout-content style="border:1px solid #d5d5ff;margin-left:5px;padding:0px;overflow: auto;">
        <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;margin-bottom: 20px">信息填报</p>
        <a-form :model="formObj" :label-col="{ span: 10 }" :wrapper-col="{ span: 14 }" :rules="rules">
          <p style="margin-top:10px;margin-bottom: 10px;overflow: hidden;">
            <a-icon type="caret-right" />
            <span style="width:120px;padding-left: 10px">立案</span>
            <span class="hrs"></span>
          </p>
          <a-form-item label="案卷中要是否有立案审批表" required>
            <a-radio-group v-model:value="formObj.isMakApp">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isMakApp == '2'" type="link" @click="addProblem('isMakApp')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <a-form-item label="立案审批表内栏目是否已填写" required>
            <a-radio-group v-model:value="formObj.isAppFill">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isAppFill == '2'" type="link" @click="addProblem('isAppFill')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <p style="margin-top:10px;margin-bottom: 10px;overflow: hidden;">
            <a-icon type="caret-right" />
            <span style="width:120px;padding-left: 10px">调查取证</span>
            <span class="hrs"></span>
          </p>
          <a-form-item label="调查笔录、勘验笔录等是否有当事人签名签时间" required>
            <a-radio-group v-model:value="formObj.isListSign">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isListSign == '2'" type="link" @click="addProblem('isListSign')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <a-form-item label="照片是否包含摄制人、时间、地点等要素" required>
            <a-radio-group v-model:value="formObj.isContTm">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isContTm == '2'" type="link" @click="addProblem('isContTm')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <p style="margin-top:10px;margin-bottom: 10px;overflow: hidden;">
            <a-icon type="caret-right" />
            <span style="width:120px;padding-left: 10px">认定情况</span>
            <span class="hrs"></span>
          </p>
          <a-form-item label="案卷中是否有结案报告" required>
            <a-radio-group v-model:value="formObj.isEndRpt">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isEndRpt == '2'" type="link" @click="addProblem('isEndRpt')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <a-form-item label="集体讨论记录中参会人员是否各自手写签名" required>
            <a-radio-group v-model:value="formObj.isMeetSign">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isMeetSign == '2'" type="link" @click="addProblem('isMeetSign')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <p style="margin-top:10px;margin-bottom: 10px;overflow: hidden;">
            <a-icon type="caret-right" />
            <span style="width:120px;padding-left: 10px">告知情况</span>
            <span class="hrs"></span>
          </p>
          <a-form-item label="案卷中是否有行政处罚事先告知书" required>
            <a-radio-group v-model:value="formObj.isPubBook">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isPubBook == '2'" type="link" @click="addProblem('isPubBook')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <a-form-item label="对个人作出超过0.5万元（法人或者其他组织超过5万元）罚款、责令停产停业、吊销许可证件等处罚的，案卷中是否包含行政处罚听证告知书" required>
            <a-radio-group v-model:value="formObj.isOverRpt">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isOverRpt == '2'" type="link" @click="addProblem('isOverRpt')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <p style="margin-top:10px;margin-bottom: 10px;overflow: hidden;">
            <a-icon type="caret-right" />
            <span style="width:120px;padding-left: 10px">决定程序</span>
            <span class="hrs"></span>
          </p>
          <a-form-item label="案卷是否加盖水利局公章的行政处罚决定书" required>
            <a-radio-group v-model:value="formObj.isSealPnsh">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isSealPnsh == '2'" type="link" @click="addProblem('isSealPnsh')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <a-form-item label="决定书中是否有明确的法律依据，收款银行、账户、账号等信息" required>
            <a-radio-group v-model:value="formObj.isSureNra">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isSureNra == '2'" type="link" @click="addProblem('isSureNra')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <p style="margin-top:10px;margin-bottom: 10px;overflow: hidden;">
            <a-icon type="caret-right" />
            <span style="width:120px;padding-left: 10px">送达程序</span>
            <span class="hrs"></span>
          </p>
          <a-form-item label="行政处罚事项告知书、听证告知书、行政处罚决定书等是否附有对应的送达回证，并有签字" required>
            <a-radio-group v-model:value="formObj.isSignBack">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isSignBack == '2'" type="link" @click="addProblem('isSignBack')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <p style="margin-top:10px;margin-bottom: 10px;overflow: hidden;">
            <a-icon type="caret-right" />
            <span style="width:120px;padding-left: 10px">执行程序</span>
            <span class="hrs"></span>
          </p>
          <a-form-item label="案卷中是否有银行缴款凭证、财政部门监制的罚没票据，转款凭证和票据金额一致" required>
            <a-radio-group v-model:value="formObj.isAgreeBill">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isAgreeBill == '2'" type="link" @click="addProblem('isAgreeBill')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <p style="margin-top:10px;margin-bottom: 10px;overflow: hidden;">
            <a-icon type="caret-right" />
            <span style="width:120px;padding-left: 10px">结案情况</span>
            <span class="hrs"></span>
          </p>
          <a-form-item label="行政处罚执行到位的案卷，是否装订成册" required>
            <a-radio-group v-model:value="formObj.isPnshBind">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isPnshBind == '2'" type="link" @click="addProblem('isPnshBind')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <a-form-item label="到期未执行到位的案卷，是否向法院申请强制执行" required>
            <a-radio-group v-model:value="formObj.isAppCompel">
              <a-radio value="1">是</a-radio>
              <a-radio value="2">否</a-radio>
              <a-button v-if="formObj.isAppCompel == '2'" type="link" @click="addProblem('isAppCompel')">
                <a-icon type="plus-circle" theme="filled" />
              </a-button>
            </a-radio-group>
          </a-form-item>
          <a-form-item :wrapper-col="{ span: 10, offset: 14 }">
            <a-button type="primary" @click="makesure('addObj')" v-if="openType">保 存</a-button>
          </a-form-item>
        </a-form>
      </a-layout-content>
      <problem-dialog
        v-if="showAddProblemDialog && openType"
        :objType="85"
        :villType="85"
        :objId="currentObjectId"
        :objName="currentObjectName"
        :problemMiddleType="'水行政执法'"
        :problData="probId"
        @closeDialog="closePlDialog"
        :currentObjectRgstrId="currentObjectRgstrId"></problem-dialog>
    </a-layout>
  </div>
</template>

<script>
import { getRgstridWtgovjxDssr } 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',
    '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 {
      id: '',
      objtbStatu: {
        scencState: '',
        rgstrId: '',
        id: '',
        state: '',
      },
      rules: {
        wiunWaoLegPersTel: [{ validator: checkTel, trigger: 'blur' }],
        techPersTel: [{ validator: checkTel, trigger: 'blur' }],
        patrolPersTel: [{ validator: checkTel, trigger: 'blur' }],
      },
      jqmmDialogShow: false,
      type: '',
      formObj: {
        nm: '',
        isMakApp: '',
        isAppFill: '',
        isListSign: '',
        isContTm: '',
        isEndRpt: '',
        isMeetSign: '',
        isPubBook: '',
        isOverRpt: '',
        isSealPnsh: '',
        isSureNra: '',
        isSignBack: '',
        isAgreeBill: '',
        isPnshBind: '',
        isAppCompel: '',
      },
      dialogFormVisible: false,
      formLabelWidth: '180px',
      loading: true,
      operationType1: '',
      rsvrRules: null,
      probId: '',
      showAddProblemDialog: false,
    };
  },
  computed: {
    recPersId() {
      return localStorage.getItem('persId')
        ? localStorage.getItem('persId')
        : '';
    },
  },
  created() {
    this.findItemByType();
  },
  mounted() {
    this.getRgstridObj();
  },
  watch: {
    currentObjectRgstrId(n, o) {
      this.getRgstridObj();
    },
  },
  methods: {
    jqmmDialogClose() {
      this.jqmmDialogShow = false;
    },
    showPic(type) {
      this.type = type;
      this.jqmmDialogShow = true;
    },
    getRgstridObj() {
      getRgstridWtgovjxDssr(this.currentObjectRgstrId).then((res) => {
        if (res.data) {
          if (res.data.state == null) {
            this.initDefault();
          } else {
            this.formObj = res.data;
          }
        } else {
          this.initDefault();
        }
      });
    },
    initDefault() {
      this.formObj = {
        nm: '',
        isMakApp: '1',
        isAppFill: '1',
        isListSign: '1',
        isContTm: '1',
        isEndRpt: '1',
        isMeetSign: '1',
        isPubBook: '1',
        isOverRpt: '1',
        isSealPnsh: '1',
        isSureNra: '1',
        isSignBack: '1',
        isAgreeBill: '1',
        isPnshBind: '1',
        isAppCompel: '1',
      };
    },
    addHandler() {
      this.formObj['rgstrId'] = this.currentObjectRgstrId;
      this.formObj['persId'] = this.recPersId;
      if (
        this.formObj.nm == '' &&
        this.formObj.isMakApp == null &&
        this.formObj.isAppFill == null &&
        this.formObj.isListSign == null &&
        this.formObj.isContTm == null &&
        this.formObj.isEndRpt == null &&
        this.formObj.isMeetSign == null &&
        this.formObj.isPubBook == null &&
        this.formObj.isOverRpt == null &&
        this.formObj.isSealPnsh == null &&
        this.formObj.isSureNra == null &&
        this.formObj.isSignBack == null &&
        this.formObj.isAgreeBill == null &&
        this.formObj.isPnshBind == null &&
        this.formObj.isAppCompel == null
      ) {
        this.formObj['state'] = '0';
      } else if (
        this.formObj.nm != null &&
        this.formObj.isMakApp != null &&
        this.formObj.isAppFill != null &&
        this.formObj.isListSign != null &&
        this.formObj.isContTm != null &&
        this.formObj.isEndRpt != null &&
        this.formObj.isMeetSign != null &&
        this.formObj.isPubBook != null &&
        this.formObj.isOverRpt != null &&
        this.formObj.isSealPnsh != null &&
        this.formObj.isSureNra != null &&
        this.formObj.isSignBack != null &&
        this.formObj.isAgreeBill != null &&
        this.formObj.isPnshBind != null &&
        this.formObj.isAppCompel != null
      ) {
        this.formObj['state'] = '2';
      } else {
        this.formObj['state'] = '1';
      }
      this.$confirm({
        title: '提示',
        content: '确认保存督查情况信息？',
        okType: 'warning',
        onOk: () => {
          request.post('/bis/insp/wtgovjx/dssr', this.formObj).then((res) => {
            if (res.success) {
              this.$message.success('提交成功');
            }
          });
        },
      });
    },
    cancelHandler() {
      this.$emit('cancelHandler');
    },
    findItemByType() {
      const obj = {
        tname: 'BIS_INSP_WTGOVJX_DSSR',
      };
      request
        .post('/bis/insp/item/ques/info/findItemByType', obj)
        .then((res) => {
          this.rsvrRules = res.data;
        });
    },
    addProblem(item) {
      const rest = this.rsvrRules.filter((e) => {
        return e.eName === item;
      });
      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>
#dcdxHeader {
  padding: 15px 20px;
}

#dxdcFooter {
  text-align: center;
}

#dxdcAside {
  border: 1px solid #d5d5ff;
}

.el-dialog__wrapper .el-treeWhite {
  /* max-height: 260px !important; */
}

.add-problem-icon {
  font-size: 16px;
}

.el-icon-camera-solid,
.el-icon-circle-plus {
  margin-left: 20px;
  color: #00bbff;
  font-size: 18px;
  line-height: 12px;
  vertical-align: middle;
  cursor: pointer;
}

.el-icon-circle-plus {
  vertical-align: top;
}

.tip_info {
  margin-left: 20px;
  font-size: 12px;
  color: #ff0000;
}
</style>
