cloud-web-corejs 1.1.0-dev.83 → 1.1.0-dev.85
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/table/vxeFilter/mixin.js +326 -326
- 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 +2 -2
- 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 +185 -152
- package/src/components/xform/form-render/container-item/data-table-item.vue +1 -0
- package/src/components/xform/form-render/container-item/data-table-mixin.js +116 -0
- package/src/components/xform/form-render/container-item/sub-form-item.vue +15 -15
|
@@ -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
|
* 同一控件内串行上传。上一次请求结束后立刻发下一次,
|
|
@@ -348,8 +348,92 @@ modules = {
|
|
|
348
348
|
this.fieldSchemaMap = {};
|
|
349
349
|
this.rowIdData.splice(0, this.rowIdData.length);
|
|
350
350
|
this.unregisterFromRefList();
|
|
351
|
+
this.restoreFilterScroll();
|
|
351
352
|
},
|
|
352
353
|
methods: {
|
|
354
|
+
/**
|
|
355
|
+
* 只在列筛选弹层打开时,把表体撑到弹层底部。
|
|
356
|
+
* 空表不再把弹层裁在滚动区外面,详情区滚动条随之出现;关闭后收回。
|
|
357
|
+
*/
|
|
358
|
+
handleFilterVisible({ visible } = {}) {
|
|
359
|
+
this.restoreFilterScroll();
|
|
360
|
+
if (!visible) return;
|
|
361
|
+
this.$nextTick(() => {
|
|
362
|
+
this.$nextTick(() => this.expandFilterScroll());
|
|
363
|
+
});
|
|
364
|
+
},
|
|
365
|
+
expandFilterScroll() {
|
|
366
|
+
this.restoreFilterScroll();
|
|
367
|
+
let grid = this.getGridTable();
|
|
368
|
+
let panel =
|
|
369
|
+
grid &&
|
|
370
|
+
grid.$el &&
|
|
371
|
+
grid.$el.querySelector(".vxe-table--filter-wrapper.is--active");
|
|
372
|
+
let body =
|
|
373
|
+
grid &&
|
|
374
|
+
grid.$el &&
|
|
375
|
+
grid.$el.querySelector(".vxe-table--main-wrapper > .vxe-table--body-wrapper");
|
|
376
|
+
if (!panel || !body) return;
|
|
377
|
+
let options = this.widget.options || {};
|
|
378
|
+
let bounded = !!(options.tableHeight || options.isQueryTable);
|
|
379
|
+
let prevMinHeight = body.style.minHeight;
|
|
380
|
+
let overflow = Math.ceil(
|
|
381
|
+
panel.getBoundingClientRect().bottom - body.getBoundingClientRect().bottom + 8
|
|
382
|
+
);
|
|
383
|
+
if (!bounded && overflow > 1) {
|
|
384
|
+
body.style.minHeight = body.getBoundingClientRect().height + overflow + "px";
|
|
385
|
+
}
|
|
386
|
+
let scrollEl = null;
|
|
387
|
+
let delta = 0;
|
|
388
|
+
let scroller = this.findFilterScroller(panel);
|
|
389
|
+
if (scroller) {
|
|
390
|
+
let gap = Math.ceil(
|
|
391
|
+
panel.getBoundingClientRect().bottom -
|
|
392
|
+
scroller.getBoundingClientRect().bottom +
|
|
393
|
+
8
|
|
394
|
+
);
|
|
395
|
+
if (gap > 1) {
|
|
396
|
+
let maxScroll = Math.max(0, scroller.scrollHeight - scroller.clientHeight);
|
|
397
|
+
let nextTop = Math.min(scroller.scrollTop + gap, maxScroll);
|
|
398
|
+
delta = nextTop - scroller.scrollTop;
|
|
399
|
+
if (delta > 0) {
|
|
400
|
+
scroller.scrollTop = nextTop;
|
|
401
|
+
scrollEl = scroller;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
if ((!bounded && overflow > 1) || delta) {
|
|
406
|
+
this._filterScrollState = { body, prevMinHeight, scrollEl, delta };
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
findFilterScroller(panel) {
|
|
410
|
+
let node = panel.parentElement;
|
|
411
|
+
while (node && node !== document.documentElement) {
|
|
412
|
+
let overflowY = window.getComputedStyle(node).overflowY;
|
|
413
|
+
if (overflowY === "auto" || overflowY === "scroll") {
|
|
414
|
+
let gap =
|
|
415
|
+
panel.getBoundingClientRect().bottom - node.getBoundingClientRect().bottom;
|
|
416
|
+
let canScroll = node.scrollHeight > node.clientHeight + 1;
|
|
417
|
+
if (gap > 1 && canScroll && !this.filterScrollbarClipped(node)) return node;
|
|
418
|
+
}
|
|
419
|
+
node = node.parentElement;
|
|
420
|
+
}
|
|
421
|
+
return null;
|
|
422
|
+
},
|
|
423
|
+
filterScrollbarClipped(el) {
|
|
424
|
+
let parent = el.parentElement;
|
|
425
|
+
if (!parent) return false;
|
|
426
|
+
let overflowX = window.getComputedStyle(parent).overflowX;
|
|
427
|
+
if (overflowX !== "hidden" && overflowX !== "clip") return false;
|
|
428
|
+
return el.getBoundingClientRect().right > parent.getBoundingClientRect().right + 1;
|
|
429
|
+
},
|
|
430
|
+
restoreFilterScroll() {
|
|
431
|
+
let state = this._filterScrollState;
|
|
432
|
+
if (!state) return;
|
|
433
|
+
if (state.delta && state.scrollEl) state.scrollEl.scrollTop -= state.delta;
|
|
434
|
+
state.body.style.minHeight = state.prevMinHeight;
|
|
435
|
+
this._filterScrollState = null;
|
|
436
|
+
},
|
|
353
437
|
/** @param {String} reason 取消原因。取消当前普通查询并使旧响应失效。 */
|
|
354
438
|
cancelActiveTableQuery(reason = "query cancelled") {
|
|
355
439
|
this.tableQuerySeq += 1;
|
|
@@ -2663,6 +2747,33 @@ modules = {
|
|
|
2663
2747
|
}
|
|
2664
2748
|
return conditions;
|
|
2665
2749
|
},
|
|
2750
|
+
/**
|
|
2751
|
+
* 列里有多行输入时,算出能完整放下输入框的行高。
|
|
2752
|
+
* 表格默认行高 36px,多行框会被裁切,边框和拖拽角叠在一起。
|
|
2753
|
+
* @param {Array} columns VXE 列。
|
|
2754
|
+
* @returns {Number|null} 行高(px);没有多行输入列时返回 null。
|
|
2755
|
+
*/
|
|
2756
|
+
getTextareaColumnRowHeight(columns) {
|
|
2757
|
+
let maxRows = 0;
|
|
2758
|
+
const visit = (list) => {
|
|
2759
|
+
(list || []).forEach((col) => {
|
|
2760
|
+
const params = col.params || {};
|
|
2761
|
+
[params.widget, params.editWidget]
|
|
2762
|
+
.concat(params.widgetList || [])
|
|
2763
|
+
.forEach((widget) => {
|
|
2764
|
+
if (!widget || widget.type !== "textarea") return;
|
|
2765
|
+
const rows = Number(widget.options && widget.options.rows);
|
|
2766
|
+
maxRows = Math.max(maxRows, rows > 0 ? rows : 3);
|
|
2767
|
+
});
|
|
2768
|
+
if (col.children && col.children.length) visit(col.children);
|
|
2769
|
+
});
|
|
2770
|
+
};
|
|
2771
|
+
visit(columns);
|
|
2772
|
+
if (!maxRows) return null;
|
|
2773
|
+
// 12px 字、1.4 行高按每行 22px,再加输入框内边距、边框和单元格上下 2px。
|
|
2774
|
+
// 至少 52px:即使只配了 1 行,32px 的最小高度加上留白也放不进 36px 的行。
|
|
2775
|
+
return Math.max(maxRows * 22 + 16, 52);
|
|
2776
|
+
},
|
|
2666
2777
|
/**
|
|
2667
2778
|
* 将设计器列转换成 VXE 列,挂载展示/编辑插槽及列级格式化配置。
|
|
2668
2779
|
* 同时收集行级组件模板,供 fieldSchemaMap 为每行克隆独立 schema。
|
|
@@ -3424,6 +3535,11 @@ modules = {
|
|
|
3424
3535
|
let rowConfig = {};
|
|
3425
3536
|
if (this.widget.options.tableRowHeight) {
|
|
3426
3537
|
rowConfig.height = this.widget.options.tableRowHeight;
|
|
3538
|
+
} else {
|
|
3539
|
+
const textareaRowHeight = this.getTextareaColumnRowHeight(columns);
|
|
3540
|
+
if (textareaRowHeight) {
|
|
3541
|
+
rowConfig.height = textareaRowHeight;
|
|
3542
|
+
}
|
|
3427
3543
|
}
|
|
3428
3544
|
|
|
3429
3545
|
// 宿主经 dataTableOption.config 覆写时,treeConfig 必须深合并而不是整体
|
|
@@ -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])
|