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/tag/index.vue |  158 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 158 insertions(+), 0 deletions(-)

diff --git a/src/views/mp/tag/index.vue b/src/views/mp/tag/index.vue
new file mode 100644
index 0000000..8720a26
--- /dev/null
+++ b/src/views/mp/tag/index.vue
@@ -0,0 +1,158 @@
+<template>
+  <doc-alert title="鍏紬鍙锋爣绛�" url="https://doc.iocoder.cn/mp/tag/" />
+
+  <!-- 鎼滅储宸ヤ綔鏍� -->
+  <ContentWrap>
+    <el-form
+      class="-mb-15px"
+      :model="queryParams"
+      ref="queryFormRef"
+      :inline="true"
+      label-width="68px"
+    >
+      <el-form-item label="鍏紬鍙�" prop="accountId">
+        <WxAccountSelect @change="onAccountChanged" />
+      </el-form-item>
+      <el-form-item>
+        <el-button
+          type="primary"
+          plain
+          @click="openForm('create')"
+          v-hasPermi="['mp:tag:create']"
+          :disabled="queryParams.accountId === 0"
+        >
+          <Icon icon="ep:plus" class="mr-5px" /> 鏂板
+        </el-button>
+        <el-button
+          type="success"
+          plain
+          @click="handleSync"
+          v-hasPermi="['mp:tag:sync']"
+          :disabled="queryParams.accountId === 0"
+        >
+          <Icon icon="ep:refresh" class="mr-5px" /> 鍚屾
+        </el-button>
+      </el-form-item>
+    </el-form>
+  </ContentWrap>
+
+  <!-- 鍒楄〃 -->
+  <ContentWrap>
+    <el-table v-loading="loading" :data="list">
+      <el-table-column label="缂栧彿" align="center" prop="id" />
+      <el-table-column label="鏍囩鍚嶇О" align="center" prop="name" />
+      <el-table-column label="绮変笣鏁�" align="center" prop="count" />
+      <el-table-column
+        label="鍒涘缓鏃堕棿"
+        align="center"
+        prop="createTime"
+        width="180"
+        :formatter="dateFormatter"
+      />
+      <el-table-column label="鎿嶄綔" align="center">
+        <template #default="scope">
+          <el-button
+            link
+            type="primary"
+            @click="openForm('update', scope.row.id)"
+            v-hasPermi="['mp:tag:update']"
+          >
+            淇敼
+          </el-button>
+          <el-button
+            link
+            type="danger"
+            @click="handleDelete(scope.row.id)"
+            v-hasPermi="['mp:tag:delete']"
+          >
+            鍒犻櫎
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 鍒嗛〉 -->
+    <Pagination
+      :total="total"
+      v-model:page="queryParams.pageNo"
+      v-model:limit="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </ContentWrap>
+
+  <!-- 琛ㄥ崟寮圭獥锛氭坊鍔�/淇敼 -->
+  <TagForm ref="formRef" @success="getList" />
+</template>
+<script lang="ts" setup>
+import { dateFormatter } from '@/utils/formatTime'
+import * as MpTagApi from '@/api/mp/tag'
+import TagForm from './TagForm.vue'
+import WxAccountSelect from '@/views/mp/components/wx-account-select'
+
+defineOptions({ name: 'MpTag' })
+
+const message = useMessage() // 娑堟伅寮圭獥
+const { t } = useI18n() // 鍥介檯鍖�
+
+const loading = ref(true) // 鍒楄〃鐨勫姞杞戒腑
+const total = ref(0) // 鍒楄〃鐨勬�婚〉鏁�
+const list = ref<any[]>([]) // 鍒楄〃鐨勬暟鎹�
+
+const queryParams = reactive({
+  pageNo: 1,
+  pageSize: 10,
+  accountId: -1
+})
+
+const formRef = ref<InstanceType<typeof TagForm> | null>(null)
+
+/** 渚﹀惉鍏紬鍙峰彉鍖� **/
+const onAccountChanged = (id: number) => {
+  queryParams.accountId = id
+  queryParams.pageNo = 1
+  getList()
+}
+
+/** 鏌ヨ鍒楄〃 */
+const getList = async () => {
+  try {
+    loading.value = true
+    const data = await MpTagApi.getTagPage(queryParams)
+    list.value = data.list
+    total.value = data.total
+  } finally {
+    loading.value = false
+  }
+}
+
+/** 娣诲姞/淇敼鎿嶄綔 */
+const openForm = (type: 'create' | 'update', id?: number) => {
+  formRef.value?.open(type, queryParams.accountId, id)
+}
+
+/** 鍒犻櫎鎸夐挳鎿嶄綔 */
+const handleDelete = async (id: number) => {
+  try {
+    // 鍒犻櫎鐨勪簩娆$‘璁�
+    await message.delConfirm()
+    // 鍙戣捣鍒犻櫎
+    await MpTagApi.deleteTag(id)
+    message.success(t('common.delSuccess'))
+    // 鍒锋柊鍒楄〃
+    await getList()
+  } catch {
+    //
+  }
+}
+
+/** 鍚屾鎿嶄綔 */
+const handleSync = async () => {
+  try {
+    await message.confirm('鏄惁纭鍚屾鏍囩锛�')
+    await MpTagApi.syncTag(queryParams.accountId as number)
+    message.success('鍚屾鏍囩鎴愬姛')
+    await getList()
+  } catch {
+    //
+  }
+}
+</script>

--
Gitblit v1.8.0