提交 4c3aa92a 编写于 作者: NoSubject's avatar NoSubject

ElementUI组件,在数据模板中的数据存取

上级 4fb5cd1f
......@@ -19,16 +19,6 @@
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_number,
"className": "Elnumber"
},
"elicon": {
"fontIcon": "el-icon-picture-outline-round",
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_icon,
"className": "Elicon"
},
"elbutton": {
"fontIcon": "el-icon-thumb",
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_button,
"className": "Elbutton"
},
"elradio": {
"fontIcon": "el-icon-success",
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_radio,
......@@ -59,6 +49,16 @@
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_slider,
"className": "Elslider"
},
"elbutton": {
"fontIcon": "el-icon-thumb",
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_button,
"className": "Elbutton"
},
"elicon": {
"fontIcon": "el-icon-picture-outline-round",
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_icon,
"className": "Elicon"
},
"elcommon": {
"fontIcon": "el-icon-full-screen",
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_common,
......
......@@ -19,16 +19,6 @@
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_number,
"className": "Elnumber"
},
"elicon": {
"fontIcon": "el-icon-picture-outline-round",
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_icon,
"className": "Elicon"
},
"elbutton": {
"fontIcon": "el-icon-thumb",
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_button,
"className": "Elbutton"
},
"elradio": {
"fontIcon": "el-icon-success",
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_radio,
......@@ -59,6 +49,16 @@
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_slider,
"className": "Elslider"
},
"elbutton": {
"fontIcon": "el-icon-thumb",
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_button,
"className": "Elbutton"
},
"elicon": {
"fontIcon": "el-icon-picture-outline-round",
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_icon,
"className": "Elicon"
},
"elcommon": {
"fontIcon": "el-icon-full-screen",
"text": MWF.xApplication.process.FormDesigner.LP.modules.el_common,
......
......@@ -47,6 +47,17 @@ o2.xApplication.process.Xform.$ElModule = MWF.APP$ElModule = new Class(
this._loadUserInterface();
}
},
_checkVmodel: function(){
var nodes = this.node.querySelectorAll("*[v-model]");
this.vModels = [];
nodes.forEach(function(node){
var model = node.get("v-model");
if (model){
this.form.Macro.environment.data.check(model);
this.vModels.push(model);
}
}.bind(this));
},
_loadUserInterface: function(){
this.node.appendHTML(this._createElementHtml(), "before");
......@@ -95,8 +106,19 @@ o2.xApplication.process.Xform.$ElModule = MWF.APP$ElModule = new Class(
};
app.methods = this._createVueMethods(app);
this.appendVueExtend(app);
this.appendVueWatch(app);
return app;
},
appendVueWatch: function(app){
if (this.vModels && this.vModels.length){
app.watch = {};
this.vModels.forEach(function(m){
app.watch[m] = function(val, oldVal){
}.bind(this);
}.bind(this));
}
},
appendVueMethods: function(methods){},
appendVueExtend: function(app){
if (!app.methods) app.methods = {};
......@@ -112,7 +134,7 @@ o2.xApplication.process.Xform.$ElModule = MWF.APP$ElModule = new Class(
_createEventFunction: function(methods, k){
methods["$loadElEvent_"+k.camelCase()] = function(){
this.validationMode();
//if (k==="change") this._setBusinessData(this.getInputData());
if (k==="change") this._setBusinessData(this.getInputData());
if (this.json.events && this.json.events[k] && this.json.events[k].code){
this.form.Macro.fire(this.json.events[k].code, this, arguments);
}
......@@ -128,6 +150,11 @@ o2.xApplication.process.Xform.$ElModule = MWF.APP$ElModule = new Class(
return methods || {};
},
_createVueData: function(){
if (this.vModels && this.vModels.length){
this.vModels.forEach(function(m){
if (!this.json.hasOwnProperty(m)) this.json[m] = "";
}.bind(this));
}
if (this.json.vueData && this.json.vueData.code){
var d = this.form.Macro.exec(this.json.vueData.code, this);
this.json = Object.merge(d, this.json);
......
......@@ -21,9 +21,9 @@ MWF.xApplication.process.Xform.Elinput = MWF.APPElinput = new Class(
"elEvents": ["focus", "blur", "change", "input", "clear"]
},
_appendVueData: function(){
this.form.Macro.environment.data.check(this.json.id);
this.form.Macro.environment.data.check(this.json.$id);
//if (!this.json[this.json.id]){
this.json[this.json.id] = this._getBusinessData();
this.json[this.json.$id] = this._getBusinessData();
//}
if (!this.json.maxlength) this.json.maxlength = "";
......@@ -52,8 +52,10 @@ MWF.xApplication.process.Xform.Elinput = MWF.APPElinput = new Class(
// }.bind(this);
// },
_createElementHtml: function(){
debugger;
this.json["$id"] = this.json.id.replace(/\.\./g, "_");
var html = "<el-input";
html += " v-model=\""+this.json.id+"\"";
html += " v-model=\""+this.json.$id+"\"";
html += " :maxlength=\"maxlength\"";
html += " :minlength=\"minlength\"";
html += " :show-word-limit=\"showWordLimit\"";
......@@ -98,5 +100,26 @@ MWF.xApplication.process.Xform.Elinput = MWF.APPElinput = new Class(
html += "</el-input>";
return html;
}
},
__setValue: function(value){
this.moduleValueAG = null;
this._setBusinessData(value);
this.json[this.json.$id] = value;
if (this.readonly || this.json.isReadonly) this.node.set("text", value);
this.fieldModuleLoaded = true;
return value;
},
__setData: function(data){
var old = this.getInputData();
this._setBusinessData(data);
this.json[this.json.$id] = data;
if (this.readonly || this.json.isReadonly) this.node.set("text", value);
if (old!==data) this.fireEvent("change");
this.moduleValueAG = null;
this.validationMode();
},
getInputData: function(){
debugger;
return this.json[this.json.$id];
},
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册