cloud-web-corejs 1.0.327 → 1.0.329
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/xform/form-designer/form-widget/field-widget/cascader-widget.vue +52 -12
- package/src/components/xform/form-designer/form-widget/field-widget/file-upload-widget.vue +13 -16
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +2 -2
- package/src/components/xform/form-designer/form-widget/field-widget/picture-upload-widget.vue +4 -4
- package/src/components/xform/form-designer/form-widget/field-widget/static-text-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/switch-widget.vue +3 -3
- 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/title-head-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +186 -153
- package/src/components/xform/form-render/container-item/sub-form-item.vue +15 -15
package/package.json
CHANGED
|
@@ -22,9 +22,7 @@
|
|
|
22
22
|
:clearable="field.options.clearable"
|
|
23
23
|
:filterable="field.options.filterable"
|
|
24
24
|
:collapse-tags="!field.options.flatCollapseTags"
|
|
25
|
-
:placeholder="
|
|
26
|
-
field.options.placeholder || i18nt('render.hint.selectPlaceholder')
|
|
27
|
-
"
|
|
25
|
+
:placeholder="getI18nLabel(field.options.placeholder || $t1('请选择'))"
|
|
28
26
|
:show-all-levels="showFullPath"
|
|
29
27
|
:props="cascaderProps"
|
|
30
28
|
@visible-change="hideDropDownOnClick"
|
|
@@ -99,7 +97,7 @@ export default {
|
|
|
99
97
|
cascaderOptions() {
|
|
100
98
|
return this.lazyEnabled
|
|
101
99
|
? this.lazyEmptyOptions
|
|
102
|
-
: this.field.options.optionItems;
|
|
100
|
+
: this.translateOptionNodes(this.field.options.optionItems);
|
|
103
101
|
},
|
|
104
102
|
|
|
105
103
|
cascaderProps() {
|
|
@@ -287,7 +285,7 @@ export default {
|
|
|
287
285
|
settled = true;
|
|
288
286
|
const nodes = this.normalizeLazyNodes(list);
|
|
289
287
|
this.rememberLazyNodes(node, nodes);
|
|
290
|
-
resolve(nodes);
|
|
288
|
+
resolve(this.translateOptionNodes(nodes));
|
|
291
289
|
};
|
|
292
290
|
const abortLazyLoad = () => {
|
|
293
291
|
if (settled) return;
|
|
@@ -318,7 +316,7 @@ export default {
|
|
|
318
316
|
settled = true;
|
|
319
317
|
const nodes = this.normalizeLazyNodes(list);
|
|
320
318
|
this.rememberLazyNodes(node, nodes);
|
|
321
|
-
resolve(nodes);
|
|
319
|
+
resolve(this.translateOptionNodes(nodes));
|
|
322
320
|
};
|
|
323
321
|
// 请求失败不能 resolve([]):Element 会把 node.loaded 置 true,之后不再 lazyLoad
|
|
324
322
|
const abortLazyLoad = () => {
|
|
@@ -349,6 +347,48 @@ export default {
|
|
|
349
347
|
error: abortLazyLoad,
|
|
350
348
|
});
|
|
351
349
|
},
|
|
350
|
+
// 展示用副本。原文留在不可枚举的 __rawLabel,脚本仍拿原文
|
|
351
|
+
translateOptionNodes(list) {
|
|
352
|
+
if (!Array.isArray(list) || this.designState) return list;
|
|
353
|
+
const labelKey = this.labelKey;
|
|
354
|
+
const childrenKey = this.childrenKey;
|
|
355
|
+
return list.map((item) => {
|
|
356
|
+
if (!item || typeof item !== "object") return item;
|
|
357
|
+
const next = { ...item };
|
|
358
|
+
const rawLabel = item[labelKey];
|
|
359
|
+
Object.defineProperty(next, "__rawLabel", {
|
|
360
|
+
value: rawLabel,
|
|
361
|
+
enumerable: false,
|
|
362
|
+
});
|
|
363
|
+
if (rawLabel != null && rawLabel !== "") {
|
|
364
|
+
next[labelKey] = this.getI18nLabel(rawLabel);
|
|
365
|
+
}
|
|
366
|
+
if (Array.isArray(item[childrenKey])) {
|
|
367
|
+
next[childrenKey] = this.translateOptionNodes(item[childrenKey]);
|
|
368
|
+
}
|
|
369
|
+
return next;
|
|
370
|
+
});
|
|
371
|
+
},
|
|
372
|
+
rawNodeLabel(node) {
|
|
373
|
+
const data = node && node.data;
|
|
374
|
+
if (data && Object.prototype.hasOwnProperty.call(data, "__rawLabel")) {
|
|
375
|
+
return data.__rawLabel;
|
|
376
|
+
}
|
|
377
|
+
return node && node.label != null ? node.label : "";
|
|
378
|
+
},
|
|
379
|
+
rawOptionData(data) {
|
|
380
|
+
if (!data || typeof data !== "object") return data || null;
|
|
381
|
+
if (!Object.prototype.hasOwnProperty.call(data, "__rawLabel")) return data;
|
|
382
|
+
const next = { ...data };
|
|
383
|
+
next[this.labelKey] = data.__rawLabel;
|
|
384
|
+
const childrenKey = this.childrenKey;
|
|
385
|
+
if (Array.isArray(data[childrenKey])) {
|
|
386
|
+
next[childrenKey] = data[childrenKey].map((child) =>
|
|
387
|
+
this.rawOptionData(child)
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
return next;
|
|
391
|
+
},
|
|
352
392
|
// 展开节点时的路径上下文(与 onSelect 的 item 字段含义一致)
|
|
353
393
|
buildCascaderNodePathContext(node) {
|
|
354
394
|
if (!node || node.root || node.level === 0) {
|
|
@@ -366,15 +406,15 @@ export default {
|
|
|
366
406
|
const levels = pathNodes.map((seg, index) => ({
|
|
367
407
|
level: index,
|
|
368
408
|
value: seg.value,
|
|
369
|
-
label: seg
|
|
370
|
-
data: seg.data
|
|
409
|
+
label: this.rawNodeLabel(seg),
|
|
410
|
+
data: this.rawOptionData(seg.data),
|
|
371
411
|
}));
|
|
372
412
|
return {
|
|
373
|
-
row: node.data
|
|
413
|
+
row: this.rawOptionData(node.data),
|
|
374
414
|
level: path.length ? path.length - 1 : 0,
|
|
375
415
|
path: path,
|
|
376
|
-
pathLabels:
|
|
377
|
-
pathRows: pathNodes.map((seg) => seg.data
|
|
416
|
+
pathLabels: pathNodes.map((seg) => this.rawNodeLabel(seg)),
|
|
417
|
+
pathRows: pathNodes.map((seg) => this.rawOptionData(seg.data)),
|
|
378
418
|
levels: levels,
|
|
379
419
|
};
|
|
380
420
|
},
|
|
@@ -579,7 +619,7 @@ export default {
|
|
|
579
619
|
const ctx = this.buildCascaderNodePathContext(node);
|
|
580
620
|
return {
|
|
581
621
|
value: node.value,
|
|
582
|
-
label: node
|
|
622
|
+
label: this.rawNodeLabel(node),
|
|
583
623
|
level: ctx.level == null ? 0 : ctx.level,
|
|
584
624
|
path: ctx.path,
|
|
585
625
|
pathLabels: ctx.pathLabels,
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
:limit="field.options.limit" :on-exceed="handleFileExceed" :before-upload="beforeFileUpload"
|
|
13
13
|
:on-success="handleFileUpload" :on-error="handleUploadError">
|
|
14
14
|
<div slot="tip" class="el-upload__tip"
|
|
15
|
-
v-if="!!field.options.uploadTip">{{field.options.uploadTip}}</div>
|
|
15
|
+
v-if="!!field.options.uploadTip">{{getI18nLabel(field.options.uploadTip)}}</div>
|
|
16
16
|
<i slot="default" class="el-icon-plus avatar-uploader-icon"></i>
|
|
17
17
|
<template #file="{ file }">
|
|
18
18
|
<div class="upload-file-list">
|
|
19
19
|
<span class="upload-file-name" :title="file.name">{{file.name}}</span>
|
|
20
20
|
<a :href="file.url" download="" target="_blank">
|
|
21
|
-
<i class="el-icon-download file-action" :title="
|
|
22
|
-
<i class="el-icon-delete file-action" :title="
|
|
21
|
+
<i class="el-icon-download file-action" :title="$t1('下载')"></i></a>
|
|
22
|
+
<i class="el-icon-delete file-action" :title="$t1('移除')" v-if="!field.options.disabled"
|
|
23
23
|
@click="removeUploadFile(file.name, file.url, file.uid)"></i>
|
|
24
24
|
</div>
|
|
25
25
|
</template>
|
|
@@ -30,16 +30,13 @@
|
|
|
30
30
|
<script>
|
|
31
31
|
import FormItemWrapper from './form-item-wrapper'
|
|
32
32
|
import emitter from '../../../../../components/xform/utils/emitter'
|
|
33
|
-
import i18n, {translate} from "../../../../../components/xform/utils/i18n";
|
|
34
33
|
import {deepClone} from "../../../../../components/xform/utils/util";
|
|
35
34
|
import fieldMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/fieldMixin";
|
|
36
35
|
|
|
37
|
-
let selectFileText = "'" + translate('render.hint.selectFile') + "'"
|
|
38
|
-
|
|
39
36
|
export default {
|
|
40
37
|
name: "file-upload-widget",
|
|
41
38
|
componentName: 'FieldWidget', //必须固定为FieldWidget,用于接收父级组件的broadcast事件
|
|
42
|
-
mixins: [emitter, fieldMixin
|
|
39
|
+
mixins: [emitter, fieldMixin],
|
|
43
40
|
props: {
|
|
44
41
|
field: Object,
|
|
45
42
|
parentWidget: Object,
|
|
@@ -86,14 +83,14 @@
|
|
|
86
83
|
},
|
|
87
84
|
fileList: [], //上传文件列表
|
|
88
85
|
uploadBtnHidden: false,
|
|
89
|
-
|
|
90
|
-
styleVariables: {
|
|
91
|
-
'--select-file-action': selectFileText,
|
|
92
|
-
},
|
|
93
86
|
}
|
|
94
87
|
},
|
|
95
88
|
computed: {
|
|
96
|
-
|
|
89
|
+
styleVariables() {
|
|
90
|
+
return {
|
|
91
|
+
'--select-file-action': "' " + this.$t1('选择文件') + "'",
|
|
92
|
+
};
|
|
93
|
+
},
|
|
97
94
|
},
|
|
98
95
|
beforeCreate() {
|
|
99
96
|
/* 这里不能访问方法和属性!! */
|
|
@@ -121,7 +118,7 @@
|
|
|
121
118
|
methods: {
|
|
122
119
|
handleFileExceed() {
|
|
123
120
|
let uploadLimit = this.field.options.limit
|
|
124
|
-
this.$message.warning(
|
|
121
|
+
this.$message.warning(this.$t1('最大上传数量({p0})已超出.', { p0: uploadLimit }))
|
|
125
122
|
},
|
|
126
123
|
|
|
127
124
|
beforeFileUpload(file) {
|
|
@@ -136,7 +133,7 @@
|
|
|
136
133
|
}
|
|
137
134
|
}
|
|
138
135
|
if (!fileTypeCheckResult) {
|
|
139
|
-
this.$message.error(this
|
|
136
|
+
this.$message.error(this.$t1('不支持格式: {p0}', { p0: extFileName }))
|
|
140
137
|
return false;
|
|
141
138
|
}
|
|
142
139
|
|
|
@@ -147,7 +144,7 @@
|
|
|
147
144
|
}
|
|
148
145
|
fileSizeCheckResult = file.size / 1024 / 1024 <= uploadFileMaxSize
|
|
149
146
|
if (!fileSizeCheckResult) {
|
|
150
|
-
this.$message.error(this
|
|
147
|
+
this.$message.error(this.$t1('文件大小已超出: {p0}MB', { p0: uploadFileMaxSize }))
|
|
151
148
|
return false;
|
|
152
149
|
}
|
|
153
150
|
|
|
@@ -250,7 +247,7 @@
|
|
|
250
247
|
customFn.call(this, err, file, fileList)
|
|
251
248
|
} else {
|
|
252
249
|
this.$message({
|
|
253
|
-
message: this
|
|
250
|
+
message: this.$t1('上传错误: {p0}', { p0: err }),
|
|
254
251
|
duration: 3000,
|
|
255
252
|
type: 'error',
|
|
256
253
|
})
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
<template v-if="field.options.labelIconPosition === 'front'">
|
|
109
109
|
<template v-if="!!field.options.labelTooltip">
|
|
110
110
|
<el-tooltip
|
|
111
|
-
:content="field.options.labelTooltip"
|
|
111
|
+
:content="getI18nLabel(field.options.labelTooltip)"
|
|
112
112
|
effect="dark"
|
|
113
113
|
popper-class="label-tooltip-pre-line"
|
|
114
114
|
>
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
label
|
|
131
131
|
}}</span
|
|
132
132
|
><el-tooltip
|
|
133
|
-
:content="field.options.labelTooltip"
|
|
133
|
+
:content="getI18nLabel(field.options.labelTooltip)"
|
|
134
134
|
effect="dark"
|
|
135
135
|
popper-class="label-tooltip-pre-line"
|
|
136
136
|
>
|
package/src/components/xform/form-designer/form-widget/field-widget/picture-upload-widget.vue
CHANGED
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
methods: {
|
|
128
128
|
handlePictureExceed() {
|
|
129
129
|
let uploadLimit = this.field.options.limit
|
|
130
|
-
this.$message.warning(
|
|
130
|
+
this.$message.warning(this.$t1('最大上传数量({p0})已超出.', { p0: uploadLimit }))
|
|
131
131
|
},
|
|
132
132
|
|
|
133
133
|
handlePicturePreview(file) {
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
if (!fileTypeCheckResult) {
|
|
149
|
-
this.$message.error(this
|
|
149
|
+
this.$message.error(this.$t1('不支持格式: {p0}', { p0: file.type }))
|
|
150
150
|
return false;
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
}
|
|
158
158
|
fileSizeCheckResult = file.size / 1024 / 1024 <= uploadFileMaxSize
|
|
159
159
|
if (!fileSizeCheckResult) {
|
|
160
|
-
this.$message.error(this
|
|
160
|
+
this.$message.error(this.$t1('文件大小已超出: {p0}MB', { p0: uploadFileMaxSize }))
|
|
161
161
|
return false;
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
customFn.call(this, err, file, fileList)
|
|
247
247
|
} else {
|
|
248
248
|
this.$message({
|
|
249
|
-
message: this
|
|
249
|
+
message: this.$t1('上传错误: {p0}', { p0: err }),
|
|
250
250
|
duration: 3000,
|
|
251
251
|
type: 'error',
|
|
252
252
|
})
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
:parent-widget="parentWidget" :parent-list="parentList" :index-of-parent-list="indexOfParentList"
|
|
4
4
|
:sub-form-row-index="subFormRowIndex" :sub-form-col-index="subFormColIndex" :sub-form-row-id="subFormRowId">
|
|
5
5
|
<div ref="fieldEditor" :style="!!field.options.fontSize ? `font-size: ${field.options.fontSize};`: ''" :class="widgetClass">
|
|
6
|
-
<pre :style="{'white-space': !!field.options.preWrap ? 'pre-wrap' : 'pre', 'text-align': !!field.options.textAlign ? field.options.textAlign : 'left'}">{{field.options.textContent}}</pre></div>
|
|
6
|
+
<pre :style="{'white-space': !!field.options.preWrap ? 'pre-wrap' : 'pre', 'text-align': !!field.options.textAlign ? field.options.textAlign : 'left'}">{{getI18nLabel(field.options.textContent)}}</pre></div>
|
|
7
7
|
</static-content-wrapper>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:sub-form-row-index="subFormRowIndex" :sub-form-col-index="subFormColIndex" :sub-form-row-id="subFormRowId">
|
|
5
5
|
<el-switch ref="fieldEditor" v-model="fieldModel"
|
|
6
6
|
:disabled="field.options.disabled"
|
|
7
|
-
:active-text="field.options.activeText" :inactive-text="field.options.inactiveText"
|
|
7
|
+
:active-text="getI18nLabel(field.options.activeText)" :inactive-text="getI18nLabel(field.options.inactiveText)"
|
|
8
8
|
:active-color="field.options.activeColor" :inactive-color="field.options.inactiveColor"
|
|
9
9
|
:width="field.options.switchWidth"
|
|
10
10
|
@change="handleChangeEvent">
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
return rawValue;
|
|
93
93
|
}
|
|
94
94
|
return rawValue
|
|
95
|
-
? this.field.options.activeText
|
|
96
|
-
: this.field.options.inactiveText;
|
|
95
|
+
? this.getI18nLabel(this.field.options.activeText)
|
|
96
|
+
: this.getI18nLabel(this.field.options.inactiveText);
|
|
97
97
|
},
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<form-item-wrapper :designer="designer" :field="field" :rules="rules" :design-state="designState"
|
|
3
|
-
:parent-widget="parentWidget" :parent-list="parentList" :index-of-parent-list="indexOfParentList"
|
|
4
|
-
:sub-form-row-index="subFormRowIndex" :sub-form-col-index="subFormColIndex" :sub-form-row-id="subFormRowId">
|
|
5
|
-
<el-time-picker ref="fieldEditor" is-range v-model="fieldModel" class="full-width-input"
|
|
6
|
-
:disabled="field.options.disabled" :readonly="field.options.readonly"
|
|
7
|
-
:size="field.options.size"
|
|
8
|
-
:clearable="field.options.clearable" :editable="field.options.editable"
|
|
9
|
-
:format="field.options.format" value-format="HH:mm:ss"
|
|
10
|
-
:start-placeholder="field.options.startPlaceholder ||
|
|
11
|
-
:end-placeholder="field.options.endPlaceholder ||
|
|
12
|
-
@focus="handleFocusCustomEvent" @blur="handleBlurCustomEvent"
|
|
13
|
-
@change="handleChangeEvent">
|
|
14
|
-
</el-time-picker>
|
|
15
|
-
</form-item-wrapper>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script>
|
|
19
|
-
import FormItemWrapper from './form-item-wrapper'
|
|
20
|
-
import emitter from '../../../../../components/xform/utils/emitter'
|
|
21
|
-
import i18n from "../../../../../components/xform/utils/i18n";
|
|
22
|
-
import fieldMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/fieldMixin";
|
|
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";
|
|
25
|
-
|
|
26
|
-
export default {
|
|
27
|
-
name: "time-range-widget",
|
|
28
|
-
componentName: 'FieldWidget', //必须固定为FieldWidget,用于接收父级组件的broadcast事件
|
|
29
|
-
mixins: [emitter, fieldMixin, i18n, utcTransformMixin, relativeDefaultMixin],
|
|
30
|
-
props: {
|
|
31
|
-
field: Object,
|
|
32
|
-
parentWidget: Object,
|
|
33
|
-
parentList: Array,
|
|
34
|
-
indexOfParentList: Number,
|
|
35
|
-
designer: Object,
|
|
36
|
-
|
|
37
|
-
designState: {
|
|
38
|
-
type: Boolean,
|
|
39
|
-
default: false
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
subFormRowIndex: { /* 子表单组件行索引,从0开始计数 */
|
|
43
|
-
type: Number,
|
|
44
|
-
default: -1
|
|
45
|
-
},
|
|
46
|
-
subFormColIndex: { /* 子表单组件列索引,从0开始计数 */
|
|
47
|
-
type: Number,
|
|
48
|
-
default: -1
|
|
49
|
-
},
|
|
50
|
-
subFormRowId: { /* 子表单组件行Id,唯一id且不可变 */
|
|
51
|
-
type: String,
|
|
52
|
-
default: ''
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
components: {
|
|
57
|
-
FormItemWrapper,
|
|
58
|
-
},
|
|
59
|
-
inject: ['refList', 'globalOptionData', 'globalModel'],
|
|
60
|
-
data() {
|
|
61
|
-
return {
|
|
62
|
-
oldFieldValue: [], //field组件change之前的值
|
|
63
|
-
fieldModel: [],
|
|
64
|
-
rules: [],
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
computed: {
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
beforeCreate() {
|
|
71
|
-
/* 这里不能访问方法和属性!! */
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
created() {
|
|
75
|
-
/* 注意:子组件mounted在父组件created之后、父组件mounted之前触发,故子组件mounted需要用到的prop
|
|
76
|
-
需要在父组件created中初始化!! */
|
|
77
|
-
this.initRelativeFieldModel()
|
|
78
|
-
this.registerToRefList()
|
|
79
|
-
this.initEventHandler()
|
|
80
|
-
this.buildFieldRules()
|
|
81
|
-
|
|
82
|
-
this.handleOnCreated()
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
mounted() {
|
|
86
|
-
this.handleOnMounted()
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
beforeDestroy() {
|
|
90
|
-
this.unregisterFromRefList()
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
methods: {
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
</script>
|
|
98
|
-
|
|
99
|
-
<style lang="scss" scoped>
|
|
100
|
-
@import "~@base/styles/theme-variables.scss"; //* form-item-wrapper已引入,还需要重复引入吗? *//
|
|
101
|
-
|
|
102
|
-
.full-width-input {
|
|
103
|
-
width: 100% !important;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<form-item-wrapper :designer="designer" :field="field" :rules="rules" :design-state="designState"
|
|
3
|
+
:parent-widget="parentWidget" :parent-list="parentList" :index-of-parent-list="indexOfParentList"
|
|
4
|
+
:sub-form-row-index="subFormRowIndex" :sub-form-col-index="subFormColIndex" :sub-form-row-id="subFormRowId">
|
|
5
|
+
<el-time-picker ref="fieldEditor" is-range v-model="fieldModel" class="full-width-input"
|
|
6
|
+
:disabled="field.options.disabled" :readonly="field.options.readonly"
|
|
7
|
+
:size="field.options.size"
|
|
8
|
+
:clearable="field.options.clearable" :editable="field.options.editable"
|
|
9
|
+
:format="field.options.format" value-format="HH:mm:ss"
|
|
10
|
+
:start-placeholder="getI18nLabel(field.options.startPlaceholder || $t1('起始时间'))"
|
|
11
|
+
:end-placeholder="getI18nLabel(field.options.endPlaceholder || $t1('截止时间'))"
|
|
12
|
+
@focus="handleFocusCustomEvent" @blur="handleBlurCustomEvent"
|
|
13
|
+
@change="handleChangeEvent">
|
|
14
|
+
</el-time-picker>
|
|
15
|
+
</form-item-wrapper>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
import FormItemWrapper from './form-item-wrapper'
|
|
20
|
+
import emitter from '../../../../../components/xform/utils/emitter'
|
|
21
|
+
import i18n from "../../../../../components/xform/utils/i18n";
|
|
22
|
+
import fieldMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/fieldMixin";
|
|
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";
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
name: "time-range-widget",
|
|
28
|
+
componentName: 'FieldWidget', //必须固定为FieldWidget,用于接收父级组件的broadcast事件
|
|
29
|
+
mixins: [emitter, fieldMixin, i18n, utcTransformMixin, relativeDefaultMixin],
|
|
30
|
+
props: {
|
|
31
|
+
field: Object,
|
|
32
|
+
parentWidget: Object,
|
|
33
|
+
parentList: Array,
|
|
34
|
+
indexOfParentList: Number,
|
|
35
|
+
designer: Object,
|
|
36
|
+
|
|
37
|
+
designState: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
subFormRowIndex: { /* 子表单组件行索引,从0开始计数 */
|
|
43
|
+
type: Number,
|
|
44
|
+
default: -1
|
|
45
|
+
},
|
|
46
|
+
subFormColIndex: { /* 子表单组件列索引,从0开始计数 */
|
|
47
|
+
type: Number,
|
|
48
|
+
default: -1
|
|
49
|
+
},
|
|
50
|
+
subFormRowId: { /* 子表单组件行Id,唯一id且不可变 */
|
|
51
|
+
type: String,
|
|
52
|
+
default: ''
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
},
|
|
56
|
+
components: {
|
|
57
|
+
FormItemWrapper,
|
|
58
|
+
},
|
|
59
|
+
inject: ['refList', 'globalOptionData', 'globalModel'],
|
|
60
|
+
data() {
|
|
61
|
+
return {
|
|
62
|
+
oldFieldValue: [], //field组件change之前的值
|
|
63
|
+
fieldModel: [],
|
|
64
|
+
rules: [],
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
computed: {
|
|
68
|
+
|
|
69
|
+
},
|
|
70
|
+
beforeCreate() {
|
|
71
|
+
/* 这里不能访问方法和属性!! */
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
created() {
|
|
75
|
+
/* 注意:子组件mounted在父组件created之后、父组件mounted之前触发,故子组件mounted需要用到的prop
|
|
76
|
+
需要在父组件created中初始化!! */
|
|
77
|
+
this.initRelativeFieldModel()
|
|
78
|
+
this.registerToRefList()
|
|
79
|
+
this.initEventHandler()
|
|
80
|
+
this.buildFieldRules()
|
|
81
|
+
|
|
82
|
+
this.handleOnCreated()
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
mounted() {
|
|
86
|
+
this.handleOnMounted()
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
beforeDestroy() {
|
|
90
|
+
this.unregisterFromRefList()
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
methods: {
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</script>
|
|
98
|
+
|
|
99
|
+
<style lang="scss" scoped>
|
|
100
|
+
@import "~@base/styles/theme-variables.scss"; //* form-item-wrapper已引入,还需要重复引入吗? *//
|
|
101
|
+
|
|
102
|
+
.full-width-input {
|
|
103
|
+
width: 100% !important;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
</style>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<static-content-wrapper :designer="designer" :field="field" :design-state="designState"
|
|
3
3
|
:parent-widget="parentWidget" :parent-list="parentList" :index-of-parent-list="indexOfParentList"
|
|
4
4
|
:sub-form-row-index="subFormRowIndex" :sub-form-col-index="subFormColIndex" :sub-form-row-id="subFormRowId">
|
|
5
|
-
<div class="title" :class="field.options.styleTitClass"><b v-html="field.options.htmlContent"></b></div>
|
|
5
|
+
<div class="title" :class="field.options.styleTitClass"><b v-html="getI18nLabel(field.options.htmlContent)"></b></div>
|
|
6
6
|
</static-content-wrapper>
|
|
7
7
|
</template>
|
|
8
8
|
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
tabindex="0"
|
|
78
78
|
></i>
|
|
79
79
|
</div>
|
|
80
|
-
<div class="el-icon-tagEdit">
|
|
80
|
+
<div class="el-icon-tagEdit" v-if="field.options.showDownload !== false">
|
|
81
81
|
<el-tooltip
|
|
82
82
|
class="item"
|
|
83
83
|
effect="dark"
|
|
@@ -130,6 +130,7 @@ import i18n from "../../../../../components/xform/utils/i18n";
|
|
|
130
130
|
import fieldMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/fieldMixin";
|
|
131
131
|
import settingConfig from "@/settings.js";
|
|
132
132
|
|
|
133
|
+
const SINGLE_UPLOAD_API = "/api/v1.0/FileOperation/UploadFilesFromPortal";
|
|
133
134
|
const BATCH_UPLOAD_API = "/api/v1.0/FileOperation/BatchUploadFilesFromPortal";
|
|
134
135
|
/** 全部处理完显示 100 后,再停一会儿关闭加载。 */
|
|
135
136
|
const HX_UPLOAD_DONE_DELAY = 200;
|
|
@@ -145,17 +146,31 @@ function parseJsonValue(value) {
|
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
149
|
+
/**
|
|
150
|
+
* 单文件用 UploadFilesFromPortal,多文件用 BatchUploadFilesFromPortal。
|
|
151
|
+
* 配置只返回其中一个时,按名称推出另一个,不互相覆盖。
|
|
152
|
+
*/
|
|
153
|
+
function resolveHisenseUploadUrls(domain, uploadApi) {
|
|
154
|
+
const api = uploadApi || "";
|
|
155
|
+
const base = domain || "";
|
|
156
|
+
const isBatch = /BatchUploadFilesFromPortal/i.test(api);
|
|
157
|
+
const isSingle = !isBatch && /UploadFilesFromPortal/i.test(api);
|
|
158
|
+
let singleApi = api;
|
|
159
|
+
let batchApi = api;
|
|
160
|
+
if (isBatch) {
|
|
161
|
+
singleApi = api.replace(/BatchUploadFilesFromPortal/i, "UploadFilesFromPortal");
|
|
162
|
+
} else if (isSingle) {
|
|
163
|
+
batchApi = api.replace(/UploadFilesFromPortal/i, "BatchUploadFilesFromPortal");
|
|
164
|
+
} else if (!api) {
|
|
165
|
+
singleApi = SINGLE_UPLOAD_API;
|
|
166
|
+
batchApi = BATCH_UPLOAD_API;
|
|
167
|
+
} else {
|
|
168
|
+
batchApi = BATCH_UPLOAD_API;
|
|
157
169
|
}
|
|
158
|
-
return
|
|
170
|
+
return {
|
|
171
|
+
singleUploadUrl: base + singleApi,
|
|
172
|
+
batchUploadUrl: base + batchApi,
|
|
173
|
+
};
|
|
159
174
|
}
|
|
160
175
|
|
|
161
176
|
/** settings.hxFileLocalProxyEnabled 打开且处于 npm run dev 时,把海信绝对地址改写到本地 /hx-file。 */
|
|
@@ -179,17 +194,18 @@ function toDevProxyUrl(absoluteUrl) {
|
|
|
179
194
|
}
|
|
180
195
|
|
|
181
196
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
197
|
+
* 单上传 data 是一个文件对象。
|
|
198
|
+
* 批量上传外层 code=1000 只表示批次受理,再看每条明细的 code;外层非 1000 整批失败。
|
|
184
199
|
*/
|
|
185
200
|
function adaptHisenseBatchUploadResponse(responseData) {
|
|
186
201
|
const body = responseData || {};
|
|
187
202
|
const outerCode = Number(body.code);
|
|
188
203
|
const fail = (message) => ({
|
|
189
204
|
success: false,
|
|
190
|
-
message: message ||
|
|
205
|
+
message: message || "上传失败",
|
|
191
206
|
fullResponse: body,
|
|
192
207
|
data: null,
|
|
208
|
+
files: [],
|
|
193
209
|
});
|
|
194
210
|
if (outerCode !== 1000) {
|
|
195
211
|
return fail(body.message);
|
|
@@ -201,24 +217,35 @@ function adaptHisenseBatchUploadResponse(responseData) {
|
|
|
201
217
|
message: body.message || "ok",
|
|
202
218
|
fullResponse: body,
|
|
203
219
|
data: parsed,
|
|
220
|
+
files: [parsed],
|
|
204
221
|
};
|
|
205
222
|
}
|
|
206
223
|
if (!Array.isArray(parsed) || !parsed.length) {
|
|
207
224
|
return fail(body.message);
|
|
208
225
|
}
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
226
|
+
const files = [];
|
|
227
|
+
const errors = [];
|
|
228
|
+
parsed.forEach((item) => {
|
|
229
|
+
if (Number(item && item.code) !== 1000) {
|
|
230
|
+
errors.push((item && item.message) || body.message || "上传失败");
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
const fileInfo = parseJsonValue(item.data);
|
|
234
|
+
if (!fileInfo) {
|
|
235
|
+
errors.push((item && item.message) || body.message || "上传失败");
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
files.push(fileInfo);
|
|
239
|
+
});
|
|
240
|
+
if (!files.length) {
|
|
241
|
+
return fail(errors.filter(Boolean).join(";") || body.message);
|
|
216
242
|
}
|
|
217
243
|
return {
|
|
218
|
-
success:
|
|
219
|
-
message:
|
|
244
|
+
success: errors.length === 0,
|
|
245
|
+
message: errors.filter(Boolean).join(";") || "ok",
|
|
220
246
|
fullResponse: body,
|
|
221
|
-
data:
|
|
247
|
+
data: files[0],
|
|
248
|
+
files,
|
|
222
249
|
};
|
|
223
250
|
}
|
|
224
251
|
|
|
@@ -268,6 +295,8 @@ export default {
|
|
|
268
295
|
isH5: false,
|
|
269
296
|
|
|
270
297
|
uploadUrl: null,
|
|
298
|
+
singleUploadUrl: null,
|
|
299
|
+
batchUploadUrl: null,
|
|
271
300
|
|
|
272
301
|
token: null,
|
|
273
302
|
deleteUrl: null,
|
|
@@ -531,9 +560,10 @@ export default {
|
|
|
531
560
|
let token = objx.apiToken;
|
|
532
561
|
if (token) {
|
|
533
562
|
this.token = token;
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
);
|
|
563
|
+
const uploadUrls = resolveHisenseUploadUrls(objx.domain, objx.uploadApi);
|
|
564
|
+
this.singleUploadUrl = toDevProxyUrl(uploadUrls.singleUploadUrl);
|
|
565
|
+
this.batchUploadUrl = toDevProxyUrl(uploadUrls.batchUploadUrl);
|
|
566
|
+
this.uploadUrl = this.singleUploadUrl;
|
|
537
567
|
this.deleteUrl = toDevProxyUrl(objx.domain + objx.deleteApi);
|
|
538
568
|
// https://crm-dev.hisense.com/api/v1.0/fileoperation/GetFile?fileName=e24a1ad9-6821-41c3-957c-0916077bb97f.jpg
|
|
539
569
|
this.viewApiUrl = toDevProxyUrl(objx.domain + objx.viewApi);
|
|
@@ -588,156 +618,159 @@ export default {
|
|
|
588
618
|
Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000
|
|
589
619
|
);
|
|
590
620
|
},
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
let
|
|
607
|
-
|
|
608
|
-
var form = new FormData();
|
|
609
|
-
// 一个文件一次请求,索引固定为 0
|
|
610
|
-
const fieldPrefix = "requests[0].";
|
|
611
|
-
form.append(fieldPrefix + "File", fileObj);
|
|
612
|
-
|
|
613
|
-
let customParam = {};
|
|
614
|
-
let entityId = this.formDataId;
|
|
615
|
-
customParam = {
|
|
621
|
+
// 同一轮选择的文件先收齐:1 个走单上传,多个走一次批量上传
|
|
622
|
+
uploadSectionFile(param, isCustom, uploadConfig) {
|
|
623
|
+
if (!this.hxPendingUploads) {
|
|
624
|
+
this.hxPendingUploads = [];
|
|
625
|
+
}
|
|
626
|
+
this.hxPendingUploads.push({ param, isCustom, uploadConfig });
|
|
627
|
+
if (this.hxFlushScheduled) return;
|
|
628
|
+
this.hxFlushScheduled = true;
|
|
629
|
+
setTimeout(() => {
|
|
630
|
+
this.hxFlushScheduled = false;
|
|
631
|
+
const pending = this.hxPendingUploads.splice(0);
|
|
632
|
+
this.flushHxUpload(pending);
|
|
633
|
+
}, 0);
|
|
634
|
+
},
|
|
635
|
+
buildHxUploadParam(fileObj) {
|
|
636
|
+
let customParam = {
|
|
616
637
|
fileName: fileObj.name,
|
|
617
638
|
entityName: "msdyn_workorder",
|
|
618
|
-
entityId,
|
|
639
|
+
entityId: this.formDataId,
|
|
619
640
|
backendwriteback: "10",
|
|
620
641
|
fileCategory: "工单",
|
|
621
642
|
user: window.$vueRoot.$store.getters.nickName,
|
|
622
|
-
// user: "1",
|
|
623
643
|
};
|
|
624
644
|
let uploadParam =
|
|
625
645
|
this.handleCustomEvent(this.field.options.vabupload2_uploadParam) || {};
|
|
626
646
|
Object.assign(customParam, uploadParam);
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
let isLoading = uploadConfig?.isLoading === true;
|
|
643
|
-
var uploadUrl = this.uploadUrl;
|
|
647
|
+
return customParam;
|
|
648
|
+
},
|
|
649
|
+
appendHxUploadFields(form, fileObj, prefix) {
|
|
650
|
+
form.append(prefix ? prefix + "File" : "file", fileObj);
|
|
651
|
+
let customParam = this.buildHxUploadParam(fileObj);
|
|
652
|
+
Object.keys(customParam).forEach((key) => {
|
|
653
|
+
if (key === "file" || key === "File") return;
|
|
654
|
+
let fieldKey = prefix && key.indexOf("requests[") !== 0 ? prefix + key : key;
|
|
655
|
+
form.append(fieldKey, customParam[key]);
|
|
656
|
+
});
|
|
657
|
+
},
|
|
658
|
+
flushHxUpload(pending) {
|
|
659
|
+
if (!pending.length || this.componentDestroyed) return;
|
|
660
|
+
let isCustom = !!pending[0].isCustom;
|
|
661
|
+
let target = this.$refs.upload;
|
|
644
662
|
if (!isCustom && !this.showUploadBtn) {
|
|
645
663
|
target && target.clearFiles();
|
|
646
664
|
return;
|
|
647
665
|
}
|
|
648
|
-
target.clearFiles();
|
|
649
|
-
if (uploadUrl) {
|
|
650
|
-
let fileOrder = 0;
|
|
651
|
-
if (!isCustom) {
|
|
652
|
-
if (this.uploadingCount === 0) {
|
|
653
|
-
this.hxUploadTotal = 0;
|
|
654
|
-
this.openHxUploadLoading();
|
|
655
|
-
}
|
|
656
|
-
this.uploadingCount++;
|
|
657
|
-
this.hxUploadTotal++;
|
|
658
|
-
fileOrder = this.hxUploadTotal;
|
|
659
|
-
}
|
|
660
|
-
var abort;
|
|
666
|
+
target && target.clearFiles();
|
|
661
667
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
}), */
|
|
676
|
-
onUploadProgress: (progressEvent) => {
|
|
677
|
-
const percent = progressEvent.total
|
|
678
|
-
? Math.floor((progressEvent.loaded * 100) / progressEvent.total)
|
|
679
|
-
: 0;
|
|
680
|
-
if (isCustom || file) {
|
|
681
|
-
progressEvent.percent = percent;
|
|
682
|
-
}
|
|
683
|
-
if (!isCustom) {
|
|
684
|
-
this.setHxUploadProgress(fileOrder, percent);
|
|
685
|
-
}
|
|
686
|
-
},
|
|
687
|
-
failMsg: false,
|
|
688
|
-
}; //添加请求头
|
|
668
|
+
let fileObjs = pending.map((item) => item.param && item.param.file).filter(Boolean);
|
|
669
|
+
if (!isCustom && this.uploadLimit) {
|
|
670
|
+
let remain = this.uploadLimit - this.attachmentCount - this.uploadingCount;
|
|
671
|
+
if (remain <= 0) return;
|
|
672
|
+
fileObjs = fileObjs.slice(0, remain);
|
|
673
|
+
}
|
|
674
|
+
if (!fileObjs.length) return;
|
|
675
|
+
|
|
676
|
+
const batch = fileObjs.length > 1;
|
|
677
|
+
const uploadUrl = batch
|
|
678
|
+
? this.batchUploadUrl
|
|
679
|
+
: this.singleUploadUrl || this.uploadUrl;
|
|
680
|
+
if (!uploadUrl) return;
|
|
689
681
|
|
|
690
|
-
|
|
691
|
-
|
|
682
|
+
let customEnabled = this.customEnabled || false;
|
|
683
|
+
const form = new FormData();
|
|
684
|
+
fileObjs.forEach((fileObj, index) => {
|
|
685
|
+
this.appendHxUploadFields(form, fileObj, batch ? `requests[${index}].` : "");
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
let fileOrder = 0;
|
|
689
|
+
if (!isCustom) {
|
|
690
|
+
if (this.uploadingCount === 0) {
|
|
691
|
+
this.hxUploadTotal = 0;
|
|
692
|
+
this.openHxUploadLoading();
|
|
692
693
|
}
|
|
694
|
+
this.uploadingCount++;
|
|
695
|
+
this.hxUploadTotal++;
|
|
696
|
+
fileOrder = this.hxUploadTotal;
|
|
697
|
+
}
|
|
693
698
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
+
let config = {
|
|
700
|
+
useToken: false,
|
|
701
|
+
isLoading: false,
|
|
702
|
+
headers: {
|
|
703
|
+
"Content-Type": "multipart/form-data",
|
|
704
|
+
Authorization: `Bearer ${this.token}`,
|
|
705
|
+
},
|
|
706
|
+
onUploadProgress: (progressEvent) => {
|
|
707
|
+
const percent = progressEvent.total
|
|
708
|
+
? Math.floor((progressEvent.loaded * 100) / progressEvent.total)
|
|
709
|
+
: 0;
|
|
699
710
|
if (!isCustom) {
|
|
700
|
-
this.setHxUploadProgress(fileOrder,
|
|
711
|
+
this.setHxUploadProgress(fileOrder, percent);
|
|
701
712
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
713
|
+
},
|
|
714
|
+
failMsg: false,
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
if (customEnabled && config?.httpConfig) {
|
|
718
|
+
config = extendDeeply(config, config.httpConfig);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
this.enqueueHxUpload(() => {
|
|
722
|
+
if (this.componentDestroyed || !this.getFormRef()) {
|
|
723
|
+
this.finishHxUpload(!isCustom);
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
if (!isCustom) {
|
|
727
|
+
this.setHxUploadProgress(fileOrder, 0);
|
|
728
|
+
}
|
|
729
|
+
let batchDone = false;
|
|
730
|
+
return this.getFormRef()
|
|
731
|
+
.$http.post(uploadUrl, form, config)
|
|
732
|
+
.then((res1) => {
|
|
733
|
+
if (this.componentDestroyed) return;
|
|
734
|
+
const isLast = !isCustom && this.uploadingCount <= 1;
|
|
735
|
+
if (isLast) {
|
|
736
|
+
this.setHxUploadPercentText(99);
|
|
737
|
+
}
|
|
738
|
+
pending.forEach((item) => {
|
|
739
|
+
item.uploadConfig &&
|
|
740
|
+
item.uploadConfig.callback &&
|
|
741
|
+
item.uploadConfig.callback(res1, item.param && item.param.file);
|
|
742
|
+
});
|
|
712
743
|
|
|
713
|
-
|
|
744
|
+
const adaptedResponse = this.responseAdapter(res1);
|
|
745
|
+
const files = Array.isArray(adaptedResponse.files)
|
|
746
|
+
? adaptedResponse.files
|
|
747
|
+
: adaptedResponse.data
|
|
748
|
+
? [adaptedResponse.data]
|
|
749
|
+
: [];
|
|
714
750
|
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
this.closeHxUploadLoading();
|
|
730
|
-
}
|
|
731
|
-
// param.onError(new Error(res1.content || '上传异常'));
|
|
751
|
+
if (!isCustom) {
|
|
752
|
+
files.forEach((data) => {
|
|
753
|
+
this.appendUploadedFile({
|
|
754
|
+
...data,
|
|
755
|
+
showUrl: null,
|
|
756
|
+
});
|
|
757
|
+
});
|
|
758
|
+
if (files.length && adaptedResponse.success) {
|
|
759
|
+
batchDone = isLast;
|
|
760
|
+
} else {
|
|
761
|
+
if (isLast) {
|
|
762
|
+
this.closeHxUploadLoading();
|
|
763
|
+
}
|
|
764
|
+
if (adaptedResponse.message) {
|
|
732
765
|
this.$baseAlert(adaptedResponse.message);
|
|
733
766
|
}
|
|
734
767
|
}
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
}
|
|
768
|
+
}
|
|
769
|
+
})
|
|
770
|
+
.finally(() => {
|
|
771
|
+
return this.finishHxUpload(!isCustom, batchDone);
|
|
772
|
+
});
|
|
773
|
+
});
|
|
741
774
|
},
|
|
742
775
|
/**
|
|
743
776
|
* 同一控件内串行上传。上一次请求结束后立刻发下一次,
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
v-show="!widget.options.hidden">
|
|
6
6
|
<el-row class="header-row">
|
|
7
7
|
<div class="action-header-column">
|
|
8
|
-
<span class="action-label">{{
|
|
8
|
+
<span class="action-label">{{$t1('操作')}}</span>
|
|
9
9
|
<el-button :disabled="actionDisabled" round type="primary" size="mini" class="action-button" @click="addSubFormRow"
|
|
10
|
-
:title="
|
|
11
|
-
{{
|
|
10
|
+
:title="$t1('新增行')">
|
|
11
|
+
{{$t1('新增')}}<i class="el-icon-plus el-icon-right"></i></el-button>
|
|
12
12
|
</div>
|
|
13
13
|
<template v-for="(subWidget) in widget.widgetList">
|
|
14
14
|
<div :key="subWidget.id + 'thc'" class="field-header-column"
|
|
@@ -18,28 +18,28 @@
|
|
|
18
18
|
<template v-if="subWidget.options.labelIconPosition === 'front'">
|
|
19
19
|
<template v-if="!!subWidget.options.labelTooltip">
|
|
20
20
|
<el-tooltip
|
|
21
|
-
:content="subWidget.options.labelTooltip"
|
|
21
|
+
:content="getI18nLabel(subWidget.options.labelTooltip)"
|
|
22
22
|
effect="light"
|
|
23
23
|
popper-class="label-tooltip-pre-line"
|
|
24
24
|
>
|
|
25
|
-
<i :class="subWidget.options.labelIconClass"></i></el-tooltip>{{subWidget.options.label}}</template>
|
|
25
|
+
<i :class="subWidget.options.labelIconClass"></i></el-tooltip>{{getI18nLabel(subWidget.options.label)}}</template>
|
|
26
26
|
<template v-else>
|
|
27
|
-
<i :class="subWidget.options.labelIconClass"></i>{{subWidget.options.label}}</template>
|
|
27
|
+
<i :class="subWidget.options.labelIconClass"></i>{{getI18nLabel(subWidget.options.label)}}</template>
|
|
28
28
|
</template>
|
|
29
29
|
<template v-else-if="subWidget.options.labelIconPosition === 'rear'">
|
|
30
30
|
<template v-if="!!subWidget.options.labelTooltip">
|
|
31
|
-
{{subWidget.options.label}}<el-tooltip
|
|
32
|
-
:content="subWidget.options.labelTooltip"
|
|
31
|
+
{{getI18nLabel(subWidget.options.label)}}<el-tooltip
|
|
32
|
+
:content="getI18nLabel(subWidget.options.labelTooltip)"
|
|
33
33
|
effect="light"
|
|
34
34
|
popper-class="label-tooltip-pre-line"
|
|
35
35
|
>
|
|
36
36
|
<i :class="subWidget.options.labelIconClass"></i></el-tooltip></template>
|
|
37
37
|
<template v-else>
|
|
38
|
-
{{subWidget.options.label}}<i :class="subWidget.options.labelIconClass"></i></template>
|
|
38
|
+
{{getI18nLabel(subWidget.options.label)}}<i :class="subWidget.options.labelIconClass"></i></template>
|
|
39
39
|
</template>
|
|
40
40
|
</span>
|
|
41
41
|
<template v-else>
|
|
42
|
-
<span :title="subWidget.options.labelTooltip">{{subWidget.options.label}}</span></template>
|
|
42
|
+
<span :title="getI18nLabel(subWidget.options.labelTooltip)">{{getI18nLabel(subWidget.options.label)}}</span></template>
|
|
43
43
|
</div>
|
|
44
44
|
</template>
|
|
45
45
|
</el-row>
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
<div class="sub-form-action-column hide-label">
|
|
48
48
|
<div class="action-button-column">
|
|
49
49
|
<el-button :disabled="actionDisabled" circle type="" icon="el-icon-circle-plus-outline" @click="insertSubFormRow(sfrIdx)"
|
|
50
|
-
:title="
|
|
50
|
+
:title="$t1('插入行')"></el-button>
|
|
51
51
|
<el-button :disabled="actionDisabled" circle type="" icon="el-icon-delete" @click="deleteSubFormRow(sfrIdx)"
|
|
52
|
-
:title="
|
|
52
|
+
:title="$t1('删除行')"></el-button>
|
|
53
53
|
<span v-if="widget.options.showRowNumber" class="row-number-span">#{{sfrIdx+1}}</span>
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
@@ -267,9 +267,9 @@
|
|
|
267
267
|
},
|
|
268
268
|
|
|
269
269
|
deleteSubFormRow(formRowIndex) {
|
|
270
|
-
this.$confirm(this
|
|
271
|
-
confirmButtonText: this
|
|
272
|
-
cancelButtonText: this
|
|
270
|
+
this.$confirm(this.$t1('删除行?'), this.$t1('提示'), {
|
|
271
|
+
confirmButtonText: this.$t1('确定'),
|
|
272
|
+
cancelButtonText: this.$t1('取消')
|
|
273
273
|
}).then(() => {
|
|
274
274
|
let oldSubFormData = this.formModel[this.widget.options.name] || []
|
|
275
275
|
let deletedDataRow = deepClone(oldSubFormData[formRowIndex])
|