import { getTelsList, telAdd, telUpdate, getTelById, telDeleteProperty } from '@/api/tels.js'

const telsInfo = {
  state: {

  },
  mutations: {

  },
  actions: {
    GetTelsList({ commit }, data) { // 根据搜索条件获取物业端号码
      return new Promise((resolve, reject) => {
        getTelsList(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    TelAdd({ commit }, data) { // 添加物业号码
      return new Promise((resolve, reject) => {
        telAdd(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    TelUpdate({ commit }, data) { // 修改物业号码
      return new Promise((resolve, reject) => {
        telUpdate(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    GetTelById({ commit }, data) { // 根据id查询详情
      return new Promise((resolve, reject) => {
        getTelById(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    TelDeleteProperty({ commit }, data) { // 批量删除物业号码, 根据id集合
      return new Promise((resolve, reject) => {
        telDeleteProperty(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default telsInfo
