<template>
  <zpa-form ref="Form">
    <zpa-form-group>
      <zpa-select
        v-model="id"
        label="可选租户"
        :labelWidth="120"
        :query="getTenantList"
      />
    </zpa-form-group>
  </zpa-form>
</template>
<script>
import { queryTopUnit } from '@centit/api-admin/unit'
import { getPosition } from '@centit/api-auth'

export default {
  name: 'TenantSelect',

  data () {
    return {
      id: ''
    }
  },

  computed: {},

  methods: {
    async getTenantList () {
      const currentuser = await getPosition()
      const res = await queryTopUnit({ userCode: currentuser.userCode })
      return res.map(m => {
        return {
          value: m.topUnit,
          text: m.unitName
        }
      })
    },

    submit () {
    }
  }
}
</script>
