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

增加VUE-Element组件 修复elcheckbox选择问题

上级 79139241
......@@ -622,7 +622,7 @@ if (window.Promise && !Promise.any){
if (_loadedCss[key]) uuid = _loadedCss[key]["class"];
if (op.dom) _parseDom(op.dom, function(node){ if (node.className.indexOf(uuid) == -1) node.className += ((node.className) ? " "+uuid : uuid);}, op.doc);
debugger;
var completed = function(){
if (_loadCssRunning[key]){
_loadCssRunning[key] = false;
......@@ -770,9 +770,10 @@ if (window.Promise && !Promise.any){
};
var _loadCssText = function(cssText, options, callback){
debugger;
var op = (_typeOf(options)==="object") ? _getCssOptions(options) : _getCssOptions(null);
var cb = (_typeOf(options)==="function") ? options : callback;
var uuid = op.uuid || "css"+_uuid();
var uuid = options.uuid || "css"+_uuid();
if (cssText){
if (op.dom) _parseDom(op.dom, function(node){ if (node.className.indexOf(uuid) == -1) node.className += ((node.className) ? " "+uuid : uuid);}, op.doc);
......
......@@ -565,10 +565,12 @@ o2.widget.Combox.Input = new Class({
}.bind(this),
"blur": function(e){
//if (!this.noBlur){
if ((this.combox.editItem == this.bind) || (!this.combox.editItem)){
this.bind.commitInput();
if (this.combox){
if ((this.combox.editItem == this.bind) || (!this.combox.editItem)){
this.bind.commitInput();
}
this.hideOptionList();
}
this.hideOptionList();
e.stopPropagation();
//}
}.bind(this)
......
......@@ -94,10 +94,18 @@ MWF.xApplication.process.FormDesigner.Module.$ElElement = MWF.FC$ElElement = new
_createElementHtml: function(){
return "";
},
_filterHtml: function(html){
debugger;
// var reg = /(?:@|v-model|\:)\S*(?:\=)\S*(?:\"|\')/g;
// return html.replace(reg, "");
return html;
},
_resetVueModuleDomNode: function(callback){
if (!this.vm){
if (!this.node.hasClass("o2_vue")) this.node.addClass("o2_vue");
this.node.set("html", this._createElementHtml());
var html = this._filterHtml(this._createElementHtml());
this.node.set("html", html);
this._loadVue(function(){
this._mountVueApp(callback);
}.bind(this));
......@@ -111,8 +119,15 @@ MWF.xApplication.process.FormDesigner.Module.$ElElement = MWF.FC$ElElement = new
_mountVueApp: function(callback){
//if (!this.vueApp)
this.vueApp = this._createVueExtend(callback);
this.vm = new Vue(this.vueApp);
this.vm.$mount(this.node);
try{
this.vm = new Vue(this.vueApp);
this.vm.$mount(this.node);
}catch(e){
this.node.store("module", this);
this._loadVueCss();
if (callback) callback();
}
},
_createVueData: function(){
var data = {};
......
......@@ -306,16 +306,23 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
if (!evdata){
evdata = this.setEnvironmentDataById({});
}
if (!evdata.hasOwnProperty(key)) evdata.add(key, v);
evdata[key] = v;
if (!evdata.hasOwnProperty(key)){
evdata.add(key, v);
}else{
evdata[key] = v;
}
}
},
setEnvironmentDataById: function(v){
//对id类似于 xx..0..xx 的字段进行拆分
var evdata = this.form.Macro.environment.data;
if(this.json.id.indexOf("..") < 1){
if (!evdata.hasOwnProperty(this.json.id)) evdata.add(this.json.id, v);
evdata[this.json.id] = v;
if (!evdata.hasOwnProperty(this.json.id)){
evdata.add(this.json.id, v);
}else{
evdata[this.json.id] = v;
}
}else{
var idList = this.json.id.split("..");
idList = idList.map( function(d){ return d.test(/^\d+$/) ? d.toInt() : d; });
......@@ -328,8 +335,11 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
if( !id && id !== 0 )return;
if( i === lastIndex ){
if (!evdata.hasOwnProperty(id)) evdata.add(id, v);
evdata[id] = v;
if (!evdata.hasOwnProperty(id)){
evdata.add(id, v);
}else{
evdata[id] = v;
}
}else{
var nexId = idList[i+1];
if(o2.typeOf(nexId) === "number"){ //下一个ID是数字
......@@ -413,16 +423,16 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
dataObj = {};
evdata = this.setBusinessDataById(dataObj);
}
if (!dataObj.hasOwnProperty(key)) evdata.add(key, v);
//if (!dataObj.hasOwnProperty(key)) evdata.add(key, v);
dataObj[key] = v;
}
},
getBusinessDataById: function(d){
var data = d || this.form.businessData.data;
var evdata = this.form.Macro.environment.data;
//var evdata = this.form.Macro.environment.data;
//对id类似于 xx..0..xx 的字段进行拆分
if(this.json.id.indexOf("..") < 1){
if (!data.hasOwnProperty(this.json.id)) evdata.add(this.json.id, data[this.json.id]||"");
//if (!data.hasOwnProperty(this.json.id)) evdata.add(this.json.id, data[this.json.id]||"");
return data[this.json.id];
}else{
var idList = this.json.id.split("..");
......@@ -436,11 +446,11 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
if( !id && id !== 0 )return null;
if( ["object","array"].contains(o2.typeOf(data)) ){
if( i === lastIndex ){
if (!data.hasOwnProperty(id)) evdata.add(id, data[id]||"");
//if (!data.hasOwnProperty(id)) evdata.add(id, data[id]||"");
return data[id];
}else{
if (!data.hasOwnProperty(id)) evdata.add(id, {});
evdata = evdata[id];
//if (!data.hasOwnProperty(id)) evdata.add(id, {});
//evdata = evdata[id];
data = data[id];
}
}else{
......@@ -451,10 +461,10 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
},
setBusinessDataById: function(v){
//对id类似于 xx..0..xx 的字段进行拆分
var evdata = this.form.Macro.environment.data;
//var evdata = this.form.Macro.environment.data;
var data = this.form.businessData.data;
if(this.json.id.indexOf("..") < 1){
if (!data.hasOwnProperty(this.json.id)) evdata.add(this.json.id, v);
//if (!data.hasOwnProperty(this.json.id)) evdata.add(this.json.id, v);
data[this.json.id] = v;
//this.form.businessData.data[this.json.id] = v;
}else{
......@@ -469,14 +479,14 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
if( !id && id !== 0 )return;
if( i === lastIndex ){
if (!data.hasOwnProperty(id)) evdata.add(id, v);
//if (!data.hasOwnProperty(id)) evdata.add(id, v);
data[id] = v;
}else{
var nexId = idList[i+1];
if(o2.typeOf(nexId) === "number"){ //下一个ID是数字
if( !data[id] && o2.typeOf(data[id]) !== "array" ){
data[id] = [];
evdata.add(id, []);
//evdata.add(id, []);
}
if( nexId > data[id].length ){ //超过了最大下标,丢弃
return;
......@@ -484,15 +494,15 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
}else{ //下一个ID是字符串
if( !data[id] || o2.typeOf(data[id]) !== "object"){
data[id] = {};
evdata.add(id, {});
//evdata.add(id, {});
}
}
data = data[id];
evdata = evdata[id];
//evdata = evdata[id];
}
}
}
return evdata;
//return evdata;
},
_queryLoaded: function(){},
......
......@@ -88,7 +88,10 @@ MWF.xApplication.process.Xform.Combox = MWF.APPCombox = new Class(
this.combox.addEvent("change", function(){
this.validationMode();
if (this.validation()) this._setEnvironmentData(this.getInputData("change"));
if (this.validation()){
var v = this.getInputData("change");
this._setEnvironmentData(v);
}
}.bind(this));
},
......@@ -267,7 +270,7 @@ MWF.xApplication.process.Xform.Combox = MWF.APPCombox = new Class(
//return this.node.get("text");
},
resetData: function(){
this.setData(this.getValue());
this._setBusinessData(this.getValue());
}
});
......@@ -165,7 +165,32 @@ MWF.xApplication.process.Xform.Elcheckbox = MWF.APPElcheckbox = new Class(
return html;
},
_setValue: function(value, m){
var mothed = m || "__setValue";
if (!!value){
var p = o2.promiseAll(value).then(function(v){
//if (o2.typeOf(v)=="array") v = v[0];
if (this.moduleSelectAG){
this.moduleValueAG = this.moduleSelectAG;
this.moduleSelectAG.then(function(){
this[mothed](v);
return v;
}.bind(this), function(){});
}else{
this[mothed](v)
}
return v;
}.bind(this), function(){});
this.moduleValueAG = p;
if (this.moduleValueAG) this.moduleValueAG.then(function(){
this.moduleValueAG = null;
}.bind(this), function(){
this.moduleValueAG = null;
}.bind(this));
}else{
this[mothed](value);
}
},
__setValue: function(value){
this._setBusinessData(value);
this.json[this.json.id] = (value) ? value : [];
......
......@@ -74,7 +74,7 @@ o2.xApplication.process.Xform.Elcommon = o2.APPElcommon = new Class(
case "object":
Object.keys(app.data).each(function(k){
this.form.Macro.environment.data.add(k, app.data[k]);
});
}.bind(this));
app.data = this.form.Macro.environment.data;
// app.data = this.json;
// app.data = Object.merge(this.json, this.form.Macro.environment.data);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册