Merge pull request #7280 from igrowp/fix-page-params

fix: 事件动作 -> 页面变量列表为空,无法选择 & 勾选框组件默认值配置fx无效
This commit is contained in:
wutong 2023-06-27 20:38:31 +08:00 committed by GitHub
commit 84393de36c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 13 deletions

View File

@ -235,11 +235,11 @@ export class VariableManager {
getPageVariablesOptions() { getPageVariablesOptions() {
let options: Option[] = []; let options: Option[] = [];
const pageScope = this.dataSchema?.root.children?.filter( const rootScope = this.dataSchema?.root;
item => item.tag === '页面变量' if (rootScope) {
)[0]; options = rootScope
if (pageScope) { .getDataPropsAsOptions()
options = pageScope.getDataPropsAsOptions(); .filter((item: any) => ['__query', '__page'].includes(item.value));
} }
eachTree(options, item => { eachTree(options, item => {
if (item.type === 'array') { if (item.type === 'array') {

View File

@ -160,6 +160,33 @@ const schemas = [
} }
} }
} }
},
{
type: 'object',
properties: {
__query: {
title: '页面入参',
type: 'object',
required: [],
properties: {
name: {
type: 'string',
title: '用户名'
}
}
},
__page: {
title: '页面变量',
type: 'object',
required: [],
properties: {
num: {
type: 'number',
title: '数量'
}
}
}
}
} }
]; ];
@ -632,6 +659,11 @@ export default class AMisSchemaEditor extends React.Component<any, any> {
replaceText replaceText
} as any } as any
} }
ctx={{
__page: {
num: 2
}
}}
/> />
); );
} }

View File

@ -148,14 +148,14 @@ export class CheckboxControlPlugin extends BasePlugin {
needDeleteProps: ['option'], needDeleteProps: ['option'],
label: '默认勾选', label: '默认勾选',
rendererWrapper: true, // 浅色线框包裹一下,增加边界感 rendererWrapper: true, // 浅色线框包裹一下,增加边界感
valueType: 'boolean', valueType: 'boolean'
pipeIn: (value: any, data: any) => { // pipeIn: (value: any, data: any) => {
return value === (data?.data?.trueValue ?? true); // return value === (data?.data?.trueValue ?? true);
}, // },
pipeOut: (value: any, origin: any, data: any) => { // pipeOut: (value: any, origin: any, data: any) => {
const {trueValue = true, falseValue = false} = data; // const {trueValue = true, falseValue = false} = data;
return value ? trueValue : falseValue; // return value ? trueValue : falseValue;
} // }
}), }),
getSchemaTpl('labelRemark'), getSchemaTpl('labelRemark'),
getSchemaTpl('remark'), getSchemaTpl('remark'),