|
@@ -0,0 +1,32 @@
|
|
|
+import _ from 'lodash'
|
|
|
+import {baseConfig} from "../base";
|
|
|
+import {date} from "../../Defaults";
|
|
|
+
|
|
|
+export default function () {
|
|
|
+
|
|
|
+ const cc = Ext.form.field.Date.prototype.constructor
|
|
|
+ const {initComponent, getValue} = Ext.form.field.Date.prototype
|
|
|
+ Ext.form.field.Date.override({
|
|
|
+ constructor(config) {
|
|
|
+ const newConfig = _.defaultsDeep({
|
|
|
+ // 强制属性
|
|
|
+ format: 'Y-m-d',
|
|
|
+ altFormats: 'Y-m-d',
|
|
|
+
|
|
|
+ }, baseConfig(config, 'col-item'), config, date)
|
|
|
+
|
|
|
+ cc.call(this, newConfig)
|
|
|
+ },
|
|
|
+
|
|
|
+ getValue() {
|
|
|
+ const ov = getValue.call(this)
|
|
|
+ const nv = Ext.util.Format.date(ov, 'Y-m-d')
|
|
|
+ // console.log('cc:', nv, ov)
|
|
|
+ return nv
|
|
|
+ },
|
|
|
+
|
|
|
+ initComponent() {
|
|
|
+ initComponent.call(this)
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|