主题切换
设计器自定义组件
代码
js
export default {
props: {
//组件数据
record: {
type: Object,
required: true
},
//在列表组件下传递的数据对象
itemData: {
type: Object,
default: () => ({})
},
//表数据 (在列表组件或表单组件下)
tableData: {
type: Object,
default: () => ({})
},
//在表单组件下传递的数据对象
parameterData: {
type: Object,
default: () => ({})
},
//可视区域高度
height: {
type: Number,
default: 100
}
},
data() {
return {};
},
methods: {
//默认暴露的方法 可外部调用
executeEvent(e) {
console.log(e)
const func = e.functionName ? e.functionName : '';
if (func && this[func] !== void 0) {
this[func](e);
} else {
console.log('未找到对应方法');
}
}
},
mounted() {
this.record.executeEvent = this.executeEvent;
}
}交互方法
js
//主界面是否需要加载
this.record.hasLoad(true);
//结束本组件调用主界面加载
this.record.hideLoad();
//事件呼叫 {functionName:事件,key:关键字,item:关键值,data:传递的数据}
this.record.eventsCall({
functionName: '',
key: '',
item: '',
data: {}
});
//调用其他组件方法
//必传数据 {key:组件key,functionName: 组件方法,data: 传递的数据,}
//非必传数据 {callback: 是否需要回调,callbackComponents:回调组件key,callbackFunction:回调组件方法}
this.record.doEvent({
key: '',
functionName: '',
data: 传递的数据
});
this.record.doEvent({
key: '',
functionName: '',
data: 传递的数据,
source: this.record,
callback: false,
callbackComponents: '',
callbackFunction: '',
});
this.record.doEvent({
key: '',
functionName: '',
data: 传递的数据,
... //可自定义其他数据
});
//获取对应组件参数 key:组件key item:组件关键值
const data = this.record.getComponentData(key)
const data = this.record.getComponentData(key, item)
//获取主界面数据 (不建议直接调用内部方法或修改数据)
const data = this.record.done全局组件交互方法
预览组件 (GdFilePreview)
gd-file-preview:文件预览gd-file-down:文件下载
打开链接 (GdOpenLink)
gd-win-open-link:在新窗口打开链接gd-router-push:在本窗口打开链接gd-win-open-api:根据 API 接口返回打开链接
页面组件交互方法
列表 (dataList)
pageLoading:重新加载数据refresh:刷新数据loadMore:下拉加载数据del:根据 ID 删除数据
视图 (table)
add:打开表单新增数据edit:打开表单编辑数据del:删除选中数据refresh:刷新baseTriggerFilter:筛选数据
BI 图表 (chartBI)
refresh:刷新数据query:筛选数据amplify:放大图表
表格 (tableGrid)
refresh:刷新数据tableGridpage:查询数据gettableGrid:获取数据tableGriddelete:删除
表单 (form)
save:保存open:根据 id 初始化openData:根据 id 获取数据getFormData:获取表单数据
数值统计 (statistic)
refresh:刷新数据query:筛选数据
弹窗 (dialog)
open:打开closed:关闭toggleFullscreen:全屏切换
侧拉 (drawer)
open:打开closed:关闭
筛选 (dataFiltering)
baseTriggerFilter:同步筛选值