mirror of
https://github.com/jeecgboot/jeecg-boot.git
synced 2025-09-28 11:03:43 +00:00
代码生成器模板小优化:生成的列表默认吸底、代码生成年、月、日存储格式修改
This commit is contained in:
@@ -5,6 +5,7 @@ import type { FormSchema } from "@/components/Form";
|
||||
import { unref } from 'vue';
|
||||
import { isObject, isFunction, isString } from '/@/utils/is';
|
||||
import Big from 'big.js';
|
||||
import dayjs from "dayjs";
|
||||
// update-begin--author:sunjianlei---date:20220408---for: 【VUEN-656】配置外部网址打不开,原因是带了#号,需要替换一下
|
||||
export const URL_HASH_TAB = `__AGWE4H__HASH__TAG__PWHRG__`;
|
||||
// update-end--author:sunjianlei---date:20220408---for: 【VUEN-656】配置外部网址打不开,原因是带了#号,需要替换一下
|
||||
@@ -119,6 +120,30 @@ export function getValueTypeBySchema(schema: FormSchema) {
|
||||
return valueType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过picker属性获取日期数据
|
||||
* @param data
|
||||
* @param picker
|
||||
*/
|
||||
export function getDateByPicker(data, picker) {
|
||||
if (!data || !picker) {
|
||||
return data;
|
||||
}
|
||||
/**
|
||||
* 需要把年、年月、设置成这段时间内的第一天([年季度]不需要处理antd回传的就是该季度的第一天,[年周]也不处理)
|
||||
* 例如日期格式是年,传给数据库的时间必须是20240101
|
||||
* 例如日期格式是年月(选择了202502),传给数据库的时间必须是20250201
|
||||
*/
|
||||
if (picker === 'year') {
|
||||
return dayjs(data).set('month', 0).set('date', 1).format('YYYY-MM-DD');
|
||||
} else if (picker === 'month') {
|
||||
return dayjs(data).set('date', 1).format('YYYY-MM-DD');
|
||||
} else if (picker === 'week') {
|
||||
return dayjs(data).startOf('week').format('YYYY-MM-DD');
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
export function getRawRoute(route: RouteLocationNormalized): RouteLocationNormalized {
|
||||
if (!route) return route;
|
||||
const { matched, ...opt } = route;
|
||||
|
Reference in New Issue
Block a user