Skip to content

Instantly share code, notes, and snippets.

@vikingmute
Last active August 29, 2015 14:02
Show Gist options
  • Save vikingmute/b61f93f3d9eab59f38d9 to your computer and use it in GitHub Desktop.
Save vikingmute/b61f93f3d9eab59f38d9 to your computer and use it in GitHub Desktop.
temai-biz template - model (由于是表单类型 所以没有绑定datasrouce)
/**
* @file 计划新建或编辑的Model
* @author zhangxuan06
*/
define(function (require) {
var Model = require('er/Model');
var util = require('er/util');
var url = require('biz/url');
/**
* 新建计划Model的构造函数
*
* @constructor
* @extends Model
*/
function PlanFormModel() {
Model.apply(this, arguments);
}
util.inherits(PlanFormModel, Model);
/**
* Model生成后数据分析和准备
*
* @public
*/
PlanFormModel.prototype.prepare = function () {
var model = this;
// to be continued
};
/**
* 新建计划的ajax方法
*
* @public
* @param {object} 新建计划传入的object
* @param {function} 新建计划完成后的回调函数
*/
PlanFormModel.prototype.getUpdateRequest = function (args, callback) {
callback = callback || function () {};
var model = this;
var planId = model.get('planId');
var data = {
planName: args.planName
};
var opUrl = url.POST_PLAN_CREATE;
if (planId) {
data.planId = planId;
content = '修改成功';
opUrl = url.POST_PLAN_EDIT;
}
require('common/ejson').post(opUrl, data, 'json').then(callback);
};
return PlanFormModel;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment