<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">
   <a-button class="bbtn" @click="updateCurrentDepart">小区查找</a-button>

    <property-settled-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></property-settled-form>
    <login-switch-house ref="loginSelect"  :closable="true" title="小区查找" @success="loginSelectOk" ></login-switch-house>
  </j-modal>

</template>

<script>

import PropertySettledForm from './NoticeForm'
import { httpAction, getAction } from '@/api/manage'
import LoginSwitchHouse from '@/components/tools/LoginSwitchHouse'
export default {
  name: 'PropertySettledModal',
  components: {
    PropertySettledForm,
    LoginSwitchHouse
  },
  data () {
    return {
      title:'',
      width: '70%',
      visible: false,
      disableSubmit: true
    }
  },
  methods: {
    add () {
      this.visible=true
      this.$nextTick(()=>{
        this.$refs.realForm.add();
      })
    },
    async updateCurrentDepart(){
     // let { result } = await getAction('/property-company/community/companyCommunity/getCommunityList',{ })
      let result =[
        {
          accessAddress: "hanjiangzhixing",
          addressInfo: "十堰市电饭锅",
          adminAvatar:"scott/pic/img01_1687743526373.png",
          adminName: "扫地僧",
          adminPassword:"123456",
          adminPhone:"15586468632",
          buildingNum:123,
          chargingStation: 23423,
          communityArea:"郧阳区",
          communityCode:"P00082",
          communityImage:"scott/pic/8b9eaa6e92ad56895430be936cc03896_1687746009641.jpg",
          communityIntro:"",
          communityName:"汉江之星小区",
          completedDate:"2021-06-16",
          councilsCode:null,
          councilsName:null,
          coverArea:23412,
          createBy:"13177461177",
          createTime:"2023-06-26 09:38:48",
          delFlag:0,
          houseNum:4532242,
          id:"1673143741424750593",
          lastPermissionIds:null,
          parkingSpace:2334,
          permissionIds:null,
          platformCode:"P00081",
          platformName:"汉江之星物业公司",
          platformType:"company",
          roleId:"1673143741215137794",
          updateBy:"汉江之星物业公司管理员",
          updateTime:"2023-07-20 14:35:35",
          useTo:1,
          userId:"1673143740938313730",
        }
      ]
      this.$refs.loginSelect.show(result)
    },
    loginSelectOk(res) {
      this.$refs.realForm.edit(res);
    },
    edit (record) {
      this.visible=true
      this.$nextTick(()=>{
        this.$refs.realForm.edit(record);
      })
    },
    close () {
      this.$emit('close');
      this.visible = false;
    },
    handleOk () {
      this.$refs.realForm.submitForm();
    },
    submitCallback(){
      this.$emit('ok');
      this.visible = false;
    },
    handleCancel () {
      this.close()
    }
  }
}
</script>
<style lang="less">
  .bbtn{
    position: absolute;
    right: 120px;
    top: 12px;
    z-index: 333;
  }
</style>