|
|
@ -2360,7 +2360,7 @@ BI.DateTimeCombo = BI.inherit(BI.Widget, { |
|
|
|
o = this.options; |
|
|
|
o = this.options; |
|
|
|
|
|
|
|
|
|
|
|
this.trigger = BI.createWidget({ |
|
|
|
this.trigger = BI.createWidget({ |
|
|
|
type: "bi.date_trigger" |
|
|
|
type: "bi.date_time_trigger1" |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.trigger.on(BI.DateTrigger.EVENT_TRIGGER_CLICK, function () { |
|
|
|
this.trigger.on(BI.DateTrigger.EVENT_TRIGGER_CLICK, function () { |
|
|
@ -2371,13 +2371,21 @@ BI.DateTimeCombo = BI.inherit(BI.Widget, { |
|
|
|
type: "bi.date_time_popup" |
|
|
|
type: "bi.date_time_popup" |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.popup.on(BI.DateCalendarPopup.EVENT_CHANGE, function () { |
|
|
|
this.popup.on(BI.DateTimePopup.EVENT_CHANGE, function () { |
|
|
|
self.setValue(self.popup.getValue()); |
|
|
|
//self.setValue(self.popup.getValue());
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.popup.on(BI.DateTimePopup.EVENT_CLICK_CONFIRM, function () { |
|
|
|
|
|
|
|
//do something here
|
|
|
|
|
|
|
|
self.setValue(); |
|
|
|
|
|
|
|
self.combo.hideView(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.popup.on(BI.DateTimePopup.EVENT_CLICK_CANCEL, function () { |
|
|
|
|
|
|
|
self.combo.hideView(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.combo = BI.createWidget({ |
|
|
|
this.combo = BI.createWidget({ |
|
|
|
type: "bi.combo", |
|
|
|
type: "bi.combo", |
|
|
|
toggle: false, |
|
|
|
toggle: true, |
|
|
|
element: this, |
|
|
|
element: this, |
|
|
|
isNeedAdjustHeight: false, |
|
|
|
isNeedAdjustHeight: false, |
|
|
|
isNeedAdjustWidth: false, |
|
|
|
isNeedAdjustWidth: false, |
|
|
@ -2391,29 +2399,156 @@ BI.DateTimeCombo = BI.inherit(BI.Widget, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_reviseMinute: function () { |
|
|
|
getValue: function () { |
|
|
|
this.m._finetuning(this.s.isNeedRevise); |
|
|
|
return this.popup.getValue(); |
|
|
|
this._reviseHour(); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_reviseHour: function () { |
|
|
|
setStep: function (step) { |
|
|
|
this.h._finetuning(this.m.isNeedRevise); |
|
|
|
this.step = step || this.step; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getCurrentTime: function () { |
|
|
|
setValue: function (v) { |
|
|
|
|
|
|
|
this.trigger.setValue(this.popup.getValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
BI.DateTimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
|
|
|
|
BI.shortcut("bi.date_time_combo", BI.DateTimeCombo);/** |
|
|
|
|
|
|
|
* Created by dailer on 2017/7/18. |
|
|
|
|
|
|
|
* 数值微调器练习 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
BI.NumberSpinner = BI.inherit(BI.Widget, { |
|
|
|
|
|
|
|
_defaultConfig: function () { |
|
|
|
|
|
|
|
return BI.extend(BI.NumberSpinner.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
|
|
|
|
baseCls: "bi-fine-tuning-number-editor bi-border", |
|
|
|
|
|
|
|
value: 0, |
|
|
|
|
|
|
|
min: 0, |
|
|
|
|
|
|
|
max: 100000, |
|
|
|
|
|
|
|
step: 1, |
|
|
|
|
|
|
|
formatter: BI.emptyFn, |
|
|
|
|
|
|
|
parser: BI.emptyFn |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
|
|
|
|
BI.NumberSpinner.superclass._init.apply(this, arguments); |
|
|
|
|
|
|
|
var self = this, |
|
|
|
|
|
|
|
o = this.options; |
|
|
|
|
|
|
|
if (o.formatter == BI.emptyFn) { |
|
|
|
|
|
|
|
this.formatter = function (v) { |
|
|
|
|
|
|
|
return v; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.formatter = o.formatter; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.parser = o.parser; |
|
|
|
|
|
|
|
this.step = o.step; |
|
|
|
|
|
|
|
this.min = o.min; |
|
|
|
|
|
|
|
this.max = o.max; |
|
|
|
|
|
|
|
this.value = o.value; |
|
|
|
|
|
|
|
this.isNeedRevise = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.editor = BI.createWidget({ |
|
|
|
|
|
|
|
type: "bi.sign_editor", |
|
|
|
|
|
|
|
value: o.value, |
|
|
|
|
|
|
|
errorText: BI.i18nText("BI-Please_Input_Natural_Number") |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { |
|
|
|
|
|
|
|
self.setValue(self.editor.getValue()); |
|
|
|
|
|
|
|
self.fireEvent(BI.NumberSpinner.EVENT_CONFIRM); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.topBtn = BI.createWidget({ |
|
|
|
|
|
|
|
type: "bi.icon_button", |
|
|
|
|
|
|
|
trigger: "lclick,", |
|
|
|
|
|
|
|
cls: "column-pre-page-h-font top-button bi-border-left bi-border-bottom", |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self._finetuning(1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.fireEvent(BI.NumberSpinner.EVENT_CONFIRM); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.bottomBtn = BI.createWidget({ |
|
|
|
|
|
|
|
type: "bi.icon_button", |
|
|
|
|
|
|
|
trigger: "lclick,", |
|
|
|
|
|
|
|
cls: "column-next-page-h-font bottom-button bi-border-left bi-border-top" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
|
|
|
|
self._finetuning(-1); |
|
|
|
|
|
|
|
self.fireEvent(BI.NumberSpinner.EVENT_CONFIRM); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this._finetuning(0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BI.createWidget({ |
|
|
|
|
|
|
|
type: "bi.htape", |
|
|
|
|
|
|
|
element: this, |
|
|
|
|
|
|
|
items: [this.editor, { |
|
|
|
|
|
|
|
el: { |
|
|
|
|
|
|
|
type: "bi.grid", |
|
|
|
|
|
|
|
columns: 1, |
|
|
|
|
|
|
|
rows: 2, |
|
|
|
|
|
|
|
items: [{ |
|
|
|
|
|
|
|
column: 0, |
|
|
|
|
|
|
|
row: 0, |
|
|
|
|
|
|
|
el: this.topBtn |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
column: 0, |
|
|
|
|
|
|
|
row: 1, |
|
|
|
|
|
|
|
el: this.bottomBtn |
|
|
|
|
|
|
|
}] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
width: 30 |
|
|
|
|
|
|
|
}] |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//微调
|
|
|
|
|
|
|
|
_finetuning: function (add) { |
|
|
|
|
|
|
|
//窝是在不值该如何处理精度损失问题,所以迫不得已采取了这个方法
|
|
|
|
|
|
|
|
var v = BI.parseFloat(this.editor.getValue()) * 1000000000000; |
|
|
|
|
|
|
|
var addend = add * this.step * 1000000000000; |
|
|
|
|
|
|
|
var result = (v + addend) / 1000000000000; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result > this.max) { |
|
|
|
|
|
|
|
this.editor.setValue(this.formatter(this.min)); |
|
|
|
|
|
|
|
this.isNeedRevise = 1; |
|
|
|
|
|
|
|
this.value = this.min; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (result < this.min) { |
|
|
|
|
|
|
|
this.editor.setValue(this.formatter(this.max)); |
|
|
|
|
|
|
|
this.isNeedRevise = -1; |
|
|
|
|
|
|
|
this.value = this.max; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.value = result; |
|
|
|
|
|
|
|
this.isNeedRevise = 0; |
|
|
|
|
|
|
|
this.editor.setValue(this.formatter(result)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getIsNeedRevise: function () { |
|
|
|
|
|
|
|
return this.isNeedRevise; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getMinAndMax: function () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
hour: this.h.getValue(), |
|
|
|
min: this.min, |
|
|
|
minute: this.m.getValue(), |
|
|
|
max: this.max |
|
|
|
second: this.s.getValue() |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_format: function (p) { |
|
|
|
getStep: function () { |
|
|
|
return p < 10 ? ('0' + p) : p |
|
|
|
return this.step; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getCurrentTimeStr: function () { |
|
|
|
getValue: function () { |
|
|
|
return this._format(this.h.getValue()) + ':' + this._format(this.m.getValue()) + ':' + this._format(this.s.getValue()) |
|
|
|
return this.value; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setStep: function (step) { |
|
|
|
setStep: function (step) { |
|
|
@ -2421,12 +2556,13 @@ BI.DateTimeCombo = BI.inherit(BI.Widget, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setValue: function (v) { |
|
|
|
setValue: function (v) { |
|
|
|
|
|
|
|
this.value = v; |
|
|
|
|
|
|
|
this.editor.setValue(this.formatter(v)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.DateTimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
BI.NumberSpinner.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
BI.shortcut("bi.date_time_combo", BI.DateTimeCombo);/** |
|
|
|
BI.shortcut("bi.test_editor", BI.NumberSpinner);/** |
|
|
|
* Created by GUY on 2015/9/7. |
|
|
|
* Created by GUY on 2015/9/7. |
|
|
|
* @class BI.DateCalendarPopup |
|
|
|
* @class BI.DateCalendarPopup |
|
|
|
* @extends BI.Widget |
|
|
|
* @extends BI.Widget |
|
|
@ -2435,7 +2571,7 @@ BI.DateTimePopup = BI.inherit(BI.Widget, { |
|
|
|
_defaultConfig: function () { |
|
|
|
_defaultConfig: function () { |
|
|
|
var conf = BI.DateTimePopup.superclass._defaultConfig.apply(this, arguments); |
|
|
|
var conf = BI.DateTimePopup.superclass._defaultConfig.apply(this, arguments); |
|
|
|
return BI.extend(conf, { |
|
|
|
return BI.extend(conf, { |
|
|
|
baseCls: "bi-date-calendar-popup", |
|
|
|
baseCls: "bi-date-calendar-popup demo-clolor", |
|
|
|
min: '1900-01-01', //最小日期
|
|
|
|
min: '1900-01-01', //最小日期
|
|
|
|
max: '2099-12-31', //最大日期
|
|
|
|
max: '2099-12-31', //最大日期
|
|
|
|
selectedTime: null |
|
|
|
selectedTime: null |
|
|
@ -2466,16 +2602,23 @@ BI.DateTimePopup = BI.inherit(BI.Widget, { |
|
|
|
this._year = this.today.getFullYear(); |
|
|
|
this._year = this.today.getFullYear(); |
|
|
|
this._month = this.today.getMonth(); |
|
|
|
this._month = this.today.getMonth(); |
|
|
|
this._day = this.today.getDate(); |
|
|
|
this._day = this.today.getDate(); |
|
|
|
|
|
|
|
this._hour = this.today.getHours(); |
|
|
|
|
|
|
|
this._minute = this.today.getMinutes(); |
|
|
|
|
|
|
|
this._second = this.today.getSeconds(); |
|
|
|
|
|
|
|
|
|
|
|
this.selectedTime = o.selectedTime || { |
|
|
|
this.selectedTime = o.selectedTime || { |
|
|
|
year: this._year, |
|
|
|
year: this._year, |
|
|
|
month: this._month, |
|
|
|
month: this._month, |
|
|
|
day: this._day |
|
|
|
day: this._day, |
|
|
|
|
|
|
|
hour: this._hour, |
|
|
|
|
|
|
|
minute: this._minute, |
|
|
|
|
|
|
|
second: this._second |
|
|
|
}; |
|
|
|
}; |
|
|
|
this.datePicker = BI.createWidget({ |
|
|
|
this.datePicker = BI.createWidget({ |
|
|
|
type: "bi.date_picker", |
|
|
|
type: "bi.date_picker", |
|
|
|
min: o.min, |
|
|
|
min: o.min, |
|
|
|
max: o.max |
|
|
|
max: o.max, |
|
|
|
|
|
|
|
cls: "demo-clolor", |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.calendar = BI.createWidget({ |
|
|
|
this.calendar = BI.createWidget({ |
|
|
@ -2494,21 +2637,42 @@ BI.DateTimePopup = BI.inherit(BI.Widget, { |
|
|
|
|
|
|
|
|
|
|
|
afterCardShow: function () { |
|
|
|
afterCardShow: function () { |
|
|
|
this.setValue(self.selectedTime); |
|
|
|
this.setValue(self.selectedTime); |
|
|
|
|
|
|
|
self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime)); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.timeTunning = BI.createWidget({ |
|
|
|
this.timeTunning = BI.createWidget({ |
|
|
|
type: "bi.time_tunning" |
|
|
|
type: "bi.time_tunning", |
|
|
|
|
|
|
|
currentTime: { |
|
|
|
|
|
|
|
hour: this._hour, |
|
|
|
|
|
|
|
minute: this._minute, |
|
|
|
|
|
|
|
second: this._second |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.timeTunning.on(BI.TimeTuning.EVENT_CHANGE, function () { |
|
|
|
|
|
|
|
self.selectedTime = self.timeTunning.getValue(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.buttons = BI.createWidget({ |
|
|
|
this.buttons = BI.createWidget({ |
|
|
|
type: "bi.button_group", |
|
|
|
type: "bi.button_group", |
|
|
|
items: [{ |
|
|
|
items: [{ |
|
|
|
type: "bi.text_button", |
|
|
|
type: "bi.button", |
|
|
|
text: BI.i18nText('BI-Basic_Clears') |
|
|
|
textHeight: 30, |
|
|
|
|
|
|
|
clear: true, |
|
|
|
|
|
|
|
text: "取消", |
|
|
|
|
|
|
|
handler: function () { |
|
|
|
|
|
|
|
self.fireEvent(BI.DateTimePopup.EVENT_CLICK_CANCEL); |
|
|
|
|
|
|
|
} |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
type: "bi.text_button", |
|
|
|
text: "|" |
|
|
|
text: BI.i18nText("BI-Basic_Sure") |
|
|
|
}, { |
|
|
|
|
|
|
|
type: "bi.button", |
|
|
|
|
|
|
|
textHeight: 30, |
|
|
|
|
|
|
|
clear: true, |
|
|
|
|
|
|
|
text: BI.i18nText("BI-Basic_Sure"), |
|
|
|
|
|
|
|
handler: function () { |
|
|
|
|
|
|
|
self.fireEvent(BI.DateTimePopup.EVENT_CLICK_CONFIRM); |
|
|
|
|
|
|
|
} |
|
|
|
}], |
|
|
|
}], |
|
|
|
chooseType: 0, |
|
|
|
chooseType: 0, |
|
|
|
behaviors: {}, |
|
|
|
behaviors: {}, |
|
|
@ -2531,23 +2695,28 @@ BI.DateTimePopup = BI.inherit(BI.Widget, { |
|
|
|
|
|
|
|
|
|
|
|
this.calendar.on(BI.Navigation.EVENT_CHANGE, function () { |
|
|
|
this.calendar.on(BI.Navigation.EVENT_CHANGE, function () { |
|
|
|
self.selectedTime = self.calendar.getValue(); |
|
|
|
self.selectedTime = self.calendar.getValue(); |
|
|
|
self.setValue(self.selectedTime); |
|
|
|
self.fireEvent(BI.DateTimePopup.EVENT_CHANGE); |
|
|
|
self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime)); |
|
|
|
|
|
|
|
this.calendar.setValue(this.selectedTime); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setValue: function (timeOb) { |
|
|
|
setValue: function (timeOb) { |
|
|
|
this.datePicker.setValue(timeOb); |
|
|
|
this.datePicker.setValue(timeOb); |
|
|
|
this.calendar.setSelect(BI.Calendar.getPageByDateJSON(timeOb)); |
|
|
|
this.calendar.setSelect(BI.Calendar.getPageByDateJSON(timeOb)); |
|
|
|
this.calendar.setValue(timeOb); |
|
|
|
this.calendar.setValue(timeOb); |
|
|
|
|
|
|
|
this.timeTunning.setValue(timeOb); |
|
|
|
this.selectedTime = timeOb; |
|
|
|
this.selectedTime = timeOb; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getValue: function () { |
|
|
|
getValue: function () { |
|
|
|
return this.selectedTime; |
|
|
|
return $.extend({}, this.calendar.getValue(), this.timeTunning.getValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.DateTimePopup.EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
BI.DateTimePopup.EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
|
|
|
|
BI.DateTimePopup.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; |
|
|
|
|
|
|
|
BI.DateTimePopup.EVENT_CLICK_CANCEL = "EVENT_CLICK_CANCEL"; |
|
|
|
BI.shortcut("bi.date_time_popup", BI.DateTimePopup);/** |
|
|
|
BI.shortcut("bi.date_time_popup", BI.DateTimePopup);/** |
|
|
|
* Created by dailer on 2017/7/19. |
|
|
|
* Created by dailer on 2017/7/19. |
|
|
|
* 时间微调器练习 |
|
|
|
* 时间微调器练习 |
|
|
@ -2599,7 +2768,9 @@ BI.TimeTuning = BI.inherit(BI.Widget, { |
|
|
|
width: 60, |
|
|
|
width: 60, |
|
|
|
height: 30 |
|
|
|
height: 30 |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.h.on(BI.FineTuningNumberEditor.EVENT_CONFIRM, function () {}); |
|
|
|
this.h.on(BI.FineTuningNumberEditor.EVENT_CONFIRM, function () { |
|
|
|
|
|
|
|
self.fireEvent(BI.TimeTuning.EVENT_CHANGE); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//分
|
|
|
|
//分
|
|
|
|
this.m = BI.createWidget({ |
|
|
|
this.m = BI.createWidget({ |
|
|
@ -2612,6 +2783,7 @@ BI.TimeTuning = BI.inherit(BI.Widget, { |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.m.on(BI.FineTuningNumberEditor.EVENT_CONFIRM, function () { |
|
|
|
this.m.on(BI.FineTuningNumberEditor.EVENT_CONFIRM, function () { |
|
|
|
self._reviseHour(); |
|
|
|
self._reviseHour(); |
|
|
|
|
|
|
|
self.fireEvent(BI.TimeTuning.EVENT_CHANGE); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//秒
|
|
|
|
//秒
|
|
|
@ -2625,6 +2797,7 @@ BI.TimeTuning = BI.inherit(BI.Widget, { |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.s.on(BI.FineTuningNumberEditor.EVENT_CONFIRM, function () { |
|
|
|
this.s.on(BI.FineTuningNumberEditor.EVENT_CONFIRM, function () { |
|
|
|
self._reviseMinute(); |
|
|
|
self._reviseMinute(); |
|
|
|
|
|
|
|
self.fireEvent(BI.TimeTuning.EVENT_CHANGE); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2657,7 +2830,7 @@ BI.TimeTuning = BI.inherit(BI.Widget, { |
|
|
|
|
|
|
|
|
|
|
|
BI.createWidget({ |
|
|
|
BI.createWidget({ |
|
|
|
type: "bi.htape", |
|
|
|
type: "bi.htape", |
|
|
|
cls: "bi-border demo-clolor", |
|
|
|
cls: "demo-clolor", |
|
|
|
element: this, |
|
|
|
element: this, |
|
|
|
items: [this.editor], |
|
|
|
items: [this.editor], |
|
|
|
width: 270, |
|
|
|
width: 270, |
|
|
@ -2666,12 +2839,12 @@ BI.TimeTuning = BI.inherit(BI.Widget, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_reviseMinute: function () { |
|
|
|
_reviseMinute: function () { |
|
|
|
this.m._finetuning(this.s.isNeedRevise); |
|
|
|
this.m._finetuning(this.s.getIsNeedRevise()); |
|
|
|
this._reviseHour(); |
|
|
|
this._reviseHour(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_reviseHour: function () { |
|
|
|
_reviseHour: function () { |
|
|
|
this.h._finetuning(this.m.isNeedRevise); |
|
|
|
this.h._finetuning(this.m.getIsNeedRevise()); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getCurrentTime: function () { |
|
|
|
getCurrentTime: function () { |
|
|
@ -2690,169 +2863,97 @@ BI.TimeTuning = BI.inherit(BI.Widget, { |
|
|
|
return this._format(this.h.getValue()) + ':' + this._format(this.m.getValue()) + ':' + this._format(this.s.getValue()) |
|
|
|
return this._format(this.h.getValue()) + ':' + this._format(this.m.getValue()) + ':' + this._format(this.s.getValue()) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getValue: function () { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
hour: this.h.getValue(), |
|
|
|
|
|
|
|
minute: this.m.getValue(), |
|
|
|
|
|
|
|
second: this.s.getValue() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setStep: function (step) { |
|
|
|
setStep: function (step) { |
|
|
|
this.step = step || this.step; |
|
|
|
this.step = step || this.step; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setValue: function (v) { |
|
|
|
setValue: function (timeObj) { |
|
|
|
this.value = v; |
|
|
|
this.h.setValue(timeObj.hour); |
|
|
|
this.editor.setValue(); |
|
|
|
this.m.setValue(timeObj.minute); |
|
|
|
|
|
|
|
this.s.setValue(timeObj.second); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.TimeTuning.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
BI.TimeTuning.EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
BI.shortcut("bi.time_tunning", BI.TimeTuning);/** |
|
|
|
BI.shortcut("bi.time_tunning", BI.TimeTuning);BI.DateTimeTrigger = BI.inherit(BI.Trigger, { |
|
|
|
* Created by dailer on 2017/7/18. |
|
|
|
|
|
|
|
* 数值微调器练习 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { |
|
|
|
|
|
|
|
_defaultConfig: function () { |
|
|
|
_defaultConfig: function () { |
|
|
|
return BI.extend(BI.FineTuningNumberEditor.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
return BI.extend(BI.DateTimeTrigger.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
baseCls: "bi-fine-tuning-number-editor bi-border", |
|
|
|
extraCls: "bi-date-trigger", |
|
|
|
value: 0, |
|
|
|
min: '1900-01-01', //最小日期
|
|
|
|
disabled: false, |
|
|
|
max: '2099-12-31', //最大日期
|
|
|
|
min: 0, |
|
|
|
height: 32 |
|
|
|
max: 100000, |
|
|
|
}); |
|
|
|
step: 1, |
|
|
|
|
|
|
|
formatter: BI.emptyFn, |
|
|
|
|
|
|
|
parser: BI.emptyFn |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
_init: function () { |
|
|
|
BI.FineTuningNumberEditor.superclass._init.apply(this, arguments); |
|
|
|
BI.DateTimeTrigger.superclass._init.apply(this, arguments); |
|
|
|
var self = this, |
|
|
|
var self = this, |
|
|
|
o = this.options; |
|
|
|
o = this.options; |
|
|
|
if (o.formatter == BI.emptyFn) { |
|
|
|
this.label = BI.createWidget({ |
|
|
|
this.formatter = function (v) { |
|
|
|
type: "bi.label", |
|
|
|
return v; |
|
|
|
textAlign: "left", |
|
|
|
} |
|
|
|
text: "", |
|
|
|
} else { |
|
|
|
height: o.height |
|
|
|
this.formatter = o.formatter; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.parser = o.parser; |
|
|
|
|
|
|
|
this.step = o.step; |
|
|
|
|
|
|
|
this.min = o.min; |
|
|
|
|
|
|
|
this.max = o.max; |
|
|
|
|
|
|
|
this.value = o.value; |
|
|
|
|
|
|
|
this.isNeedRevise = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.editor = BI.createWidget({ |
|
|
|
|
|
|
|
type: "bi.sign_editor", |
|
|
|
|
|
|
|
value: o.value, |
|
|
|
|
|
|
|
errorText: BI.i18nText("BI-Please_Input_Natural_Number") |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { |
|
|
|
|
|
|
|
self.setValue(self.editor.getValue()); |
|
|
|
|
|
|
|
self.fireEvent(BI.FineTuningNumberEditor.EVENT_CONFIRM); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.topBtn = BI.createWidget({ |
|
|
|
|
|
|
|
type: "bi.icon_button", |
|
|
|
|
|
|
|
trigger: "lclick,", |
|
|
|
|
|
|
|
cls: "column-pre-page-h-font top-button bi-border-left bi-border-bottom", |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
|
|
|
|
self._isNeedRevise(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self._finetuning(1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.fireEvent(BI.FineTuningNumberEditor.EVENT_CONFIRM); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.bottomBtn = BI.createWidget({ |
|
|
|
|
|
|
|
type: "bi.icon_button", |
|
|
|
|
|
|
|
trigger: "lclick,", |
|
|
|
|
|
|
|
cls: "column-next-page-h-font bottom-button bi-border-left bi-border-top" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
|
|
|
|
self._finetuning(-1); |
|
|
|
|
|
|
|
self.fireEvent(BI.FineTuningNumberEditor.EVENT_CONFIRM); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this._finetuning(0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BI.createWidget({ |
|
|
|
BI.createWidget({ |
|
|
|
type: "bi.htape", |
|
|
|
type: "bi.htape", |
|
|
|
element: this, |
|
|
|
element: this, |
|
|
|
items: [this.editor, { |
|
|
|
|
|
|
|
el: { |
|
|
|
|
|
|
|
type: "bi.grid", |
|
|
|
|
|
|
|
columns: 1, |
|
|
|
|
|
|
|
rows: 2, |
|
|
|
|
|
|
|
items: [{ |
|
|
|
items: [{ |
|
|
|
column: 0, |
|
|
|
el: BI.createWidget({ |
|
|
|
row: 0, |
|
|
|
type: "bi.icon_button", |
|
|
|
el: this.topBtn |
|
|
|
cls: "search-font" |
|
|
|
}, { |
|
|
|
}), |
|
|
|
column: 0, |
|
|
|
|
|
|
|
row: 1, |
|
|
|
|
|
|
|
el: this.bottomBtn |
|
|
|
|
|
|
|
}] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
width: 30 |
|
|
|
width: 30 |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
el: this.label |
|
|
|
}] |
|
|
|
}] |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//微调
|
|
|
|
|
|
|
|
_finetuning: function (add) { |
|
|
|
|
|
|
|
//窝是在不值该如何处理精度损失问题,所以迫不得已采取了这个方法
|
|
|
|
|
|
|
|
var v = BI.parseFloat(this.editor.getValue()) * 1000000000000; |
|
|
|
|
|
|
|
var addend = add * this.step * 1000000000000; |
|
|
|
|
|
|
|
var result = (v + addend) / 1000000000000; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result > this.max) { |
|
|
|
|
|
|
|
this.editor.setValue(this.formatter(this.min)); |
|
|
|
|
|
|
|
this.isNeedRevise = 1; |
|
|
|
|
|
|
|
this.value = this.min; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (result < this.min) { |
|
|
|
|
|
|
|
this.editor.setValue(this.formatter(this.max)); |
|
|
|
|
|
|
|
this.isNeedRevise = -1; |
|
|
|
|
|
|
|
this.value = this.max; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.value = result; |
|
|
|
|
|
|
|
this.isNeedRevise = 0; |
|
|
|
|
|
|
|
this.editor.setValue(this.formatter(result)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var today = new Date(), |
|
|
|
|
|
|
|
timeObj = { |
|
|
|
|
|
|
|
year: today.getFullYear(), |
|
|
|
|
|
|
|
month: today.getMonth(), |
|
|
|
|
|
|
|
day: today.getDate(), |
|
|
|
|
|
|
|
hour: today.getHours(), |
|
|
|
|
|
|
|
minute: today.getMinutes(), |
|
|
|
|
|
|
|
second: today.getSeconds() |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
this.setValue(timeObj); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_isNeedRevise: function () { |
|
|
|
|
|
|
|
// console.log(this.editor.getValue() - this.value);
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getMinAndMax: function () { |
|
|
|
|
|
|
|
return { |
|
|
|
_parseTimeObjToStr: function (timeObj) { |
|
|
|
min: this.min, |
|
|
|
var _format = function (p) { |
|
|
|
max: this.max |
|
|
|
return p < 10 ? ('0' + p) : p |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
BI.each(timeObj, function (key, val) { |
|
|
|
|
|
|
|
timeObj[key] = _format(timeObj[key]); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return timeObj.year + "-" + (1 + BI.parseInt(timeObj.month)) + "-" + timeObj.day + " " + timeObj.hour + ":" + timeObj.minute + ":" + timeObj.second; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getStep: function () { |
|
|
|
setValue: function (v) { |
|
|
|
return this.step; |
|
|
|
this.label.setValue(this._parseTimeObjToStr(v)); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getValue: function () { |
|
|
|
|
|
|
|
return this.value; |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setStep: function (step) { |
|
|
|
getValue: function () { |
|
|
|
this.step = step || this.step; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setValue: function (v) { |
|
|
|
|
|
|
|
this.value = v; |
|
|
|
|
|
|
|
this.editor.setValue(this.formatter(v)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.FineTuningNumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
|
|
|
|
BI.shortcut("bi.test_editor", BI.FineTuningNumberEditor);/** |
|
|
|
BI.shortcut("bi.date_time_trigger1", BI.DateTimeTrigger);/** |
|
|
|
* 日期控件中的月份下拉框 |
|
|
|
* 日期控件中的月份下拉框 |
|
|
|
* |
|
|
|
* |
|
|
|
* Created by GUY on 2015/9/7. |
|
|
|
* Created by GUY on 2015/9/7. |
|
|
|