YunaiV 01691827fc 1. 重命名 DataGrid 为 MessageTable,增加可读性
2. 调整素材管理,读取 API 接口

(cherry picked from commit 48c7b58b03853eb2f8e597377b460a7b4fdf6024)
2023-06-13 12:48:41 +08:00

38 lines
956 B
Vue

<template>
<el-select v-model="account.id" placeholder="请选择公众号" class="!w-240px" @change="onChanged">
<el-option v-for="item in accountList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</template>
<script lang="ts" setup name="WxAccountSelect">
import * as MpAccountApi from '@/api/mp/account'
const account: MpAccountApi.AccountVO = reactive({
id: undefined,
name: ''
})
const accountList: Ref<MpAccountApi.AccountVO[]> = ref([])
const emit = defineEmits<{
(e: 'change', id?: number, name?: string): void
}>()
const handleQuery = async () => {
accountList.value = await MpAccountApi.getSimpleAccountList()
// 默认选中第一个
if (accountList.value.length > 0) {
account.id = accountList.value[0].id
emit('change', account.id, account.name)
}
}
const onChanged = () => {
emit('change', account.id, account.name)
}
/** 初始化 */
onMounted(() => {
handleQuery()
})
</script>