Browse Source

!316 增加全局超长number序列化 vue3 pay模块重构
Merge pull request !316 from xingyu/feature/vue3

芋道源码 2 years ago
parent
commit
cb0daf3c23
37 changed files with 1263 additions and 1275 deletions
  1. 8 4
      yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/framework/config/SecurityConfiguration.java
  2. 8 4
      yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/framework/config/SecurityConfiguration.java
  3. 1 0
      yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/SetUtils.java
  4. 1 0
      yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/YudaoAuthRequestFactory.java
  5. 9 9
      yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
  6. 3 2
      yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/config/YudaoJacksonAutoConfiguration.java
  7. 31 0
      yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core/databind/NumberSerializer.java
  8. 0 0
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java
  9. 5 5
      yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm
  10. 2 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/captcha/CaptchaController.java
  11. 1 1
      yudao-ui-admin-vue3/package.json
  12. 144 226
      yudao-ui-admin-vue3/pnpm-lock.yaml
  13. 10 7
      yudao-ui-admin-vue3/prettier.config.js
  14. 40 8
      yudao-ui-admin-vue3/src/api/pay/app/index.ts
  15. 0 11
      yudao-ui-admin-vue3/src/api/pay/app/types.ts
  16. 36 3
      yudao-ui-admin-vue3/src/api/pay/channel/index.ts
  17. 0 11
      yudao-ui-admin-vue3/src/api/pay/channel/types.ts
  18. 30 3
      yudao-ui-admin-vue3/src/api/pay/merchant/index.ts
  19. 0 9
      yudao-ui-admin-vue3/src/api/pay/merchant/types.ts
  20. 80 3
      yudao-ui-admin-vue3/src/api/pay/order/index.ts
  21. 0 26
      yudao-ui-admin-vue3/src/api/pay/order/types.ts
  22. 87 3
      yudao-ui-admin-vue3/src/api/pay/refund/index.ts
  23. 0 26
      yudao-ui-admin-vue3/src/api/pay/refund/types.ts
  24. 23 17
      yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts
  25. 1 1
      yudao-ui-admin-vue3/src/locales/en.ts
  26. 1 1
      yudao-ui-admin-vue3/src/locales/zh-CN.ts
  27. 2 2
      yudao-ui-admin-vue3/src/views/Home/Index.vue
  28. 1 1
      yudao-ui-admin-vue3/src/views/infra/job/index.vue
  29. 55 61
      yudao-ui-admin-vue3/src/views/pay/app/app.data.ts
  30. 112 127
      yudao-ui-admin-vue3/src/views/pay/app/index.vue
  31. 111 128
      yudao-ui-admin-vue3/src/views/pay/merchant/index.vue
  32. 53 83
      yudao-ui-admin-vue3/src/views/pay/merchant/merchant.data.ts
  33. 59 141
      yudao-ui-admin-vue3/src/views/pay/order/index.vue
  34. 130 162
      yudao-ui-admin-vue3/src/views/pay/order/order.data.ts
  35. 50 85
      yudao-ui-admin-vue3/src/views/pay/refund/index.vue
  36. 168 104
      yudao-ui-admin-vue3/src/views/pay/refund/refund.data.ts
  37. 1 1
      yudao-ui-admin-vue3/src/views/system/user/index.vue

+ 8 - 4
yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/framework/config/SecurityConfiguration.java

@@ -2,17 +2,20 @@ package cn.iocoder.yudao.ssodemo.framework.config;
 
 import cn.iocoder.yudao.ssodemo.framework.core.filter.TokenAuthenticationFilter;
 import cn.iocoder.yudao.ssodemo.framework.core.handler.AccessDeniedHandlerImpl;
+import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.http.HttpMethod;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
 import org.springframework.security.web.AuthenticationEntryPoint;
+import org.springframework.security.web.SecurityFilterChain;
 import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
 
 import javax.annotation.Resource;
 
 @Configuration(proxyBeanMethods = false)
