fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

287 lines
8.4 KiB

7 years ago
TmpView = BI.inherit(BI.View, {
7 years ago
_defaultConfig: function () {
return BI.extend(TmpView.superclass._defaultConfig.apply(this, arguments), {
7 years ago
baseCls: "bi-tmp"
7 years ago
});
7 years ago
},
7 years ago
_init: function () {
7 years ago
TmpView.superclass._init.apply(this, arguments);
},
7 years ago
change: function (changed) {
if(changed.data1) {
7 years ago
this._showModelData();
}
},
7 years ago
_showModelData: function () {
this.text.setText("父级Model层数据为:" + JSON.stringify(this.model.toJSON()));
7 years ago
},
7 years ago
_createMain: function () {
7 years ago
var self = this;
return BI.createWidget({
type: "bi.border",
items: {
west: {
el: {
type: "bi.vertical",
vgap: 10,
items: [{
el: (this.text = BI.createWidget({
type: "bi.label",
whiteSpace: "normal"
}))
}, {
el: {
type: "bi.text_button",
cls: "tmp-button mvc-button",
text: "点击触发事件tmp('data1', {child: {type: {value: \"临时数据\"}}})",
height: 30,
7 years ago
handler: function () {
7 years ago
self.model.tmp("data1", {
child: {
type: {
value: "临时数据"
}
}
7 years ago
});
7 years ago
}
}
}, {
el: {
type: "bi.text_button",
cls: "tmp-button mvc-button",
text: "点击触发事件submit",
height: 30,
7 years ago
handler: function () {
7 years ago
self.model.submit();
}
}
}, {
el: {
type: "bi.text_button",
cls: "tmp-button mvc-button",
text: "点击跳转到右方",
height: 30,
7 years ago
handler: function () {
7 years ago
self.addSubVessel("test", self.center).skipTo("child", "test", "data1");
}
}
}]
},
width: 200
},
center: {
el: (this.center = BI.createWidget())
}
}
7 years ago
});
7 years ago
},
7 years ago
render: function (vessel) {
7 years ago
BI.createWidget({
type: "bi.center",
element: vessel,
items: [{
el: this._createMain()
}],
hgap: 50,
vgap: 100
7 years ago
});
7 years ago
},
7 years ago
refresh: function () {
7 years ago
this._showModelData();
}
7 years ago
});
7 years ago
TmpModel = BI.inherit(BI.Model, {
7 years ago
_defaultConfig: function () {
return BI.extend(TmpModel.superclass._defaultConfig.apply(this, arguments), {
7 years ago
data1: {
child: {
type: {
value: "这是一个测试数据"
}
}
},
data2: "test"
7 years ago
});
7 years ago
},
7 years ago
_init: function () {
7 years ago
TmpModel.superclass._init.apply(this, arguments);
}
7 years ago
});
7 years ago
TmpChildView = BI.inherit(BI.View, {
7 years ago
_defaultConfig: function () {
return BI.extend(TmpChildView.superclass._defaultConfig.apply(this, arguments), {
7 years ago
baseCls: "bi-tmp-child"
7 years ago
});
7 years ago
},
7 years ago
_init: function () {
7 years ago
TmpChildView.superclass._init.apply(this, arguments);
},
7 years ago
change: function (changed) {
if(changed.child) {
7 years ago
this._showModelData();
}
},
7 years ago
_showModelData: function () {
this.text.setText("子级Model层数据为:" + JSON.stringify(this.model.toJSON()));
7 years ago
},
7 years ago
_createMain: function () {
7 years ago
var self = this;
return BI.createWidget({
type: "bi.border",
items: {
west: {
el: {
type: "bi.vertical",
vgap: 10,
items: [{
el: (this.text = BI.createWidget({
type: "bi.label",
whiteSpace: "normal"
}))
}, {
el: {
type: "bi.text_button",
cls: "tmp-button mvc-button",
text: "点击触发事件set",
height: 30,
7 years ago
handler: function () {
7 years ago
self.set("child", {
type: {
value: "值改变了"
}
7 years ago
});
7 years ago
}
}
}, {
el: {
type: "bi.text_button",
cls: "tmp-button mvc-button",
text: "点击跳转到右方",
height: 30,
7 years ago
handler: function () {
7 years ago
self.addSubVessel("test", self.center).skipTo("child", "test", "child");
}
}
}]
},
width: 200
},
center: {
el: (this.center = BI.createWidget())
}
}
7 years ago
});
7 years ago
},
7 years ago
render: function (vessel) {
7 years ago
BI.createWidget({
type: "bi.center",
element: vessel,
items: [{
el: this._createMain()
}],
hgap: 50
7 years ago
});
7 years ago
},
7 years ago
refresh: function () {
7 years ago
this._showModelData();
}
7 years ago
});
7 years ago
TmpChildModel = BI.inherit(BI.Model, {
7 years ago
_defaultConfig: function () {
return BI.extend(TmpChildModel.superclass._defaultConfig.apply(this, arguments), {
7 years ago
7 years ago
});
7 years ago
},
7 years ago
_init: function () {
7 years ago
TmpChildModel.superclass._init.apply(this, arguments);
}
7 years ago
});
7 years ago
TmpChildChildView = BI.inherit(BI.View, {
7 years ago
_defaultConfig: function () {
return BI.extend(TmpChildChildView.superclass._defaultConfig.apply(this, arguments), {
7 years ago
baseCls: "bi-tmp-child-child"
7 years ago
});
7 years ago
},
7 years ago
_init: function () {
7 years ago
TmpChildChildView.superclass._init.apply(this, arguments);
},
7 years ago
change: function (changed) {
if(changed.type) {
7 years ago
this._showModelData();
}
},
7 years ago
_showModelData: function () {
this.text.setText("叶节点数据为:" + JSON.stringify(this.model.toJSON()));
7 years ago
},
7 years ago
_createMain: function () {
7 years ago
return (this.text = BI.createWidget({
type: "bi.label",
whiteSpace: "normal"
7 years ago
}));
7 years ago
},
7 years ago
render: function (vessel) {
7 years ago
BI.createWidget({
type: "bi.center",
element: vessel,
items: [{
el: this._createMain()
}],
hgap: 50
7 years ago
});
7 years ago
},
7 years ago
refresh: function () {
7 years ago
this._showModelData();
}
7 years ago
});
7 years ago
TmpChildChildModel = BI.inherit(BI.Model, {
7 years ago
_defaultConfig: function () {
return BI.extend(TmpChildChildModel.superclass._defaultConfig.apply(this, arguments), {
7 years ago
7 years ago
});
7 years ago
},
7 years ago
_init: function () {
7 years ago
TmpChildChildModel.superclass._init.apply(this, arguments);
}
7 years ago
});
7 years ago
Demo.Func = BI.inherit(BI.Widget, {
render: function () {
var view = BI.View.createView("/tmp", {}, {
element: this
});
view.populate();
},
mounted: function () {
}
});
BI.shortcut("demo.tmp", Demo.Func);