From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目

---
 src/views/mp/components/wx-account-select/main.vue |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/src/views/mp/components/wx-account-select/main.vue b/src/views/mp/components/wx-account-select/main.vue
new file mode 100644
index 0000000..4df4cbe
--- /dev/null
+++ b/src/views/mp/components/wx-account-select/main.vue
@@ -0,0 +1,58 @@
+<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>
+import * as MpAccountApi from '@/api/mp/account'
+import { useTagsViewStore } from '@/store/modules/tagsView'
+
+const message = useMessage() // 娑堟伅寮圭獥
+const { delView } = useTagsViewStore() // 瑙嗗浘鎿嶄綔
+const { push, currentRoute } = useRouter() // 璺敱
+
+defineOptions({ name: 'WxAccountSelect' })
+
+const account: MpAccountApi.AccountVO = reactive({
+  id: -1,
+  name: ''
+})
+
+const accountList = ref<MpAccountApi.AccountVO[]>([])
+
+const emit = defineEmits<{
+  (e: 'change', id: number, name: string)
+}>()
+
+const handleQuery = async () => {
+  accountList.value = await MpAccountApi.getSimpleAccountList()
+  if (accountList.value.length == 0) {
+    message.error('鏈厤缃叕浼楀彿锛岃鍦ㄣ�愬叕浼楀彿绠$悊 -> 璐﹀彿绠$悊銆戣彍鍗曪紝杩涜閰嶇疆')
+    delView(unref(currentRoute))
+    await push({ name: 'MpAccount' })
+    return
+  }
+  // 榛樿閫変腑绗竴涓�
+  if (accountList.value.length > 0) {
+    account.id = accountList.value[0].id
+    if (account.id) {
+      account.name = accountList.value[0].name
+      emit('change', account.id, account.name)
+    }
+  }
+}
+
+const onChanged = (id?: number) => {
+  const found = accountList.value.find((v) => v.id === id)
+  if (account.id) {
+    account.name = found ? found.name : ''
+    emit('change', account.id, account.name)
+  }
+}
+
+/** 鍒濆鍖� */
+onMounted(() => {
+  handleQuery()
+})
+</script>

--
Gitblit v1.8.0