|
@@ -139,15 +139,21 @@ var operationEdit={ |
|
@@ -139,15 +139,21 @@ var operationEdit={ |
139
|
}
|
139
|
}
|
140
|
},
|
140
|
},
|
141
|
promotionId:null,
|
141
|
promotionId:null,
|
|
|
142
|
+ promotionType:null,
|
|
|
143
|
+ actionParam:null,
|
142
|
edit:null,
|
144
|
edit:null,
|
143
|
actionUrl:"/promotionInfo/setOperation",
|
145
|
actionUrl:"/promotionInfo/setOperation",
|
144
|
load:function(config){
|
146
|
load:function(config){
|
145
|
var _e= new edit("#tab_body",{});
|
147
|
var _e= new edit("#tab_body",{});
|
146
|
this.edit=_e;
|
148
|
this.edit=_e;
|
147
|
- if(config){
|
|
|
148
|
- this.promotionId=config.promotionId
|
149
|
+ if(config){
|
|
|
150
|
+ this.promotionType=config.promotionType;
|
|
|
151
|
+ this.actionParam=config.actionParam;
|
|
|
152
|
+ this.promotionId=config.promotionId;
|
149
|
}
|
153
|
}
|
|
|
154
|
+ $("#promotionType").val(this.promotionType);
|
150
|
_e.init();
|
155
|
_e.init();
|
|
|
156
|
+ selectOneOption(this.promotionType);
|
151
|
this.bindEvent();
|
157
|
this.bindEvent();
|
152
|
},
|
158
|
},
|
153
|
template:function(_htmlObj,_data){
|
159
|
template:function(_htmlObj,_data){
|
|
@@ -161,11 +167,20 @@ var operationEdit={ |
|
@@ -161,11 +167,20 @@ var operationEdit={ |
161
|
switch(_param.type){
|
167
|
switch(_param.type){
|
162
|
case "text":
|
168
|
case "text":
|
163
|
_input=$("<input type=\"text\" class=\"form-control\" />");
|
169
|
_input=$("<input type=\"text\" class=\"form-control\" />");
|
164
|
- _input.val(_param.default_value);
|
170
|
+ if(this.actionParam&&this.actionParam[_param.name]){
|
|
|
171
|
+ _input.val(this.actionParam[_param.name]);
|
|
|
172
|
+ }else{
|
|
|
173
|
+ _input.val(_param.default_value);
|
|
|
174
|
+ }
|
165
|
break;
|
175
|
break;
|
166
|
case "textarea":
|
176
|
case "textarea":
|
167
|
_input=$("<textarea style=\"width: 400px; height: 90px;\"></textarea>");
|
177
|
_input=$("<textarea style=\"width: 400px; height: 90px;\"></textarea>");
|
168
|
- _input.text(_param.default_value);
|
178
|
+ if(this.actionParam&&this.actionParam[_param.name]){
|
|
|
179
|
+ _input.text(this.actionParam[_param.name]);
|
|
|
180
|
+ }else{
|
|
|
181
|
+ _input.text(_param.default_value);
|
|
|
182
|
+ }
|
|
|
183
|
+
|
169
|
break;
|
184
|
break;
|
170
|
}
|
185
|
}
|
171
|
_input.attr("id",_param.name);
|
186
|
_input.attr("id",_param.name);
|
|
@@ -176,11 +191,10 @@ var operationEdit={ |
|
@@ -176,11 +191,10 @@ var operationEdit={ |
176
|
}
|
191
|
}
|
177
|
}
|
192
|
}
|
178
|
},
|
193
|
},
|
179
|
- selectOneOption:function(_sel){
|
194
|
+ selectOneOption:function(selectKey){
|
180
|
var firstGroup=$("#tab_body>.row").find(".form-group:eq(0)");
|
195
|
var firstGroup=$("#tab_body>.row").find(".form-group:eq(0)");
|
181
|
//移除兄弟节点
|
196
|
//移除兄弟节点
|
182
|
- firstGroup.nextAll().remove();
|
|
|
183
|
- var selectKey=$(_sel).children('option:selected').val();
|
197
|
+ firstGroup.nextAll().remove();
|
184
|
var _html;
|
198
|
var _html;
|
185
|
var _selectObj;
|
199
|
var _selectObj;
|
186
|
switch(selectKey){
|
200
|
switch(selectKey){
|
|
@@ -220,7 +234,10 @@ var operationEdit={ |
|
@@ -220,7 +234,10 @@ var operationEdit={ |
220
|
bindEvent:function(){
|
234
|
bindEvent:function(){
|
221
|
var _g=this;
|
235
|
var _g=this;
|
222
|
$(document).on('click','#save',function(){return this.save()});
|
236
|
$(document).on('click','#save',function(){return this.save()});
|
223
|
- $("#promotionType").change(function(){return _g.selectOneOption(this)});
|
237
|
+ $("#promotionType").change(function(){
|
|
|
238
|
+ var selectKey=$(this).children('option:selected').val();
|
|
|
239
|
+ return _g.selectOneOption(selectKey);
|
|
|
240
|
+ });
|
224
|
},
|
241
|
},
|
225
|
save:function(){
|
242
|
save:function(){
|
226
|
var e=this.edit;
|
243
|
var e=this.edit;
|