app/assets/javascripts/task-manager/extjs/app/view/plan/Form.js in task-manager-0.1.5 vs app/assets/javascripts/task-manager/extjs/app/view/plan/Form.js in task-manager-0.1.6

- old
+ new

@@ -29,20 +29,21 @@ name: 'name', allowBlank: false }, { xtype: 'assignee_treecombo', fieldLabel: '执行人', + allowBlank: false, name: 'assignables_attributes', store: Ext.getStore('TM.store.Assignees').toTreeStore() }, { - fieldLabel: '类型', + fieldLabel: '周期', name: 'plan_type', store: 'TM.store.Types', editable: false, valueField: 'value', xtype: 'combo', - blankText: '请选择类型!', + blankText: '请选择周期', allowBlank: false }, { fieldLabel: '横向指标', emptyText: '请用逗号分割指标项', name: 'data.x' @@ -75,17 +76,17 @@ valueField: 'id' }] }, { xtype: 'fieldset', itemId: 'deadline', - title: '截止时间', + title: '完成时限', layout: { type: 'table', columns: 2 }, defaults: { - labelAlign: 'right', + labelAlign: 'right' }, items: [{ fieldLabel: '月', name: 'data.deadline_month', xtype: 'combo', @@ -252,44 +253,52 @@ bindStore(Ext.getStore('TM.store.Months')); this.getDeadlineCombo('data.deadline_day'). bindStore(Ext.getStore('TM.store.Days')); this.showDeadlineCombos(["month", "day", "hour", "minute"]); + this.requireDeadlineCombos(["month", "day", "hour", "minute"]); }, // @private showQuarterlyDeadlineCombos: function() { this.getDeadlineCombo('data.deadline_month'). bindStore(Ext.getStore('TM.store.QuarterlyMonths')); this.getDeadlineCombo('data.deadline_day'). bindStore(Ext.getStore('TM.store.Days')); this.showDeadlineCombos(["month", "day", "hour", "minute"]); + this.requireDeadlineCombos(["month", "day", "hour", "minute"]); }, // @private showMonthlyDeadlineCombos: function() { this.getDeadlineCombo('data.deadline_day'). bindStore(Ext.getStore('TM.store.Days')); this.showDeadlineCombos(["day", "hour", "minute"]); this.hideDeadlineCombos(["month"]); + this.requireDeadlineCombos(["day", "hour", "minute"]); + this.allowBlankDeadlineCombos(["month"]); }, // @private showWeeklyDeadlineCombos: function() { this.getDeadlineCombo('data.deadline_day'). bindStore(Ext.getStore('TM.store.WeekDays')); this.showDeadlineCombos(["day", "hour", "minute"]); this.hideDeadlineCombos(["month"]); + this.requireDeadlineCombos(["day", "hour", "minute"]); + this.allowBlankDeadlineCombos(["month"]); }, // @private showDailyDeadlineCombos: function() { this.showDeadlineCombos(["hour", "minute"]); this.hideDeadlineCombos(["month", "day"]); + this.requireDeadlineCombos(["hour", "minute"]); + this.allowBlankDeadlineCombos(["month","day"]); }, // @private getDeadlineCombo: function(name) { return this.query('#deadline combo[name="' + name + '"]')[0]; @@ -304,9 +313,23 @@ // @private hideDeadlineCombos: function(combos) { combos.forEach(function(c) { this.getDeadlineCombo('data.deadline_' + c).hide(); + }, this); + }, + + // @private + requireDeadlineCombos: function(combos) { + combos.forEach(function(c) { + this.getDeadlineCombo('data.deadline_' + c).allowBlank = false; + }, this); + }, + + // @private + allowBlankDeadlineCombos: function(combos) { + combos.forEach(function(c) { + this.getDeadlineCombo('data.deadline_' + c).allowBlank = true; }, this); }, // @private getAssigneesTreeCombo: function() {