From 61e06cce09b80ff7b9ada0240654a2443c726c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=97=B4=E8=B4=A7?= <252048765@qq.com> Date: Mon, 5 May 2025 12:19:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=AE=9D=E6=B8=A0=E9=81=93=E9=85=8D=E7=BD=AE=E5=92=8C?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=9B=B8=E5=85=B3=E8=A1=A8=E5=8D=95=E5=92=8C?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/package.json | 1 + apps/web-antd/src/adapter/form.ts | 1 + .../src/components/upload/file-upload.vue | 6 +- apps/web-antd/src/views/pay/app/data.ts | 223 +++++++++ apps/web-antd/src/views/pay/app/index.vue | 430 +++++++++++++++++- .../src/views/pay/app/modules/app-form.vue | 90 ++++ .../app/modules/channel/AlipayChannelForm.vue | 139 ++++++ .../src/views/pay/app/modules/channel/data.ts | 204 +++++++++ docs/src/components/common-ui/vben-form.md | 12 + .../ui-kit/form-ui/src/form-render/form.vue | 6 +- packages/@core/ui-kit/form-ui/src/types.ts | 2 + .../ui-kit/popup-ui/src/modal/modal-api.ts | 8 + .../utils/src/helpers/get-popup-container.ts | 28 ++ pnpm-lock.yaml | 3 + 14 files changed, 1130 insertions(+), 23 deletions(-) create mode 100644 apps/web-antd/src/views/pay/app/data.ts create mode 100644 apps/web-antd/src/views/pay/app/modules/app-form.vue create mode 100644 apps/web-antd/src/views/pay/app/modules/channel/AlipayChannelForm.vue create mode 100644 apps/web-antd/src/views/pay/app/modules/channel/data.ts diff --git a/apps/web-antd/package.json b/apps/web-antd/package.json index e5c1e01d6..cd817905a 100644 --- a/apps/web-antd/package.json +++ b/apps/web-antd/package.json @@ -26,6 +26,7 @@ "#/*": "./src/*" }, "dependencies": { + "@ant-design/icons-vue": "^7.0.1", "@form-create/ant-design-vue": "catalog:", "@form-create/antd-designer": "catalog:", "@tinymce/tinymce-vue": "catalog:", diff --git a/apps/web-antd/src/adapter/form.ts b/apps/web-antd/src/adapter/form.ts index cf75673e5..a1653a237 100644 --- a/apps/web-antd/src/adapter/form.ts +++ b/apps/web-antd/src/adapter/form.ts @@ -68,3 +68,4 @@ export { useVbenForm, z }; export type VbenFormSchema = FormSchema; export type { VbenFormProps }; +export type FormSchemaGetter = () => VbenFormSchema[]; diff --git a/apps/web-antd/src/components/upload/file-upload.vue b/apps/web-antd/src/components/upload/file-upload.vue index 91d7cc669..0d479942e 100644 --- a/apps/web-antd/src/components/upload/file-upload.vue +++ b/apps/web-antd/src/components/upload/file-upload.vue @@ -55,7 +55,7 @@ const props = withDefaults( showDescription: false, }, ); -const emit = defineEmits(['change', 'update:value', 'delete']); +const emit = defineEmits(['change', 'update:value', 'delete', 'getText']); const { accept, helpText, maxNumber, maxSize } = toRefs(props); const isInnerOperate = ref(false); const { getStringAccept } = useUploadType({ @@ -122,6 +122,10 @@ const handleRemove = async (file: UploadFile) => { }; const beforeUpload = async (file: File) => { + // 使用现代的Blob.text()方法替代FileReader + const fileContent = await file.text(); + emit('getText', fileContent); + const { maxSize, accept } = props; const isAct = checkFileType(file, accept); if (!isAct) { diff --git a/apps/web-antd/src/views/pay/app/data.ts b/apps/web-antd/src/views/pay/app/data.ts new file mode 100644 index 000000000..4ab541952 --- /dev/null +++ b/apps/web-antd/src/views/pay/app/data.ts @@ -0,0 +1,223 @@ +import type { FormSchemaGetter } from '#/adapter/form'; +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { DICT_TYPE, getDictOptions } from '#/utils/dict'; + +export const querySchema: FormSchemaGetter = () => [ + { + component: 'Input', + fieldName: 'name', + label: '应用名', + componentProps: { + placeholder: '请输入应用名', + }, + }, + { + component: 'Select', + fieldName: 'status', + label: '开启状态', + componentProps: { + placeholder: '请选择开启状态', + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + }, + }, + { + component: 'RangePicker', + fieldName: 'createTime', + label: '创建时间', + componentProps: { + placeholder: ['开始日期', '结束日期'], + }, + }, +]; + +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60 }, + { + title: '应用标识', + field: 'appKey', + }, + { + title: '应用名', + field: 'name', + }, + { + title: '开启状态', + field: 'status', + slots: { + default: 'status', + }, + }, + { + title: '支付宝配置', + children: [ + { + title: 'APP 支付', + slots: { + default: 'alipayAppConfig', + }, + }, + { + title: 'PC 网站支付', + slots: { + default: 'alipayPCConfig', + }, + }, + { + title: 'WAP 网站支付', + slots: { + default: 'alipayWAPConfig', + }, + }, + { + title: '扫码支付', + slots: { + default: 'alipayQrConfig', + }, + }, + { + title: '条码支付', + slots: { + default: 'alipayBarConfig', + }, + }, + ], + }, + { + title: '微信配置', + children: [ + { + title: '小程序支付', + slots: { + default: 'wxLiteConfig', + }, + }, + { + title: 'JSAPI 支付', + slots: { + default: 'wxPubConfig', + }, + }, + { + title: 'APP 支付', + slots: { + default: 'wxAppConfig', + }, + }, + { + title: 'Native 支付', + slots: { + default: 'wxNativeConfig', + }, + }, + { + title: 'WAP 网站支付', + slots: { + default: 'wxWapConfig', + }, + }, + { + title: '条码支付', + slots: { + default: 'wxBarConfig', + }, + }, + ], + }, + { + title: '钱包支付配置', + field: 'walletConfig', + slots: { + default: 'walletConfig', + }, + }, + { + title: '模拟支付配置', + field: 'mockConfig', + slots: { + default: 'mockConfig', + }, + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '操作', + width: 250, + }, +]; + +export const modalSchema: FormSchemaGetter = () => [ + { + label: '应用编号', + fieldName: 'id', + component: 'Input', + dependencies: { + show: () => false, + triggerFields: [''], + }, + }, + { + label: '应用名', + fieldName: 'name', + component: 'Input', + rules: 'required', + componentProps: { + placeholder: '请输入应用名', + }, + }, + { + label: '应用标识', + fieldName: 'appKey', + component: 'Input', + rules: 'required', + componentProps: { + placeholder: '请输入应用标识', + }, + }, + { + label: '开启状态', + fieldName: 'status', + component: 'RadioGroup', + rules: 'required', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + }, + }, + { + label: '支付结果的回调地址', + fieldName: 'orderNotifyUrl', + component: 'Input', + rules: 'required', + componentProps: { + placeholder: '请输入支付结果的回调地址', + }, + }, + { + label: '退款结果的回调地址', + fieldName: 'refundNotifyUrl', + component: 'Input', + rules: 'required', + componentProps: { + placeholder: '请输入支付结果的回调地址', + }, + }, + { + label: '转账结果的回调地址', + fieldName: 'transferNotifyUrl', + component: 'Input', + rules: 'required', + componentProps: { + placeholder: '请输入转账结果的回调地址', + }, + }, + { + label: '备注', + fieldName: 'remark', + component: 'Textarea', + componentProps: { + rows: 3, + placeholder: '请输入备注', + }, + }, +]; diff --git a/apps/web-antd/src/views/pay/app/index.vue b/apps/web-antd/src/views/pay/app/index.vue index 199d0ebd2..81ccaf6bd 100644 --- a/apps/web-antd/src/views/pay/app/index.vue +++ b/apps/web-antd/src/views/pay/app/index.vue @@ -1,31 +1,419 @@ diff --git a/apps/web-antd/src/views/pay/app/modules/app-form.vue b/apps/web-antd/src/views/pay/app/modules/app-form.vue new file mode 100644 index 000000000..3791d15a1 --- /dev/null +++ b/apps/web-antd/src/views/pay/app/modules/app-form.vue @@ -0,0 +1,90 @@ + + diff --git a/apps/web-antd/src/views/pay/app/modules/channel/AlipayChannelForm.vue b/apps/web-antd/src/views/pay/app/modules/channel/AlipayChannelForm.vue new file mode 100644 index 000000000..30f7bc351 --- /dev/null +++ b/apps/web-antd/src/views/pay/app/modules/channel/AlipayChannelForm.vue @@ -0,0 +1,139 @@ + +