From fe2d6627b8f1002af7a31b08f6f43bec034d04ee Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期三, 21 十月 2026 18:29:07 +0800
Subject: [PATCH] feat: 完善课题、会员、财务、企微页面并新增资产/用车/采购
---
src/views/wxcp/activity/data.ts | 196 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 196 insertions(+), 0 deletions(-)
diff --git a/src/views/wxcp/activity/data.ts b/src/views/wxcp/activity/data.ts
index 1692620..745584f 100644
--- a/src/views/wxcp/activity/data.ts
+++ b/src/views/wxcp/activity/data.ts
@@ -2,6 +2,8 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { WxCpActivityApi } from '#/api/wxcp/activity';
+import { ACTIVITY_TYPE } from '#/api/wxcp/activity';
+
import {
ACTIVITY_STATUS_OPTIONS,
PUSH_SCOPE_OPTIONS,
@@ -12,11 +14,52 @@
/** 琛ㄥ崟绫诲瀷 */
export type ActivityFormType = 'create' | 'update' | 'detail';
+/** 娲诲姩妯℃澘绫诲瀷閫夐」 */
+export const ACTIVITY_TYPE_OPTIONS = [
+ {
+ label: '绾�氱煡锛堝彧鎺ㄤ竴鏉℃枃鏈級',
+ value: ACTIVITY_TYPE.TEXT,
+ },
+ {
+ label: '鍗曟潯娑堟伅锛堝彲鐐瑰嚮鍗$墖锛�',
+ value: ACTIVITY_TYPE.MESSAGE,
+ },
+ {
+ label: '鍥剧墖閫氱煡锛堜笂浼犲浘鐗囨帹閫侊級',
+ value: ACTIVITY_TYPE.IMAGE,
+ },
+ {
+ label: '闄勪欢閫氱煡锛堟帹閫佹枃浠朵緵涓嬭浇锛�',
+ value: ACTIVITY_TYPE.FILE,
+ },
+ {
+ label: '鏁版嵁閲囬泦/璇勪环锛堝~鍐欒〃鍗曪級',
+ value: ACTIVITY_TYPE.FORM,
+ },
+];
+
+/** 閲囬泦瀛楁绫诲瀷閫夐」 */
+export const FIELD_TYPE_OPTIONS = [
+ { label: '鍗曡鏂囨湰', value: 'text' },
+ { label: '澶氳鏂囨湰', value: 'textarea' },
+ { label: '鏁板瓧', value: 'number' },
+ { label: '鏃ユ湡', value: 'date' },
+ { label: '涓嬫媺閫夋嫨', value: 'select' },
+ { label: '鍗曢��', value: 'radio' },
+ { label: '澶氶��', value: 'checkbox' },
+ { label: '璇勫垎', value: 'rating' },
+];
+
const DATETIME_PROPS = {
showTime: true,
valueFormat: 'YYYY-MM-DD HH:mm:ss',
format: 'YYYY-MM-DD HH:mm:ss',
} as const;
+
+/** 浠呮暟鎹噰闆嗘ā鏉块渶瑕佹姤鍚嶆椂闂翠笌鍚嶉 */
+function isFormType(values: Record<string, unknown>) {
+ return values.activityType === ACTIVITY_TYPE.FORM;
+}
/** 娲诲姩琛ㄥ崟 */
export function useActivityFormSchema(
@@ -30,6 +73,19 @@
dependencies: { triggerFields: [''], show: () => false },
},
{
+ fieldName: 'activityType',
+ label: '娲诲姩妯℃澘',
+ component: 'Select',
+ componentProps: {
+ options: ACTIVITY_TYPE_OPTIONS,
+ placeholder: '璇烽�夋嫨娲诲姩妯℃澘',
+ disabled: readonly,
+ },
+ rules: 'required',
+ help: '涓嶅悓妯℃澘鍐冲畾鎺ㄩ�佸舰鎬侊細绾�氱煡/鍗曟潯娑堟伅/鍥剧墖/闄勪欢锛屾垨甯﹁〃鍗曠殑鏁版嵁閲囬泦',
+ formItemClass: 'col-span-2',
+ },
+ {
fieldName: 'title',
label: '娲诲姩鏍囬',
component: 'Input',
@@ -38,6 +94,22 @@
disabled: readonly,
},
rules: 'required',
+ formItemClass: 'col-span-2',
+ },
+ {
+ fieldName: 'buttonText',
+ label: '鎸夐挳鏂囨',
+ component: 'Input',
+ componentProps: {
+ placeholder: '濡傦細鏌ョ湅璇︽儏 / 绔嬪嵆鎶ュ悕',
+ disabled: readonly,
+ },
+ dependencies: {
+ triggerFields: ['activityType'],
+ show: (values) =>
+ values.activityType === ACTIVITY_TYPE.MESSAGE ||
+ values.activityType === ACTIVITY_TYPE.FORM,
+ },
formItemClass: 'col-span-2',
},
{
@@ -64,12 +136,20 @@
label: '鎶ュ悕寮�濮�',
component: 'DatePicker',
componentProps: { ...DATETIME_PROPS, disabled: readonly },
+ dependencies: {
+ triggerFields: ['activityType'],
+ show: isFormType,
+ },
},
{
fieldName: 'signupEndTime',
label: '鎶ュ悕鎴',
component: 'DatePicker',
componentProps: { ...DATETIME_PROPS, disabled: readonly },
+ dependencies: {
+ triggerFields: ['activityType'],
+ show: isFormType,
+ },
},
{
fieldName: 'signupLimit',
@@ -81,8 +161,13 @@
class: 'w-full',
disabled: readonly,
},
+ defaultValue: 0,
rules: 'required',
help: '濉� 0 琛ㄧず涓嶉檺鍚嶉',
+ dependencies: {
+ triggerFields: ['activityType'],
+ show: isFormType,
+ },
},
{
// 灏侀潰璧伴檮浠朵腑闂磋〃锛氳繖閲屾彁浜� blobIds锛屽洖鏄捐 attachmentList锛堣 form.vue 鐨勬槧灏勫嚱鏁帮級
@@ -114,6 +199,100 @@
disabled: readonly,
},
formItemClass: 'col-span-2',
+ },
+ {
+ // 璇︽儏鍥剧墖璧板彟涓�濂楅檮浠跺叧绯伙紙recordType = wxcp_activity_detail锛夛紝涓庡皝闈簰涓嶅奖鍝嶃��
+ // 鎶ュ悕椤垫妸瀹冩帓鍦ㄣ�屾椿鍔ㄨ鎯呫�嶆枃瀛椾笅鏂广�佹寜鍘熷浘姣斾緥瀹屾暣灞曠ず锛堜笉瑁佸壀锛夛紝
+ // 鎵�浠ヤ簩缁寸爜/娴锋姤杩欑被琚灏卞け鏁堢殑鍥惧繀椤绘斁杩欓噷锛屽埆鏀惧皝闈€��
+ fieldName: 'detailBlobIds',
+ label: '璇︽儏鍥剧墖',
+ component: 'ImageUpload',
+ componentProps: {
+ valueKey: 'id',
+ resultField: 'id',
+ maxNumber: 5,
+ multiple: true,
+ disabled: readonly,
+ },
+ help: '閫夊~锛屾渶澶� 5 寮狅紱娲诲姩椤垫寜鍘熷浘姣斾緥瀹屾暣鏄剧ず涓嶈鍓紝浜岀淮鐮佸缓璁斁杩欓噷',
+ formItemClass: 'col-span-2',
+ },
+ {
+ // 鍥剧墖閫氱煡妯℃澘锛氭帹閫佹椂閫愬紶鍙戝浘鐗囨秷鎭紙浼佷笟寰俊鍥剧墖娑堟伅锛�
+ fieldName: 'imageBlobIds',
+ label: '鎺ㄩ�佸浘鐗�',
+ component: 'ImageUpload',
+ componentProps: {
+ valueKey: 'id',
+ resultField: 'id',
+ maxNumber: 9,
+ multiple: true,
+ disabled: readonly,
+ },
+ dependencies: {
+ triggerFields: ['activityType'],
+ show: (values) => values.activityType === ACTIVITY_TYPE.IMAGE,
+ },
+ help: '鎺ㄩ�佹椂閫愬紶鍙戦�佸浘鐗囨秷鎭紝鏈�澶� 9 寮�',
+ formItemClass: 'col-span-2',
+ },
+ {
+ // 闄勪欢閫氱煡妯℃澘锛氭帹閫佹椂閫愪釜鍙戞枃浠舵秷鎭紝鎺ユ敹浜哄彲鐩存帴涓嬭浇
+ fieldName: 'fileBlobIds',
+ label: '鎺ㄩ�侀檮浠�',
+ component: 'FileUpload',
+ componentProps: {
+ valueKey: 'id',
+ maxNumber: 5,
+ multiple: true,
+ showDescription: !readonly,
+ disabled: readonly,
+ },
+ dependencies: {
+ triggerFields: ['activityType'],
+ show: (values) => values.activityType === ACTIVITY_TYPE.FILE,
+ },
+ help: '鎺ㄩ�佹椂閫愪釜鍙戦�佹枃浠舵秷鎭紝鍗曚釜涓嶈秴杩� 20MB锛屾渶澶� 5 涓�',
+ formItemClass: 'col-span-2',
+ },
+ {
+ fieldName: 'ratingEnabled',
+ label: '寮�鍚瘎浠�',
+ component: 'Switch',
+ componentProps: { disabled: readonly },
+ dependencies: {
+ triggerFields: ['activityType'],
+ show: isFormType,
+ },
+ },
+ {
+ fieldName: 'ratingTitle',
+ label: '璇勪环鏍囬',
+ component: 'Input',
+ componentProps: {
+ placeholder: '濡傦細娲诲姩婊℃剰搴﹁瘎浠�',
+ disabled: readonly,
+ },
+ dependencies: {
+ triggerFields: ['activityType', 'ratingEnabled'],
+ show: (values) => isFormType(values) && values.ratingEnabled === true,
+ },
+ },
+ {
+ fieldName: 'ratingMax',
+ label: '鏈�楂樻槦绾�',
+ component: 'InputNumber',
+ componentProps: {
+ min: 1,
+ max: 10,
+ class: 'w-full',
+ disabled: readonly,
+ },
+ defaultValue: 5,
+ dependencies: {
+ triggerFields: ['activityType', 'ratingEnabled'],
+ show: (values) => isFormType(values) && values.ratingEnabled === true,
+ },
},
{
fieldName: 'remark',
@@ -160,6 +339,11 @@
/** 娲诲姩鍒楄〃瀛楁 */
export function useActivityGridColumns(): VxeTableGridOptions<WxCpActivityApi.Activity>['columns'] {
return [
+ {
+ field: 'activityTypeName',
+ title: '妯℃澘',
+ width: 150,
+ },
{
field: 'title',
title: '娲诲姩鏍囬',
@@ -234,6 +418,18 @@
slots: { default: 'content' },
},
{
+ field: 'fieldValues',
+ title: '閲囬泦鍐呭',
+ minWidth: 200,
+ slots: { default: 'fieldValues' },
+ },
+ {
+ field: 'ratingScore',
+ title: '璇勪环',
+ width: 80,
+ slots: { default: 'ratingScore' },
+ },
+ {
field: 'attachment',
title: '闄勪欢',
width: 80,
--
Gitblit v1.9.3