<template>
  <a-button v-if="utils.hasPermission('agentTeamTable')" class="mt-10" type="primary" @click="createGroupAccount">创建主账号</a-button>
   <a-table :dataSource="dataSource" :columns="utils.TBLayout('agentGrouptable')" size="small" bordered>
    <template #bodyCell="{ column, record }">
      <template v-if="column.dataIndex == 'qrcord'">
        <a-qrcode :value="useAuthStore().qrCordBaseUrl+'wechatBind?wechatBindUserid='+record.sys_enterprise_hrid+'&userName='+record.name" size="100" />
      </template>
      <template v-else>{{ record[column.dataIndex] }}</template>
    </template>
   </a-table>
</template>

<script setup>
import Api from '@/api/api'
import utils from '@/utils/utils'
import {ref,defineProps,createVNode, defineComponent,defineEmits, inject} from 'vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { useAuthStore } from '@/stores/modules/auth.js'
import { Modal } from 'ant-design-vue';
let baseUrl = inject('baseUrl')
const props = defineProps(['enterpriseid','dataSource'])
const emit = defineEmits(['onSuccess'])
const createGroupAccount = ()=>{
  Modal.confirm({
    title: '确定要创建团队主账号吗?',
    icon: createVNode(ExclamationCircleOutlined),
    okText: '确认',
    cancelText: '取消',
    async onOk() {
      const res = await Api.requested({
        "id":20220920084301,
        "content":{
          "sys_enterpriseid":props.enterpriseid
        }
      })
      utils.message(res,'创建成功',()=>{
        emit('onSuccess')
      })
    },
    onCancel() {
      console.log('Cancel');
    },
    class: 'test',
  })
}
// agentGrouptable
</script>
<style>
</style>