增加配置项

值变更回调事件增加传参
移动端不绑表字段报错修正
子组件将formModel传给父组件
This commit is contained in:
yaoyn
2024-06-11 17:09:39 +08:00
parent 1e4b1c3452
commit 832c0f94d8
7 changed files with 823 additions and 818 deletions

View File

@ -16,6 +16,8 @@ VITE_DROP_CONSOLE = false
# 接口地址 # 接口地址
# 如果没有跨域问题,直接在这里配置即可 # 如果没有跨域问题,直接在这里配置即可
VITE_GLOB_API_URL=http://10.133.96.105:8077 VITE_GLOB_API_URL=http://10.133.96.105:8077
# 报表系统地址
VITE_GLOB_REPORT_URL=http://10.133.96.105:3100
# 文件上传接口 可选 # 文件上传接口 可选
VITE_GLOB_UPLOAD_URL = /system/oss/upload VITE_GLOB_UPLOAD_URL = /system/oss/upload
@ -31,3 +33,6 @@ VITE_GLOB_PRINT_BASE_URL = http://114.116.210.204:3300
# 接口地址前缀,有些系统所有接口地址都有前缀,可以在这里统一加,方便切换 # 接口地址前缀,有些系统所有接口地址都有前缀,可以在这里统一加,方便切换
VITE_GLOB_API_URL_PREFIX = VITE_GLOB_API_URL_PREFIX =
# 屏蔽通知消息的轮询
VITE_DISABLE_NEWS=false

View File

@ -259,7 +259,7 @@
const val = Array.isArray(value) ? value.join(',') : value; const val = Array.isArray(value) ? value.join(',') : value;
emitData.value = args; emitData.value = args;
emit('update:value', val); emit('update:value', val);
emit('change', val); emit('change', val, args);
selectedValue.value = props.value === undefined ? val : (((typeof props.value === 'string' && !!props.value ? props.value?.split(',') : props.value) || undefined) as any); selectedValue.value = props.value === undefined ? val : (((typeof props.value === 'string' && !!props.value ? props.value?.split(',') : props.value) || undefined) as any);
updateSepTextField(Array.isArray(value) ? value : [value]); updateSepTextField(Array.isArray(value) ? value : [value]);
} }

File diff suppressed because it is too large Load Diff

View File

