cloud-web-corejs 1.0.295 → 1.0.297
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/errorMsg/index.vue +69 -8
- package/src/components/errorMsg/mixins.js +31 -0
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +10 -6
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +13 -3
- package/src/components/xform/form-render/container-item/data-table-item.vue +1 -1
- package/src/components/xform/form-render/container-item/data-table-mixin.js +49 -15
- package/src/components/xform/form-render/index.vue +1 -0
- package/src/components/xform/form-render/indexMixin.js +3 -0
- package/src/components/xform/styles/detail.scss +6 -0
- package/src/components/xform/utils/treeTableUtil.js +27 -0
- package/src/components/xform/utils/util.js +34 -0
- package/src/utils/request.js +89 -14
package/package.json
CHANGED
|
@@ -6,20 +6,27 @@
|
|
|
6
6
|
v-if="showWrap"
|
|
7
7
|
:close-on-click-modal="false"
|
|
8
8
|
width="501px"
|
|
9
|
-
custom-class="dialog-style tips-dialog error"
|
|
9
|
+
:custom-class="structuredDetail ? `dialog-style tips-dialog error error-message-dialog${showTextFlag ? ' is-detail' : ''}` : 'dialog-style tips-dialog error'"
|
|
10
10
|
:append-to-body="true"
|
|
11
11
|
:modal="false"
|
|
12
12
|
@close="closeDialog"
|
|
13
13
|
v-el-drag-dialog
|
|
14
14
|
>
|
|
15
15
|
<div class="cont">
|
|
16
|
-
<p v-if="!rmid">Error:</p>
|
|
16
|
+
<p v-if="!rmid && !errorLabel">Error:</p>
|
|
17
17
|
<p v-if="rmid">Error({{ rmid }}):</p>
|
|
18
|
+
<p v-if="!rmid && errorLabel">Error({{ errorLabel }}):</p>
|
|
18
19
|
<template v-if="!showTextFlag">
|
|
19
20
|
<p v-html="text1"></p>
|
|
20
21
|
</template>
|
|
21
|
-
<
|
|
22
|
-
|
|
22
|
+
<div v-if="showTextFlag && structuredDetail" class="error-detail-list">
|
|
23
|
+
<div v-for="(item, index) in detailItems" :key="index" class="error-detail-row" :class="{ 'is-summary': item.isSummary, 'is-section': item.isSection, 'is-cause': item.isCause }">
|
|
24
|
+
<span v-if="item.label" class="error-detail-label">{{ item.label }}</span>
|
|
25
|
+
<span v-if="item.value" class="error-detail-value">{{ item.value }}</span>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<p v-else-if="showTextFlag" class="error-detail-plain" v-html="text2"></p>
|
|
29
|
+
<a class="error-detail-toggle" href="javascript:void(0);" @click="showTextFlag = !showTextFlag">{{
|
|
23
30
|
!showTextFlag
|
|
24
31
|
? $t2("详情", "components.errorMsg.detail")
|
|
25
32
|
: $t2("收起", "components.errorMsg.collapse")
|
|
@@ -44,12 +51,19 @@
|
|
|
44
51
|
<i class="icon"></i>
|
|
45
52
|
<div class="cont">
|
|
46
53
|
<p class="name">{{ title }}</p>
|
|
47
|
-
<p class="txt" v-if="!rmid">Error:</p>
|
|
54
|
+
<p class="txt" v-if="!rmid && !errorLabel">Error:</p>
|
|
48
55
|
<p class="txt" v-if="rmid">Error({{ rmid }}):</p>
|
|
56
|
+
<p class="txt" v-if="!rmid && errorLabel">Error({{ errorLabel }}):</p>
|
|
49
57
|
<template v-if="!showTextFlag">
|
|
50
58
|
<p class="txt">{{ text1 }}</p>
|
|
51
59
|
</template>
|
|
52
|
-
<
|
|
60
|
+
<div v-if="showTextFlag && structuredDetail" class="error-detail-list">
|
|
61
|
+
<div v-for="(item, index) in detailItems" :key="index" class="error-detail-row" :class="{ 'is-summary': item.isSummary, 'is-section': item.isSection, 'is-cause': item.isCause }">
|
|
62
|
+
<span v-if="item.label" class="error-detail-label">{{ item.label }}</span>
|
|
63
|
+
<span v-if="item.value" class="error-detail-value">{{ item.value }}</span>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
<p class="txt" v-else-if="showTextFlag" v-html="text2"></p>
|
|
53
67
|
<a href="javascript:void(0);" @click="showTextFlag = !showTextFlag">{{
|
|
54
68
|
!showTextFlag
|
|
55
69
|
? $t2("详情", "components.errorMsg.detail")
|
|
@@ -70,9 +84,56 @@
|
|
|
70
84
|
import { mixins } from "./mixins";
|
|
71
85
|
|
|
72
86
|
export default {
|
|
73
|
-
|
|
87
|
+
name: "ErrorMessage",
|
|
74
88
|
mixins: [mixins],
|
|
75
89
|
};
|
|
76
90
|
</script>
|
|
77
91
|
|
|
78
|
-
<style
|
|
92
|
+
<style lang="scss">
|
|
93
|
+
.error-message-dialog {
|
|
94
|
+
.el-dialog__body .cont {
|
|
95
|
+
padding: 18px 20px 16px;
|
|
96
|
+
max-height: min(520px, calc(100vh - 190px));
|
|
97
|
+
}
|
|
98
|
+
&.is-detail .el-dialog__body:after { display: none; }
|
|
99
|
+
}
|
|
100
|
+
.error-detail-list {
|
|
101
|
+
overflow: hidden; border: 1px solid #dfe6f1; border-radius: 6px;
|
|
102
|
+
background: rgba(255, 255, 255, 0.86);
|
|
103
|
+
}
|
|
104
|
+
.error-detail-row {
|
|
105
|
+
display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 12px;
|
|
106
|
+
padding: 7px 12px; border-bottom: 1px solid #edf0f5;
|
|
107
|
+
line-height: 1.55; word-break: break-word;
|
|
108
|
+
&:last-child { border-bottom: 0; }
|
|
109
|
+
&.is-summary, &.is-section { display: block; }
|
|
110
|
+
&.is-summary {
|
|
111
|
+
padding: 10px 12px; background: #edf4ff; color: #315f91; font-weight: 600;
|
|
112
|
+
}
|
|
113
|
+
&.is-section {
|
|
114
|
+
padding: 9px 12px 5px; border-bottom: 0; color: #303133; font-weight: 600;
|
|
115
|
+
}
|
|
116
|
+
&.is-cause {
|
|
117
|
+
position: relative; display: block; padding: 4px 12px 4px 30px; border-bottom: 0;
|
|
118
|
+
&:before {
|
|
119
|
+
content: ""; position: absolute; top: 13px; left: 17px;
|
|
120
|
+
width: 4px; height: 4px; border-radius: 50%; background: #8ca5c2;
|
|
121
|
+
}
|
|
122
|
+
.error-detail-label { margin-right: 4px; }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
.error-detail-label { color: #606266; font-weight: 600; }
|
|
126
|
+
.error-detail-value { min-width: 0; color: #606266; }
|
|
127
|
+
.error-detail-toggle { display: inline-block; margin-top: 12px; }
|
|
128
|
+
.error-detail-plain { line-height: 1.65; word-break: break-word; }
|
|
129
|
+
.pop-tipsBox.error .error-detail-list {
|
|
130
|
+
max-height: 42vh; overflow: auto; text-align: left;
|
|
131
|
+
}
|
|
132
|
+
@media (max-width: 640px) {
|
|
133
|
+
.error-detail-row {
|
|
134
|
+
display: block;
|
|
135
|
+
.error-detail-label { display: block; margin-bottom: 2px; }
|
|
136
|
+
&.is-cause .error-detail-label { display: inline; }
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
</style>
|
|
@@ -14,6 +14,9 @@ tmixins = {
|
|
|
14
14
|
},
|
|
15
15
|
objx: Object,
|
|
16
16
|
_errorMsg: null,
|
|
17
|
+
errorLabel: {
|
|
18
|
+
default: "",
|
|
19
|
+
},
|
|
17
20
|
},
|
|
18
21
|
created() {
|
|
19
22
|
if (this.$baseEventBus.isMobile) {
|
|
@@ -26,6 +29,8 @@ tmixins = {
|
|
|
26
29
|
title: this.$t2("提示", "components.errorMsg.title"),
|
|
27
30
|
text1: "",
|
|
28
31
|
text2: "",
|
|
32
|
+
detailItems: [],
|
|
33
|
+
structuredDetail: false,
|
|
29
34
|
showWrap: false,
|
|
30
35
|
showTextFlag: false,
|
|
31
36
|
zIndex: null,
|
|
@@ -56,6 +61,26 @@ tmixins = {
|
|
|
56
61
|
if (!text) return text;
|
|
57
62
|
return text.replace(/(\r\n|\n|\r)/gm, "<br />");
|
|
58
63
|
},
|
|
64
|
+
getDetailItems(text) {
|
|
65
|
+
let inCauseSection = false;
|
|
66
|
+
return String(text || "")
|
|
67
|
+
.split(/\r\n|\n|\r/)
|
|
68
|
+
.filter((line) => line.trim())
|
|
69
|
+
.map((line, index) => {
|
|
70
|
+
const separatorIndex = line.search(/[::]/);
|
|
71
|
+
const label = separatorIndex >= 0 ? line.slice(0, separatorIndex) : "";
|
|
72
|
+
const value = separatorIndex >= 0 ? line.slice(separatorIndex + 1).trim() : line;
|
|
73
|
+
const isSection = label === "可能原因";
|
|
74
|
+
if (isSection) inCauseSection = true;
|
|
75
|
+
return {
|
|
76
|
+
label,
|
|
77
|
+
value,
|
|
78
|
+
isSection,
|
|
79
|
+
isSummary: index === 0 && separatorIndex < 0,
|
|
80
|
+
isCause: inCauseSection && !isSection,
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
},
|
|
59
84
|
showMsgBox: function () {
|
|
60
85
|
this.removeEnterEvent();
|
|
61
86
|
this.addEnterEvent();
|
|
@@ -79,8 +104,14 @@ tmixins = {
|
|
|
79
104
|
);
|
|
80
105
|
if (this._errorMsg) {
|
|
81
106
|
this.text2 = this.getShowText(this._errorMsg);
|
|
107
|
+
this.structuredDetail = /(^|\n)状态码[::]/.test(this._errorMsg);
|
|
108
|
+
this.detailItems = this.structuredDetail
|
|
109
|
+
? this.getDetailItems(this._errorMsg)
|
|
110
|
+
: [];
|
|
82
111
|
} else {
|
|
83
112
|
this.text2 = this.getShowText(content);
|
|
113
|
+
this.structuredDetail = false;
|
|
114
|
+
this.detailItems = [];
|
|
84
115
|
}
|
|
85
116
|
}
|
|
86
117
|
this.showTextFlag = false;
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
isArrayValueWidgetType,
|
|
12
12
|
isAttachmentWidgetType,
|
|
13
13
|
isEmptyArrayFieldValue,
|
|
14
|
+
resolveElementFormItemProp,
|
|
14
15
|
} from "../../../../../components/xform/utils/util";
|
|
15
16
|
import FormValidators, {
|
|
16
17
|
getRegExp,
|
|
@@ -346,19 +347,22 @@ modules = {
|
|
|
346
347
|
);
|
|
347
348
|
},
|
|
348
349
|
getPropName: function () {
|
|
350
|
+
let propName;
|
|
349
351
|
if (this.formItemProp) {
|
|
350
|
-
|
|
352
|
+
propName = this.formItemProp;
|
|
351
353
|
} else {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
+
propName =
|
|
355
|
+
this.subFormItemFlag && !this.designState
|
|
356
|
+
? this.subFormName +
|
|
354
357
|
"." +
|
|
355
358
|
this.subFormRowIndex +
|
|
356
359
|
"." +
|
|
357
360
|
this.fieldKeyName
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
+
: this.getObjectFieldFlag() && !this.designState
|
|
362
|
+
? this.getObjectName() + "." + this.fieldKeyName
|
|
363
|
+
: this.fieldKeyName;
|
|
361
364
|
}
|
|
365
|
+
return resolveElementFormItemProp(this.formModel, propName);
|
|
362
366
|
},
|
|
363
367
|
initFieldModel: function (flag) {
|
|
364
368
|
let e = this;
|
|
@@ -256,6 +256,7 @@ import i18n from "../../../../../components/xform/utils/i18n";
|
|
|
256
256
|
import {
|
|
257
257
|
getSubFormNameByFieldId,
|
|
258
258
|
isVabsearchMultiWidget,
|
|
259
|
+
resolveElementFormItemProp,
|
|
259
260
|
} from "../../../../../components/xform/utils/util";
|
|
260
261
|
import compareView from "../../../../../components/xform/form-render/compareView.vue";
|
|
261
262
|
import {
|
|
@@ -307,6 +308,7 @@ export default {
|
|
|
307
308
|
},
|
|
308
309
|
inject: {
|
|
309
310
|
getFormConfig: { default: () => () => ({}) },
|
|
311
|
+
globalModel: { default: () => ({ formModel: {} }) },
|
|
310
312
|
getSubFormFieldFlag: { default: () => () => false },
|
|
311
313
|
getSubFormName: { default: () => () => "" },
|
|
312
314
|
tableParam: { default: null },
|
|
@@ -559,6 +561,12 @@ export default {
|
|
|
559
561
|
getRules() {
|
|
560
562
|
return this.rules;
|
|
561
563
|
},
|
|
564
|
+
getFormModelForProp() {
|
|
565
|
+
return (this.globalModel && this.globalModel.formModel) || null;
|
|
566
|
+
},
|
|
567
|
+
resolveFormItemProp(propName) {
|
|
568
|
+
return resolveElementFormItemProp(this.getFormModelForProp(), propName);
|
|
569
|
+
},
|
|
562
570
|
getPropName() {
|
|
563
571
|
if (this.formItemProp === "false") {
|
|
564
572
|
return null;
|
|
@@ -568,12 +576,14 @@ export default {
|
|
|
568
576
|
// }
|
|
569
577
|
if (this.tableParam && !this.tableParam.$table?.$parent?.$parent) {
|
|
570
578
|
if (this.formItemProp) {
|
|
571
|
-
return this.formItemProp;
|
|
579
|
+
return this.resolveFormItemProp(this.formItemProp);
|
|
572
580
|
}
|
|
573
581
|
return null;
|
|
574
582
|
}
|
|
575
583
|
if (this.tableParam && !!this.tableParam.$table?.$parent?.$parent) {
|
|
576
|
-
return this.
|
|
584
|
+
return this.resolveFormItemProp(
|
|
585
|
+
this.getColumnProp(this.field, this.tableParam)
|
|
586
|
+
);
|
|
577
587
|
}
|
|
578
588
|
let o = this.field.options.name;
|
|
579
589
|
let propName =
|
|
@@ -586,7 +596,7 @@ export default {
|
|
|
586
596
|
? this.getObjectName() + "." + o
|
|
587
597
|
: o);
|
|
588
598
|
|
|
589
|
-
return propName;
|
|
599
|
+
return this.resolveFormItemProp(propName);
|
|
590
600
|
},
|
|
591
601
|
getFieldKeyName(widget) {
|
|
592
602
|
let o = widget.options.name;
|
|
@@ -70,6 +70,7 @@ import {
|
|
|
70
70
|
isTemporaryTreeKey,
|
|
71
71
|
syncTreeKeyReferences,
|
|
72
72
|
sanitizeTreeRow,
|
|
73
|
+
stripTreeContainers,
|
|
73
74
|
} from "../../utils/treeTableUtil";
|
|
74
75
|
import { tableTreeMixins } from "../../../../mixins/tableTree/index.js";
|
|
75
76
|
|
|
@@ -233,6 +234,15 @@ modules = {
|
|
|
233
234
|
customClass: function () {
|
|
234
235
|
return this.widget.options.customClass || "";
|
|
235
236
|
},
|
|
237
|
+
/**
|
|
238
|
+
* 查询表 / 配了 tableHeight 的表才跟父级对高度(内部滚动)。
|
|
239
|
+
* 详情里的树表没设高度时必须跟着行数长,滚动交给页面的 .d-cont,
|
|
240
|
+
* 否则 auto-resize 会把表格撑满视口,页面滚动条消失。
|
|
241
|
+
*/
|
|
242
|
+
tableAutoResize() {
|
|
243
|
+
let options = this.widget.options || {};
|
|
244
|
+
return !!(options.isQueryTable || options.tableHeight);
|
|
245
|
+
},
|
|
236
246
|
singleRowSelectFlag: function () {
|
|
237
247
|
return !this.widget.options.showCheckBox;
|
|
238
248
|
},
|
|
@@ -2701,7 +2711,7 @@ modules = {
|
|
|
2701
2711
|
}
|
|
2702
2712
|
: {}),
|
|
2703
2713
|
config: {
|
|
2704
|
-
height:
|
|
2714
|
+
...(height ? { height } : {}),
|
|
2705
2715
|
showFooter,
|
|
2706
2716
|
pagerConfig,
|
|
2707
2717
|
treeConfig,
|
|
@@ -3749,7 +3759,11 @@ modules = {
|
|
|
3749
3759
|
let nullValue = newData.hasOwnProperty(field)
|
|
3750
3760
|
? null
|
|
3751
3761
|
: this.getColumnNullValue(widget, defaultValueEnabled);
|
|
3752
|
-
|
|
3762
|
+
// 带点 keyName 是 lookup 嵌套路径。写成字面量键后,XEUtils.get 会命中
|
|
3763
|
+
// 这个 null,不再走进 msdyn_substatus.Name 这类对象取值。
|
|
3764
|
+
if (typeof field !== "string" || field.indexOf(".") === -1) {
|
|
3765
|
+
newData[field] = nullValue;
|
|
3766
|
+
}
|
|
3753
3767
|
if (this.isSingerlSearch(widget)) {
|
|
3754
3768
|
let vabSearchName = widget.options.vabSearchName;
|
|
3755
3769
|
if (vabSearchName) newData[vabSearchName] = null;
|
|
@@ -3786,7 +3800,7 @@ modules = {
|
|
|
3786
3800
|
} else {
|
|
3787
3801
|
if (widget) {
|
|
3788
3802
|
this.handleWidgetNullValue(widget, newData, defaultValueEnabled);
|
|
3789
|
-
} else {
|
|
3803
|
+
} else if (String(item.prop).indexOf(".") === -1) {
|
|
3790
3804
|
newData[item.prop] = null;
|
|
3791
3805
|
}
|
|
3792
3806
|
}
|
|
@@ -3831,7 +3845,7 @@ modules = {
|
|
|
3831
3845
|
let newData = this.createNewTableData();
|
|
3832
3846
|
tableRows.push(newData);
|
|
3833
3847
|
}
|
|
3834
|
-
this.setValue(tableRows);
|
|
3848
|
+
this.setValue(this.stripTreeContainerRows(tableRows));
|
|
3835
3849
|
this.$nextTick(() => {
|
|
3836
3850
|
this.handleWbs();
|
|
3837
3851
|
});
|
|
@@ -4815,7 +4829,7 @@ modules = {
|
|
|
4815
4829
|
await reconcileGrid.clearActived();
|
|
4816
4830
|
}
|
|
4817
4831
|
if (rebuildTreeAfterSave && !responseAlreadyApplied) {
|
|
4818
|
-
this.setValue(treeTableRows);
|
|
4832
|
+
this.setValue(this.stripTreeContainerRows(treeTableRows));
|
|
4819
4833
|
treeSnapshotApplied = true;
|
|
4820
4834
|
await new Promise((resolve) => this.$nextTick(resolve));
|
|
4821
4835
|
}
|
|
@@ -4987,7 +5001,7 @@ modules = {
|
|
|
4987
5001
|
} else {
|
|
4988
5002
|
tableRows.splice(0, 0, newRow);
|
|
4989
5003
|
}
|
|
4990
|
-
this.setValue(tableRows);
|
|
5004
|
+
this.setValue(this.stripTreeContainerRows(tableRows));
|
|
4991
5005
|
this.$nextTick(() => {
|
|
4992
5006
|
this.handleWbs();
|
|
4993
5007
|
if (isEditTable) {
|
|
@@ -5009,7 +5023,7 @@ modules = {
|
|
|
5009
5023
|
} else {
|
|
5010
5024
|
tableRows.splice(0, 0, newRow);
|
|
5011
5025
|
}
|
|
5012
|
-
this.setValue(tableRows);
|
|
5026
|
+
this.setValue(this.stripTreeContainerRows(tableRows));
|
|
5013
5027
|
this.$nextTick(() => {
|
|
5014
5028
|
this.handleWbs();
|
|
5015
5029
|
// setValue 已浅克隆所有行,obj.row 是失效引用,须按 _X_ROW_KEY 找回新行
|
|
@@ -5097,7 +5111,7 @@ modules = {
|
|
|
5097
5111
|
});
|
|
5098
5112
|
this.validateNewTreeRows(newRows, treeContext);
|
|
5099
5113
|
tableRows.push(...newRows);
|
|
5100
|
-
this.setValue(tableRows);
|
|
5114
|
+
this.setValue(this.stripTreeContainerRows(tableRows));
|
|
5101
5115
|
this.$nextTick(() => {
|
|
5102
5116
|
this.handleWbs();
|
|
5103
5117
|
if (parent) {
|
|
@@ -5106,6 +5120,26 @@ modules = {
|
|
|
5106
5120
|
}
|
|
5107
5121
|
});
|
|
5108
5122
|
},
|
|
5123
|
+
/**
|
|
5124
|
+
* 去掉 VXE 建树时写回行对象的容器字段(children / mapChildren)。
|
|
5125
|
+
*
|
|
5126
|
+
* 删除、排序这类「改扁平数组再整表重载」的操作必须先剥容器:容器是上一次
|
|
5127
|
+
* 渲染的产物,已被移出数组的节点仍挂在存活父行下,setValue 里的
|
|
5128
|
+
* canonicalizeTreeInput 会顺着容器把它们收回来,删除与排序因此静默失效。
|
|
5129
|
+
*
|
|
5130
|
+
* 只对 isTreeTable(强制 transform,父子关系由 parentField 表达)生效;
|
|
5131
|
+
* 靠 children 表达层级的表原样返回,剥掉会丢层级。
|
|
5132
|
+
* @param {Array} rows 取自表单模型的扁平活动行。
|
|
5133
|
+
* @returns {Array} 可安全交给 setValue 的行数组。
|
|
5134
|
+
*/
|
|
5135
|
+
stripTreeContainerRows(rows) {
|
|
5136
|
+
if (!this.widget.options.isTreeTable) {
|
|
5137
|
+
return rows || [];
|
|
5138
|
+
}
|
|
5139
|
+
return stripTreeContainers(rows || [], {
|
|
5140
|
+
fields: this.getTreeFields(),
|
|
5141
|
+
});
|
|
5142
|
+
},
|
|
5109
5143
|
/**
|
|
5110
5144
|
* 收集节点全部后代的 _X_ROW_KEY(不含节点自身)。
|
|
5111
5145
|
* 兼容嵌套结构(children 字段)与扁平结构(parentField 关联)两种数据形态。
|
|
@@ -5185,7 +5219,7 @@ modules = {
|
|
|
5185
5219
|
});
|
|
5186
5220
|
}
|
|
5187
5221
|
let newRows = tableRows.filter((item) => !delKeys.has(item._X_ROW_KEY));
|
|
5188
|
-
this.setValue(newRows);
|
|
5222
|
+
this.setValue(this.stripTreeContainerRows(newRows));
|
|
5189
5223
|
this.$nextTick(() => {
|
|
5190
5224
|
this.handleWbs();
|
|
5191
5225
|
});
|
|
@@ -5443,7 +5477,7 @@ modules = {
|
|
|
5443
5477
|
} else {
|
|
5444
5478
|
tableRows.splice(0, 0, newRow);
|
|
5445
5479
|
}
|
|
5446
|
-
this.setValue(tableRows);
|
|
5480
|
+
this.setValue(this.stripTreeContainerRows(tableRows));
|
|
5447
5481
|
this.$nextTick(() => {
|
|
5448
5482
|
this.handleWbs();
|
|
5449
5483
|
});
|
|
@@ -5460,7 +5494,7 @@ modules = {
|
|
|
5460
5494
|
} else {
|
|
5461
5495
|
tableRows.splice(0, 0, newRow);
|
|
5462
5496
|
}
|
|
5463
|
-
this.setValue(tableRows);
|
|
5497
|
+
this.setValue(this.stripTreeContainerRows(tableRows));
|
|
5464
5498
|
this.$nextTick(() => {
|
|
5465
5499
|
this.handleWbs();
|
|
5466
5500
|
// setValue 已浅克隆所有行,obj.row 是失效引用,须按 _X_ROW_KEY 找回新行
|
|
@@ -5657,7 +5691,7 @@ modules = {
|
|
|
5657
5691
|
);
|
|
5658
5692
|
tableRows.splice(currentIndex, 1);
|
|
5659
5693
|
tableRows.splice(prevIndex, 0, row);
|
|
5660
|
-
this.setValue(tableRows);
|
|
5694
|
+
this.setValue(this.stripTreeContainerRows(tableRows));
|
|
5661
5695
|
this.$nextTick(() => {
|
|
5662
5696
|
this.handleWbs();
|
|
5663
5697
|
});
|
|
@@ -5706,7 +5740,7 @@ modules = {
|
|
|
5706
5740
|
);
|
|
5707
5741
|
tableRows.splice(currentIndex, 1);
|
|
5708
5742
|
tableRows.splice(nextIndex, 0, row);
|
|
5709
|
-
this.setValue(tableRows);
|
|
5743
|
+
this.setValue(this.stripTreeContainerRows(tableRows));
|
|
5710
5744
|
this.$nextTick(() => {
|
|
5711
5745
|
this.handleWbs();
|
|
5712
5746
|
});
|
|
@@ -5783,7 +5817,7 @@ modules = {
|
|
|
5783
5817
|
rows.forEach((row, index1) => {
|
|
5784
5818
|
items.splice(index + index1, 0, row);
|
|
5785
5819
|
});
|
|
5786
|
-
this.setValue(items);
|
|
5820
|
+
this.setValue(this.stripTreeContainerRows(items));
|
|
5787
5821
|
this.$nextTick(() => {
|
|
5788
5822
|
this.handleWbs();
|
|
5789
5823
|
});
|
|
@@ -6123,7 +6157,7 @@ modules = {
|
|
|
6123
6157
|
if (this.designState) return;
|
|
6124
6158
|
this.$on("setFormData", (o) => {
|
|
6125
6159
|
let rows = this.formModel[this.fieldKeyName] || [];
|
|
6126
|
-
this.setValue(rows);
|
|
6160
|
+
this.setValue(this.stripTreeContainerRows(rows));
|
|
6127
6161
|
});
|
|
6128
6162
|
},
|
|
6129
6163
|
/** @param {Object} widget 组件 schema。@param {Array<String>} ignoreFields 忽略字段。@returns {Boolean} 是否处理禁用状态。 */
|
|
@@ -1827,6 +1827,9 @@ modules = {
|
|
|
1827
1827
|
let e = this;
|
|
1828
1828
|
this.$off("fieldValidation"),
|
|
1829
1829
|
this.$on("fieldValidation", function (t) {
|
|
1830
|
+
// 查询区带点 keyName 不会注册到 el-form-item,getPropName 为 null。
|
|
1831
|
+
// Element validateField(null) 会 warn「please pass correct props!」
|
|
1832
|
+
if (!t || !e.$refs.renderForm) return;
|
|
1830
1833
|
e.$refs.renderForm.validateField(t);
|
|
1831
1834
|
});
|
|
1832
1835
|
},
|
|
@@ -713,6 +713,33 @@ export const validateTreeGraph = (
|
|
|
713
713
|
};
|
|
714
714
|
};
|
|
715
715
|
|
|
716
|
+
/**
|
|
717
|
+
* 剥离 VXE 就地写在行对象上的树容器字段,返回浅拷贝。
|
|
718
|
+
*
|
|
719
|
+
* transform 模式下 vxe 用 XEUtils.toArrayTree 建树,会把子节点数组直接挂回行
|
|
720
|
+
* 对象(children 与 mapChildren 两份),而表单模型保存的正是这批活动行。删除 /
|
|
721
|
+
* 排序只改扁平数组、不动这些容器,容器里的引用随即成为过期快照:再经
|
|
722
|
+
* canonicalizeTreeInput 时会顺着它们把已删节点收回来、按旧顺序还原兄弟节点,
|
|
723
|
+
* 表现为「删除没效果」「上移下移没效果」且不报错。
|
|
724
|
+
*
|
|
725
|
+
* 扁平数据 + parentField 是树关系的唯一事实源,容器只是渲染产物,重建前一律剥掉。
|
|
726
|
+
* 注意:只适用于 transform 树表的活动行;靠 children 表达层级的嵌套输入不可调用。
|
|
727
|
+
* @param {Array} rows 取自表单模型的扁平活动行。
|
|
728
|
+
* @param {Object} options fields 为已解析的树字段。
|
|
729
|
+
* @returns {Array} 去掉容器字段的浅拷贝行数组。
|
|
730
|
+
*/
|
|
731
|
+
export const stripTreeContainers = (rows, { fields } = {}) => {
|
|
732
|
+
let resolvedFields = fields || resolveTreeFields();
|
|
733
|
+
if (!Array.isArray(rows)) return [];
|
|
734
|
+
return rows.map((row) => {
|
|
735
|
+
if (!isObject(row) || Array.isArray(row)) return row;
|
|
736
|
+
let next = { ...row };
|
|
737
|
+
delete next[resolvedFields.childrenField];
|
|
738
|
+
delete next[resolvedFields.mapChildrenField];
|
|
739
|
+
return next;
|
|
740
|
+
});
|
|
741
|
+
};
|
|
742
|
+
|
|
716
743
|
export const canonicalizeTreeInput = (
|
|
717
744
|
source,
|
|
718
745
|
{ fields, identityConfig, strict = true } = {}
|
|
@@ -121,6 +121,40 @@ export function isEmptyStr(str) {
|
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Element el-form-item 的 prop 按 '.' / '[]' 拆成嵌套路径,中间对象不存在会抛
|
|
126
|
+
* "please transfer a valid prop path to form item"。
|
|
127
|
+
* 本系统大量 keyName 是 Dynamics 风格字面量键(如 msdyn_reportedbycontact.fullname),
|
|
128
|
+
* 存在 model["a.b"] 上而不是 model.a.b,不能交给 el-form-item。
|
|
129
|
+
*/
|
|
130
|
+
export function isElementFormPropReachable(model, prop) {
|
|
131
|
+
if (prop == null || prop === "" || prop === false || prop === "false") {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
const path = String(prop);
|
|
135
|
+
if (path.indexOf(".") === -1 && path.indexOf("[") === -1) {
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
if (model == null || typeof model !== "object") {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
let tempObj = model;
|
|
142
|
+
const normalized = path.replace(/\[(\w+)\]/g, ".$1").replace(/^\./, "");
|
|
143
|
+
const keyArr = normalized.split(".");
|
|
144
|
+
for (let i = 0; i < keyArr.length - 1; i++) {
|
|
145
|
+
const key = keyArr[i];
|
|
146
|
+
if (tempObj == null || typeof tempObj !== "object" || !(key in tempObj)) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
tempObj = tempObj[key];
|
|
150
|
+
}
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function resolveElementFormItemProp(model, prop) {
|
|
155
|
+
return isElementFormPropReachable(model, prop) ? prop : null;
|
|
156
|
+
}
|
|
157
|
+
|
|
124
158
|
export const generateId = function () {
|
|
125
159
|
return Math.floor(
|
|
126
160
|
Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000
|
package/src/utils/request.js
CHANGED
|
@@ -111,7 +111,7 @@ service.interceptors.request.use(
|
|
|
111
111
|
}
|
|
112
112
|
);
|
|
113
113
|
|
|
114
|
-
function removeModel(config) {
|
|
114
|
+
function removeModel(config) {
|
|
115
115
|
if (config) {
|
|
116
116
|
if (config.modal !== false && config.ajaxOverlay) {
|
|
117
117
|
config.ajaxOverlay.remove();
|
|
@@ -123,7 +123,76 @@ function removeModel(config) {
|
|
|
123
123
|
}, 200);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function getSafeRequestUrl(config) {
|
|
129
|
+
if (!config || !config.url) return t1("未知");
|
|
130
|
+
const rawUrl = String(config.url).split("?")[0].split("#")[0];
|
|
131
|
+
const baseUrl = config.baseURL || "";
|
|
132
|
+
if (/^https?:\/\//i.test(rawUrl)) return rawUrl;
|
|
133
|
+
return `${baseUrl || ""}${rawUrl}` || t1("未知");
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function t1(path, values) {
|
|
137
|
+
const translate = Vue.prototype.$t1;
|
|
138
|
+
return typeof translate === "function" ? translate(path, values) : path;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function getRequestErrorMessage(error) {
|
|
142
|
+
const config = (error && error.config) || {};
|
|
143
|
+
const response = error && error.response;
|
|
144
|
+
const status = response && response.status;
|
|
145
|
+
const method = String(config.method || "GET").toUpperCase();
|
|
146
|
+
const requestUrl = getSafeRequestUrl(config);
|
|
147
|
+
const originalMessage = (error && error.message) || "未知错误";
|
|
148
|
+
let summary = t1("请求失败,请稍后重试。");
|
|
149
|
+
|
|
150
|
+
if (error && (error.code === "ECONNABORTED" || /timeout/i.test(originalMessage))) {
|
|
151
|
+
summary = t1("请求超时,请检查网络或稍后重试。");
|
|
152
|
+
} else if (!response) {
|
|
153
|
+
summary = t1("无法连接服务器,请检查网络、VPN/代理及服务状态后重试。");
|
|
154
|
+
} else if ([501, 502, 503, 504].includes(status)) {
|
|
155
|
+
summary = t1("网关或后端服务异常,请稍后重试或联系管理员。");
|
|
156
|
+
} else if (status >= 500) {
|
|
157
|
+
summary = t1("服务器暂时不可用,请稍后重试或联系管理员。");
|
|
158
|
+
} else if (status === 404) {
|
|
159
|
+
summary = t1("请求的服务地址不存在,请联系管理员检查接口配置。");
|
|
160
|
+
} else if (status === 403) {
|
|
161
|
+
summary = t1("服务器拒绝了本次请求,请检查访问权限。");
|
|
162
|
+
} else if (status === 401) {
|
|
163
|
+
summary = t1("登录状态已失效或无效,请重新登录。");
|
|
164
|
+
} else if (status >= 400) {
|
|
165
|
+
summary = t1("服务器未能处理本次请求,请检查输入后重试。");
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const details = [
|
|
169
|
+
summary,
|
|
170
|
+
t1("请求:{method} {url}", { method, url: requestUrl }),
|
|
171
|
+
t1("状态码:{status}", {
|
|
172
|
+
status: status || t1("未收到服务器响应(浏览器未提供 HTTP 状态码)"),
|
|
173
|
+
}),
|
|
174
|
+
t1("错误码:{code}", { code: (error && error.code) || t1("无") }),
|
|
175
|
+
t1("原始错误:{message}", { message: originalMessage }),
|
|
176
|
+
t1("发生时间:{time}", { time: new Date().toLocaleString() }),
|
|
177
|
+
];
|
|
178
|
+
|
|
179
|
+
if (!response) {
|
|
180
|
+
details.push(t1("可能原因:"));
|
|
181
|
+
details.push(t1("ERR_CONNECTION_RESET:连接被服务端、网关或安全设备重置;"));
|
|
182
|
+
details.push(t1("CORS:浏览器跨域配置异常;"));
|
|
183
|
+
details.push(t1("ERR_CERT_*:HTTPS 证书异常;"));
|
|
184
|
+
details.push(t1("请求长期 Pending:接口阻塞或连接未释放。"));
|
|
185
|
+
details.push(t1("实际 HTTP 状态码请在浏览器 Network 面板或网关日志中确认。"));
|
|
186
|
+
} else if ([501, 502, 503, 504].includes(status)) {
|
|
187
|
+
details.push(t1("501/502/503/504:网关或后端服务异常。"));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
summary,
|
|
192
|
+
details: details.join("\n"),
|
|
193
|
+
errorLabel: !response ? originalMessage : "",
|
|
194
|
+
};
|
|
195
|
+
}
|
|
127
196
|
|
|
128
197
|
async function handleNickName(option) {
|
|
129
198
|
let { vueTarget, res, callback, config } = option;
|
|
@@ -419,18 +488,24 @@ service.interceptors.response.use(
|
|
|
419
488
|
if (config.modalStrictly !== true) {
|
|
420
489
|
removeModel(config);
|
|
421
490
|
}
|
|
422
|
-
if (config.errorMsg !== false) {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
491
|
+
if (config.errorMsg !== false) {
|
|
492
|
+
const requestError = getRequestErrorMessage(error);
|
|
493
|
+
ErroreBox.msg({
|
|
494
|
+
content: requestError.summary,
|
|
495
|
+
_errorMsg: requestError.details,
|
|
496
|
+
errorLabel: requestError.errorLabel,
|
|
497
|
+
type: "error",
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
} else {
|
|
501
|
+
const requestError = getRequestErrorMessage(error);
|
|
502
|
+
ErroreBox.msg({
|
|
503
|
+
content: requestError.summary,
|
|
504
|
+
_errorMsg: requestError.details,
|
|
505
|
+
errorLabel: requestError.errorLabel,
|
|
506
|
+
type: "error",
|
|
507
|
+
});
|
|
508
|
+
}
|
|
434
509
|
}
|
|
435
510
|
return Promise.reject(error);
|
|
436
511
|
}
|