1. 控件优化

2. 增加monaco-editor、echarts等
This commit is contained in:
Gary Fu
2024-06-30 10:58:24 +08:00
parent 56fd1fa151
commit aac8f09802
74 changed files with 8494 additions and 936 deletions

View File

@@ -1,7 +1,6 @@
import { ref, unref } from 'vue'
import { $i18nBundle, $i18nKey } from '@/messages'
import { isArray, isObject, isFunction } from 'lodash'
import dayjs from 'dayjs'
import { isArray, isFunction, isObject } from 'lodash-es'
export const getFrontendPage = (totalCount, pageSize, pageNumber = 1) => {
const pageCount = Math.floor((totalCount + pageSize - 1) / pageSize)
@@ -138,10 +137,27 @@ export const parsePathParams = (path, params) => {
return path
}
export const proxyMethod = (targets = [], methodName) => {
return (...args) => {
const results = []
for (let target of targets.filter(target => !!unref(target))) {
target = unref(target)
const method = target[methodName]
if (isFunction(method)) {
results.push(method.call(target, ...args))
}
}
if (isObject(results[0]) && isFunction(results[0]?.then)) {
return Promise.all(results)
}
return results
}
}
/**
* 定义表单选项带有jsdoc注解方便代码提示
* @param {CommonFormOption[]} formOptions 表单选项
* @return {CommonFormOption[]} 表单选项配置
* @param {CommonFormOption|CommonFormOption[]} formOptions 表单选项
* @return {CommonFormOption|CommonFormOption[]} 表单选项配置
*/
export const defineFormOptions = (formOptions) => {
return formOptions
@@ -171,31 +187,3 @@ export const defineTableButtons = (tableButtons) => {
export const defineMenuItems = (menuItems) => {
return menuItems
}
export const formatDate = (date, format) => {
if (date) {
return dayjs(date).format(format || 'YYYY-MM-DD HH:mm:ss')
}
}
export const formatDay = (date, format) => {
if (date) {
return dayjs(date).format(format || 'YYYY-MM-DD')
}
}
export const proxyMethod = (targets = [], methodName) => {
return (...args) => {
const results = []
for (let target of targets) {
target = unref(target)
const method = target[methodName]
if (isFunction(method)) {
results.push(method.call(target, ...args))
}
}
if (isObject(results[0]) && isFunction(results[0]?.then)) {
return Promise.all(results)
}
return results
}
}