mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 04:39:12 +08:00
修复 updateSchema 多个field 属性时,第二个无效问题。 (#2493)
* Table BasicColumn 添加 editDynamicDisabled Co-authored-by: Cyrus Zhou <6802207@qq.com> 使用方式同 Form FormSchema dynamicDisabled ``` export const Columns: BasicColumn[] = [ { title: 'Title', dataIndex: 'Title', editRow: true, editComponent: 'Select', editDynamicDisabled: ({ record }) => record.isDisabled, }, * editComponentProps onChange 功能恢复 Co-authored-by: Cyrus Zhou <6802207@qq.com> 说明: ...omit(compProps, 'onChange') 这会忽略 onChange ,导致 editComponentProps onChange 被取消 如下功能将不支持: ``` editComponentProps: ({ record }) => { return { options: effectTypeData, onChange: () => { }, }; }, ``` * tableData == null 报错 * ApiSelect 第一次选择触发required错误提示问题 * 恢复 虽然可以解决第一次选择提示报错问题,但是会导致 onChange: (e: any, options: any) => 无法获得 options 的值 * 修复标签页切换灰屏不显示内容问题 Co-authored-by: Cyrus Zhou <6802207@qq.com> 问题描述页面没有用 div 包括 会提示 Component inside <Transition> renders non-element root node that cannot be animated , 导致页灰屏必须刷新页面才可以显示内容 * 添加 Form ApiTransfer ## 使用方式 api 方式: ``` ...... component: 'ApiTransfer', componentProps: { api: sysUserSelector, labelField: 'name', valueField: 'id', }, ..... ``` 数据方式: ``` .... componentProps: { dataSource: [ { title: 'Test01', key: '0', disabled: false, description: 'description 01' }, { title: 'Test02', key: '1', disabled: false, description: 'description 02' }, { title: 'Test03', key: '2', disabled: false, description: 'description 03' }, { title: 'Test04', key: '3', disabled: false, description: 'description 04' }, { title: 'Test05', key: '4', disabled: false, description: 'description 05' }, ], }, .... ``` * style: eslint 书写规范 * fix: 频繁切换页面导致灰屏 * fix: 修复 updateSchema 多个field 属性时,第二个无效问题。 如: ``` updateSchema([ { field: 'password', ifShow: !unref(isUpdate), }, { field: 'confirm', ifShow: !unref(isUpdate), }, ]); ``` Co-authored-by: CyrusZhou <6802207@qq.com>
This commit is contained in:
20
.vscode/settings.json
vendored
20
.vscode/settings.json
vendored
@@ -138,5 +138,23 @@
|
|||||||
],
|
],
|
||||||
"vetur.format.scriptInitialIndent": true,
|
"vetur.format.scriptInitialIndent": true,
|
||||||
"vetur.format.styleInitialIndent": true,
|
"vetur.format.styleInitialIndent": true,
|
||||||
"vetur.validation.script": false
|
"vetur.validation.script": false,
|
||||||
|
"MicroPython.executeButton": [
|
||||||
|
{
|
||||||
|
"text": "▶",
|
||||||
|
"tooltip": "运行",
|
||||||
|
"alignment": "left",
|
||||||
|
"command": "extension.executeFile",
|
||||||
|
"priority": 3.5
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"MicroPython.syncButton": [
|
||||||
|
{
|
||||||
|
"text": "$(sync)",
|
||||||
|
"tooltip": "同步",
|
||||||
|
"alignment": "left",
|
||||||
|
"command": "extension.execute",
|
||||||
|
"priority": 4
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@@ -220,15 +220,19 @@ export function useFormEvents({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const schema: FormSchema[] = [];
|
const schema: FormSchema[] = [];
|
||||||
updateData.forEach((item) => {
|
unref(getSchema).forEach((val) => {
|
||||||
unref(getSchema).forEach((val) => {
|
let _val;
|
||||||
|
updateData.forEach((item) => {
|
||||||
if (val.field === item.field) {
|
if (val.field === item.field) {
|
||||||
const newSchema = deepMerge(val, item);
|
_val = item;
|
||||||
schema.push(newSchema as FormSchema);
|
|
||||||
} else {
|
|
||||||
schema.push(val);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (_val !== undefined && val.field === _val.field) {
|
||||||
|
const newSchema = deepMerge(val, _val);
|
||||||
|
schema.push(newSchema as FormSchema);
|
||||||
|
} else {
|
||||||
|
schema.push(val);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
_setDefaultValue(schema);
|
_setDefaultValue(schema);
|
||||||
|
|
||||||
|
@@ -134,7 +134,7 @@ export const treeProps = buildProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
treeWrapperClassName: String
|
treeWrapperClassName: String,
|
||||||
});
|
});
|
||||||
|
|
||||||
export type TreeProps = ExtractPropTypes<typeof treeProps>;
|
export type TreeProps = ExtractPropTypes<typeof treeProps>;
|
||||||
|
@@ -15,7 +15,9 @@
|
|||||||
appear
|
appear
|
||||||
>
|
>
|
||||||
<keep-alive v-if="openCache" :include="getCaches">
|
<keep-alive v-if="openCache" :include="getCaches">
|
||||||
<component :is="Component" :key="route.fullPath" />
|
<div :key="route.name">
|
||||||
|
<component :is="Component" :key="route.fullPath" />
|
||||||
|
</div>
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
<div v-else :key="route.name">
|
<div v-else :key="route.name">
|
||||||
<component :is="Component" :key="route.fullPath" />
|
<component :is="Component" :key="route.fullPath" />
|
||||||
|
@@ -15,4 +15,3 @@ export function formatToDate(date?: dayjs.ConfigType, format = DATE_FORMAT): str
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const dateUtil = dayjs;
|
export const dateUtil = dayjs;
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@ export function setObjToUrlParams(baseUrl: string, obj: any): string {
|
|||||||
// 深度合并
|
// 深度合并
|
||||||
export function deepMerge<T = any>(src: any = {}, target: any = {}): T {
|
export function deepMerge<T = any>(src: any = {}, target: any = {}): T {
|
||||||
let key: string;
|
let key: string;
|
||||||
const res: any = cloneDeep(src)
|
const res: any = cloneDeep(src);
|
||||||
for (key in target) {
|
for (key in target) {
|
||||||
res[key] = isObject(res[key]) ? deepMerge(res[key], target[key]) : (res[key] = target[key]);
|
res[key] = isObject(res[key]) ? deepMerge(res[key], target[key]) : (res[key] = target[key]);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user