Permalink
Browse files

fix: pro-IUAPDESIGN-69:营销物业管理:u-meta定义方式需要支持指定数据行

  • Loading branch information...
1 parent 3850d78 commit 994e949ce1123600da4b4bb719bb0b9565eb71b7 liuyk committed Oct 18, 2016
Showing with 31 additions and 7 deletions.
  1. +30 −6 js/core/valueMixin.js
  2. +1 −1 package.json
View
@@ -8,10 +8,24 @@
var ValueMixin = {
init: function(){
var self = this;
- this.dataModel.ref(this.field).subscribe(function(value) {
- self.modelValueChange(value)
- });
- this.modelValueChange(this.dataModel.getValue(this.field));
+
+ // 如果存在行对象则处理数据都针对此行进行处理
+ if(this.options.rowIndex > -1){
+ var obj = {
+ index : this.options.rowIndex,
+ fieldName : this.field
+ }
+ var rowObj = this.dataModel.getRow(this.options.rowIndex);
+ if(rowObj){
+ this.modelValueChange(rowObj.getValue(this.field));
+ }
+ }else{
+ this.dataModel.ref(this.field).subscribe(function(value) {
+ self.modelValueChange(value)
+ });
+ this.modelValueChange(this.dataModel.getValue(this.field));
+ }
+
},
methods:{
@@ -50,7 +64,13 @@ var ValueMixin = {
this.showValue = this.masker ? this.masker.format(this.trueValue).value : this.trueValue;
this.setShowValue(this.showValue);
this.slice = true;
- this.dataModel.setValue(this.field, this.trueValue);
+ if(this.options.rowIndex > -1){
+ var rowObj = this.dataModel.getRow(this.options.rowIndex);
+ if(rowObj)
+ rowObj.setValue(this.field, this.trueValue);
+ }else{
+ this.dataModel.setValue(this.field, this.trueValue);
+ }
this.slice = false;
},
/**
@@ -70,7 +90,11 @@ var ValueMixin = {
},
setModelValue: function (value) {
if (!this.dataModel) return
- this.dataModel.setValue(this.field, value)
+ if(this.rowObj){
+ this.rowObj.setValue(this.field, value)
+ }else{
+ this.dataModel.setValue(this.field, value)
+ }
},
}
}
View
@@ -11,7 +11,7 @@
"dist": "webpack --progress --colors --mode=dev && webpack --colors --progress --mode=build && node version --mode=dev && node version --mode=build",
"test": "mocha --compilers js:babel-core/register --colors -w ./test/*.spec.js",
"product": "npm run build && npm run dev && gulp dist",
- "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && node changeSort.js"
+ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && node changeSort.js && node getAllChange.js"
},
"dependencies": {
"kero": "^3.5.1",

0 comments on commit 994e949

Please sign in to comment.