
import { getPhaseList, getBuildingList, getUnitList, buildingList, getLevelList, getRoomNoList, deleteBuilding, addBuilding, updateBuilding, getByIdBuildingId, userPassCertification, updataPassCertification, communityBuildinglist, buildingHouse, communityBuildingAdd, buildingDownloadExcel, addNode, deleteNode, buildingDetails, verifyinfoAdd } from '@/api/buildingOwnerInfo'

const buildingOwnerInfo = {
  state: {
    list: ''
  },
  mutations: {
    SET_LIST: (data) => {
      this.state.list = data
    }
  },
  actions: {
    GetPhaseList({ commit }, data) { // 查询 楼栋/单元/楼层/户号
      return new Promise((resolve, reject) => {
        getPhaseList(data).then(response => {
          // console.log('查询 楼栋/单元/楼层/户号: ', response)
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    GetBuildingList({ commit }, data) { // 查询 楼栋/单元/楼层/户号
      return new Promise((resolve, reject) => {
        getBuildingList(data).then(response => {
          // console.log('查询 楼栋/单元/楼层/户号: ', response)
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    GetUnitList({ commit }, data) { // 查询 楼栋/单元/楼层/户号
      return new Promise((resolve, reject) => {
        getUnitList(data).then(response => {
          // console.log('查询 楼栋/单元/楼层/户号: ', response)
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    GetLevelList({ commit }, data) { // 查询 楼栋/单元/楼层/户号
      return new Promise((resolve, reject) => {
        getLevelList(data).then(response => {
          // console.log('查询 楼栋/单元/楼层/户号: ', response)
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    GetRoomNoList({ commit }, data) { // 查询 楼栋/单元/楼层/户号
      return new Promise((resolve, reject) => {
        getRoomNoList(data).then(response => {
          // console.log('查询 楼栋/单元/楼层/户号: ', response)
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    BuildingInfoList({ commit }, data) { // 根据条件查询 楼栋信息库
      return new Promise((resolve, reject) => {
        buildingList(data).then(response => {
          // const data = response.data
          // commit('SET_LIST', data)
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    UserPassCertification({ commit }, data) { // 查询已认证的
      return new Promise((resolve, reject) => {
        userPassCertification(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },

    DeleteBuilding({ commit }, data) { // 批量删除
      return new Promise((resolve, reject) => {
        deleteBuilding(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    UpdataPassCertification({ commit }, data) { // 查询已认证的
      return new Promise((resolve, reject) => {
        updataPassCertification(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    UpdateBuilding({ commit }, data) { // 修改楼栋户主信息
      return new Promise((resolve, reject) => {
        updateBuilding(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    AddBuilding({ commit }, data) { // 修改楼栋户主信息
      return new Promise((resolve, reject) => {
        addBuilding(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    GetByIdBuildingId({ commit }, data) { // 根据楼栋信息id查询
      return new Promise((resolve, reject) => {
        getByIdBuildingId(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    CommunityBuildinglist({ commit }, data) {
      return new Promise((resolve, reject) => {
        communityBuildinglist(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    BuildingHouse({ commit }, data) { // 小区楼栋资料 查询 楼栋/单元/楼层/户号
      return new Promise((resolve, reject) => {
        buildingHouse(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    CommunityBuildingAdd({ commit }, data) { // 小区楼栋资料 修改 楼栋/单元/楼层/户号
      return new Promise((resolve, reject) => {
        communityBuildingAdd(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    BuildingDownloadExcel({ commit }) { // 下载模板
      return new Promise((resolve, reject) => {
        buildingDownloadExcel().then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    AddNode({ commit }, data) { // 添加当前期/栋/单元/层/户/节点
      return new Promise((resolve, reject) => {
        addNode(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    DeleteNode({ commit }, data) { // 添加当前期/栋/单元/层/户/节点
      return new Promise((resolve, reject) => {
        deleteNode(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    BuildingDetails({ commit }, data) { // 查询 楼栋/单元/楼层/户号
      return new Promise((resolve, reject) => {
        buildingDetails(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    VerifyinfoAdd({ commit }, data) {
      return new Promise((resolve, reject) => {
        verifyinfoAdd(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}
export default buildingOwnerInfo
