watch: {
canshupipei(){
this.postCurrent()
},
},
mounted() {
this.opener = window.opener
this.selectModel();
window.addEventListener('message', ({source, data}) => {
if (source == this.opener) {
if (data.type == 'change') {
this.widgets = data.payload
this.sourceFilters = []
data.sourceFilters.map(i => this.sourceFilters.push({
columnKey: undefined,
operator: 0,
valueType: 1,
value: i.label,
type: i.type
}))
}
}
});
this.opener.postMessage({type: "handshake", groupId: this.groupId})
},
postCurrent() {
this.opener.postMessage({
type: "change", groupId: this.groupId, payload: {
selectedSources: this.selectedSources,
selectedModels: this.selectedModels,
sourceFilters: this.sourceFilters,
groups: this.groups,
aggregations: this.aggregations,
resData: this.resData,
modelReturnData: this.modelReturnData,
canshupipei:this.canshupipei
}
})
},
window.addEventListener('message', ({source,data})=>{
const {groupId} = data
if(!groupId) return
if(source==this.popupWindows.get(groupId)){
if(data.type=="change"){
this.modelData[groupId]=data.payload
}else if(data.type=="handshake"){
this.sendWidgetsToPupup(groupId)
}
}
});