<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"
              :inspType="inspType"
              :id="id"
              :prjType="prjType"
              :openType="openType"
              @cancelHandler="cancelHandler"
              @addShuiKuSuccess="addShuiKuSuccess"> </component>
          </a-tab-pane>
        </a-tabs>
      </a-layout-content>
    </a-layout>
  </a-modal>
</template>

<script>
import { getrgstrIdObject } from '../../api/duChaTianBao';
import request from '../../utils/gw_ajax_request';
import buildUnit from './zhongDianShuiLi/buildUnit.vue';
import jianLiUnit from './zhongDianShuiLi/jianLiUnit.vue';
import jichuxinxi from './zhongDianShuiLi/jichuxinxi.vue';
import problemList from './zhongDianShuiLi/problemList.vue';
import projectEntity from './zhongDianShuiLi/projectEntity.vue';

export default {
  components: {
    jichuxinxi: jichuxinxi,
    buildUnit: buildUnit,
    jianLiUnit: jianLiUnit,
    projectEntity: projectEntity,
    problemList: problemList,
  },
  props: [
    'id',
    'rowData',
    'currentObjectRgstrId',
    'currentResCode',
    'currentObjectId',
    'currentObjectName',
    'pType',
    'inspType',
    'prjType',
    'openType',
  ],
  data() {
    return {
      options: [
        { label: '基础信息纠错', value: 'jichuxinxi' },
        { label: '监理单位', value: 'jianLiUnit' },
        { label: '施工单位', value: 'buildUnit' },
        { label: '项目法人', value: 'projectEntity' },
        { label: '问题清单', value: 'problemList' },
      ],
      value: '',
      dialogShow: false,
      currentViewId: '基础信息纠错',
      dialogFormVisible: true,
      activeLabel: '',
    };
  },
  computed: {
    persId() {
      return localStorage.getItem('persId')
        ? localStorage.getItem('persId')
        : '1098101939614724096';
    },
    currentRlcode() {
      return localStorage.getItem('currentRlcode')
        ? localStorage.getItem('currentRlcode')
        : '';
    },
  },
  mounted() {
    console.log(this.pType);
  },
  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>
