cloud-web-corejs 1.0.54-dev.801 → 1.0.54-dev.803
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/baseArea/index.vue +82 -27
- package/src/components/table/tableForm.vue +16 -5
- package/src/components/table/tableFormMixin.js +35 -7
- package/src/components/wf/content.vue +9 -1
- package/src/components/wf/wfActionDropdown.vue +32 -5
- package/src/components/wf/wfActionItems.js +22 -2
- package/src/components/wf/wfUtil.js +34 -10
- package/src/components/xform/form-designer/designer.js +6 -1
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +9 -3
- package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +3 -2
- package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +3 -12
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js +2 -46
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/relative-default-mixin.js +107 -0
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/relativeDateUtil.js +321 -0
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/time-limit-mixin.js +2 -17
- package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +3 -2
- package/src/components/xform/form-designer/form-widget/field-widget/time-widget.vue +3 -12
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +35 -36
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultValue-editor.vue +35 -18
- package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-defaultValue-editor.vue +34 -36
- package/src/components/xform/form-designer/setting-panel/property-editor/field-time-range/time-range-defaultValue-editor.vue +35 -18
- package/src/components/xform/form-designer/setting-panel/property-editor/fixedQuery-editor.vue +39 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/relative-default-block.vue +369 -0
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +1 -0
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +34 -2
- package/src/components/xform/form-render/container-item/data-table-mixin.js +116 -74
- package/src/components/xform/lang/en-US.js +3 -0
- package/src/components/xform/lang/zh-CN.js +3 -0
- package/src/components/xform/utils/fixedQueryUtil.js +93 -0
- package/src/views/user/home/wjl/content.vue +1206 -0
- package/src/views/user/menu/voc_list.vue +686 -0
- package/src/views/user/role/edit.vue +32 -9
- package/src/views/user/role/list.vue +142 -67
- package/src/views/user/role/voc_edit.vue +282 -0
- package/src/views/user/wf/wf_manage/list.vue +17 -1
package/src/components/xform/form-designer/form-widget/field-widget/mixins/relativeDateUtil.js
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 日期/时间组件「相对默认值」的统一求值器(date、date-range、time、time-range 共用)。
|
|
3
|
+
*
|
|
4
|
+
* 描述符 { offset, unit, align }:先按 offset 平移 unit,再按 align 对齐到该单位的起/止。
|
|
5
|
+
* {offset: 0, unit: 'day'} → 今天
|
|
6
|
+
* {offset: 7, unit: 'day'} → 7天后
|
|
7
|
+
* {offset: -1, unit: 'month', align: 'start'} → 上月1号
|
|
8
|
+
* {offset: -1, unit: 'month', align: 'end'} → 上月最后一天
|
|
9
|
+
*
|
|
10
|
+
* 老配置 defaultValueType='now'(date/time 的「当前时间」勾选)在此读时归一为 {offset:0},
|
|
11
|
+
* 不改存量表单 JSON,也不做数据迁移。
|
|
12
|
+
*/
|
|
13
|
+
import moment from "moment";
|
|
14
|
+
|
|
15
|
+
export const DEFAULT_VALUE_TYPE_NOW = "now";
|
|
16
|
+
export const DEFAULT_VALUE_TYPE_RELATIVE = "relative";
|
|
17
|
+
|
|
18
|
+
/* 日期类单位:date/date-range 可用 */
|
|
19
|
+
export const DATE_UNITS = ["day", "week", "month", "quarter", "year"];
|
|
20
|
+
/* 时间类单位:time/time-range 可用,date 组件在 datetime 类型下也可用 */
|
|
21
|
+
export const TIME_UNITS = ["hour", "minute", "second"];
|
|
22
|
+
export const ALIGN_TYPES = ["none", "start", "end"];
|
|
23
|
+
|
|
24
|
+
export const KIND_DATE = "date";
|
|
25
|
+
export const KIND_TIME = "time";
|
|
26
|
+
|
|
27
|
+
const RANGE_WIDGET_TYPES = ["date-range", "time-range"];
|
|
28
|
+
const TIME_WIDGET_TYPES = ["time", "time-range"];
|
|
29
|
+
|
|
30
|
+
/* el-time-picker 的 value-format 在组件里写死为 HH:mm:ss */
|
|
31
|
+
const TIME_VALUE_FORMAT = "HH:mm:ss";
|
|
32
|
+
|
|
33
|
+
const UNIT_LABELS = {
|
|
34
|
+
day: "天",
|
|
35
|
+
week: "周",
|
|
36
|
+
month: "月",
|
|
37
|
+
quarter: "季",
|
|
38
|
+
year: "年",
|
|
39
|
+
hour: "小时",
|
|
40
|
+
minute: "分钟",
|
|
41
|
+
second: "秒",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** @returns {String} 组件类型对应的求值口径:time/time-range 为时间类,其余按日期类 */
|
|
45
|
+
export function getRelativeKind(widgetType) {
|
|
46
|
+
return TIME_WIDGET_TYPES.includes(widgetType) ? KIND_TIME : KIND_DATE;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @returns {Boolean} 是否范围组件(值为长度 2 的数组) */
|
|
50
|
+
export function isRangeWidgetType(widgetType) {
|
|
51
|
+
return RANGE_WIDGET_TYPES.includes(widgetType);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** @returns {Array} 该口径下可选的单位;日期类额外放开时分秒(datetime 类型要用) */
|
|
55
|
+
export function getAvailableUnits(kind) {
|
|
56
|
+
return kind === KIND_TIME ? [...TIME_UNITS] : [...DATE_UNITS, ...TIME_UNITS];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function getUnitLabel(unit) {
|
|
60
|
+
return UNIT_LABELS[unit] || unit;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** @returns {Boolean} 该单位是否为时间类(时/分/秒) */
|
|
64
|
+
export function isTimeUnit(unit) {
|
|
65
|
+
return TIME_UNITS.includes(unit);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 描述符补全:offset 取整、unit/align 落到白名单内。
|
|
70
|
+
* @param {Object} descriptor 原始描述符,可为 null
|
|
71
|
+
* @param {String} kind KIND_DATE / KIND_TIME
|
|
72
|
+
* @returns {Object} { offset, unit, align }
|
|
73
|
+
*/
|
|
74
|
+
export function normalizeRelativeDescriptor(descriptor, kind = KIND_DATE) {
|
|
75
|
+
const source
|
|
76
|
+
= descriptor && typeof descriptor === "object" ? descriptor : {};
|
|
77
|
+
const units = getAvailableUnits(kind);
|
|
78
|
+
const offset = Number(source.offset);
|
|
79
|
+
const unit = units.includes(source.unit)
|
|
80
|
+
? source.unit
|
|
81
|
+
: kind === KIND_TIME
|
|
82
|
+
? "hour"
|
|
83
|
+
: "day";
|
|
84
|
+
const align = ALIGN_TYPES.includes(source.align) ? source.align : "none";
|
|
85
|
+
return {
|
|
86
|
+
offset: Number.isFinite(offset) ? Math.trunc(offset) : 0,
|
|
87
|
+
unit,
|
|
88
|
+
align,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** 范围描述符补全,两端各自独立 */
|
|
93
|
+
export function normalizeRelativeRangeDescriptor(descriptor, kind = KIND_DATE) {
|
|
94
|
+
const source
|
|
95
|
+
= descriptor && typeof descriptor === "object" ? descriptor : {};
|
|
96
|
+
return {
|
|
97
|
+
start: normalizeRelativeDescriptor(source.start, kind),
|
|
98
|
+
end: normalizeRelativeDescriptor(source.end, kind),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* 周的起止按 ISO 周算(周一为一周之始):moment 未加载中文语言包,
|
|
103
|
+
startOf('week') 会按 en 口径落到周日,与国内习惯不符 */
|
|
104
|
+
function getAlignUnit(unit) {
|
|
105
|
+
return unit === "week" ? "isoWeek" : unit;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* element 的 format/value-format 转 moment 格式。
|
|
110
|
+
* 只有 y(年)和 d(日)两族记号不同,M/H/m/s/A 两边一致。
|
|
111
|
+
*/
|
|
112
|
+
export function toMomentFormat(elFormat) {
|
|
113
|
+
const tokenMap = { yyyy: "YYYY", yy: "YY", dd: "DD", d: "D" };
|
|
114
|
+
return String(elFormat).replace(
|
|
115
|
+
/yyyy|yy|dd|d/g,
|
|
116
|
+
(token) => tokenMap[token]
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** @returns {Boolean} 该组件的值是否带时分秒 */
|
|
121
|
+
export function hasTimePart(type, valueFormat) {
|
|
122
|
+
if (String(type || "").indexOf("datetime") > -1) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
return /[Hhms]/.test(String(valueFormat || ""));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** "HH:mm:ss" → 把时分秒盖到 moment 实例上;解析不出来就原样返回 */
|
|
129
|
+
function applyTimeOfDay(momentValue, timeText) {
|
|
130
|
+
const matched = /^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/.exec(
|
|
131
|
+
String(timeText || "").trim()
|
|
132
|
+
);
|
|
133
|
+
if (!matched) {
|
|
134
|
+
return momentValue;
|
|
135
|
+
}
|
|
136
|
+
return momentValue.set({
|
|
137
|
+
hour: Number(matched[1]),
|
|
138
|
+
minute: Number(matched[2]),
|
|
139
|
+
second: Number(matched[3] || 0),
|
|
140
|
+
millisecond: 0,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 求出描述符对应的时刻。
|
|
146
|
+
* @param {Object} descriptor 描述符
|
|
147
|
+
* @param {Object} config { kind, baseDate }
|
|
148
|
+
*/
|
|
149
|
+
export function resolveRelativeMoment(descriptor, config = {}) {
|
|
150
|
+
const kind = config.kind || KIND_DATE;
|
|
151
|
+
const { offset, unit, align } = normalizeRelativeDescriptor(
|
|
152
|
+
descriptor,
|
|
153
|
+
kind
|
|
154
|
+
);
|
|
155
|
+
const momentValue = config.baseDate ? moment(config.baseDate) : moment();
|
|
156
|
+
if (offset) {
|
|
157
|
+
momentValue.add(offset, unit);
|
|
158
|
+
}
|
|
159
|
+
if (align === "start") {
|
|
160
|
+
momentValue.startOf(getAlignUnit(unit));
|
|
161
|
+
} else if (align === "end") {
|
|
162
|
+
momentValue.endOf(getAlignUnit(unit));
|
|
163
|
+
}
|
|
164
|
+
return momentValue;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* 按组件的取值格式输出。
|
|
169
|
+
* time 类固定 HH:mm:ss;date 类 valueFormat 为空时 picker 的值是 Date 对象。
|
|
170
|
+
*/
|
|
171
|
+
export function formatRelativeMoment(momentValue, config = {}) {
|
|
172
|
+
if ((config.kind || KIND_DATE) === KIND_TIME) {
|
|
173
|
+
return momentValue.format(TIME_VALUE_FORMAT);
|
|
174
|
+
}
|
|
175
|
+
const valueFormat = config.valueFormat;
|
|
176
|
+
if (!valueFormat) {
|
|
177
|
+
return momentValue.toDate();
|
|
178
|
+
}
|
|
179
|
+
if (valueFormat === "timestamp") {
|
|
180
|
+
return momentValue.valueOf();
|
|
181
|
+
}
|
|
182
|
+
return momentValue.format(toMomentFormat(valueFormat));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/*
|
|
186
|
+
* 时分秒口径:单位是日期类(天及以上)时,端点时刻取 defaultTime(起 00:00:00 / 止 23:59:59),
|
|
187
|
+
* 保证「当前到+7天」是整天区间,between 查询不会漏掉首尾当天的数据;
|
|
188
|
+
* 单位是时间类(时/分/秒)时用户要的就是时刻精度,不套 defaultTime。
|
|
189
|
+
*/
|
|
190
|
+
function shouldApplyDefaultTime(descriptor, config) {
|
|
191
|
+
if (!config.defaultTime) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
if (!hasTimePart(config.type, config.valueFormat)) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
return !isTimeUnit(normalizeRelativeDescriptor(descriptor, config.kind).unit);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* 单值组件的相对默认值。
|
|
202
|
+
* @param {Object} descriptor 描述符
|
|
203
|
+
* @param {Object} config { kind, type, valueFormat, defaultTime, baseDate }
|
|
204
|
+
*/
|
|
205
|
+
export function resolveRelativeValue(descriptor, config = {}) {
|
|
206
|
+
const momentValue = resolveRelativeMoment(descriptor, config);
|
|
207
|
+
if (shouldApplyDefaultTime(descriptor, config)) {
|
|
208
|
+
applyTimeOfDay(momentValue, config.defaultTime);
|
|
209
|
+
}
|
|
210
|
+
const value = formatRelativeMoment(momentValue, config);
|
|
211
|
+
/* date 组件的 dates(多选日期)类型,值是数组 */
|
|
212
|
+
return config.type === "dates" ? [value] : value;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* 范围组件的相对默认值,返回长度 2 的数组。
|
|
217
|
+
* config.defaultTime 为 ["00:00:00", "23:59:59"] 这样的两端时刻。
|
|
218
|
+
*/
|
|
219
|
+
export function resolveRelativeRangeValue(descriptor, config = {}) {
|
|
220
|
+
const { start, end } = normalizeRelativeRangeDescriptor(
|
|
221
|
+
descriptor,
|
|
222
|
+
config.kind
|
|
223
|
+
);
|
|
224
|
+
const defaultTime = Array.isArray(config.defaultTime)
|
|
225
|
+
? config.defaultTime
|
|
226
|
+
: [];
|
|
227
|
+
return [
|
|
228
|
+
resolveRelativeValue(start, { ...config, defaultTime: defaultTime[0] }),
|
|
229
|
+
resolveRelativeValue(end, { ...config, defaultTime: defaultTime[1] }),
|
|
230
|
+
];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** 描述符 → 一句话规则,如「7天后」「1月前·月初」 */
|
|
234
|
+
export function describeRelativeDescriptor(descriptor, kind = KIND_DATE) {
|
|
235
|
+
const { offset, unit, align } = normalizeRelativeDescriptor(descriptor, kind);
|
|
236
|
+
const unitLabel = getUnitLabel(unit);
|
|
237
|
+
let text = "当前";
|
|
238
|
+
if (offset > 0) {
|
|
239
|
+
text = `${offset}${unitLabel}后`;
|
|
240
|
+
} else if (offset < 0) {
|
|
241
|
+
text = `${-offset}${unitLabel}前`;
|
|
242
|
+
}
|
|
243
|
+
if (align === "start") {
|
|
244
|
+
text += `·${unitLabel}初`;
|
|
245
|
+
} else if (align === "end") {
|
|
246
|
+
text += `·${unitLabel}末`;
|
|
247
|
+
}
|
|
248
|
+
return text;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** 设计器预览用:把求值结果转成可读文本 */
|
|
252
|
+
export function toPreviewText(value) {
|
|
253
|
+
if (value === null || value === undefined || value === "") {
|
|
254
|
+
return "";
|
|
255
|
+
}
|
|
256
|
+
if (Array.isArray(value)) {
|
|
257
|
+
return value.map((item) => toPreviewText(item)).join(" ~ ");
|
|
258
|
+
}
|
|
259
|
+
if (value instanceof Date) {
|
|
260
|
+
return moment(value).format("YYYY-MM-DD HH:mm:ss");
|
|
261
|
+
}
|
|
262
|
+
if (typeof value === "number") {
|
|
263
|
+
return moment(value).format("YYYY-MM-DD HH:mm:ss");
|
|
264
|
+
}
|
|
265
|
+
return String(value);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** @returns {Boolean} options 上是否配了相对默认值(含老的 now 勾选) */
|
|
269
|
+
export function isRelativeDefaultType(defaultValueType) {
|
|
270
|
+
return (
|
|
271
|
+
defaultValueType === DEFAULT_VALUE_TYPE_RELATIVE
|
|
272
|
+
|| defaultValueType === DEFAULT_VALUE_TYPE_NOW
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* 从 options 读出描述符:'now' 归一为 offset 0,'relative' 取 defaultValueRelative。
|
|
278
|
+
* 未配相对默认值返回 null,调用方走原有静态默认值逻辑。
|
|
279
|
+
* @param {Object} options 组件 options
|
|
280
|
+
* @param {String} widgetType 组件类型
|
|
281
|
+
*/
|
|
282
|
+
export function getRelativeDescriptor(options, widgetType) {
|
|
283
|
+
const source = options || {};
|
|
284
|
+
if (!isRelativeDefaultType(source.defaultValueType)) {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
const kind = getRelativeKind(widgetType);
|
|
288
|
+
const isRange = isRangeWidgetType(widgetType);
|
|
289
|
+
if (source.defaultValueType === DEFAULT_VALUE_TYPE_NOW) {
|
|
290
|
+
/* 老的「当前时间」勾选:两端都取此刻 */
|
|
291
|
+
const now = normalizeRelativeDescriptor(null, kind);
|
|
292
|
+
return isRange ? { start: now, end: { ...now } } : now;
|
|
293
|
+
}
|
|
294
|
+
return isRange
|
|
295
|
+
? normalizeRelativeRangeDescriptor(source.defaultValueRelative, kind)
|
|
296
|
+
: normalizeRelativeDescriptor(source.defaultValueRelative, kind);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* 组件 options → 相对默认值。未配相对默认值返回 undefined。
|
|
301
|
+
* @param {Object} options 组件 options
|
|
302
|
+
* @param {String} widgetType 组件类型
|
|
303
|
+
* @param {Date} baseDate 基准时刻,仅测试用;不传取当前时刻
|
|
304
|
+
*/
|
|
305
|
+
export function resolveDefaultValueFromOptions(options, widgetType, baseDate) {
|
|
306
|
+
const descriptor = getRelativeDescriptor(options, widgetType);
|
|
307
|
+
if (!descriptor) {
|
|
308
|
+
return undefined;
|
|
309
|
+
}
|
|
310
|
+
const source = options || {};
|
|
311
|
+
const config = {
|
|
312
|
+
kind: getRelativeKind(widgetType),
|
|
313
|
+
type: source.type,
|
|
314
|
+
valueFormat: source.valueFormat,
|
|
315
|
+
defaultTime: source.defaultTime,
|
|
316
|
+
baseDate,
|
|
317
|
+
};
|
|
318
|
+
return isRangeWidgetType(widgetType)
|
|
319
|
+
? resolveRelativeRangeValue(descriptor, config)
|
|
320
|
+
: resolveRelativeValue(descriptor, config);
|
|
321
|
+
}
|
package/src/components/xform/form-designer/form-widget/field-widget/mixins/time-limit-mixin.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* 时间组件的最小时间支持配置为「当前时间」,此处统一解析。
|
|
2
|
+
默认值(含「当前时间」与相对偏移)已收敛到 relative-default-mixin,不在此处理。 */
|
|
2
3
|
export const TIME_VALUE_TYPE_NOW = "now";
|
|
3
4
|
|
|
4
5
|
const MAX_TIME_VALUE = "23:59:59";
|
|
@@ -72,21 +73,5 @@ export default {
|
|
|
72
73
|
getTimeLimitViolationMessage() {
|
|
73
74
|
return `时间不能小于${this.getTimeLimitMinValue()}`;
|
|
74
75
|
},
|
|
75
|
-
/* 默认值配置为「当前时间」时,临时替换 defaultValue 后再走通用的取值逻辑 */
|
|
76
|
-
initTimeFieldModel() {
|
|
77
|
-
const options = this.getTimeLimitOptions();
|
|
78
|
-
if (!this.isNowTimeValueType(options.defaultValueType)) {
|
|
79
|
-
this.initFieldModel();
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const rawDefaultValue = options.defaultValue;
|
|
84
|
-
options.defaultValue = this.getNowTimeValue();
|
|
85
|
-
try {
|
|
86
|
-
this.initFieldModel();
|
|
87
|
-
} finally {
|
|
88
|
-
options.defaultValue = rawDefaultValue;
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
76
|
},
|
|
92
77
|
};
|
|
@@ -21,11 +21,12 @@
|
|
|
21
21
|
import i18n from "../../../../../components/xform/utils/i18n";
|
|
22
22
|
import fieldMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/fieldMixin";
|
|
23
23
|
import utcTransformMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/mixins/utc-transform-mixin";
|
|
24
|
+
import relativeDefaultMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/mixins/relative-default-mixin";
|
|
24
25
|
|
|
25
26
|
export default {
|
|
26
27
|
name: "time-range-widget",
|
|
27
28
|
componentName: 'FieldWidget', //必须固定为FieldWidget,用于接收父级组件的broadcast事件
|
|
28
|
-
mixins: [emitter, fieldMixin, i18n, utcTransformMixin],
|
|
29
|
+
mixins: [emitter, fieldMixin, i18n, utcTransformMixin, relativeDefaultMixin],
|
|
29
30
|
props: {
|
|
30
31
|
field: Object,
|
|
31
32
|
parentWidget: Object,
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
created() {
|
|
74
75
|
/* 注意:子组件mounted在父组件created之后、父组件mounted之前触发,故子组件mounted需要用到的prop
|
|
75
76
|
需要在父组件created中初始化!! */
|
|
76
|
-
this.
|
|
77
|
+
this.initRelativeFieldModel()
|
|
77
78
|
this.registerToRefList()
|
|
78
79
|
this.initEventHandler()
|
|
79
80
|
this.buildFieldRules()
|
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
import fieldMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/fieldMixin";
|
|
23
23
|
import timeLimitMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/mixins/time-limit-mixin";
|
|
24
24
|
import utcTransformMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/mixins/utc-transform-mixin";
|
|
25
|
+
import relativeDefaultMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/mixins/relative-default-mixin";
|
|
25
26
|
|
|
26
27
|
export default {
|
|
27
28
|
name: "time-widget",
|
|
28
29
|
componentName: 'FieldWidget', //必须固定为FieldWidget,用于接收父级组件的broadcast事件
|
|
29
|
-
mixins: [emitter, fieldMixin, i18n, timeLimitMixin, utcTransformMixin],
|
|
30
|
+
mixins: [emitter, fieldMixin, i18n, timeLimitMixin, utcTransformMixin, relativeDefaultMixin],
|
|
30
31
|
props: {
|
|
31
32
|
field: Object,
|
|
32
33
|
parentWidget: Object,
|
|
@@ -83,7 +84,7 @@
|
|
|
83
84
|
created() {
|
|
84
85
|
/* 注意:子组件mounted在父组件created之后、父组件mounted之前触发,故子组件mounted需要用到的prop
|
|
85
86
|
需要在父组件created中初始化!! */
|
|
86
|
-
this.
|
|
87
|
+
this.initRelativeFieldModel()
|
|
87
88
|
this.registerToRefList()
|
|
88
89
|
this.initEventHandler()
|
|
89
90
|
this.buildFieldRules()
|
|
@@ -119,16 +120,6 @@
|
|
|
119
120
|
setNow() {
|
|
120
121
|
this.setValue(this.getNowTimeValue())
|
|
121
122
|
},
|
|
122
|
-
refreshDefaultValue() {
|
|
123
|
-
if (this.designState !== true) {
|
|
124
|
-
return
|
|
125
|
-
}
|
|
126
|
-
if (this.isNowTimeValueType(this.field.options.defaultValueType)) {
|
|
127
|
-
this.fieldModel = this.getNowTimeValue()
|
|
128
|
-
} else if (this.field.options.defaultValue !== undefined) {
|
|
129
|
-
this.fieldModel = this.field.options.defaultValue
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
123
|
}
|
|
133
124
|
}
|
|
134
125
|
</script>
|
|
@@ -1,44 +1,43 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-form-item
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
<el-form-item
|
|
3
|
+
:label="i18nt('designer.setting.defaultValue')"
|
|
4
|
+
class="form-item-label-top"
|
|
5
|
+
>
|
|
6
|
+
<relative-default-block
|
|
7
|
+
:option-model="optionModel"
|
|
8
|
+
widget-type="date"
|
|
9
|
+
@change="emitDefaultValueChange"
|
|
10
|
+
>
|
|
11
|
+
<el-date-picker
|
|
12
|
+
:type="optionModel.type"
|
|
13
|
+
v-model="optionModel.defaultValue"
|
|
14
|
+
@change="emitDefaultValueChange"
|
|
15
|
+
:format="optionModel.format"
|
|
16
|
+
:value-format="optionModel.valueFormat"
|
|
17
|
+
style="width: 100%"
|
|
18
|
+
>
|
|
19
|
+
</el-date-picker>
|
|
20
|
+
</relative-default-block>
|
|
9
21
|
</el-form-item>
|
|
10
22
|
</template>
|
|
11
23
|
|
|
12
24
|
<script>
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
import i18n from "../../../../../../components/xform/utils/i18n";
|
|
26
|
+
import propertyMixin from "../../../../../../components/xform/form-designer/setting-panel/property-editor/propertyMixin";
|
|
27
|
+
import RelativeDefaultBlock from "../../../../../../components/xform/form-designer/setting-panel/property-editor/relative-default-block";
|
|
15
28
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return this.optionModel.defaultValueType === 'now'
|
|
29
|
-
},
|
|
30
|
-
set(checked) {
|
|
31
|
-
this.$set(this.optionModel, 'defaultValueType', checked ? 'now' : '')
|
|
32
|
-
if (checked) {
|
|
33
|
-
this.$set(this.optionModel, 'defaultValue', null)
|
|
34
|
-
}
|
|
35
|
-
this.emitDefaultValueChange()
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
}
|
|
29
|
+
export default {
|
|
30
|
+
name: "date-defaultValue-editor",
|
|
31
|
+
mixins: [i18n, propertyMixin],
|
|
32
|
+
components: {
|
|
33
|
+
RelativeDefaultBlock,
|
|
34
|
+
},
|
|
35
|
+
props: {
|
|
36
|
+
designer: Object,
|
|
37
|
+
selectedWidget: Object,
|
|
38
|
+
optionModel: Object,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
40
41
|
</script>
|
|
41
42
|
|
|
42
|
-
<style scoped>
|
|
43
|
-
|
|
44
|
-
</style>
|
|
43
|
+
<style scoped></style>
|
|
@@ -1,26 +1,43 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-form-item
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<el-form-item
|
|
3
|
+
:label="i18nt('designer.setting.defaultValue')"
|
|
4
|
+
class="form-item-label-top"
|
|
5
|
+
>
|
|
6
|
+
<relative-default-block
|
|
7
|
+
:option-model="optionModel"
|
|
8
|
+
widget-type="date-range"
|
|
9
|
+
@change="emitDefaultValueChange"
|
|
10
|
+
>
|
|
11
|
+
<el-date-picker
|
|
12
|
+
:type="optionModel.type"
|
|
13
|
+
v-model="optionModel.defaultValue"
|
|
14
|
+
@change="emitDefaultValueChange"
|
|
15
|
+
:format="optionModel.format"
|
|
16
|
+
:value-format="optionModel.valueFormat"
|
|
17
|
+
style="width: 100%"
|
|
18
|
+
>
|
|
19
|
+
</el-date-picker>
|
|
20
|
+
</relative-default-block>
|
|
6
21
|
</el-form-item>
|
|
7
22
|
</template>
|
|
8
23
|
|
|
9
24
|
<script>
|
|
10
|
-
|
|
11
|
-
|
|
25
|
+
import i18n from "../../../../../../components/xform/utils/i18n";
|
|
26
|
+
import propertyMixin from "../../../../../../components/xform/form-designer/setting-panel/property-editor/propertyMixin";
|
|
27
|
+
import RelativeDefaultBlock from "../../../../../../components/xform/form-designer/setting-panel/property-editor/relative-default-block";
|
|
12
28
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
export default {
|
|
30
|
+
name: "date-range-defaultValue-editor",
|
|
31
|
+
mixins: [i18n, propertyMixin],
|
|
32
|
+
components: {
|
|
33
|
+
RelativeDefaultBlock,
|
|
34
|
+
},
|
|
35
|
+
props: {
|
|
36
|
+
designer: Object,
|
|
37
|
+
selectedWidget: Object,
|
|
38
|
+
optionModel: Object,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
22
41
|
</script>
|
|
23
42
|
|
|
24
|
-
<style scoped>
|
|
25
|
-
|
|
26
|
-
</style>
|
|
43
|
+
<style scoped></style>
|
|
@@ -1,44 +1,42 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-form-item
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
<el-form-item
|
|
3
|
+
:label="i18nt('designer.setting.defaultValue')"
|
|
4
|
+
class="form-item-label-top"
|
|
5
|
+
>
|
|
6
|
+
<relative-default-block
|
|
7
|
+
:option-model="optionModel"
|
|
8
|
+
widget-type="time"
|
|
9
|
+
@change="emitDefaultValueChange"
|
|
10
|
+
>
|
|
11
|
+
<el-time-picker
|
|
12
|
+
v-model="optionModel.defaultValue"
|
|
13
|
+
@change="emitDefaultValueChange"
|
|
14
|
+
:format="optionModel.format"
|
|
15
|
+
value-format="HH:mm:ss"
|
|
16
|
+
style="width: 100%"
|
|
17
|
+
>
|
|
18
|
+
</el-time-picker>
|
|
19
|
+
</relative-default-block>
|
|
9
20
|
</el-form-item>
|
|
10
21
|
</template>
|
|
11
22
|
|
|
12
23
|
<script>
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
import i18n from "../../../../../../components/xform/utils/i18n";
|
|
25
|
+
import propertyMixin from "../../../../../../components/xform/form-designer/setting-panel/property-editor/propertyMixin";
|
|
26
|
+
import RelativeDefaultBlock from "../../../../../../components/xform/form-designer/setting-panel/property-editor/relative-default-block";
|
|
15
27
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return this.optionModel.defaultValueType === 'now'
|
|
29
|
-
},
|
|
30
|
-
set(checked) {
|
|
31
|
-
this.$set(this.optionModel, 'defaultValueType', checked ? 'now' : '')
|
|
32
|
-
if (checked) {
|
|
33
|
-
this.$set(this.optionModel, 'defaultValue', null)
|
|
34
|
-
}
|
|
35
|
-
this.emitDefaultValueChange()
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
}
|
|
28
|
+
export default {
|
|
29
|
+
name: "time-defaultValue-editor",
|
|
30
|
+
mixins: [i18n, propertyMixin],
|
|
31
|
+
components: {
|
|
32
|
+
RelativeDefaultBlock,
|
|
33
|
+
},
|
|
34
|
+
props: {
|
|
35
|
+
designer: Object,
|
|
36
|
+
selectedWidget: Object,
|
|
37
|
+
optionModel: Object,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
40
|
</script>
|
|
41
41
|
|
|
42
|
-
<style scoped>
|
|
43
|
-
|
|
44
|
-
</style>
|
|
42
|
+
<style scoped></style>
|