<template>
  <a-modal
    :open="showAddProblemDialog"
    @cancel="dialogClose"
    :title="objName + '新增问题'"
    class="custom_dialog"
    style="width: 55%"
    :footer="null">
    <div style="text-align: center;">
      对象id：{{rowData.objId}}
      <component
        :is="curComponent"
        :rowData="rowData"
        :objId="objId"
        :objType="objType"
        :type="type"
        :villType="villType"
        :villCode="villCode"
        :cwsCode="cwsCode"
        :grwCode="grwCode"
        :objName="objName"
        :problemMiddleType="problemMiddleType"
        :problemSmallType="problemSmallType"
        :stationType="stationType"
        :regId="regId"
        :currentObjectRgstrId="currentObjectRgstrId"
        @closeDialog="dialogClose"
        :newModelData="newModelData"
        :prjType="prjType"
        :flag="flag"></component>
         问题id：{{uuid}}
    </div>
  </a-modal>
</template>

<script>
import { simpleUuid } from '@/utils/uuid';
import commonwenti from './commonwenti.vue';
import dfgcaqdxwenti from './dfgcaqdxwenti.vue';
import dike2022wenti from './dike2022wenti.vue';
import fhgczgfcwenti from './fhgczgfcwenti.vue';
import hehuweishiwenti from './hehuweishiwenti.vue';
import ncgsgcwenti from './ncgsgcwenti.vue';
import shuibao from './shuibao.vue';
import shuilitisunianwenti from './shuilitisunianwenti.vue';
import shujunshashi from './shujunshashiwenti.vue';
import skfhddwenti from './skfhddwenti.vue';
import slaqscdpcwenti from './slaqscdpcwenti.vue';
import sxzzfwenti from './sxzzfwenti.vue';
import villsafwenti from './villsafwenti.vue';
import xiaoshuidianwenti from './xiaoshuidianwenti.vue';
import xiaoshuiku from './xiaoshuikuwenti.vue';
import yjbysywenti from './yjbysywenti.vue';
export default {
  props: {
    showAddProblemDialog: {
      default: false,
    },
    //  1 小水库  2 人饮 3 水毁
    objType: {
      default: '2',
      // required: true
    },
    // 对象类型 0 小水库  1 行政村  2 水源地  3 饮水工程  4 水毁工程
    villType: {
      default: '1',
      // required: true
    },
    villCode: {
      default: '1',
      // required: true
    },
    // 对象id
    objId: {
      default: '',
      // required: true
    },
    // 对象名称
    objName: {
      default: '行政村',
      // required: true
    },
    // 问题中类型
    problemMiddleType: {
      default: '用水户情况',
    },
    // 问题小类型
    problemSmallType: {
      default: '水质',
    },
    cwsCode: {
      default: '',
    },
    grwCode: {
      default: '',
    },
    stationType: {
      default: '',
    },
    regId: {
      default: '',
    },
    currentObjectRgstrId: {
      default: '',
    },
    newModelData: {
      default: null,
    },
    prjType: {
      default: '',
    },
    type: {
      default: '',
    },
    rowData: {
      default: Object,
    },
    flag: {
      default: '',
    },
  },
  components: {
    xiaoshuiku,
    shuibao,
    shujunshashi,
    hehuweishiwenti,
    shuilitisunianwenti,
    xiaoshuidianwenti,
    sxzzfwenti,
    yjbysywenti,
    skfhddwenti,
    dfgcaqdxwenti,
    fhgczgfcwenti,
    slaqscdpcwenti,
    ncgsgcwenti,
    commonwenti,
    dike2022wenti,
    villsafwenti,
  },
  data() {
    return {
      uuid: simpleUuid(),
      // dialogTableVisible: true,
      curComponent: 'xiaoshuiku',
    };
  },
  mounted() {
    console.log(this.objType, 'xxxxx222xxxx');
    if (this.objType == '1') {
      this.curComponent = 'xiaoshuiku';
    } else if (this.objType == '17') {
      this.curComponent = 'shuibao';
    } else if (this.objType == '52') {
      this.curComponent = 'shujunshashi';
    } else if (this.objType == '50') {
      this.curComponent = 'hehuweishiwenti';
    } else if (this.objType == '51') {
      this.curComponent = 'shuilitisunianwenti';
    } else if (
      this.objType == '58' ||
      this.objType == '59' ||
      this.objType == '61' ||
      this.objType == '63' ||
      this.objType == '60' ||
      this.objType == '64' ||
      this.objType == '65' ||
      this.objType == '66'
    ) {
      this.curComponent = 'xiaoshuidianwenti';
    } else if (this.objType == '85') {
      this.curComponent = 'sxzzfwenti';
    } else if (this.objType == '86') {
      this.curComponent = 'skfhddwenti';
    } else if (this.objType == '87') {
      this.curComponent = 'yjbysywenti';
    } else if (this.objType == '90') {
      this.curComponent = 'dfgcaqdxwenti';
    } else if (this.objType == '92') {
      this.curComponent = 'fhgczgfcwenti';
    } else if (this.objType == '107') {
      this.curComponent = 'slaqscdpcwenti';
    } else if (this.objType == '109') {
      this.curComponent = 'ncgsgcwenti';
    } else if (this.objType == '111') {
      this.curComponent = 'commonwenti';
    } else if (this.objType == '114') {
      this.curComponent = 'dike2022wenti';
    } else if (this.objType == '117') {
      this.curComponent = 'villsafwenti';
    } else {
      this.curComponent = 'xiaoshuiku';
    }
    this.showAddProblemDialog = true;
  },
  methods: {
    dialogClose() {
      this.$emit('closeDialog');
    },
  },
  watch: {
    objType(val) {
      if (val == '1') {
        this.curComponent = 'xiaoshuiku';
      } else if (val == '17') {
        this.curComponent = 'shuibao';
      } else if (val == '52') {
        this.curComponent = 'shujunshashi';
      } else if (
        val == '58' ||
        val == '59' ||
        val == '61' ||
        val == '63' ||
        val == '60' ||
        val == '64' ||
        val == '65' ||
        val == '66'
      ) {
        this.curComponent = 'xiaoshuidianwenti';
      } else {
        this.curComponent = 'xiaoshuiku';
      }
    },
  },
};
</script>

<style lang='less' scoped>

</style>
