Commit 86368a4a47b0ed93775a6e6ddf020279b2a53d4d
Merge branch 'main' into 'ft-dev'
# Conflicts: # .env.development # src/views/device/config.data.ts # src/views/device/index.vue # src/views/system/role/RoleDrawer.vue
Showing
78 changed files
with
2331 additions
and
1019 deletions
Too many changes to show.
To preserve performance only 78 of 125 files are displayed.
... | ... | @@ -6,9 +6,7 @@ VITE_PUBLIC_PATH = / |
6 | 6 | |
7 | 7 | # Cross-domain proxy, you can configure multiple |
8 | 8 | # Please note that no line breaks |
9 | -# If Use Online Mock,Address Is ["https://www.fastmock.site/mock/87187f474cb8128e88a517a04d77d80c/api"] | |
10 | -VITE_PROXY = [["/api","http://192.168.10.116:8082/api"],["/upload","http://localhost:3300/upload"]] | |
11 | -# VITE_PROXY = [["/api","https://www.fastmock.site/mock/87187f474cb8128e88a517a04d77d80c/api]",["/upload","http://localhost:3300/upload"]] | |
9 | +VITE_PROXY = [["/api","http://192.168.10.120:8082/api"],["/upload","http://192.168.10.120:3300/upload"]] | |
12 | 10 | # VITE_PROXY=[["/api","https://vvbin.cn/test"]] |
13 | 11 | |
14 | 12 | # Delete console | ... | ... |
.vscode/settings.json
0 → 100644
configModel.ts
0 → 100644
1 | +import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel'; | |
2 | +/** | |
3 | + * @description: Request list interface parameters | |
4 | + */ | |
5 | +export type MessageConfigParams = BasicPageParams & MessageParams; | |
6 | + | |
7 | +export type MessageParams = { | |
8 | + status?: number; | |
9 | + messageType?: string; | |
10 | +}; | |
11 | + | |
12 | +export interface MessageConfig { | |
13 | + id: string; | |
14 | + configName: string; | |
15 | + messageType: string; | |
16 | + platformType: string; | |
17 | + config: ConfigParams; | |
18 | + createTime: string; | |
19 | + updateTime: string; | |
20 | + status: number; | |
21 | +} | |
22 | +export interface ConfigParams { | |
23 | + host: string; | |
24 | + port: number; | |
25 | + username: string; | |
26 | + password: string; | |
27 | + accessKeyId: string; | |
28 | + accessKeySecret: string; | |
29 | +} | |
30 | + | |
31 | +/** | |
32 | + * @description: Request list return value | |
33 | + */ | |
34 | +export type MessageConfigResultModel = BasicFetchResult<MessageConfig>; | |
35 | + | |
36 | +export type MessageConfigResult = MessageConfig; | ... | ... |
... | ... | @@ -21,7 +21,7 @@ |
21 | 21 | "clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite", |
22 | 22 | "clean:lib": "rimraf node_modules", |
23 | 23 | "lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix", |
24 | - "lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"", | |
24 | + "lint:prettier": "prettier --write \"src/**/*.{js,json,ts,tsx,css,less,scss,vue,html,md}\"", | |
25 | 25 | "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", |
26 | 26 | "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js", |
27 | 27 | "lint:pretty": "pretty-quick --staged", |
... | ... | @@ -59,6 +59,7 @@ |
59 | 59 | "tinymce": "^5.8.2", |
60 | 60 | "vditor": "^3.8.6", |
61 | 61 | "vue": "3.2.2", |
62 | + "vue-baidu-map": "^0.21.22", | |
62 | 63 | "vue-i18n": "9.1.7", |
63 | 64 | "vue-json-pretty": "^2.0.4", |
64 | 65 | "vue-router": "^4.0.11", | ... | ... |
src/api/alarm/contact/alarmContact.ts
0 → 100644
1 | +import { defHttp } from '/@/utils/http/axios'; | |
2 | +import type { | |
3 | + ContactPageParams, | |
4 | + ContactModal, | |
5 | + ContactParams, | |
6 | + ContactInfo, | |
7 | +} from './model/alarmContactModal'; | |
8 | +import { getPageData } from '../../base'; | |
9 | +enum Api { | |
10 | + alarmContact = '/alarmContact', | |
11 | + updateAlarmContact = '/alarmContact/update', | |
12 | +} | |
13 | + | |
14 | +// 获取 | |
15 | +export const getAlarmContact = (params: ContactPageParams) => { | |
16 | + return getPageData<ContactModal>(params, Api.alarmContact); | |
17 | +}; | |
18 | + | |
19 | +// 新增 | |
20 | +export const addAlarmContact = (params: ContactParams) => { | |
21 | + return defHttp.post({ | |
22 | + url: Api.alarmContact, | |
23 | + data: params, | |
24 | + }); | |
25 | +}; | |
26 | + | |
27 | +// 更新 | |
28 | +export const updateAlarmContact = (params: ContactParams) => { | |
29 | + return defHttp.post({ | |
30 | + url: Api.updateAlarmContact, | |
31 | + data: params, | |
32 | + }); | |
33 | +}; | |
34 | + | |
35 | +// 删除 | |
36 | +export const deleteAlarmContact = (ids: string[]) => { | |
37 | + return defHttp.delete({ | |
38 | + url: Api.alarmContact, | |
39 | + data: ids, | |
40 | + }); | |
41 | +}; | |
42 | + | |
43 | +// 新增或者编辑 | |
44 | +export const saveOrEditAlarmContact = (params: ContactInfo, isUpdate: boolean) => { | |
45 | + if (isUpdate) return updateAlarmContact(params); | |
46 | + addAlarmContact(params); | |
47 | +}; | ... | ... |
1 | +import { BasicPageParams } from '/@/api/model/baseModel'; | |
2 | + | |
3 | +interface ContactItemsModal { | |
4 | + id: string; | |
5 | + createTime: string; | |
6 | + enabled: boolean; | |
7 | + username: string; | |
8 | + department: string; | |
9 | + phone: string; | |
10 | +} | |
11 | +export type ContactPageParams = BasicPageParams & { username: string; organizationId: string }; | |
12 | + | |
13 | +export interface ContactModal { | |
14 | + items: ContactItemsModal[]; | |
15 | + total: number; | |
16 | +} | |
17 | + | |
18 | +export interface ContactParams { | |
19 | + phone: string; | |
20 | + username: string; | |
21 | + department?: string; | |
22 | + email?: string; | |
23 | + wechat?: string; | |
24 | + addPeople?: string; | |
25 | + remark?: string; | |
26 | +} | |
27 | + | |
28 | +export type ContactInfo = ContactParams; | ... | ... |
1 | -import {defHttp} from '/@/utils/http/axios'; | |
1 | +import { defHttp } from '/@/utils/http/axios'; | |
2 | 2 | |
3 | 3 | export interface PageData<T> { |
4 | 4 | total: number; |
... | ... | @@ -14,7 +14,7 @@ export interface BaseQueryParams { |
14 | 14 | pageSize: number; |
15 | 15 | page: number; |
16 | 16 | orderFiled?: string; |
17 | - orderType?: OrderType | |
17 | + orderType?: OrderType; | |
18 | 18 | } |
19 | 19 | |
20 | 20 | export class BaseQueryRequest implements BaseQueryParams { |
... | ... | @@ -23,7 +23,7 @@ export class BaseQueryRequest implements BaseQueryParams { |
23 | 23 | page: number; |
24 | 24 | pageSize: number; |
25 | 25 | |
26 | - constructor(page: number = 1, pageSize: number = 10) { | |
26 | + constructor(page = 1, pageSize = 10) { | |
27 | 27 | this.page = page; |
28 | 28 | this.pageSize = pageSize; |
29 | 29 | } |
... | ... | @@ -41,16 +41,13 @@ export class BaseQueryRequest implements BaseQueryParams { |
41 | 41 | } |
42 | 42 | |
43 | 43 | setPageSize(pageSize: number) { |
44 | - this.pageSize = pageSize | |
44 | + this.pageSize = pageSize; | |
45 | 45 | } |
46 | - | |
47 | 46 | } |
48 | 47 | |
49 | 48 | export function getPageData<T>(params: BaseQueryParams, url: string): Promise<PageData<T>> { |
50 | - return defHttp.get<PageData<T>>( | |
51 | - { | |
52 | - params: params, | |
53 | - url: url | |
54 | - } | |
55 | - ); | |
49 | + return defHttp.get<PageData<T>>({ | |
50 | + params: params, | |
51 | + url: url, | |
52 | + }); | |
56 | 53 | } | ... | ... |
1 | -import {defHttp} from "/@/utils/http/axios"; | |
1 | +import { defHttp } from '/@/utils/http/axios'; | |
2 | 2 | import { |
3 | 3 | DeviceModel, |
4 | 4 | DeviceProfileModel, |
5 | 5 | DeviceProfileQueryParam, |
6 | - DeviceQueryParam | |
7 | -} from "/@/api/device/model/deviceModel"; | |
6 | + DeviceQueryParam, | |
7 | +} from '/@/api/device/model/deviceModel'; | |
8 | 8 | |
9 | 9 | enum DeviceManagerApi { |
10 | 10 | /** |
11 | 11 | * 设备URL |
12 | 12 | */ |
13 | - DEVICE_URL = "/device", | |
13 | + DEVICE_URL = '/device', | |
14 | 14 | /** |
15 | 15 | * 设备配置URL |
16 | 16 | */ |
17 | - DEVICE_PROFILE_URL = "/deviceProfile" | |
17 | + DEVICE_PROFILE_URL = '/deviceProfile', | |
18 | 18 | } |
19 | 19 | |
20 | -export const devicePage = (params: DeviceQueryParam) =>{ | |
20 | +export const devicePage = (params: DeviceQueryParam) => { | |
21 | 21 | return defHttp.get<DeviceModel>({ |
22 | 22 | url: DeviceManagerApi.DEVICE_URL, |
23 | - params | |
23 | + params, | |
24 | 24 | }); |
25 | -} | |
25 | +}; | |
26 | 26 | |
27 | 27 | /** |
28 | 28 | * 分页查询设备配置页面 |
... | ... | @@ -31,9 +31,9 @@ export const devicePage = (params: DeviceQueryParam) =>{ |
31 | 31 | export const deviceProfilePage = (params: DeviceProfileQueryParam) => { |
32 | 32 | return defHttp.get<DeviceProfileModel>({ |
33 | 33 | url: DeviceManagerApi.DEVICE_PROFILE_URL, |
34 | - params | |
34 | + params, | |
35 | 35 | }); |
36 | -} | |
36 | +}; | |
37 | 37 | /** |
38 | 38 | * 删除设备配置 |
39 | 39 | * @param ids 删除的ids |
... | ... | @@ -41,11 +41,11 @@ export const deviceProfilePage = (params: DeviceProfileQueryParam) => { |
41 | 41 | export const deleteDeviceProfile = (ids: string[]) => { |
42 | 42 | return defHttp.delete({ |
43 | 43 | url: DeviceManagerApi.DEVICE_PROFILE_URL, |
44 | - data:{ | |
45 | - ids:ids | |
46 | - } | |
47 | - }) | |
48 | -} | |
44 | + data: { | |
45 | + ids: ids, | |
46 | + }, | |
47 | + }); | |
48 | +}; | |
49 | 49 | |
50 | 50 | /** |
51 | 51 | * 删除设备 |
... | ... | @@ -54,8 +54,8 @@ export const deleteDeviceProfile = (ids: string[]) => { |
54 | 54 | export const deleteDevice = (ids: string[]) => { |
55 | 55 | return defHttp.delete({ |
56 | 56 | url: DeviceManagerApi.DEVICE_URL, |
57 | - data:{ | |
58 | - ids:ids | |
59 | - } | |
60 | - }) | |
61 | -} | |
57 | + data: { | |
58 | + ids: ids, | |
59 | + }, | |
60 | + }); | |
61 | +}; | ... | ... |
1 | -import {BasicPageParams} from "/@/api/model/baseModel"; | |
1 | +import { BasicPageParams } from '/@/api/model/baseModel'; | |
2 | 2 | export enum DeviceState { |
3 | - INACTIVE='INACTIVE', | |
4 | - ONLINE='ONLINE', | |
5 | - OFFLINE='OFFLINE' | |
3 | + INACTIVE = 'INACTIVE', | |
4 | + ONLINE = 'ONLINE', | |
5 | + OFFLINE = 'OFFLINE', | |
6 | 6 | } |
7 | -export enum DeviceTypeEnum{ | |
8 | - GATEWAY='GATEWAY', | |
9 | - DIRECT_CONNECTION='DIRECT_CONNECTION', | |
10 | - SENSOR='SENSOR' | |
7 | +export enum DeviceTypeEnum { | |
8 | + GATEWAY = 'GATEWAY', | |
9 | + DIRECT_CONNECTION = 'DIRECT_CONNECTION', | |
10 | + SENSOR = 'SENSOR', | |
11 | 11 | } |
12 | -export type DeviceProfileQueryParam = BasicPageParams & DeviceProfileParam | |
13 | -export type DeviceQueryParam = BasicPageParams & DeviceParam | |
12 | +export type DeviceProfileQueryParam = BasicPageParams & DeviceProfileParam; | |
13 | +export type DeviceQueryParam = BasicPageParams & DeviceParam; | |
14 | 14 | export type DeviceParam = { |
15 | - name?:string, | |
16 | - deviceProfileId?:string | |
17 | -} | |
15 | + name?: string; | |
16 | + deviceProfileId?: string; | |
17 | +}; | |
18 | 18 | export type DeviceProfileParam = { |
19 | - name?: string | |
20 | -} | |
19 | + name?: string; | |
20 | +}; | |
21 | 21 | |
22 | -export interface DeviceModel{ | |
23 | - id:string, | |
24 | - name:string, | |
25 | - deviceInfo:any, | |
26 | - activeTime:string, | |
27 | - deviceState:DeviceState, | |
28 | - profileId:string, | |
29 | - label:string, | |
30 | - lastConnectTime:string, | |
31 | - deviceType:DeviceTypeEnum | |
22 | +export interface DeviceModel { | |
23 | + id: string; | |
24 | + name: string; | |
25 | + deviceInfo: any; | |
26 | + activeTime: string; | |
27 | + deviceState: DeviceState; | |
28 | + profileId: string; | |
29 | + label: string; | |
30 | + lastConnectTime: string; | |
31 | + deviceType: DeviceTypeEnum; | |
32 | 32 | } |
33 | 33 | |
34 | -export interface DeviceProfileModel{ | |
35 | - id:string, | |
36 | - name:string, | |
37 | - transportType:string, | |
38 | - createTime:string, | |
39 | - description:string | |
34 | +export interface DeviceProfileModel { | |
35 | + id: string; | |
36 | + name: string; | |
37 | + transportType: string; | |
38 | + createTime: string; | |
39 | + description: string; | |
40 | 40 | } | ... | ... |
1 | 1 | import { defHttp } from '/@/utils/http/axios'; |
2 | 2 | import { |
3 | 3 | MessageConfig, |
4 | - MessageConfigParams, MessageConfigResult, | |
4 | + MessageConfigParams, | |
5 | + MessageConfigResult, | |
5 | 6 | MessageConfigResultModel, |
6 | - MessageParams | |
7 | + MessageParams, | |
7 | 8 | } from './model/configModel'; |
8 | 9 | |
9 | - | |
10 | 10 | enum MessageConfigApi { |
11 | 11 | CONFIG_URL = '/message', |
12 | 12 | } |
... | ... | @@ -14,13 +14,13 @@ enum MessageConfigApi { |
14 | 14 | /** |
15 | 15 | * 获取当前租户下的所有配置 |
16 | 16 | */ |
17 | -export const findMessageConfig=(params: MessageParams)=>{ | |
18 | - console.log(params,"params") | |
17 | +export const findMessageConfig = (params: MessageParams) => { | |
18 | + console.log(params, 'params'); | |
19 | 19 | return defHttp.post<MessageConfigResult>({ |
20 | - url: MessageConfigApi.CONFIG_URL + "/find", | |
20 | + url: MessageConfigApi.CONFIG_URL + '/find', | |
21 | 21 | params, |
22 | - }) | |
23 | -} | |
22 | + }); | |
23 | +}; | |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @description: 获取MessageConfig分页数据 |
... | ... | @@ -41,14 +41,14 @@ export const saveOrEditMessageConfig = (params: MessageConfig, isUpdate: boolean |
41 | 41 | return defHttp.put<MessageConfigResultModel>({ |
42 | 42 | url: MessageConfigApi.CONFIG_URL, |
43 | 43 | params, |
44 | - }) | |
44 | + }); | |
45 | 45 | } else { |
46 | 46 | return defHttp.post<MessageConfigResultModel>({ |
47 | 47 | url: MessageConfigApi.CONFIG_URL, |
48 | 48 | params, |
49 | - }) | |
49 | + }); | |
50 | 50 | } |
51 | -} | |
51 | +}; | |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * 更新配置状态 |
... | ... | @@ -56,15 +56,15 @@ export const saveOrEditMessageConfig = (params: MessageConfig, isUpdate: boolean |
56 | 56 | * @param messageType 消息类型 |
57 | 57 | * @param status 状态 |
58 | 58 | */ |
59 | -export const setMessageConfigStatus=(id:string,messageType:string,status:number) => | |
59 | +export const setMessageConfigStatus = (id: string, messageType: string, status: number) => | |
60 | 60 | defHttp.put<MessageConfigResultModel>({ |
61 | 61 | url: MessageConfigApi.CONFIG_URL, |
62 | - data:{ | |
63 | - "id":id, | |
64 | - "messageType":messageType, | |
65 | - "status":status, | |
62 | + data: { | |
63 | + id: id, | |
64 | + messageType: messageType, | |
65 | + status: status, | |
66 | 66 | }, |
67 | - }) | |
67 | + }); | |
68 | 68 | /** |
69 | 69 | * 删除MessageConfig |
70 | 70 | * @param ids 删除id数组 |
... | ... | @@ -73,6 +73,6 @@ export const deleteMessageConfig = (ids: string[]) => |
73 | 73 | defHttp.delete({ |
74 | 74 | url: MessageConfigApi.CONFIG_URL, |
75 | 75 | data: { |
76 | - ids: ids | |
76 | + ids: ids, | |
77 | 77 | }, |
78 | - }) | |
78 | + }); | ... | ... |
1 | -import { | |
2 | - BasicPageParams, | |
3 | - BasicFetchResult | |
4 | -} from '/@/api/model/baseModel'; | |
1 | +import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel'; | |
5 | 2 | /** |
6 | 3 | * @description: Request list interface parameters |
7 | 4 | */ |
8 | 5 | export type MessageConfigParams = BasicPageParams & MessageParams; |
9 | 6 | |
10 | 7 | export type MessageParams = { |
11 | - status?:number; | |
12 | - messageType?:string; | |
13 | -} | |
8 | + status?: number; | |
9 | + messageType?: string; | |
10 | +}; | |
14 | 11 | |
15 | 12 | export interface MessageConfig { |
16 | 13 | id: string; |
17 | - configName:string; | |
14 | + configName: string; | |
18 | 15 | messageType: string; |
19 | 16 | platformType: string; |
20 | 17 | config: ConfigParams; |
... | ... | @@ -22,13 +19,13 @@ export interface MessageConfig { |
22 | 19 | updateTime: string; |
23 | 20 | status: number; |
24 | 21 | } |
25 | -export interface ConfigParams{ | |
26 | - host:string; | |
27 | - port:number; | |
28 | - username:string; | |
29 | - password:string; | |
30 | - accessKeyId:string; | |
31 | - accessKeySecret:string; | |
22 | +export interface ConfigParams { | |
23 | + host: string; | |
24 | + port: number; | |
25 | + username: string; | |
26 | + password: string; | |
27 | + accessKeyId: string; | |
28 | + accessKeySecret: string; | |
32 | 29 | } |
33 | 30 | |
34 | 31 | /** | ... | ... |
1 | -import {BasicFetchResult, BasicPageParams} from "/@/api/model/baseModel"; | |
1 | +import { BasicFetchResult, BasicPageParams } from '/@/api/model/baseModel'; | |
2 | 2 | |
3 | 3 | export type MessageRecordsParams = BasicPageParams; |
4 | 4 | |
5 | -export interface SmsLogModel{ | |
6 | - id?:string | |
5 | +export interface SmsLogModel { | |
6 | + id?: string; | |
7 | 7 | } |
8 | -export interface MailLogModel{ | |
9 | - id?:string; | |
10 | - subject?:string; | |
11 | - to?:string; | |
12 | - cc?:string; | |
13 | - bcc?:string; | |
14 | - status?:number; | |
8 | +export interface MailLogModel { | |
9 | + id?: string; | |
10 | + subject?: string; | |
11 | + to?: string; | |
12 | + cc?: string; | |
13 | + bcc?: string; | |
14 | + status?: number; | |
15 | 15 | } |
16 | -export type SmsLogModelResult= BasicFetchResult<SmsLogModel>; | |
17 | -export type MailLogModelResult= BasicFetchResult<MailLogModel>; | |
16 | +export type SmsLogModelResult = BasicFetchResult<SmsLogModel>; | |
17 | +export type MailLogModelResult = BasicFetchResult<MailLogModel>; | ... | ... |
1 | -import { | |
2 | - BasicPageParams, | |
3 | - BasicFetchResult, BasicParams | |
4 | -} from '/@/api/model/baseModel'; | |
1 | +import { BasicPageParams, BasicFetchResult, BasicParams } from '/@/api/model/baseModel'; | |
5 | 2 | |
6 | 3 | /** |
7 | 4 | * @description: Request list interface parameters |
... | ... | @@ -15,23 +12,23 @@ export interface MessageTemplate { |
15 | 12 | } |
16 | 13 | |
17 | 14 | export type SmsParams = { |
18 | - id?:string; | |
19 | - phoneNumbers?:string; | |
20 | - params?:string; | |
21 | - remark?:string; | |
22 | - templatePurpose?:string; | |
23 | -} | |
15 | + id?: string; | |
16 | + phoneNumbers?: string; | |
17 | + params?: string; | |
18 | + remark?: string; | |
19 | + templatePurpose?: string; | |
20 | +}; | |
24 | 21 | export type EmailParams = { |
25 | - id?:string; | |
26 | - to?:string[]; | |
27 | - cc?:string[]; | |
28 | - bcc?:string[]; | |
29 | - subject?:string; | |
30 | - emailFormatEnum?:string; | |
31 | - templatePurpose?:string; | |
32 | -} | |
22 | + id?: string; | |
23 | + to?: string[]; | |
24 | + cc?: string[]; | |
25 | + bcc?: string[]; | |
26 | + subject?: string; | |
27 | + emailFormatEnum?: string; | |
28 | + templatePurpose?: string; | |
29 | +}; | |
33 | 30 | export interface MessageResult { |
34 | - result:boolean | |
31 | + result: boolean; | |
35 | 32 | } |
36 | 33 | |
37 | 34 | /** | ... | ... |
1 | -import {defHttp} from '/@/utils/http/axios'; | |
1 | +import { defHttp } from '/@/utils/http/axios'; | |
2 | 2 | import { |
3 | 3 | MailLogModelResult, |
4 | 4 | MessageRecordsParams, |
5 | - SmsLogModelResult | |
6 | -} from "/@/api/message/model/recordsModel"; | |
5 | + SmsLogModelResult, | |
6 | +} from '/@/api/message/model/recordsModel'; | |
7 | 7 | |
8 | 8 | enum MessageRecordsApi { |
9 | - SMS_RECORDS = "/smsLog", | |
10 | - EMAIL_RECORDS = "/mailLog" | |
9 | + SMS_RECORDS = '/smsLog', | |
10 | + EMAIL_RECORDS = '/mailLog', | |
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
... | ... | @@ -17,30 +17,30 @@ enum MessageRecordsApi { |
17 | 17 | export const smsLogPage = (params: MessageRecordsParams) => { |
18 | 18 | return defHttp.get<SmsLogModelResult>({ |
19 | 19 | url: MessageRecordsApi.SMS_RECORDS, |
20 | - params | |
21 | - }) | |
22 | -} | |
20 | + params, | |
21 | + }); | |
22 | +}; | |
23 | 23 | |
24 | 24 | /** |
25 | 25 | * 获取邮件发送记录【分页】 |
26 | 26 | * @param params 查询参数 |
27 | 27 | */ |
28 | -export const mailLogPage=(params:MessageRecordsParams)=>{ | |
28 | +export const mailLogPage = (params: MessageRecordsParams) => { | |
29 | 29 | return defHttp.get<MailLogModelResult>({ |
30 | 30 | url: MessageRecordsApi.EMAIL_RECORDS, |
31 | - params | |
32 | - }) | |
33 | -} | |
31 | + params, | |
32 | + }); | |
33 | +}; | |
34 | 34 | |
35 | 35 | /** |
36 | 36 | * 删除邮件记录 |
37 | 37 | * @param ids 邮件记录ID |
38 | 38 | */ |
39 | -export const deleteMailLog =(ids: string[]) => | |
39 | +export const deleteMailLog = (ids: string[]) => | |
40 | 40 | defHttp.delete({ |
41 | 41 | url: MessageRecordsApi.EMAIL_RECORDS, |
42 | 42 | data: { |
43 | - ids: ids | |
43 | + ids: ids, | |
44 | 44 | }, |
45 | 45 | }); |
46 | 46 | /** |
... | ... | @@ -51,6 +51,6 @@ export const deleteSmsLog = (ids: string[]) => |
51 | 51 | defHttp.delete({ |
52 | 52 | url: MessageRecordsApi.SMS_RECORDS, |
53 | 53 | data: { |
54 | - ids: ids | |
54 | + ids: ids, | |
55 | 55 | }, |
56 | 56 | }); | ... | ... |
1 | 1 | import { defHttp } from '/@/utils/http/axios'; |
2 | 2 | import { |
3 | - EmailParams, MessageResultModel, | |
3 | + EmailParams, | |
4 | + MessageResultModel, | |
4 | 5 | MessageTemplate, |
5 | 6 | MessageTemplateParams, |
6 | - MessageTemplateResultModel, SmsParams | |
7 | -} from "/@/api/message/model/templateModel"; | |
8 | -import {MessageConfigResultModel} from "/@/api/message/model/configModel"; | |
7 | + MessageTemplateResultModel, | |
8 | + SmsParams, | |
9 | +} from '/@/api/message/model/templateModel'; | |
10 | +import { MessageConfigResultModel } from '/@/api/message/model/configModel'; | |
9 | 11 | |
10 | 12 | enum MessageTemplateApi { |
11 | 13 | TEMPLATE_URL = '/template', |
... | ... | @@ -15,19 +17,19 @@ enum MessageTemplateApi { |
15 | 17 | * 短信发送 |
16 | 18 | * @param params 发送参数 |
17 | 19 | */ |
18 | -export const sendSms=(params: SmsParams)=>{ | |
20 | +export const sendSms = (params: SmsParams) => { | |
19 | 21 | return defHttp.post<MessageResultModel>({ |
20 | - url: MessageTemplateApi.TEMPLATE_URL+"/sendSms", | |
22 | + url: MessageTemplateApi.TEMPLATE_URL + '/sendSms', | |
21 | 23 | params, |
22 | - }) | |
23 | -} | |
24 | + }); | |
25 | +}; | |
24 | 26 | |
25 | -export const sendEmail=(params:EmailParams)=>{ | |
27 | +export const sendEmail = (params: EmailParams) => { | |
26 | 28 | return defHttp.post<MessageResultModel>({ |
27 | - url: MessageTemplateApi.TEMPLATE_URL+"/sendEmail", | |
29 | + url: MessageTemplateApi.TEMPLATE_URL + '/sendEmail', | |
28 | 30 | params, |
29 | - }) | |
30 | -} | |
31 | + }); | |
32 | +}; | |
31 | 33 | |
32 | 34 | export const messageTemplatePage = (params: MessageTemplateParams) => |
33 | 35 | defHttp.get<MessageTemplateResultModel>({ |
... | ... | @@ -35,7 +37,6 @@ export const messageTemplatePage = (params: MessageTemplateParams) => |
35 | 37 | params, |
36 | 38 | }); |
37 | 39 | |
38 | - | |
39 | 40 | /** |
40 | 41 | * 更新或保存MessageTemplate配置 |
41 | 42 | * @param params 参数 |
... | ... | @@ -46,14 +47,14 @@ export const saveOrEditMessageTemplate = (params: MessageTemplate, isUpdate: boo |
46 | 47 | return defHttp.put<MessageTemplateResultModel>({ |
47 | 48 | url: MessageTemplateApi.TEMPLATE_URL, |
48 | 49 | params, |
49 | - }) | |
50 | + }); | |
50 | 51 | } else { |
51 | 52 | return defHttp.post<MessageTemplateResultModel>({ |
52 | 53 | url: MessageTemplateApi.TEMPLATE_URL, |
53 | 54 | params, |
54 | - }) | |
55 | + }); | |
55 | 56 | } |
56 | -} | |
57 | +}; | |
57 | 58 | |
58 | 59 | /** |
59 | 60 | * 删除MessageConfig |
... | ... | @@ -63,21 +64,26 @@ export const deleteMessageTemplate = (ids: string[]) => |
63 | 64 | defHttp.delete({ |
64 | 65 | url: MessageTemplateApi.TEMPLATE_URL, |
65 | 66 | data: { |
66 | - ids: ids | |
67 | + ids: ids, | |
67 | 68 | }, |
68 | - }) | |
69 | + }); | |
69 | 70 | /** |
70 | 71 | * 更新模板状态 |
71 | 72 | * @param id 配置id |
72 | 73 | * @param status 状态 |
73 | 74 | */ |
74 | -export const setMessageTemplateStatus=(id:string,templatePurpose:string,messageType:string,status:number) => | |
75 | +export const setMessageTemplateStatus = ( | |
76 | + id: string, | |
77 | + templatePurpose: string, | |
78 | + messageType: string, | |
79 | + status: number | |
80 | +) => | |
75 | 81 | defHttp.put<MessageConfigResultModel>({ |
76 | 82 | url: MessageTemplateApi.TEMPLATE_URL, |
77 | - data:{ | |
78 | - "id":id, | |
79 | - "status":status, | |
80 | - "templatePurpose":templatePurpose, | |
81 | - "messageType":messageType | |
83 | + data: { | |
84 | + id: id, | |
85 | + status: status, | |
86 | + templatePurpose: templatePurpose, | |
87 | + messageType: messageType, | |
82 | 88 | }, |
83 | - }) | |
89 | + }); | ... | ... |
... | ... | @@ -3,10 +3,10 @@ export interface BasicPageParams { |
3 | 3 | pageSize: number; |
4 | 4 | } |
5 | 5 | |
6 | -export interface BasicParams<T extends any>{ | |
7 | - code:number; | |
8 | - message:string; | |
9 | - data:T; | |
6 | +export interface BasicParams<T extends any> { | |
7 | + code: number; | |
8 | + message: string; | |
9 | + data: T; | |
10 | 10 | } |
11 | 11 | |
12 | 12 | export interface BasicFetchResult<T extends any> { | ... | ... |
1 | -import {defHttp} from "/@/utils/http/axios"; | |
2 | -import {FileUploadResponse} from "/@/api/oss/FileUploadResponse"; | |
1 | +import { defHttp } from '/@/utils/http/axios'; | |
2 | +import { FileUploadResponse } from '/@/api/oss/FileUploadResponse'; | |
3 | 3 | |
4 | 4 | enum Api { |
5 | 5 | BaseUploadUrl = '/oss/upload', |
6 | 6 | } |
7 | 7 | |
8 | 8 | export const upload = (file) => { |
9 | - return defHttp.post<FileUploadResponse>({url: Api.BaseUploadUrl, params: file}) | |
10 | -} | |
9 | + return defHttp.post<FileUploadResponse>({ url: Api.BaseUploadUrl, params: file }); | |
10 | +}; | ... | ... |
1 | 1 | export interface JwtModel { |
2 | - userId: string; | |
3 | - username: string; | |
4 | - tenantCode: string; | |
5 | - tenantName: string; | |
6 | - exp: number; | |
7 | - role: string[]; | |
8 | - } | |
9 | - | |
\ No newline at end of file | ||
2 | + userId: string; | |
3 | + username: string; | |
4 | + tenantCode: string; | |
5 | + tenantName: string; | |
6 | + exp: number; | |
7 | + role: string[]; | |
8 | +} | ... | ... |
1 | -import {defHttp} from '/@/utils/http/axios'; | |
2 | -import {getMenuListResultModel} from './model/menuModel'; | |
3 | -import {useUserStore} from '/@/store/modules/user'; | |
4 | -import {RoleEnum} from '/@/enums/roleEnum'; | |
1 | +import { defHttp } from '/@/utils/http/axios'; | |
2 | +import { getMenuListResultModel } from './model/menuModel'; | |
3 | +import { useUserStore } from '/@/store/modules/user'; | |
4 | +import { RoleEnum } from '/@/enums/roleEnum'; | |
5 | 5 | |
6 | 6 | enum Api { |
7 | 7 | BaseMenuUrl = '/menu', |
8 | 8 | GetMenuList = '/menu/me/menus', |
9 | 9 | SysAdminMenuList = '/admin/me/menus', |
10 | - GetMenuIdsByRoleId = '/menu/getMenuIdsByRoleId/' | |
10 | + GetMenuIdsByRoleId = '/menu/getMenuIdsByRoleId/', | |
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
... | ... | @@ -17,17 +17,17 @@ enum Api { |
17 | 17 | export const getMenuList = () => { |
18 | 18 | const userStore = useUserStore(); |
19 | 19 | let url = Api.GetMenuList; |
20 | - if (userStore.getRoleList.find(v => v == RoleEnum.ROLE_SYS_ADMIN)) { | |
20 | + if (userStore.getRoleList.find((v) => v == RoleEnum.ROLE_SYS_ADMIN)) { | |
21 | 21 | url = Api.SysAdminMenuList; |
22 | 22 | } |
23 | - return defHttp.get<getMenuListResultModel>({url: url}); | |
23 | + return defHttp.get<getMenuListResultModel>({ url: url }); | |
24 | 24 | }; |
25 | 25 | |
26 | 26 | export const delMenu = (menuIds: string[]) => { |
27 | - let url = Api.BaseMenuUrl; | |
28 | - return defHttp.delete({url: url, data: menuIds}) | |
29 | -} | |
27 | + const url = Api.BaseMenuUrl; | |
28 | + return defHttp.delete({ url: url, data: menuIds }); | |
29 | +}; | |
30 | 30 | export const getMenusIdsByRoleId = (roleId: string) => { |
31 | - let url = Api.GetMenuIdsByRoleId + roleId; | |
32 | - return defHttp.get<Array<string>>({url: url}); | |
33 | -} | |
31 | + const url = Api.GetMenuIdsByRoleId + roleId; | |
32 | + return defHttp.get<Array<string>>({ url: url }); | |
33 | +}; | ... | ... |
... | ... | @@ -42,8 +42,7 @@ export interface GetUserInfoModel { |
42 | 42 | // 介绍 |
43 | 43 | desc?: string; |
44 | 44 | } |
45 | - export interface UserInfoModel{ | |
46 | - | |
45 | +export interface UserInfoModel { | |
47 | 46 | userId: string | number; |
48 | 47 | username: string; |
49 | 48 | realName: string; |
... | ... | @@ -52,10 +51,9 @@ export interface GetUserInfoModel { |
52 | 51 | tenantName: string; |
53 | 52 | roles: string[]; |
54 | 53 | plainRoles?: PlainRoleInfo[]; |
55 | - } | |
54 | +} | |
56 | 55 | |
57 | - export interface PlainRoleInfo { | |
56 | +export interface PlainRoleInfo { | |
58 | 57 | roleName: string; |
59 | 58 | roleId: string; |
60 | 59 | } |
61 | - | ... | ... |
... | ... | @@ -5,7 +5,7 @@ import { |
5 | 5 | GetUserInfoModel, |
6 | 6 | UserInfoModel, |
7 | 7 | RefreshTokenParams, |
8 | - SmsLoginParams | |
8 | + SmsLoginParams, | |
9 | 9 | } from './model/userModel'; |
10 | 10 | |
11 | 11 | import { ErrorMessageMode } from '/#/axios'; |
... | ... | @@ -18,7 +18,7 @@ enum Api { |
18 | 18 | GetMyInfo = '/user/me/info', |
19 | 19 | GetPermCode = '/role/me/permissions', |
20 | 20 | RefreshToken = '/auth/token', |
21 | - SendLoginSmsCode = '/noauth/sendLoginSmsCode/' | |
21 | + SendLoginSmsCode = '/noauth/sendLoginSmsCode/', | |
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
... | ... | @@ -35,7 +35,7 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') |
35 | 35 | } |
36 | 36 | ); |
37 | 37 | } |
38 | -export function getMyInfo(){ | |
38 | +export function getMyInfo() { | |
39 | 39 | return defHttp.get<UserInfoModel>({ url: Api.GetMyInfo }); |
40 | 40 | } |
41 | 41 | /** |
... | ... | @@ -48,19 +48,17 @@ export function getUserInfo() { |
48 | 48 | export function getPermCode() { |
49 | 49 | return defHttp.get<string[]>({ url: Api.GetPermCode }); |
50 | 50 | } |
51 | -export async function SendLoginSmsCode(phoneNumber:string){ | |
52 | - return await defHttp.post<boolean>({url:Api.SendLoginSmsCode+phoneNumber}) | |
51 | +export async function SendLoginSmsCode(phoneNumber: string) { | |
52 | + return await defHttp.post<boolean>({ url: Api.SendLoginSmsCode + phoneNumber }); | |
53 | 53 | } |
54 | 54 | export function doLogout() { |
55 | 55 | // return defHttp.get({ url: Api.Logout }); |
56 | 56 | } |
57 | -export function doRefreshToken(params:RefreshTokenParams){ | |
58 | - return defHttp.post<LoginResultModel>( | |
59 | - { | |
60 | - url: Api.RefreshToken, | |
61 | - params, | |
62 | - } | |
63 | - ); | |
57 | +export function doRefreshToken(params: RefreshTokenParams) { | |
58 | + return defHttp.post<LoginResultModel>({ | |
59 | + url: Api.RefreshToken, | |
60 | + params, | |
61 | + }); | |
64 | 62 | } |
65 | 63 | export function smsCodeLoginApi(params: SmsLoginParams, mode: ErrorMessageMode = 'modal') { |
66 | 64 | return defHttp.post<LoginResultModel>( | ... | ... |
1 | -import {defHttp} from '/@/utils/http/axios'; | |
1 | +import { defHttp } from '/@/utils/http/axios'; | |
2 | 2 | |
3 | -import {DeptListGetResultModel, DeptListItem} from "/@/api/system/model/deptModel"; | |
4 | - | |
5 | -import {DeptOperationApiResult, DeptOperationParams} from "/@/api/system/model/deptModel"; | |
6 | -import {ErrorMessageMode} from "/#/axios"; | |
3 | +import { DeptListGetResultModel, DeptListItem } from '/@/api/system/model/deptModel'; | |
7 | 4 | |
5 | +import { DeptOperationApiResult, DeptOperationParams } from '/@/api/system/model/deptModel'; | |
6 | +import { ErrorMessageMode } from '/#/axios'; | |
8 | 7 | |
9 | 8 | enum Api { |
10 | 9 | DeptList = '/dept/all', |
... | ... | @@ -17,7 +16,11 @@ export const getDeptList = (params?: DeptListItem) => |
17 | 16 | /** |
18 | 17 | * @description: save or edit dept api |
19 | 18 | */ |
20 | -export function saveOrEditDeptApi(params: DeptOperationParams, update: boolean = false, mode: ErrorMessageMode = 'modal') { | |
19 | +export function saveOrEditDeptApi( | |
20 | + params: DeptOperationParams, | |
21 | + update = false, | |
22 | + mode: ErrorMessageMode = 'modal' | |
23 | +) { | |
21 | 24 | if (!update) { |
22 | 25 | return defHttp.post<DeptOperationApiResult>( |
23 | 26 | { |
... | ... | @@ -29,11 +32,14 @@ export function saveOrEditDeptApi(params: DeptOperationParams, update: boolean = |
29 | 32 | } |
30 | 33 | ); |
31 | 34 | } else { |
32 | - return defHttp.put<DeptOperationApiResult>({url: Api.basicUrl, params}, {errorMessageMode: mode}); | |
35 | + return defHttp.put<DeptOperationApiResult>( | |
36 | + { url: Api.basicUrl, params }, | |
37 | + { errorMessageMode: mode } | |
38 | + ); | |
33 | 39 | } |
34 | 40 | } |
35 | 41 | |
36 | 42 | export const delDept = (menuIds: string[]) => { |
37 | - let url = Api.basicUrl; | |
38 | - return defHttp.delete({url: url, data: menuIds}) | |
39 | -} | |
43 | + const url = Api.basicUrl; | |
44 | + return defHttp.delete({ url: url, data: menuIds }); | |
45 | +}; | ... | ... |
1 | -import {defHttp} from '/@/utils/http/axios'; | |
1 | +import { defHttp } from '/@/utils/http/axios'; | |
2 | 2 | import { |
3 | 3 | SysDictItem, |
4 | 4 | SysDict, |
5 | 5 | SysDictParams, |
6 | 6 | SysDictItemParams, |
7 | 7 | SysDictResultModel, |
8 | - SysDictItemResultModel, SysDictItemResult, DictCodeParams | |
8 | + SysDictItemResultModel, | |
9 | + SysDictItemResult, | |
10 | + DictCodeParams, | |
9 | 11 | } from './model/dictModel'; |
10 | 12 | |
11 | - | |
12 | 13 | enum SysDictApi { |
13 | 14 | CONFIG_URL = '/dict', |
14 | - CONFIG_ITEM_URL = '/dictItem' | |
15 | + CONFIG_ITEM_URL = '/dictItem', | |
15 | 16 | } |
16 | 17 | |
17 | 18 | /** |
18 | 19 | * 查找字典值 |
19 | 20 | * @param code |
20 | 21 | */ |
21 | -export const findDictItemByCode=(params? : DictCodeParams)=> | |
22 | -{ | |
22 | +export const findDictItemByCode = (params?: DictCodeParams) => { | |
23 | 23 | return defHttp.post<SysDictItemResult>({ |
24 | - url: SysDictApi.CONFIG_ITEM_URL + "/find", | |
24 | + url: SysDictApi.CONFIG_ITEM_URL + '/find', | |
25 | 25 | params, |
26 | - }) | |
26 | + }); | |
27 | 27 | }; |
28 | 28 | |
29 | 29 | /** |
... | ... | @@ -56,14 +56,14 @@ export const saveOrEditDictItem = (params: SysDictItem, isUpdate: boolean) => { |
56 | 56 | return defHttp.put<SysDictItemResultModel>({ |
57 | 57 | url: SysDictApi.CONFIG_ITEM_URL, |
58 | 58 | params, |
59 | - }) | |
59 | + }); | |
60 | 60 | } else { |
61 | 61 | return defHttp.post<SysDictItemResultModel>({ |
62 | 62 | url: SysDictApi.CONFIG_ITEM_URL, |
63 | 63 | params, |
64 | - }) | |
64 | + }); | |
65 | 65 | } |
66 | -} | |
66 | +}; | |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * 修改DictItem的状态 |
... | ... | @@ -74,11 +74,11 @@ export const setDictItemStatus = (id: string, status: number) => { |
74 | 74 | return defHttp.put<SysDictItemResultModel>({ |
75 | 75 | url: SysDictApi.CONFIG_ITEM_URL, |
76 | 76 | data: { |
77 | - "id": id, | |
78 | - "status": status | |
77 | + id: id, | |
78 | + status: status, | |
79 | 79 | }, |
80 | - }) | |
81 | -} | |
80 | + }); | |
81 | +}; | |
82 | 82 | |
83 | 83 | /** |
84 | 84 | * 保存或更新字典表 |
... | ... | @@ -90,29 +90,32 @@ export const saveOrEditDict = (params: SysDict, isUpdate: boolean) => { |
90 | 90 | return defHttp.put<SysDictResultModel>({ |
91 | 91 | url: SysDictApi.CONFIG_URL, |
92 | 92 | params, |
93 | - }) | |
93 | + }); | |
94 | 94 | } else { |
95 | 95 | return defHttp.post<SysDictResultModel>({ |
96 | 96 | url: SysDictApi.CONFIG_URL, |
97 | 97 | params, |
98 | - }) | |
98 | + }); | |
99 | 99 | } |
100 | -} | |
100 | +}; | |
101 | 101 | |
102 | 102 | /** |
103 | 103 | * 删除SysDict |
104 | 104 | * @param ids 删除id数组 |
105 | 105 | */ |
106 | 106 | export const deleteDict = (ids: string[]) => |
107 | - defHttp.delete({ | |
108 | - url: SysDictApi.CONFIG_URL, | |
109 | - data: { | |
110 | - ids: ids | |
107 | + defHttp.delete( | |
108 | + { | |
109 | + url: SysDictApi.CONFIG_URL, | |
110 | + data: { | |
111 | + ids: ids, | |
112 | + }, | |
111 | 113 | }, |
112 | - }, { | |
113 | - errorMessageMode: "message", | |
114 | - // catchFirst:true | |
115 | - }) | |
114 | + { | |
115 | + errorMessageMode: 'message', | |
116 | + // catchFirst:true | |
117 | + } | |
118 | + ); | |
116 | 119 | /** |
117 | 120 | * 删除SysDictItem |
118 | 121 | * @param ids 删除id数组 |
... | ... | @@ -121,7 +124,6 @@ export const deleteDictItem = (ids: string[]) => |
121 | 124 | defHttp.delete({ |
122 | 125 | url: SysDictApi.CONFIG_ITEM_URL, |
123 | 126 | data: { |
124 | - ids: ids | |
127 | + ids: ids, | |
125 | 128 | }, |
126 | - }) | |
127 | - | |
129 | + }); | ... | ... |
1 | -import {defHttp} from "/@/utils/http/axios"; | |
2 | -import {GroupListResultModel} from "/@/api/system/model/groupModel"; | |
1 | +import { defHttp } from '/@/utils/http/axios'; | |
2 | +import { GroupListResultModel } from '/@/api/system/model/groupModel'; | |
3 | 3 | |
4 | 4 | enum GroupApi { |
5 | - BASE_URL="/organization" | |
5 | + BASE_URL = '/organization', | |
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
9 | 9 | * 查询当前用户的所属组织 |
10 | 10 | */ |
11 | -export const findCurrentUserGroups=()=> | |
11 | +export const findCurrentUserGroups = () => | |
12 | 12 | defHttp.get<GroupListResultModel>({ |
13 | - url: GroupApi.BASE_URL+"/me/organizations", | |
13 | + url: GroupApi.BASE_URL + '/me/organizations', | |
14 | 14 | }); | ... | ... |
1 | -import {MenuOperationParams, MenuOperationApiResult} from "/@/api/system/model/menuModel"; | |
2 | -import {ErrorMessageMode} from "/#/axios"; | |
3 | -import {defHttp} from "/@/utils/http/axios"; | |
4 | - | |
1 | +import { MenuOperationParams, MenuOperationApiResult } from '/@/api/system/model/menuModel'; | |
2 | +import { ErrorMessageMode } from '/#/axios'; | |
3 | +import { defHttp } from '/@/utils/http/axios'; | |
5 | 4 | |
6 | 5 | enum Api { |
7 | 6 | Save = '/menu', |
... | ... | @@ -10,7 +9,11 @@ enum Api { |
10 | 9 | /** |
11 | 10 | * @description: save menu api |
12 | 11 | */ |
13 | -export function saveMenuApi(params: MenuOperationParams, update: boolean = false, mode: ErrorMessageMode = 'modal') { | |
12 | +export function saveMenuApi( | |
13 | + params: MenuOperationParams, | |
14 | + update: boolean = false, | |
15 | + mode: ErrorMessageMode = 'modal' | |
16 | +) { | |
14 | 17 | console.log(params); |
15 | 18 | if (!update) { |
16 | 19 | return defHttp.post<MenuOperationApiResult>( |
... | ... | @@ -23,6 +26,9 @@ export function saveMenuApi(params: MenuOperationParams, update: boolean = false |
23 | 26 | } |
24 | 27 | ); |
25 | 28 | } else { |
26 | - return defHttp.put<MenuOperationApiResult>({url: Api.Save, params}, {errorMessageMode: mode}); | |
29 | + return defHttp.put<MenuOperationApiResult>( | |
30 | + { url: Api.Save, params }, | |
31 | + { errorMessageMode: mode } | |
32 | + ); | |
27 | 33 | } |
28 | 34 | } | ... | ... |
1 | -import {BasicFetchResult} from "/@/api/model/baseModel"; | |
1 | +import { BasicFetchResult } from '/@/api/model/baseModel'; | |
2 | 2 | |
3 | 3 | export interface DeptOperationParams { |
4 | 4 | id: string; |
... | ... | @@ -6,18 +6,16 @@ export interface DeptOperationParams { |
6 | 6 | createTime: string; |
7 | 7 | tenantCode: string; |
8 | 8 | parentId?: string; |
9 | - orderNo:number; | |
10 | - status:number; | |
9 | + orderNo: number; | |
10 | + status: number; | |
11 | 11 | remark: string; |
12 | 12 | } |
13 | 13 | |
14 | - | |
15 | 14 | export interface DeptOperationApiResult { |
16 | 15 | message: string; |
17 | 16 | code: number; |
18 | 17 | } |
19 | 18 | |
20 | - | |
21 | 19 | export interface DeptListItem { |
22 | 20 | id: string; |
23 | 21 | deptName: string; | ... | ... |
1 | -import { | |
2 | - BasicPageParams, | |
3 | - BasicFetchResult | |
4 | -} from '/@/api/model/baseModel'; | |
1 | +import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel'; | |
5 | 2 | /** |
6 | 3 | * @description: Request list interface parameters |
7 | 4 | */ |
8 | 5 | export type SysDictParams = BasicPageParams & DictParams; |
9 | -export type SysDictItemParams = BasicPageParams & DictItemParams; | |
6 | +export type SysDictItemParams = BasicPageParams & DictItemParams; | |
10 | 7 | |
11 | -export type DictCodeParams={ | |
12 | - dictCode?:string; | |
13 | -} | |
8 | +export type DictCodeParams = { | |
9 | + dictCode?: string; | |
10 | +}; | |
14 | 11 | |
15 | 12 | export type DictParams = { |
16 | - dictName?:string; | |
17 | - dictCode?:string; | |
18 | -} | |
13 | + dictName?: string; | |
14 | + dictCode?: string; | |
15 | +}; | |
19 | 16 | |
20 | 17 | export interface SysDict { |
21 | 18 | id: string; |
... | ... | @@ -28,17 +25,17 @@ export interface SysDict { |
28 | 25 | } |
29 | 26 | |
30 | 27 | export type DictItemParams = { |
31 | - itemText?:string; | |
32 | - dictId?:string; | |
33 | -} | |
28 | + itemText?: string; | |
29 | + dictId?: string; | |
30 | +}; | |
34 | 31 | |
35 | -export interface SysDictItem{ | |
32 | +export interface SysDictItem { | |
36 | 33 | id: string; |
37 | - itemText:string; | |
38 | - itemValue:string; | |
39 | - description:string; | |
40 | - sort:number; | |
41 | - status:number; | |
34 | + itemText: string; | |
35 | + itemValue: string; | |
36 | + description: string; | |
37 | + sort: number; | |
38 | + status: number; | |
42 | 39 | createTime: string; |
43 | 40 | updateTime: string; |
44 | 41 | } |
... | ... | @@ -51,4 +48,3 @@ export type SysDictResultModel = BasicFetchResult<SysDict>; |
51 | 48 | export type SysDictItemResultModel = BasicFetchResult<SysDictItem>; |
52 | 49 | |
53 | 50 | export type SysDictItemResult = SysDictItem; |
54 | - | ... | ... |
1 | - | |
2 | -export interface GroupItem{ | |
3 | - id:string; | |
4 | - name:string; | |
5 | - parentId:string; | |
6 | - sort:number; | |
7 | - children?:GroupItem[]; | |
1 | +export interface GroupItem { | |
2 | + id: string; | |
3 | + name: string; | |
4 | + parentId: string; | |
5 | + sort: number; | |
6 | + children?: GroupItem[]; | |
8 | 7 | } |
9 | 8 | |
10 | 9 | export type GroupListResultModel = GroupItem[]; | ... | ... |
1 | - | |
2 | 1 | export interface MenuOperationApiResult { |
3 | 2 | message: string; |
4 | 3 | code: number; |
5 | 4 | } |
6 | 5 | |
7 | - | |
8 | 6 | export interface MenuOperationParams { |
9 | 7 | path: string; |
10 | 8 | component: any; |
11 | - type:string; | |
12 | - parentId:string; | |
9 | + type: string; | |
10 | + parentId: string; | |
13 | 11 | meta: metaModel; |
14 | 12 | name?: string; |
15 | 13 | alias?: string | string[]; |
... | ... | @@ -21,8 +19,8 @@ export interface MenuOperationParams { |
21 | 19 | export interface metaModel { |
22 | 20 | icon: string; |
23 | 21 | title: string; |
24 | - isLink:boolean; | |
25 | - menuType:number; | |
22 | + isLink: boolean; | |
23 | + menuType: number; | |
26 | 24 | ignoreKeepAlive?: boolean; |
27 | 25 | hideMenu: boolean; |
28 | 26 | status: number; | ... | ... |
1 | -import {BasicPageParams, BasicFetchResult} from '/@/api/model/baseModel'; | |
1 | +import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel'; | |
2 | 2 | |
3 | 3 | export type AccountParams = BasicPageParams & { |
4 | 4 | account?: string; |
... | ... | @@ -6,7 +6,7 @@ export type AccountParams = BasicPageParams & { |
6 | 6 | }; |
7 | 7 | |
8 | 8 | export type RoleParams = { |
9 | - roleType?:string; | |
9 | + roleType?: string; | |
10 | 10 | roleName?: string; |
11 | 11 | status?: string; |
12 | 12 | }; |
... | ... | @@ -30,10 +30,10 @@ export interface AccountListItem { |
30 | 30 | email: string; |
31 | 31 | realName: string; |
32 | 32 | roles: any; |
33 | - groupIds:any; | |
33 | + groupIds: any; | |
34 | 34 | createTime: string; |
35 | 35 | deptId: string; |
36 | - accountExpireTime?:string; | |
36 | + accountExpireTime?: string; | |
37 | 37 | } |
38 | 38 | |
39 | 39 | export interface OrganizationListItem { |
... | ... | @@ -69,16 +69,16 @@ export interface RoleReqDTO { |
69 | 69 | } |
70 | 70 | |
71 | 71 | export interface ChangeAccountParams { |
72 | - userId?:string; | |
73 | - password?:string; | |
74 | - resetPassword?:string; | |
72 | + userId?: string; | |
73 | + password?: string; | |
74 | + resetPassword?: string; | |
75 | 75 | } |
76 | 76 | |
77 | 77 | export class RoleOrOrganizationParam { |
78 | - userId:string; | |
79 | - queryRole:boolean; | |
80 | - queryOrganization:boolean; | |
81 | - constructor(userId:string,queryRole:boolean,queryOrganization:boolean){ | |
78 | + userId: string; | |
79 | + queryRole: boolean; | |
80 | + queryOrganization: boolean; | |
81 | + constructor(userId: string, queryRole: boolean, queryOrganization: boolean) { | |
82 | 82 | this.queryRole = queryRole; |
83 | 83 | this.queryOrganization = queryOrganization; |
84 | 84 | this.userId = userId; |
... | ... | @@ -99,4 +99,3 @@ export type RolePageListGetResultModel = BasicFetchResult<RoleListItem>; |
99 | 99 | export type RoleListGetResultModel = RoleListItem[]; |
100 | 100 | |
101 | 101 | export type AccountListModel = AccountListItem; |
102 | - | ... | ... |
... | ... | @@ -15,7 +15,7 @@ import { |
15 | 15 | RoleOrOrganizationParam, |
16 | 16 | ChangeAccountParams, |
17 | 17 | } from './model/systemModel'; |
18 | -import {defHttp} from '/@/utils/http/axios'; | |
18 | +import { defHttp } from '/@/utils/http/axios'; | |
19 | 19 | |
20 | 20 | enum Api { |
21 | 21 | AccountList = '/user/page', |
... | ... | @@ -28,33 +28,34 @@ enum Api { |
28 | 28 | DeleteRole = '/role', |
29 | 29 | GetAllRoleList = '/role/find/list', |
30 | 30 | BaseUserUrl = '/user', |
31 | - BaseOrganization = '/organization' | |
31 | + BaseOrganization = '/organization', | |
32 | 32 | } |
33 | 33 | |
34 | -export const getAccountInfo=(userId:string)=> | |
35 | - defHttp.get<AccountListModel>({url: Api.BaseUserUrl+"/"+userId}) | |
34 | +export const getAccountInfo = (userId: string) => | |
35 | + defHttp.get<AccountListModel>({ url: Api.BaseUserUrl + '/' + userId }); | |
36 | 36 | |
37 | 37 | export const getAccountList = (params: AccountParams) => |
38 | - defHttp.get<AccountListGetResultModel>({url: Api.AccountList, params}); | |
39 | - | |
38 | + defHttp.get<AccountListGetResultModel>({ url: Api.AccountList, params }); | |
40 | 39 | /** |
41 | 40 | * 获取组织列表 |
42 | 41 | * @param params 请求参数 |
43 | 42 | */ |
44 | 43 | export const getOrganizationList = (params?: OrganizationListItem) => |
45 | - defHttp.get<OrganizationListGetResultModel>({url: Api.BaseOrganization+'/me/organizations', params}); | |
44 | + defHttp.get<OrganizationListGetResultModel>({ | |
45 | + url: Api.BaseOrganization + '/me/organizations', | |
46 | + params, | |
47 | + }); | |
46 | 48 | |
47 | 49 | /** |
48 | 50 | * 更新或者保存组织 |
49 | 51 | * @param params |
50 | 52 | * @param isUpdate |
51 | 53 | */ |
52 | -export const saveOrUpdateOrganization = (params?:OrganizationListItem,isUpdate?:boolean) => | |
53 | -{ | |
54 | - if(isUpdate){ | |
55 | - return defHttp.put<OrganizationListGetResultModel>({url: Api.BaseOrganization, params}); | |
56 | - }else{ | |
57 | - return defHttp.post<OrganizationListGetResultModel>({url: Api.BaseOrganization, params}); | |
54 | +export const saveOrUpdateOrganization = (params?: OrganizationListItem, isUpdate?: boolean) => { | |
55 | + if (isUpdate) { | |
56 | + return defHttp.put<OrganizationListGetResultModel>({ url: Api.BaseOrganization, params }); | |
57 | + } else { | |
58 | + return defHttp.post<OrganizationListGetResultModel>({ url: Api.BaseOrganization, params }); | |
58 | 59 | } |
59 | 60 | }; |
60 | 61 | |
... | ... | @@ -63,32 +64,31 @@ export const saveOrUpdateOrganization = (params?:OrganizationListItem,isUpdate?: |
63 | 64 | * @param ids 删除的ID |
64 | 65 | */ |
65 | 66 | export const delOrganization = (ids: string[]) => |
66 | - defHttp.delete({url: Api.BaseOrganization, data: ids}) | |
67 | - | |
67 | + defHttp.delete({ url: Api.BaseOrganization, data: ids }); | |
68 | 68 | |
69 | 69 | export const getMenuList = (params?: MenuParams) => |
70 | - defHttp.get<MenuListGetResultModel>({url: Api.MenuList, params}); | |
70 | + defHttp.get<MenuListGetResultModel>({ url: Api.MenuList, params }); | |
71 | 71 | |
72 | 72 | export const getRoleListByPage = (params?: RolePageParams) => |
73 | - defHttp.get<RolePageListGetResultModel>({url: Api.RolePageList, params}); | |
74 | -export const getTenantRoleListByPage= (params?: RolePageParams) => | |
75 | - defHttp.get<RolePageListGetResultModel>({url: Api.RolePageList, params}); | |
73 | + defHttp.get<RolePageListGetResultModel>({ url: Api.RolePageList, params }); | |
74 | +export const getTenantRoleListByPage = (params?: RolePageParams) => | |
75 | + defHttp.get<RolePageListGetResultModel>({ url: Api.RolePageList, params }); | |
76 | 76 | |
77 | 77 | export const getAllRoleList = (params?: RoleParams) => |
78 | - defHttp.post<RoleListGetResultModel>({url: Api.GetAllRoleList, params}); | |
78 | + defHttp.post<RoleListGetResultModel>({ url: Api.GetAllRoleList, params }); | |
79 | 79 | |
80 | 80 | export const setRoleStatus = (id: number, status: number) => |
81 | - defHttp.put({url: Api.setRoleStatus + id + "/" + status}); | |
81 | + defHttp.put({ url: Api.setRoleStatus + id + '/' + status }); | |
82 | 82 | export const saveOrUpdateRoleInfoWithMenu = async (roleRequestDto: RoleReqDTO) => { |
83 | - await defHttp.post({url: Api.SaveOrUpdateRoleInfoWithMenu, params: roleRequestDto}); | |
84 | -} | |
83 | + await defHttp.post({ url: Api.SaveOrUpdateRoleInfoWithMenu, params: roleRequestDto }); | |
84 | +}; | |
85 | 85 | |
86 | 86 | export const isAccountExist = (account: string) => |
87 | - defHttp.get({url: Api.IsAccountExist + account}, {errorMessageMode: 'none'}); | |
87 | + defHttp.get({ url: Api.IsAccountExist + account }, { errorMessageMode: 'none' }); | |
88 | 88 | |
89 | 89 | export const delRole = async (roleIds: string[]) => { |
90 | - await defHttp.delete({url: Api.DeleteRole, params: roleIds}); | |
91 | -} | |
90 | + await defHttp.delete({ url: Api.DeleteRole, params: roleIds }); | |
91 | +}; | |
92 | 92 | |
93 | 93 | /** |
94 | 94 | * 更新或添加用户信息 |
... | ... | @@ -96,19 +96,19 @@ export const delRole = async (roleIds: string[]) => { |
96 | 96 | * @param isUpdate |
97 | 97 | * @constructor |
98 | 98 | */ |
99 | -export const SaveOrUpdateUserInfo = (params: AccountListItem, isUpdate: boolean)=>{ | |
99 | +export const SaveOrUpdateUserInfo = (params: AccountListItem, isUpdate: boolean) => { | |
100 | 100 | if (isUpdate) { |
101 | 101 | return defHttp.put<AccountListModel>({ |
102 | 102 | url: Api.BaseUserUrl, |
103 | 103 | params, |
104 | - }) | |
104 | + }); | |
105 | 105 | } else { |
106 | 106 | return defHttp.post<AccountListModel>({ |
107 | 107 | url: Api.BaseUserUrl, |
108 | 108 | params, |
109 | - }) | |
109 | + }); | |
110 | 110 | } |
111 | -} | |
111 | +}; | |
112 | 112 | /** |
113 | 113 | * 删除User |
114 | 114 | * @param ids 删除id数组 |
... | ... | @@ -117,26 +117,27 @@ export const deleteUser = (ids: string[]) => |
117 | 117 | defHttp.delete({ |
118 | 118 | url: Api.BaseUserUrl, |
119 | 119 | data: { |
120 | - ids: ids | |
120 | + ids: ids, | |
121 | 121 | }, |
122 | - }) | |
122 | + }); | |
123 | 123 | |
124 | 124 | /** |
125 | 125 | * 查询当前用户的关系 |
126 | 126 | * @param params |
127 | 127 | */ |
128 | -export const findCurrentUserRelation=(params:RoleOrOrganizationParam)=> | |
128 | + | |
129 | +export const findCurrentUserRelation = (params: RoleOrOrganizationParam) => | |
129 | 130 | defHttp.post<Array<string>>({ |
130 | - url: Api.BaseUserUrl+"/relation", | |
131 | - params:params | |
131 | + url: Api.BaseUserUrl + '/relation', | |
132 | + params: params, | |
132 | 133 | }); |
133 | 134 | |
134 | 135 | /** |
135 | 136 | * 修改密码 |
136 | 137 | * @param params |
137 | 138 | */ |
138 | -export const resetPassword=(params:ChangeAccountParams)=> | |
139 | +export const resetPassword = (params: ChangeAccountParams) => | |
139 | 140 | defHttp.post({ |
140 | - url: Api.BaseUserUrl + "/reset", | |
141 | - params:params | |
141 | + url: Api.BaseUserUrl + '/reset', | |
142 | + params: params, | |
142 | 143 | }); | ... | ... |
1 | -import {getPageData} from '../base'; | |
1 | +import { getPageData } from '../base'; | |
2 | 2 | import { |
3 | 3 | SendResetPasswordEmailMsg, |
4 | 4 | TenantAdminPageRequestParams, |
5 | 5 | TenantDTO, |
6 | 6 | TenantPageRequestParams, |
7 | - TenantRequestDTO, UserDTO | |
7 | + TenantRequestDTO, | |
8 | + UserDTO, | |
8 | 9 | } from './tenantInfo'; |
9 | -import {defHttp} from "/@/utils/http/axios"; | |
10 | +import { defHttp } from '/@/utils/http/axios'; | |
10 | 11 | |
11 | 12 | enum Api { |
12 | 13 | userPage = '/user/page', |
13 | 14 | tenantPage = '/admin/tenant/page', |
14 | 15 | saveTenantAdmin = '/user/saveTenantAdmin', |
15 | - updateOrCreateTenant = "/admin/tenant/updateOrCreateTenant", | |
16 | - deleteTenant = "/admin/tenant", | |
17 | - resetTenantAdminPassword = "/tenant/resetPassword/", | |
18 | - sendMessageOrEmail = "/tenant/sendRestPasswordMsg", | |
16 | + updateOrCreateTenant = '/admin/tenant/updateOrCreateTenant', | |
17 | + deleteTenant = '/admin/tenant', | |
18 | + resetTenantAdminPassword = '/tenant/resetPassword/', | |
19 | + sendMessageOrEmail = '/tenant/sendRestPasswordMsg', | |
19 | 20 | deleteTenantAdmin = '/admin/user/deleteTenantAdmin', |
20 | - getTenantRoles="/admin/tenant/roles/", | |
21 | + getTenantRoles = '/admin/tenant/roles/', | |
21 | 22 | } |
22 | 23 | |
23 | 24 | export function getTenantPage(params: TenantPageRequestParams) { |
... | ... | @@ -29,63 +30,49 @@ export function getTenantAdminPage(params: TenantAdminPageRequestParams) { |
29 | 30 | } |
30 | 31 | |
31 | 32 | export async function saveTenantAdmin(params: UserDTO) { |
32 | - await defHttp.post( | |
33 | - { | |
34 | - params: params, | |
35 | - url: Api.saveTenantAdmin | |
36 | - } | |
37 | - ); | |
33 | + await defHttp.post({ | |
34 | + params: params, | |
35 | + url: Api.saveTenantAdmin, | |
36 | + }); | |
38 | 37 | } |
39 | 38 | |
40 | 39 | export async function updateOrCreateTenant(params: TenantRequestDTO) { |
41 | - await defHttp.post( | |
42 | - { | |
43 | - params: params, | |
44 | - url: Api.updateOrCreateTenant | |
45 | - } | |
46 | - ); | |
40 | + await defHttp.post({ | |
41 | + params: params, | |
42 | + url: Api.updateOrCreateTenant, | |
43 | + }); | |
47 | 44 | } |
48 | 45 | |
49 | 46 | export async function deleteTenant(tenantIds: Array<string>) { |
50 | - await defHttp.delete( | |
51 | - { | |
52 | - data: tenantIds, | |
53 | - url: Api.deleteTenant | |
54 | - } | |
55 | - ); | |
47 | + await defHttp.delete({ | |
48 | + data: tenantIds, | |
49 | + url: Api.deleteTenant, | |
50 | + }); | |
56 | 51 | } |
57 | 52 | |
58 | 53 | export async function deleteTenantAdmin(adminIds: Array<string>) { |
59 | - await defHttp.delete( | |
60 | - { | |
61 | - data: adminIds, | |
62 | - url: Api.deleteTenantAdmin | |
63 | - } | |
64 | - ); | |
54 | + await defHttp.delete({ | |
55 | + data: adminIds, | |
56 | + url: Api.deleteTenantAdmin, | |
57 | + }); | |
65 | 58 | } |
66 | 59 | |
67 | 60 | export async function resetPassword(params: string) { |
68 | - await defHttp.post( | |
69 | - { | |
70 | - url: Api.resetTenantAdminPassword + params | |
71 | - } | |
72 | - ); | |
61 | + await defHttp.post({ | |
62 | + url: Api.resetTenantAdminPassword + params, | |
63 | + }); | |
73 | 64 | } |
74 | 65 | |
75 | 66 | export async function sendMessageOrEmail(params: SendResetPasswordEmailMsg) { |
76 | - await defHttp.post( | |
77 | - { | |
78 | - params: params, | |
79 | - url: Api.sendMessageOrEmail | |
80 | - } | |
81 | - ); | |
67 | + await defHttp.post({ | |
68 | + params: params, | |
69 | + url: Api.sendMessageOrEmail, | |
70 | + }); | |
82 | 71 | } |
83 | 72 | |
84 | -export function getTenantRoles(tenantCode:string){ | |
85 | - return defHttp.get( | |
86 | - { | |
87 | - params:tenantCode, | |
88 | - url:Api.getTenantRoles | |
89 | - } | |
90 | - ); | |
73 | +export function getTenantRoles(tenantCode: string) { | |
74 | + return defHttp.get({ | |
75 | + params: tenantCode, | |
76 | + url: Api.getTenantRoles, | |
77 | + }); | |
91 | 78 | } | ... | ... |
1 | -import {BaseQueryParams, BaseQueryRequest} from "../base"; | |
1 | +import { BaseQueryParams, BaseQueryRequest } from '../base'; | |
2 | 2 | |
3 | 3 | export enum TenantStatusEnum { |
4 | 4 | NORMAL = 'NORMAL', |
... | ... | @@ -54,13 +54,13 @@ export interface UserDTO { |
54 | 54 | accountExpireTime: string; |
55 | 55 | createTime: string; |
56 | 56 | updateTime: string; |
57 | - userStatusEnum: UserStatusEnum | |
57 | + userStatusEnum: UserStatusEnum; | |
58 | 58 | hasPassword?: boolean; |
59 | 59 | } |
60 | 60 | |
61 | 61 | export enum MessageTypeEnum { |
62 | 62 | EMAIL_MESSAGE = 'EMAIL_MESSAGE', |
63 | - PHONE_MESSAGE = 'PHONE_MESSAGE' | |
63 | + PHONE_MESSAGE = 'PHONE_MESSAGE', | |
64 | 64 | } |
65 | 65 | |
66 | 66 | export class SendResetPasswordEmailMsg { |
... | ... | @@ -71,13 +71,12 @@ export class SendResetPasswordEmailMsg { |
71 | 71 | this.userId = userId; |
72 | 72 | this.messageTypeEnum = msgType; |
73 | 73 | } |
74 | - | |
75 | 74 | } |
76 | 75 | |
77 | 76 | export class TenantPageRequest extends BaseQueryRequest { |
78 | 77 | tenantName: string | undefined; |
79 | 78 | |
80 | - constructor(page: number = 1, pageSize: number = 10, tenantName?: string) { | |
79 | + constructor(page = 1, pageSize = 10, tenantName?: string) { | |
81 | 80 | super(page, pageSize); |
82 | 81 | this.tenantName = tenantName; |
83 | 82 | } | ... | ... |
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | <template> |
6 | 6 | <div class="anticon" :class="getAppLogoClass" @click="goHome"> |
7 | 7 | <img src="../../../assets/images/logo.png" /> |
8 | - <div class="ml-2 md:opacity-100" :class="getTitleClass" v-show="showTitle"> | |
8 | + <div class="ml-2 md:opacity-100" :class="getTitleClass" v-show="showTitle"> | |
9 | 9 | {{ title }} |
10 | 10 | </div> |
11 | 11 | </div> | ... | ... |
1 | -<template><BasicModal | |
2 | - width="800px" | |
3 | - :title="t('component.upload.upload')" | |
4 | - :okText="t('component.upload.save')" | |
5 | - v-bind="$attrs" | |
6 | - @register="register" | |
7 | - @ok="handleOk" | |
8 | - :closeFunc="handleCloseFunc" | |
9 | - :maskClosable="false" | |
10 | - :keyboard="false" | |
11 | - wrapClassName="upload-modal" | |
12 | - :okButtonProps="getOkButtonProps" | |
13 | - :cancelButtonProps="{ disabled: isUploadingRef }" | |
14 | -> | |
15 | - | |
1 | +<template | |
2 | + ><BasicModal | |
3 | + width="800px" | |
4 | + :title="t('component.upload.upload')" | |
5 | + :okText="t('component.upload.save')" | |
6 | + v-bind="$attrs" | |
7 | + @register="register" | |
8 | + @ok="handleOk" | |
9 | + :closeFunc="handleCloseFunc" | |
10 | + :maskClosable="false" | |
11 | + :keyboard="false" | |
12 | + wrapClassName="upload-modal" | |
13 | + :okButtonProps="getOkButtonProps" | |
14 | + :cancelButtonProps="{ disabled: isUploadingRef }" | |
15 | + > | |
16 | 16 | <template #centerFooter> |
17 | 17 | <a-button |
18 | 18 | @click="handleStartUpload" | ... | ... |
1 | 1 | export enum RoleEnum { |
2 | - ROLE_SYS_ADMIN = "ROLE_SYS_ADMIN", | |
3 | - ROLE_TENANT_ADMIN = "ROLE_TENANT_ADMIN", | |
4 | - ROLE_NORMAL_USER = "ROLE_NORMAL_USER", | |
5 | - ROLE_PLATFORM_ADMIN="ROLE_PLATFORM_ADMIN" | |
2 | + ROLE_SYS_ADMIN = 'ROLE_SYS_ADMIN', | |
3 | + ROLE_TENANT_ADMIN = 'ROLE_TENANT_ADMIN', | |
4 | + ROLE_NORMAL_USER = 'ROLE_NORMAL_USER', | |
5 | + ROLE_PLATFORM_ADMIN = 'ROLE_PLATFORM_ADMIN', | |
6 | 6 | } | ... | ... |
1 | 1 | export default { |
2 | - common:{ | |
3 | - createTime:"create time", | |
4 | - updateTime:"update time", | |
5 | - operation:"operation", | |
6 | - remark:"remark", | |
7 | - enable:"enable", | |
8 | - disable:"disable", | |
9 | - sort:"sort", | |
10 | - status:"status", | |
2 | + common: { | |
3 | + createTime: 'create time', | |
4 | + updateTime: 'update time', | |
5 | + operation: 'operation', | |
6 | + remark: 'remark', | |
7 | + enable: 'enable', | |
8 | + disable: 'disable', | |
9 | + sort: 'sort', | |
10 | + status: 'status', | |
11 | 11 | }, |
12 | - tenant:{ | |
13 | - tenant:"tenant", | |
14 | - tenantManagement:"tenant management", | |
15 | - tenantSetting:"tenant setting" | |
16 | - }, | |
17 | - organization:{ | |
18 | - queryOrganizationName:"organization name", | |
19 | - toolOrganizationList:"organization list", | |
20 | - toolCreateOrganization:"create organization", | |
21 | - toolEditOrganization:"edit organization", | |
22 | - parentOrganization:"parent organization", | |
12 | + tenant: { | |
13 | + tenant: 'tenant', | |
14 | + tenantManagement: 'tenant management', | |
15 | + tenantSetting: 'tenant setting', | |
23 | 16 | }, |
24 | - dept:{ | |
25 | - queryDeptName:"dept name", | |
26 | - queryDeptStatus:"status", | |
27 | - toolDeptList:"dept list", | |
28 | - toolCreateDept:"create dept", | |
29 | - toolEditDept:"edit dept", | |
30 | - tableTitleDeptSort:"sort", | |
31 | - tableTitleDeptCreateTime:"create time", | |
32 | - tableTitleDeptOperation:"operation", | |
33 | - drawerTitleDeptEnable:"enable", | |
34 | - drawerTitleDeptDisable:"disable", | |
35 | - drawerTitleDeptParentDept:"parent dept", | |
36 | - tableTitleMemo:"memo" | |
17 | + organization: { | |
18 | + queryOrganizationName: 'organization name', | |
19 | + toolOrganizationList: 'organization list', | |
20 | + toolCreateOrganization: 'create organization', | |
21 | + toolEditOrganization: 'edit organization', | |
22 | + parentOrganization: 'parent organization', | |
37 | 23 | }, |
38 | - system:{ | |
39 | - system:"system", | |
40 | - accountManagement:"account management", | |
41 | - roleManagement:"role management", | |
42 | - menuManagement:"menu management", | |
43 | - deptManagement:"dept management", | |
44 | - modifyPassword:"modify password", | |
45 | - pageSystemTitleCreateMenu:"create menu", | |
46 | - pageSystemTitleCreateTenant:"new tenant", | |
47 | - pageSystemTitleEditMenu:"edit menu", | |
48 | - pageSystemTitleEditTenant:"edit tenant", | |
49 | - pageSystemTitleOperation:"operation", | |
50 | - pageSystemTitleWhetherDelete:"Are you sure to delete", | |
51 | - pageSystemTitleMenuList:"menu list", | |
52 | - menuEditPagesMenuType:"menu type", | |
53 | - menuEditPagesDirectory:"directory", | |
54 | - menuEditPagesMenu:"menu", | |
55 | - menuEditPagesButton:"button", | |
56 | - menuEditPagesParentMenu:"parent menu", | |
57 | - menuEditPagesRouterAddress:"router address", | |
58 | - menuEditPagesComponentsPath:"components", | |
59 | - menuEditPagesIsExt:"is ext", | |
60 | - menuEditPagesIsKeepAlive:"is keep alive", | |
61 | - menuEditPagesIsHide:"is hide", | |
62 | - menuEditPagesYes:"yes", | |
63 | - menuEditPagesNo:"no", | |
64 | - tableTitleSystemMenuName:"menu name", | |
65 | - tableTitleSystemIcon:"icon", | |
66 | - tableTitleSystemPermissionTag:"permission tag", | |
67 | - tableTitleSystemComponents:"components", | |
68 | - tableTitleSystemSort:"sort", | |
69 | - tableTitleSystemStatus:"status", | |
70 | - tableTitleSystemCreateTime:"create time", | |
71 | - tableTitleSystemEnable:"enable", | |
72 | - tableTitleSystemStop:"disable", | |
73 | - tableSuccessStatus:"success", | |
74 | - tableFailedStatus:"failed", | |
75 | - } | |
76 | - }; | |
24 | + dept: { | |
25 | + queryDeptName: 'dept name', | |
26 | + queryDeptStatus: 'status', | |
27 | + toolDeptList: 'dept list', | |
28 | + toolCreateDept: 'create dept', | |
29 | + toolEditDept: 'edit dept', | |
30 | + tableTitleDeptSort: 'sort', | |
31 | + tableTitleDeptCreateTime: 'create time', | |
32 | + tableTitleDeptOperation: 'operation', | |
33 | + drawerTitleDeptEnable: 'enable', | |
34 | + drawerTitleDeptDisable: 'disable', | |
35 | + drawerTitleDeptParentDept: 'parent dept', | |
36 | + tableTitleMemo: 'memo', | |
37 | + }, | |
38 | + system: { | |
39 | + system: 'system', | |
40 | + accountManagement: 'account management', | |
41 | + roleManagement: 'role management', | |
42 | + menuManagement: 'menu management', | |
43 | + deptManagement: 'dept management', | |
44 | + modifyPassword: 'modify password', | |
45 | + pageSystemTitleCreateMenu: 'create menu', | |
46 | + pageSystemTitleCreateTenant: 'new tenant', | |
47 | + pageSystemTitleEditMenu: 'edit menu', | |
48 | + pageSystemTitleEditTenant: 'edit tenant', | |
49 | + pageSystemTitleOperation: 'operation', | |
50 | + pageSystemTitleWhetherDelete: 'Are you sure to delete', | |
51 | + pageSystemTitleMenuList: 'menu list', | |
52 | + menuEditPagesMenuType: 'menu type', | |
53 | + menuEditPagesDirectory: 'directory', | |
54 | + menuEditPagesMenu: 'menu', | |
55 | + menuEditPagesButton: 'button', | |
56 | + menuEditPagesParentMenu: 'parent menu', | |
57 | + menuEditPagesRouterAddress: 'router address', | |
58 | + menuEditPagesComponentsPath: 'components', | |
59 | + menuEditPagesIsExt: 'is ext', | |
60 | + menuEditPagesIsKeepAlive: 'is keep alive', | |
61 | + menuEditPagesIsHide: 'is hide', | |
62 | + menuEditPagesYes: 'yes', | |
63 | + menuEditPagesNo: 'no', | |
64 | + tableTitleSystemMenuName: 'menu name', | |
65 | + tableTitleSystemIcon: 'icon', | |
66 | + tableTitleSystemPermissionTag: 'permission tag', | |
67 | + tableTitleSystemComponents: 'components', | |
68 | + tableTitleSystemSort: 'sort', | |
69 | + tableTitleSystemStatus: 'status', | |
70 | + tableTitleSystemCreateTime: 'create time', | |
71 | + tableTitleSystemEnable: 'enable', | |
72 | + tableTitleSystemStop: 'disable', | |
73 | + tableSuccessStatus: 'success', | |
74 | + tableFailedStatus: 'failed', | |
75 | + }, | |
76 | +}; | ... | ... |
... | ... | @@ -2,7 +2,7 @@ export default { |
2 | 2 | api: { |
3 | 3 | operationFailed: 'Operation failed', |
4 | 4 | errorTip: 'Error Tip', |
5 | - passwordOrUserNameError:'username or password not correct', | |
5 | + passwordOrUserNameError: 'username or password not correct', | |
6 | 6 | loginFailed: 'Login Failed', |
7 | 7 | errorMessage: 'The operation failed, the system is abnormal!', |
8 | 8 | timeoutMessage: 'Login timed out, please log in again!', | ... | ... |
1 | 1 | export default { |
2 | - common:{ | |
3 | - createTime:"创建时间", | |
4 | - updateTime:"更新时间", | |
5 | - operation:"操作", | |
6 | - remark:"备注", | |
7 | - enable:"启用", | |
8 | - disable:"禁用", | |
9 | - sort:"排序", | |
10 | - status:"状态" | |
11 | - }, | |
12 | - tenant:{ | |
13 | - tenant:"租户", | |
14 | - tenantManagement:"租户管理", | |
15 | - tenantSetting:"租户设置" | |
16 | - }, | |
17 | - organization:{ | |
18 | - queryOrganizationName:"组织名称", | |
19 | - toolOrganizationList:"组织列表", | |
20 | - toolCreateOrganization:"新增组织", | |
21 | - toolEditOrganization:"编辑组织", | |
22 | - parentOrganization:"上级组织", | |
2 | + common: { | |
3 | + createTime: '创建时间', | |
4 | + updateTime: '更新时间', | |
5 | + operation: '操作', | |
6 | + remark: '备注', | |
7 | + enable: '启用', | |
8 | + disable: '禁用', | |
9 | + sort: '排序', | |
10 | + status: '状态', | |
23 | 11 | }, |
24 | - dept:{ | |
25 | - queryDeptName:"部门名称", | |
26 | - queryDeptStatus:"状态", | |
27 | - toolDeptList:"部门列表", | |
28 | - toolCreateDept:"新增部门", | |
29 | - toolEditDept:"编辑部门", | |
30 | - tableTitleDeptSort:"排序", | |
31 | - tableTitleDeptCreateTime:"创建时间", | |
32 | - tableTitleDeptOperation:"操作", | |
33 | - drawerTitleDeptEnable:"启用", | |
34 | - drawerTitleDeptDisable:"停用", | |
35 | - drawerTitleDeptParentDept:"上级部门", | |
36 | - tableTitleMemo:"备注" | |
12 | + tenant: { | |
13 | + tenant: '租户', | |
14 | + tenantManagement: '租户管理', | |
15 | + tenantSetting: '租户设置', | |
37 | 16 | }, |
38 | - system:{ | |
39 | - system:"系统管理", | |
40 | - accountManagement:"账号管理", | |
41 | - roleManagement:"角色管理", | |
42 | - menuManagement:"菜单管理", | |
43 | - deptManagement:"部门管理", | |
44 | - modifyPassword:"修改密码", | |
45 | - pageSystemTitleCreateMenu:"新增菜单", | |
46 | - pageSystemTitleCreateTenant:"新增租户", | |
47 | - pageSystemTitleEditMenu:"编辑菜单", | |
48 | - pageSystemTitleEditTenant:"编辑租户", | |
49 | - pageSystemTitleOperation:"操作", | |
50 | - pageSystemTitleWhetherDelete:"是否确认删除", | |
51 | - pageSystemTitleMenuList:"菜单列表", | |
52 | - menuEditPagesMenuType:"菜单类型", | |
53 | - menuEditPagesDirectory:"目录", | |
54 | - menuEditPagesMenu:"菜单", | |
55 | - menuEditPagesButton:"按钮", | |
56 | - menuEditPagesParentMenu:"上级菜单", | |
57 | - menuEditPagesRouterAddress:"路由地址", | |
58 | - menuEditPagesComponentsPath:"组件路径", | |
59 | - menuEditPagesIsExt:"是否外链", | |
60 | - menuEditPagesIsKeepAlive:"是否缓存", | |
61 | - menuEditPagesIsHide:"是否隐藏", | |
62 | - menuEditPagesYes:"是", | |
63 | - menuEditPagesNo:"否", | |
64 | - tableTitleSystemMenuName:"菜单名称", | |
65 | - tableTitleSystemIcon:"图标", | |
66 | - tableTitleSystemPermissionTag:"权限标识", | |
67 | - tableTitleSystemComponents:"组件", | |
68 | - tableTitleSystemSort:"排序", | |
69 | - tableTitleSystemStatus:"状态", | |
70 | - tableTitleSystemCreateTime:"创建时间", | |
71 | - tableTitleSystemEnable:"启用", | |
72 | - tableTitleSystemStop:"停用", | |
73 | - tableSuccessStatus:"成功", | |
74 | - tableFailedStatus:"失败", | |
75 | - } | |
76 | - }; | |
17 | + organization: { | |
18 | + queryOrganizationName: '组织名称', | |
19 | + toolOrganizationList: '组织列表', | |
20 | + toolCreateOrganization: '新增组织', | |
21 | + toolEditOrganization: '编辑组织', | |
22 | + parentOrganization: '上级组织', | |
23 | + }, | |
24 | + dept: { | |
25 | + queryDeptName: '部门名称', | |
26 | + queryDeptStatus: '状态', | |
27 | + toolDeptList: '部门列表', | |
28 | + toolCreateDept: '新增部门', | |
29 | + toolEditDept: '编辑部门', | |
30 | + tableTitleDeptSort: '排序', | |
31 | + tableTitleDeptCreateTime: '创建时间', | |
32 | + tableTitleDeptOperation: '操作', | |
33 | + drawerTitleDeptEnable: '启用', | |
34 | + drawerTitleDeptDisable: '停用', | |
35 | + drawerTitleDeptParentDept: '上级部门', | |
36 | + tableTitleMemo: '备注', | |
37 | + }, | |
38 | + system: { | |
39 | + system: '系统管理', | |
40 | + accountManagement: '账号管理', | |
41 | + roleManagement: '角色管理', | |
42 | + menuManagement: '菜单管理', | |
43 | + deptManagement: '部门管理', | |
44 | + modifyPassword: '修改密码', | |
45 | + pageSystemTitleCreateMenu: '新增菜单', | |
46 | + pageSystemTitleCreateTenant: '新增租户', | |
47 | + pageSystemTitleEditMenu: '编辑菜单', | |
48 | + pageSystemTitleEditTenant: '编辑租户', | |
49 | + pageSystemTitleOperation: '操作', | |
50 | + pageSystemTitleWhetherDelete: '是否确认删除', | |
51 | + pageSystemTitleMenuList: '菜单列表', | |
52 | + menuEditPagesMenuType: '菜单类型', | |
53 | + menuEditPagesDirectory: '目录', | |
54 | + menuEditPagesMenu: '菜单', | |
55 | + menuEditPagesButton: '按钮', | |
56 | + menuEditPagesParentMenu: '上级菜单', | |
57 | + menuEditPagesRouterAddress: '路由地址', | |
58 | + menuEditPagesComponentsPath: '组件路径', | |
59 | + menuEditPagesIsExt: '是否外链', | |
60 | + menuEditPagesIsKeepAlive: '是否缓存', | |
61 | + menuEditPagesIsHide: '是否隐藏', | |
62 | + menuEditPagesYes: '是', | |
63 | + menuEditPagesNo: '否', | |
64 | + tableTitleSystemMenuName: '菜单名称', | |
65 | + tableTitleSystemIcon: '图标', | |
66 | + tableTitleSystemPermissionTag: '权限标识', | |
67 | + tableTitleSystemComponents: '组件', | |
68 | + tableTitleSystemSort: '排序', | |
69 | + tableTitleSystemStatus: '状态', | |
70 | + tableTitleSystemCreateTime: '创建时间', | |
71 | + tableTitleSystemEnable: '启用', | |
72 | + tableTitleSystemStop: '停用', | |
73 | + tableSuccessStatus: '成功', | |
74 | + tableFailedStatus: '失败', | |
75 | + }, | |
76 | +}; | ... | ... |
... | ... | @@ -63,9 +63,9 @@ export function initAppConfigStore() { |
63 | 63 | // init store |
64 | 64 | localeStore.initLocale(); |
65 | 65 | |
66 | - const userInfo = Persistent.getLocal(USER_INFO_KEY) as UserInfo | |
66 | + const userInfo = Persistent.getLocal(USER_INFO_KEY) as UserInfo; | |
67 | 67 | const userStore = useUserStore(); |
68 | - if(userInfo){ | |
68 | + if (userInfo) { | |
69 | 69 | userStore.setUserInfo(userInfo); |
70 | 70 | userStore.jwtToken = Persistent.getLocal(JWT_TOKEN_KEY) as string; |
71 | 71 | userStore.refreshToken = Persistent.getLocal(REFRESH_TOKEN_KEY) as string; | ... | ... |
... | ... | @@ -188,7 +188,7 @@ export const usePermissionStore = defineStore({ |
188 | 188 | routeList = (await getMenuList()) as AppRouteRecordRaw[]; |
189 | 189 | } catch (error) { |
190 | 190 | console.error(error); |
191 | - } // Dynamically introduce components | |
191 | + } // Dynamically introduce components | |
192 | 192 | routeList = transformObjToRoute(routeList); |
193 | 193 | |
194 | 194 | // Background routing to menu structure | ... | ... |
... | ... | @@ -4,15 +4,21 @@ import { defineStore } from 'pinia'; |
4 | 4 | import { store } from '/@/store'; |
5 | 5 | import { RoleEnum } from '/@/enums/roleEnum'; |
6 | 6 | import { PageEnum } from '/@/enums/pageEnum'; |
7 | -import { JWT_TOKEN_KEY, REFRESH_TOKEN_KEY, ROLES_KEY, TOKEN_KEY, USER_INFO_KEY } from '/@/enums/cacheEnum'; | |
7 | +import { | |
8 | + JWT_TOKEN_KEY, | |
9 | + REFRESH_TOKEN_KEY, | |
10 | + ROLES_KEY, | |
11 | + TOKEN_KEY, | |
12 | + USER_INFO_KEY, | |
13 | +} from '/@/enums/cacheEnum'; | |
8 | 14 | import { getAuthCache, setAuthCache } from '/@/utils/auth'; |
9 | 15 | import { |
10 | 16 | LoginParams, |
11 | 17 | LoginResultModel, |
12 | 18 | RefreshTokenParams, |
13 | - SmsLoginParams | |
19 | + SmsLoginParams, | |
14 | 20 | } from '/@/api/sys/model/userModel'; |
15 | -import {doRefreshToken, getMyInfo, loginApi, smsCodeLoginApi} from '/@/api/sys/user'; | |
21 | +import { doRefreshToken, getMyInfo, loginApi, smsCodeLoginApi } from '/@/api/sys/user'; | |
16 | 22 | import { useI18n } from '/@/hooks/web/useI18n'; |
17 | 23 | import { useMessage } from '/@/hooks/web/useMessage'; |
18 | 24 | import { router } from '/@/router'; |
... | ... | @@ -26,8 +32,8 @@ interface UserState { |
26 | 32 | roleList: RoleEnum[]; |
27 | 33 | sessionTimeout?: boolean; |
28 | 34 | lastUpdateTime: number; |
29 | - jwtToken?:string; | |
30 | - refreshToken?:string; | |
35 | + jwtToken?: string; | |
36 | + refreshToken?: string; | |
31 | 37 | } |
32 | 38 | |
33 | 39 | export const useUserStore = defineStore({ |
... | ... | @@ -38,7 +44,7 @@ export const useUserStore = defineStore({ |
38 | 44 | // token |
39 | 45 | jwtToken: undefined, |
40 | 46 | //refresh Token |
41 | - refreshToken:undefined, | |
47 | + refreshToken: undefined, | |
42 | 48 | // roleList |
43 | 49 | roleList: [], |
44 | 50 | // Whether the login expired |
... | ... | @@ -67,11 +73,11 @@ export const useUserStore = defineStore({ |
67 | 73 | }, |
68 | 74 | }, |
69 | 75 | actions: { |
70 | - storeToken(jwtToken:string,refreshToken:string){ | |
76 | + storeToken(jwtToken: string, refreshToken: string) { | |
71 | 77 | this.jwtToken = jwtToken; |
72 | 78 | this.refreshToken = refreshToken; |
73 | - setAuthCache(JWT_TOKEN_KEY,jwtToken); | |
74 | - setAuthCache(REFRESH_TOKEN_KEY,refreshToken); | |
79 | + setAuthCache(JWT_TOKEN_KEY, jwtToken); | |
80 | + setAuthCache(REFRESH_TOKEN_KEY, refreshToken); | |
75 | 81 | }, |
76 | 82 | setToken(info: string | undefined) { |
77 | 83 | this.token = info; |
... | ... | @@ -107,34 +113,34 @@ export const useUserStore = defineStore({ |
107 | 113 | try { |
108 | 114 | const { goHome = true, mode, ...loginParams } = params; |
109 | 115 | const data = await loginApi(loginParams, mode); |
110 | - return this.process(data,goHome); | |
116 | + return this.process(data, goHome); | |
111 | 117 | } catch (error) { |
112 | 118 | return Promise.reject(error); |
113 | 119 | } |
114 | 120 | }, |
115 | - async process(data: LoginResultModel, goHome?: boolean): Promise<UserInfo | null> { | |
116 | - const {token, refreshToken} = data; | |
117 | - this.storeToken(token, refreshToken); | |
118 | - // get user info | |
119 | - const userInfo = await this.getMyUserInfoAction(); | |
121 | + async process(data: LoginResultModel, goHome?: boolean): Promise<UserInfo | null> { | |
122 | + const { token, refreshToken } = data; | |
123 | + this.storeToken(token, refreshToken); | |
124 | + // get user info | |
125 | + const userInfo = await this.getMyUserInfoAction(); | |
120 | 126 | |
121 | - const sessionTimeout = this.sessionTimeout; | |
122 | - if (sessionTimeout) { | |
123 | - this.setSessionTimeout(false); | |
124 | - } else if (goHome) { | |
125 | - const permissionStore = usePermissionStore(); | |
126 | - if (!permissionStore.isDynamicAddedRoute) { | |
127 | - const routes = await permissionStore.buildRoutesAction(); | |
128 | - routes.forEach((route) => { | |
129 | - router.addRoute(route as unknown as RouteRecordRaw); | |
130 | - }); | |
131 | - router.addRoute(PAGE_NOT_FOUND_ROUTE as unknown as RouteRecordRaw); | |
132 | - permissionStore.setDynamicAddedRoute(true); | |
133 | - } | |
134 | - await router.replace(userInfo.homePath || PageEnum.BASE_HOME); | |
135 | - } | |
136 | - return userInfo; | |
137 | - }, | |
127 | + const sessionTimeout = this.sessionTimeout; | |
128 | + if (sessionTimeout) { | |
129 | + this.setSessionTimeout(false); | |
130 | + } else if (goHome) { | |
131 | + const permissionStore = usePermissionStore(); | |
132 | + if (!permissionStore.isDynamicAddedRoute) { | |
133 | + const routes = await permissionStore.buildRoutesAction(); | |
134 | + routes.forEach((route) => { | |
135 | + router.addRoute(route as unknown as RouteRecordRaw); | |
136 | + }); | |
137 | + router.addRoute(PAGE_NOT_FOUND_ROUTE as unknown as RouteRecordRaw); | |
138 | + permissionStore.setDynamicAddedRoute(true); | |
139 | + } | |
140 | + await router.replace(userInfo.homePath || PageEnum.BASE_HOME); | |
141 | + } | |
142 | + return userInfo; | |
143 | + }, | |
138 | 144 | async smsCodelogin( |
139 | 145 | params: SmsLoginParams & { |
140 | 146 | goHome?: boolean; |
... | ... | @@ -144,7 +150,7 @@ export const useUserStore = defineStore({ |
144 | 150 | try { |
145 | 151 | const { goHome = true, mode, ...loginParams } = params; |
146 | 152 | const data = await smsCodeLoginApi(loginParams, mode); |
147 | - return this.process(data,goHome); | |
153 | + return this.process(data, goHome); | |
148 | 154 | } catch (error) { |
149 | 155 | return Promise.reject(error); |
150 | 156 | } |
... | ... | @@ -167,21 +173,21 @@ export const useUserStore = defineStore({ |
167 | 173 | // console.log('注销Token失败'); |
168 | 174 | // } |
169 | 175 | this.resetState(); |
170 | - setAuthCache(JWT_TOKEN_KEY,undefined); | |
171 | - setAuthCache(REFRESH_TOKEN_KEY,undefined); | |
176 | + setAuthCache(JWT_TOKEN_KEY, undefined); | |
177 | + setAuthCache(REFRESH_TOKEN_KEY, undefined); | |
172 | 178 | // this.setSessionTimeout(false); |
173 | 179 | // goLogin && router.push(PageEnum.BASE_LOGIN); |
174 | 180 | await router.push(PageEnum.BASE_LOGIN); |
175 | 181 | }, |
176 | 182 | |
177 | - async doRefresh(){ | |
178 | - try{ | |
179 | - const req = {"refreshToken":this.refreshToken} as RefreshTokenParams; | |
183 | + async doRefresh() { | |
184 | + try { | |
185 | + const req = { refreshToken: this.refreshToken } as RefreshTokenParams; | |
180 | 186 | const data = await doRefreshToken(req); |
181 | 187 | const { token, refreshToken } = data; |
182 | - this.storeToken(token,refreshToken); | |
183 | - }catch(error){ | |
184 | - this.logout() | |
188 | + this.storeToken(token, refreshToken); | |
189 | + } catch (error) { | |
190 | + this.logout(); | |
185 | 191 | } |
186 | 192 | }, |
187 | 193 | |
... | ... | @@ -207,4 +213,3 @@ export const useUserStore = defineStore({ |
207 | 213 | export function useUserStoreWithOut() { |
208 | 214 | return useUserStore(store); |
209 | 215 | } |
210 | - | ... | ... |
1 | 1 | import { Persistent, BasicKeys } from '/@/utils/cache/persistent'; |
2 | 2 | import { CacheTypeEnum } from '/@/enums/cacheEnum'; |
3 | 3 | import projectSetting from '/@/settings/projectSetting'; |
4 | -import { JWT_TOKEN_KEY,REFRESH_TOKEN_KEY } from '/@/enums/cacheEnum'; | |
4 | +import { JWT_TOKEN_KEY, REFRESH_TOKEN_KEY } from '/@/enums/cacheEnum'; | |
5 | 5 | |
6 | 6 | const { permissionCacheType } = projectSetting; |
7 | 7 | const isLocal = permissionCacheType === CacheTypeEnum.LOCAL; |
... | ... | @@ -20,9 +20,9 @@ export function clearAuthCache(immediate = true) { |
20 | 20 | const fn = isLocal ? Persistent.clearLocal : Persistent.clearSession; |
21 | 21 | return fn(immediate); |
22 | 22 | } |
23 | -export function getJwtToken(){ | |
24 | - return getAuthCache(JWT_TOKEN_KEY); | |
23 | +export function getJwtToken() { | |
24 | + return getAuthCache(JWT_TOKEN_KEY); | |
25 | 25 | } |
26 | -export function getRefreshToken(){ | |
26 | +export function getRefreshToken() { | |
27 | 27 | return getAuthCache(REFRESH_TOKEN_KEY); |
28 | 28 | } | ... | ... |
... | ... | @@ -105,11 +105,23 @@ window.addEventListener('beforeunload', function () { |
105 | 105 | // LOCK_INFO_KEY 在锁屏和解锁时写入,此处也不应修改 |
106 | 106 | ls.set(APP_LOCAL_CACHE_KEY, { |
107 | 107 | ...omit(localMemory.getCache, LOCK_INFO_KEY), |
108 | - ...pick(ls.get(APP_LOCAL_CACHE_KEY), [TOKEN_KEY,JWT_TOKEN_KEY,REFRESH_TOKEN_KEY, USER_INFO_KEY, LOCK_INFO_KEY]), | |
108 | + ...pick(ls.get(APP_LOCAL_CACHE_KEY), [ | |
109 | + TOKEN_KEY, | |
110 | + JWT_TOKEN_KEY, | |
111 | + REFRESH_TOKEN_KEY, | |
112 | + USER_INFO_KEY, | |
113 | + LOCK_INFO_KEY, | |
114 | + ]), | |
109 | 115 | }); |
110 | 116 | ss.set(APP_SESSION_CACHE_KEY, { |
111 | 117 | ...omit(sessionMemory.getCache, LOCK_INFO_KEY), |
112 | - ...pick(ss.get(APP_SESSION_CACHE_KEY), [TOKEN_KEY,JWT_TOKEN_KEY,REFRESH_TOKEN_KEY, USER_INFO_KEY, LOCK_INFO_KEY]), | |
118 | + ...pick(ss.get(APP_SESSION_CACHE_KEY), [ | |
119 | + TOKEN_KEY, | |
120 | + JWT_TOKEN_KEY, | |
121 | + REFRESH_TOKEN_KEY, | |
122 | + USER_INFO_KEY, | |
123 | + LOCK_INFO_KEY, | |
124 | + ]), | |
113 | 125 | }); |
114 | 126 | }); |
115 | 127 | ... | ... |
src/utils/fnUtils.ts
0 → 100644
1 | +export const copyTransFun = (arr: any[]) => { | |
2 | + arr.forEach((item) => { | |
3 | + if (item.name) { | |
4 | + item.label = item.name; | |
5 | + delete item.name; | |
6 | + } | |
7 | + if (item.id) { | |
8 | + item.value = item.id; | |
9 | + delete item.id; | |
10 | + } | |
11 | + if (item.children) { | |
12 | + if (item.children.length) { | |
13 | + copyTransFun(item.children); | |
14 | + } | |
15 | + } | |
16 | + }); | |
17 | +}; | ... | ... |
... | ... | @@ -10,7 +10,7 @@ import { ContentTypeEnum } from '/@/enums/httpEnum'; |
10 | 10 | import { RequestEnum } from '/@/enums/httpEnum'; |
11 | 11 | import { useUserStore } from '/@/store/modules/user'; |
12 | 12 | import { JwtModel } from '/@/api/sys/jwtModel'; |
13 | -import jwt_decode from "jwt-decode"; | |
13 | +import jwt_decode from 'jwt-decode'; | |
14 | 14 | |
15 | 15 | export * from './axiosTransform'; |
16 | 16 | |
... | ... | @@ -20,14 +20,14 @@ export * from './axiosTransform'; |
20 | 20 | export class VAxios { |
21 | 21 | private axiosInstance: AxiosInstance; |
22 | 22 | private readonly options: CreateAxiosOptions; |
23 | - private waitingQueue:any[]; | |
23 | + private waitingQueue: any[]; | |
24 | 24 | private refreshing = false; |
25 | 25 | |
26 | 26 | constructor(options: CreateAxiosOptions) { |
27 | 27 | this.options = options; |
28 | 28 | this.axiosInstance = axios.create(options); |
29 | 29 | this.setupInterceptors(); |
30 | - this.waitingQueue=[]; | |
30 | + this.waitingQueue = []; | |
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
... | ... | @@ -69,15 +69,15 @@ export class VAxios { |
69 | 69 | * JWT 自动刷新 |
70 | 70 | * @description: 自动刷新token |
71 | 71 | */ |
72 | - private isNeedTokenURL(url, arr = ['/auth/login', '/auth/token']) { | |
72 | + private isNeedTokenURL(url, arr = ['/auth/login', '/auth/token']) { | |
73 | 73 | return !arr.some((val) => url.indexOf(val) > -1); |
74 | 74 | } |
75 | - | |
75 | + | |
76 | 76 | /** |
77 | - * | |
78 | - * @returns | |
77 | + * | |
78 | + * @returns | |
79 | 79 | */ |
80 | - private refreshTokenBeforeReq(doRefreshTokenApi: () => Promise<unknown>): Promise<unknown> { | |
80 | + private refreshTokenBeforeReq(doRefreshTokenApi: () => Promise<unknown>): Promise<unknown> { | |
81 | 81 | // 创建一个未完成的promise,把改变状态的resolve方法交给请求token结束后执行 |
82 | 82 | const promise = new Promise((resolve) => { |
83 | 83 | console.log('等待新token'); |
... | ... | @@ -88,7 +88,7 @@ export class VAxios { |
88 | 88 | this.refreshing = true; |
89 | 89 | // 模拟请求刷新Token接口,当接口返回数据时执行then方法 TODO 添加catch捕获异常 |
90 | 90 | doRefreshTokenApi().then(() => { |
91 | - console.log('刷新token成功,放行队列中的请求',this.waitingQueue.length); | |
91 | + console.log('刷新token成功,放行队列中的请求', this.waitingQueue.length); | |
92 | 92 | this.refreshing = false; |
93 | 93 | this.waitingQueue.forEach((cb) => cb()); |
94 | 94 | this.waitingQueue.length = 0; |
... | ... | @@ -116,19 +116,18 @@ export class VAxios { |
116 | 116 | // Request interceptor configuration processing |
117 | 117 | this.axiosInstance.interceptors.request.use(async (config: AxiosRequestConfig) => { |
118 | 118 | // If cancel repeat request is turned on, then cancel repeat request is prohibited |
119 | - const userStore = useUserStore(); | |
120 | - if(userStore && userStore.jwtToken){ | |
121 | - try{ | |
122 | - const res = jwt_decode(userStore.jwtToken) as JwtModel; | |
123 | - const currentTime = new Date().getTime()/1000; | |
124 | - if(currentTime >= res.exp && this.isNeedTokenURL(config.url)){ | |
125 | - await this.refreshTokenBeforeReq(userStore.doRefresh); | |
126 | - } | |
127 | - }catch(error){ | |
119 | + const userStore = useUserStore(); | |
120 | + if (userStore && userStore.jwtToken) { | |
121 | + try { | |
122 | + const res = jwt_decode(userStore.jwtToken) as JwtModel; | |
123 | + const currentTime = new Date().getTime() / 1000; | |
124 | + if (currentTime >= res.exp && this.isNeedTokenURL(config.url)) { | |
125 | + await this.refreshTokenBeforeReq(userStore.doRefresh); | |
126 | + } | |
127 | + } catch (error) { | |
128 | 128 | userStore.logout(); |
129 | - } | |
130 | - | |
131 | - } | |
129 | + } | |
130 | + } | |
132 | 131 | const { |
133 | 132 | headers: { ignoreCancelToken }, |
134 | 133 | } = config; | ... | ... |
... | ... | @@ -93,7 +93,7 @@ const transform: AxiosTransform = { |
93 | 93 | const token = getJwtToken(); |
94 | 94 | if (token && (config as Recordable)?.requestOptions?.withToken !== false) { |
95 | 95 | // jwt token |
96 | - config.headers["X-Authorization"] = options.authenticationScheme | |
96 | + config.headers['X-Authorization'] = options.authenticationScheme | |
97 | 97 | ? `${options.authenticationScheme} ${token}` |
98 | 98 | : token; |
99 | 99 | } |
... | ... | @@ -111,10 +111,10 @@ const transform: AxiosTransform = { |
111 | 111 | * @description: 响应错误处理 |
112 | 112 | */ |
113 | 113 | responseInterceptorsCatch: (error: any) => { |
114 | - const {t} = useI18n(); | |
114 | + const { t } = useI18n(); | |
115 | 115 | const errorLogStore = useErrorLogStoreWithOut(); |
116 | 116 | errorLogStore.addAjaxErrorInfo(error); |
117 | - const {response, code, message, config} = error || {}; | |
117 | + const { response, code, message, config } = error || {}; | |
118 | 118 | const errorMessageMode = config?.requestOptions?.errorMessageMode || 'none'; |
119 | 119 | const msg: string = response?.data?.msg ?? ''; |
120 | 120 | const err: string = error?.toString?.() ?? ''; |
... | ... | @@ -130,13 +130,13 @@ const transform: AxiosTransform = { |
130 | 130 | |
131 | 131 | if (errMessage) { |
132 | 132 | if (errorMessageMode === 'modal') { |
133 | - createErrorModal({title: t('sys.api.errorTip'), content: errMessage}); | |
133 | + createErrorModal({ title: t('sys.api.errorTip'), content: errMessage }); | |
134 | 134 | } else if (errorMessageMode === 'message') { |
135 | 135 | createMessage.error(errMessage); |
136 | 136 | } |
137 | 137 | return Promise.reject(error); |
138 | 138 | } |
139 | - } catch (error) { | |
139 | + } catch (error: any) { | |
140 | 140 | throw new Error(error); |
141 | 141 | } |
142 | 142 | ... | ... |
1 | 1 | /* list To Tree */ |
2 | 2 | |
3 | -import {getMenuListResultModel} from "/@/api/sys/model/menuModel"; | |
4 | -import {useI18n} from "/@/hooks/web/useI18n"; | |
5 | - | |
3 | +import { getMenuListResultModel } from '/@/api/sys/model/menuModel'; | |
4 | +import { useI18n } from '/@/hooks/web/useI18n'; | |
6 | 5 | |
7 | 6 | export function listToTree(lists: getMenuListResultModel): getMenuListResultModel { |
8 | 7 | const { t } = useI18n(); //加载国际化 |
9 | - lists.forEach(goods => { | |
8 | + lists.forEach((goods) => { | |
10 | 9 | goods['menuName'] = t(goods.meta.title); // 为goods添加属性menuName |
11 | 10 | |
12 | 11 | // console.log(goods.children?.length); |
13 | - if(goods.children?.length){ | |
14 | - goods.children.forEach(goodChildren => { | |
12 | + if (goods.children?.length) { | |
13 | + goods.children.forEach((goodChildren) => { | |
15 | 14 | goodChildren['menuName'] = t(goodChildren.meta.title); // 为goodChildren添加属性menuName |
16 | - }) | |
15 | + }); | |
17 | 16 | } |
18 | - }) | |
17 | + }); | |
19 | 18 | |
20 | 19 | return lists; |
21 | - | |
22 | 20 | } |
23 | - | |
24 | - | |
25 | - | |
26 | - | |
27 | - | |
28 | - | |
29 | - | ... | ... |
src/views/alarm/position/config.data.ts
0 → 100644
1 | +import { FormSchema } from '/@/components/Table'; | |
2 | +export const formSchema: FormSchema[] = [ | |
3 | + { | |
4 | + field: 'organization', | |
5 | + label: '', | |
6 | + component: 'TreeSelect', | |
7 | + componentProps: {}, | |
8 | + }, | |
9 | + { | |
10 | + field: 'organization', | |
11 | + label: '', | |
12 | + component: 'Select', | |
13 | + componentProps: {}, | |
14 | + }, | |
15 | + { | |
16 | + field: 'device', | |
17 | + label: '', | |
18 | + slot: 'device', | |
19 | + component: 'Input', | |
20 | + }, | |
21 | +]; | ... | ... |
src/views/alarm/position/index.vue
0 → 100644
1 | +<template> | |
2 | + <div class="wrapper"> | |
3 | + <div ref="wrapRef" :style="{ height, width }"> </div> | |
4 | + <div class="right-wrap"> | |
5 | + <BasicForm @register="registerForm"> | |
6 | + <template #device> | |
7 | + <div class="flex justify-between"> | |
8 | + <a-input v-model:value="deviceValue" placeholder="请输入设备名称" style="width: 70%" /> | |
9 | + <a-button color="success" @click="handleReset" class="w-1/4">复位查询</a-button> | |
10 | + </div> | |
11 | + </template> | |
12 | + </BasicForm> | |
13 | + <div> | |
14 | + <RadioGroup v-model:value="deviceStatus"> | |
15 | + <Radio :value="1">全部</Radio> | |
16 | + <Radio :value="2">在线</Radio> | |
17 | + <Radio :value="3">离线</Radio> | |
18 | + <Radio :value="4">报警</Radio> | |
19 | + </RadioGroup> | |
20 | + <div class="scroll-wrap"> | |
21 | + <ScrollContainer ref="scrollRef"> | |
22 | + <template | |
23 | + v-for="(item, index) in 10" | |
24 | + :key="index" | |
25 | + :class="{ active: currentIndex == index }" | |
26 | + @click="bander(index)" | |
27 | + > | |
28 | + <div class="flex" style="border-bottom: 1px solid #ccc"> | |
29 | + <div> | |
30 | + <div class="flex"> | |
31 | + <div class="font-bold ml-5">名称 </div> | |
32 | + <div class="ml-5">发动机{{ item }}</div> | |
33 | + </div> | |
34 | + <div class="flex"> | |
35 | + <div class="font-bold ml-5">位置 </div> | |
36 | + <div class="ml-5 font-bold">四川省成都市高新区{{ item }}</div> | |
37 | + </div> | |
38 | + </div> | |
39 | + <div class="self-center ml-10"><Tag color="default">离线</Tag></div> | |
40 | + </div> | |
41 | + </template> | |
42 | + </ScrollContainer> | |
43 | + </div> | |
44 | + <div class="flex justify-end"> | |
45 | + <Pagination v-model:current="current" :total="50" size="small" show-less-items /> | |
46 | + </div> | |
47 | + </div> | |
48 | + </div> | |
49 | + </div> | |
50 | +</template> | |
51 | +<script lang="ts"> | |
52 | + import { defineComponent, ref, nextTick, unref, onMounted } from 'vue'; | |
53 | + import { useScript } from '/@/hooks/web/useScript'; | |
54 | + import { BasicForm, useForm } from '/@/components/Form/index'; | |
55 | + import { formSchema } from './config.data'; | |
56 | + import { RadioGroup, Radio, Tag, Pagination } from 'ant-design-vue'; | |
57 | + import { ScrollContainer, ScrollActionType } from '/@/components/Container/index'; | |
58 | + export default defineComponent({ | |
59 | + name: 'BaiduMap', | |
60 | + components: { | |
61 | + BasicForm, | |
62 | + RadioGroup, | |
63 | + Radio, | |
64 | + Tag, | |
65 | + ScrollContainer, | |
66 | + Pagination, | |
67 | + }, | |
68 | + props: { | |
69 | + width: { | |
70 | + type: String, | |
71 | + default: '100%', | |
72 | + }, | |
73 | + height: { | |
74 | + type: String, | |
75 | + default: 'calc(100vh - 78px)', | |
76 | + }, | |
77 | + }, | |
78 | + | |
79 | + setup() { | |
80 | + const BAI_DU_MAP_URL = | |
81 | + 'https://api.map.baidu.com/getscript?v=3.0&ak=7uOPPyAHn2Y2ZryeQqHtcRqtIY374vKa'; | |
82 | + const wrapRef = ref<HTMLDivElement | null>(null); | |
83 | + const scrollRef = ref<Nullable<ScrollActionType>>(null); | |
84 | + const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); | |
85 | + async function initMap() { | |
86 | + await toPromise(); | |
87 | + await nextTick(); | |
88 | + const wrapEl = unref(wrapRef); | |
89 | + const BMap = (window as any).BMap; | |
90 | + if (!wrapEl) return; | |
91 | + const map = new BMap.Map(wrapEl); | |
92 | + const point = new BMap.Point(116.14282, 35.19515); | |
93 | + map.centerAndZoom(point, 15); | |
94 | + map.enableScrollWheelZoom(true); | |
95 | + } | |
96 | + onMounted(() => { | |
97 | + initMap(); | |
98 | + }); | |
99 | + const deviceValue = ref(''); | |
100 | + const deviceStatus = ref(1); | |
101 | + const current = ref(2); | |
102 | + const currentIndex = ref(1); | |
103 | + const bander = (index: number) => { | |
104 | + currentIndex.value = index; | |
105 | + }; | |
106 | + const [registerForm] = useForm({ | |
107 | + labelWidth: 90, | |
108 | + schemas: formSchema, | |
109 | + showActionButtonGroup: false, | |
110 | + }); | |
111 | + const handleReset = () => { | |
112 | + deviceValue.value = ''; | |
113 | + }; | |
114 | + return { | |
115 | + wrapRef, | |
116 | + registerForm, | |
117 | + deviceValue, | |
118 | + deviceStatus, | |
119 | + handleReset, | |
120 | + scrollRef, | |
121 | + current, | |
122 | + currentIndex, | |
123 | + bander, | |
124 | + }; | |
125 | + }, | |
126 | + }); | |
127 | +</script> | |
128 | + | |
129 | +<style scoped> | |
130 | + .wrapper { | |
131 | + position: relative; | |
132 | + } | |
133 | + .active { | |
134 | + background-color: #fff; | |
135 | + } | |
136 | + .right-wrap { | |
137 | + padding-top: 10px; | |
138 | + width: 20%; | |
139 | + height: 80%; | |
140 | + position: absolute; | |
141 | + right: 5%; | |
142 | + top: 10%; | |
143 | + background-color: #f3f8fe; | |
144 | + } | |
145 | + .scroll-wrap { | |
146 | + height: 450px; | |
147 | + background-color: #f3f8fe; | |
148 | + } | |
149 | +</style> | ... | ... |
src/views/alarm/template/ContactDrawer.vue
renamed from
src/views/device/DeviceDrawer.vue
... | ... | @@ -4,10 +4,10 @@ |
4 | 4 | @register="registerDrawer" |
5 | 5 | showFooter |
6 | 6 | :title="getTitle" |
7 | - width="500px" | |
7 | + width="30%" | |
8 | 8 | @ok="handleSubmit" |
9 | 9 | > |
10 | - <BasicForm @register="registerForm"/> | |
10 | + <BasicForm @register="registerForm" /> | |
11 | 11 | </BasicDrawer> |
12 | 12 | </template> |
13 | 13 | <script lang="ts"> |
... | ... | @@ -15,17 +15,17 @@ |
15 | 15 | import { BasicForm, useForm } from '/@/components/Form'; |
16 | 16 | import { formSchema } from './config.data'; |
17 | 17 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
18 | - import {saveOrEditMessageConfig} from "/@/api/message/config"; | |
19 | - import {useMessage} from "/@/hooks/web/useMessage"; | |
18 | + import { saveOrEditAlarmContact } from '/@/api/alarm/contact/alarmContact'; | |
19 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
20 | 20 | |
21 | 21 | export default defineComponent({ |
22 | - name: 'ConfigDrawer', | |
22 | + name: 'ContactDrawer', | |
23 | 23 | components: { BasicDrawer, BasicForm }, |
24 | 24 | emits: ['success', 'register'], |
25 | 25 | setup(_, { emit }) { |
26 | 26 | const isUpdate = ref(true); |
27 | 27 | |
28 | - const [registerForm, { validate,setFieldsValue,resetFields }] = useForm({ | |
28 | + const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ | |
29 | 29 | labelWidth: 120, |
30 | 30 | schemas: formSchema, |
31 | 31 | showActionButtonGroup: false, |
... | ... | @@ -36,53 +36,34 @@ |
36 | 36 | setDrawerProps({ confirmLoading: false }); |
37 | 37 | isUpdate.value = !!data?.isUpdate; |
38 | 38 | if (unref(isUpdate)) { |
39 | - const config = data.record.config; | |
40 | - for (const key in config){ | |
41 | - Reflect.set(data.record, key+'', config[key]); | |
42 | - } | |
43 | 39 | await setFieldsValue({ |
44 | 40 | ...data.record, |
45 | 41 | }); |
46 | 42 | } |
47 | 43 | }); |
48 | 44 | |
49 | - const getTitle = computed(() => (!unref(isUpdate) ? '新增消息配置' : '编辑消息配置')); | |
45 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增联系人配置' : '编辑联系人配置')); | |
50 | 46 | |
51 | 47 | async function handleSubmit() { |
52 | 48 | try { |
53 | 49 | const values = await validate(); |
54 | 50 | const { createMessage } = useMessage(); |
55 | 51 | setDrawerProps({ confirmLoading: true }); |
56 | - let config={}; | |
57 | - if(values.messageType === 'PHONE_MESSAGE'){ | |
58 | - config ={ | |
59 | - "accessKeyId":values.accessKeyId, | |
60 | - "accessKeySecret":values.accessKeySecret, | |
61 | - } | |
62 | - }else if(values.messageType === 'EMAIL_MESSAGE'){ | |
63 | - config ={ | |
64 | - "host":values.host, | |
65 | - "port":values.port, | |
66 | - "username":values.username, | |
67 | - "password":values.password, | |
68 | - } | |
69 | - } | |
70 | - Reflect.set(values, 'config', config); | |
71 | - let saveMessage = "添加成功"; | |
72 | - let updateMessage = "修改成功"; | |
73 | - await saveOrEditMessageConfig(values, unref(isUpdate)); | |
52 | + let saveMessage = '添加成功'; | |
53 | + let updateMessage = '修改成功'; | |
54 | + await saveOrEditAlarmContact(values, unref(isUpdate)); | |
74 | 55 | closeDrawer(); |
75 | 56 | emit('success'); |
76 | - createMessage.success(unref(isUpdate)?updateMessage:saveMessage); | |
57 | + createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | |
77 | 58 | } finally { |
78 | 59 | setDrawerProps({ confirmLoading: false }); |
79 | 60 | } |
80 | 61 | } |
81 | 62 | |
82 | 63 | return { |
64 | + getTitle, | |
83 | 65 | registerDrawer, |
84 | 66 | registerForm, |
85 | - getTitle, | |
86 | 67 | handleSubmit, |
87 | 68 | }; |
88 | 69 | }, | ... | ... |
src/views/alarm/template/config.data.ts
0 → 100644
1 | +import { BasicColumn } from '/@/components/Table'; | |
2 | +import { FormSchema } from '/@/components/Table'; | |
3 | +import { getOrganizationList } from '/@/api/system/system'; | |
4 | +import { copyTransFun } from '/@/utils/fnUtils'; | |
5 | +// 表格列数据 | |
6 | +export const columns: BasicColumn[] = [ | |
7 | + { | |
8 | + title: '姓名', | |
9 | + dataIndex: 'username', | |
10 | + width: 120, | |
11 | + }, | |
12 | + { | |
13 | + title: '所属组织', | |
14 | + dataIndex: 'organizationId', | |
15 | + width: 160, | |
16 | + }, | |
17 | + { | |
18 | + title: '手机', | |
19 | + dataIndex: 'phone', | |
20 | + width: 160, | |
21 | + }, | |
22 | + { | |
23 | + title: '邮箱', | |
24 | + dataIndex: 'email', | |
25 | + width: 160, | |
26 | + }, | |
27 | + { | |
28 | + title: '微信', | |
29 | + dataIndex: 'wechat', | |
30 | + width: 180, | |
31 | + }, | |
32 | + { | |
33 | + title: '备注', | |
34 | + dataIndex: 'remark', | |
35 | + width: 120, | |
36 | + }, | |
37 | + { | |
38 | + title: '添加人', | |
39 | + dataIndex: 'addPeople', | |
40 | + width: 180, | |
41 | + }, | |
42 | + { | |
43 | + title: '添加时间', | |
44 | + dataIndex: 'createTime', | |
45 | + width: 180, | |
46 | + }, | |
47 | + { | |
48 | + title: '更新时间', | |
49 | + dataIndex: 'updateTime', | |
50 | + width: 180, | |
51 | + }, | |
52 | +]; | |
53 | + | |
54 | +// 查询字段 | |
55 | +export const searchFormSchema: FormSchema[] = [ | |
56 | + { | |
57 | + field: 'username', | |
58 | + label: '联系人姓名', | |
59 | + component: 'Input', | |
60 | + colProps: { span: 6 }, | |
61 | + componentProps: { | |
62 | + placeholder: '请输入联系人姓名', | |
63 | + }, | |
64 | + }, | |
65 | +]; | |
66 | + | |
67 | +// 弹框配置项 | |
68 | +export const formSchema: FormSchema[] = [ | |
69 | + { | |
70 | + field: 'username', | |
71 | + label: '联系人姓名', | |
72 | + required: true, | |
73 | + component: 'Input', | |
74 | + componentProps: { | |
75 | + placeholder: '请输入联系人姓名', | |
76 | + }, | |
77 | + }, | |
78 | + { | |
79 | + field: 'organizationId', | |
80 | + label: '所属组织', | |
81 | + component: 'ApiTreeSelect', | |
82 | + componentProps: { | |
83 | + api: async () => { | |
84 | + const data = await getOrganizationList(); | |
85 | + copyTransFun(data as any as any[]); | |
86 | + return data; | |
87 | + }, | |
88 | + }, | |
89 | + }, | |
90 | + { | |
91 | + field: 'phone', | |
92 | + label: '手机号码', | |
93 | + required: true, | |
94 | + component: 'Input', | |
95 | + componentProps: { | |
96 | + placeholder: '请输入手机号码', | |
97 | + }, | |
98 | + }, | |
99 | + { | |
100 | + field: 'email', | |
101 | + label: '邮箱', | |
102 | + component: 'Input', | |
103 | + componentProps: { | |
104 | + placeholder: '请输入邮箱', | |
105 | + }, | |
106 | + }, | |
107 | + { | |
108 | + field: 'wechat', | |
109 | + label: '微信', | |
110 | + component: 'Input', | |
111 | + componentProps: { | |
112 | + placeholder: '请输入微信号', | |
113 | + }, | |
114 | + }, | |
115 | + { | |
116 | + field: 'addPeople', | |
117 | + label: '添加人', | |
118 | + component: 'Input', | |
119 | + componentProps: { | |
120 | + placeholder: '请输入添加人', | |
121 | + }, | |
122 | + }, | |
123 | + { | |
124 | + field: 'remark', | |
125 | + label: '备注', | |
126 | + component: 'InputTextArea', | |
127 | + componentProps: { | |
128 | + placeholder: '', | |
129 | + }, | |
130 | + }, | |
131 | + { | |
132 | + field: 'id', | |
133 | + label: '', | |
134 | + component: 'Input', | |
135 | + componentProps: { | |
136 | + style: { | |
137 | + display: 'none', | |
138 | + }, | |
139 | + }, | |
140 | + }, | |
141 | +]; | ... | ... |
src/views/alarm/template/index.vue
0 → 100644
1 | +<template> | |
2 | + <PageWrapper dense contentFullHeight fixedHeight contentClass="flex"> | |
3 | + <OrganizationIdTree class="w-1/4 xl:w-1/5" @select="handleSelect" /> | |
4 | + <BasicTable @register="registerTable" :searchInfo="searchInfo" class="w-3/4 xl:w-4/5"> | |
5 | + <template #toolbar> | |
6 | + <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增联系人 </a-button> | |
7 | + <a-button | |
8 | + type="primary" | |
9 | + color="error" | |
10 | + @click="handleDeleteOrBatchDelete(null)" | |
11 | + :disabled="hasBatchDelete" | |
12 | + > | |
13 | + 批量删除 | |
14 | + </a-button> | |
15 | + </template> | |
16 | + <template #action="{ record }"> | |
17 | + <TableAction | |
18 | + :actions="[ | |
19 | + { | |
20 | + label: '编辑', | |
21 | + icon: 'clarity:note-edit-line', | |
22 | + onClick: handleCreateOrEdit.bind(null, record), | |
23 | + }, | |
24 | + { | |
25 | + label: '删除', | |
26 | + icon: 'ant-design:delete-outlined', | |
27 | + color: 'error', | |
28 | + popConfirm: { | |
29 | + title: '是否确认删除', | |
30 | + confirm: handleDeleteOrBatchDelete.bind(null, record), | |
31 | + }, | |
32 | + }, | |
33 | + ]" | |
34 | + /> | |
35 | + </template> | |
36 | + </BasicTable> | |
37 | + </PageWrapper> | |
38 | + <ContactDrawer @register="registerDrawer" @success="handleSuccess" /> | |
39 | +</template> | |
40 | + | |
41 | +<script lang="ts"> | |
42 | + import { defineComponent, reactive, ref, computed } from 'vue'; | |
43 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
44 | + import { PageWrapper } from '/@/components/Page'; | |
45 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
46 | + import { useDrawer } from '/@/components/Drawer'; | |
47 | + import ContactDrawer from './ContactDrawer.vue'; | |
48 | + import OrganizationIdTree from '../../common/OrganizationIdTree.vue'; | |
49 | + import { getAlarmContact, deleteAlarmContact } from '/@/api/alarm/contact/alarmContact'; | |
50 | + import { searchFormSchema, columns } from './config.data'; | |
51 | + export default defineComponent({ | |
52 | + components: { | |
53 | + PageWrapper, | |
54 | + OrganizationIdTree, | |
55 | + BasicTable, | |
56 | + TableAction, | |
57 | + ContactDrawer, | |
58 | + }, | |
59 | + setup() { | |
60 | + let selectedRowIds = ref<string[]>([]); | |
61 | + const hasBatchDelete = computed(() => selectedRowIds.value.length <= 0); | |
62 | + // 复选框事件 | |
63 | + const onSelectRowChange = (selectedRowKeys: string[]) => { | |
64 | + selectedRowIds.value = selectedRowKeys; | |
65 | + }; | |
66 | + // 表格hooks | |
67 | + const [registerTable, { reload }] = useTable({ | |
68 | + api: getAlarmContact, | |
69 | + columns, | |
70 | + formConfig: { | |
71 | + labelWidth: 120, | |
72 | + schemas: searchFormSchema, | |
73 | + }, | |
74 | + useSearchForm: true, | |
75 | + showTableSetting: true, | |
76 | + bordered: true, | |
77 | + rowSelection: { | |
78 | + onChange: onSelectRowChange, | |
79 | + type: 'checkbox', | |
80 | + }, | |
81 | + rowKey: 'id', | |
82 | + actionColumn: { | |
83 | + width: 180, | |
84 | + title: '操作', | |
85 | + dataIndex: 'action', | |
86 | + slots: { customRender: 'action' }, | |
87 | + fixed: 'right', | |
88 | + }, | |
89 | + }); | |
90 | + // 弹框 | |
91 | + const [registerDrawer, { openDrawer }] = useDrawer(); | |
92 | + const { createMessage } = useMessage(); | |
93 | + const searchInfo = reactive<Recordable>({}); | |
94 | + // 刷新 | |
95 | + const handleSuccess = () => { | |
96 | + reload(); | |
97 | + }; | |
98 | + // 新增或编辑 | |
99 | + const handleCreateOrEdit = (record: Recordable) => { | |
100 | + if (record) { | |
101 | + openDrawer(true, { | |
102 | + isUpdate: true, | |
103 | + record, | |
104 | + }); | |
105 | + } else { | |
106 | + openDrawer(true, { | |
107 | + isUpdate: false, | |
108 | + }); | |
109 | + } | |
110 | + }; | |
111 | + // 删除或批量删除 | |
112 | + const handleDeleteOrBatchDelete = async (record?: Recordable) => { | |
113 | + if (record) { | |
114 | + try { | |
115 | + await deleteAlarmContact([record.id]); | |
116 | + createMessage.success('删除联系人成功'); | |
117 | + handleSuccess(); | |
118 | + } catch (e) { | |
119 | + createMessage.error('删除失败'); | |
120 | + } | |
121 | + } else { | |
122 | + try { | |
123 | + await deleteAlarmContact(selectedRowIds.value); | |
124 | + createMessage.success('批量删除联系人成功'); | |
125 | + handleSuccess(); | |
126 | + } catch (e) { | |
127 | + createMessage.info('删除失败'); | |
128 | + } | |
129 | + } | |
130 | + }; | |
131 | + | |
132 | + // 树形选择器 | |
133 | + const handleSelect = (organizationId: string) => { | |
134 | + searchInfo.organizationId = organizationId; | |
135 | + handleSuccess(); | |
136 | + }; | |
137 | + return { | |
138 | + searchInfo, | |
139 | + hasBatchDelete, | |
140 | + handleCreateOrEdit, | |
141 | + handleDeleteOrBatchDelete, | |
142 | + handleSelect, | |
143 | + handleSuccess, | |
144 | + registerTable, | |
145 | + registerDrawer, | |
146 | + }; | |
147 | + }, | |
148 | + }); | |
149 | +</script> | ... | ... |
src/views/device/DeviceModal.vue
0 → 100644
1 | +<template> | |
2 | + <BasicModal | |
3 | + v-bind="$attrs" | |
4 | + width="55rem" | |
5 | + @register="register" | |
6 | + :title="getTitle" | |
7 | + @visible-change="handleVisibleChange" | |
8 | + @cancel="handleCancel" | |
9 | + > | |
10 | + <div class="step-form-form"> | |
11 | + <a-steps :current="current"> | |
12 | + <a-step title="填写设备信息" /> | |
13 | + <a-step title="添加设备凭证" /> | |
14 | + </a-steps> | |
15 | + </div> | |
16 | + <div class="mt-5"> | |
17 | + <DeviceStep1 @next="handleStep1Next" v-show="current === 0" /> | |
18 | + <DeviceStep2 | |
19 | + @prev="handleStepPrev" | |
20 | + @next="handleStep2Next" | |
21 | + v-show="current === 1" | |
22 | + v-if="initStep2" | |
23 | + /> | |
24 | + </div> | |
25 | + </BasicModal> | |
26 | +</template> | |
27 | +<script lang="ts"> | |
28 | + import { defineComponent, ref, nextTick, computed, unref, reactive, toRefs } from 'vue'; | |
29 | + import { BasicModal, useModalInner } from '/@/components/Modal'; | |
30 | + import DeviceStep1 from '/@/views/device/step/DeviceStep1.vue'; | |
31 | + import DeviceStep2 from '/@/views/device/step/DeviceStep2.vue'; | |
32 | + import { Steps } from 'ant-design-vue'; | |
33 | + export default defineComponent({ | |
34 | + name: 'DeviceModal', | |
35 | + components: { | |
36 | + BasicModal, | |
37 | + DeviceStep1, | |
38 | + DeviceStep2, | |
39 | + [Steps.name]: Steps, | |
40 | + [Steps.Step.name]: Steps.Step, | |
41 | + }, | |
42 | + props: { | |
43 | + userData: { type: Object }, | |
44 | + }, | |
45 | + setup(props) { | |
46 | + const state = reactive({ | |
47 | + initStep2: false, | |
48 | + }); | |
49 | + const current = ref(0); | |
50 | + const isUpdate = ref(true); | |
51 | + const modelRef = ref({}); | |
52 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增设备' : '编辑设备')); | |
53 | + | |
54 | + const [register] = useModalInner((data) => { | |
55 | + isUpdate.value = !!data?.isUpdate; | |
56 | + data && onDataReceive(data); | |
57 | + }); | |
58 | + | |
59 | + function handleStepPrev() { | |
60 | + current.value--; | |
61 | + } | |
62 | + function handleStep1Next(step1Values: any) { | |
63 | + current.value++; | |
64 | + state.initStep2 = true; | |
65 | + console.log(step1Values); | |
66 | + } | |
67 | + function handleStep2Next(step2Values: any) { | |
68 | + current.value++; | |
69 | + console.log(step2Values); | |
70 | + } | |
71 | + function handleRedo() { | |
72 | + current.value = 0; | |
73 | + state.initStep2 = false; | |
74 | + } | |
75 | + function handleCancel() { | |
76 | + console.log('关闭了弹框'); | |
77 | + } | |
78 | + | |
79 | + function onDataReceive(data) { | |
80 | + console.log('Data Received', data); | |
81 | + // 方式1; | |
82 | + // setFieldsValue({ | |
83 | + // field2: data.data, | |
84 | + // field1: data.info, | |
85 | + // }); | |
86 | + | |
87 | + // // 方式2 | |
88 | + modelRef.value = { field2: data.data, field1: data.info }; | |
89 | + | |
90 | + // setProps({ | |
91 | + // model:{ field2: data.data, field1: data.info } | |
92 | + // }) | |
93 | + } | |
94 | + | |
95 | + function handleVisibleChange(v) { | |
96 | + v && props.userData && nextTick(() => onDataReceive(props.userData)); | |
97 | + } | |
98 | + | |
99 | + return { | |
100 | + register, | |
101 | + model: modelRef, | |
102 | + getTitle, | |
103 | + handleVisibleChange, | |
104 | + current, | |
105 | + ...toRefs(state), | |
106 | + handleStepPrev, | |
107 | + handleStep1Next, | |
108 | + handleStep2Next, | |
109 | + handleCancel, | |
110 | + handleRedo, | |
111 | + }; | |
112 | + }, | |
113 | + }); | |
114 | +</script> | ... | ... |
... | ... | @@ -3,6 +3,7 @@ import { FormSchema } from '/@/components/Table'; |
3 | 3 | import { findDictItemByCode } from '/@/api/system/dict'; |
4 | 4 | import { MessageEnum } from '/@/enums/messageEnum'; |
5 | 5 | import { DeviceTypeEnum, DeviceState } from '/@/api/device/model/deviceModel'; |
6 | +// 表格列数据 | |
6 | 7 | export const columns: BasicColumn[] = [ |
7 | 8 | { |
8 | 9 | title: '默认', |
... | ... | @@ -41,7 +42,6 @@ export const columns: BasicColumn[] = [ |
41 | 42 | width: 120, |
42 | 43 | slots: { customRender: 'deviceState' }, |
43 | 44 | }, |
44 | - | |
45 | 45 | { |
46 | 46 | title: '最后连接时间', |
47 | 47 | dataIndex: 'lastConnectTime', |
... | ... | @@ -54,6 +54,7 @@ export const columns: BasicColumn[] = [ |
54 | 54 | }, |
55 | 55 | ]; |
56 | 56 | |
57 | +// 查询字段 | |
57 | 58 | export const searchFormSchema: FormSchema[] = [ |
58 | 59 | { |
59 | 60 | field: 'deviceType', |
... | ... | @@ -89,13 +90,7 @@ export const searchFormSchema: FormSchema[] = [ |
89 | 90 | }, |
90 | 91 | ]; |
91 | 92 | |
92 | -export const isMessage = (type: string) => { | |
93 | - return type === MessageEnum.IS_SMS; | |
94 | -}; | |
95 | -export const isEmail = (type: string) => { | |
96 | - return type === MessageEnum.IS_EMAIL; | |
97 | -}; | |
98 | - | |
93 | +// 弹框配置项 | |
99 | 94 | export const formSchema: FormSchema[] = [ |
100 | 95 | { |
101 | 96 | field: 'configName', |
... | ... | @@ -206,3 +201,10 @@ export const formSchema: FormSchema[] = [ |
206 | 201 | component: 'InputTextArea', |
207 | 202 | }, |
208 | 203 | ]; |
204 | + | |
205 | +export const isMessage = (type: string) => { | |
206 | + return type === MessageEnum.IS_SMS; | |
207 | +}; | |
208 | +export const isEmail = (type: string) => { | |
209 | + return type === MessageEnum.IS_EMAIL; | |
210 | +}; | ... | ... |
src/views/device/device.data.ts
0 → 100644
1 | +import { BasicColumn } from '/@/components/Table'; | |
2 | +import { FormSchema } from '/@/components/Table'; | |
3 | +import { findDictItemByCode } from '/@/api/system/dict'; | |
4 | +import { DeviceTypeEnum, DeviceState } from '/@/api/device/model/deviceModel'; | |
5 | +export const columns: BasicColumn[] = [ | |
6 | + { | |
7 | + title: '设备名称', | |
8 | + dataIndex: 'name', | |
9 | + width: 120, | |
10 | + }, | |
11 | + { | |
12 | + title: '设备类型', | |
13 | + dataIndex: 'deviceType', | |
14 | + width: 100, | |
15 | + slots: { customRender: 'deviceType' }, | |
16 | + }, | |
17 | + { | |
18 | + title: '设备配置', | |
19 | + dataIndex: 'deviceProfile.name', | |
20 | + width: 160, | |
21 | + slots: { customRender: 'deviceProfile' }, | |
22 | + }, | |
23 | + | |
24 | + { | |
25 | + title: '所属组织', | |
26 | + dataIndex: 'organizationId', | |
27 | + slots: { customRender: 'organizationId' }, | |
28 | + }, | |
29 | + { | |
30 | + title: '标签', | |
31 | + dataIndex: 'label', | |
32 | + width: 180, | |
33 | + }, | |
34 | + { | |
35 | + title: '状态', | |
36 | + dataIndex: 'deviceState', | |
37 | + width: 120, | |
38 | + slots: { customRender: 'deviceState' }, | |
39 | + }, | |
40 | + | |
41 | + { | |
42 | + title: '最后连接时间', | |
43 | + dataIndex: 'lastConnectTime', | |
44 | + width: 180, | |
45 | + }, | |
46 | +]; | |
47 | + | |
48 | +export const searchFormSchema: FormSchema[] = [ | |
49 | + { | |
50 | + field: 'deviceType', | |
51 | + label: '设备类型', | |
52 | + component: 'Select', | |
53 | + componentProps: { | |
54 | + options: [ | |
55 | + { label: '网关设备', value: DeviceTypeEnum.GATEWAY }, | |
56 | + { label: '直连设备', value: DeviceTypeEnum.DIRECT_CONNECTION }, | |
57 | + { label: '网关子设备', value: DeviceTypeEnum.SENSOR }, | |
58 | + ], | |
59 | + }, | |
60 | + colProps: { span: 4 }, | |
61 | + }, | |
62 | + { | |
63 | + field: 'deviceState', | |
64 | + label: '设备状态', | |
65 | + component: 'Select', | |
66 | + componentProps: { | |
67 | + options: [ | |
68 | + { label: '待激活', value: DeviceState.INACTIVE }, | |
69 | + { label: '在线', value: DeviceState.ONLINE }, | |
70 | + { label: '离线', value: DeviceState.OFFLINE }, | |
71 | + ], | |
72 | + }, | |
73 | + colProps: { span: 4 }, | |
74 | + }, | |
75 | + { | |
76 | + field: 'name', | |
77 | + label: '设备名称', | |
78 | + component: 'Input', | |
79 | + colProps: { span: 8 }, | |
80 | + }, | |
81 | +]; | |
82 | + | |
83 | +export const formSchema: FormSchema[] = [ | |
84 | + { | |
85 | + field: 'icon', | |
86 | + label: '设备图片: ', | |
87 | + slot: 'iconSelect', | |
88 | + component: 'Input', | |
89 | + }, | |
90 | + { | |
91 | + field: 'name', | |
92 | + label: '设备名称', | |
93 | + required: true, | |
94 | + component: 'Input', | |
95 | + componentProps: { | |
96 | + maxLength: 30, | |
97 | + }, | |
98 | + }, | |
99 | + { | |
100 | + field: 'deviceType', | |
101 | + label: '设备类型', | |
102 | + required: true, | |
103 | + component: 'ApiSelect', | |
104 | + componentProps: { | |
105 | + api: findDictItemByCode, | |
106 | + params: { | |
107 | + dictCode: 'device_type', | |
108 | + }, | |
109 | + labelField: 'itemText', | |
110 | + valueField: 'itemValue', | |
111 | + }, | |
112 | + }, | |
113 | + { | |
114 | + field: 'label', | |
115 | + label: '设备标签', | |
116 | + component: 'Input', | |
117 | + componentProps: { | |
118 | + maxLength: 255, | |
119 | + }, | |
120 | + }, | |
121 | + { | |
122 | + label: '备注', | |
123 | + field: 'remark', | |
124 | + component: 'InputTextArea', | |
125 | + }, | |
126 | +]; | ... | ... |
1 | 1 | <template> |
2 | - <div> | |
3 | - <BasicTable @register="registerTable"> | |
2 | + <PageWrapper dense contentFullHeight fixedHeight contentClass="flex"> | |
3 | + <OrganizationIdTree class="w-1/6 xl:w-1/5" @select="handleSelect" /> | |
4 | + <BasicTable @register="registerTable" class="w-5/6 xl:w-4/5"> | |
4 | 5 | <template #toolbar> |
5 | 6 | <a-button type="primary" @click="handleCreate"> 新增设备 </a-button> |
6 | 7 | </template> |
7 | - <template #config="{ record }"> | |
8 | - <a-button type="link" class="ml-2" @click="showData(record)"> 查看配置 </a-button> | |
9 | - </template> | |
10 | 8 | <template #deviceProfile="{ record }"> |
11 | 9 | <a-button type="link" class="ml-2" @click="goDeviceProfile"> |
12 | 10 | {{ record.deviceProfile.name }} |
13 | 11 | </a-button> |
14 | 12 | </template> |
13 | + <template #organizationId="{ record }"> | |
14 | + {{ record.organizationDTO.name }} | |
15 | + </template> | |
15 | 16 | <template #deviceType="{ record }"> |
16 | 17 | <Tag color="success" class="ml-2"> |
17 | 18 | {{ |
18 | - record.deviceType == DeviceTypeEnum.GATEWAY | |
19 | + record.deviceType === DeviceTypeEnum.GATEWAY | |
19 | 20 | ? '网关设备' |
20 | - : record.deviceType == DeviceTypeEnum.DIRECT_CONNECTION | |
21 | + : record.deviceType === DeviceTypeEnum.DIRECT_CONNECTION | |
21 | 22 | ? '直连设备' |
22 | 23 | : '网关子设备' |
23 | 24 | }} |
... | ... | @@ -64,30 +65,44 @@ |
64 | 65 | /> |
65 | 66 | </template> |
66 | 67 | </BasicTable> |
67 | - <ConfigDrawer @register="registerDrawer" @success="handleSuccess" /> | |
68 | - </div> | |
68 | + <!-- <ConfigDrawer @register="registerDrawer" @success="handleSuccess" /> --> | |
69 | + <DeviceModal @register="registerModal" @success="handleSuccess" /> | |
70 | + </PageWrapper> | |
69 | 71 | </template> |
70 | 72 | <script lang="ts"> |
71 | - import { defineComponent, h } from 'vue'; | |
73 | + import { defineComponent, reactive } from 'vue'; | |
72 | 74 | import { DeviceState, DeviceTypeEnum } from '/@/api/device/model/deviceModel'; |
73 | 75 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
74 | - import { useDrawer } from '/@/components/Drawer'; | |
75 | - import ConfigDrawer from './DeviceDrawer.vue'; | |
76 | - import { columns, searchFormSchema } from './config.data'; | |
77 | - import { Modal, Tag } from 'ant-design-vue'; | |
78 | - import { CodeEditor, JsonPreview } from '/@/components/CodeEditor'; | |
76 | + // import { useDrawer } from '/@/components/Drawer'; | |
77 | + // import ConfigDrawer from './DeviceDrawer.vue'; | |
78 | + import { columns, searchFormSchema } from './device.data'; | |
79 | + import { Tag } from 'ant-design-vue'; | |
79 | 80 | import { useMessage } from '/@/hooks/web/useMessage'; |
80 | 81 | import { deleteDevice, devicePage } from '/@/api/device/deviceManager'; |
81 | 82 | import { PageEnum } from '/@/enums/pageEnum'; |
82 | 83 | import { useGo } from '/@/hooks/web/usePage'; |
84 | + import { PageWrapper } from '/@/components/Page'; | |
85 | + import OrganizationIdTree from '/@/views/common/OrganizationIdTree.vue'; | |
86 | + import { useModal } from '/@/components/Modal'; | |
87 | + import DeviceModal from '/@/views/device/DeviceModal.vue'; | |
83 | 88 | |
84 | 89 | export default defineComponent({ |
85 | 90 | name: 'DeviceManagement', |
86 | - components: { BasicTable, ConfigDrawer, TableAction, CodeEditor, Tag }, | |
91 | + components: { | |
92 | + BasicTable, | |
93 | + // ConfigDrawer, | |
94 | + PageWrapper, | |
95 | + TableAction, | |
96 | + OrganizationIdTree, | |
97 | + Tag, | |
98 | + DeviceModal, | |
99 | + }, | |
87 | 100 | setup() { |
88 | - const [registerDrawer, { openDrawer }] = useDrawer(); | |
101 | + // const [registerDrawer, { openDrawer }] = useDrawer(); | |
89 | 102 | const { createMessage } = useMessage(); |
90 | 103 | const go = useGo(); |
104 | + const searchInfo = reactive<Recordable>({}); | |
105 | + const [registerModal, { openModal }] = useModal(); | |
91 | 106 | const [registerTable, { reload }] = useTable({ |
92 | 107 | title: '设备列表', |
93 | 108 | api: devicePage, |
... | ... | @@ -100,6 +115,7 @@ |
100 | 115 | showTableSetting: true, |
101 | 116 | bordered: true, |
102 | 117 | showIndexColumn: false, |
118 | + searchInfo: searchInfo, | |
103 | 119 | actionColumn: { |
104 | 120 | width: 180, |
105 | 121 | title: '操作', |
... | ... | @@ -110,15 +126,15 @@ |
110 | 126 | }); |
111 | 127 | |
112 | 128 | function handleCreate() { |
113 | - openDrawer(true, { | |
129 | + openModal(true, { | |
114 | 130 | isUpdate: false, |
115 | 131 | }); |
116 | 132 | } |
117 | 133 | |
118 | 134 | function handleEdit(record: Recordable) { |
119 | - openDrawer(true, { | |
120 | - record, | |
135 | + openModal(true, { | |
121 | 136 | isUpdate: true, |
137 | + record, | |
122 | 138 | }); |
123 | 139 | } |
124 | 140 | |
... | ... | @@ -133,20 +149,16 @@ |
133 | 149 | function handleSuccess() { |
134 | 150 | reload(); |
135 | 151 | } |
136 | - function showData(record: Recordable) { | |
137 | - Modal.info({ | |
138 | - title: '当前配置', | |
139 | - width: 480, | |
140 | - content: h(JsonPreview, { data: JSON.parse(JSON.stringify(record.deviceInfo)) }), | |
141 | - }); | |
152 | + function handleSelect(organization) { | |
153 | + searchInfo.organizationId = organization; | |
154 | + handleSuccess(); | |
142 | 155 | } |
143 | 156 | function goDeviceProfile() { |
144 | 157 | go(PageEnum.DEVICE_PROFILE); |
145 | 158 | } |
146 | 159 | return { |
147 | 160 | registerTable, |
148 | - registerDrawer, | |
149 | - showData, | |
161 | + // registerDrawer, | |
150 | 162 | handleCreate, |
151 | 163 | handleEdit, |
152 | 164 | handleDelete, |
... | ... | @@ -154,6 +166,9 @@ |
154 | 166 | goDeviceProfile, |
155 | 167 | DeviceTypeEnum, |
156 | 168 | DeviceState, |
169 | + handleSelect, | |
170 | + searchInfo, | |
171 | + registerModal, | |
157 | 172 | }; |
158 | 173 | }, |
159 | 174 | }); | ... | ... |
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | width="500px" |
8 | 8 | @ok="handleSubmit" |
9 | 9 | > |
10 | - <BasicForm @register="registerForm"/> | |
10 | + <BasicForm @register="registerForm" /> | |
11 | 11 | </BasicDrawer> |
12 | 12 | </template> |
13 | 13 | <script lang="ts"> |
... | ... | @@ -15,8 +15,8 @@ |
15 | 15 | import { BasicForm, useForm } from '/@/components/Form'; |
16 | 16 | import { formSchema } from './device.profile.data'; |
17 | 17 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
18 | - import {saveOrEditMessageConfig} from "/@/api/message/config"; | |
19 | - import {useMessage} from "/@/hooks/web/useMessage"; | |
18 | + import { saveOrEditMessageConfig } from '/@/api/message/config'; | |
19 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
20 | 20 | |
21 | 21 | export default defineComponent({ |
22 | 22 | name: 'DeviceProfileDrawer', |
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | setup(_, { emit }) { |
26 | 26 | const isUpdate = ref(true); |
27 | 27 | |
28 | - const [registerForm, { validate,setFieldsValue,resetFields }] = useForm({ | |
28 | + const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ | |
29 | 29 | labelWidth: 120, |
30 | 30 | schemas: formSchema, |
31 | 31 | showActionButtonGroup: false, |
... | ... | @@ -37,8 +37,8 @@ |
37 | 37 | isUpdate.value = !!data?.isUpdate; |
38 | 38 | if (unref(isUpdate)) { |
39 | 39 | const config = data.record.config; |
40 | - for (const key in config){ | |
41 | - Reflect.set(data.record, key+'', config[key]); | |
40 | + for (const key in config) { | |
41 | + Reflect.set(data.record, key + '', config[key]); | |
42 | 42 | } |
43 | 43 | await setFieldsValue({ |
44 | 44 | ...data.record, |
... | ... | @@ -53,27 +53,27 @@ |
53 | 53 | const values = await validate(); |
54 | 54 | const { createMessage } = useMessage(); |
55 | 55 | setDrawerProps({ confirmLoading: true }); |
56 | - let config={}; | |
57 | - if(values.messageType === 'PHONE_MESSAGE'){ | |
58 | - config ={ | |
59 | - "accessKeyId":values.accessKeyId, | |
60 | - "accessKeySecret":values.accessKeySecret, | |
61 | - } | |
62 | - }else if(values.messageType === 'EMAIL_MESSAGE'){ | |
63 | - config ={ | |
64 | - "host":values.host, | |
65 | - "port":values.port, | |
66 | - "username":values.username, | |
67 | - "password":values.password, | |
68 | - } | |
56 | + let config = {}; | |
57 | + if (values.messageType === 'PHONE_MESSAGE') { | |
58 | + config = { | |
59 | + accessKeyId: values.accessKeyId, | |
60 | + accessKeySecret: values.accessKeySecret, | |
61 | + }; | |
62 | + } else if (values.messageType === 'EMAIL_MESSAGE') { | |
63 | + config = { | |
64 | + host: values.host, | |
65 | + port: values.port, | |
66 | + username: values.username, | |
67 | + password: values.password, | |
68 | + }; | |
69 | 69 | } |
70 | 70 | Reflect.set(values, 'config', config); |
71 | - let saveMessage = "添加成功"; | |
72 | - let updateMessage = "修改成功"; | |
71 | + let saveMessage = '添加成功'; | |
72 | + let updateMessage = '修改成功'; | |
73 | 73 | await saveOrEditMessageConfig(values, unref(isUpdate)); |
74 | 74 | closeDrawer(); |
75 | 75 | emit('success'); |
76 | - createMessage.success(unref(isUpdate)?updateMessage:saveMessage); | |
76 | + createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | |
77 | 77 | } finally { |
78 | 78 | setDrawerProps({ confirmLoading: false }); |
79 | 79 | } | ... | ... |
1 | 1 | import { BasicColumn } from '/@/components/Table'; |
2 | 2 | import { FormSchema } from '/@/components/Table'; |
3 | -import {findDictItemByCode} from "/@/api/system/dict"; | |
4 | -import {MessageEnum} from "/@/enums/messageEnum"; | |
3 | +import { findDictItemByCode } from '/@/api/system/dict'; | |
4 | +import { MessageEnum } from '/@/enums/messageEnum'; | |
5 | 5 | export const columns: BasicColumn[] = [ |
6 | 6 | { |
7 | 7 | title: '配置名称', |
... | ... | @@ -34,20 +34,19 @@ export const searchFormSchema: FormSchema[] = [ |
34 | 34 | }, |
35 | 35 | ]; |
36 | 36 | |
37 | - | |
38 | -export const isMessage = (type:string)=>{ | |
39 | - return type===MessageEnum.IS_SMS; | |
40 | -} | |
41 | -export const isEmail = (type:string)=>{ | |
42 | - return type===MessageEnum.IS_EMAIL; | |
43 | -} | |
37 | +export const isMessage = (type: string) => { | |
38 | + return type === MessageEnum.IS_SMS; | |
39 | +}; | |
40 | +export const isEmail = (type: string) => { | |
41 | + return type === MessageEnum.IS_EMAIL; | |
42 | +}; | |
44 | 43 | |
45 | 44 | export const formSchema: FormSchema[] = [ |
46 | 45 | { |
47 | 46 | field: 'configName', |
48 | 47 | label: '配置名称', |
49 | 48 | required: true, |
50 | - component:'Input' | |
49 | + component: 'Input', | |
51 | 50 | }, |
52 | 51 | { |
53 | 52 | field: 'messageType', |
... | ... | @@ -55,12 +54,12 @@ export const formSchema: FormSchema[] = [ |
55 | 54 | required: true, |
56 | 55 | component: 'ApiSelect', |
57 | 56 | componentProps: { |
58 | - api:findDictItemByCode, | |
59 | - params:{ | |
60 | - dictCode:"message_type" | |
57 | + api: findDictItemByCode, | |
58 | + params: { | |
59 | + dictCode: 'message_type', | |
61 | 60 | }, |
62 | - labelField:'itemText', | |
63 | - valueField:'itemValue', | |
61 | + labelField: 'itemText', | |
62 | + valueField: 'itemValue', | |
64 | 63 | }, |
65 | 64 | }, |
66 | 65 | { |
... | ... | @@ -69,70 +68,70 @@ export const formSchema: FormSchema[] = [ |
69 | 68 | required: true, |
70 | 69 | component: 'ApiSelect', |
71 | 70 | componentProps: { |
72 | - api:findDictItemByCode, | |
73 | - params:{ | |
74 | - dictCode:"platform_type" | |
71 | + api: findDictItemByCode, | |
72 | + params: { | |
73 | + dictCode: 'platform_type', | |
75 | 74 | }, |
76 | - labelField:'itemText', | |
77 | - valueField:'itemValue', | |
75 | + labelField: 'itemText', | |
76 | + valueField: 'itemValue', | |
78 | 77 | }, |
79 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | |
78 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | |
80 | 79 | }, |
81 | 80 | { |
82 | 81 | field: 'accessKeyId', |
83 | 82 | label: 'accessKeyId', |
84 | 83 | required: true, |
85 | - component:'Input', | |
86 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | |
84 | + component: 'Input', | |
85 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | |
87 | 86 | }, |
88 | 87 | { |
89 | 88 | field: 'accessKeySecret', |
90 | 89 | label: 'accessKeySecret', |
91 | 90 | required: true, |
92 | - component:'Input', | |
93 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | |
91 | + component: 'Input', | |
92 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | |
94 | 93 | }, |
95 | 94 | { |
96 | 95 | field: 'host', |
97 | 96 | label: '服务器地址', |
98 | - defaultValue:'smtp.163.com', | |
97 | + defaultValue: 'smtp.163.com', | |
99 | 98 | required: true, |
100 | - component:'Input', | |
101 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | |
99 | + component: 'Input', | |
100 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
102 | 101 | }, |
103 | 102 | { |
104 | 103 | field: 'port', |
105 | 104 | label: '端口', |
106 | 105 | defaultValue: 25, |
107 | 106 | required: true, |
108 | - component:'InputNumber', | |
109 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | |
107 | + component: 'InputNumber', | |
108 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
110 | 109 | }, |
111 | 110 | { |
112 | 111 | field: 'username', |
113 | 112 | label: '用户名', |
114 | 113 | required: true, |
115 | - component:'Input', | |
116 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | |
114 | + component: 'Input', | |
115 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
117 | 116 | }, |
118 | 117 | { |
119 | 118 | field: 'password', |
120 | 119 | label: '密码', |
121 | 120 | required: true, |
122 | - component:'InputPassword', | |
123 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | |
121 | + component: 'InputPassword', | |
122 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
124 | 123 | }, |
125 | 124 | { |
126 | 125 | field: 'config', |
127 | 126 | label: '消息配置', |
128 | - component:'Input', | |
129 | - show:false, | |
127 | + component: 'Input', | |
128 | + show: false, | |
130 | 129 | }, |
131 | 130 | { |
132 | 131 | field: 'id', |
133 | 132 | label: '主键', |
134 | - component:'Input', | |
135 | - show:false, | |
133 | + component: 'Input', | |
134 | + show: false, | |
136 | 135 | }, |
137 | 136 | { |
138 | 137 | field: 'status', |
... | ... | @@ -150,5 +149,5 @@ export const formSchema: FormSchema[] = [ |
150 | 149 | label: '备注', |
151 | 150 | field: 'remark', |
152 | 151 | component: 'InputTextArea', |
153 | - } | |
152 | + }, | |
154 | 153 | ]; | ... | ... |
... | ... | @@ -8,18 +8,18 @@ |
8 | 8 | <TableAction |
9 | 9 | :actions="[ |
10 | 10 | { |
11 | - label:'编辑', | |
11 | + label: '编辑', | |
12 | 12 | icon: 'clarity:note-edit-line', |
13 | 13 | onClick: handleEdit.bind(null, record), |
14 | 14 | }, |
15 | 15 | { |
16 | - label:'删除', | |
16 | + label: '删除', | |
17 | 17 | icon: 'ant-design:delete-outlined', |
18 | 18 | color: 'error', |
19 | 19 | popConfirm: { |
20 | 20 | title: '是否确认删除', |
21 | 21 | confirm: handleDelete.bind(null, record), |
22 | - } | |
22 | + }, | |
23 | 23 | }, |
24 | 24 | ]" |
25 | 25 | /> |
... | ... | @@ -29,71 +29,71 @@ |
29 | 29 | </div> |
30 | 30 | </template> |
31 | 31 | <script lang="ts"> |
32 | -import { defineComponent} from 'vue'; | |
33 | -import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
34 | -import { useDrawer } from '/@/components/Drawer'; | |
35 | -import DeviceProfileDrawer from './DeviceProfile.vue'; | |
36 | -import { columns, searchFormSchema } from './device.profile.data'; | |
37 | -import {useMessage} from "/@/hooks/web/useMessage"; | |
38 | -import {deviceProfilePage,deleteDeviceProfile} from "/@/api/device/deviceManager"; | |
39 | -export default defineComponent({ | |
40 | - name: 'DeviceProfileManagement', | |
41 | - components: { BasicTable, DeviceProfileDrawer, TableAction}, | |
42 | - setup() { | |
43 | - const [registerDrawer, { openDrawer }] = useDrawer(); | |
44 | - const {createMessage} = useMessage(); | |
45 | - const [registerTable, { reload }] = useTable({ | |
46 | - title: '设备配置列表', | |
47 | - api: deviceProfilePage, | |
48 | - columns, | |
49 | - formConfig: { | |
50 | - labelWidth: 120, | |
51 | - schemas: searchFormSchema, | |
52 | - }, | |
53 | - useSearchForm: true, | |
54 | - showTableSetting: true, | |
55 | - bordered: true, | |
56 | - showIndexColumn: false, | |
57 | - actionColumn: { | |
58 | - width: 180, | |
59 | - title: '操作', | |
60 | - dataIndex: 'action', | |
61 | - slots: { customRender: 'action' }, | |
62 | - }, | |
63 | - }); | |
64 | - | |
65 | - function handleCreate() { | |
66 | - openDrawer(true, { | |
67 | - isUpdate: false, | |
32 | + import { defineComponent } from 'vue'; | |
33 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
34 | + import { useDrawer } from '/@/components/Drawer'; | |
35 | + import DeviceProfileDrawer from './DeviceProfile.vue'; | |
36 | + import { columns, searchFormSchema } from './device.profile.data'; | |
37 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
38 | + import { deviceProfilePage, deleteDeviceProfile } from '/@/api/device/deviceManager'; | |
39 | + export default defineComponent({ | |
40 | + name: 'DeviceProfileManagement', | |
41 | + components: { BasicTable, DeviceProfileDrawer, TableAction }, | |
42 | + setup() { | |
43 | + const [registerDrawer, { openDrawer }] = useDrawer(); | |
44 | + const { createMessage } = useMessage(); | |
45 | + const [registerTable, { reload }] = useTable({ | |
46 | + title: '设备配置列表', | |
47 | + api: deviceProfilePage, | |
48 | + columns, | |
49 | + formConfig: { | |
50 | + labelWidth: 120, | |
51 | + schemas: searchFormSchema, | |
52 | + }, | |
53 | + useSearchForm: true, | |
54 | + showTableSetting: true, | |
55 | + bordered: true, | |
56 | + showIndexColumn: false, | |
57 | + actionColumn: { | |
58 | + width: 180, | |
59 | + title: '操作', | |
60 | + dataIndex: 'action', | |
61 | + slots: { customRender: 'action' }, | |
62 | + }, | |
68 | 63 | }); |
69 | - } | |
70 | 64 | |
71 | - function handleEdit(record: Recordable) { | |
72 | - openDrawer(true, { | |
73 | - record, | |
74 | - isUpdate: true, | |
75 | - }); | |
76 | - } | |
65 | + function handleCreate() { | |
66 | + openDrawer(true, { | |
67 | + isUpdate: false, | |
68 | + }); | |
69 | + } | |
77 | 70 | |
78 | - function handleDelete(record: Recordable) { | |
79 | - let ids = [record.id]; | |
80 | - deleteDeviceProfile(ids).then(()=>{ | |
81 | - createMessage.success("删除设备配置成功") | |
82 | - handleSuccess() | |
83 | - }); | |
84 | - } | |
71 | + function handleEdit(record: Recordable) { | |
72 | + openDrawer(true, { | |
73 | + record, | |
74 | + isUpdate: true, | |
75 | + }); | |
76 | + } | |
77 | + | |
78 | + function handleDelete(record: Recordable) { | |
79 | + let ids = [record.id]; | |
80 | + deleteDeviceProfile(ids).then(() => { | |
81 | + createMessage.success('删除设备配置成功'); | |
82 | + handleSuccess(); | |
83 | + }); | |
84 | + } | |
85 | 85 | |
86 | - function handleSuccess() { | |
87 | - reload(); | |
88 | - } | |
89 | - return { | |
90 | - registerTable, | |
91 | - registerDrawer, | |
92 | - handleCreate, | |
93 | - handleEdit, | |
94 | - handleDelete, | |
95 | - handleSuccess, | |
96 | - }; | |
97 | - }, | |
98 | -}); | |
86 | + function handleSuccess() { | |
87 | + reload(); | |
88 | + } | |
89 | + return { | |
90 | + registerTable, | |
91 | + registerDrawer, | |
92 | + handleCreate, | |
93 | + handleEdit, | |
94 | + handleDelete, | |
95 | + handleSuccess, | |
96 | + }; | |
97 | + }, | |
98 | + }); | |
99 | 99 | </script> | ... | ... |
src/views/device/step/DeviceStep1.vue
0 → 100644
1 | +<template> | |
2 | + <div class="step1"> | |
3 | + <div class="step1-form"> | |
4 | + <BasicForm @register="register"> | |
5 | + <template #iconSelect> | |
6 | + <Upload | |
7 | + name="avatar" | |
8 | + list-type="picture-card" | |
9 | + class="avatar-uploader" | |
10 | + :show-upload-list="false" | |
11 | + :customRequest="customUpload" | |
12 | + :before-upload="beforeUpload" | |
13 | + > | |
14 | + <img v-if="devicePic" :src="devicePic" alt="avatar" /> | |
15 | + <div v-else> | |
16 | + <!-- <LoadingOutlined v-if="loading" /> --> | |
17 | + <PlusOutlined /> | |
18 | + <div class="ant-upload-text">图片上传</div> | |
19 | + </div> | |
20 | + </Upload> | |
21 | + </template> | |
22 | + <template #devicePosition> | |
23 | + <Input disabled v-model:value="positionState.address"> | |
24 | + <template #addonAfter> | |
25 | + <EnvironmentTwoTone @click="selectPosition" /> | |
26 | + </template> | |
27 | + </Input> | |
28 | + </template> | |
29 | + </BasicForm> | |
30 | + </div> | |
31 | + <Modal v-model:visible="visible" title="设备位置" @ok="handleOk" width="800px"> | |
32 | + <div> | |
33 | + <a-form :label-col="labelCol"> | |
34 | + <a-row :gutter="20"> | |
35 | + <a-col :span="8"> | |
36 | + <a-form-item label="经度"> | |
37 | + <Input type="input" v-model:value="positionState.lng" disabled /> | |
38 | + </a-form-item> | |
39 | + </a-col> | |
40 | + <a-col :span="8"> | |
41 | + <a-form-item label="纬度"> | |
42 | + <Input type="input" v-model:value="positionState.lat" disabled /> | |
43 | + </a-form-item> | |
44 | + </a-col> | |
45 | + </a-row> | |
46 | + </a-form> | |
47 | + <div ref="wrapRef" style="height: 300px; width: 90%" class="ml-6"></div> | |
48 | + </div> | |
49 | + </Modal> | |
50 | + </div> | |
51 | +</template> | |
52 | +<script lang="ts"> | |
53 | + import { defineComponent, ref, nextTick, unref, reactive } from 'vue'; | |
54 | + import { BasicForm, useForm } from '/@/components/Form'; | |
55 | + import { step1Schemas } from './data'; | |
56 | + import { useScript } from '/@/hooks/web/useScript'; | |
57 | + import { ScrollActionType } from '/@/components/Container/index'; | |
58 | + import { Input, Divider, Upload, message, Modal, Form, Row, Col } from 'ant-design-vue'; | |
59 | + import { EnvironmentTwoTone, LoadingOutlined, PlusOutlined } from '@ant-design/icons-vue'; | |
60 | + import { upload } from '/@/api/oss/ossFileUploader'; | |
61 | + import { FileItem } from '/@/components/Upload/src/typing'; | |
62 | + | |
63 | + export default defineComponent({ | |
64 | + components: { | |
65 | + BasicForm, | |
66 | + Input, | |
67 | + [Input.Group.name]: Input.Group, | |
68 | + [Divider.name]: Divider, | |
69 | + Upload, | |
70 | + EnvironmentTwoTone, | |
71 | + // LoadingOutlined, | |
72 | + PlusOutlined, | |
73 | + Modal, | |
74 | + [Form.name]: Form, | |
75 | + [Form.Item.name]: Form.Item, | |
76 | + [Row.name]: Row, | |
77 | + [Col.name]: Col, | |
78 | + }, | |
79 | + emits: ['next'], | |
80 | + setup(_, { emit }) { | |
81 | + const devicePic = ref(''); | |
82 | + const positionState = reactive({ | |
83 | + lng: '', | |
84 | + lat: '', | |
85 | + address: '', | |
86 | + }); | |
87 | + const [register, { validate }] = useForm({ | |
88 | + labelWidth: 100, | |
89 | + schemas: step1Schemas, | |
90 | + actionColOptions: { | |
91 | + span: 14, | |
92 | + }, | |
93 | + showResetButton: false, | |
94 | + submitButtonOptions: { | |
95 | + text: '下一步', | |
96 | + }, | |
97 | + submitFunc: customSubmitFunc, | |
98 | + }); | |
99 | + | |
100 | + async function customSubmitFunc() { | |
101 | + try { | |
102 | + let values = await validate(); | |
103 | + values = { devicePic: devicePic.value, ...positionState, ...values }; | |
104 | + delete values.icon; | |
105 | + delete values.devicePosition; | |
106 | + emit('next', values); | |
107 | + // 获取输入的数据 | |
108 | + } catch (error) {} | |
109 | + } | |
110 | + // 图片上传 | |
111 | + async function customUpload({ file }) { | |
112 | + if (beforeUpload(file)) { | |
113 | + const formData = new FormData(); | |
114 | + formData.append('file', file); | |
115 | + const response = await upload(formData); | |
116 | + if (response.fileStaticUri) { | |
117 | + devicePic.value = response.fileStaticUri; | |
118 | + } | |
119 | + } | |
120 | + } | |
121 | + const beforeUpload = (file: FileItem) => { | |
122 | + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; | |
123 | + if (!isJpgOrPng) { | |
124 | + message.error('只能上传图片文件!'); | |
125 | + } | |
126 | + const isLt2M = (file.size as number) / 1024 / 1024 < 2; | |
127 | + if (!isLt2M) { | |
128 | + message.error('图片大小不能超过2MB!'); | |
129 | + } | |
130 | + return isJpgOrPng && isLt2M; | |
131 | + }; | |
132 | + | |
133 | + // 地图的弹框 | |
134 | + const visible = ref(false); | |
135 | + const selectPosition = () => { | |
136 | + visible.value = true; | |
137 | + initMap(); | |
138 | + }; | |
139 | + | |
140 | + // 地图 | |
141 | + const BAI_DU_MAP_URL = | |
142 | + 'https://api.map.baidu.com/getscript?v=3.0&ak=7uOPPyAHn2Y2ZryeQqHtcRqtIY374vKa'; | |
143 | + const wrapRef = ref<HTMLDivElement | null>(null); | |
144 | + const scrollRef = ref<Nullable<ScrollActionType>>(null); | |
145 | + const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); | |
146 | + async function initMap() { | |
147 | + await toPromise(); | |
148 | + await nextTick(); | |
149 | + const wrapEl = unref(wrapRef); | |
150 | + const BMap = (window as any).BMap; | |
151 | + if (!wrapEl) return; | |
152 | + const map = new BMap.Map(wrapEl); | |
153 | + map.addEventListener('click', () => { | |
154 | + const { lat, lng } = map.he; | |
155 | + positionState.lat = lat + ''; | |
156 | + positionState.lng = lng + ''; | |
157 | + let gc = new BMap.Geocoder(); | |
158 | + let newPoint = new BMap.Point(lng, lat); | |
159 | + gc.getLocation(newPoint, (rs) => { | |
160 | + let addComp = rs.addressComponents; | |
161 | + //获取详细的地址,精确到街道的名称 | |
162 | + let addrname = addComp.city + addComp.district + addComp.street + addComp.streetNumber; | |
163 | + positionState.address = addrname; | |
164 | + }); | |
165 | + }); | |
166 | + const point = new BMap.Point(104.04813399999999, 30.54348986021446); | |
167 | + map.centerAndZoom(point, 15); | |
168 | + map.enableScrollWheelZoom(true); | |
169 | + } | |
170 | + // 确定选择的位置 | |
171 | + const handleOk = () => { | |
172 | + visible.value = false; | |
173 | + }; | |
174 | + return { | |
175 | + positionState, | |
176 | + register, | |
177 | + beforeUpload, | |
178 | + customUpload, | |
179 | + selectPosition, | |
180 | + devicePic, | |
181 | + visible, | |
182 | + scrollRef, | |
183 | + handleOk, | |
184 | + wrapRef, | |
185 | + labelCol: { style: { width: '40px' } }, | |
186 | + }; | |
187 | + }, | |
188 | + }); | |
189 | +</script> | |
190 | +<style lang="less" scoped> | |
191 | + .step1 { | |
192 | + &-form { | |
193 | + width: 450px; | |
194 | + margin: 0 auto; | |
195 | + } | |
196 | + | |
197 | + h3 { | |
198 | + margin: 0 0 12px; | |
199 | + font-size: 16px; | |
200 | + line-height: 32px; | |
201 | + color: @text-color; | |
202 | + } | |
203 | + | |
204 | + h4 { | |
205 | + margin: 0 0 4px; | |
206 | + font-size: 14px; | |
207 | + line-height: 22px; | |
208 | + color: @text-color; | |
209 | + } | |
210 | + | |
211 | + p { | |
212 | + color: @text-color; | |
213 | + } | |
214 | + } | |
215 | + | |
216 | + .pay-select { | |
217 | + width: 20%; | |
218 | + } | |
219 | + | |
220 | + .pay-input { | |
221 | + width: 70%; | |
222 | + } | |
223 | +</style> | ... | ... |
src/views/device/step/DeviceStep2.vue
0 → 100644
1 | +<template> | |
2 | + <div class="step2"> | |
3 | + <div><input type="checkbox" v-model="isCreaentials" @click="checked" /> 添加凭证 </div> | |
4 | + | |
5 | + <a-form :label-col="labelCol" :wrapper-col="wrapperCol" v-if="isCreaentials"> | |
6 | + <a-form-item label="凭据类型"> | |
7 | + <a-select | |
8 | + v-model:value="creaentialsType" | |
9 | + style="width: 200px" | |
10 | + @change="handleChange" | |
11 | + placeholder="请选择凭据类型" | |
12 | + :options="options" | |
13 | + /> | |
14 | + </a-form-item> | |
15 | + <div v-if="creaentialsType === 'Access token'"> | |
16 | + <a-form-item label="访问令牌"> | |
17 | + <a-input type="input" style="width: 200px" v-model:value="token" /> | |
18 | + </a-form-item> | |
19 | + </div> | |
20 | + <div v-else-if="creaentialsType === 'X.509'"> | |
21 | + <a-form-item label="RSA公钥"> | |
22 | + <a-input type="input" style="width: 200px" v-model:value="publicKey" /> | |
23 | + </a-form-item> | |
24 | + </div> | |
25 | + <div v-else> | |
26 | + <a-form-item label="客户端ID"> | |
27 | + <a-input type="input" style="width: 200px" v-model:value="clientId" /> | |
28 | + </a-form-item> | |
29 | + <a-form-item label="用户名"> | |
30 | + <a-input type="input" style="width: 200px" v-model:value="username" /> | |
31 | + </a-form-item> | |
32 | + <a-form-item label="密码"> | |
33 | + <a-input type="password" style="width: 200px" v-model:value="password" /> | |
34 | + </a-form-item> | |
35 | + </div> | |
36 | + </a-form> | |
37 | + | |
38 | + <div class="flex justify-start"> | |
39 | + <a-button class="mr-5" @click="prevStep">上一步</a-button> | |
40 | + </div> | |
41 | + </div> | |
42 | +</template> | |
43 | +<script lang="ts"> | |
44 | + import { defineComponent, reactive, ref, toRefs } from 'vue'; | |
45 | + | |
46 | + import { Input, Form, Select, Button, SelectProps } from 'ant-design-vue'; | |
47 | + export default defineComponent({ | |
48 | + components: { | |
49 | + [Form.name]: Form, | |
50 | + [Form.Item.name]: Form.Item, | |
51 | + [Input.name]: Input, | |
52 | + [Select.name]: Select, | |
53 | + [Button.name]: Button, | |
54 | + }, | |
55 | + emits: ['prev'], | |
56 | + setup(_, { emit }) { | |
57 | + const isCreaentials = ref(false); | |
58 | + const creaentialsType = ref('Access token'); | |
59 | + const creaentialsPassword = reactive({ | |
60 | + token: '', | |
61 | + publicKey: '', | |
62 | + clientId: '', | |
63 | + username: '', | |
64 | + password: '', | |
65 | + }); | |
66 | + const options = ref<SelectProps['options']>([ | |
67 | + { | |
68 | + value: 'Access token', | |
69 | + label: 'Access token', | |
70 | + }, | |
71 | + | |
72 | + { | |
73 | + value: 'X.509', | |
74 | + label: 'X.509', | |
75 | + }, | |
76 | + { | |
77 | + value: 'MQTT Basic', | |
78 | + label: 'MQTT Basic', | |
79 | + }, | |
80 | + ]); | |
81 | + const checked = () => { | |
82 | + isCreaentials.value = !isCreaentials.value; | |
83 | + }; | |
84 | + const prevStep = () => { | |
85 | + emit('prev'); | |
86 | + }; | |
87 | + // 切换凭证类型时,重置字段 | |
88 | + const handleChange = (value) => { | |
89 | + if (value === 'Access token') { | |
90 | + creaentialsPassword.token = ''; | |
91 | + } else if (value === 'X.509') { | |
92 | + creaentialsPassword.publicKey = ''; | |
93 | + } else { | |
94 | + creaentialsPassword.clientId = ''; | |
95 | + creaentialsPassword.username = ''; | |
96 | + creaentialsPassword.password = ''; | |
97 | + } | |
98 | + }; | |
99 | + return { | |
100 | + ...toRefs(creaentialsPassword), | |
101 | + creaentialsType, | |
102 | + isCreaentials, | |
103 | + options, | |
104 | + handleChange, | |
105 | + prevStep, | |
106 | + checked, | |
107 | + labelCol: { style: { width: '150px' } }, | |
108 | + wrapperCol: { span: 18 }, | |
109 | + }; | |
110 | + }, | |
111 | + }); | |
112 | +</script> | |
113 | +<style lang="less" scoped> | |
114 | + .step2 { | |
115 | + width: 500px; | |
116 | + margin: 0 auto; | |
117 | + } | |
118 | +</style> | ... | ... |
src/views/device/step/StepIndexDemo.vue
0 → 100644
1 | +<template> | |
2 | + <PageWrapper | |
3 | + title="分步表单" | |
4 | + contentBackground | |
5 | + content=" 将一个冗长或用户不熟悉的表单任务分成多个步骤,指导用户完成。" | |
6 | + contentClass="p-4" | |
7 | + > | |
8 | + <div class="step-form-form"> | |
9 | + <a-steps :current="current"> | |
10 | + <a-step title="填写转账信息" /> | |
11 | + <a-step title="确认转账信息" /> | |
12 | + <a-step title="完成" /> | |
13 | + </a-steps> | |
14 | + </div> | |
15 | + <div class="mt-5"> | |
16 | + <Step1 @next="handleStep1Next" v-show="current === 0" /> | |
17 | + <Step2 | |
18 | + @prev="handleStepPrev" | |
19 | + @next="handleStep2Next" | |
20 | + v-show="current === 1" | |
21 | + v-if="initSetp2" | |
22 | + /> | |
23 | + </div> | |
24 | + </PageWrapper> | |
25 | +</template> | |
26 | +<script lang="ts"> | |
27 | + import { defineComponent, ref, reactive, toRefs } from 'vue'; | |
28 | + import Step1 from './DeviceStep1.vue'; | |
29 | + import Step2 from './DeviceStep2.vue'; | |
30 | + import { PageWrapper } from '/@/components/Page'; | |
31 | + import { Steps } from 'ant-design-vue'; | |
32 | + | |
33 | + export default defineComponent({ | |
34 | + name: 'FormStepPage', | |
35 | + components: { | |
36 | + Step1, | |
37 | + Step2, | |
38 | + | |
39 | + PageWrapper, | |
40 | + [Steps.name]: Steps, | |
41 | + [Steps.Step.name]: Steps.Step, | |
42 | + }, | |
43 | + setup() { | |
44 | + const current = ref(1); | |
45 | + | |
46 | + const state = reactive({ | |
47 | + initSetp2: false, | |
48 | + }); | |
49 | + | |
50 | + function handleStep1Next(step1Values: any) { | |
51 | + current.value++; | |
52 | + state.initSetp2 = true; | |
53 | + console.log(step1Values); | |
54 | + } | |
55 | + | |
56 | + function handleStepPrev() { | |
57 | + current.value--; | |
58 | + } | |
59 | + | |
60 | + function handleStep2Next(step2Values: any) { | |
61 | + current.value++; | |
62 | + console.log(step2Values); | |
63 | + } | |
64 | + | |
65 | + function handleRedo() { | |
66 | + current.value = 0; | |
67 | + state.initSetp2 = false; | |
68 | + } | |
69 | + | |
70 | + return { | |
71 | + current, | |
72 | + handleStep1Next, | |
73 | + handleStep2Next, | |
74 | + handleRedo, | |
75 | + handleStepPrev, | |
76 | + ...toRefs(state), | |
77 | + }; | |
78 | + }, | |
79 | + }); | |
80 | +</script> | |
81 | +<style lang="less" scoped> | |
82 | + .step-form-content { | |
83 | + padding: 24px; | |
84 | + background-color: @component-background; | |
85 | + } | |
86 | + | |
87 | + .step-form-form { | |
88 | + width: 750px; | |
89 | + margin: 0 auto; | |
90 | + } | |
91 | +</style> | ... | ... |
src/views/device/step/data.ts
0 → 100644
1 | +import { FormSchema } from '/@/components/Form'; | |
2 | +import { findDictItemByCode } from '/@/api/system/dict'; | |
3 | + | |
4 | +export const step1Schemas: FormSchema[] = [ | |
5 | + { | |
6 | + field: 'icon', | |
7 | + label: '设备图片: ', | |
8 | + slot: 'iconSelect', | |
9 | + component: 'Input', | |
10 | + }, | |
11 | + { | |
12 | + field: 'name', | |
13 | + label: '设备名称', | |
14 | + required: true, | |
15 | + component: 'Input', | |
16 | + componentProps: { | |
17 | + maxLength: 30, | |
18 | + }, | |
19 | + }, | |
20 | + { | |
21 | + field: 'deviceType', | |
22 | + label: '设备类型', | |
23 | + required: true, | |
24 | + component: 'ApiSelect', | |
25 | + componentProps: { | |
26 | + api: findDictItemByCode, | |
27 | + params: { | |
28 | + dictCode: 'device_type', | |
29 | + }, | |
30 | + labelField: 'itemText', | |
31 | + valueField: 'itemValue', | |
32 | + }, | |
33 | + }, | |
34 | + { | |
35 | + field: 'label', | |
36 | + label: '设备标签', | |
37 | + component: 'Input', | |
38 | + componentProps: { | |
39 | + maxLength: 255, | |
40 | + }, | |
41 | + }, | |
42 | + { | |
43 | + field: 'devicePosition', | |
44 | + label: '设备位置', | |
45 | + component: 'Input', | |
46 | + slot: 'devicePosition', | |
47 | + }, | |
48 | + { | |
49 | + label: '备注', | |
50 | + field: 'remark', | |
51 | + component: 'InputTextArea', | |
52 | + }, | |
53 | +]; | ... | ... |
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | width="500px" |
8 | 8 | @ok="handleSubmit" |
9 | 9 | > |
10 | - <BasicForm @register="registerForm"/> | |
10 | + <BasicForm @register="registerForm" /> | |
11 | 11 | </BasicDrawer> |
12 | 12 | </template> |
13 | 13 | <script lang="ts"> |
... | ... | @@ -15,8 +15,8 @@ |
15 | 15 | import { BasicForm, useForm } from '/@/components/Form'; |
16 | 16 | import { formSchema } from './config.data'; |
17 | 17 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
18 | - import {saveOrEditMessageConfig} from "/@/api/message/config"; | |
19 | - import {useMessage} from "/@/hooks/web/useMessage"; | |
18 | + import { saveOrEditMessageConfig } from '/@/api/message/config'; | |
19 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
20 | 20 | |
21 | 21 | export default defineComponent({ |
22 | 22 | name: 'ConfigDrawer', |
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | setup(_, { emit }) { |
26 | 26 | const isUpdate = ref(true); |
27 | 27 | |
28 | - const [registerForm, { validate,setFieldsValue,resetFields }] = useForm({ | |
28 | + const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ | |
29 | 29 | labelWidth: 120, |
30 | 30 | schemas: formSchema, |
31 | 31 | showActionButtonGroup: false, |
... | ... | @@ -37,8 +37,8 @@ |
37 | 37 | isUpdate.value = !!data?.isUpdate; |
38 | 38 | if (unref(isUpdate)) { |
39 | 39 | const config = data.record.config; |
40 | - for (const key in config){ | |
41 | - Reflect.set(data.record, key+'', config[key]); | |
40 | + for (const key in config) { | |
41 | + Reflect.set(data.record, key + '', config[key]); | |
42 | 42 | } |
43 | 43 | await setFieldsValue({ |
44 | 44 | ...data.record, |
... | ... | @@ -53,27 +53,27 @@ |
53 | 53 | const values = await validate(); |
54 | 54 | const { createMessage } = useMessage(); |
55 | 55 | setDrawerProps({ confirmLoading: true }); |
56 | - let config={}; | |
57 | - if(values.messageType === 'PHONE_MESSAGE'){ | |
58 | - config ={ | |
59 | - "accessKeyId":values.accessKeyId, | |
60 | - "accessKeySecret":values.accessKeySecret, | |
61 | - } | |
62 | - }else if(values.messageType === 'EMAIL_MESSAGE'){ | |
63 | - config ={ | |
64 | - "host":values.host, | |
65 | - "port":values.port, | |
66 | - "username":values.username, | |
67 | - "password":values.password, | |
68 | - } | |
56 | + let config = {}; | |
57 | + if (values.messageType === 'PHONE_MESSAGE') { | |
58 | + config = { | |
59 | + accessKeyId: values.accessKeyId, | |
60 | + accessKeySecret: values.accessKeySecret, | |
61 | + }; | |
62 | + } else if (values.messageType === 'EMAIL_MESSAGE') { | |
63 | + config = { | |
64 | + host: values.host, | |
65 | + port: values.port, | |
66 | + username: values.username, | |
67 | + password: values.password, | |
68 | + }; | |
69 | 69 | } |
70 | 70 | Reflect.set(values, 'config', config); |
71 | - let saveMessage = "添加成功"; | |
72 | - let updateMessage = "修改成功"; | |
71 | + let saveMessage = '添加成功'; | |
72 | + let updateMessage = '修改成功'; | |
73 | 73 | await saveOrEditMessageConfig(values, unref(isUpdate)); |
74 | 74 | closeDrawer(); |
75 | 75 | emit('success'); |
76 | - createMessage.success(unref(isUpdate)?updateMessage:saveMessage); | |
76 | + createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | |
77 | 77 | } finally { |
78 | 78 | setDrawerProps({ confirmLoading: false }); |
79 | 79 | } | ... | ... |
... | ... | @@ -2,10 +2,10 @@ import { BasicColumn } from '/@/components/Table'; |
2 | 2 | import { FormSchema } from '/@/components/Table'; |
3 | 3 | import { h } from 'vue'; |
4 | 4 | import { Switch } from 'ant-design-vue'; |
5 | -import {setMessageConfigStatus} from "/@/api/message/config"; | |
5 | +import { setMessageConfigStatus } from '/@/api/message/config'; | |
6 | 6 | import { useMessage } from '/@/hooks/web/useMessage'; |
7 | -import {findDictItemByCode} from "/@/api/system/dict"; | |
8 | -import {MessageEnum} from "/@/enums/messageEnum"; | |
7 | +import { findDictItemByCode } from '/@/api/system/dict'; | |
8 | +import { MessageEnum } from '/@/enums/messageEnum'; | |
9 | 9 | export const columns: BasicColumn[] = [ |
10 | 10 | { |
11 | 11 | title: '配置名称', |
... | ... | @@ -45,7 +45,7 @@ export const columns: BasicColumn[] = [ |
45 | 45 | record.pendingStatus = true; |
46 | 46 | const newStatus = checked ? 1 : 0; |
47 | 47 | const { createMessage } = useMessage(); |
48 | - setMessageConfigStatus(record.id, record.messageType,newStatus) | |
48 | + setMessageConfigStatus(record.id, record.messageType, newStatus) | |
49 | 49 | .then(() => { |
50 | 50 | record.status = newStatus; |
51 | 51 | createMessage.success(`修改成功`); |
... | ... | @@ -96,20 +96,19 @@ export const searchFormSchema: FormSchema[] = [ |
96 | 96 | }, |
97 | 97 | ]; |
98 | 98 | |
99 | - | |
100 | -export const isMessage = (type:string)=>{ | |
101 | - return type===MessageEnum.IS_SMS; | |
102 | -} | |
103 | -export const isEmail = (type:string)=>{ | |
104 | - return type===MessageEnum.IS_EMAIL; | |
105 | -} | |
99 | +export const isMessage = (type: string) => { | |
100 | + return type === MessageEnum.IS_SMS; | |
101 | +}; | |
102 | +export const isEmail = (type: string) => { | |
103 | + return type === MessageEnum.IS_EMAIL; | |
104 | +}; | |
106 | 105 | |
107 | 106 | export const formSchema: FormSchema[] = [ |
108 | 107 | { |
109 | 108 | field: 'configName', |
110 | 109 | label: '配置名称', |
111 | 110 | required: true, |
112 | - component:'Input' | |
111 | + component: 'Input', | |
113 | 112 | }, |
114 | 113 | { |
115 | 114 | field: 'messageType', |
... | ... | @@ -117,12 +116,12 @@ export const formSchema: FormSchema[] = [ |
117 | 116 | required: true, |
118 | 117 | component: 'ApiSelect', |
119 | 118 | componentProps: { |
120 | - api:findDictItemByCode, | |
121 | - params:{ | |
122 | - dictCode:"message_type" | |
119 | + api: findDictItemByCode, | |
120 | + params: { | |
121 | + dictCode: 'message_type', | |
123 | 122 | }, |
124 | - labelField:'itemText', | |
125 | - valueField:'itemValue', | |
123 | + labelField: 'itemText', | |
124 | + valueField: 'itemValue', | |
126 | 125 | }, |
127 | 126 | }, |
128 | 127 | { |
... | ... | @@ -131,70 +130,70 @@ export const formSchema: FormSchema[] = [ |
131 | 130 | required: true, |
132 | 131 | component: 'ApiSelect', |
133 | 132 | componentProps: { |
134 | - api:findDictItemByCode, | |
135 | - params:{ | |
136 | - dictCode:"platform_type" | |
133 | + api: findDictItemByCode, | |
134 | + params: { | |
135 | + dictCode: 'platform_type', | |
137 | 136 | }, |
138 | - labelField:'itemText', | |
139 | - valueField:'itemValue', | |
137 | + labelField: 'itemText', | |
138 | + valueField: 'itemValue', | |
140 | 139 | }, |
141 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | |
140 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | |
142 | 141 | }, |
143 | 142 | { |
144 | 143 | field: 'accessKeyId', |
145 | 144 | label: 'accessKeyId', |
146 | 145 | required: true, |
147 | - component:'Input', | |
148 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | |
146 | + component: 'Input', | |
147 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | |
149 | 148 | }, |
150 | 149 | { |
151 | 150 | field: 'accessKeySecret', |
152 | 151 | label: 'accessKeySecret', |
153 | 152 | required: true, |
154 | - component:'Input', | |
155 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | |
153 | + component: 'Input', | |
154 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | |
156 | 155 | }, |
157 | 156 | { |
158 | 157 | field: 'host', |
159 | 158 | label: '服务器地址', |
160 | - defaultValue:'smtp.163.com', | |
159 | + defaultValue: 'smtp.163.com', | |
161 | 160 | required: true, |
162 | - component:'Input', | |
163 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | |
161 | + component: 'Input', | |
162 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
164 | 163 | }, |
165 | 164 | { |
166 | 165 | field: 'port', |
167 | 166 | label: '端口', |
168 | 167 | defaultValue: 25, |
169 | 168 | required: true, |
170 | - component:'InputNumber', | |
171 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | |
169 | + component: 'InputNumber', | |
170 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
172 | 171 | }, |
173 | 172 | { |
174 | 173 | field: 'username', |
175 | 174 | label: '用户名', |
176 | 175 | required: true, |
177 | - component:'Input', | |
178 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | |
176 | + component: 'Input', | |
177 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
179 | 178 | }, |
180 | 179 | { |
181 | 180 | field: 'password', |
182 | 181 | label: '密码', |
183 | 182 | required: true, |
184 | - component:'InputPassword', | |
185 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | |
183 | + component: 'InputPassword', | |
184 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
186 | 185 | }, |
187 | 186 | { |
188 | 187 | field: 'config', |
189 | 188 | label: '消息配置', |
190 | - component:'Input', | |
191 | - show:false, | |
189 | + component: 'Input', | |
190 | + show: false, | |
192 | 191 | }, |
193 | 192 | { |
194 | 193 | field: 'id', |
195 | 194 | label: '主键', |
196 | - component:'Input', | |
197 | - show:false, | |
195 | + component: 'Input', | |
196 | + show: false, | |
198 | 197 | }, |
199 | 198 | { |
200 | 199 | field: 'status', |
... | ... | @@ -212,5 +211,5 @@ export const formSchema: FormSchema[] = [ |
212 | 211 | label: '备注', |
213 | 212 | field: 'remark', |
214 | 213 | component: 'InputTextArea', |
215 | - } | |
214 | + }, | |
216 | 215 | ]; | ... | ... |
... | ... | @@ -4,26 +4,26 @@ |
4 | 4 | <template #toolbar> |
5 | 5 | <a-button type="primary" @click="handleCreate"> 新增配置 </a-button> |
6 | 6 | </template> |
7 | - <template #config="{record}"> | |
7 | + <template #config="{ record }"> | |
8 | 8 | <a-button type="link" class="ml-2" @click="showData(record)"> 查看配置 </a-button> |
9 | 9 | </template> |
10 | 10 | <template #action="{ record }"> |
11 | 11 | <TableAction |
12 | 12 | :actions="[ |
13 | 13 | { |
14 | - label:'编辑', | |
14 | + label: '编辑', | |
15 | 15 | icon: 'clarity:note-edit-line', |
16 | 16 | onClick: handleEdit.bind(null, record), |
17 | 17 | }, |
18 | 18 | { |
19 | - label:'删除', | |
19 | + label: '删除', | |
20 | 20 | icon: 'ant-design:delete-outlined', |
21 | 21 | color: 'error', |
22 | 22 | popConfirm: { |
23 | 23 | title: '是否确认删除', |
24 | 24 | confirm: handleDelete.bind(null, record), |
25 | 25 | }, |
26 | - ifShow: record.status ==0 | |
26 | + ifShow: record.status == 0, | |
27 | 27 | }, |
28 | 28 | ]" |
29 | 29 | /> |
... | ... | @@ -33,83 +33,83 @@ |
33 | 33 | </div> |
34 | 34 | </template> |
35 | 35 | <script lang="ts"> |
36 | -import { defineComponent,h} from 'vue'; | |
36 | + import { defineComponent, h } from 'vue'; | |
37 | 37 | |
38 | -import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
39 | -import { messageConfigPage,deleteMessageConfig } from '/@/api/message/config'; | |
40 | -import { useDrawer } from '/@/components/Drawer'; | |
41 | -import ConfigDrawer from './ConfigDrawer.vue'; | |
42 | -import { columns, searchFormSchema } from './config.data'; | |
43 | -import { Modal } from 'ant-design-vue'; | |
44 | -import { CodeEditor,JsonPreview } from '/@/components/CodeEditor'; | |
45 | -import {useMessage} from "/@/hooks/web/useMessage"; | |
46 | -export default defineComponent({ | |
47 | - name: 'MessageConfigManagement', | |
48 | - components: { BasicTable, ConfigDrawer, TableAction ,CodeEditor}, | |
49 | - setup() { | |
50 | - const [registerDrawer, { openDrawer }] = useDrawer(); | |
51 | - const {createMessage} = useMessage(); | |
52 | - const [registerTable, { reload }] = useTable({ | |
53 | - title: '消息配置列表', | |
54 | - api: messageConfigPage, | |
55 | - columns, | |
56 | - formConfig: { | |
57 | - labelWidth: 120, | |
58 | - schemas: searchFormSchema, | |
59 | - }, | |
60 | - useSearchForm: true, | |
61 | - showTableSetting: true, | |
62 | - bordered: true, | |
63 | - showIndexColumn: false, | |
64 | - actionColumn: { | |
65 | - width: 180, | |
66 | - title: '操作', | |
67 | - dataIndex: 'action', | |
68 | - slots: { customRender: 'action' }, | |
69 | - fixed: undefined, | |
70 | - }, | |
71 | - }); | |
72 | - | |
73 | - function handleCreate() { | |
74 | - openDrawer(true, { | |
75 | - isUpdate: false, | |
38 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
39 | + import { messageConfigPage, deleteMessageConfig } from '/@/api/message/config'; | |
40 | + import { useDrawer } from '/@/components/Drawer'; | |
41 | + import ConfigDrawer from './ConfigDrawer.vue'; | |
42 | + import { columns, searchFormSchema } from './config.data'; | |
43 | + import { Modal } from 'ant-design-vue'; | |
44 | + import { CodeEditor, JsonPreview } from '/@/components/CodeEditor'; | |
45 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
46 | + export default defineComponent({ | |
47 | + name: 'MessageConfigManagement', | |
48 | + components: { BasicTable, ConfigDrawer, TableAction, CodeEditor }, | |
49 | + setup() { | |
50 | + const [registerDrawer, { openDrawer }] = useDrawer(); | |
51 | + const { createMessage } = useMessage(); | |
52 | + const [registerTable, { reload }] = useTable({ | |
53 | + title: '消息配置列表', | |
54 | + api: messageConfigPage, | |
55 | + columns, | |
56 | + formConfig: { | |
57 | + labelWidth: 120, | |
58 | + schemas: searchFormSchema, | |
59 | + }, | |
60 | + useSearchForm: true, | |
61 | + showTableSetting: true, | |
62 | + bordered: true, | |
63 | + showIndexColumn: false, | |
64 | + actionColumn: { | |
65 | + width: 180, | |
66 | + title: '操作', | |
67 | + dataIndex: 'action', | |
68 | + slots: { customRender: 'action' }, | |
69 | + fixed: undefined, | |
70 | + }, | |
76 | 71 | }); |
77 | - } | |
78 | 72 | |
79 | - function handleEdit(record: Recordable) { | |
80 | - openDrawer(true, { | |
81 | - record, | |
82 | - isUpdate: true, | |
83 | - }); | |
84 | - } | |
73 | + function handleCreate() { | |
74 | + openDrawer(true, { | |
75 | + isUpdate: false, | |
76 | + }); | |
77 | + } | |
85 | 78 | |
86 | - function handleDelete(record: Recordable) { | |
87 | - let ids = [record.id]; | |
88 | - deleteMessageConfig(ids).then((result)=>{ | |
89 | - createMessage.success(result.message) | |
90 | - handleSuccess() | |
91 | - }); | |
92 | - } | |
79 | + function handleEdit(record: Recordable) { | |
80 | + openDrawer(true, { | |
81 | + record, | |
82 | + isUpdate: true, | |
83 | + }); | |
84 | + } | |
93 | 85 | |
94 | - function handleSuccess() { | |
95 | - reload(); | |
96 | - } | |
97 | - function showData(record: Recordable){ | |
98 | - Modal.info({ | |
99 | - title: '当前配置', | |
100 | - width:480, | |
101 | - content: h(JsonPreview, { data: JSON.parse(JSON.stringify(record.config)) }), | |
102 | - }); | |
103 | - } | |
104 | - return { | |
105 | - registerTable, | |
106 | - registerDrawer, | |
107 | - showData, | |
108 | - handleCreate, | |
109 | - handleEdit, | |
110 | - handleDelete, | |
111 | - handleSuccess, | |
112 | - }; | |
113 | - }, | |
114 | -}); | |
86 | + function handleDelete(record: Recordable) { | |
87 | + let ids = [record.id]; | |
88 | + deleteMessageConfig(ids).then((result) => { | |
89 | + createMessage.success(result.message); | |
90 | + handleSuccess(); | |
91 | + }); | |
92 | + } | |
93 | + | |
94 | + function handleSuccess() { | |
95 | + reload(); | |
96 | + } | |
97 | + function showData(record: Recordable) { | |
98 | + Modal.info({ | |
99 | + title: '当前配置', | |
100 | + width: 480, | |
101 | + content: h(JsonPreview, { data: JSON.parse(JSON.stringify(record.config)) }), | |
102 | + }); | |
103 | + } | |
104 | + return { | |
105 | + registerTable, | |
106 | + registerDrawer, | |
107 | + showData, | |
108 | + handleCreate, | |
109 | + handleEdit, | |
110 | + handleDelete, | |
111 | + handleSuccess, | |
112 | + }; | |
113 | + }, | |
114 | + }); | |
115 | 115 | </script> | ... | ... |