|
|
|
@ -2334,6 +2334,525 @@ BI.BranchRelation = BI.inherit(BI.Widget, {
|
|
|
|
|
}); |
|
|
|
|
BI.BranchRelation.EVENT_CHANGE = "BranchRelation.EVENT_CHANGE"; |
|
|
|
|
BI.shortcut("bi.branch_relation", BI.BranchRelation);/** |
|
|
|
|
* Created by dailer on 2017/7/19. |
|
|
|
|
* 日期时间练习 |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
BI.DateTimeCombo = BI.inherit(BI.Widget, { |
|
|
|
|
_defaultConfig: function () { |
|
|
|
|
return BI.extend(BI.TimeTuning.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
|
baseCls: "bi-fine-tuning-number-editor bi-border", |
|
|
|
|
selectedTime: { |
|
|
|
|
year: 2017, |
|
|
|
|
month: 0, |
|
|
|
|
day: 1, |
|
|
|
|
hour: 0, |
|
|
|
|
minute: 0, |
|
|
|
|
second: 0 |
|
|
|
|
}, |
|
|
|
|
height: 30 |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
|
BI.DateCombo.superclass._init.apply(this, arguments); |
|
|
|
|
var self = this, |
|
|
|
|
o = this.options; |
|
|
|
|
|
|
|
|
|
this.trigger = BI.createWidget({ |
|
|
|
|
type: "bi.date_trigger" |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.trigger.on(BI.DateTrigger.EVENT_TRIGGER_CLICK, function () { |
|
|
|
|
self.combo.toggle(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.popup = BI.createWidget({ |
|
|
|
|
type: "bi.date_time_popup" |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.popup.on(BI.DateCalendarPopup.EVENT_CHANGE, function () { |
|
|
|
|
self.setValue(self.popup.getValue()); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.combo = BI.createWidget({ |
|
|
|
|
type: "bi.combo", |
|
|
|
|
toggle: false, |
|
|
|
|
element: this, |
|
|
|
|
isNeedAdjustHeight: false, |
|
|
|
|
isNeedAdjustWidth: false, |
|
|
|
|
el: this.trigger, |
|
|
|
|
popup: { |
|
|
|
|
width: 270, |
|
|
|
|
el: this.popup, |
|
|
|
|
stopPropagation: false |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_reviseMinute: function () { |
|
|
|
|
this.m._finetuning(this.s.isNeedRevise); |
|
|
|
|
this._reviseHour(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_reviseHour: function () { |
|
|
|
|
this.h._finetuning(this.m.isNeedRevise); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getCurrentTime: function () { |
|
|
|
|
return { |
|
|
|
|
hour: this.h.getValue(), |
|
|
|
|
minute: this.m.getValue(), |
|
|
|
|
second: this.s.getValue() |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_format: function (p) { |
|
|
|
|
return p < 10 ? ('0' + p) : p |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getCurrentTimeStr: function () { |
|
|
|
|
return this._format(this.h.getValue()) + ':' + this._format(this.m.getValue()) + ':' + this._format(this.s.getValue()) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
setStep: function (step) { |
|
|
|
|
this.step = step || this.step; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
setValue: function (v) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
BI.DateTimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
|
BI.shortcut("bi.date_time_combo", BI.DateTimeCombo);/** |
|
|
|
|
* Created by GUY on 2015/9/7. |
|
|
|
|
* @class BI.DateCalendarPopup |
|
|
|
|
* @extends BI.Widget |
|
|
|
|
*/ |
|
|
|
|
BI.DateTimePopup = BI.inherit(BI.Widget, { |
|
|
|
|
_defaultConfig: function () { |
|
|
|
|
var conf = BI.DateTimePopup.superclass._defaultConfig.apply(this, arguments); |
|
|
|
|
return BI.extend(conf, { |
|
|
|
|
baseCls: "bi-date-calendar-popup", |
|
|
|
|
min: '1900-01-01', //最小日期
|
|
|
|
|
max: '2099-12-31', //最大日期
|
|
|
|
|
selectedTime: null |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_createNav: function (v) { |
|
|
|
|
var date = BI.Calendar.getDateJSONByPage(v); |
|
|
|
|
var calendar = BI.createWidget({ |
|
|
|
|
type: "bi.calendar", |
|
|
|
|
logic: { |
|
|
|
|
dynamic: true |
|
|
|
|
}, |
|
|
|
|
min: this.options.min, |
|
|
|
|
max: this.options.max, |
|
|
|
|
year: date.year, |
|
|
|
|
month: date.month, |
|
|
|
|
day: this.selectedTime.day |
|
|
|
|
}); |
|
|
|
|
return calendar |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
|
BI.DateTimePopup.superclass._init.apply(this, arguments); |
|
|
|
|
var self = this, |
|
|
|
|
o = this.options; |
|
|
|
|
this.today = new Date(); |
|
|
|
|
this._year = this.today.getFullYear(); |
|
|
|
|
this._month = this.today.getMonth(); |
|
|
|
|
this._day = this.today.getDate(); |
|
|
|
|
|
|
|
|
|
this.selectedTime = o.selectedTime || { |
|
|
|
|
year: this._year, |
|
|
|
|
month: this._month, |
|
|
|
|
day: this._day |
|
|
|
|
}; |
|
|
|
|
this.datePicker = BI.createWidget({ |
|
|
|
|
type: "bi.date_picker", |
|
|
|
|
min: o.min, |
|
|
|
|
max: o.max |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.calendar = BI.createWidget({ |
|
|
|
|
direction: "top", |
|
|
|
|
// element: this,
|
|
|
|
|
logic: { |
|
|
|
|
dynamic: true |
|
|
|
|
}, |
|
|
|
|
type: "bi.navigation", |
|
|
|
|
tab: this.datePicker, |
|
|
|
|
cardCreator: BI.bind(this._createNav, this), |
|
|
|
|
|
|
|
|
|
afterCardCreated: function () { |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
afterCardShow: function () { |
|
|
|
|
this.setValue(self.selectedTime); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.timeTunning = BI.createWidget({ |
|
|
|
|
type: "bi.time_tunning" |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.buttons = BI.createWidget({ |
|
|
|
|
type: "bi.button_group", |
|
|
|
|
items: [{ |
|
|
|
|
type: "bi.text_button", |
|
|
|
|
text: BI.i18nText('BI-Basic_Clears') |
|
|
|
|
}, { |
|
|
|
|
type: "bi.text_button", |
|
|
|
|
text: BI.i18nText("BI-Basic_Sure") |
|
|
|
|
}], |
|
|
|
|
chooseType: 0, |
|
|
|
|
behaviors: {}, |
|
|
|
|
layouts: [{ |
|
|
|
|
type: "bi.center_adapt" |
|
|
|
|
}] |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.dateTime = BI.createWidget({ |
|
|
|
|
type: "bi.vertical", |
|
|
|
|
element: this, |
|
|
|
|
items: [this.calendar, this.timeTunning, this.buttons] |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.datePicker.on(BI.DatePicker.EVENT_CHANGE, function () { |
|
|
|
|
self.selectedTime = self.datePicker.getValue(); |
|
|
|
|
self.selectedTime.day = 1; |
|
|
|
|
self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime)); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.calendar.on(BI.Navigation.EVENT_CHANGE, function () { |
|
|
|
|
self.selectedTime = self.calendar.getValue(); |
|
|
|
|
self.setValue(self.selectedTime); |
|
|
|
|
self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
setValue: function (timeOb) { |
|
|
|
|
this.datePicker.setValue(timeOb); |
|
|
|
|
this.calendar.setSelect(BI.Calendar.getPageByDateJSON(timeOb)); |
|
|
|
|
this.calendar.setValue(timeOb); |
|
|
|
|
this.selectedTime = timeOb; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getValue: function () { |
|
|
|
|
return this.selectedTime; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
BI.DateTimePopup.EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
|
BI.shortcut("bi.date_time_popup", BI.DateTimePopup);/** |
|
|
|
|
* Created by dailer on 2017/7/19. |
|
|
|
|
* 时间微调器练习 |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
BI.TimeTuning = BI.inherit(BI.Widget, { |
|
|
|
|
_defaultConfig: function () { |
|
|
|
|
return BI.extend(BI.TimeTuning.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
|
baseCls: "bi-fine-tuning-number-editor bi-border", |
|
|
|
|
disabled: false, |
|
|
|
|
currentTime: { |
|
|
|
|
hour: 0, |
|
|
|
|
minute: 0, |
|
|
|
|
second: 0 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
|
BI.TimeTuning.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.currentTime = BI.deepClone(o.currentTime); |
|
|
|
|
this.last = { |
|
|
|
|
lastH: o.currentTime.hour, |
|
|
|
|
lastM: o.currentTime.minute, |
|
|
|
|
lastS: o.currentTime.second |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//时
|
|
|
|
|
this.h = BI.createWidget({ |
|
|
|
|
type: "bi.test_editor", |
|
|
|
|
value: this.currentTime.hour, |
|
|
|
|
min: 0, |
|
|
|
|
max: 23, |
|
|
|
|
width: 60, |
|
|
|
|
height: 30 |
|
|
|
|
}); |
|
|
|
|
this.h.on(BI.FineTuningNumberEditor.EVENT_CONFIRM, function () {}); |
|
|
|
|
|
|
|
|
|
//分
|
|
|
|
|
this.m = BI.createWidget({ |
|
|
|
|
type: "bi.test_editor", |
|
|
|
|
value: this.currentTime.minute, |
|
|
|
|
min: 0, |
|
|
|
|
max: 59, |
|
|
|
|
width: 60, |
|
|
|
|
height: 30 |
|
|
|
|
}) |
|
|
|
|
this.m.on(BI.FineTuningNumberEditor.EVENT_CONFIRM, function () { |
|
|
|
|
self._reviseHour(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
//秒
|
|
|
|
|
this.s = BI.createWidget({ |
|
|
|
|
type: "bi.test_editor", |
|
|
|
|
value: this.currentTime.second, |
|
|
|
|
min: 0, |
|
|
|
|
max: 59, |
|
|
|
|
width: 60, |
|
|
|
|
height: 30 |
|
|
|
|
}) |
|
|
|
|
this.s.on(BI.FineTuningNumberEditor.EVENT_CONFIRM, function () { |
|
|
|
|
self._reviseMinute(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.editor = BI.createWidget({ |
|
|
|
|
type: "bi.horizontal", |
|
|
|
|
items: [{ |
|
|
|
|
type: "bi.label", |
|
|
|
|
text: "时间", |
|
|
|
|
width: 45, |
|
|
|
|
height: 30 |
|
|
|
|
}, |
|
|
|
|
this.h, |
|
|
|
|
{ |
|
|
|
|
type: "bi.text", |
|
|
|
|
text: ":", |
|
|
|
|
textAlign: "center", |
|
|
|
|
width: 15 |
|
|
|
|
}, |
|
|
|
|
this.m, |
|
|
|
|
{ |
|
|
|
|
type: "bi.text", |
|
|
|
|
text: ":", |
|
|
|
|
textAlign: "center", |
|
|
|
|
width: 15 |
|
|
|
|
}, |
|
|
|
|
this.s |
|
|
|
|
] |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
BI.createWidget({ |
|
|
|
|
type: "bi.htape", |
|
|
|
|
cls: "bi-border demo-clolor", |
|
|
|
|
element: this, |
|
|
|
|
items: [this.editor], |
|
|
|
|
width: 270, |
|
|
|
|
height: 50 |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_reviseMinute: function () { |
|
|
|
|
this.m._finetuning(this.s.isNeedRevise); |
|
|
|
|
this._reviseHour(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_reviseHour: function () { |
|
|
|
|
this.h._finetuning(this.m.isNeedRevise); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getCurrentTime: function () { |
|
|
|
|
return { |
|
|
|
|
hour: this.h.getValue(), |
|
|
|
|
minute: this.m.getValue(), |
|
|
|
|
second: this.s.getValue() |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_format: function (p) { |
|
|
|
|
return p < 10 ? ('0' + p) : p |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getCurrentTimeStr: function () { |
|
|
|
|
return this._format(this.h.getValue()) + ':' + this._format(this.m.getValue()) + ':' + this._format(this.s.getValue()) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
setStep: function (step) { |
|
|
|
|
this.step = step || this.step; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
setValue: function (v) { |
|
|
|
|
this.value = v; |
|
|
|
|
this.editor.setValue(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
BI.TimeTuning.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
|
BI.shortcut("bi.time_tunning", BI.TimeTuning);/** |
|
|
|
|
* Created by dailer on 2017/7/18. |
|
|
|
|
* 数值微调器练习 |
|
|
|
|
*/ |
|
|
|
|
BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { |
|
|
|
|
_defaultConfig: function () { |
|
|
|
|
return BI.extend(BI.FineTuningNumberEditor.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
|
baseCls: "bi-fine-tuning-number-editor bi-border", |
|
|
|
|
value: 0, |
|
|
|
|
disabled: false, |
|
|
|
|
min: 0, |
|
|
|
|
max: 100000, |
|
|
|
|
step: 1, |
|
|
|
|
formatter: BI.emptyFn, |
|
|
|
|
parser: BI.emptyFn |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
|
BI.FineTuningNumberEditor.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.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({ |
|
|
|
|
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)); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_isNeedRevise: function () { |
|
|
|
|
// console.log(this.editor.getValue() - this.value);
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getMinAndMax: function () { |
|
|
|
|
return { |
|
|
|
|
min: this.min, |
|
|
|
|
max: this.max |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getStep: function () { |
|
|
|
|
return this.step; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getValue: function () { |
|
|
|
|
return this.value; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
setStep: function (step) { |
|
|
|
|
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);/** |
|
|
|
|
* 日期控件中的月份下拉框 |
|
|
|
|
* |
|
|
|
|
* Created by GUY on 2015/9/7. |
|
|
|
@ -2613,12 +3132,13 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, {
|
|
|
|
|
month: date.month, |
|
|
|
|
day: this.selectedTime.day |
|
|
|
|
}); |
|
|
|
|
return calendar; |
|
|
|
|
return calendar |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
|
BI.DateCalendarPopup.superclass._init.apply(this, arguments); |
|
|
|
|
var self = this, o = this.options; |
|
|
|
|
var self = this, |
|
|
|
|
o = this.options; |
|
|
|
|
this.today = new Date(); |
|
|
|
|
this._year = this.today.getFullYear(); |
|
|
|
|
this._month = this.today.getMonth(); |
|
|
|
@ -2764,7 +3284,8 @@ BI.DateCombo = BI.inherit(BI.Widget, {
|
|
|
|
|
}, |
|
|
|
|
_init: function () { |
|
|
|
|
BI.DateCombo.superclass._init.apply(this, arguments); |
|
|
|
|
var self = this, o = this.options; |
|
|
|
|
var self = this, |
|
|
|
|
o = this.options; |
|
|
|
|
|
|
|
|
|
this.trigger = BI.createWidget({ |
|
|
|
|
type: "bi.date_trigger" |
|
|
|
@ -14523,117 +15044,6 @@ BI.SwitchTree.SelectType = {
|
|
|
|
|
}; |
|
|
|
|
BI.shortcut('bi.switch_tree', BI.SwitchTree); |
|
|
|
|
/** |
|
|
|
|
* Created by dailer on 2017/7/18. |
|
|
|
|
* 数值微调器练习 |
|
|
|
|
*/ |
|
|
|
|
BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { |
|
|
|
|
_defaultConfig: function () { |
|
|
|
|
return BI.extend(BI.FineTuningNumberEditor.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
|
baseCls: "bi-fine-tuning-number-editor bi-border", |
|
|
|
|
value: 0, |
|
|
|
|
disabled: false, |
|
|
|
|
min: 0, |
|
|
|
|
max: 100, |
|
|
|
|
step: 1, |
|
|
|
|
formatter: BI.emptyFn, |
|
|
|
|
parser: BI.emptyFn |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
|
BI.FineTuningNumberEditor.superclass._init.apply(this, arguments); |
|
|
|
|
var self = this, |
|
|
|
|
o = this.options; |
|
|
|
|
this.formatter = o.formatter; |
|
|
|
|
this.step = this.options.step; |
|
|
|
|
console.log(this.options.value); |
|
|
|
|
this.editor = BI.createWidget({ |
|
|
|
|
type: "bi.sign_editor", |
|
|
|
|
value: o.value, |
|
|
|
|
errorText: BI.i18nText("BI-Please_Input_Natural_Number"), |
|
|
|
|
// validationChecker: function (v) {
|
|
|
|
|
// // return BI.isNaturalNumber(v);
|
|
|
|
|
// }
|
|
|
|
|
}); |
|
|
|
|
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { |
|
|
|
|
self._finetuning(1); |
|
|
|
|
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", |
|
|
|
|
handler: function () { |
|
|
|
|
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", |
|
|
|
|
handler: function () { |
|
|
|
|
self._finetuning(-1); |
|
|
|
|
self.fireEvent(BI.FineTuningNumberEditor.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; |
|
|
|
|
console.log(this.options.formatter.toString()); |
|
|
|
|
this.editor.setValue(this.formatter(result)); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getMinAndMax: function () {}, |
|
|
|
|
|
|
|
|
|
getStep: function () {}, |
|
|
|
|
|
|
|
|
|
getValue: function () {}, |
|
|
|
|
|
|
|
|
|
setStep: function (step) { |
|
|
|
|
this.step = step || this.step; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
setValue: function (v) {} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
BI.FineTuningNumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
|
BI.shortcut("bi.test_editor", BI.FineTuningNumberEditor);/** |
|
|
|
|
* 年份下拉框 |
|
|
|
|
* |
|
|
|
|
* Created by GUY on 2015/8/28. |
|
|
|
|