You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.9 KiB
57 lines
1.9 KiB
import { shortcut, Widget, print } from "@/core"; |
|
import { Msg } from "@/base"; |
|
import { DateTimeCombo } from "@/widget"; |
|
|
|
@shortcut() |
|
export class CustomDateTime extends Widget { |
|
static xtype = "demo.date_time"; |
|
|
|
props = {}; |
|
|
|
render() { |
|
const self = this; |
|
|
|
return { |
|
type: "bi.absolute", |
|
items: [ |
|
{ |
|
el: { |
|
type: "bi.date_time_combo", |
|
listeners: [ |
|
{ |
|
eventName: DateTimeCombo.EVENT_CONFIRM, |
|
action() { |
|
const value = this.getValue(); |
|
const date = new Date( |
|
value.year, |
|
value.month - 1, |
|
value.day, |
|
value.hour, |
|
value.minute, |
|
value.second |
|
); |
|
const dateStr = print(date, "%Y-%X-%d %H:%M:%S"); |
|
Msg.alert("日期", dateStr); |
|
}, |
|
}, |
|
{ |
|
eventName: DateTimeCombo.EVENT_CANCEL, |
|
action() {}, |
|
} |
|
], |
|
value: { |
|
year: 2017, |
|
month: 2, |
|
day: 23, |
|
hour: 12, |
|
minute: 11, |
|
second: 1, |
|
}, |
|
}, |
|
top: 200, |
|
left: 200, |
|
} |
|
], |
|
}; |
|
} |
|
}
|
|
|