-public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
+@EnableWebSecurity
+public class SecurityConfiguration{
 
     @Resource
     private TokenAuthenticationFilter tokenAuthenticationFilter;
@@ -22,8 +25,8 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
     @Resource
     private AuthenticationEntryPoint authenticationEntryPoint;
 
-    @Override
-    protected void configure(HttpSecurity httpSecurity) throws Exception {
+    @Bean
+    protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
         // 设置 URL 安全权限
         httpSecurity.csrf().disable() // 禁用 CSRF 保护
                 .authorizeRequests()
@@ -43,6 +46,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
 
         // 添加 Token Filter
         httpSecurity.addFilterBefore(tokenAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
+        return httpSecurity.build();
     }
 
 }

+ 8 - 4
yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/framework/config/SecurityConfiguration.java

@@ -2,17 +2,20 @@ package cn.iocoder.yudao.ssodemo.framework.config;
 
 import cn.iocoder.yudao.ssodemo.framework.core.filter.TokenAuthenticationFilter;
 import cn.iocoder.yudao.ssodemo.framework.core.handler.AccessDeniedHandlerImpl;
+import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.http.HttpMethod;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
 import org.springframework.security.web.AuthenticationEntryPoint;
+import org.springframework.security.web.SecurityFilterChain;
 import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
 
 import javax.annotation.Resource;
 
 @Configuration(proxyBeanMethods = false)
-public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
+@EnableWebSecurity
+public class SecurityConfiguration {
 
     @Resource
     private TokenAuthenticationFilter tokenAuthenticationFilter;
@@ -22,8 +25,8 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
     @Resource
     private AuthenticationEntryPoint authenticationEntryPoint;
 
-    @Override
-    protected void configure(HttpSecurity httpSecurity) throws Exception {
+    @Bean
+    protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
         // 设置 URL 安全权限
         httpSecurity.csrf().disable() // 禁用 CSRF 保护
                 .authorizeRequests()
@@ -43,6 +46,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
 
         // 添加 Token Filter
         httpSecurity.addFilterBefore(tokenAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
+        return httpSecurity.build();
     }
 
 }

+ 1 - 0
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/SetUtils.java

@@ -11,6 +11,7 @@ import java.util.Set;
  */
 public class SetUtils {
 
+    @SafeVarargs
     public static <T> Set<T> asSet(T... objs) {
         return new HashSet<>(Arrays.asList(objs));
     }

+ 1 - 0
yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/YudaoAuthRequestFactory.java

@@ -43,6 +43,7 @@ public class YudaoAuthRequestFactory extends AuthRequestFactory {
      * @param source {@link AuthSource}
      * @return {@link AuthRequest}
      */
+    @Override
     public AuthRequest get(String source) {
         // 先尝试获取自定义扩展的
         AuthRequest authRequest = getExtendRequest(source);

+ 9 - 9
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java

@@ -5,16 +5,16 @@ import cn.iocoder.yudao.framework.web.config.WebProperties;
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.Multimap;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.http.HttpMethod;
 import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
 import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
 import org.springframework.security.config.http.SessionCreationPolicy;
 import org.springframework.security.web.AuthenticationEntryPoint;
+import org.springframework.security.web.SecurityFilterChain;
 import org.springframework.security.web.access.AccessDeniedHandler;
 import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
 import org.springframework.web.method.HandlerMethod;
@@ -34,7 +34,7 @@ import java.util.Set;
  */
 @AutoConfiguration
 @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
-public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
+public class YudaoWebSecurityConfigurerAdapter {
 
     @Resource
     private WebProperties webProperties;
@@ -72,11 +72,9 @@ public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdap
      * 由于 Spring Security 创建 AuthenticationManager 对象时,没声明 @Bean 注解,导致无法被注入
      * 通过覆写父类的该方法,添加 @Bean 注解,解决该问题
      */
-    @Override
     @Bean
-    @ConditionalOnMissingBean(AuthenticationManager.class)
-    public AuthenticationManager authenticationManagerBean() throws Exception {
-        return super.authenticationManagerBean();
+    public AuthenticationManager authenticationManagerBean(AuthenticationConfiguration authenticationConfiguration) throws Exception {
+        return authenticationConfiguration.getAuthenticationManager();
     }
 
     /**
@@ -96,8 +94,8 @@ public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdap
      * rememberMe          |   允许通过remember-me登录的用户访问
      * authenticated       |   用户登录后可访问
      */
-    @Override
-    protected void configure(HttpSecurity httpSecurity) throws Exception {
+    @Bean
+    protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
         // 登出
         httpSecurity
                 // 开启跨域
@@ -141,6 +139,8 @@ public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdap
 
         // 添加 Token Filter
         httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
+
+        return httpSecurity.build();
     }
 
     private String buildAppApi(String url) {

+ 3 - 2
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/config/YudaoJacksonAutoConfiguration.java

@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.framework.jackson.config;
 
+import cn.iocoder.yudao.framework.jackson.core.databind.NumberSerializer;
 import cn.iocoder.yudao.framework.jackson.core.databind.LocalDateTimeDeserializer;
 import cn.iocoder.yudao.framework.jackson.core.databind.LocalDateTimeSerializer;
 import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
@@ -32,8 +33,8 @@ public class YudaoJacksonAutoConfiguration {
                  * 2. 新增LocalDateTime序列化、反序列化规则
                  */
                 simpleModule
-//                .addSerializer(Long.class, ToStringSerializer.instance)
-//                    .addSerializer(Long.TYPE, ToStringSerializer.instance)
+                        .addSerializer(Long.class, NumberSerializer.INSTANCE)
+                        .addSerializer(Long.TYPE, NumberSerializer.INSTANCE)
                         .addSerializer(LocalDateTime.class, LocalDateTimeSerializer.INSTANCE)
                         .addDeserializer(LocalDateTime.class, LocalDateTimeDeserializer.INSTANCE);
 

+ 31 - 0
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/core/databind/NumberSerializer.java

@@ -0,0 +1,31 @@
+package cn.iocoder.yudao.framework.jackson.core.databind;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
+
+import java.io.IOException;
+/**
+ * Long序列化规则
+ * <p>
+ * 会将超长long值转换为string
+ */
+@JacksonStdImpl
+public class NumberSerializer extends com.fasterxml.jackson.databind.ser.std.NumberSerializer {
+    private static final long MAX_SAFE_INTEGER = 9007199254740991L;
+    private static final long MIN_SAFE_INTEGER = -9007199254740991L;
+
+    public static final NumberSerializer INSTANCE = new NumberSerializer(Number.class);
+    public NumberSerializer(Class<? extends Number> rawType) {
+        super(rawType);
+    }
+    @Override
+    public void serialize(Number value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
+        // 超出范围 序列化位字符串
+        if (value.longValue() > MIN_SAFE_INTEGER && value.longValue() < MAX_SAFE_INTEGER) {
+            super.serialize(value, gen, serializers);
+        } else {
+            gen.writeString(value.toString());
+        }
+    }
+}

File diff suppressed because it is too large
+ 0 - 0
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java


+ 5 - 5
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm

@@ -3,10 +3,10 @@ import request from '@/config/axios'
 export interface ${simpleClassName}VO {
 #foreach ($column in $columns)
 #if ($column.createOperation || $column.updateOperation)
-#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")
+#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "double")
   ${column.javaField}: number
 #elseif(${column.javaType.toLowerCase()} == "date")
-  ${column.javaField}: string
+  ${column.javaField}: Date
 #else
   ${column.javaField}: ${column.javaType.toLowerCase()}
 #end
@@ -17,10 +17,10 @@ export interface ${simpleClassName}VO {
 export interface ${simpleClassName}PageReqVO extends PageParam {
 #foreach ($column in $columns)
 #if (${column.listOperation})##查询操作
-#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")
+#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "double")
   ${column.javaField}?: number
 #elseif(${column.javaType.toLowerCase()} == "date")
-  ${column.javaField}?: string[]
+  ${column.javaField}?: Date[]
 #else
   ${column.javaField}?: ${column.javaType.toLowerCase()}
 #end
@@ -31,7 +31,7 @@ export interface ${simpleClassName}PageReqVO extends PageParam {
 export interface ${simpleClassName}ExcelReqVO {
 #foreach ($column in $columns)
 #if (${column.listOperation})##查询操作
-#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")
+#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "double")
   ${column.javaField}?: number
 #elseif(${column.javaType.toLowerCase()} == "date")
   ${column.javaField}?: string[]

+ 2 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/captcha/CaptchaController.java

@@ -30,6 +30,7 @@ public class CaptchaController extends com.anji.captcha.controller.CaptchaContro
     @ApiOperation("获得验证码")
     @PermitAll
     @OperateLog(enable = false) // 避免 Post 请求被记录操作日志
+    @Override
     public ResponseModel get(@RequestBody CaptchaVO data, HttpServletRequest request) {
         return super.get(data, request);
     }
@@ -38,6 +39,7 @@ public class CaptchaController extends com.anji.captcha.controller.CaptchaContro
     @ApiOperation("校验验证码")
     @PermitAll
     @OperateLog(enable = false) // 避免 Post 请求被记录操作日志
+    @Override
     public ResponseModel check(@RequestBody CaptchaVO data, HttpServletRequest request) {
         return super.check(data, request);
     }

+ 1 - 1
yudao-ui-admin-vue3/package.json

@@ -104,7 +104,7 @@
     "vite-plugin-svg-icons": "^2.0.1",
     "vite-plugin-vue-setup-extend": "^0.4.0",
     "vite-plugin-windicss": "^1.8.8",
-    "vue-tsc": "^1.0.9",
+    "vue-tsc": "^1.0.10",
     "windicss": "^3.5.6"
   },
   "engines": {

File diff suppressed because it is too large
+ 144 - 226
yudao-ui-admin-vue3/pnpm-lock.yaml


+ 10 - 7
yudao-ui-admin-vue3/prettier.config.js

@@ -1,14 +1,17 @@
 module.exports = {
-  printWidth: 100,
-  tabWidth: 2,
-  useTabs: false,
-  semi: false,
+  printWidth: 100, // 每行代码长度(默认80)
+  tabWidth: 2, // 每个tab相当于多少个空格(默认2)ab进行缩进(默认false)
+  useTabs: false, // 是否使用tab
+  semi: false, // 声明结尾使用分号(默认true)
   vueIndentScriptAndStyle: false,
-  singleQuote: true,
+  singleQuote: true, // 使用单引号(默认false)
   quoteProps: 'as-needed',
-  bracketSpacing: true,
-  trailingComma: 'none',
+  bracketSpacing: true, // 对象字面量的大括号间使用空格(默认true)
+  trailingComma: 'none', // 多行使用拖尾逗号(默认none)
   jsxSingleQuote: false,
+  // 箭头函数参数括号 默认avoid 可选 avoid| always
+  // avoid 能省略括号的时候就省略 例如x => x
+  // always 总是有括号
   arrowParens: 'always',
   insertPragma: false,
   requirePragma: false,

+ 40 - 8
yudao-ui-admin-vue3/src/api/pay/app/index.ts

@@ -1,8 +1,44 @@
 import request from '@/config/axios'
-import type { AppVO } from './types'
+
+export interface AppVO {
+  id: number
+  name: string
+  status: number
+  remark: string
+  payNotifyUrl: string
+  refundNotifyUrl: string
+  merchantId: number
+  merchantName: string
+  createTime: Date
+}
+
+export interface AppPageReqVO extends PageParam {
+  name?: string
+  status?: number
+  remark?: string
+  payNotifyUrl?: string
+  refundNotifyUrl?: string
+  merchantName?: string
+  createTime?: Date[]
+}
+
+export interface AppExportReqVO {
+  name?: string
+  status?: number
+  remark?: string
+  payNotifyUrl?: string
+  refundNotifyUrl?: string
+  merchantName?: string
+  createTime?: Date[]
+}
+
+export interface AppUpdateStatusReqVO {
+  id: number
+  status: number
+}
 
 // 查询列表支付应用
-export const getAppPageApi = (params) => {
+export const getAppPageApi = (params: AppPageReqVO) => {
   return request.get({ url: '/pay/app/page', params })
 }
 
@@ -22,11 +58,7 @@ export const updateAppApi = (data: AppVO) => {
 }
 
 // 支付应用信息状态修改
-export const changeAppStatusApi = (id: number, status: number) => {
-  const data = {
-    id,
-    status
-  }
+export const changeAppStatusApi = (data: AppUpdateStatusReqVO) => {
   return request.put({ url: '/pay/app/update-status', data: data })
 }
 
@@ -36,7 +68,7 @@ export const deleteAppApi = (id: number) => {
 }
 
 // 导出支付应用
-export const exportAppApi = (params) => {
+export const exportAppApi = (params: AppExportReqVO) => {
   return request.download({ url: '/pay/app/export-excel', params })
 }
 

+ 0 - 11
yudao-ui-admin-vue3/src/api/pay/app/types.ts

@@ -1,11 +0,0 @@
-export type AppVO = {
-  id: number
-  name: string
-  status: number
-  remark: string
-  payNotifyUrl: string
-  refundNotifyUrl: string
-  merchantName: string
-  merchantId: number
-  createTime: string
-}

+ 36 - 3
yudao-ui-admin-vue3/src/api/pay/channel/index.ts

@@ -1,8 +1,41 @@
 import request from '@/config/axios'
-import type { ChannelVO } from './types'
+
+export interface ChannelVO {
+  id: number
+  code: string
+  config: string
+  status: number
+  remark: string
+  feeRate: number
+  merchantId: number
+  appId: number
+  createTime: Date
+}
+
+export interface ChannelPageReqVO extends PageParam {
+  code?: string
+  status?: number
+  remark?: string
+  feeRate?: number
+  merchantId?: number
+  appId?: number
+  config?: string
+  createTime?: Date[]
+}
+
+export interface ChannelExportReqVO {
+  code?: string
+  status?: number
+  remark?: string
+  feeRate?: number
+  merchantId?: number
+  appId?: number
+  config?: string
+  createTime?: Date[]
+}
 
 // 查询列表支付渠道
-export const getChannelPageApi = (params) => {
+export const getChannelPageApi = (params: ChannelPageReqVO) => {
   return request.get({ url: '/pay/channel/page', params })
 }
 
@@ -32,6 +65,6 @@ export const deleteChannelApi = (id: number) => {
 }
 
 // 导出支付渠道
-export const exportChannelApi = (params) => {
+export const exportChannelApi = (params: ChannelExportReqVO) => {
   return request.download({ url: '/pay/channel/export-excel', params })
 }

+ 0 - 11
yudao-ui-admin-vue3/src/api/pay/channel/types.ts

@@ -1,11 +0,0 @@
-export type ChannelVO = {
-  id: number
-  code: string
-  config: string
-  status: number
-  remark: string
-  feeRate: number
-  merchantId: number
-  appId: number
-  createTime: string
-}

+ 30 - 3
yudao-ui-admin-vue3/src/api/pay/merchant/index.ts

@@ -1,8 +1,35 @@
 import request from '@/config/axios'
-import type { MerchantVO } from './types'
+
+export interface MerchantVO {
+  id: number
+  no: string
+  name: string
+  shortName: string
+  status: number
+  remark: string
+  createTime: Date
+}
+
+export interface MerchantPageReqVO extends PageParam {
+  no?: string
+  name?: string
+  shortName?: string
+  status?: number
+  remark?: string
+  createTime?: Date[]
+}
+
+export interface MerchantExportReqVO {
+  no?: string
+  name?: string
+  shortName?: string
+  status?: number
+  remark?: string
+  createTime?: Date[]
+}
 
 // 查询列表支付商户
-export const getMerchantPageApi = (params) => {
+export const getMerchantPageApi = (params: MerchantPageReqVO) => {
   return request.get({ url: '/pay/merchant/page', params })
 }
 
@@ -37,7 +64,7 @@ export const deleteMerchantApi = (id: number) => {
 }
 
 // 导出支付商户
-export const exportMerchantApi = (params) => {
+export const exportMerchantApi = (params: MerchantExportReqVO) => {
   return request.download({ url: '/pay/merchant/export-excel', params })
 }
 // 支付商户状态修改

+ 0 - 9
yudao-ui-admin-vue3/src/api/pay/merchant/types.ts

@@ -1,9 +0,0 @@
-export type MerchantVO = {
-  id: number
-  no: string
-  name: string
-  shortName: string
-  status: number
-  remark: string
-  createTime: string
-}

+ 80 - 3
yudao-ui-admin-vue3/src/api/pay/order/index.ts

@@ -1,8 +1,85 @@
 import request from '@/config/axios'
-import type { OrderVO } from './types'
+
+export interface OrderVO {
+  id: number
+  merchantId: number
+  appId: number
+  channelId: number
+  channelCode: string
+  merchantOrderId: string
+  subject: string
+  body: string
+  notifyUrl: string
+  notifyStatus: number
+  amount: number
+  channelFeeRate: number
+  channelFeeAmount: number
+  status: number
+  userIp: string
+  expireTime: Date
+  successTime: Date
+  notifyTime: Date
+  successExtensionId: number
+  refundStatus: number
+  refundTimes: number
+  refundAmount: number
+  channelUserId: string
+  channelOrderNo: string
+  createTime: Date
+}
+
+export interface OrderPageReqVO extends PageParam {
+  merchantId?: number
+  appId?: number
+  channelId?: number
+  channelCode?: string
+  merchantOrderId?: string
+  subject?: string
+  body?: string
+  notifyUrl?: string
+  notifyStatus?: number
+  amount?: number
+  channelFeeRate?: number
+  channelFeeAmount?: number
+  status?: number
+  expireTime?: Date[]
+  successTime?: Date[]
+  notifyTime?: Date[]
+  successExtensionId?: number
+  refundStatus?: number
+  refundTimes?: number
+  channelUserId?: string
+  channelOrderNo?: string
+  createTime?: Date[]
+}
+
+export interface OrderExportReqVO {
+  merchantId?: number
+  appId?: number
+  channelId?: number
+  channelCode?: string
+  merchantOrderId?: string
+  subject?: string
+  body?: string
+  notifyUrl?: string
+  notifyStatus?: number
+  amount?: number
+  channelFeeRate?: number
+  channelFeeAmount?: number
+  status?: number
+  expireTime?: Date[]
+  successTime?: Date[]
+  notifyTime?: Date[]
+  successExtensionId?: number
+  refundStatus?: number
+  refundTimes?: number
+  channelUserId?: string
+  channelOrderNo?: string
+  createTime?: Date[]
+}
 
 // 查询列表支付订单
-export const getOrderPageApi = async (params) => {
+export const getOrderPageApi = async (params: OrderPageReqVO) => {
   return await request.get({ url: '/pay/order/page', params })
 }
 
@@ -27,6 +104,6 @@ export const deleteOrderApi = async (id: number) => {
 }
 
 // 导出支付订单
-export const exportOrderApi = async (params) => {
+export const exportOrderApi = async (params: OrderExportReqVO) => {
   return await request.download({ url: '/pay/order/export-excel', params })
 }

+ 0 - 26
yudao-ui-admin-vue3/src/api/pay/order/types.ts

@@ -1,26 +0,0 @@
-export type OrderVO = {
-  id: number
-  merchantId: number
-  appId: number
-  channelId: number
-  channelCode: string
-  merchantOrderId: string
-  subject: string
-  body: string
-  notifyUrl: string
-  notifyStatus: number
-  amount: number
-  channelFeeRate: number
-  channelFeeAmount: number
-  status: number
-  userIp: string
-  expireTime: string
-  successTime: string
-  notifyTime: string
-  successExtensionId: number
-  refundStatus: number
-  refundTimes: number
-  refundAmount: number
-  channelUserId: string
-  channelOrderNo: string
-}

+ 87 - 3
yudao-ui-admin-vue3/src/api/pay/refund/index.ts

@@ -1,8 +1,92 @@
 import request from '@/config/axios'
-import type { RefundVO } from './types'
+
+export interface RefundVO {
+  id: number
+  merchantId: number
+  appId: number
+  channelId: number
+  channelCode: string
+  orderId: string
+  tradeNo: string
+  merchantOrderId: string
+  merchantRefundNo: string
+  notifyUrl: string
+  notifyStatus: number
+  status: number
+  type: number
+  payAmount: number
+  refundAmount: number
+  reason: string
+  userIp: string
+  channelOrderNo: string
+  channelRefundNo: string
+  channelErrorCode: string
+  channelErrorMsg: string
+  channelExtras: string
+  expireTime: Date
+  successTime: Date
+  notifyTime: Date
+  createTime: Date
+}
+
+export interface RefundPageReqVO extends PageParam {
+  merchantId?: number
+  appId?: number
+  channelId?: number
+  channelCode?: string
+  orderId?: string
+  tradeNo?: string
+  merchantOrderId?: string
+  merchantRefundNo?: string
+  notifyUrl?: string
+  notifyStatus?: number
+  status?: number
+  type?: number
+  payAmount?: number
+  refundAmount?: number
+  reason?: string
+  userIp?: string
+  channelOrderNo?: string
+  channelRefundNo?: string
+  channelErrorCode?: string
+  channelErrorMsg?: string
+  channelExtras?: string
+  expireTime?: Date[]
+  successTime?: Date[]
+  notifyTime?: Date[]
+  createTime?: Date[]
+}
+
+export interface PayRefundExportReqVO {
+  merchantId?: number
+  appId?: number
+  channelId?: number
+  channelCode?: string
+  orderId?: string
+  tradeNo?: string
+  merchantOrderId?: string
+  merchantRefundNo?: string
+  notifyUrl?: string
+  notifyStatus?: number
+  status?: number
+  type?: number
+  payAmount?: number
+  refundAmount?: number
+  reason?: string
+  userIp?: string
+  channelOrderNo?: string
+  channelRefundNo?: string
+  channelErrorCode?: string
+  channelErrorMsg?: string
+  channelExtras?: string
+  expireTime?: Date[]
+  successTime?: Date[]
+  notifyTime?: Date[]
+  createTime?: Date[]
+}
 
 // 查询列表退款订单
-export const getRefundPageApi = (params) => {
+export const getRefundPageApi = (params: RefundPageReqVO) => {
   return request.get({ url: '/pay/refund/page', params })
 }
 
@@ -27,6 +111,6 @@ export const deleteRefundApi = (id: number) => {
 }
 
 // 导出退款订单
-export const exportRefundApi = (params) => {
+export const exportRefundApi = (params: PayRefundExportReqVO) => {
   return request.download({ url: '/pay/refund/export-excel', params })
 }

+ 0 - 26
yudao-ui-admin-vue3/src/api/pay/refund/types.ts

@@ -1,26 +0,0 @@
-export type RefundVO = {
-  id: number
-  merchantId: number
-  appId: number
-  channelId: number
-  channelCode: string
-  merchantOrderId: string
-  subject: string
-  body: string
-  notifyUrl: string
-  notifyStatus: number
-  amount: number
-  channelFeeRate: number
-  channelFeeAmount: number
-  status: number
-  userIp: string
-  expireTime: string
-  successTime: string
-  notifyTime: string
-  successExtensionId: number
-  refundStatus: number
-  refundTimes: number
-  refundAmount: number
-  channelUserId: string
-  channelOrderNo: string
-}

+ 23 - 17
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts

@@ -17,7 +17,7 @@ import { DescriptionsSchema } from '@/types/descriptions'
 export type VxeCrudSchema = {
   primaryKey?: string // 主键ID
   primaryTitle?: string // 主键标题 默认为序号
-  primaryType?: VxeColumnPropTypes.Type // 不填写为数据库编号 null为不显示 还支持 "seq" | "radio" | "checkbox" | "expand" | "html" | null
+  primaryType?: VxeColumnPropTypes.Type | 'id' // 还支持 "id" | "seq" | "radio" | "checkbox" | "expand" | "html" | null
   action?: boolean // 是否开启表格内右侧操作栏插槽
   actionTitle?: string // 操作栏标题 默认为操作
   actionWidth?: string // 操作栏插槽宽度,一般2个字带图标 text 类型按钮 50-70
@@ -121,18 +121,8 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema): VxeFormItemProps[] => {
     if (schemaItem?.isSearch || schemaItem.search?.show) {
       let itemRenderName = schemaItem?.search?.itemRender?.name || '$input'
       const options: any[] = []
-      let itemRender: FormItemRenderOptions
-      if (schemaItem.search?.itemRender) {
-        itemRender = schemaItem.search.itemRender
-      } else {
-        itemRender = {
-          name: itemRenderName,
-          props:
-            itemRenderName == '$input'
-              ? { placeholder: t('common.inputText') }
-              : { placeholder: t('common.selectText') }
-        }
-      }
+      let itemRender: FormItemRenderOptions = {}
+
       if (schemaItem.dictType) {
         const allOptions = { label: '全部', value: '' }
         options.push(allOptions)
@@ -146,8 +136,19 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema): VxeFormItemProps[] => {
           options: options,
           props: { placeholder: t('common.selectText') }
         }
+      } else {
+        if (schemaItem.search?.itemRender) {
+          itemRender = schemaItem.search.itemRender
+        } else {
+          itemRender = {
+            name: itemRenderName,
+            props:
+              itemRenderName == '$input'
+                ? { placeholder: t('common.inputText') }
+                : { placeholder: t('common.selectText') }
+          }
+        }
       }
-
       const searchSchemaItem = {
         // 默认为 input
         folding: searchSchema.length > spanLength - 1,
@@ -156,7 +157,6 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema): VxeFormItemProps[] => {
         title: schemaItem.search?.title || schemaItem.title,
         span: span
       }
-
       searchSchema.push(searchSchemaItem)
     }
   })
@@ -187,12 +187,18 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns
   if (crudSchema.primaryKey && crudSchema.primaryType) {
     const primaryTitle = crudSchema.primaryTitle ? crudSchema.primaryTitle : t('common.index')
     const primaryWidth = primaryTitle.length * 30 + 'px'
-    const tableSchemaItem = {
+
+    let tableSchemaItem: { [x: string]: any } = {
       title: primaryTitle,
       field: crudSchema.primaryKey,
-      type: crudSchema.primaryType ? crudSchema.primaryType : null,
       width: primaryWidth
     }
+    if (crudSchema.primaryType != 'id') {
+      tableSchemaItem = {
+        ...tableSchemaItem,
+        type: crudSchema.primaryType
+      }
+    }
     tableSchema.push(tableSchemaItem)
   }
 

+ 1 - 1
yudao-ui-admin-vue3/src/locales/en.ts

@@ -189,7 +189,6 @@ export default {
     access: 'Project access',
     toDo: 'To do',
     introduction: 'A serious introduction',
-    more: 'More',
     shortcutOperation: 'Quick entry',
     operation: 'Operation',
     index: 'Index',
@@ -284,6 +283,7 @@ export default {
     edit: 'Edit',
     update: 'Update',
     preview: 'Preview',
+    more: 'More',
     sync: 'Sync',
     save: 'Save',
     detail: 'Detail',

+ 1 - 1
yudao-ui-admin-vue3/src/locales/zh-CN.ts

@@ -189,7 +189,6 @@ export default {
     access: '项目访问',
     toDo: '待办',
     introduction: '一个正经的简介',
-    more: '更多',
     shortcutOperation: '快捷入口',
     operation: '操作',
     index: '指数',
@@ -284,6 +283,7 @@ export default {
     edit: '编辑',
     update: '编辑',
     preview: '预览',
+    more: '更多',
     sync: '同步',
     save: '保存',
     detail: '详情',

+ 2 - 2
yudao-ui-admin-vue3/src/views/Home/Index.vue

@@ -60,7 +60,7 @@
         <template #header>
           <div class="flex justify-between h-3">
             <span>{{ t('workplace.project') }}</span>
-            <el-link type="primary" :underline="false">{{ t('workplace.more') }}</el-link>
+            <el-link type="primary" :underline="false">{{ t('action.more') }}</el-link>
           </div>
         </template>
         <el-skeleton :loading="loading" animated>
@@ -135,7 +135,7 @@
         <template #header>
           <div class="flex justify-between h-3">
             <span>{{ t('workplace.notice') }}</span>
-            <el-link type="primary" :underline="false">{{ t('workplace.more') }}</el-link>
+            <el-link type="primary" :underline="false">{{ t('action.more') }}</el-link>
           </div>
         </template>
         <el-skeleton :loading="loading" animated>

+ 1 - 1
yudao-ui-admin-vue3/src/views/infra/job/index.vue

@@ -49,7 +49,7 @@
           @click="handleDelete(row.id)"
         />
         <el-dropdown class="p-0.5" v-hasPermi="['infra:job:trigger', 'infra:job:query']">
-          <XTextButton title="更多" postIcon="ep:arrow-down" />
+          <XTextButton :title="t('action.more')" postIcon="ep:arrow-down" />
           <template #dropdown>
             <el-dropdown-menu>
               <el-dropdown-item>

+ 55 - 61
yudao-ui-admin-vue3/src/views/pay/app/app.data.ts

@@ -1,8 +1,8 @@
 import { reactive } from 'vue'
 import { useI18n } from '@/hooks/web/useI18n'
 import { required } from '@/utils/formRules'
-import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
 import { DICT_TYPE } from '@/utils/dict'
+import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
 const { t } = useI18n() // 国际化
 
 // 表单校验
@@ -15,67 +15,61 @@ export const rules = reactive({
 })
 
 // CrudSchema
-const crudSchemas = reactive<CrudSchema[]>([
-  {
-    label: t('common.index'),
-    field: 'id',
-    type: 'index',
-    form: {
-      show: false
+const crudSchemas = reactive<VxeCrudSchema>({
+  primaryKey: 'id',
+  primaryType: 'seq',
+  primaryTitle: '编号',
+  action: true,
+  columns: [
+    {
+      title: '应用名',
+      field: 'name',
+      isSearch: true
     },
-    detail: {
-      show: false
-    }
-  },
-  {
-    label: '应用名',
-    field: 'name',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '商户名称',
-    field: 'payMerchant',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: t('common.status'),
-    field: 'status',
-    dictType: DICT_TYPE.COMMON_STATUS,
-    dictClass: 'number',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: t('common.createTime'),
-    field: 'createTime',
-    form: {
-      show: false
+    {
+      title: '商户名称',
+      field: 'payMerchant',
+      isSearch: true
     },
-    search: {
-      show: true,
-      component: 'DatePicker',
-      componentProps: {
-        type: 'datetimerange',
-        valueFormat: 'YYYY-MM-DD HH:mm:ss',
-        defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
-      }
-    }
-  },
-  {
-    label: t('table.action'),
-    field: 'action',
-    width: '240px',
-    form: {
-      show: false
+    {
+      title: t('common.status'),
+      field: 'status',
+      dictType: DICT_TYPE.COMMON_STATUS,
+      dictClass: 'number',
+      isSearch: true
     },
-    detail: {
-      show: false
+    {
+      title: '支付结果的回调地址',
+      field: 'payNotifyUrl',
+      isSearch: true
+    },
+    {
+      title: '退款结果的回调地址',
+      field: 'refundNotifyUrl',
+      isSearch: true
+    },
+    {
+      title: '商户名称',
+      field: 'merchantName',
+      isSearch: true
+    },
+    {
+      title: '备注',
+      field: 'remark',
+      isTable: false,
+      isSearch: true
+    },
+    {
+      title: t('common.createTime'),
+      field: 'createTime',
+      isForm: false,
+      search: {
+        show: true,
+        itemRender: {
+          name: 'XDataTimePicker'
+        }
+      }
     }
-  }
-])
-export const { allSchemas } = useCrudSchemas(crudSchemas)
+  ]
+})
+export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

+ 112 - 127
yudao-ui-admin-vue3/src/views/pay/app/index.vue

@@ -1,23 +1,101 @@
+<template>
+  <ContentWrap>
+    <!-- 列表 -->
+    <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
+      <template #toolbar_buttons>
+        <!-- 操作:新增 -->
+        <XButton
+          type="primary"
+          preIcon="ep:zoom-in"
+          :title="t('action.add')"
+          v-hasPermi="['pay:app:create']"
+          @click="handleCreate()"
+        />
+        <!-- 操作:导出 -->
+        <XButton
+          type="warning"
+          preIcon="ep:download"
+          :title="t('action.export')"
+          v-hasPermi="['pay:app:export']"
+          @click="handleExport()"
+        />
+      </template>
+      <template #actionbtns_default="{ row }">
+        <!-- 操作:修改 -->
+        <XTextButton
+          preIcon="ep:edit"
+          :title="t('action.edit')"
+          v-hasPermi="['pay:app:update']"
+          @click="handleUpdate(row.id)"
+        />
+        <!-- 操作:详情 -->
+        <XTextButton
+          preIcon="ep:view"
+          :title="t('action.detail')"
+          v-hasPermi="['pay:app:query']"
+          @click="handleDetail(row.id)"
+        />
+        <!-- 操作:删除 -->
+        <XTextButton
+          preIcon="ep:delete"
+          :title="t('action.del')"
+          v-hasPermi="['pay:app:delete']"
+          @click="handleDelete(row.id)"
+        />
+      </template>
+    </vxe-grid>
+  </ContentWrap>
+
+  <XModal v-model="dialogVisible" :title="dialogTitle">
+    <!-- 对话框(添加 / 修改) -->
+    <Form
+      v-if="['create', 'update'].includes(actionType)"
+      :schema="allSchemas.formSchema"
+      :rules="rules"
+      ref="formRef"
+    />
+    <!-- 对话框(详情) -->
+    <Descriptions
+      v-if="actionType === 'detail'"
+      :schema="allSchemas.detailSchema"
+      :data="detailData"
+    />
+    <!-- 操作按钮 -->
+    <template #footer>
+      <!-- 按钮:保存 -->
+      <XButton
+        v-if="['create', 'update'].includes(actionType)"
+        type="primary"
+        :title="t('action.save')"
+        :loading="actionLoading"
+        @click="submitForm()"
+      />
+      <!-- 按钮:关闭 -->
+      <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
+    </template>
+  </XModal>
+</template>
 <script setup lang="ts" name="App">
 import { ref, unref } from 'vue'
-import dayjs from 'dayjs'
-import { ElMessage } from 'element-plus'
-import { DICT_TYPE } from '@/utils/dict'
-import { useTable } from '@/hooks/web/useTable'
 import { useI18n } from '@/hooks/web/useI18n'
+import { useMessage } from '@/hooks/web/useMessage'
+import { useVxeGrid } from '@/hooks/web/useVxeGrid'
+import { VxeGridInstance } from 'vxe-table'
 import { FormExpose } from '@/components/Form'
-import type { AppVO } from '@/api/pay/app/types'
 import { rules, allSchemas } from './app.data'
 import * as AppApi from '@/api/pay/app'
+
 const { t } = useI18n() // 国际化
+const message = useMessage() // 消息弹窗
 
-// ========== 列表相关 ==========
-const { register, tableObject, methods } = useTable<AppVO>({
+// 列表相关的变量
+const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
+const { gridOptions, getList, deleteData, exportList } = useVxeGrid<AppApi.AppVO>({
+  allSchemas: allSchemas,
   getListApi: AppApi.getAppPageApi,
-  delListApi: AppApi.deleteAppApi,
+  deleteApi: AppApi.deleteAppApi,
   exportListApi: AppApi.exportAppApi
 })
-const { getList, setSearchParams, delList, exportList } = methods
 
 // ========== CRUD 相关 ==========
 const actionLoading = ref(false) // 遮罩层
@@ -25,6 +103,7 @@ const actionType = ref('') // 操作按钮的类型
 const dialogVisible = ref(false) // 是否显示弹出层
 const dialogTitle = ref('edit') // 弹出层标题
 const formRef = ref<FormExpose>() // 表单 Ref
+const detailData = ref() // 详情 Ref
 
 // 设置标题
 const setDialogTile = (type: string) => {
@@ -38,14 +117,31 @@ const handleCreate = () => {
   setDialogTile('create')
 }
 
+// 导出操作
+const handleExport = async () => {
+  await exportList(xGrid, '应用信息.xls')
+}
+
 // 修改操作
-const handleUpdate = async (row: AppVO) => {
+const handleUpdate = async (rowId: number) => {
   setDialogTile('update')
   // 设置数据
-  const res = await AppApi.getAppApi(row.id)
+  const res = await AppApi.getAppApi(rowId)
   unref(formRef)?.setValues(res)
 }
 
+// 详情操作
+const handleDetail = async (rowId: number) => {
+  setDialogTile('detail')
+  const res = await AppApi.getAppApi(rowId)
+  detailData.value = res
+}
+
+// 删除操作
+const handleDelete = async (rowId: number) => {
+  await deleteData(xGrid, rowId)
+}
+
 // 提交按钮
 const submitForm = async () => {
   const elForm = unref(formRef)?.getElFormRef()
@@ -55,132 +151,21 @@ const submitForm = async () => {
       actionLoading.value = true
       // 提交请求
       try {
-        const data = unref(formRef)?.formModel as AppVO
+        const data = unref(formRef)?.formModel as AppApi.AppVO
         if (actionType.value === 'create') {
           await AppApi.createAppApi(data)
-          ElMessage.success(t('common.createSuccess'))
+          message.success(t('common.createSuccess'))
         } else {
           await AppApi.updateAppApi(data)
-          ElMessage.success(t('common.updateSuccess'))
+          message.success(t('common.updateSuccess'))
         }
-        // 操作成功,重新加载列表
         dialogVisible.value = false
-        await getList()
       } finally {
         actionLoading.value = false
+        // 刷新列表
+        await getList(xGrid)
       }
     }
   })
 }
-
-// ========== 详情相关 ==========
-const detailRef = ref() // 详情 Ref
-
-// 详情操作
-const handleDetail = async (row: AppVO) => {
-  // 设置数据
-  detailRef.value = row
-  setDialogTile('detail')
-}
-
-// ========== 初始化 ==========
-getList()
 </script>
-
-<template>
-  <!-- 搜索工作区 -->
-  <ContentWrap>
-    <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
-  </ContentWrap>
-  <ContentWrap>
-    <!-- 操作工具栏 -->
-    <div class="mb-10px">
-      <el-button type="primary" v-hasPermi="['system:post:create']" @click="handleCreate">
-        <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }}
-      </el-button>
-      <el-button
-        type="warning"
-        v-hasPermi="['system:post:export']"
-        :loading="tableObject.exportLoading"
-        @click="exportList('应用数据.xls')"
-      >
-        <Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') }}
-      </el-button>
-    </div>
-    <!-- 列表 -->
-    <Table
-      :columns="allSchemas.tableColumns"
-      :selection="false"
-      :data="tableObject.tableList"
-      :loading="tableObject.loading"
-      :pagination="{
-        total: tableObject.total
-      }"
-      v-model:pageSize="tableObject.pageSize"
-      v-model:currentPage="tableObject.currentPage"
-      @register="register"
-    >
-      <template #status="{ row }">
-        <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
-      </template>
-      <template #createTime="{ row }">
-        <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
-      </template>
-      <template #action="{ row }">
-        <el-button
-          link
-          type="primary"
-          v-hasPermi="['system:post:update']"
-          @click="handleUpdate(row)"
-        >
-          <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }}
-        </el-button>
-        <el-button
-          link
-          type="primary"
-          v-hasPermi="['system:post:update']"
-          @click="handleDetail(row)"
-        >
-          <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}
-        </el-button>
-        <el-button
-          link
-          type="primary"
-          v-hasPermi="['system:post:delete']"
-          @click="delList(row.id, false)"
-        >
-          <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
-        </el-button>
-      </template>
-    </Table>
-  </ContentWrap>
-
-  <XModal v-model="dialogVisible" :title="dialogTitle">
-    <!-- 对话框(添加 / 修改) -->
-    <Form
-      v-if="['create', 'update'].includes(actionType)"
-      :schema="allSchemas.formSchema"
-      :rules="rules"
-      ref="formRef"
-    />
-    <!-- 对话框(详情) -->
-    <Descriptions
-      v-if="actionType === 'detail'"
-      :schema="allSchemas.detailSchema"
-      :data="detailRef"
-    />
-    <!-- 操作按钮 -->
-    <template #footer>
-      <!-- 按钮:保存 -->
-      <XButton
-        v-if="['create', 'update'].includes(actionType)"
-        type="primary"
-        :title="t('action.save')"
-        :loading="actionLoading"
-        @click="submitForm()"
-      />
-      <!-- 按钮:关闭 -->
-      <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
-    </template>
-  </XModal>
-</template>

+ 111 - 128
yudao-ui-admin-vue3/src/views/pay/merchant/index.vue

@@ -1,23 +1,99 @@
+<template>
+  <ContentWrap>
+    <!-- 列表 -->
+    <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
+      <template #toolbar_buttons>
+        <!-- 操作:新增 -->
+        <XButton
+          type="primary"
+          preIcon="ep:zoom-in"
+          :title="t('action.add')"
+          v-hasPermi="['pay:merchant:create']"
+          @click="handleCreate()"
+        />
+        <!-- 操作:导出 -->
+        <XButton
+          type="warning"
+          preIcon="ep:download"
+          :title="t('action.export')"
+          v-hasPermi="['pay:merchant:export']"
+          @click="handleExport()"
+        />
+      </template>
+      <template #actionbtns_default="{ row }">
+        <!-- 操作:修改 -->
+        <XTextButton
+          preIcon="ep:edit"
+          :title="t('action.edit')"
+          v-hasPermi="['pay:merchant:update']"
+          @click="handleUpdate(row.id)"
+        />
+        <!-- 操作:详情 -->
+        <XTextButton
+          preIcon="ep:view"
+          :title="t('action.detail')"
+          v-hasPermi="['pay:merchant:query']"
+          @click="handleDetail(row.id)"
+        />
+        <!-- 操作:删除 -->
+        <XTextButton
+          preIcon="ep:delete"
+          :title="t('action.del')"
+          v-hasPermi="['pay:merchant:delete']"
+          @click="handleDelete(row.id)"
+        />
+      </template>
+    </vxe-grid>
+  </ContentWrap>
+  <XModal v-model="dialogVisible" :title="dialogTitle">
+    <!-- 对话框(添加 / 修改) -->
+    <Form
+      v-if="['create', 'update'].includes(actionType)"
+      :schema="allSchemas.formSchema"
+      :rules="rules"
+      ref="formRef"
+    />
+    <!-- 对话框(详情) -->
+    <Descriptions
+      v-if="actionType === 'detail'"
+      :schema="allSchemas.detailSchema"
+      :data="detailData"
+    />
+    <!-- 操作按钮 -->
+    <template #footer>
+      <!-- 按钮:保存 -->
+      <XButton
+        v-if="['create', 'update'].includes(actionType)"
+        type="primary"
+        :title="t('action.save')"
+        :loading="actionLoading"
+        @click="submitForm()"
+      />
+      <!-- 按钮:关闭 -->
+      <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
+    </template>
+  </XModal>
+</template>
 <script setup lang="ts" name="Merchant">
 import { ref, unref } from 'vue'
-import dayjs from 'dayjs'
-import { ElMessage } from 'element-plus'
-import { DICT_TYPE } from '@/utils/dict'
-import { useTable } from '@/hooks/web/useTable'
 import { useI18n } from '@/hooks/web/useI18n'
+import { useMessage } from '@/hooks/web/useMessage'
+import { useVxeGrid } from '@/hooks/web/useVxeGrid'
+import { VxeGridInstance } from 'vxe-table'
 import { FormExpose } from '@/components/Form'
-import type { MerchantVO } from '@/api/pay/merchant/types'
 import { rules, allSchemas } from './merchant.data'
 import * as MerchantApi from '@/api/pay/merchant'
-const { t } = useI18n() // 国际化
 
-// ========== 列表相关 ==========
-const { register, tableObject, methods } = useTable<MerchantVO>({
+const { t } = useI18n() // 国际化
+const message = useMessage() // 消息弹窗
+// 列表相关的变量
+const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
+const { gridOptions, getList, deleteData, exportList } = useVxeGrid<MerchantApi.MerchantVO>({
+  allSchemas: allSchemas,
   getListApi: MerchantApi.getMerchantPageApi,
-  delListApi: MerchantApi.deleteMerchantApi,
+  deleteApi: MerchantApi.deleteMerchantApi,
   exportListApi: MerchantApi.exportMerchantApi
 })
-const { getList, setSearchParams, delList, exportList } = methods
 
 // ========== CRUD 相关 ==========
 const actionLoading = ref(false) // 遮罩层
@@ -25,6 +101,7 @@ const actionType = ref('') // 操作按钮的类型
 const dialogVisible = ref(false) // 是否显示弹出层
 const dialogTitle = ref('edit') // 弹出层标题
 const formRef = ref<FormExpose>() // 表单 Ref
+const detailData = ref() // 详情 Ref
 
 // 设置标题
 const setDialogTile = (type: string) => {
@@ -38,14 +115,31 @@ const handleCreate = () => {
   setDialogTile('create')
 }
 
+// 导出操作
+const handleExport = async () => {
+  await exportList(xGrid, '商户列表.xls')
+}
+
 // 修改操作
-const handleUpdate = async (row: MerchantVO) => {
+const handleUpdate = async (rowId: number) => {
   setDialogTile('update')
   // 设置数据
-  const res = await MerchantApi.getMerchantApi(row.id)
+  const res = await MerchantApi.getMerchantApi(rowId)
   unref(formRef)?.setValues(res)
 }
 
+// 详情操作
+const handleDetail = async (rowId: number) => {
+  setDialogTile('detail')
+  const res = await MerchantApi.getMerchantApi(rowId)
+  detailData.value = res
+}
+
+// 删除操作
+const handleDelete = async (rowId: number) => {
+  await deleteData(xGrid, rowId)
+}
+
 // 提交按钮
 const submitForm = async () => {
   const elForm = unref(formRef)?.getElFormRef()
@@ -55,132 +149,21 @@ const submitForm = async () => {
       actionLoading.value = true
       // 提交请求
       try {
-        const data = unref(formRef)?.formModel as MerchantVO
+        const data = unref(formRef)?.formModel as MerchantApi.MerchantVO
         if (actionType.value === 'create') {
           await MerchantApi.createMerchantApi(data)
-          ElMessage.success(t('common.createSuccess'))
+          message.success(t('common.createSuccess'))
         } else {
           await MerchantApi.updateMerchantApi(data)
-          ElMessage.success(t('common.updateSuccess'))
+          message.success(t('common.updateSuccess'))
         }
-        // 操作成功,重新加载列表
         dialogVisible.value = false
-        await getList()
       } finally {
         actionLoading.value = false
+        // 刷新列表
+        await getList(xGrid)
       }
     }
   })
 }
-
-// ========== 详情相关 ==========
-const detailRef = ref() // 详情 Ref
-
-// 详情操作
-const handleDetail = async (row: MerchantVO) => {
-  // 设置数据
-  detailRef.value = row
-  setDialogTile('detail')
-}
-
-// ========== 初始化 ==========
-getList()
 </script>
-
-<template>
-  <!-- 搜索工作区 -->
-  <ContentWrap>
-    <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
-  </ContentWrap>
-  <ContentWrap>
-    <!-- 操作工具栏 -->
-    <div class="mb-10px">
-      <el-button type="primary" v-hasPermi="['system:post:create']" @click="handleCreate">
-        <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }}
-      </el-button>
-      <el-button
-        type="warning"
-        v-hasPermi="['system:post:export']"
-        :loading="tableObject.exportLoading"
-        @click="exportList('商户数据.xls')"
-      >
-        <Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') }}
-      </el-button>
-    </div>
-    <!-- 列表 -->
-    <Table
-      :columns="allSchemas.tableColumns"
-      :selection="false"
-      :data="tableObject.tableList"
-      :loading="tableObject.loading"
-      :pagination="{
-        total: tableObject.total
-      }"
-      v-model:pageSize="tableObject.pageSize"
-      v-model:currentPage="tableObject.currentPage"
-      @register="register"
-    >
-      <template #status="{ row }">
-        <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
-      </template>
-      <template #createTime="{ row }">
-        <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
-      </template>
-      <template #action="{ row }">
-        <el-button
-          link
-          type="primary"
-          v-hasPermi="['system:post:update']"
-          @click="handleUpdate(row)"
-        >
-          <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }}
-        </el-button>
-        <el-button
-          link
-          type="primary"
-          v-hasPermi="['system:post:update']"
-          @click="handleDetail(row)"
-        >
-          <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}
-        </el-button>
-        <el-button
-          link
-          type="primary"
-          v-hasPermi="['system:post:delete']"
-          @click="delList(row.id, false)"
-        >
-          <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
-        </el-button>
-      </template>
-    </Table>
-  </ContentWrap>
-
-  <XModal v-model="dialogVisible" :title="dialogTitle">
-    <!-- 对话框(添加 / 修改) -->
-    <Form
-      v-if="['create', 'update'].includes(actionType)"
-      :schema="allSchemas.formSchema"
-      :rules="rules"
-      ref="formRef"
-    />
-    <!-- 对话框(详情) -->
-    <Descriptions
-      v-if="actionType === 'detail'"
-      :schema="allSchemas.detailSchema"
-      :data="detailRef"
-    />
-    <!-- 操作按钮 -->
-    <template #footer>
-      <!-- 按钮:保存 -->
-      <XButton
-        v-if="['create', 'update'].includes(actionType)"
-        type="primary"
-        :title="t('action.save')"
-        :loading="actionLoading"
-        @click="submitForm()"
-      />
-      <!-- 按钮:关闭 -->
-      <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
-    </template>
-  </XModal>
-</template>

+ 53 - 83
yudao-ui-admin-vue3/src/views/pay/merchant/merchant.data.ts

@@ -1,8 +1,8 @@
 import { reactive } from 'vue'
 import { useI18n } from '@/hooks/web/useI18n'
 import { required } from '@/utils/formRules'
-import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
 import { DICT_TYPE } from '@/utils/dict'
+import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
 const { t } = useI18n() // 国际化
 
 // 表单校验
@@ -14,91 +14,61 @@ export const rules = reactive({
 })
 
 // CrudSchema
-const crudSchemas = reactive<CrudSchema[]>([
-  {
-    label: t('common.index'),
-    field: 'id',
-    type: 'index',
-    form: {
-      show: false
+const crudSchemas = reactive<VxeCrudSchema>({
+  primaryKey: 'id',
+  primaryType: 'seq',
+  primaryTitle: '商户编号',
+  action: true,
+  columns: [
+    {
+      title: '商户号',
+      field: 'no',
+      isSearch: true
     },
-    detail: {
-      show: false
-    }
-  },
-  {
-    label: '商户号',
-    field: 'no',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '商户全称',
-    field: 'code',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '商户简称',
-    field: 'shortName',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: t('common.status'),
-    field: 'status',
-    dictType: DICT_TYPE.COMMON_STATUS,
-    dictClass: 'number',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: t('form.remark'),
-    field: 'remark',
-    form: {
-      component: 'Input',
-      componentProps: {
-        type: 'textarea',
-        rows: 4
-      },
-      colProps: {
-        span: 24
-      }
+    {
+      title: '商户全称',
+      field: 'code',
+      isSearch: true
     },
-    table: {
-      show: false
-    }
-  },
-  {
-    label: t('common.createTime'),
-    field: 'createTime',
-    form: {
-      show: false
+    {
+      title: '商户简称',
+      field: 'shortName',
+      isSearch: true
+    },
+    {
+      title: t('common.status'),
+      field: 'status',
+      dictType: DICT_TYPE.COMMON_STATUS,
+      dictClass: 'number',
+      isSearch: true
     },
-    search: {
-      show: true,
-      component: 'DatePicker',
-      componentProps: {
-        type: 'datetimerange',
-        valueFormat: 'YYYY-MM-DD HH:mm:ss',
-        defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
+    {
+      title: t('form.remark'),
+      field: 'remark',
+      isTable: false,
+      form: {
+        component: 'Input',
+        componentProps: {
+          type: 'textarea',
+          rows: 4
+        },
+        colProps: {
+          span: 24
+        }
       }
-    }
-  },
-  {
-    label: t('table.action'),
-    field: 'action',
-    width: '240px',
-    form: {
-      show: false
     },
-    detail: {
-      show: false
+    {
+      title: t('common.createTime'),
+      field: 'createTime',
+      formatter: 'formatDate',
+      isForm: false,
+      search: {
+        show: true,
+        itemRender: {
+          name: 'XDataTimePicker'
+        }
+      }
     }
-  }
-])
-export const { allSchemas } = useCrudSchemas(crudSchemas)
+  ]
+})
+export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

+ 59 - 141
yudao-ui-admin-vue3/src/views/pay/order/index.vue

@@ -1,28 +1,68 @@
+<template>
+  <ContentWrap>
+    <!-- 列表 -->
+    <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
+      <template #toolbar_buttons>
+        <!-- 操作:新增 -->
+        <XButton
+          type="primary"
+          preIcon="ep:zoom-in"
+          :title="t('action.add')"
+          v-hasPermi="['pay:order:create']"
+          @click="handleCreate()"
+        />
+        <!-- 操作:导出 -->
+        <XButton
+          type="warning"
+          preIcon="ep:download"
+          :title="t('action.export')"
+          v-hasPermi="['pay:order:export']"
+          @click="handleExport()"
+        />
+      </template>
+      <template #actionbtns_default="{ row }">
+        <!-- 操作:详情 -->
+        <XTextButton
+          preIcon="ep:view"
+          :title="t('action.detail')"
+          v-hasPermi="['pay:order:query']"
+          @click="handleDetail(row.id)"
+        />
+      </template>
+    </vxe-grid>
+  </ContentWrap>
+  <XModal v-model="dialogVisible" :title="dialogTitle">
+    <!-- 对话框(详情) -->
+    <Descriptions :schema="allSchemas.detailSchema" :data="detailData" />
+    <!-- 操作按钮 -->
+    <template #footer>
+      <!-- 按钮:关闭 -->
+      <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
+    </template>
+  </XModal>
+</template>
 <script setup lang="ts" name="Order">
-import { ref, unref } from 'vue'
-import { ElMessage } from 'element-plus'
-import { DICT_TYPE } from '@/utils/dict'
-import { useTable } from '@/hooks/web/useTable'
+import { ref } from 'vue'
 import { useI18n } from '@/hooks/web/useI18n'
-import { FormExpose } from '@/components/Form'
-import type { OrderVO } from '@/api/pay/order/types'
-import { rules, allSchemas } from './order.data'
+import { useVxeGrid } from '@/hooks/web/useVxeGrid'
+import { VxeGridInstance } from 'vxe-table'
+import { allSchemas } from './order.data'
 import * as OrderApi from '@/api/pay/order'
+
 const { t } = useI18n() // 国际化
-// ========== 列表相关 ==========
-const { register, tableObject, methods } = useTable<OrderVO>({
+// 列表相关的变量
+const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
+const { gridOptions, exportList } = useVxeGrid<OrderApi.OrderVO>({
+  allSchemas: allSchemas,
   getListApi: OrderApi.getOrderPageApi,
-  delListApi: OrderApi.deleteOrderApi,
   exportListApi: OrderApi.exportOrderApi
 })
-const { getList, setSearchParams, delList, exportList } = methods
 // ========== CRUD 相关 ==========
 const actionLoading = ref(false) // 遮罩层
 const actionType = ref('') // 操作按钮的类型
 const dialogVisible = ref(false) // 是否显示弹出层
 const dialogTitle = ref('edit') // 弹出层标题
-const formRef = ref<FormExpose>() // 表单 Ref
-
+const detailData = ref() // 详情 Ref
 // 设置标题
 const setDialogTile = (type: string) => {
   dialogTitle.value = t('action.' + type)
@@ -34,137 +74,15 @@ const setDialogTile = (type: string) => {
 const handleCreate = () => {
   setDialogTile('create')
 }
-
-// 修改操作
-const handleUpdate = async (row: OrderVO) => {
-  setDialogTile('update')
-  // 设置数据
-  const res = await OrderApi.getOrderApi(row.id)
-  unref(formRef)?.setValues(res)
-}
-
-// 提交按钮
-const submitForm = async () => {
-  const elForm = unref(formRef)?.getElFormRef()
-  if (!elForm) return
-  elForm.validate(async (valid) => {
-    if (valid) {
-      actionLoading.value = true
-      // 提交请求
-      try {
-        const data = unref(formRef)?.formModel as OrderVO
-        if (actionType.value === 'create') {
-          await OrderApi.createOrderApi(data)
-          ElMessage.success(t('common.createSuccess'))
-        } else {
-          await OrderApi.updateOrderApi(data)
-          ElMessage.success(t('common.updateSuccess'))
-        }
-        // 操作成功,重新加载列表
-        dialogVisible.value = false
-        await getList()
-      } finally {
-        actionLoading.value = false
-      }
-    }
-  })
+// 导出操作
+const handleExport = async () => {
+  await exportList(xGrid, '订单数据.xls')
 }
 
-// ========== 详情相关 ==========
-const detailRef = ref() // 详情 Ref
-
 // 详情操作
-const handleDetail = async (row: OrderVO) => {
+const handleDetail = async (rowId: number) => {
   setDialogTile('detail')
-  // 设置数据
-  const res = await OrderApi.getOrderApi(row.id as number)
-  detailRef.value = res
+  const res = await OrderApi.getOrderApi(rowId)
+  detailData.value = res
 }
-
-// ========== 初始化 ==========
-getList()
 </script>
-<template>
-  <!-- 搜索工作区 -->
-  <ContentWrap>
-    <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
-  </ContentWrap>
-  <ContentWrap>
-    <!-- 操作工具栏 -->
-    <div class="mb-10px">
-      <el-button type="primary" v-hasPermi="['pay:order:create']" @click="handleCreate">
-        <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }}
-      </el-button>
-      <el-button
-        type="warning"
-        v-hasPermi="['pay:order:export']"
-        :loading="tableObject.exportLoading"
-        @click="exportList('订单数据.xls')"
-      >
-        <Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') }}
-      </el-button>
-    </div>
-    <!-- 列表 -->
-    <Table
-      :columns="allSchemas.tableColumns"
-      :selection="false"
-      :data="tableObject.tableList"
-      :loading="tableObject.loading"
-      :pagination="{
-        total: tableObject.total
-      }"
-      v-model:pageSize="tableObject.pageSize"
-      v-model:currentPage="tableObject.currentPage"
-      @register="register"
-    >
-      <template #status="{ row }">
-        <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
-      </template>
-      <template #action="{ row }">
-        <el-button link type="primary" v-hasPermi="['pay:order:update']" @click="handleUpdate(row)">
-          <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }}
-        </el-button>
-        <el-button link type="primary" v-hasPermi="['pay:order:update']" @click="handleDetail(row)">
-          <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}
-        </el-button>
-        <el-button
-          link
-          type="primary"
-          v-hasPermi="['pay:order:delete']"
-          @click="delList(row.id, false)"
-        >
-          <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
-        </el-button>
-      </template>
-    </Table>
-  </ContentWrap>
-
-  <XModal v-model="dialogVisible" :title="dialogTitle">
-    <!-- 对话框(添加 / 修改) -->
-    <Form
-      v-if="['create', 'update'].includes(actionType)"
-      :schema="allSchemas.formSchema"
-      :rules="rules"
-      ref="formRef"
-    />
-    <!-- 对话框(详情) -->
-    <Descriptions
-      v-if="actionType === 'detail'"
-      :schema="allSchemas.detailSchema"
-      :data="detailRef"
-    />
-    <!-- 操作按钮 -->
-    <template #footer>
-      <!-- 按钮:保存 -->
-      <XButton
-        v-if="['create', 'update'].includes(actionType)"
-        type="primary"
-        :title="t('action.save')"
-        :loading="actionLoading"
-        @click="submitForm()"
-      />
-      <!-- 按钮:关闭 -->
-      <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
-    </template>
-  </XModal>
-</template>

+ 130 - 162
yudao-ui-admin-vue3/src/views/pay/order/order.data.ts

@@ -1,8 +1,8 @@
 import { reactive } from 'vue'
 import { useI18n } from '@/hooks/web/useI18n'
 import { required } from '@/utils/formRules'
-import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
 import { DICT_TYPE } from '@/utils/dict'
+import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
 const { t } = useI18n() // 国际化
 
 // 表单校验
@@ -23,166 +23,134 @@ export const rules = reactive({
   refundAmount: [required]
 })
 // CrudSchema
-const crudSchemas = reactive<CrudSchema[]>([
-  {
-    label: t('common.index'),
-    field: 'id',
-    type: 'index',
-    form: {
-      show: false
-    },
-    detail: {
-      show: false
-    }
-  },
-  {
-    label: '商户编号',
-    field: 'merchantId',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '应用编号',
-    field: 'appId',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '渠道编号',
-    field: 'channelId'
-  },
-  {
-    label: '渠道编码',
-    field: 'channelCode',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '渠道订单号',
-    field: 'merchantOrderId',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '商品标题',
-    field: 'subject'
-  },
-  {
-    label: '商品描述',
-    field: 'body'
-  },
-  {
-    label: '异步通知地址',
-    field: 'notifyUrl'
-  },
-  {
-    label: '回调商户状态',
-    field: 'notifyStatus',
-    dictType: DICT_TYPE.PAY_ORDER_NOTIFY_STATUS,
-    dictClass: 'number'
-  },
-  {
-    label: '支付金额',
-    field: 'amount',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '渠道手续费',
-    field: 'channelFeeRate',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '渠道手续金额',
-    field: 'channelFeeAmount',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '支付状态',
-    field: 'status',
-    dictType: DICT_TYPE.PAY_ORDER_STATUS,
-    dictClass: 'number',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '用户 IP',
-    field: 'userIp'
-  },
-  {
-    label: '订单失效时间',
-    field: 'expireTime'
-  },
-  {
-    label: '订单支付成功时间',
-    field: 'successTime'
-  },
-  {
-    label: '订单支付通知时间',
-    field: 'notifyTime'
-  },
-  {
-    label: '支付成功的订单拓展单编号',
-    field: 'successExtensionId'
-  },
-  {
-    label: '退款状态',
-    field: 'refundStatus',
-    dictType: DICT_TYPE.PAY_ORDER_REFUND_STATUS,
-    dictClass: 'number',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '退款次数',
-    field: 'refundTimes'
-  },
-  {
-    label: '退款总金额',
-    field: 'refundAmount'
-  },
-  {
-    label: '渠道用户编号',
-    field: 'channelUserId'
-  },
-  {
-    label: '渠道订单号',
-    field: 'channelOrderNo'
-  },
-  {
-    label: t('common.createTime'),
-    field: 'createTime',
-    form: {
-      show: false
-    },
-    search: {
-      show: true,
-      component: 'DatePicker',
-      componentProps: {
-        type: 'datetimerange',
-        valueFormat: 'YYYY-MM-DD HH:mm:ss',
-        defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
+const crudSchemas = reactive<VxeCrudSchema>({
+  primaryKey: 'id',
+  primaryType: 'seq',
+  primaryTitle: '岗位编号',
+  action: true,
+  columns: [
+    {
+      title: '商户编号',
+      field: 'merchantId',
+      isSearch: true
+    },
+    {
+      title: '应用编号',
+      field: 'appId',
+      isSearch: true
+    },
+    {
+      title: '渠道编号',
+      field: 'channelId'
+    },
+    {
+      title: '渠道编码',
+      field: 'channelCode',
+      isSearch: true
+    },
+    {
+      title: '渠道订单号',
+      field: 'merchantOrderId',
+      isSearch: true
+    },
+    {
+      title: '商品标题',
+      field: 'subject'
+    },
+    {
+      title: '商品描述',
+      field: 'body'
+    },
+    {
+      title: '异步通知地址',
+      field: 'notifyUrl'
+    },
+    {
+      title: '回调状态',
+      field: 'notifyStatus',
+      dictType: DICT_TYPE.PAY_ORDER_NOTIFY_STATUS,
+      dictClass: 'number'
+    },
+    {
+      title: '支付金额',
+      field: 'amount',
+      isSearch: true
+    },
+    {
+      title: '渠道手续费',
+      field: 'channelFeeRate',
+      isSearch: true
+    },
+    {
+      title: '渠道手续金额',
+      field: 'channelFeeAmount',
+      isSearch: true
+    },
+    {
+      title: '支付状态',
+      field: 'status',
+      dictType: DICT_TYPE.PAY_ORDER_STATUS,
+      dictClass: 'number',
+      isSearch: true
+    },
+    {
+      title: '用户 IP',
+      field: 'userIp'
+    },
+    {
+      title: '订单失效时间',
+      field: 'expireTime',
+      formatter: 'formatDate'
+    },
+    {
+      title: '支付时间',
+      field: 'successTime',
+      formatter: 'formatDate'
+    },
+    {
+      title: '支付通知时间',
+      field: 'notifyTime',
+      formatter: 'formatDate'
+    },
+    {
+      title: '拓展编号',
+      field: 'successExtensionId'
+    },
+    {
+      title: '退款状态',
+      field: 'refundStatus',
+      dictType: DICT_TYPE.PAY_ORDER_REFUND_STATUS,
+      dictClass: 'number',
+      isSearch: true
+    },
+    {
+      title: '退款次数',
+      field: 'refundTimes'
+    },
+    {
+      title: '退款总金额',
+      field: 'refundAmount'
+    },
+    {
+      title: '渠道用户编号',
+      field: 'channelUserId'
+    },
+    {
+      title: '渠道订单号',
+      field: 'channelOrderNo'
+    },
+    {
+      title: t('common.createTime'),
+      field: 'createTime',
+      formatter: 'formatDate',
+      isForm: false,
+      search: {
+        show: true,
+        itemRender: {
+          name: 'XDataTimePicker'
+        }
       }
     }
-  },
-  {
-    label: t('table.action'),
-    field: 'action',
-    width: '270px',
-    form: {
-      show: false
-    }
-  }
-])
-export const { allSchemas } = useCrudSchemas(crudSchemas)
+  ]
+})
+export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

+ 50 - 85
yudao-ui-admin-vue3/src/views/pay/refund/index.vue

@@ -1,104 +1,69 @@
+<template>
+  <ContentWrap>
+    <!-- 列表 -->
+    <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
+      <template #toolbar_buttons>
+        <!-- 操作:导出 -->
+        <XButton
+          type="warning"
+          preIcon="ep:download"
+          :title="t('action.export')"
+          v-hasPermi="['pay:refund:export']"
+          @click="handleExport()"
+        />
+      </template>
+      <template #actionbtns_default="{ row }">
+        <!-- 操作:详情 -->
+        <XTextButton
+          preIcon="ep:view"
+          :title="t('action.detail')"
+          v-hasPermi="['pay:refund:query']"
+          @click="handleDetail(row.id)"
+        />
+      </template>
+    </vxe-grid>
+  </ContentWrap>
+
+  <XModal v-model="dialogVisible" :title="t('action.detail')">
+    <!-- 对话框(详情) -->
+    <Descriptions :schema="allSchemas.detailSchema" :data="detailData" />
+    <!-- 操作按钮 -->
+    <template #footer>
+      <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
+    </template>
+  </XModal>
+</template>
 <script setup lang="ts" name="Refund">
 import { ref } from 'vue'
-import dayjs from 'dayjs'
-import { DICT_TYPE } from '@/utils/dict'
-import { useTable } from '@/hooks/web/useTable'
 import { useI18n } from '@/hooks/web/useI18n'
-import type { RefundVO } from '@/api/pay/refund/types'
+import { useVxeGrid } from '@/hooks/web/useVxeGrid'
+import { VxeGridInstance } from 'vxe-table'
 import { allSchemas } from './refund.data'
 import * as RefundApi from '@/api/pay/refund'
+
 const { t } = useI18n() // 国际化
 
-// ========== 列表相关 ==========
-const { register, tableObject, methods } = useTable<RefundVO>({
+// 列表相关的变量
+const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
+const { gridOptions, exportList } = useVxeGrid<RefundApi.RefundVO>({
+  allSchemas: allSchemas,
   getListApi: RefundApi.getRefundPageApi,
-  delListApi: RefundApi.deleteRefundApi,
   exportListApi: RefundApi.exportRefundApi
 })
-const { getList, setSearchParams, delList, exportList } = methods
+
+// 导出操作
+const handleExport = async () => {
+  await exportList(xGrid, '退款订单.xls')
+}
 
 // ========== CRUD 相关 ==========
 const dialogVisible = ref(false) // 是否显示弹出层
-const dialogTitle = ref('edit') // 弹出层标题
-
-// ========== 详情相关 ==========
-const detailRef = ref() // 详情 Ref
+const detailData = ref() // 详情 Ref
 
 // 详情操作
-const handleDetail = async (row: RefundVO) => {
+const handleDetail = async (rowId: number) => {
   // 设置数据
-  detailRef.value = RefundApi.getRefundApi(row.id)
-  dialogTitle.value = t('action.detail')
+  detailData.value = RefundApi.getRefundApi(rowId)
   dialogVisible.value = true
 }
-
-// ========== 初始化 ==========
-getList()
 </script>
-
-<template>
-  <!-- 搜索工作区 -->
-  <ContentWrap>
-    <Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
-  </ContentWrap>
-  <ContentWrap>
-    <!-- 操作工具栏 -->
-    <div class="mb-10px">
-      <el-button
-        type="warning"
-        v-hasPermi="['system:post:export']"
-        :loading="tableObject.exportLoading"
-        @click="exportList('退款订单.xls')"
-      >
-        <Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') }}
-      </el-button>
-    </div>
-    <!-- 列表 -->
-    <Table
-      :columns="allSchemas.tableColumns"
-      :selection="false"
-      :data="tableObject.tableList"
-      :loading="tableObject.loading"
-      :pagination="{
-        total: tableObject.total
-      }"
-      v-model:pageSize="tableObject.pageSize"
-      v-model:currentPage="tableObject.currentPage"
-      @register="register"
-    >
-      <template #status="{ row }">
-        <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
-      </template>
-      <template #createTime="{ row }">
-        <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
-      </template>
-      <template #action="{ row }">
-        <el-button
-          link
-          type="primary"
-          v-hasPermi="['system:post:update']"
-          @click="handleDetail(row)"
-        >
-          <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}
-        </el-button>
-        <el-button
-          link
-          type="primary"
-          v-hasPermi="['system:post:delete']"
-          @click="delList(row.id, false)"
-        >
-          <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
-        </el-button>
-      </template>
-    </Table>
-  </ContentWrap>
-
-  <XModal v-model="dialogVisible" :title="dialogTitle">
-    <!-- 对话框(详情) -->
-    <Descriptions :schema="allSchemas.detailSchema" :data="detailRef" />
-    <!-- 操作按钮 -->
-    <template #footer>
-      <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
-    </template>
-  </XModal>
-</template>

+ 168 - 104
yudao-ui-admin-vue3/src/views/pay/refund/refund.data.ts

@@ -1,112 +1,176 @@
 import { reactive } from 'vue'
 import { useI18n } from '@/hooks/web/useI18n'
-import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
 import { DICT_TYPE } from '@/utils/dict'
+import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
 const { t } = useI18n() // 国际化
 
 // CrudSchema
-const crudSchemas = reactive<CrudSchema[]>([
-  {
-    label: t('common.index'),
-    field: 'id',
-    type: 'index',
-    form: {
-      show: false
-    },
-    detail: {
-      show: false
-    }
-  },
-  {
-    label: '应用编号',
-    field: 'appId',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '商户名称',
-    field: 'merchantName'
-  },
-  {
-    label: '应用名称',
-    field: 'appName'
-  },
-  {
-    label: '商品名称',
-    field: 'subject'
-  },
-  {
-    label: '商户退款单号',
-    field: 'merchantRefundNo'
-  },
-  {
-    label: '商户订单号',
-    field: 'merchantOrderId'
-  },
-  {
-    label: '交易订单号',
-    field: 'tradeNo'
-  },
-  {
-    label: '支付金额',
-    field: 'payAmount'
-  },
-  {
-    label: '退款金额',
-    field: 'refundAmount'
-  },
-  {
-    label: '渠道编码',
-    field: 'channelCode',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: '退款类型',
-    field: 'type',
-    dictType: DICT_TYPE.PAY_REFUND_ORDER_TYPE,
-    dictClass: 'number',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: t('common.status'),
-    field: 'status',
-    dictType: DICT_TYPE.PAY_REFUND_ORDER_STATUS,
-    dictClass: 'number',
-    search: {
-      show: true
-    }
-  },
-  {
-    label: t('common.createTime'),
-    field: 'createTime',
-    form: {
-      show: false
-    },
-    search: {
-      show: true,
-      component: 'DatePicker',
-      componentProps: {
-        type: 'datetimerange',
-        valueFormat: 'YYYY-MM-DD HH:mm:ss',
-        defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
+const crudSchemas = reactive<VxeCrudSchema>({
+  primaryKey: 'id',
+  primaryType: 'seq',
+  primaryTitle: '序号',
+  action: true,
+  columns: [
+    {
+      title: '商户编号',
+      field: 'merchantId',
+      isSearch: true
+    },
+    {
+      title: '应用编号',
+      field: 'appId',
+      isSearch: true
+    },
+    {
+      title: '渠道编号',
+      field: 'channelId',
+      isSearch: true
+    },
+    {
+      title: '渠道编码',
+      field: 'channelCode',
+      dictType: DICT_TYPE.PAY_CHANNEL_CODE_TYPE,
+      dictClass: 'number',
+      isSearch: true
+    },
+    {
+      title: '支付订单编号',
+      field: 'orderId',
+      isSearch: true
+    },
+    {
+      title: '交易订单号',
+      field: 'tradeNo',
+      isSearch: true
+    },
+    {
+      title: '商户订单号',
+      field: 'merchantOrderId',
+      isSearch: true
+    },
+    {
+      title: '商户退款单号',
+      field: 'merchantRefundNo',
+      isSearch: true
+    },
+    {
+      title: '回调地址',
+      field: 'notifyUrl',
+      isSearch: true
+    },
+    {
+      title: '回调状态',
+      field: 'notifyStatus',
+      dictType: DICT_TYPE.PAY_ORDER_NOTIFY_STATUS,
+      dictClass: 'number',
+      isSearch: true
+    },
+    {
+      title: '退款类型',
+      field: 'type',
+      dictType: DICT_TYPE.PAY_REFUND_ORDER_TYPE,
+      dictClass: 'number',
+      isSearch: true
+    },
+    {
+      title: t('common.status'),
+      field: 'status',
+      dictType: DICT_TYPE.PAY_REFUND_ORDER_STATUS,
+      dictClass: 'number',
+      isSearch: true
+    },
+    {
+      title: '支付金额',
+      field: 'payAmount',
+      formatter: 'formatAmount',
+      isSearch: true
+    },
+    {
+      title: '退款金额',
+      field: 'refundAmount',
+      formatter: 'formatAmount',
+      isSearch: true
+    },
+    {
+      title: '退款原因',
+      field: 'reason',
+      isSearch: true
+    },
+    {
+      title: '用户IP',
+      field: 'userIp',
+      isSearch: true
+    },
+    {
+      title: '渠道订单号',
+      field: 'channelOrderNo',
+      isSearch: true
+    },
+    {
+      title: '渠道退款单号',
+      field: 'channelRefundNo',
+      isSearch: true
+    },
+    {
+      title: '渠道调用报错时',
+      field: 'channelErrorCode'
+    },
+    {
+      title: '渠道调用报错时',
+      field: 'channelErrorMsg'
+    },
+    {
+      title: '支付渠道的额外参数',
+      field: 'channelExtras'
+    },
+    {
+      title: '退款失效时间',
+      field: 'expireTime',
+      formatter: 'formatDate',
+      isForm: false,
+      search: {
+        show: true,
+        itemRender: {
+          name: 'XDataTimePicker'
+        }
+      }
+    },
+    {
+      title: '退款成功时间',
+      field: 'successTime',
+      formatter: 'formatDate',
+      isForm: false,
+      search: {
+        show: true,
+        itemRender: {
+          name: 'XDataTimePicker'
+        }
+      }
+    },
+    {
+      title: '退款通知时间',
+      field: 'notifyTime',
+      formatter: 'formatDate',
+      isForm: false,
+      search: {
+        show: true,
+        itemRender: {
+          name: 'XDataTimePicker'
+        }
+      }
+    },
+    {
+      title: t('common.createTime'),
+      field: 'createTime',
+      formatter: 'formatDate',
+      isForm: false,
+      search: {
+        show: true,
+        itemRender: {
+          name: 'XDataTimePicker'
+        }
       }
     }
-  },
-  {
-    label: t('table.action'),
-    field: 'action',
-    width: '240px',
-    form: {
-      show: false
-    },
-    detail: {
-      show: false
-    }
-  }
-])
-export const { allSchemas } = useCrudSchemas(crudSchemas)
+  ]
+})
+export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

+ 1 - 1
yudao-ui-admin-vue3/src/views/system/user/index.vue

@@ -78,7 +78,7 @@
             @click="handleDetail(row.id)"
           />
           <el-dropdown class="p-0.5" v-hasPermi="['infra:job:trigger', 'infra:job:query']">
-            <XTextButton title="更多" postIcon="ep:arrow-down" />
+            <XTextButton :title="t('action.more')" postIcon="ep:arrow-down" />
             <template #dropdown>
               <el-dropdown-menu>
                 <el-dropdown-item>

Some files were not shown because too many files changed in this diff