cloud-web-corejs 1.1.0-dev.42 → 1.1.0-dev.44
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 +2 -6
- package/src/components/errorMsg/mixins.js +22 -0
- package/src/components/onlineTalk/mixins.js +10 -7
- 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-mixin.js +6 -2
- package/src/components/xform/form-render/indexMixin.js +3 -0
- package/src/components/xform/utils/util.js +34 -0
- package/src/utils/request.js +123 -100
- package/src/views/user/home/default.vue +2 -2
- package/src/views/user/home/default2.vue +2 -2
- package/src/views/user/user/list.vue +28 -6
package/package.json
CHANGED
|
@@ -13,9 +13,7 @@
|
|
|
13
13
|
v-el-drag-dialog
|
|
14
14
|
>
|
|
15
15
|
<div class="cont">
|
|
16
|
-
<p
|
|
17
|
-
<p v-if="rmid">Error({{ rmid }}):</p>
|
|
18
|
-
<p v-if="!rmid && errorLabel">Error({{ errorLabel }}):</p>
|
|
16
|
+
<p>{{ errorTitle }}</p>
|
|
19
17
|
<template v-if="!showTextFlag">
|
|
20
18
|
<p v-html="text1"></p>
|
|
21
19
|
</template>
|
|
@@ -56,9 +54,7 @@
|
|
|
56
54
|
<i class="icon"></i>
|
|
57
55
|
<div class="cont">
|
|
58
56
|
<p class="name">{{ title }}</p>
|
|
59
|
-
<p class="txt"
|
|
60
|
-
<p class="txt" v-if="rmid">Error({{ rmid }}):</p>
|
|
61
|
-
<p class="txt" v-if="!rmid && errorLabel">Error({{ errorLabel }}):</p>
|
|
57
|
+
<p class="txt">{{ errorTitle }}</p>
|
|
62
58
|
<template v-if="!showTextFlag">
|
|
63
59
|
<p class="txt">{{ text1 }}</p>
|
|
64
60
|
</template>
|
|
@@ -33,9 +33,21 @@ tmixins = {
|
|
|
33
33
|
structuredDetail: false,
|
|
34
34
|
showWrap: false,
|
|
35
35
|
showTextFlag: false,
|
|
36
|
+
displayErrorLabel: "",
|
|
36
37
|
zIndex: null,
|
|
37
38
|
};
|
|
38
39
|
},
|
|
40
|
+
computed: {
|
|
41
|
+
errorTitle() {
|
|
42
|
+
if (this.rmid) return `Error(${this.rmid}):`;
|
|
43
|
+
if (!this.displayErrorLabel) return "Error:";
|
|
44
|
+
if (this.isNetworkErrorLabel) return `${this.displayErrorLabel}:`;
|
|
45
|
+
return `Error(${this.displayErrorLabel}):`;
|
|
46
|
+
},
|
|
47
|
+
isNetworkErrorLabel() {
|
|
48
|
+
return /^network error$/i.test(String(this.displayErrorLabel).trim());
|
|
49
|
+
},
|
|
50
|
+
},
|
|
39
51
|
beforeDestroy() {
|
|
40
52
|
this.removeEnterEvent();
|
|
41
53
|
},
|
|
@@ -61,6 +73,11 @@ tmixins = {
|
|
|
61
73
|
if (!text) return text;
|
|
62
74
|
return text.replace(/(\r\n|\n|\r)/gm, "<br />");
|
|
63
75
|
},
|
|
76
|
+
getHttpStatusCode(detailItems) {
|
|
77
|
+
const item = (detailItems || []).find((row) => row.label === "状态码");
|
|
78
|
+
const value = item && String(item.value).trim();
|
|
79
|
+
return /^\d{3}$/.test(value) ? value : "";
|
|
80
|
+
},
|
|
64
81
|
getDetailItems(text) {
|
|
65
82
|
let inCauseSection = false;
|
|
66
83
|
return String(text || "")
|
|
@@ -113,7 +130,12 @@ tmixins = {
|
|
|
113
130
|
this.structuredDetail = false;
|
|
114
131
|
this.detailItems = [];
|
|
115
132
|
}
|
|
133
|
+
} else {
|
|
134
|
+
this.detailItems = [];
|
|
135
|
+
this.structuredDetail = false;
|
|
116
136
|
}
|
|
137
|
+
this.displayErrorLabel =
|
|
138
|
+
this.errorLabel || this.getHttpStatusCode(this.detailItems) || "";
|
|
117
139
|
this.showTextFlag = false;
|
|
118
140
|
this.showWrap = true;
|
|
119
141
|
this.promise = new Promise((resolve, reject) => {
|
|
@@ -272,7 +272,7 @@ tmixins = {
|
|
|
272
272
|
}
|
|
273
273
|
});
|
|
274
274
|
},
|
|
275
|
-
getUserPage(flag) {
|
|
275
|
+
getUserPage(flag, silent) {
|
|
276
276
|
if (!this.dialogTableVisible) return
|
|
277
277
|
if (!this.inited) {
|
|
278
278
|
flag = null;
|
|
@@ -284,6 +284,7 @@ tmixins = {
|
|
|
284
284
|
method: `post`,
|
|
285
285
|
data: {operateTime: time},
|
|
286
286
|
modal: false,
|
|
287
|
+
...(silent ? { ignoreNetworkError: true } : {}),
|
|
287
288
|
success: res => {
|
|
288
289
|
let records = res.objx || [];
|
|
289
290
|
records.forEach(record => {
|
|
@@ -368,7 +369,7 @@ tmixins = {
|
|
|
368
369
|
}
|
|
369
370
|
return lastTalkRecordId;
|
|
370
371
|
},
|
|
371
|
-
getList(direction, callback) {
|
|
372
|
+
getList(direction, callback, silent) {
|
|
372
373
|
if (!this.dialogTableVisible) return
|
|
373
374
|
if (!this.talkUserId) return
|
|
374
375
|
let talkUser = this.talkUser;
|
|
@@ -387,6 +388,7 @@ tmixins = {
|
|
|
387
388
|
direction: direction
|
|
388
389
|
},
|
|
389
390
|
modal: false,
|
|
391
|
+
...(silent ? { ignoreNetworkError: true } : {}),
|
|
390
392
|
success: res => {
|
|
391
393
|
let rows = res.objx || [];
|
|
392
394
|
if (rows.length) {
|
|
@@ -456,15 +458,15 @@ tmixins = {
|
|
|
456
458
|
createTimerHandle() {
|
|
457
459
|
this.clearTimerHandle();
|
|
458
460
|
this.handleExitsRead();
|
|
459
|
-
this.talkHandle();
|
|
461
|
+
this.talkHandle(true);
|
|
460
462
|
this.timer = setInterval(() => {
|
|
461
463
|
this.handleExitsRead();
|
|
462
|
-
this.talkHandle();
|
|
464
|
+
this.talkHandle(true);
|
|
463
465
|
}, 10000)
|
|
464
466
|
},
|
|
465
|
-
talkHandle() {
|
|
466
|
-
this.getUserPage(1);
|
|
467
|
-
this.getList(0);
|
|
467
|
+
talkHandle(silent) {
|
|
468
|
+
this.getUserPage(1, silent);
|
|
469
|
+
this.getList(0, null, silent);
|
|
468
470
|
},
|
|
469
471
|
clearTimerHandle() {
|
|
470
472
|
if (this.timer) {
|
|
@@ -488,6 +490,7 @@ tmixins = {
|
|
|
488
490
|
method: `post`,
|
|
489
491
|
data: {},
|
|
490
492
|
modal: false,
|
|
493
|
+
ignoreNetworkError: true,
|
|
491
494
|
success: res => {
|
|
492
495
|
this.isExitsRead = res.objx === 1;
|
|
493
496
|
}
|
|
@@ -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,
|
|
@@ -366,19 +367,22 @@ modules = {
|
|
|
366
367
|
);
|
|
367
368
|
},
|
|
368
369
|
getPropName: function () {
|
|
370
|
+
let propName;
|
|
369
371
|
if (this.formItemProp) {
|
|
370
|
-
|
|
372
|
+
propName = this.formItemProp;
|
|
371
373
|
} else {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
+
propName =
|
|
375
|
+
this.subFormItemFlag && !this.designState
|
|
376
|
+
? this.subFormName +
|
|
374
377
|
"." +
|
|
375
378
|
this.subFormRowIndex +
|
|
376
379
|
"." +
|
|
377
380
|
this.fieldKeyName
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
+
: this.getObjectFieldFlag() && !this.designState
|
|
382
|
+
? this.getObjectName() + "." + this.fieldKeyName
|
|
383
|
+
: this.fieldKeyName;
|
|
381
384
|
}
|
|
385
|
+
return resolveElementFormItemProp(this.formModel, propName);
|
|
382
386
|
},
|
|
383
387
|
initFieldModel: function (flag) {
|
|
384
388
|
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 },
|
|
@@ -567,6 +569,12 @@ export default {
|
|
|
567
569
|
getRules() {
|
|
568
570
|
return this.rules;
|
|
569
571
|
},
|
|
572
|
+
getFormModelForProp() {
|
|
573
|
+
return (this.globalModel && this.globalModel.formModel) || null;
|
|
574
|
+
},
|
|
575
|
+
resolveFormItemProp(propName) {
|
|
576
|
+
return resolveElementFormItemProp(this.getFormModelForProp(), propName);
|
|
577
|
+
},
|
|
570
578
|
getPropName() {
|
|
571
579
|
if (this.formItemProp === "false") {
|
|
572
580
|
return null;
|
|
@@ -576,12 +584,14 @@ export default {
|
|
|
576
584
|
// }
|
|
577
585
|
if (this.tableParam && !this.tableParam.$table?.$parent?.$parent) {
|
|
578
586
|
if (this.formItemProp) {
|
|
579
|
-
return this.formItemProp;
|
|
587
|
+
return this.resolveFormItemProp(this.formItemProp);
|
|
580
588
|
}
|
|
581
589
|
return null;
|
|
582
590
|
}
|
|
583
591
|
if (this.tableParam && !!this.tableParam.$table?.$parent?.$parent) {
|
|
584
|
-
return this.
|
|
592
|
+
return this.resolveFormItemProp(
|
|
593
|
+
this.getColumnProp(this.field, this.tableParam)
|
|
594
|
+
);
|
|
585
595
|
}
|
|
586
596
|
let o = this.field.options.name;
|
|
587
597
|
let propName =
|
|
@@ -594,7 +604,7 @@ export default {
|
|
|
594
604
|
? this.getObjectName() + "." + o
|
|
595
605
|
: o);
|
|
596
606
|
|
|
597
|
-
return propName;
|
|
607
|
+
return this.resolveFormItemProp(propName);
|
|
598
608
|
},
|
|
599
609
|
getFieldKeyName(widget) {
|
|
600
610
|
let o = widget.options.name;
|
|
@@ -4234,7 +4234,11 @@ modules = {
|
|
|
4234
4234
|
let nullValue = newData.hasOwnProperty(field)
|
|
4235
4235
|
? null
|
|
4236
4236
|
: this.getColumnNullValue(widget, defaultValueEnabled);
|
|
4237
|
-
|
|
4237
|
+
// 带点 keyName 是 lookup 嵌套路径。写成字面量键后,XEUtils.get 会命中
|
|
4238
|
+
// 这个 null,不再走进 msdyn_substatus.Name 这类对象取值。
|
|
4239
|
+
if (typeof field !== "string" || field.indexOf(".") === -1) {
|
|
4240
|
+
newData[field] = nullValue;
|
|
4241
|
+
}
|
|
4238
4242
|
if (this.isSingerlSearch(widget)) {
|
|
4239
4243
|
let vabSearchName = widget.options.vabSearchName;
|
|
4240
4244
|
if (vabSearchName) newData[vabSearchName] = null;
|
|
@@ -4271,7 +4275,7 @@ modules = {
|
|
|
4271
4275
|
} else {
|
|
4272
4276
|
if (widget) {
|
|
4273
4277
|
this.handleWidgetNullValue(widget, newData, defaultValueEnabled);
|
|
4274
|
-
} else {
|
|
4278
|
+
} else if (String(item.prop).indexOf(".") === -1) {
|
|
4275
4279
|
newData[item.prop] = null;
|
|
4276
4280
|
}
|
|
4277
4281
|
}
|
|
@@ -1871,6 +1871,9 @@ modules = {
|
|
|
1871
1871
|
let e = this;
|
|
1872
1872
|
this.$off("fieldValidation"),
|
|
1873
1873
|
this.$on("fieldValidation", function (t) {
|
|
1874
|
+
// 查询区带点 keyName 不会注册到 el-form-item,getPropName 为 null。
|
|
1875
|
+
// Element validateField(null) 会 warn「please pass correct props!」
|
|
1876
|
+
if (!t || !e.$refs.renderForm) return;
|
|
1874
1877
|
e.$refs.renderForm.validateField(t);
|
|
1875
1878
|
});
|
|
1876
1879
|
},
|
|
@@ -141,6 +141,40 @@ export function isEmptyStr(str) {
|
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Element el-form-item 的 prop 按 '.' / '[]' 拆成嵌套路径,中间对象不存在会抛
|
|
146
|
+
* "please transfer a valid prop path to form item"。
|
|
147
|
+
* 本系统大量 keyName 是 Dynamics 风格字面量键(如 msdyn_reportedbycontact.fullname),
|
|
148
|
+
* 存在 model["a.b"] 上而不是 model.a.b,不能交给 el-form-item。
|
|
149
|
+
*/
|
|
150
|
+
export function isElementFormPropReachable(model, prop) {
|
|
151
|
+
if (prop == null || prop === "" || prop === false || prop === "false") {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
const path = String(prop);
|
|
155
|
+
if (path.indexOf(".") === -1 && path.indexOf("[") === -1) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
if (model == null || typeof model !== "object") {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
let tempObj = model;
|
|
162
|
+
const normalized = path.replace(/\[(\w+)\]/g, ".$1").replace(/^\./, "");
|
|
163
|
+
const keyArr = normalized.split(".");
|
|
164
|
+
for (let i = 0; i < keyArr.length - 1; i++) {
|
|
165
|
+
const key = keyArr[i];
|
|
166
|
+
if (tempObj == null || typeof tempObj !== "object" || !(key in tempObj)) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
tempObj = tempObj[key];
|
|
170
|
+
}
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function resolveElementFormItemProp(model, prop) {
|
|
175
|
+
return isElementFormPropReachable(model, prop) ? prop : null;
|
|
176
|
+
}
|
|
177
|
+
|
|
144
178
|
export const generateId = function () {
|
|
145
179
|
return Math.floor(
|
|
146
180
|
Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000
|
package/src/utils/request.js
CHANGED
|
@@ -8,8 +8,8 @@ import ErroreBox from "../components/errorMsg/index.js";
|
|
|
8
8
|
import PopupManager from "element-ui/src/utils/popup/popup-manager.js";
|
|
9
9
|
import settingConfig from "@/settings.js";
|
|
10
10
|
import { encode } from "js-base64";
|
|
11
|
-
import { encrypt } from "@base/utils/aes";
|
|
12
|
-
import { handleRequestNetworkError } from "@base/utils/runtimeRecovery";
|
|
11
|
+
import { encrypt } from "@base/utils/aes";
|
|
12
|
+
import { handleRequestNetworkError } from "@base/utils/runtimeRecovery";
|
|
13
13
|
|
|
14
14
|
let configUtil = {
|
|
15
15
|
baseUrl: process.env.VUE_APP_BASE_API,
|
|
@@ -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,76 +123,96 @@ function removeModel(config) {
|
|
|
123
123
|
}, 200);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
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
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
t1("
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
t1("
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
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 isAxiosNetworkError(error) {
|
|
142
|
+
if (!error || error.response) return false;
|
|
143
|
+
const message = (error.message || "").toString();
|
|
144
|
+
if (error.code === "ECONNABORTED" || /timeout/i.test(message)) return false;
|
|
145
|
+
return error.code === "ERR_NETWORK" || /network error/i.test(message);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function shouldSwallowNetworkError(config, error) {
|
|
149
|
+
return !!(
|
|
150
|
+
config &&
|
|
151
|
+
config.ignoreNetworkError === true &&
|
|
152
|
+
isAxiosNetworkError(error)
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function getRequestErrorMessage(error) {
|
|
157
|
+
const config = (error && error.config) || {};
|
|
158
|
+
const response = error && error.response;
|
|
159
|
+
const status = response && response.status;
|
|
160
|
+
const method = String(config.method || "GET").toUpperCase();
|
|
161
|
+
const requestUrl = getSafeRequestUrl(config);
|
|
162
|
+
const originalMessage = (error && error.message) || "未知错误";
|
|
163
|
+
let summary = t1("请求失败,请稍后重试。");
|
|
164
|
+
|
|
165
|
+
if (error && (error.code === "ECONNABORTED" || /timeout/i.test(originalMessage))) {
|
|
166
|
+
summary = t1("请求超时,请检查网络或稍后重试。");
|
|
167
|
+
} else if (!response) {
|
|
168
|
+
summary = t1("无法连接服务器,请检查网络、VPN/代理及服务状态后重试。");
|
|
169
|
+
} else if ([501, 502, 503, 504].includes(status)) {
|
|
170
|
+
summary = t1("网关或后端服务异常,请稍后重试或联系管理员。");
|
|
171
|
+
} else if (status >= 500) {
|
|
172
|
+
summary = t1("服务器暂时不可用,请稍后重试或联系管理员。");
|
|
173
|
+
} else if (status === 404) {
|
|
174
|
+
summary = t1("请求的服务地址不存在,请联系管理员检查接口配置。");
|
|
175
|
+
} else if (status === 403) {
|
|
176
|
+
summary = t1("服务器拒绝了本次请求,请检查访问权限。");
|
|
177
|
+
} else if (status === 401) {
|
|
178
|
+
summary = t1("登录状态已失效或无效,请重新登录。");
|
|
179
|
+
} else if (status >= 400) {
|
|
180
|
+
summary = t1("服务器未能处理本次请求,请检查输入后重试。");
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const details = [
|
|
184
|
+
summary,
|
|
185
|
+
t1("请求:{method} {url}", { method, url: requestUrl }),
|
|
186
|
+
t1("状态码:{status}", {
|
|
187
|
+
status: status || t1("未收到服务器响应(浏览器未提供 HTTP 状态码)"),
|
|
188
|
+
}),
|
|
189
|
+
];
|
|
190
|
+
if (error && error.code) {
|
|
191
|
+
details.push(t1("错误码:{code}", { code: error.code }));
|
|
192
|
+
}
|
|
193
|
+
details.push(
|
|
194
|
+
t1("原始错误:{message}", { message: originalMessage }),
|
|
195
|
+
t1("发生时间:{time}", { time: new Date().toLocaleString() })
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
if (!response) {
|
|
199
|
+
details.push(t1("可能原因:"));
|
|
200
|
+
details.push(t1("ERR_CONNECTION_RESET:连接被服务端、网关或安全设备重置;"));
|
|
201
|
+
details.push(t1("CORS:浏览器跨域配置异常;"));
|
|
202
|
+
details.push(t1("ERR_CERT_*:HTTPS 证书异常;"));
|
|
203
|
+
details.push(t1("请求长期 Pending:接口阻塞或连接未释放。"));
|
|
204
|
+
details.push(t1("实际 HTTP 状态码请在浏览器 Network 面板或网关日志中确认。"));
|
|
205
|
+
} else if ([501, 502, 503, 504].includes(status)) {
|
|
206
|
+
details.push(t1("501/502/503/504:网关或后端服务异常。"));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return {
|
|
210
|
+
summary,
|
|
211
|
+
details: details.join("\n"),
|
|
212
|
+
// 有 HTTP 状态码时直接挂到弹窗标题 Error(502),不用点开「详情」
|
|
213
|
+
errorLabel: status ? String(status) : !response ? originalMessage : "",
|
|
214
|
+
};
|
|
215
|
+
}
|
|
196
216
|
|
|
197
217
|
async function handleNickName(option) {
|
|
198
218
|
let { vueTarget, res, callback, config } = option;
|
|
@@ -467,14 +487,17 @@ service.interceptors.response.use(
|
|
|
467
487
|
// 那个 else 分支无条件弹 ErroreBox —— 而 ErroreBox 是弹窗不是 toast,取消 N 个
|
|
468
488
|
// 在途请求就会连弹 N 个错误框。config.errorMsg 那条逃生口在 if (config) 里面,
|
|
469
489
|
// Cancel 走不到,所以只能在这里拦。调用方按需自行 catch。
|
|
470
|
-
if (axios.isCancel(error)) {
|
|
471
|
-
return Promise.reject(error);
|
|
472
|
-
}
|
|
473
|
-
let config = error.config;
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
490
|
+
if (axios.isCancel(error)) {
|
|
491
|
+
return Promise.reject(error);
|
|
492
|
+
}
|
|
493
|
+
let config = error.config;
|
|
494
|
+
// 仅 Network Error 可被 ignoreNetworkError 吞掉(首页/在线聊天定时轮询)。
|
|
495
|
+
// 超时、5xx、业务失败等其它异常照常弹窗并 reject。
|
|
496
|
+
const swallowNetworkError = shouldSwallowNetworkError(config, error);
|
|
497
|
+
if (handleRequestNetworkError()) {
|
|
498
|
+
if (config && config.modalStrictly !== true) removeModel(config);
|
|
499
|
+
return swallowNetworkError ? Promise.resolve() : Promise.reject(error);
|
|
500
|
+
}
|
|
478
501
|
if (
|
|
479
502
|
error.response &&
|
|
480
503
|
error.response.data &&
|
|
@@ -488,26 +511,26 @@ service.interceptors.response.use(
|
|
|
488
511
|
if (config.modalStrictly !== true) {
|
|
489
512
|
removeModel(config);
|
|
490
513
|
}
|
|
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
|
-
}
|
|
514
|
+
if (config.errorMsg !== false && !swallowNetworkError) {
|
|
515
|
+
const requestError = getRequestErrorMessage(error);
|
|
516
|
+
ErroreBox.msg({
|
|
517
|
+
content: requestError.summary,
|
|
518
|
+
_errorMsg: requestError.details,
|
|
519
|
+
errorLabel: requestError.errorLabel,
|
|
520
|
+
type: "error",
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
} else {
|
|
524
|
+
const requestError = getRequestErrorMessage(error);
|
|
525
|
+
ErroreBox.msg({
|
|
526
|
+
content: requestError.summary,
|
|
527
|
+
_errorMsg: requestError.details,
|
|
528
|
+
errorLabel: requestError.errorLabel,
|
|
529
|
+
type: "error",
|
|
530
|
+
});
|
|
531
|
+
}
|
|
509
532
|
}
|
|
510
|
-
return Promise.reject(error);
|
|
533
|
+
return swallowNetworkError ? Promise.resolve() : Promise.reject(error);
|
|
511
534
|
}
|
|
512
535
|
);
|
|
513
536
|
|
|
@@ -637,7 +637,7 @@ export default {
|
|
|
637
637
|
res.objx && res.objx.records ? res.objx.records : [];
|
|
638
638
|
},
|
|
639
639
|
failMsg: false,
|
|
640
|
-
|
|
640
|
+
ignoreNetworkError: true,
|
|
641
641
|
fail: (res, response) => {
|
|
642
642
|
if (response && response.status == 200) {
|
|
643
643
|
this.$errorMsg(res);
|
|
@@ -660,7 +660,7 @@ export default {
|
|
|
660
660
|
this.unreadMessageNum = res.objx || 0;
|
|
661
661
|
},
|
|
662
662
|
failMsg: false,
|
|
663
|
-
|
|
663
|
+
ignoreNetworkError: true,
|
|
664
664
|
fail: (res, response) => {
|
|
665
665
|
if (response && response.status == 200) {
|
|
666
666
|
this.$errorMsg(res);
|
|
@@ -878,7 +878,7 @@ export default {
|
|
|
878
878
|
res.objx && res.objx.records ? res.objx.records : [];
|
|
879
879
|
},
|
|
880
880
|
failMsg: false,
|
|
881
|
-
|
|
881
|
+
ignoreNetworkError: true,
|
|
882
882
|
fail: (res, response) => {
|
|
883
883
|
if (response && response.status === 200) {
|
|
884
884
|
this.$errorMsg(res);
|
|
@@ -901,7 +901,7 @@ export default {
|
|
|
901
901
|
this.unreadMessageNum = res.objx || 0;
|
|
902
902
|
},
|
|
903
903
|
failMsg: false,
|
|
904
|
-
|
|
904
|
+
ignoreNetworkError: true,
|
|
905
905
|
fail: (res, response) => {
|
|
906
906
|
if (response && response.status === 200) {
|
|
907
907
|
this.$errorMsg(res);
|
|
@@ -63,7 +63,10 @@
|
|
|
63
63
|
{{ $t1("新增") }}
|
|
64
64
|
</vxe-button>
|
|
65
65
|
<base-table-export
|
|
66
|
-
:option="{
|
|
66
|
+
:option="{
|
|
67
|
+
title: $t1('账户导出'),
|
|
68
|
+
targetRef: 'table-m1',
|
|
69
|
+
}"
|
|
67
70
|
:parent-target="_self"
|
|
68
71
|
/>
|
|
69
72
|
<vxe-button
|
|
@@ -74,7 +77,10 @@
|
|
|
74
77
|
>
|
|
75
78
|
{{ $t1("导入") }}
|
|
76
79
|
</vxe-button>
|
|
77
|
-
<base-input-export
|
|
80
|
+
<base-input-export
|
|
81
|
+
:option="exportOption"
|
|
82
|
+
:parent-target="_self"
|
|
83
|
+
/>
|
|
78
84
|
</template>
|
|
79
85
|
<template #buttonRight>
|
|
80
86
|
<vxe-button
|
|
@@ -478,8 +484,18 @@ export default {
|
|
|
478
484
|
type: "input",
|
|
479
485
|
common: true,
|
|
480
486
|
},
|
|
481
|
-
{
|
|
482
|
-
|
|
487
|
+
{
|
|
488
|
+
title: this.$t1("姓名"),
|
|
489
|
+
field: "nickName",
|
|
490
|
+
type: "input",
|
|
491
|
+
common: true,
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
title: this.$t1("手机号"),
|
|
495
|
+
field: "mobile",
|
|
496
|
+
type: "input",
|
|
497
|
+
common: true,
|
|
498
|
+
},
|
|
483
499
|
{
|
|
484
500
|
title: this.$t1("角色"),
|
|
485
501
|
field: "roleCodes",
|
|
@@ -512,7 +528,12 @@ export default {
|
|
|
512
528
|
{ label: this.$t1("女"), value: 2 },
|
|
513
529
|
],
|
|
514
530
|
},
|
|
515
|
-
{
|
|
531
|
+
{
|
|
532
|
+
title: this.$t1("邮编"),
|
|
533
|
+
field: "zipCode",
|
|
534
|
+
type: "input",
|
|
535
|
+
common: false,
|
|
536
|
+
},
|
|
516
537
|
{
|
|
517
538
|
title: this.$t1("是否启用"),
|
|
518
539
|
field: "enabled",
|
|
@@ -641,7 +662,8 @@ export default {
|
|
|
641
662
|
method: "post",
|
|
642
663
|
data: { code: "outUserRoleCode" },
|
|
643
664
|
success: (res) => {
|
|
644
|
-
let value =
|
|
665
|
+
let value =
|
|
666
|
+
!res.objx || !res.objx.value ? "distributor" : res.objx.value;
|
|
645
667
|
let codes = value.split(",");
|
|
646
668
|
this.outUserCodes = codes;
|
|
647
669
|
},
|