From b64a0deae5b5d33f9e20671a68936b27f0b9b00b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 21 七月 2026 18:03:03 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0
---
src/views/im/manager/channel/material/data.ts | 235 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 235 insertions(+), 0 deletions(-)
diff --git a/src/views/im/manager/channel/material/data.ts b/src/views/im/manager/channel/material/data.ts
new file mode 100644
index 0000000..34488e4
--- /dev/null
+++ b/src/views/im/manager/channel/material/data.ts
@@ -0,0 +1,235 @@
+import type { VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+
+import { markRaw } from 'vue';
+
+import { DICT_TYPE } from '#/packages/constants/src';
+import { getDictOptions } from '#/packages/effects/hooks/src';
+
+import { z } from '#/adapter/form';
+import { getRangePickerDefaultProps } from '#/utils';
+import { ChannelSelect } from '#/views/im/manager/channel/list/components';
+
+/** 鏂板/淇敼鐨勮〃鍗� */
+export function useFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'id',
+ component: 'Input',
+ dependencies: {
+ triggerFields: [''],
+ show: () => false,
+ },
+ },
+ {
+ fieldName: 'channelId',
+ label: '鎵�灞為閬�',
+ component: markRaw(ChannelSelect),
+ rules: 'selectRequired',
+ },
+ {
+ fieldName: 'type',
+ label: '鍐呭绫诲瀷',
+ component: 'RadioGroup',
+ componentProps: {
+ options: getDictOptions(DICT_TYPE.IM_CHANNEL_MATERIAL_TYPE, 'number'),
+ buttonStyle: 'solid',
+ optionType: 'button',
+ },
+ rules: z.number().default(1),
+ },
+ {
+ fieldName: 'title',
+ label: '鏍囬',
+ component: 'Input',
+ componentProps: {
+ maxlength: 128,
+ placeholder: '璇疯緭鍏ユ爣棰�',
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'coverUrl',
+ label: '灏侀潰鍥�',
+ component: 'ImageUpload',
+ componentProps: {
+ maxNumber: 1,
+ },
+ },
+ {
+ fieldName: 'summary',
+ label: '鎽樿',
+ component: 'Textarea',
+ componentProps: {
+ maxlength: 255,
+ placeholder: '璇疯緭鍏ユ憳瑕�',
+ rows: 2,
+ },
+ },
+ {
+ fieldName: 'content',
+ label: '姝f枃',
+ component: 'RichTextarea',
+ dependencies: {
+ triggerFields: ['type'],
+ show: (values) => values.type === 1,
+ },
+ },
+ {
+ fieldName: 'url',
+ label: '璺宠浆閾炬帴',
+ component: 'Input',
+ componentProps: {
+ placeholder: 'https://example.com/...',
+ },
+ dependencies: {
+ triggerFields: ['type'],
+ show: (values) => values.type !== 1,
+ },
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勬悳绱㈣〃鍗� */
+export function useGridFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'channelId',
+ label: '棰戦亾',
+ component: markRaw(ChannelSelect),
+ componentProps: {
+ placeholder: '鍏ㄩ儴',
+ },
+ },
+ {
+ fieldName: 'title',
+ label: '鏍囬',
+ component: 'Input',
+ componentProps: {
+ allowClear: true,
+ placeholder: '鏍囬鍏抽敭瀛�',
+ },
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勫瓧娈� */
+export function useGridColumns(): VxeTableGridOptions['columns'] {
+ return [
+ {
+ field: 'id',
+ title: '缂栧彿',
+ width: 80,
+ },
+ {
+ field: 'coverUrl',
+ title: '灏侀潰',
+ width: 80,
+ slots: { default: 'cover' },
+ },
+ {
+ field: 'channelName',
+ title: '棰戦亾',
+ minWidth: 120,
+ },
+ {
+ field: 'type',
+ title: '鍐呭绫诲瀷',
+ width: 110,
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.IM_CHANNEL_MATERIAL_TYPE },
+ },
+ },
+ {
+ field: 'title',
+ title: '鏍囬',
+ minWidth: 180,
+ },
+ {
+ field: 'summary',
+ title: '鎽樿',
+ minWidth: 180,
+ },
+ {
+ field: 'createTime',
+ title: '鍒涘缓鏃堕棿',
+ minWidth: 180,
+ formatter: 'formatDateTime',
+ },
+ {
+ title: '鎿嶄綔',
+ width: 160,
+ fixed: 'right',
+ slots: { default: 'actions' },
+ },
+ ];
+}
+
+/** 棰戦亾娑堟伅鎼滅储琛ㄥ崟 */
+export function useMessageGridFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'channelId',
+ label: '棰戦亾',
+ component: markRaw(ChannelSelect),
+ componentProps: {
+ placeholder: '鍏ㄩ儴',
+ },
+ },
+ {
+ fieldName: 'sendTime',
+ label: '鍙戦�佹椂闂�',
+ component: 'RangePicker',
+ componentProps: {
+ ...getRangePickerDefaultProps(),
+ allowClear: true,
+ },
+ },
+ ];
+}
+
+/** 棰戦亾娑堟伅瀛楁 */
+export function useMessageGridColumns(): VxeTableGridOptions['columns'] {
+ return [
+ {
+ field: 'id',
+ title: '缂栧彿',
+ width: 80,
+ },
+ {
+ field: 'materialCoverUrl',
+ title: '灏侀潰',
+ width: 80,
+ slots: { default: 'cover' },
+ },
+ {
+ field: 'channelName',
+ title: '棰戦亾',
+ minWidth: 120,
+ },
+ {
+ field: 'materialTitle',
+ title: '绱犳潗鏍囬',
+ minWidth: 180,
+ },
+ {
+ field: 'receiverUserIds',
+ title: '鎺ユ敹浜�',
+ width: 120,
+ slots: { default: 'receivers' },
+ },
+ {
+ field: 'sendTime',
+ title: '鍙戦�佹椂闂�',
+ minWidth: 180,
+ formatter: 'formatDateTime',
+ },
+ {
+ title: '鎿嶄綔',
+ width: 100,
+ fixed: 'right',
+ slots: { default: 'actions' },
+ },
+ ];
+}
--
Gitblit v1.9.3