!316 增加全局超长number序列化 vue3 pay模块重构

Merge pull request !316 from xingyu/feature/vue3
This commit is contained in:
芋道源码 2022-11-30 11:44:05 +00:00 committed by Gitee
commit cb0daf3c23
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
37 changed files with 2642 additions and 2310 deletions

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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));
}

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -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());
}
}
}

View File

@ -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[]

View File

@ -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);
}

View File

@ -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 Load Diff

View File

@ -1,14 +1,17 @@
module.exports = {
printWidth: 100,
tabWidth: 2,
useTabs: false,
semi: false,
printWidth: 100, // 每行代码长度默认80
tabWidth: 2, // 每个tab相当于多少个空格默认2ab进行缩进默认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,

View File

@ -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 })
}

View File

@ -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
}

View File

@ -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 })
}

View File

@ -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
}

View File

@ -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 })
}
// 支付商户状态修改

View File

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

View File

@ -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 })
}

View File

@ -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
}

View File

@ -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 })
}

View File

@ -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
}

View File

@ -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)
}

View File

@ -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',

View File

@ -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: '详情',

View File

@ -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>

View File

@ -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>

View File

@ -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)]
{
title: t('common.status'),
field: 'status',
dictType: DICT_TYPE.COMMON_STATUS,
dictClass: 'number',
isSearch: true
},
{
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'
}
}
}
},
{
label: t('table.action'),
field: 'action',
width: '240px',
form: {
show: false
},
detail: {
show: false
}
}
])
export const { allSchemas } = useCrudSchemas(crudSchemas)
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

View File

@ -1,158 +1,49 @@
<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 { 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 { register, tableObject, methods } = useTable<AppVO>({
getListApi: AppApi.getAppPageApi,
delListApi: AppApi.deleteAppApi,
exportListApi: AppApi.exportAppApi
})
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 setDialogTile = (type: string) => {
dialogTitle.value = t('action.' + type)
actionType.value = type
dialogVisible.value = true
}
//
const handleCreate = () => {
setDialogTile('create')
}
//
const handleUpdate = async (row: AppVO) => {
setDialogTile('update')
//
const res = await AppApi.getAppApi(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 AppVO
if (actionType.value === 'create') {
await AppApi.createAppApi(data)
ElMessage.success(t('common.createSuccess'))
} else {
await AppApi.updateAppApi(data)
ElMessage.success(t('common.updateSuccess'))
}
//
dialogVisible.value = false
await getList()
} finally {
actionLoading.value = false
}
}
})
}
// ========== ==========
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
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
<template #toolbar_buttons>
<!-- 操作新增 -->
<XButton
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>
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>
</Table>
<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">
@ -167,7 +58,7 @@ getList()
<Descriptions
v-if="actionType === 'detail'"
:schema="allSchemas.detailSchema"
:data="detailRef"
:data="detailData"
/>
<!-- 操作按钮 -->
<template #footer>
@ -184,3 +75,97 @@ getList()
</template>
</XModal>
</template>
<script setup lang="ts" name="App">
import { ref, unref } from 'vue'
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 { rules, allSchemas } from './app.data'
import * as AppApi from '@/api/pay/app'
const { t } = useI18n() //
const message = useMessage() //
//
const xGrid = ref<VxeGridInstance>() // Grid Ref
const { gridOptions, getList, deleteData, exportList } = useVxeGrid<AppApi.AppVO>({
allSchemas: allSchemas,
getListApi: AppApi.getAppPageApi,
deleteApi: AppApi.deleteAppApi,
exportListApi: AppApi.exportAppApi
})
// ========== 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)
actionType.value = type
dialogVisible.value = true
}
//
const handleCreate = () => {
setDialogTile('create')
}
//
const handleExport = async () => {
await exportList(xGrid, '应用信息.xls')
}
//
const handleUpdate = async (rowId: number) => {
setDialogTile('update')
//
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()
if (!elForm) return
elForm.validate(async (valid) => {
if (valid) {
actionLoading.value = true
//
try {
const data = unref(formRef)?.formModel as AppApi.AppVO
if (actionType.value === 'create') {
await AppApi.createAppApi(data)
message.success(t('common.createSuccess'))
} else {
await AppApi.updateAppApi(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
} finally {
actionLoading.value = false
//
await getList(xGrid)
}
}
})
}
</script>

View File

@ -1,160 +1,50 @@
<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 { 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>({
getListApi: MerchantApi.getMerchantPageApi,
delListApi: MerchantApi.deleteMerchantApi,
exportListApi: MerchantApi.exportMerchantApi
})
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 setDialogTile = (type: string) => {
dialogTitle.value = t('action.' + type)
actionType.value = type
dialogVisible.value = true
}
//
const handleCreate = () => {
setDialogTile('create')
}
//
const handleUpdate = async (row: MerchantVO) => {
setDialogTile('update')
//
const res = await MerchantApi.getMerchantApi(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 MerchantVO
if (actionType.value === 'create') {
await MerchantApi.createMerchantApi(data)
ElMessage.success(t('common.createSuccess'))
} else {
await MerchantApi.updateMerchantApi(data)
ElMessage.success(t('common.updateSuccess'))
}
//
dialogVisible.value = false
await getList()
} finally {
actionLoading.value = false
}
}
})
}
// ========== ==========
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
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
<template #toolbar_buttons>
<!-- 操作新增 -->
<XButton
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>
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>
</Table>
<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
@ -167,7 +57,7 @@ getList()
<Descriptions
v-if="actionType === 'detail'"
:schema="allSchemas.detailSchema"
:data="detailRef"
:data="detailData"
/>
<!-- 操作按钮 -->
<template #footer>
@ -184,3 +74,96 @@ getList()
</template>
</XModal>
</template>
<script setup lang="ts" name="Merchant">
import { ref, unref } from 'vue'
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 { rules, allSchemas } from './merchant.data'
import * as MerchantApi from '@/api/pay/merchant'
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,
deleteApi: MerchantApi.deleteMerchantApi,
exportListApi: MerchantApi.exportMerchantApi
})
// ========== 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)
actionType.value = type
dialogVisible.value = true
}
//
const handleCreate = () => {
setDialogTile('create')
}
//
const handleExport = async () => {
await exportList(xGrid, '商户列表.xls')
}
//
const handleUpdate = async (rowId: number) => {
setDialogTile('update')
//
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()
if (!elForm) return
elForm.validate(async (valid) => {
if (valid) {
actionLoading.value = true
//
try {
const data = unref(formRef)?.formModel as MerchantApi.MerchantVO
if (actionType.value === 'create') {
await MerchantApi.createMerchantApi(data)
message.success(t('common.createSuccess'))
} else {
await MerchantApi.updateMerchantApi(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
} finally {
actionLoading.value = false
//
await getList(xGrid)
}
}
})
}
</script>

View File

@ -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
},
{
title: '商户简称',
field: 'shortName',
isSearch: true
},
{
title: t('common.status'),
field: 'status',
dictType: DICT_TYPE.COMMON_STATUS,
dictClass: 'number',
isSearch: true
},
{
title: t('form.remark'),
field: 'remark',
isTable: false,
form: {
component: 'Input',
componentProps: {
type: 'textarea',
rows: 4
},
colProps: {
span: 24
}
}
},
table: {
show: false
}
},
{
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)]
{
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)

