<template>
  <a-modal
    :open="dialogFormVisible"
    :title="currentObjectName + '督查填报'"
    :footer="null"
    width="100%"
    @cancel="closeDialog">
    <a-layout>
      <a-layout-content id="dxdcListMain">
        <a-tabs v-model="currentViewId" type="card" @tabClick="tabIndexChange">
          <a-tab-pane v-for="option in options" :key="option.label" :tab="option.label">
            <component
              :is="option.value"
              :currentObjectRgstrId="currentObjectRgstrId"
              :currentObjectName="currentObjectName"
              :currentResCode="currentResCode"
              :currentObjectId="currentObjectId"
              :activeLabel="activeLabel"
              :pType="pType"
              :id="id"
              :openType="openType"
              :labelList="signatureLabelList"
              @cancelHandler="cancelHandler"
              @addShuiKuSuccess="addShuiKuSuccess"></component>
          </a-tab-pane>
        </a-tabs>
      </a-layout-content>
    </a-layout>
  </a-modal>
</template>

<script>
import request from '../../utils/gw_ajax_request';
import chkprState from './dfgcaqdx/chkprState.vue';
import dayState from './dfgcaqdx/dayState.vue';
import faceState from './dfgcaqdx/faceState.vue';
import jichuxinxi from './dfgcaqdx/jichuxinxi.vue';
import problemList from './dfgcaqdxProblemList.vue';
export default {
  components: {
    jichuxinxi: jichuxinxi,
    faceState: faceState,
    dayState: dayState,
    chkprState: chkprState,
    problemList: problemList,
  },
  props: [
    'id',
    'rowData',
    'currentObjectRgstrId',
    'currentResCode',
    'currentObjectId',
    'currentObjectName',
    'pType',
    'openType',
  ],
  data() {
    return {
      options: [],
      value: '',
      dialogShow: false,
      currentViewId: '基础信息纠错',
      dialogFormVisible: true,
      activeLabel: '',
      signatureLabelList: ['行政责任人', '技术责任人', '巡查责任人'],
    };
  },
  computed: {
    persId() {
      return localStorage.getItem('persId')
        ? localStorage.getItem('persId')
        : '1098101939614724096';
    },
    currentRlcode() {
      return localStorage.getItem('currentRlcode')
        ? localStorage.getItem('currentRlcode')
        : '';
    },
  },
  mounted() {
    this.options = [
      {
        label: '基础信息纠错',
        value: 'jichuxinxi',
      },
      {
        label: '堤容堤貌检查',
        value: 'faceState',
      },
      {
        label: '日常管理',
        value: 'dayState',
      },
      {
        label: '防汛准备',
        value: 'chkprState',
      },
      {
        label: '问题清单',
        value: 'problemList',
      },
    ];
  },
  created() {},
  methods: {
    cancelHandler() {
      this.$emit('cancelHandler');
    },
    addShuiKuSuccess() {
      this.$emit('addShuiKuSuccess');
    },
    closeDialog() {
      this.$confirm({
        title: '提示',
        content: '确认退出吗？',
        okType: 'warning',
        onOk: () => {
          this.$emit('cancelHandler');
        },
      });
    },
    tabIndexChange(item) {
      if (item == '问题清单') {
        this.activeLabel = item;
      } else {
        this.activeLabel = '';
      }
    },
  },
};
</script>

<style lang='less' scoped>
:deep(.ant-modal) {
  top: 0;
}
</style>
