Browse Source

REPORT-73071 fix: 加个变量记录datetime组件提交前是否触发过error

master
Austin.Duan 2 years ago
parent
commit
e6d27bba6a
  1. 8
      src/widget/dynamicdatetime/dynamicdatetime.combo.js

8
src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -32,6 +32,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
var date = BI.getDate(); var date = BI.getDate();
this.storeValue = opts.value; this.storeValue = opts.value;
var border = opts.simple ? 1 : 2; var border = opts.simple ? 1 : 2;
var errorState = false;
return { return {
type: "bi.absolute", type: "bi.absolute",
@ -120,6 +121,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
} }
}; };
self.combo.element.addClass("error"); self.combo.element.addClass("error");
errorState = true;
self.fireEvent(BI.DynamicDateTimeCombo.EVENT_ERROR); self.fireEvent(BI.DynamicDateTimeCombo.EVENT_ERROR);
} }
}, { }, {
@ -138,10 +140,11 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
action: function () { action: function () {
var dateStore = self.storeTriggerValue; var dateStore = self.storeTriggerValue;
var dateObj = self.trigger.getKey(); var dateObj = self.trigger.getKey();
if (self.combo.isViewVisible() || BI.isEqual(dateObj, dateStore)) { if (self.combo.isViewVisible() || BI.isEqual(dateObj, dateStore) && !errorState) {
return; return;
} }
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) { if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)
|| BI.isEqual(dateObj, dateStore) && errorState) {
self.storeValue = self.trigger.getValue(); self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue()); self.setValue(self.trigger.getValue());
} else if (BI.isEmptyString(dateObj)) { } else if (BI.isEmptyString(dateObj)) {
@ -150,6 +153,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
} }
self._checkDynamicValue(self.storeValue); self._checkDynamicValue(self.storeValue);
self.fireEvent(BI.DynamicDateTimeCombo.EVENT_CONFIRM); self.fireEvent(BI.DynamicDateTimeCombo.EVENT_CONFIRM);
errorState = false;
} }
}] }]
}] }]

Loading…
Cancel
Save