|
|
|
@ -30,6 +30,7 @@ export class DynamicDatePane extends Widget {
|
|
|
|
|
minDate: "1900-01-01", |
|
|
|
|
maxDate: "2099-12-31", |
|
|
|
|
supportDynamic: true, |
|
|
|
|
isShow: false, // 是否是预览状态
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
@ -195,7 +196,7 @@ export class DynamicDatePane extends Widget {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
created() { |
|
|
|
|
this.setValue(this.options.value); |
|
|
|
|
this.setValue(this.options.value, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_checkValueValid(value) { |
|
|
|
@ -226,15 +227,29 @@ export class DynamicDatePane extends Widget {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setValue(v) { |
|
|
|
|
setValue(v, isCreated = false) { |
|
|
|
|
v = v || {}; |
|
|
|
|
const type = v.type || DynamicDateCombo.Static; |
|
|
|
|
const value = v.value || v; |
|
|
|
|
this.switcher.setValue(type); |
|
|
|
|
this.dateTab.setSelect(type); |
|
|
|
|
|
|
|
|
|
const { isShow } = this.options; |
|
|
|
|
let date; |
|
|
|
|
|
|
|
|
|
// 如果是初始化且是预览状态 直接打开静态页面
|
|
|
|
|
this.switcher.setValue(isShow && isCreated ? DynamicDateCombo.Static : type); |
|
|
|
|
this.dateTab.setSelect(isShow && isCreated ? DynamicDateCombo.Static : type); |
|
|
|
|
switch (type) { |
|
|
|
|
case DynamicDateCombo.Dynamic: |
|
|
|
|
if (isShow && isCreated) { |
|
|
|
|
date = DynamicDateHelper.getCalculation(value); |
|
|
|
|
this.ymd.setValue({ |
|
|
|
|
year: date.getFullYear(), |
|
|
|
|
month: date.getMonth() + 1, |
|
|
|
|
day: date.getDate(), |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.dynamicPane.setValue(value); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case DynamicDateCombo.Static: |
|
|
|
|
default: |
|
|
|
|