cloud-web-corejs 1.0.54-dev.810 → 1.0.54-dev.811
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/VabUpload/image-viewer.vue +442 -442
- package/src/components/VabUpload/index.vue +44 -2
- package/src/components/VabUpload/mixins.js +126 -19
- package/src/components/VabUpload/view.vue +247 -209
- package/src/components/baseTabs/mixins.js +181 -181
- package/src/components/mobile/wf/content.vue +1665 -1556
- package/src/components/table/config.js +78 -78
- package/src/components/table/index.js +1276 -1276
- package/src/components/table/tableForm.vue +330 -330
- package/src/components/table/tableFormMixin.js +318 -318
- package/src/components/table/vxeFilter/index.js +163 -163
- package/src/components/table/vxeFilter/mixin.js +316 -316
- package/src/components/wf/content.vue +1188 -1188
- package/src/components/wf/wf.js +29 -12
- package/src/components/wf/wfActionDropdown.vue +1 -1
- package/src/components/wf/wfActionItems.js +1 -1
- package/src/components/xform/docs/2026-08 xform H5 P0 /345/256/236/347/216/260/350/247/204/346/240/274.md" +528 -0
- package/src/components/xform/docs/2026-08 xform H5 P1 /345/256/236/347/216/260/350/247/204/346/240/274.md" +412 -0
- package/src/components/xform/docs/2026-08 xform H5 P2 /345/256/236/347/216/260/350/247/204/346/240/274.md" +287 -0
- package/src/components/xform/docs/2026-08 xform /347/247/273/345/212/250/347/253/257/345/270/203/345/261/200/345/257/271/351/275/220 bill_setting /346/226/271/346/241/210.md" +400 -0
- package/src/components/xform/form-designer/designer.js +15 -0
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +269 -269
- package/src/components/xform/form-designer/form-widget/container-widget/detail-temp-widget.vue +132 -0
- package/src/components/xform/form-designer/form-widget/container-widget/detail-widget.vue +250 -250
- package/src/components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue +319 -320
- package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +365 -365
- package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +554 -555
- package/src/components/xform/form-designer/form-widget/dialog/vabSearchDialog.vue +409 -409
- package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +150 -132
- package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +114 -114
- package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +154 -154
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +29 -1
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js +178 -178
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/time-limit-mixin.js +77 -77
- package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +139 -139
- package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +106 -106
- package/src/components/xform/form-designer/form-widget/field-widget/time-widget.vue +134 -134
- package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +1 -0
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +39 -39
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/exportItemColumns-dialog.vue +438 -438
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +2103 -2103
- package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-temp-edito.vue +90 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-grid/gutter-editor.vue +82 -82
- package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +8 -8
- package/src/components/xform/form-designer/setting-panel/property-editor/dropdownFlag-editor.vue +137 -137
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +237 -237
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +43 -43
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultValue-editor.vue +43 -43
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +96 -96
- package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-defaultValue-editor.vue +42 -42
- package/src/components/xform/form-designer/setting-panel/property-editor/field-time-range/time-range-defaultValue-editor.vue +43 -43
- package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +158 -158
- package/src/components/xform/form-designer/setting-panel/property-editor/h5Span-editor.vue +51 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/itemStyle-editor.vue +39 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/name-editor.vue +188 -188
- package/src/components/xform/form-designer/setting-panel/property-editor/styleTempClass-editor.vue +51 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +347 -347
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +4 -0
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +55 -3
- package/src/components/xform/form-render/container-item/data-table-mixin.js +33 -12
- package/src/components/xform/form-render/container-item/detail-h5-item.vue +183 -32
- package/src/components/xform/form-render/container-item/detail-temp-item.vue +110 -0
- package/src/components/xform/form-render/container-item/h5-card-pane-item.vue +160 -140
- package/src/components/xform/form-render/container-item/list-h5-item.vue +1642 -1700
- package/src/components/xform/form-render/index.vue +153 -147
- package/src/components/xform/form-render/indexMixin.js +12 -0
- package/src/components/xform/lang/en-US.js +10 -0
- package/src/components/xform/lang/zh-CN.js +12 -0
- package/src/components/xform/mixins/defaultHandle.js +707 -707
- package/src/components/xform/styles/h5.scss +1633 -0
- package/src/components/xform/utils/textMaskUtil.js +182 -182
- package/src/components/xform/utils/treeTableUtil.js +1292 -1265
- package/src/components/xform/utils/util.js +56 -11
- package/src/utils/pdfUtil.js +429 -429
- package/src/views/bd/setting/bd_company_env/dialog.vue +174 -174
- package/src/views/bd/setting/table_model/edit.vue +1066 -1066
- package/src/views/bd/setting/table_model/mixins/edit.js +1455 -1455
- package/src/views/bd/setting/table_model/mixins/zdDialog.js +148 -148
- package/src/views/user/home/wjl/content.vue +394 -31
- package/src/views/user/role/edit.vue +632 -632
- package/src/views/user/role/list.vue +260 -260
- package/src/views/user/wf/wf_manage/list.vue +1116 -1116
package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js
CHANGED
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
/* 日期组件的最小日期支持配置为「当前时间」,此处统一解析。
|
|
2
|
-
默认值(含「当前时间」与相对偏移)已收敛到 relative-default-mixin,不在此处理。 */
|
|
3
|
-
export const DATE_VALUE_TYPE_NOW = "now";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
methods: {
|
|
7
|
-
getDateLimitOptions() {
|
|
8
|
-
return this.field.options || {};
|
|
9
|
-
},
|
|
10
|
-
isNowDateValueType(valueType) {
|
|
11
|
-
return valueType === DATE_VALUE_TYPE_NOW;
|
|
12
|
-
},
|
|
13
|
-
/* 最小日期:固定日期或当前时间 */
|
|
14
|
-
getDateLimitMinValue() {
|
|
15
|
-
const options = this.getDateLimitOptions();
|
|
16
|
-
if (this.isNowDateValueType(options.minDateType)) {
|
|
17
|
-
return new Date();
|
|
18
|
-
}
|
|
19
|
-
return options.minDate;
|
|
20
|
-
},
|
|
21
|
-
initDateLimitPickerOptions() {
|
|
22
|
-
const pickerOptions = { ...(this.pickerOptions || {}) };
|
|
23
|
-
if (["year", "month", "date", "datetime"].includes(this.field.options.type)) {
|
|
24
|
-
if (!pickerOptions.shortcuts) {
|
|
25
|
-
pickerOptions.shortcuts = [
|
|
26
|
-
{
|
|
27
|
-
text: this.$t1("此刻"),
|
|
28
|
-
onClick(picker) {
|
|
29
|
-
picker.$emit("pick", new Date());
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
pickerOptions.disabledDate = (time) => this.isDateLimitDisabled(time);
|
|
36
|
-
this.pickerOptions = pickerOptions;
|
|
37
|
-
},
|
|
38
|
-
initDateLimitWatch() {
|
|
39
|
-
if (this.designState) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const { limitStartField, limitEndField } = this.getDateLimitOptions();
|
|
43
|
-
if (limitStartField) {
|
|
44
|
-
this.$watch(
|
|
45
|
-
() => this.getDateLimitLinkedValue(limitStartField),
|
|
46
|
-
() => {
|
|
47
|
-
this.initDateLimitPickerOptions();
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
if (limitEndField) {
|
|
52
|
-
this.$watch(
|
|
53
|
-
() => this.getDateLimitLinkedValue(limitEndField),
|
|
54
|
-
() => {
|
|
55
|
-
this.initDateLimitPickerOptions();
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
getDateLimitDataSource() {
|
|
61
|
-
return this.tableParam && this.tableParam.row
|
|
62
|
-
? this.tableParam.row
|
|
63
|
-
: this.formModel;
|
|
64
|
-
},
|
|
65
|
-
getDateLimitLinkedValue(fieldName) {
|
|
66
|
-
if (!fieldName) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
const dataSource = this.getDateLimitDataSource();
|
|
70
|
-
return dataSource ? dataSource[fieldName] : null;
|
|
71
|
-
},
|
|
72
|
-
parseDateLimitValue(val) {
|
|
73
|
-
if (val === null || val === undefined || val === "") {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
if (val instanceof Date) {
|
|
77
|
-
return isNaN(val.getTime()) ? null : val.getTime();
|
|
78
|
-
}
|
|
79
|
-
if (typeof val === "number") {
|
|
80
|
-
return isNaN(val) ? null : val;
|
|
81
|
-
}
|
|
82
|
-
const date = new Date(String(val).replace(/-/g, "/"));
|
|
83
|
-
return isNaN(date.getTime()) ? null : date.getTime();
|
|
84
|
-
},
|
|
85
|
-
normalizeDateLimitDayTime(time, isEnd) {
|
|
86
|
-
const date = new Date(time);
|
|
87
|
-
if (this.field.options.type === "datetime") {
|
|
88
|
-
return date.getTime();
|
|
89
|
-
}
|
|
90
|
-
date.setHours(isEnd ? 23 : 0, isEnd ? 59 : 0, isEnd ? 59 : 0, isEnd ? 999 : 0);
|
|
91
|
-
return date.getTime();
|
|
92
|
-
},
|
|
93
|
-
isDateLimitDisabled(time) {
|
|
94
|
-
const options = this.getDateLimitOptions();
|
|
95
|
-
const currentTime = time.getTime();
|
|
96
|
-
|
|
97
|
-
const minDate = this.parseDateLimitValue(this.getDateLimitMinValue());
|
|
98
|
-
if (minDate !== null && currentTime < this.normalizeDateLimitDayTime(minDate, false)) {
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const maxDate = this.parseDateLimitValue(options.maxDate);
|
|
103
|
-
if (maxDate !== null && currentTime > this.normalizeDateLimitDayTime(maxDate, true)) {
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (options.limitStartField) {
|
|
108
|
-
const startTime = this.parseDateLimitValue(
|
|
109
|
-
this.getDateLimitLinkedValue(options.limitStartField)
|
|
110
|
-
);
|
|
111
|
-
if (startTime !== null && currentTime < this.normalizeDateLimitDayTime(startTime, false)) {
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (options.limitEndField) {
|
|
117
|
-
const endTime = this.parseDateLimitValue(
|
|
118
|
-
this.getDateLimitLinkedValue(options.limitEndField)
|
|
119
|
-
);
|
|
120
|
-
if (endTime !== null && currentTime > this.normalizeDateLimitDayTime(endTime, true)) {
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return false;
|
|
126
|
-
},
|
|
127
|
-
isDateLimitViolated(value) {
|
|
128
|
-
if (value === null || value === undefined || value === "") {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
const currentTime = this.parseDateLimitValue(value);
|
|
132
|
-
if (currentTime === null) {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const options = this.getDateLimitOptions();
|
|
137
|
-
const minDate = this.parseDateLimitValue(this.getDateLimitMinValue());
|
|
138
|
-
if (minDate !== null && currentTime < this.normalizeDateLimitDayTime(minDate, false)) {
|
|
139
|
-
return true;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const maxDate = this.parseDateLimitValue(options.maxDate);
|
|
143
|
-
if (maxDate !== null && currentTime > this.normalizeDateLimitDayTime(maxDate, true)) {
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (options.limitStartField) {
|
|
148
|
-
const startTime = this.parseDateLimitValue(
|
|
149
|
-
this.getDateLimitLinkedValue(options.limitStartField)
|
|
150
|
-
);
|
|
151
|
-
if (startTime !== null && currentTime < this.normalizeDateLimitDayTime(startTime, false)) {
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (options.limitEndField) {
|
|
157
|
-
const endTime = this.parseDateLimitValue(
|
|
158
|
-
this.getDateLimitLinkedValue(options.limitEndField)
|
|
159
|
-
);
|
|
160
|
-
if (endTime !== null && currentTime > this.normalizeDateLimitDayTime(endTime, true)) {
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return false;
|
|
166
|
-
},
|
|
167
|
-
getDateLimitViolationMessage() {
|
|
168
|
-
const options = this.getDateLimitOptions();
|
|
169
|
-
if (options.limitEndField && !options.limitStartField) {
|
|
170
|
-
return "开始时间不能大于结束时间";
|
|
171
|
-
}
|
|
172
|
-
if (options.limitStartField && !options.limitEndField) {
|
|
173
|
-
return "结束时间不能小于开始时间";
|
|
174
|
-
}
|
|
175
|
-
return "日期超出允许范围";
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
};
|
|
1
|
+
/* 日期组件的最小日期支持配置为「当前时间」,此处统一解析。
|
|
2
|
+
默认值(含「当前时间」与相对偏移)已收敛到 relative-default-mixin,不在此处理。 */
|
|
3
|
+
export const DATE_VALUE_TYPE_NOW = "now";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
methods: {
|
|
7
|
+
getDateLimitOptions() {
|
|
8
|
+
return this.field.options || {};
|
|
9
|
+
},
|
|
10
|
+
isNowDateValueType(valueType) {
|
|
11
|
+
return valueType === DATE_VALUE_TYPE_NOW;
|
|
12
|
+
},
|
|
13
|
+
/* 最小日期:固定日期或当前时间 */
|
|
14
|
+
getDateLimitMinValue() {
|
|
15
|
+
const options = this.getDateLimitOptions();
|
|
16
|
+
if (this.isNowDateValueType(options.minDateType)) {
|
|
17
|
+
return new Date();
|
|
18
|
+
}
|
|
19
|
+
return options.minDate;
|
|
20
|
+
},
|
|
21
|
+
initDateLimitPickerOptions() {
|
|
22
|
+
const pickerOptions = { ...(this.pickerOptions || {}) };
|
|
23
|
+
if (["year", "month", "date", "datetime"].includes(this.field.options.type)) {
|
|
24
|
+
if (!pickerOptions.shortcuts) {
|
|
25
|
+
pickerOptions.shortcuts = [
|
|
26
|
+
{
|
|
27
|
+
text: this.$t1("此刻"),
|
|
28
|
+
onClick(picker) {
|
|
29
|
+
picker.$emit("pick", new Date());
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
pickerOptions.disabledDate = (time) => this.isDateLimitDisabled(time);
|
|
36
|
+
this.pickerOptions = pickerOptions;
|
|
37
|
+
},
|
|
38
|
+
initDateLimitWatch() {
|
|
39
|
+
if (this.designState) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const { limitStartField, limitEndField } = this.getDateLimitOptions();
|
|
43
|
+
if (limitStartField) {
|
|
44
|
+
this.$watch(
|
|
45
|
+
() => this.getDateLimitLinkedValue(limitStartField),
|
|
46
|
+
() => {
|
|
47
|
+
this.initDateLimitPickerOptions();
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
if (limitEndField) {
|
|
52
|
+
this.$watch(
|
|
53
|
+
() => this.getDateLimitLinkedValue(limitEndField),
|
|
54
|
+
() => {
|
|
55
|
+
this.initDateLimitPickerOptions();
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
getDateLimitDataSource() {
|
|
61
|
+
return this.tableParam && this.tableParam.row
|
|
62
|
+
? this.tableParam.row
|
|
63
|
+
: this.formModel;
|
|
64
|
+
},
|
|
65
|
+
getDateLimitLinkedValue(fieldName) {
|
|
66
|
+
if (!fieldName) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const dataSource = this.getDateLimitDataSource();
|
|
70
|
+
return dataSource ? dataSource[fieldName] : null;
|
|
71
|
+
},
|
|
72
|
+
parseDateLimitValue(val) {
|
|
73
|
+
if (val === null || val === undefined || val === "") {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
if (val instanceof Date) {
|
|
77
|
+
return isNaN(val.getTime()) ? null : val.getTime();
|
|
78
|
+
}
|
|
79
|
+
if (typeof val === "number") {
|
|
80
|
+
return isNaN(val) ? null : val;
|
|
81
|
+
}
|
|
82
|
+
const date = new Date(String(val).replace(/-/g, "/"));
|
|
83
|
+
return isNaN(date.getTime()) ? null : date.getTime();
|
|
84
|
+
},
|
|
85
|
+
normalizeDateLimitDayTime(time, isEnd) {
|
|
86
|
+
const date = new Date(time);
|
|
87
|
+
if (this.field.options.type === "datetime") {
|
|
88
|
+
return date.getTime();
|
|
89
|
+
}
|
|
90
|
+
date.setHours(isEnd ? 23 : 0, isEnd ? 59 : 0, isEnd ? 59 : 0, isEnd ? 999 : 0);
|
|
91
|
+
return date.getTime();
|
|
92
|
+
},
|
|
93
|
+
isDateLimitDisabled(time) {
|
|
94
|
+
const options = this.getDateLimitOptions();
|
|
95
|
+
const currentTime = time.getTime();
|
|
96
|
+
|
|
97
|
+
const minDate = this.parseDateLimitValue(this.getDateLimitMinValue());
|
|
98
|
+
if (minDate !== null && currentTime < this.normalizeDateLimitDayTime(minDate, false)) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const maxDate = this.parseDateLimitValue(options.maxDate);
|
|
103
|
+
if (maxDate !== null && currentTime > this.normalizeDateLimitDayTime(maxDate, true)) {
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (options.limitStartField) {
|
|
108
|
+
const startTime = this.parseDateLimitValue(
|
|
109
|
+
this.getDateLimitLinkedValue(options.limitStartField)
|
|
110
|
+
);
|
|
111
|
+
if (startTime !== null && currentTime < this.normalizeDateLimitDayTime(startTime, false)) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (options.limitEndField) {
|
|
117
|
+
const endTime = this.parseDateLimitValue(
|
|
118
|
+
this.getDateLimitLinkedValue(options.limitEndField)
|
|
119
|
+
);
|
|
120
|
+
if (endTime !== null && currentTime > this.normalizeDateLimitDayTime(endTime, true)) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return false;
|
|
126
|
+
},
|
|
127
|
+
isDateLimitViolated(value) {
|
|
128
|
+
if (value === null || value === undefined || value === "") {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
const currentTime = this.parseDateLimitValue(value);
|
|
132
|
+
if (currentTime === null) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const options = this.getDateLimitOptions();
|
|
137
|
+
const minDate = this.parseDateLimitValue(this.getDateLimitMinValue());
|
|
138
|
+
if (minDate !== null && currentTime < this.normalizeDateLimitDayTime(minDate, false)) {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const maxDate = this.parseDateLimitValue(options.maxDate);
|
|
143
|
+
if (maxDate !== null && currentTime > this.normalizeDateLimitDayTime(maxDate, true)) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (options.limitStartField) {
|
|
148
|
+
const startTime = this.parseDateLimitValue(
|
|
149
|
+
this.getDateLimitLinkedValue(options.limitStartField)
|
|
150
|
+
);
|
|
151
|
+
if (startTime !== null && currentTime < this.normalizeDateLimitDayTime(startTime, false)) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (options.limitEndField) {
|
|
157
|
+
const endTime = this.parseDateLimitValue(
|
|
158
|
+
this.getDateLimitLinkedValue(options.limitEndField)
|
|
159
|
+
);
|
|
160
|
+
if (endTime !== null && currentTime > this.normalizeDateLimitDayTime(endTime, true)) {
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return false;
|
|
166
|
+
},
|
|
167
|
+
getDateLimitViolationMessage() {
|
|
168
|
+
const options = this.getDateLimitOptions();
|
|
169
|
+
if (options.limitEndField && !options.limitStartField) {
|
|
170
|
+
return "开始时间不能大于结束时间";
|
|
171
|
+
}
|
|
172
|
+
if (options.limitStartField && !options.limitEndField) {
|
|
173
|
+
return "结束时间不能小于开始时间";
|
|
174
|
+
}
|
|
175
|
+
return "日期超出允许范围";
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
};
|
package/src/components/xform/form-designer/form-widget/field-widget/mixins/time-limit-mixin.js
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
/* 时间组件的最小时间支持配置为「当前时间」,此处统一解析。
|
|
2
|
-
默认值(含「当前时间」与相对偏移)已收敛到 relative-default-mixin,不在此处理。 */
|
|
3
|
-
export const TIME_VALUE_TYPE_NOW = "now";
|
|
4
|
-
|
|
5
|
-
const MAX_TIME_VALUE = "23:59:59";
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
methods: {
|
|
9
|
-
getTimeLimitOptions() {
|
|
10
|
-
return this.field.options || {};
|
|
11
|
-
},
|
|
12
|
-
isNowTimeValueType(valueType) {
|
|
13
|
-
return valueType === TIME_VALUE_TYPE_NOW;
|
|
14
|
-
},
|
|
15
|
-
getNowTimeValue() {
|
|
16
|
-
const now = new Date();
|
|
17
|
-
const pad = (val) => (val < 10 ? "0" + val : String(val));
|
|
18
|
-
return `${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(
|
|
19
|
-
now.getSeconds()
|
|
20
|
-
)}`;
|
|
21
|
-
},
|
|
22
|
-
normalizeTimeValue(val) {
|
|
23
|
-
if (val === null || val === undefined || val === "") {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const matched = /^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(String(val).trim());
|
|
27
|
-
if (!matched) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
const hour = Number(matched[1]);
|
|
31
|
-
const minute = Number(matched[2]);
|
|
32
|
-
const second = Number(matched[3] || 0);
|
|
33
|
-
if (hour > 23 || minute > 59 || second > 59) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
const pad = (v) => (v < 10 ? "0" + v : String(v));
|
|
37
|
-
return `${pad(hour)}:${pad(minute)}:${pad(second)}`;
|
|
38
|
-
},
|
|
39
|
-
parseTimeLimitValue(val) {
|
|
40
|
-
const normalized = this.normalizeTimeValue(val);
|
|
41
|
-
if (normalized === null) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
const parts = normalized.split(":");
|
|
45
|
-
return Number(parts[0]) * 3600 + Number(parts[1]) * 60 + Number(parts[2]);
|
|
46
|
-
},
|
|
47
|
-
/* 最小时间:固定时间或当前时间 */
|
|
48
|
-
getTimeLimitMinValue() {
|
|
49
|
-
const options = this.getTimeLimitOptions();
|
|
50
|
-
if (this.isNowTimeValueType(options.minTimeType)) {
|
|
51
|
-
return this.getNowTimeValue();
|
|
52
|
-
}
|
|
53
|
-
return this.normalizeTimeValue(options.minTime);
|
|
54
|
-
},
|
|
55
|
-
initTimeLimitPickerOptions() {
|
|
56
|
-
const pickerOptions = { ...(this.pickerOptions || {}) };
|
|
57
|
-
const minTime = this.getTimeLimitMinValue();
|
|
58
|
-
if (minTime === null) {
|
|
59
|
-
delete pickerOptions.selectableRange;
|
|
60
|
-
} else {
|
|
61
|
-
pickerOptions.selectableRange = `${minTime} - ${MAX_TIME_VALUE}`;
|
|
62
|
-
}
|
|
63
|
-
this.pickerOptions = pickerOptions;
|
|
64
|
-
},
|
|
65
|
-
isTimeLimitViolated(value) {
|
|
66
|
-
const currentTime = this.parseTimeLimitValue(value);
|
|
67
|
-
if (currentTime === null) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
const minTime = this.parseTimeLimitValue(this.getTimeLimitMinValue());
|
|
71
|
-
return minTime !== null && currentTime < minTime;
|
|
72
|
-
},
|
|
73
|
-
getTimeLimitViolationMessage() {
|
|
74
|
-
return `时间不能小于${this.getTimeLimitMinValue()}`;
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
};
|
|
1
|
+
/* 时间组件的最小时间支持配置为「当前时间」,此处统一解析。
|
|
2
|
+
默认值(含「当前时间」与相对偏移)已收敛到 relative-default-mixin,不在此处理。 */
|
|
3
|
+
export const TIME_VALUE_TYPE_NOW = "now";
|
|
4
|
+
|
|
5
|
+
const MAX_TIME_VALUE = "23:59:59";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
methods: {
|
|
9
|
+
getTimeLimitOptions() {
|
|
10
|
+
return this.field.options || {};
|
|
11
|
+
},
|
|
12
|
+
isNowTimeValueType(valueType) {
|
|
13
|
+
return valueType === TIME_VALUE_TYPE_NOW;
|
|
14
|
+
},
|
|
15
|
+
getNowTimeValue() {
|
|
16
|
+
const now = new Date();
|
|
17
|
+
const pad = (val) => (val < 10 ? "0" + val : String(val));
|
|
18
|
+
return `${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(
|
|
19
|
+
now.getSeconds()
|
|
20
|
+
)}`;
|
|
21
|
+
},
|
|
22
|
+
normalizeTimeValue(val) {
|
|
23
|
+
if (val === null || val === undefined || val === "") {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const matched = /^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(String(val).trim());
|
|
27
|
+
if (!matched) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const hour = Number(matched[1]);
|
|
31
|
+
const minute = Number(matched[2]);
|
|
32
|
+
const second = Number(matched[3] || 0);
|
|
33
|
+
if (hour > 23 || minute > 59 || second > 59) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const pad = (v) => (v < 10 ? "0" + v : String(v));
|
|
37
|
+
return `${pad(hour)}:${pad(minute)}:${pad(second)}`;
|
|
38
|
+
},
|
|
39
|
+
parseTimeLimitValue(val) {
|
|
40
|
+
const normalized = this.normalizeTimeValue(val);
|
|
41
|
+
if (normalized === null) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const parts = normalized.split(":");
|
|
45
|
+
return Number(parts[0]) * 3600 + Number(parts[1]) * 60 + Number(parts[2]);
|
|
46
|
+
},
|
|
47
|
+
/* 最小时间:固定时间或当前时间 */
|
|
48
|
+
getTimeLimitMinValue() {
|
|
49
|
+
const options = this.getTimeLimitOptions();
|
|
50
|
+
if (this.isNowTimeValueType(options.minTimeType)) {
|
|
51
|
+
return this.getNowTimeValue();
|
|
52
|
+
}
|
|
53
|
+
return this.normalizeTimeValue(options.minTime);
|
|
54
|
+
},
|
|
55
|
+
initTimeLimitPickerOptions() {
|
|
56
|
+
const pickerOptions = { ...(this.pickerOptions || {}) };
|
|
57
|
+
const minTime = this.getTimeLimitMinValue();
|
|
58
|
+
if (minTime === null) {
|
|
59
|
+
delete pickerOptions.selectableRange;
|
|
60
|
+
} else {
|
|
61
|
+
pickerOptions.selectableRange = `${minTime} - ${MAX_TIME_VALUE}`;
|
|
62
|
+
}
|
|
63
|
+
this.pickerOptions = pickerOptions;
|
|
64
|
+
},
|
|
65
|
+
isTimeLimitViolated(value) {
|
|
66
|
+
const currentTime = this.parseTimeLimitValue(value);
|
|
67
|
+
if (currentTime === null) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
const minTime = this.parseTimeLimitValue(this.getTimeLimitMinValue());
|
|
71
|
+
return minTime !== null && currentTime < minTime;
|
|
72
|
+
},
|
|
73
|
+
getTimeLimitViolationMessage() {
|
|
74
|
+
return `时间不能小于${this.getTimeLimitMinValue()}`;
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|