@oinone/kunlun-vue-admin-base 6.2.3 → 6.2.4
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/dist/oinone-kunlun-vue-admin-base.css +1 -1
- package/dist/oinone-kunlun-vue-admin-base.esm.js +241 -70
- package/dist/oinone-kunlun-vue-admin-base.scss +1 -1
- package/dist/types/src/field/form/m2o/address/FormM2OAddressFieldWidget.d.ts +11 -1
- package/dist/types/src/typing/model.d.ts +27 -12
- package/dist/types/src/view/login/LoginWidget.d.ts +5 -1
- package/dist/types/src/view/reset-password/ForgetPasswordWidget.d.ts +1 -1
- package/package.json +8 -8
- package/src/basic/BaseI18nRouterWidget.ts +1 -1
- package/src/field/form/m2o/address/FormM2OAddressFieldWidget.ts +187 -12
- package/src/main-view/shared/SharedMainViewWidget.ts +5 -1
- package/src/typing/model.ts +29 -12
- package/src/util/default-tree-definition.ts +11 -0
- package/src/view/login/LoginWidget.ts +22 -8
- package/src/view/reset-password/FirstResetPasswordWidget.ts +5 -1
- package/src/view/reset-password/ForgetPasswordWidget.ts +7 -3
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { ActiveRecord, SubmitValue } from '@oinone/kunlun-engine';
|
|
2
|
+
import { StandardString } from '@oinone/kunlun-shared';
|
|
2
3
|
import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
|
|
3
4
|
import { TreeNodeResponseBody } from '../../../../service';
|
|
4
|
-
import { TreeData, TreeNodeMetadata } from '../../../../typing';
|
|
5
|
+
import { AddressTypeEnum, ResourceAddress, TreeData, TreeNodeMetadata } from '../../../../typing';
|
|
5
6
|
import { FormM2OCascaderFieldWidget } from '../cascader/FormM2OCascaderFieldWidget';
|
|
6
7
|
export declare class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
|
|
8
|
+
static readonly AddressTypes: AddressTypeEnum[];
|
|
7
9
|
protected get changeOnSelect(): boolean;
|
|
8
10
|
protected generatorDefaultTreeDefinition(props: any): TreeNodeMetadata | undefined;
|
|
9
11
|
protected getSubmitField(metadata: TreeNodeMetadata): Record<string, string> | undefined;
|
|
10
12
|
protected $onSelectedChange(selectedNodes: OioTreeNode<TreeData>[] | null | undefined): void;
|
|
13
|
+
protected $onSelectedChangeNext(currentValue: ResourceAddress, selectedNode: OioTreeNode<TreeData> | undefined): void;
|
|
14
|
+
protected getResourceAddressValue(currentValue: ResourceAddress, type: AddressTypeEnum): {
|
|
15
|
+
code: StandardString;
|
|
16
|
+
name: StandardString;
|
|
17
|
+
} | undefined;
|
|
18
|
+
protected setResourceAddressValue(currentValue: ResourceAddress, type: AddressTypeEnum, code: StandardString, name: StandardString): AddressTypeEnum | null | undefined;
|
|
11
19
|
protected fetchBackfillData(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): Promise<TreeNodeResponseBody[] | undefined>;
|
|
20
|
+
protected fetchBackfillDataNext(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): Promise<TreeNodeResponseBody[] | undefined>;
|
|
12
21
|
protected generatorCompareRecords(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): ActiveRecord[] | undefined;
|
|
22
|
+
protected generatorCompareRecordsNext(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): ActiveRecord[] | undefined;
|
|
13
23
|
submit(submitValue: SubmitValue): Promise<Record<string, unknown> | undefined>;
|
|
14
24
|
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { ActiveRecord } from '@oinone/kunlun-engine';
|
|
2
2
|
export interface ResourceAddress extends ActiveRecord {
|
|
3
3
|
id?: string;
|
|
4
|
-
countryCode?: string;
|
|
5
|
-
countryName?: string;
|
|
4
|
+
countryCode?: string | null;
|
|
5
|
+
countryName?: string | null;
|
|
6
6
|
originCountry?: ResourceCountry;
|
|
7
|
-
provinceCode?: string;
|
|
8
|
-
provinceName?: string;
|
|
7
|
+
provinceCode?: string | null;
|
|
8
|
+
provinceName?: string | null;
|
|
9
9
|
originProvince?: ResourceProvince;
|
|
10
|
-
cityCode?: string;
|
|
11
|
-
cityName?: string;
|
|
10
|
+
cityCode?: string | null;
|
|
11
|
+
cityName?: string | null;
|
|
12
12
|
originCity?: ResourceCity;
|
|
13
|
-
districtCode?: string;
|
|
14
|
-
districtName?: string;
|
|
13
|
+
districtCode?: string | null;
|
|
14
|
+
districtName?: string | null;
|
|
15
15
|
originDistrict?: ResourceDistrict;
|
|
16
|
-
streetCode?: string;
|
|
17
|
-
streetName?: string;
|
|
16
|
+
streetCode?: string | null;
|
|
17
|
+
streetName?: string | null;
|
|
18
18
|
originStreet?: ResourceStreet;
|
|
19
19
|
/**
|
|
20
20
|
* 详细地址
|
|
21
21
|
*/
|
|
22
|
-
street2?: string;
|
|
22
|
+
street2?: string | null;
|
|
23
23
|
/**
|
|
24
24
|
* 完整地址
|
|
25
25
|
*/
|
|
26
|
-
fullAddress?: string;
|
|
26
|
+
fullAddress?: string | null;
|
|
27
27
|
}
|
|
28
28
|
export interface ResourceCountry extends ActiveRecord {
|
|
29
29
|
id?: string;
|
|
@@ -51,3 +51,18 @@ export interface ResourceStreet extends ActiveRecord {
|
|
|
51
51
|
code?: string;
|
|
52
52
|
name?: string;
|
|
53
53
|
}
|
|
54
|
+
export interface ResourceRegion extends ActiveRecord {
|
|
55
|
+
id?: string;
|
|
56
|
+
type?: AddressTypeEnum;
|
|
57
|
+
code?: string | null;
|
|
58
|
+
name?: string | null;
|
|
59
|
+
pCode?: string;
|
|
60
|
+
parent?: ResourceRegion;
|
|
61
|
+
}
|
|
62
|
+
export declare enum AddressTypeEnum {
|
|
63
|
+
Country = "Country",
|
|
64
|
+
Province = "Province",
|
|
65
|
+
City = "City",
|
|
66
|
+
District = "District",
|
|
67
|
+
Street = "Street"
|
|
68
|
+
}
|
|
@@ -2,7 +2,7 @@ import { MajorConfig } from '@oinone/kunlun-engine';
|
|
|
2
2
|
import { Router } from '@oinone/kunlun-router';
|
|
3
3
|
import { LoginConfig, LoginData, LoginMode, RuntimeLanguage } from '@oinone/kunlun-vue-ui-common';
|
|
4
4
|
import { BaseI18nRouterWidget } from '../../basic/BaseI18nRouterWidget';
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class LoginWidget extends BaseI18nRouterWidget {
|
|
6
6
|
protected moduleName: string;
|
|
7
7
|
errorMessages: Record<string, string>;
|
|
8
8
|
/**
|
|
@@ -106,3 +106,7 @@ export declare class LoginPageWidget extends BaseI18nRouterWidget {
|
|
|
106
106
|
protected queryLanguageSetting(langCode: any): Promise<Record<string, unknown>>;
|
|
107
107
|
protected beforeMount(): Promise<void>;
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated please using LoginWidget
|
|
111
|
+
*/
|
|
112
|
+
export declare const LoginPageWidget: typeof LoginWidget;
|
|
@@ -2,9 +2,9 @@ import { MajorConfig } from '@oinone/kunlun-engine';
|
|
|
2
2
|
import { Router } from '@oinone/kunlun-router';
|
|
3
3
|
import { FormItemRule, OioFormInstance } from '@oinone/kunlun-vue-ui-antd';
|
|
4
4
|
import { SelectItem } from '@oinone/kunlun-vue-ui-common';
|
|
5
|
+
import { BaseI18nRouterWidget } from '../../basic';
|
|
5
6
|
import { ResourceCountry } from '../../typing';
|
|
6
7
|
import { ResetPasswordData } from './typing';
|
|
7
|
-
import { BaseI18nRouterWidget } from '../../basic/BaseI18nRouterWidget';
|
|
8
8
|
export declare class ForgetPasswordWidget extends BaseI18nRouterWidget {
|
|
9
9
|
protected moduleName: string;
|
|
10
10
|
protected router: Router;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oinone/kunlun-vue-admin-base",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.4",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prebuild": "rimraf dist",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"doc": "typedoc --out docs src/index.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@oinone/kunlun-vue-admin-layout": "6.2.
|
|
18
|
-
"@oinone/kunlun-vue-router": "6.2.
|
|
19
|
-
"@oinone/kunlun-vue-ui": "6.2.
|
|
20
|
-
"@oinone/kunlun-vue-ui-antd": "6.2.
|
|
21
|
-
"@oinone/kunlun-vue-ui-common": "6.2.
|
|
22
|
-
"@oinone/kunlun-vue-ui-el": "6.2.
|
|
23
|
-
"@oinone/kunlun-vue-widget": "6.2.
|
|
17
|
+
"@oinone/kunlun-vue-admin-layout": "6.2.4",
|
|
18
|
+
"@oinone/kunlun-vue-router": "6.2.4",
|
|
19
|
+
"@oinone/kunlun-vue-ui": "6.2.4",
|
|
20
|
+
"@oinone/kunlun-vue-ui-antd": "6.2.4",
|
|
21
|
+
"@oinone/kunlun-vue-ui-common": "6.2.4",
|
|
22
|
+
"@oinone/kunlun-vue-ui-el": "6.2.4",
|
|
23
|
+
"@oinone/kunlun-vue-widget": "6.2.4",
|
|
24
24
|
"@wangeditor/editor": "5.1.23",
|
|
25
25
|
"@wangeditor/editor-for-vue": "5.1.11",
|
|
26
26
|
"@wangeditor/plugin-upload-attachment": "1.1.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RouterWidget } from '@oinone/kunlun-vue-router';
|
|
2
1
|
import { getDefaultBrowser, initI18n, OioProvider, translateValueByKey } from '@oinone/kunlun-engine';
|
|
3
2
|
import { SYSTEM_MODULE_NAME } from '@oinone/kunlun-meta';
|
|
3
|
+
import { RouterWidget } from '@oinone/kunlun-vue-router';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 无模块需要国际化的路由页面
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ActiveRecord,
|
|
3
|
+
ActiveRecordExtendKeys,
|
|
4
|
+
ExperimentalConfigManager,
|
|
5
|
+
parseConfigs,
|
|
6
|
+
SubmitHandler,
|
|
7
|
+
SubmitValue
|
|
8
|
+
} from '@oinone/kunlun-engine';
|
|
2
9
|
import { ModelFieldType, ViewType } from '@oinone/kunlun-meta';
|
|
3
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
BooleanHelper,
|
|
12
|
+
CastHelper,
|
|
13
|
+
ObjectUtils,
|
|
14
|
+
Optional,
|
|
15
|
+
StandardString,
|
|
16
|
+
uniqueKeyGenerator
|
|
17
|
+
} from '@oinone/kunlun-shared';
|
|
4
18
|
import { SPI } from '@oinone/kunlun-spi';
|
|
5
19
|
import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
|
|
6
20
|
import { Widget } from '@oinone/kunlun-vue-widget';
|
|
7
21
|
import { FormFieldWidget } from '../../../../basic';
|
|
8
22
|
import { TreeNodeResponseBody, TreeService } from '../../../../service';
|
|
9
|
-
import { TreeData, TreeNodeMetadata } from '../../../../typing';
|
|
23
|
+
import { AddressTypeEnum, ResourceAddress, ResourceRegion, TreeData, TreeNodeMetadata } from '../../../../typing';
|
|
10
24
|
import { FetchUtil } from '../../../../util';
|
|
11
25
|
import { generatorDefaultAddressTreeDefinition } from '../../../../util/default-tree-definition';
|
|
12
26
|
import { FormM2OCascaderFieldWidget } from '../cascader/FormM2OCascaderFieldWidget';
|
|
@@ -19,6 +33,14 @@ import { FormM2OCascaderFieldWidget } from '../cascader/FormM2OCascaderFieldWidg
|
|
|
19
33
|
})
|
|
20
34
|
)
|
|
21
35
|
export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
|
|
36
|
+
public static readonly AddressTypes = [
|
|
37
|
+
AddressTypeEnum.Street,
|
|
38
|
+
AddressTypeEnum.District,
|
|
39
|
+
AddressTypeEnum.City,
|
|
40
|
+
AddressTypeEnum.Province,
|
|
41
|
+
AddressTypeEnum.Country
|
|
42
|
+
];
|
|
43
|
+
|
|
22
44
|
@Widget.Reactive()
|
|
23
45
|
protected get changeOnSelect(): boolean {
|
|
24
46
|
return Optional.ofNullable(this.getDsl().changeOnSelect).map(BooleanHelper.toBoolean).orElse(true)!;
|
|
@@ -63,7 +85,7 @@ export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
|
|
|
63
85
|
return;
|
|
64
86
|
}
|
|
65
87
|
const { value } = this;
|
|
66
|
-
let currentValue:
|
|
88
|
+
let currentValue: ResourceAddress | undefined;
|
|
67
89
|
if (value) {
|
|
68
90
|
currentValue = FetchUtil.generatorPksObjectByPks(['id'], value);
|
|
69
91
|
if (currentValue) {
|
|
@@ -77,25 +99,130 @@ export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
|
|
|
77
99
|
__draftId: uniqueKeyGenerator()
|
|
78
100
|
};
|
|
79
101
|
}
|
|
102
|
+
if (ExperimentalConfigManager.addressWidgetNext()) {
|
|
103
|
+
this.$onSelectedChangeNext(currentValue, selectedNode);
|
|
104
|
+
} else {
|
|
105
|
+
while (selectedNode) {
|
|
106
|
+
const targetValue = selectedNode.value.data;
|
|
107
|
+
if (targetValue) {
|
|
108
|
+
const submitFields = this.getSubmitField(selectedNode.value.metadata);
|
|
109
|
+
if (submitFields) {
|
|
110
|
+
Object.entries(submitFields).forEach(([relationField, referenceField]) => {
|
|
111
|
+
currentValue![relationField] = targetValue[referenceField as string];
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
selectedNode = selectedNode.parent;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
this.change(currentValue);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
protected $onSelectedChangeNext(currentValue: ResourceAddress, selectedNode: OioTreeNode<TreeData> | undefined) {
|
|
122
|
+
let nextAddressType: AddressTypeEnum | null | undefined;
|
|
80
123
|
while (selectedNode) {
|
|
81
|
-
const targetValue = selectedNode.value.data;
|
|
82
|
-
if (targetValue) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
124
|
+
const targetValue = selectedNode.value.data as ResourceRegion | undefined;
|
|
125
|
+
if (!targetValue) {
|
|
126
|
+
selectedNode = selectedNode.parent;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const { type, code, name } = targetValue;
|
|
130
|
+
if (!type) {
|
|
131
|
+
console.error('Invalid region type.', selectedNode);
|
|
132
|
+
this.change(null);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (nextAddressType) {
|
|
136
|
+
while (type !== nextAddressType) {
|
|
137
|
+
nextAddressType = this.setResourceAddressValue(currentValue, nextAddressType, null, null);
|
|
138
|
+
if (nextAddressType === null) {
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
if (!nextAddressType) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
88
144
|
}
|
|
145
|
+
} else {
|
|
146
|
+
nextAddressType = type;
|
|
147
|
+
}
|
|
148
|
+
nextAddressType = this.setResourceAddressValue(currentValue, type, code, name);
|
|
149
|
+
if (nextAddressType === null) {
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
if (!nextAddressType) {
|
|
153
|
+
return;
|
|
89
154
|
}
|
|
90
155
|
selectedNode = selectedNode.parent;
|
|
91
156
|
}
|
|
92
|
-
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
protected getResourceAddressValue(
|
|
160
|
+
currentValue: ResourceAddress,
|
|
161
|
+
type: AddressTypeEnum
|
|
162
|
+
):
|
|
163
|
+
| {
|
|
164
|
+
code: StandardString;
|
|
165
|
+
name: StandardString;
|
|
166
|
+
}
|
|
167
|
+
| undefined {
|
|
168
|
+
switch (type) {
|
|
169
|
+
case AddressTypeEnum.Country:
|
|
170
|
+
return { code: currentValue.countryCode, name: currentValue.countryName };
|
|
171
|
+
case AddressTypeEnum.Province:
|
|
172
|
+
return { code: currentValue.provinceCode, name: currentValue.provinceName };
|
|
173
|
+
case AddressTypeEnum.City:
|
|
174
|
+
return { code: currentValue.cityCode, name: currentValue.cityName };
|
|
175
|
+
case AddressTypeEnum.District:
|
|
176
|
+
return { code: currentValue.districtCode, name: currentValue.districtName };
|
|
177
|
+
case AddressTypeEnum.Street:
|
|
178
|
+
return { code: currentValue.streetCode, name: currentValue.streetName };
|
|
179
|
+
default:
|
|
180
|
+
console.error('Invalid region type.', type);
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
protected setResourceAddressValue(
|
|
186
|
+
currentValue: ResourceAddress,
|
|
187
|
+
type: AddressTypeEnum,
|
|
188
|
+
code: StandardString,
|
|
189
|
+
name: StandardString
|
|
190
|
+
): AddressTypeEnum | null | undefined {
|
|
191
|
+
switch (type) {
|
|
192
|
+
case AddressTypeEnum.Country:
|
|
193
|
+
currentValue.countryCode = code;
|
|
194
|
+
currentValue.countryName = name;
|
|
195
|
+
return null;
|
|
196
|
+
case AddressTypeEnum.Province:
|
|
197
|
+
currentValue.provinceCode = code;
|
|
198
|
+
currentValue.provinceName = name;
|
|
199
|
+
return AddressTypeEnum.Country;
|
|
200
|
+
case AddressTypeEnum.City:
|
|
201
|
+
currentValue.cityCode = code;
|
|
202
|
+
currentValue.cityName = name;
|
|
203
|
+
return AddressTypeEnum.Province;
|
|
204
|
+
case AddressTypeEnum.District:
|
|
205
|
+
currentValue.districtCode = code;
|
|
206
|
+
currentValue.districtName = name;
|
|
207
|
+
return AddressTypeEnum.City;
|
|
208
|
+
case AddressTypeEnum.Street:
|
|
209
|
+
currentValue.streetCode = code;
|
|
210
|
+
currentValue.streetName = name;
|
|
211
|
+
return AddressTypeEnum.District;
|
|
212
|
+
default:
|
|
213
|
+
console.error('Invalid region type.', type);
|
|
214
|
+
this.change(null);
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
93
217
|
}
|
|
94
218
|
|
|
95
219
|
protected async fetchBackfillData(
|
|
96
220
|
currentValues: ActiveRecord[],
|
|
97
221
|
metadataList: TreeNodeMetadata[]
|
|
98
222
|
): Promise<TreeNodeResponseBody[] | undefined> {
|
|
223
|
+
if (ExperimentalConfigManager.addressWidgetNext()) {
|
|
224
|
+
return this.fetchBackfillDataNext(currentValues, metadataList);
|
|
225
|
+
}
|
|
99
226
|
const finalValues: ActiveRecord[] = [];
|
|
100
227
|
let finalMetadataList: TreeNodeMetadata[] | undefined;
|
|
101
228
|
for (const currentValue of currentValues) {
|
|
@@ -130,10 +257,37 @@ export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
|
|
|
130
257
|
return undefined;
|
|
131
258
|
}
|
|
132
259
|
|
|
260
|
+
protected async fetchBackfillDataNext(
|
|
261
|
+
currentValues: ActiveRecord[],
|
|
262
|
+
metadataList: TreeNodeMetadata[]
|
|
263
|
+
): Promise<TreeNodeResponseBody[] | undefined> {
|
|
264
|
+
const currentValue = currentValues[0] as ResourceAddress | undefined;
|
|
265
|
+
if (!currentValue) {
|
|
266
|
+
return undefined;
|
|
267
|
+
}
|
|
268
|
+
let lastRegion: ResourceRegion | undefined;
|
|
269
|
+
for (const type of FormM2OAddressFieldWidget.AddressTypes) {
|
|
270
|
+
lastRegion = this.getResourceAddressValue(currentValue, type);
|
|
271
|
+
if (lastRegion) {
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (lastRegion) {
|
|
276
|
+
return TreeService.reverselyQueryWithSize([lastRegion], metadataList, {
|
|
277
|
+
expressionParameters: this.generatorExpressionParameters(),
|
|
278
|
+
disabledIsLeaf: true
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
return undefined;
|
|
282
|
+
}
|
|
283
|
+
|
|
133
284
|
protected generatorCompareRecords(
|
|
134
285
|
currentValues: ActiveRecord[],
|
|
135
286
|
metadataList: TreeNodeMetadata[]
|
|
136
287
|
): ActiveRecord[] | undefined {
|
|
288
|
+
if (ExperimentalConfigManager.addressWidgetNext()) {
|
|
289
|
+
return this.generatorCompareRecordsNext(currentValues, metadataList);
|
|
290
|
+
}
|
|
137
291
|
const compareRecords: ActiveRecord[] = [];
|
|
138
292
|
for (const currentValue of currentValues) {
|
|
139
293
|
for (const metadata of metadataList) {
|
|
@@ -161,6 +315,27 @@ export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
|
|
|
161
315
|
return [compareRecords[compareRecords.length - 1]];
|
|
162
316
|
}
|
|
163
317
|
|
|
318
|
+
protected generatorCompareRecordsNext(
|
|
319
|
+
currentValues: ActiveRecord[],
|
|
320
|
+
metadataList: TreeNodeMetadata[]
|
|
321
|
+
): ActiveRecord[] | undefined {
|
|
322
|
+
const currentValue = currentValues[0] as ResourceAddress | undefined;
|
|
323
|
+
if (!currentValue) {
|
|
324
|
+
return undefined;
|
|
325
|
+
}
|
|
326
|
+
let lastRegion: ResourceRegion | undefined;
|
|
327
|
+
for (const type of FormM2OAddressFieldWidget.AddressTypes) {
|
|
328
|
+
lastRegion = this.getResourceAddressValue(currentValue, type);
|
|
329
|
+
if (lastRegion) {
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (lastRegion) {
|
|
334
|
+
return [lastRegion];
|
|
335
|
+
}
|
|
336
|
+
return undefined;
|
|
337
|
+
}
|
|
338
|
+
|
|
164
339
|
public async submit(submitValue: SubmitValue) {
|
|
165
340
|
return SubmitHandler.DEFAULT(this.field, this.itemName, submitValue, this.value);
|
|
166
341
|
}
|
|
@@ -23,7 +23,11 @@ import { clearSharedSession, getSharedSession, setSharedSession } from './sessio
|
|
|
23
23
|
import SharedMainView from './SharedMainView.vue';
|
|
24
24
|
import { SharedViewUtils } from './utils';
|
|
25
25
|
|
|
26
|
-
@SPI.ClassFactory(
|
|
26
|
+
@SPI.ClassFactory(
|
|
27
|
+
RouterWidget.Token({
|
|
28
|
+
widget: SHARED_VIEW_WIDGET
|
|
29
|
+
})
|
|
30
|
+
)
|
|
27
31
|
export class SharedMainViewWidget extends RouterWidget {
|
|
28
32
|
protected metadataViewWidget: MetadataViewWidget | undefined;
|
|
29
33
|
|
package/src/typing/model.ts
CHANGED
|
@@ -3,35 +3,35 @@ import { ActiveRecord } from '@oinone/kunlun-engine';
|
|
|
3
3
|
export interface ResourceAddress extends ActiveRecord {
|
|
4
4
|
id?: string;
|
|
5
5
|
|
|
6
|
-
countryCode?: string;
|
|
7
|
-
countryName?: string;
|
|
6
|
+
countryCode?: string | null;
|
|
7
|
+
countryName?: string | null;
|
|
8
8
|
originCountry?: ResourceCountry;
|
|
9
9
|
|
|
10
|
-
provinceCode?: string;
|
|
11
|
-
provinceName?: string;
|
|
10
|
+
provinceCode?: string | null;
|
|
11
|
+
provinceName?: string | null;
|
|
12
12
|
originProvince?: ResourceProvince;
|
|
13
13
|
|
|
14
|
-
cityCode?: string;
|
|
15
|
-
cityName?: string;
|
|
14
|
+
cityCode?: string | null;
|
|
15
|
+
cityName?: string | null;
|
|
16
16
|
originCity?: ResourceCity;
|
|
17
17
|
|
|
18
|
-
districtCode?: string;
|
|
19
|
-
districtName?: string;
|
|
18
|
+
districtCode?: string | null;
|
|
19
|
+
districtName?: string | null;
|
|
20
20
|
originDistrict?: ResourceDistrict;
|
|
21
21
|
|
|
22
|
-
streetCode?: string;
|
|
23
|
-
streetName?: string;
|
|
22
|
+
streetCode?: string | null;
|
|
23
|
+
streetName?: string | null;
|
|
24
24
|
originStreet?: ResourceStreet;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* 详细地址
|
|
28
28
|
*/
|
|
29
|
-
street2?: string;
|
|
29
|
+
street2?: string | null;
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* 完整地址
|
|
33
33
|
*/
|
|
34
|
-
fullAddress?: string;
|
|
34
|
+
fullAddress?: string | null;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export interface ResourceCountry extends ActiveRecord {
|
|
@@ -65,3 +65,20 @@ export interface ResourceStreet extends ActiveRecord {
|
|
|
65
65
|
code?: string;
|
|
66
66
|
name?: string;
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
export interface ResourceRegion extends ActiveRecord {
|
|
70
|
+
id?: string;
|
|
71
|
+
type?: AddressTypeEnum;
|
|
72
|
+
code?: string | null;
|
|
73
|
+
name?: string | null;
|
|
74
|
+
pCode?: string;
|
|
75
|
+
parent?: ResourceRegion;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export enum AddressTypeEnum {
|
|
79
|
+
Country = 'Country',
|
|
80
|
+
Province = 'Province',
|
|
81
|
+
City = 'City',
|
|
82
|
+
District = 'District',
|
|
83
|
+
Street = 'Street'
|
|
84
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { XMLParse } from '@oinone/kunlun-dsl';
|
|
2
|
+
import { ExperimentalConfigManager } from '@oinone/kunlun-engine';
|
|
2
3
|
import { TreeNodeMetadata } from '../typing';
|
|
3
4
|
import { TreeUtils } from './tree-utils';
|
|
4
5
|
|
|
@@ -13,7 +14,17 @@ const defaultAddressTemplate = XMLParse.INSTANCE.parse(`<template>
|
|
|
13
14
|
</template>
|
|
14
15
|
`);
|
|
15
16
|
|
|
17
|
+
const defaultAddressTemplateNext = XMLParse.INSTANCE.parse(`<template>
|
|
18
|
+
<nodes>
|
|
19
|
+
<node model="resource.ResourceRegion" label="activeRecord.name" labelFields="name" selfReferences="parent" />
|
|
20
|
+
</nodes>
|
|
21
|
+
</template>
|
|
22
|
+
`);
|
|
23
|
+
|
|
16
24
|
export function generatorDefaultAddressTreeDefinition(): TreeNodeMetadata | undefined {
|
|
25
|
+
if (ExperimentalConfigManager.addressWidgetNext()) {
|
|
26
|
+
return TreeUtils.convert(defaultAddressTemplateNext);
|
|
27
|
+
}
|
|
17
28
|
return TreeUtils.convert(defaultAddressTemplate);
|
|
18
29
|
}
|
|
19
30
|
|
|
@@ -10,7 +10,14 @@ import {
|
|
|
10
10
|
translateValueByKey
|
|
11
11
|
} from '@oinone/kunlun-engine';
|
|
12
12
|
import { RuntimeConfig, SYSTEM_MODULE_NAME } from '@oinone/kunlun-meta';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
gql,
|
|
15
|
+
HttpClientError,
|
|
16
|
+
ILevel,
|
|
17
|
+
isFirstResetPasswordError,
|
|
18
|
+
isPicCodeError,
|
|
19
|
+
useMessageHub
|
|
20
|
+
} from '@oinone/kunlun-request';
|
|
14
21
|
import { Router } from '@oinone/kunlun-router';
|
|
15
22
|
import { http } from '@oinone/kunlun-service';
|
|
16
23
|
import { SPI } from '@oinone/kunlun-spi';
|
|
@@ -28,15 +35,17 @@ import {
|
|
|
28
35
|
LoginMode,
|
|
29
36
|
RuntimeLanguage
|
|
30
37
|
} from '@oinone/kunlun-vue-ui-common';
|
|
31
|
-
import {
|
|
32
|
-
import { toString } from 'lodash-es';
|
|
38
|
+
import { Widget } from '@oinone/kunlun-vue-widget';
|
|
33
39
|
import { BaseI18nRouterWidget } from '../../basic/BaseI18nRouterWidget';
|
|
34
|
-
|
|
35
40
|
import { encrypt, homepageMaybeRuntimeContext } from '../../util';
|
|
36
41
|
import LoginComponent from './Login.vue';
|
|
37
42
|
|
|
38
|
-
@SPI.ClassFactory(
|
|
39
|
-
|
|
43
|
+
@SPI.ClassFactory(
|
|
44
|
+
RouterWidget.Token({
|
|
45
|
+
widget: 'Login'
|
|
46
|
+
})
|
|
47
|
+
)
|
|
48
|
+
export class LoginWidget extends BaseI18nRouterWidget {
|
|
40
49
|
protected moduleName = SYSTEM_MODULE_NAME.USER;
|
|
41
50
|
|
|
42
51
|
public errorMessages = defaultLoginErrorMessages;
|
|
@@ -601,7 +610,7 @@ export class LoginPageWidget extends BaseI18nRouterWidget {
|
|
|
601
610
|
return;
|
|
602
611
|
}
|
|
603
612
|
|
|
604
|
-
if (
|
|
613
|
+
if (isFirstResetPasswordError(errorCode)) {
|
|
605
614
|
// 首次登录需修改密码
|
|
606
615
|
this.router.push({ segments: [{ path: 'first' }] });
|
|
607
616
|
return;
|
|
@@ -635,7 +644,7 @@ export class LoginPageWidget extends BaseI18nRouterWidget {
|
|
|
635
644
|
const hub = useMessageHub(loginMessageHubName);
|
|
636
645
|
hub.subscribe((error) => {
|
|
637
646
|
const { errorCode } = error;
|
|
638
|
-
if (errorCode
|
|
647
|
+
if (isPicCodeError(errorCode)) {
|
|
639
648
|
this.getPicCode();
|
|
640
649
|
}
|
|
641
650
|
hub.unsubscribe();
|
|
@@ -689,3 +698,8 @@ export class LoginPageWidget extends BaseI18nRouterWidget {
|
|
|
689
698
|
});
|
|
690
699
|
}
|
|
691
700
|
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* @deprecated please using LoginWidget
|
|
704
|
+
*/
|
|
705
|
+
export const LoginPageWidget = LoginWidget;
|
|
@@ -9,7 +9,11 @@ import { UserService } from '../../service';
|
|
|
9
9
|
import FirstResetPassword from './FirstResetPassword.vue';
|
|
10
10
|
import { ForgetPasswordWidget } from './ForgetPasswordWidget';
|
|
11
11
|
|
|
12
|
-
@SPI.ClassFactory(
|
|
12
|
+
@SPI.ClassFactory(
|
|
13
|
+
RouterWidget.Token({
|
|
14
|
+
widget: 'FirstResetPassword'
|
|
15
|
+
})
|
|
16
|
+
)
|
|
13
17
|
export class FirstResetPasswordWidget extends ForgetPasswordWidget {
|
|
14
18
|
public initialize(config) {
|
|
15
19
|
super.initialize(config);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getMajorConfig, MajorConfig, translateValueByKey } from '@oinone/kunlun-engine';
|
|
2
|
+
import { SYSTEM_MODULE_NAME } from '@oinone/kunlun-meta';
|
|
2
3
|
import { Router } from '@oinone/kunlun-router';
|
|
3
4
|
import { http } from '@oinone/kunlun-service';
|
|
4
5
|
import { SPI } from '@oinone/kunlun-spi';
|
|
@@ -6,14 +7,17 @@ import { RouterWidget, useRouter } from '@oinone/kunlun-vue-router';
|
|
|
6
7
|
import { FormItemRule, OioFormInstance, OioMessage } from '@oinone/kunlun-vue-ui-antd';
|
|
7
8
|
import { SelectItem } from '@oinone/kunlun-vue-ui-common';
|
|
8
9
|
import { Widget } from '@oinone/kunlun-vue-widget';
|
|
10
|
+
import { BaseI18nRouterWidget } from '../../basic';
|
|
9
11
|
import { PhoneCodeQueryService, UserService } from '../../service';
|
|
10
12
|
import { ResourceCountry } from '../../typing';
|
|
11
13
|
import ForgetPassword from './ForgetPassword.vue';
|
|
12
14
|
import { ResetPasswordData } from './typing';
|
|
13
|
-
import { BaseI18nRouterWidget } from '../../basic/BaseI18nRouterWidget';
|
|
14
|
-
import { SYSTEM_MODULE_NAME } from '@oinone/kunlun-meta';
|
|
15
15
|
|
|
16
|
-
@SPI.ClassFactory(
|
|
16
|
+
@SPI.ClassFactory(
|
|
17
|
+
RouterWidget.Token({
|
|
18
|
+
widget: 'ForgetPassword'
|
|
19
|
+
})
|
|
20
|
+
)
|
|
17
21
|
export class ForgetPasswordWidget extends BaseI18nRouterWidget {
|
|
18
22
|
protected moduleName = SYSTEM_MODULE_NAME.USER;
|
|
19
23
|
|