From 27cd042df9aca0383a49f3514bc21958dd890912 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 29 六月 2026 15:42:23 +0800
Subject: [PATCH] 银川 1.联调产品维护页面 2.添加IM即时通讯模块

---
 src/views/im/manager/channel/list/modules/form.vue |   82 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 82 insertions(+), 0 deletions(-)

diff --git a/src/views/im/manager/channel/list/modules/form.vue b/src/views/im/manager/channel/list/modules/form.vue
new file mode 100644
index 0000000..fa39414
--- /dev/null
+++ b/src/views/im/manager/channel/list/modules/form.vue
@@ -0,0 +1,82 @@
+<script lang="ts" setup>
+import type { ImManagerChannelApi } from '#/api/im/manager/channel'
+
+import { computed, ref } from 'vue'
+
+import { useVbenModal } from '#/packages/effects/common-ui/src'
+
+import { message } from 'ant-design-vue'
+
+import { useVbenForm } from '#/adapter/form'
+import {
+  createManagerChannel,
+  getManagerChannel,
+  updateManagerChannel
+} from '#/api/im/manager/channel'
+import { $t } from '#/locales'
+
+import { useFormSchema } from '../data'
+
+const emit = defineEmits(['success'])
+const formData = ref<ImManagerChannelApi.Channel>()
+const getTitle = computed(() => {
+  return formData.value?.id
+    ? $t('ui.actionTitle.edit', ['棰戦亾'])
+    : $t('ui.actionTitle.create', ['棰戦亾'])
+})
+
+const [Form, formApi] = useVbenForm({
+  commonConfig: {
+    componentProps: {
+      class: 'w-full'
+    },
+    formItemClass: 'col-span-2',
+    labelWidth: 100
+  },
+  layout: 'horizontal',
+  schema: useFormSchema(),
+  showDefaultActions: false
+})
+
+const [Modal, modalApi] = useVbenModal({
+  async onConfirm() {
+    const { valid } = await formApi.validate()
+    if (!valid) {
+      return
+    }
+    modalApi.lock()
+    const data = (await formApi.getValues()) as ImManagerChannelApi.Channel
+    try {
+      await (formData.value?.id ? updateManagerChannel(data) : createManagerChannel(data))
+      await modalApi.close()
+      emit('success')
+      message.success($t('ui.actionMessage.operationSuccess'))
+    } finally {
+      modalApi.unlock()
+    }
+  },
+  async onOpenChange(isOpen: boolean) {
+    if (!isOpen) {
+      formData.value = undefined
+      return
+    }
+    const data = modalApi.getData<ImManagerChannelApi.Channel>()
+    if (!data || !data.id) {
+      return
+    }
+    modalApi.lock()
+    try {
+      formData.value = await getManagerChannel(data.id)
+      await formApi.setValues(formData.value)
+    } finally {
+      modalApi.unlock()
+    }
+  }
+})
+</script>
+
+<template>
+  <Modal :title="getTitle" class="w-1/3">
+    <Form class="mx-4" />
+  </Modal>
+</template>

--
Gitblit v1.9.3