@ -84,7 +84,17 @@
:wrapperCol="itemLabelWidthProp.wrapperCol" :wrapperCol="itemLabelWidthProp.wrapperCol"
> >
<template v-if="getDisable && readonlySupport(schema.component)"> <template v-if="getDisable && readonlySupport(schema.component)">
<readonly :schema="schema" :model="formModel" /> <readonly :schema="schema" :model="formModel"/>
<component
:is="componentMap.get(schema.component)"
v-show="false"
v-model:endField="schema.field.split(',')[1]"
v-model:startField="schema.field.split(',')[0]"
v-model:value="formModel![schema.field]"
:disabled="getDisable"
:size="formProps?.size"
v-bind="schema.componentProps"
/>
</template> </template>
<template v-else> <template v-else>
<component <component
@ -303,13 +313,13 @@
} else if (typeof fun === 'function') { } else if (typeof fun === 'function') {
event = fun; event = fun;
} }
componentProps['on' + upperFirst(eventKey)] = function () { componentProps['on' + upperFirst(eventKey)] = function (value, selectedOptions) {
let cloneFormModel = cloneDeep(formModel); let cloneFormModel = cloneDeep(formModel);
for (let item in cloneFormModel) { for (let item in cloneFormModel) {
let field = camelCaseString(item); let field = camelCaseString(item);
if (field) cloneFormModel[field] = cloneFormModel[item]; if (field) cloneFormModel[field] = cloneFormModel[item];
} }
event(props.schema, isCamelCase ? cloneFormModel : formModel, props.formApi, { formData }); event(props.schema, isCamelCase ? cloneFormModel : formModel, props.formApi, { formData, value, selectedOptions });
if (isCamelCase) { if (isCamelCase) {
for (let item in formModel) { for (let item in formModel) {

View File

@ -5,50 +5,40 @@ import pkg from '../../package.json';
import { getConfigFileName } from '../../build/getConfigFileName'; import { getConfigFileName } from '../../build/getConfigFileName';
export function getCommonStoragePrefix() { export function getCommonStoragePrefix() {
const { VITE_GLOB_APP_SHORT_NAME } = getAppEnvConfig(); const { VITE_GLOB_APP_SHORT_NAME } = getAppEnvConfig();
return `${VITE_GLOB_APP_SHORT_NAME}__${getEnv()}`.toUpperCase(); return `${VITE_GLOB_APP_SHORT_NAME}__${getEnv()}`.toUpperCase();
} }
// Generate cache key according to version // Generate cache key according to version
export function getStorageShortName() { export function getStorageShortName() {
return `${getCommonStoragePrefix()}${`__${pkg.version}`}__`.toUpperCase(); return `${getCommonStoragePrefix()}${`__${pkg.version}`}__`.toUpperCase();
} }
export function getAppEnvConfig() { export function getAppEnvConfig() {
const ENV_NAME = getConfigFileName(import.meta.env); const ENV_NAME = getConfigFileName(import.meta.env);
const ENV = (import.meta.env.DEV const ENV = (import.meta.env.DEV
? // Get the global configuration (the configuration will be extracted independently when packaging) ? // Get the global configuration (the configuration will be extracted independently when packaging)
(import.meta.env as unknown as GlobEnvConfig) (import.meta.env as unknown as GlobEnvConfig)
: window[ENV_NAME as any]) as unknown as GlobEnvConfig; : window[ENV_NAME as any]) as unknown as GlobEnvConfig;
const { const { VITE_GLOB_APP_TITLE, VITE_GLOB_API_URL, VITE_GLOB_APP_SHORT_NAME, VITE_GLOB_API_URL_PREFIX, VITE_GLOB_UPLOAD_URL, VITE_GLOB_UPLOAD_PREVIEW, VITE_GLOB_OUT_LINK_URL, VITE_GLOB_REPORT_URL, VITE_GLOB_PRINT_BASE_URL } = ENV;
VITE_GLOB_APP_TITLE,
VITE_GLOB_API_URL,
VITE_GLOB_APP_SHORT_NAME,
VITE_GLOB_API_URL_PREFIX,
VITE_GLOB_UPLOAD_URL,
VITE_GLOB_UPLOAD_PREVIEW,
VITE_GLOB_OUT_LINK_URL,
VITE_GLOB_PRINT_BASE_URL,
} = ENV;
if (!/^[a-zA-Z\_]*$/.test(VITE_GLOB_APP_SHORT_NAME)) { if (!/^[a-zA-Z\_]*$/.test(VITE_GLOB_APP_SHORT_NAME)) {
warn( warn(`VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.`);
`VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.`, }
);
}
return { return {
VITE_GLOB_APP_TITLE, VITE_GLOB_APP_TITLE,
VITE_GLOB_API_URL, VITE_GLOB_API_URL,
VITE_GLOB_APP_SHORT_NAME, VITE_GLOB_APP_SHORT_NAME,
VITE_GLOB_API_URL_PREFIX, VITE_GLOB_API_URL_PREFIX,
VITE_GLOB_UPLOAD_URL, VITE_GLOB_UPLOAD_URL,
VITE_GLOB_UPLOAD_PREVIEW, VITE_GLOB_UPLOAD_PREVIEW,
VITE_GLOB_OUT_LINK_URL, VITE_GLOB_OUT_LINK_URL,
VITE_GLOB_PRINT_BASE_URL, VITE_GLOB_REPORT_URL,
}; VITE_GLOB_PRINT_BASE_URL
};
} }
/** /**
@ -67,7 +57,7 @@ export const prodMode = 'production';
* @example: * @example:
*/ */
export function getEnv(): string { export function getEnv(): string {
return import.meta.env.MODE; return import.meta.env.MODE;
} }
/** /**
@ -76,7 +66,7 @@ export function getEnv(): string {
* @example: * @example:
*/ */
export function isDevMode(): boolean { export function isDevMode(): boolean {
return import.meta.env.DEV; return import.meta.env.DEV;
} }
/** /**
@ -85,5 +75,5 @@ export function isDevMode(): boolean {
* @example: * @example:
*/ */
export function isProdMode(): boolean { export function isProdMode(): boolean {
return import.meta.env.PROD; return import.meta.env.PROD;
} }

View File

@ -498,7 +498,8 @@
} }
// TODO 这里继续写各组件自己特有的一些验证 // TODO 这里继续写各组件自己特有的一些验证
if (!component.bindTable) { if ((component.type == 'input' && !component.options!.isSave && !component.bindTable) ||
(component.type !== 'input' && !component.bindTable)) {
return t(`{name}未绑定表`, { name: component.label }); return t(`{name}未绑定表`, { name: component.label });
} }

288
types/config.d.ts vendored
View File

@ -1,179 +1,173 @@
import { MenuTypeEnum, MenuModeEnum, TriggerEnum, MixSidebarTriggerEnum } from '/@/enums/menuEnum'; import { MenuTypeEnum, MenuModeEnum, TriggerEnum, MixSidebarTriggerEnum } from '/@/enums/menuEnum';
import { import { ContentEnum, PermissionModeEnum, ThemeEnum, RouterTransitionEnum, SettingButtonPositionEnum, SessionTimeoutProcessingEnum } from '/@/enums/appEnum';
ContentEnum,
PermissionModeEnum,
ThemeEnum,
RouterTransitionEnum,
SettingButtonPositionEnum,
SessionTimeoutProcessingEnum,
} from '/@/enums/appEnum';
import { CacheTypeEnum } from '/@/enums/cacheEnum'; import { CacheTypeEnum } from '/@/enums/cacheEnum';
export type LocaleType = 'zh_CN' | 'zh_TW' | 'en' | 'ru' | 'ja' | 'ko'; export type LocaleType = 'zh_CN' | 'zh_TW' | 'en' | 'ru' | 'ja' | 'ko';
export interface MenuSetting { export interface MenuSetting {
bgColor: string; bgColor: string;
fixed: boolean; fixed: boolean;
collapsed: boolean; collapsed: boolean;
canDrag: boolean; canDrag: boolean;
show: boolean; show: boolean;
hidden: boolean; hidden: boolean;
split: boolean; split: boolean;
menuWidth: number; menuWidth: number;
mode: MenuModeEnum; mode: MenuModeEnum;
type: MenuTypeEnum; type: MenuTypeEnum;
theme: ThemeEnum; theme: ThemeEnum;
topMenuAlign: 'start' | 'center' | 'end'; topMenuAlign: 'start' | 'center' | 'end';
trigger: TriggerEnum; trigger: TriggerEnum;
accordion: boolean; accordion: boolean;
closeMixSidebarOnChange: boolean; closeMixSidebarOnChange: boolean;
collapsedShowTitle: boolean; collapsedShowTitle: boolean;
mixSideTrigger: MixSidebarTriggerEnum; mixSideTrigger: MixSidebarTriggerEnum;
mixSideFixed: boolean; mixSideFixed: boolean;
} }
export interface MultiTabsSetting { export interface MultiTabsSetting {
cache: boolean; cache: boolean;
show: boolean; show: boolean;
showQuick: boolean; showQuick: boolean;
canDrag: boolean; canDrag: boolean;
showRedo: boolean; showRedo: boolean;
showFold: boolean; showFold: boolean;
} }
export interface HeaderSetting { export interface HeaderSetting {
bgColor: string; bgColor: string;
fixed: boolean; fixed: boolean;
show: boolean; show: boolean;
theme: ThemeEnum; theme: ThemeEnum;
// Turn on full screen // Turn on full screen
showFullScreen: boolean; showFullScreen: boolean;
// Whether to show the lock screen // Whether to show the lock screen
useLockPage: boolean; useLockPage: boolean;
// Show document button // Show document button
showDoc: boolean; showDoc: boolean;
// Show message center button // Show message center button
showNotice: boolean; showNotice: boolean;
showSearch: boolean; showSearch: boolean;
} }
export interface LocaleSetting { export interface LocaleSetting {
showPicker: boolean; showPicker: boolean;
// Current language // Current language
locale: LocaleType; locale: LocaleType;
// default language // default language
fallback: LocaleType; fallback: LocaleType;
// available Locales // available Locales
availableLocales: LocaleType[]; availableLocales: LocaleType[];
} }
export interface TransitionSetting { export interface TransitionSetting {
// Whether to open the page switching animation // Whether to open the page switching animation
enable: boolean; enable: boolean;
// Route basic switching animation // Route basic switching animation
basicTransition: RouterTransitionEnum; basicTransition: RouterTransitionEnum;
// Whether to open page switching loading // Whether to open page switching loading
openPageLoading: boolean; openPageLoading: boolean;
// Whether to open the top progress bar // Whether to open the top progress bar
openNProgress: boolean; openNProgress: boolean;
} }
export interface ProjectConfig { export interface ProjectConfig {
// Storage location of permission related information // Storage location of permission related information
permissionCacheType: CacheTypeEnum; permissionCacheType: CacheTypeEnum;
// Whether to show the configuration button // Whether to show the configuration button
showSettingButton: boolean; showSettingButton: boolean;
// Whether to show the theme switch button // Whether to show the theme switch button
showDarkModeToggle: boolean; showDarkModeToggle: boolean;
// Configure where the button is displayed // Configure where the button is displayed
settingButtonPosition: SettingButtonPositionEnum; settingButtonPosition: SettingButtonPositionEnum;
// Permission mode // Permission mode
permissionMode: PermissionModeEnum; permissionMode: PermissionModeEnum;
// Session timeout processing // Session timeout processing
sessionTimeoutProcessing: SessionTimeoutProcessingEnum; sessionTimeoutProcessing: SessionTimeoutProcessingEnum;
// Website gray mode, open for possible mourning dates // Website gray mode, open for possible mourning dates
grayMode: boolean; grayMode: boolean;
// Whether to turn on the color weak mode // Whether to turn on the color weak mode
colorWeak: boolean; colorWeak: boolean;
// Theme color // Theme color
themeColor: string; themeColor: string;
// The main interface is displayed in full screen, the menu is not displayed, and the top // The main interface is displayed in full screen, the menu is not displayed, and the top
fullContent: boolean; fullContent: boolean;
// content width // content width
contentMode: ContentEnum; contentMode: ContentEnum;
// Whether to display the logo // Whether to display the logo
showLogo: boolean; showLogo: boolean;
// Whether to show the global footer // Whether to show the global footer
showFooter: boolean; showFooter: boolean;
// menuType: MenuTypeEnum; // menuType: MenuTypeEnum;
headerSetting: HeaderSetting; headerSetting: HeaderSetting;
// menuSetting // menuSetting
menuSetting: MenuSetting; menuSetting: MenuSetting;
// Multi-tab settings // Multi-tab settings
multiTabsSetting: MultiTabsSetting; multiTabsSetting: MultiTabsSetting;
// Animation configuration // Animation configuration
transitionSetting: TransitionSetting; transitionSetting: TransitionSetting;
// pageLayout whether to enable keep-alive // pageLayout whether to enable keep-alive
openKeepAlive: boolean; openKeepAlive: boolean;
// Lock screen time // Lock screen time
lockTime: number; lockTime: number;
// Show breadcrumbs // Show breadcrumbs
showBreadCrumb: boolean; showBreadCrumb: boolean;
// Show breadcrumb icon // Show breadcrumb icon
showBreadCrumbIcon: boolean; showBreadCrumbIcon: boolean;
// Use error-handler-plugin // Use error-handler-plugin
useErrorHandle: boolean; useErrorHandle: boolean;
// Whether to open back to top // Whether to open back to top
useOpenBackTop: boolean; useOpenBackTop: boolean;
// Is it possible to embed iframe pages // Is it possible to embed iframe pages
canEmbedIFramePage: boolean; canEmbedIFramePage: boolean;
// Whether to delete unclosed messages and notify when switching the interface // Whether to delete unclosed messages and notify when switching the interface
closeMessageOnSwitch: boolean; closeMessageOnSwitch: boolean;
// Whether to cancel the http request that has been sent but not responded when switching the interface. // Whether to cancel the http request that has been sent but not responded when switching the interface.
removeAllHttpPending: boolean; removeAllHttpPending: boolean;
} }
export interface GlobConfig { export interface GlobConfig {
// Site title // Site title
title: string; title: string;
// Service interface url // Service interface url
apiUrl: string; apiUrl: string;
// Upload url // Upload url
uploadUrl?: string; uploadUrl?: string;
// Service interface url prefix // Service interface url prefix
urlPrefix?: string; urlPrefix?: string;
// Project abbreviation // Project abbreviation
shortName: string; shortName: string;
// outlink // outlink
outLink?: string; outLink?: string;
//print url //print url
printBaseUrl?: string; printBaseUrl?: string;
} }
export interface GlobEnvConfig { export interface GlobEnvConfig {
// Site title // Site title
VITE_GLOB_APP_TITLE: string; VITE_GLOB_APP_TITLE: string;
// Service interface url // Service interface url
VITE_GLOB_API_URL: string; VITE_GLOB_API_URL: string;
// Service interface url prefix // Service interface url prefix
VITE_GLOB_API_URL_PREFIX?: string; VITE_GLOB_API_URL_PREFIX?: string;
// Project abbreviation // Project abbreviation
VITE_GLOB_APP_SHORT_NAME: string; VITE_GLOB_APP_SHORT_NAME: string;
// Upload url // Upload url
VITE_GLOB_UPLOAD_URL?: string; VITE_GLOB_UPLOAD_URL?: string;
VITE_GLOB_OUT_LINK_URL?: string; VITE_GLOB_OUT_LINK_URL?: string;
VITE_GLOB_PRINT_BASE_URL?: string; VITE_GLOB_PRINT_BASE_URL?: string;
//file preview //file preview
VITE_GLOB_UPLOAD_PREVIEW?: string; VITE_GLOB_UPLOAD_PREVIEW?: string;
VITE_GLOB_REPORT_URL: string;
} }
export interface LogoConfig { export interface LogoConfig {
companyName?: string; companyName?: string;
shortName?: string; shortName?: string;
refreshLogoUrl?: string; refreshLogoUrl?: string;
backgroundLogoUrl?: string; backgroundLogoUrl?: string;
designerLogoUrl?: string; designerLogoUrl?: string;
loginLogoUrl?: string; loginLogoUrl?: string;
menuLogoUrl?: string; menuLogoUrl?: string;
} }