View File

@ -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 handleExport = async () => {
await exportList(xGrid, '订单数据.xls')
}
//
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 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>

View File

@ -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
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
primaryTitle: '岗位编号',
action: true,
columns: [
{
title: '商户编号',
field: 'merchantId',
isSearch: true
},
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
{
title: '应用编号',
field: 'appId',
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: '渠道编号',
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)

View File

@ -1,104 +1,69 @@
<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 { allSchemas } from './refund.data'
import * as RefundApi from '@/api/pay/refund'
const { t } = useI18n() //
// ========== ==========
const { register, tableObject, methods } = useTable<RefundVO>({
getListApi: RefundApi.getRefundPageApi,
delListApi: RefundApi.deleteRefundApi,
exportListApi: RefundApi.exportRefundApi
})
const { getList, setSearchParams, delList, exportList } = methods
// ========== CRUD ==========
const dialogVisible = ref(false) //
const dialogTitle = ref('edit') //
// ========== ==========
const detailRef = ref() // Ref
//
const handleDetail = async (row: RefundVO) => {
//
detailRef.value = RefundApi.getRefundApi(row.id)
dialogTitle.value = t('action.detail')
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" />
<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 #createTime="{ row }">
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
<template #actionbtns_default="{ row }">
<!-- 操作详情 -->
<XTextButton
preIcon="ep:view"
:title="t('action.detail')"
v-hasPermi="['pay:refund:query']"
@click="handleDetail(row.id)"
/>
</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>
</vxe-grid>
</ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="t('action.detail')">
<!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef" />
<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 { useI18n } from '@/hooks/web/useI18n'
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 xGrid = ref<VxeGridInstance>() // Grid Ref
const { gridOptions, exportList } = useVxeGrid<RefundApi.RefundVO>({
allSchemas: allSchemas,
getListApi: RefundApi.getRefundPageApi,
exportListApi: RefundApi.exportRefundApi
})
//
const handleExport = async () => {
await exportList(xGrid, '退款订单.xls')
}
// ========== CRUD ==========
const dialogVisible = ref(false) //
const detailData = ref() // Ref
//
const handleDetail = async (rowId: number) => {
//
detailData.value = RefundApi.getRefundApi(rowId)
dialogVisible.value = true
}
</script>

View File

@ -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
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
primaryTitle: '序号',
action: true,
columns: [
{
title: '商户编号',
field: 'merchantId',
isSearch: true
},
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
{
title: '应用编号',
field: 'appId',
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: '渠道编号',
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)

View File

@ -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>