<template>
  <a-modal
    :open="dialogFormVisible"
    :title="`${rowData.nm?rowData.nm:''} - 督查填报`"
    :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
              ref="diFangTabs"
              :is="option.value"
              :rowData="rowData"
              :openType="openType"
              @addDiFangSuccess="addDiFangSuccess"></component>
          </a-tab-pane>
        </a-tabs>
      </a-layout-content>
    </a-layout>
  </a-modal>
</template>

<script>
import { optionsForJiangxiShuiHuiGongCheng } from './shuiHuiGongCheng/forDifferentProvince';
import jichuxinxi from './shuiHuiGongCheng/jichuxinxi.vue';
import problemList from './shuiHuiGongCheng/problemList.vue';
import shuiHuiXiangMuDuCha from './shuiHuiGongCheng/shuiHuiXiangMuDuCha.vue';

export default {
  components: {
    jichuxinxi,
    shuiHuiXiangMuDuCha, // 水毁工程督查
    problemList, // 问题清单
  },
  props: {
    rowData: {
      type: Object,
      default: {},
    },
    inspType: {
      type: String,
      default: '',
    },
    openType: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {
      dialogFormVisible: true,
      options: [],
      currentViewId: '基础信息纠错',
      activeLabel: '',
    };
  },
  computed: {
    currentRlcode() {
      return localStorage.getItem('currentRlcode')
        ? localStorage.getItem('currentRlcode')
        : '';
    },
  },
  mounted() {
    if (this.currentRlcode.indexOf('36') == '0') {
      // 江西省
      var arr = optionsForJiangxiShuiHuiGongCheng;
      this.options = arr;
    }
  },
  created() {},
  methods: {
    closeDialog() {
      this.$confirm({
        title: '提示',
        content: '确认退出吗？',
        okType: 'warning',
        onOk: () => {
          this.$emit('cancelHandler');
        },
      });
    },
    tabIndexChange(item) {
      if (item == '问题清单') {
        this.activeLabel = item;
        this.$refs.diFangTabs[2].getProblemList();
      } else {
        this.activeLabel = '';
      }
    },
    addDiFangSuccess() {
      this.$emit('addDiFangSuccess');
    },
  },
};
</script>

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