Showing
55 changed files
with
1959 additions
and
1465 deletions
Too many changes to show.
To preserve performance only 55 of 73 files are displayed.
... | ... | @@ -6,7 +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 | -VITE_PROXY = [["/api","http://localhost:8082/api"],["/upload","http://localhost:3300/upload"]] | |
9 | +VITE_PROXY = [["/api","http://192.168.10.123:8082/api"],["/upload","http://192.168.10.125:3300/upload"]] | |
10 | 10 | # VITE_PROXY=[["/api","https://vvbin.cn/test"]] |
11 | 11 | |
12 | 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; | ... | ... |
src/api/alarm/contact/alarmContact.ts
0 → 100644
1 | +import { defHttp } from '/@/utils/http/axios'; | |
2 | +import type { BasicPageParams } from '/@/api/model/baseModel'; | |
3 | +import type { ContactModal, ContactParams } from './modal/alarmContactModel'; | |
4 | +import { getPageData } from '../../base'; | |
5 | +enum Api { | |
6 | + alarmContact = '/alarmContact', | |
7 | + updateAlarmContact = '/alarmContact/update', | |
8 | +} | |
9 | + | |
10 | +// 获取 | |
11 | +export const getAlarmContact = (params: BasicPageParams) => { | |
12 | + return getPageData<ContactModal>(params, Api.alarmContact); | |
13 | +}; | |
14 | + | |
15 | +// 新增 | |
16 | +export const addAlarmContact = (params: ContactParams) => { | |
17 | + return defHttp.post({ | |
18 | + url: Api.alarmContact, | |
19 | + data: { | |
20 | + params, | |
21 | + }, | |
22 | + }); | |
23 | +}; | |
24 | + | |
25 | +// 更新 | |
26 | +export const updateAlarmContact = (params: ContactParams) => { | |
27 | + return defHttp.post({ | |
28 | + url: Api.updateAlarmContact, | |
29 | + data: { | |
30 | + params, | |
31 | + }, | |
32 | + }); | |
33 | +}; | |
34 | + | |
35 | +// 删除 | |
36 | +export const deleteAlarmContact = (ids: string[]) => { | |
37 | + return defHttp.delete({ | |
38 | + url: Api.alarmContact, | |
39 | + data: ids, | |
40 | + }); | |
41 | +}; | ... | ... |
1 | +interface ContactItemsModal { | |
2 | + id: string; | |
3 | + createTime: string; | |
4 | + enabled: boolean; | |
5 | + username: string; | |
6 | + department: string; | |
7 | + phone: string; | |
8 | +} | |
9 | + | |
10 | +export interface ContactModal { | |
11 | + items: ContactItemsModal[]; | |
12 | + total: number; | |
13 | +} | |
14 | + | |
15 | +export interface ContactParams { | |
16 | + phone: string; | |
17 | + username: string; | |
18 | + department?: string; | |
19 | + email?: string; | |
20 | + enabled?: boolean; | |
21 | + wechat?: string; | |
22 | + addPeople?: string; | |
23 | + remark?: string; | |
24 | +} | ... | ... |
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 | /** | ... | ... |
... | ... | @@ -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'; | |
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 {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 DeptListItem { |
... | ... | @@ -70,16 +70,16 @@ export interface RoleReqDTO { |
70 | 70 | } |
71 | 71 | |
72 | 72 | export interface ChangeAccountParams { |
73 | - userId?:string; | |
74 | - password?:string; | |
75 | - resetPassword?:string; | |
73 | + userId?: string; | |
74 | + password?: string; | |
75 | + resetPassword?: string; | |
76 | 76 | } |
77 | 77 | |
78 | -export class RoleOrGroupParam{ | |
79 | - userId:string; | |
80 | - queryRole:boolean; | |
81 | - queryGroup:boolean; | |
82 | - constructor(userId:string,queryRole:boolean,queryGroup:boolean){ | |
78 | +export class RoleOrGroupParam { | |
79 | + userId: string; | |
80 | + queryRole: boolean; | |
81 | + queryGroup: boolean; | |
82 | + constructor(userId: string, queryRole: boolean, queryGroup: boolean) { | |
83 | 83 | this.queryRole = queryRole; |
84 | 84 | this.queryGroup = queryGroup; |
85 | 85 | this.userId = userId; |
... | ... | @@ -100,4 +100,3 @@ export type RolePageListGetResultModel = BasicFetchResult<RoleListItem>; |
100 | 100 | export type RoleListGetResultModel = RoleListItem[]; |
101 | 101 | |
102 | 102 | export type AccountListModel = AccountListItem; |
103 | - | ... | ... |
... | ... | @@ -15,7 +15,7 @@ import { |
15 | 15 | RoleOrGroupParam, |
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', |
... | ... | @@ -27,41 +27,41 @@ enum Api { |
27 | 27 | SaveOrUpdateRoleInfoWithMenu = '/role/saveOrUpdateRoleInfoWithMenu', |
28 | 28 | DeleteRole = '/role', |
29 | 29 | GetAllRoleList = '/role/find/list', |
30 | - BaseUserUrl = '/user' | |
30 | + BaseUserUrl = '/user', | |
31 | 31 | } |
32 | 32 | |
33 | -export const getAccountInfo=(userId:string)=> | |
34 | - defHttp.get<AccountListModel>({url: Api.BaseUserUrl+"/"+userId}) | |
33 | +export const getAccountInfo = (userId: string) => | |
34 | + defHttp.get<AccountListModel>({ url: Api.BaseUserUrl + '/' + userId }); | |
35 | 35 | |
36 | 36 | export const getAccountList = (params: AccountParams) => |
37 | - defHttp.get<AccountListGetResultModel>({url: Api.AccountList, params}); | |
37 | + defHttp.get<AccountListGetResultModel>({ url: Api.AccountList, params }); | |
38 | 38 | |
39 | 39 | export const getDeptList = (params?: DeptListItem) => |
40 | - defHttp.get<DeptListGetResultModel>({url: Api.DeptList, params}); | |
40 | + defHttp.get<DeptListGetResultModel>({ url: Api.DeptList, params }); | |
41 | 41 | |
42 | 42 | export const getMenuList = (params?: MenuParams) => |
43 | - defHttp.get<MenuListGetResultModel>({url: Api.MenuList, params}); | |
43 | + defHttp.get<MenuListGetResultModel>({ url: Api.MenuList, params }); | |
44 | 44 | |
45 | 45 | export const getRoleListByPage = (params?: RolePageParams) => |
46 | - defHttp.get<RolePageListGetResultModel>({url: Api.RolePageList, params}); | |
47 | -export const getTenantRoleListByPage= (params?: RolePageParams) => | |
48 | - defHttp.get<RolePageListGetResultModel>({url: Api.RolePageList, params}); | |
46 | + defHttp.get<RolePageListGetResultModel>({ url: Api.RolePageList, params }); | |
47 | +export const getTenantRoleListByPage = (params?: RolePageParams) => | |
48 | + defHttp.get<RolePageListGetResultModel>({ url: Api.RolePageList, params }); | |
49 | 49 | |
50 | 50 | export const getAllRoleList = (params?: RoleParams) => |
51 | - defHttp.post<RoleListGetResultModel>({url: Api.GetAllRoleList, params}); | |
51 | + defHttp.post<RoleListGetResultModel>({ url: Api.GetAllRoleList, params }); | |
52 | 52 | |
53 | 53 | export const setRoleStatus = (id: number, status: number) => |
54 | - defHttp.put({url: Api.setRoleStatus + id + "/" + status}); | |
54 | + defHttp.put({ url: Api.setRoleStatus + id + '/' + status }); | |
55 | 55 | export const saveOrUpdateRoleInfoWithMenu = async (roleRequestDto: RoleReqDTO) => { |
56 | - await defHttp.post({url: Api.SaveOrUpdateRoleInfoWithMenu, params: roleRequestDto}); | |
57 | -} | |
56 | + await defHttp.post({ url: Api.SaveOrUpdateRoleInfoWithMenu, params: roleRequestDto }); | |
57 | +}; | |
58 | 58 | |
59 | 59 | export const isAccountExist = (account: string) => |
60 | - defHttp.get({url: Api.IsAccountExist + account}, {errorMessageMode: 'none'}); | |
60 | + defHttp.get({ url: Api.IsAccountExist + account }, { errorMessageMode: 'none' }); | |
61 | 61 | |
62 | 62 | export const delRole = async (roleIds: string[]) => { |
63 | - await defHttp.delete({url: Api.DeleteRole, params: roleIds}); | |
64 | -} | |
63 | + await defHttp.delete({ url: Api.DeleteRole, params: roleIds }); | |
64 | +}; | |
65 | 65 | |
66 | 66 | /** |
67 | 67 | * 更新或添加用户信息 |
... | ... | @@ -69,19 +69,19 @@ export const delRole = async (roleIds: string[]) => { |
69 | 69 | * @param isUpdate |
70 | 70 | * @constructor |
71 | 71 | */ |
72 | -export const SaveOrUpdateUserInfo = (params: AccountListItem, isUpdate: boolean)=>{ | |
72 | +export const SaveOrUpdateUserInfo = (params: AccountListItem, isUpdate: boolean) => { | |
73 | 73 | if (isUpdate) { |
74 | 74 | return defHttp.put<AccountListModel>({ |
75 | 75 | url: Api.BaseUserUrl, |
76 | 76 | params, |
77 | - }) | |
77 | + }); | |
78 | 78 | } else { |
79 | 79 | return defHttp.post<AccountListModel>({ |
80 | 80 | url: Api.BaseUserUrl, |
81 | 81 | params, |
82 | - }) | |
82 | + }); | |
83 | 83 | } |
84 | -} | |
84 | +}; | |
85 | 85 | /** |
86 | 86 | * 删除User |
87 | 87 | * @param ids 删除id数组 |
... | ... | @@ -90,26 +90,26 @@ export const deleteUser = (ids: string[]) => |
90 | 90 | defHttp.delete({ |
91 | 91 | url: Api.BaseUserUrl, |
92 | 92 | data: { |
93 | - ids: ids | |
93 | + ids: ids, | |
94 | 94 | }, |
95 | - }) | |
95 | + }); | |
96 | 96 | |
97 | 97 | /** |
98 | 98 | * 查询当前用户的关系 |
99 | 99 | * @param params |
100 | 100 | */ |
101 | -export const findCurrentUserRelation=(params:RoleOrGroupParam)=> | |
101 | +export const findCurrentUserRelation = (params: RoleOrGroupParam) => | |
102 | 102 | defHttp.post<Array<string>>({ |
103 | - url: Api.BaseUserUrl+"/relation", | |
104 | - params:params | |
103 | + url: Api.BaseUserUrl + '/relation', | |
104 | + params: params, | |
105 | 105 | }); |
106 | 106 | |
107 | 107 | /** |
108 | 108 | * 修改密码 |
109 | 109 | * @param params |
110 | 110 | */ |
111 | -export const resetPassword=(params:ChangeAccountParams)=> | |
111 | +export const resetPassword = (params: ChangeAccountParams) => | |
112 | 112 | defHttp.post({ |
113 | - url: Api.BaseUserUrl + "/reset", | |
114 | - params:params | |
113 | + url: Api.BaseUserUrl + '/reset', | |
114 | + params: params, | |
115 | 115 | }); | ... | ... |
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 default { |
2 | - tenant:{ | |
3 | - tenant:"租户", | |
4 | - tenantManagement:"租户管理", | |
5 | - tenantSetting:"租户设置" | |
6 | - }, | |
7 | - dept:{ | |
8 | - queryDeptName:"部门名称", | |
9 | - queryDeptStatus:"状态", | |
10 | - toolDeptList:"部门列表", | |
11 | - toolCreateDept:"新增部门", | |
12 | - toolEditDept:"编辑部门", | |
13 | - tableTitleDeptSort:"排序", | |
14 | - tableTitleDeptCreateTime:"创建时间", | |
15 | - tableTitleDeptOperation:"操作", | |
16 | - drawerTitleDeptEnable:"启用", | |
17 | - drawerTitleDeptDisable:"停用", | |
18 | - drawerTitleDeptParentDept:"上级部门", | |
19 | - tableTitleMemo:"备注" | |
2 | + tenant: { | |
3 | + tenant: '租户', | |
4 | + tenantManagement: '租户管理', | |
5 | + tenantSetting: '租户设置', | |
20 | 6 | }, |
21 | - system:{ | |
22 | - system:"系统管理", | |
23 | - accountManagement:"账号管理", | |
24 | - roleManagement:"角色管理", | |
25 | - menuManagement:"菜单管理", | |
26 | - deptManagement:"部门管理", | |
27 | - modifyPassword:"修改密码", | |
28 | - pageSystemTitleCreateMenu:"新增菜单", | |
29 | - pageSystemTitleCreateTenant:"新增租户", | |
30 | - pageSystemTitleEditMenu:"编辑菜单", | |
31 | - pageSystemTitleEditTenant:"编辑租户", | |
32 | - pageSystemTitleOperation:"操作", | |
33 | - pageSystemTitleWhetherDelete:"是否确认删除", | |
34 | - pageSystemTitleMenuList:"菜单列表", | |
35 | - menuEditPagesMenuType:"菜单类型", | |
36 | - menuEditPagesDirectory:"目录", | |
37 | - menuEditPagesMenu:"菜单", | |
38 | - menuEditPagesButton:"按钮", | |
39 | - menuEditPagesParentMenu:"上级菜单", | |
40 | - menuEditPagesRouterAddress:"路由地址", | |
41 | - menuEditPagesComponentsPath:"组件路径", | |
42 | - menuEditPagesIsExt:"是否外链", | |
43 | - menuEditPagesIsKeepAlive:"是否缓存", | |
44 | - menuEditPagesIsHide:"是否隐藏", | |
45 | - menuEditPagesYes:"是", | |
46 | - menuEditPagesNo:"否", | |
47 | - tableTitleSystemMenuName:"菜单名称", | |
48 | - tableTitleSystemIcon:"图标", | |
49 | - tableTitleSystemPermissionTag:"权限标识", | |
50 | - tableTitleSystemComponents:"组件", | |
51 | - tableTitleSystemSort:"排序", | |
52 | - tableTitleSystemStatus:"状态", | |
53 | - tableTitleSystemCreateTime:"创建时间", | |
54 | - tableTitleSystemEnable:"启用", | |
55 | - tableTitleSystemStop:"停用", | |
56 | - tableSuccessStatus:"成功", | |
57 | - tableFailedStatus:"失败", | |
58 | - } | |
59 | - }; | |
7 | + dept: { | |
8 | + queryDeptName: '部门名称', | |
9 | + queryDeptStatus: '状态', | |
10 | + toolDeptList: '部门列表', | |
11 | + toolCreateDept: '新增部门', | |
12 | + toolEditDept: '编辑部门', | |
13 | + tableTitleDeptSort: '排序', | |
14 | + tableTitleDeptCreateTime: '创建时间', | |
15 | + tableTitleDeptOperation: '操作', | |
16 | + drawerTitleDeptEnable: '启用', | |
17 | + drawerTitleDeptDisable: '停用', | |
18 | + drawerTitleDeptParentDept: '上级部门', | |
19 | + tableTitleMemo: '备注', | |
20 | + }, | |
21 | + system: { | |
22 | + system: '系统管理', | |
23 | + accountManagement: '账号管理', | |
24 | + roleManagement: '角色管理', | |
25 | + menuManagement: '菜单管理', | |
26 | + deptManagement: '部门管理', | |
27 | + modifyPassword: '修改密码', | |
28 | + pageSystemTitleCreateMenu: '新增菜单', | |
29 | + pageSystemTitleCreateTenant: '新增租户', | |
30 | + pageSystemTitleEditMenu: '编辑菜单', | |
31 | + pageSystemTitleEditTenant: '编辑租户', | |
32 | + pageSystemTitleOperation: '操作', | |
33 | + pageSystemTitleWhetherDelete: '是否确认删除', | |
34 | + pageSystemTitleMenuList: '菜单列表', | |
35 | + menuEditPagesMenuType: '菜单类型', | |
36 | + menuEditPagesDirectory: '目录', | |
37 | + menuEditPagesMenu: '菜单', | |
38 | + menuEditPagesButton: '按钮', | |
39 | + menuEditPagesParentMenu: '上级菜单', | |
40 | + menuEditPagesRouterAddress: '路由地址', | |
41 | + menuEditPagesComponentsPath: '组件路径', | |
42 | + menuEditPagesIsExt: '是否外链', | |
43 | + menuEditPagesIsKeepAlive: '是否缓存', | |
44 | + menuEditPagesIsHide: '是否隐藏', | |
45 | + menuEditPagesYes: '是', | |
46 | + menuEditPagesNo: '否', | |
47 | + tableTitleSystemMenuName: '菜单名称', | |
48 | + tableTitleSystemIcon: '图标', | |
49 | + tableTitleSystemPermissionTag: '权限标识', | |
50 | + tableTitleSystemComponents: '组件', | |
51 | + tableTitleSystemSort: '排序', | |
52 | + tableTitleSystemStatus: '状态', | |
53 | + tableTitleSystemCreateTime: '创建时间', | |
54 | + tableTitleSystemEnable: '启用', | |
55 | + tableTitleSystemStop: '停用', | |
56 | + tableSuccessStatus: '成功', | |
57 | + tableFailedStatus: '失败', | |
58 | + }, | |
59 | +}; | ... | ... |
... | ... | @@ -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 | ... | ... |
src/views/alarm/template/ContactDrawer.vue
0 → 100644
1 | +<template> | |
2 | + <BasicDrawer | |
3 | + v-bind="$attrs" | |
4 | + @register="registerDrawer" | |
5 | + showFooter | |
6 | + :title="getTitle" | |
7 | + width="500px" | |
8 | + @ok="handleSubmit" | |
9 | + > | |
10 | + <BasicForm @register="registerForm" /> | |
11 | + </BasicDrawer> | |
12 | +</template> | |
13 | +<script lang="ts"> | |
14 | + import { defineComponent, ref, computed, unref } from 'vue'; | |
15 | + import { BasicForm, useForm } from '/@/components/Form'; | |
16 | + import { formSchema } from './config.data'; | |
17 | + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | |
18 | + import { saveOrEditMessageConfig } from '/@/api/message/config'; | |
19 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
20 | + | |
21 | + export default defineComponent({ | |
22 | + name: 'ContactDrawer', | |
23 | + components: { BasicDrawer, BasicForm }, | |
24 | + emits: ['success', 'register'], | |
25 | + setup(_, { emit }) { | |
26 | + const isUpdate = ref(true); | |
27 | + | |
28 | + const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ | |
29 | + labelWidth: 120, | |
30 | + schemas: formSchema, | |
31 | + showActionButtonGroup: false, | |
32 | + }); | |
33 | + | |
34 | + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | |
35 | + await resetFields(); | |
36 | + setDrawerProps({ confirmLoading: false }); | |
37 | + isUpdate.value = !!data?.isUpdate; | |
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 | + await setFieldsValue({ | |
44 | + ...data.record, | |
45 | + }); | |
46 | + } | |
47 | + }); | |
48 | + | |
49 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增消息配置' : '编辑消息配置')); | |
50 | + | |
51 | + async function handleSubmit() { | |
52 | + try { | |
53 | + const values = await validate(); | |
54 | + const { createMessage } = useMessage(); | |
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 | + }; | |
69 | + } | |
70 | + Reflect.set(values, 'config', config); | |
71 | + let saveMessage = '添加成功'; | |
72 | + let updateMessage = '修改成功'; | |
73 | + await saveOrEditMessageConfig(values, unref(isUpdate)); | |
74 | + closeDrawer(); | |
75 | + emit('success'); | |
76 | + createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | |
77 | + } finally { | |
78 | + setDrawerProps({ confirmLoading: false }); | |
79 | + } | |
80 | + } | |
81 | + | |
82 | + return { | |
83 | + registerDrawer, | |
84 | + registerForm, | |
85 | + getTitle, | |
86 | + handleSubmit, | |
87 | + }; | |
88 | + }, | |
89 | + }); | |
90 | +</script> | ... | ... |
src/views/alarm/template/config.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 { MessageEnum } from '/@/enums/messageEnum'; | |
5 | +// 表格列数据 | |
6 | +export const columns: BasicColumn[] = [ | |
7 | + { | |
8 | + title: '姓名', | |
9 | + dataIndex: 'username', | |
10 | + width: 100, | |
11 | + }, | |
12 | + { | |
13 | + title: '所属组织', | |
14 | + dataIndex: 'department', | |
15 | + width: 200, | |
16 | + }, | |
17 | + { | |
18 | + title: '手机', | |
19 | + dataIndex: 'phone', | |
20 | + width: 160, | |
21 | + }, | |
22 | + { | |
23 | + title: '邮箱', | |
24 | + dataIndex: 'label', | |
25 | + width: 160, | |
26 | + }, | |
27 | + { | |
28 | + title: '微信', | |
29 | + dataIndex: 'deviceInfo', | |
30 | + width: 180, | |
31 | + }, | |
32 | + { | |
33 | + title: '备注', | |
34 | + dataIndex: 'deviceState', | |
35 | + width: 120, | |
36 | + }, | |
37 | + { | |
38 | + title: '添加人', | |
39 | + dataIndex: 'lastConnectTime', | |
40 | + width: 180, | |
41 | + }, | |
42 | + { | |
43 | + title: '更新时间', | |
44 | + dataIndex: 'updateTime', | |
45 | + width: 180, | |
46 | + }, | |
47 | + { | |
48 | + title: '添加时间', | |
49 | + dataIndex: 'createTime', | |
50 | + width: 180, | |
51 | + }, | |
52 | +]; | |
53 | + | |
54 | +// 查询字段 | |
55 | +export const searchFormSchema: FormSchema[] = [ | |
56 | + { | |
57 | + field: 'department', | |
58 | + label: '所属组织', | |
59 | + component: 'TreeSelect', | |
60 | + componentProps: { | |
61 | + placeholder: '请选择组织', | |
62 | + }, | |
63 | + colProps: { span: 6 }, | |
64 | + }, | |
65 | + { | |
66 | + field: 'username', | |
67 | + label: '用户名', | |
68 | + component: 'Input', | |
69 | + colProps: { span: 6 }, | |
70 | + componentProps: { | |
71 | + placeholder: '请输入姓名、手机号或邮箱', | |
72 | + }, | |
73 | + }, | |
74 | +]; | |
75 | + | |
76 | +// 弹框配置项 | |
77 | +export const formSchema: FormSchema[] = [ | |
78 | + { | |
79 | + field: 'configName', | |
80 | + label: '联系人姓名', | |
81 | + required: true, | |
82 | + component: 'Input', | |
83 | + }, | |
84 | + { | |
85 | + field: 'messageType', | |
86 | + label: '所属组织', | |
87 | + required: true, | |
88 | + component: 'ApiSelect', | |
89 | + componentProps: { | |
90 | + api: findDictItemByCode, | |
91 | + params: { | |
92 | + dictCode: 'message_type', | |
93 | + }, | |
94 | + labelField: 'itemText', | |
95 | + valueField: 'itemValue', | |
96 | + }, | |
97 | + }, | |
98 | + { | |
99 | + field: 'platformType', | |
100 | + label: '手机号码', | |
101 | + required: true, | |
102 | + component: 'Input', | |
103 | + componentProps: { | |
104 | + api: findDictItemByCode, | |
105 | + params: { | |
106 | + dictCode: 'platform_type', | |
107 | + }, | |
108 | + labelField: 'itemText', | |
109 | + valueField: 'itemValue', | |
110 | + }, | |
111 | + }, | |
112 | + { | |
113 | + field: 'accessKeyId', | |
114 | + label: 'accessKeyId', | |
115 | + required: true, | |
116 | + component: 'Input', | |
117 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | |
118 | + }, | |
119 | + { | |
120 | + field: 'accessKeySecret', | |
121 | + label: 'accessKeySecret', | |
122 | + required: true, | |
123 | + component: 'Input', | |
124 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | |
125 | + }, | |
126 | + { | |
127 | + field: 'host', | |
128 | + label: '服务器地址', | |
129 | + defaultValue: 'smtp.163.com', | |
130 | + required: true, | |
131 | + component: 'Input', | |
132 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
133 | + }, | |
134 | + { | |
135 | + field: 'port', | |
136 | + label: '端口', | |
137 | + defaultValue: 25, | |
138 | + required: true, | |
139 | + component: 'InputNumber', | |
140 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
141 | + }, | |
142 | + { | |
143 | + field: 'username', | |
144 | + label: '用户名', | |
145 | + required: true, | |
146 | + component: 'Input', | |
147 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
148 | + }, | |
149 | + { | |
150 | + field: 'password', | |
151 | + label: '密码', | |
152 | + required: true, | |
153 | + component: 'InputPassword', | |
154 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
155 | + }, | |
156 | + { | |
157 | + field: 'config', | |
158 | + label: '消息配置', | |
159 | + component: 'Input', | |
160 | + show: false, | |
161 | + }, | |
162 | + { | |
163 | + field: 'id', | |
164 | + label: '主键', | |
165 | + component: 'Input', | |
166 | + show: false, | |
167 | + }, | |
168 | + { | |
169 | + field: 'status', | |
170 | + label: '状态', | |
171 | + component: 'RadioButtonGroup', | |
172 | + defaultValue: 0, | |
173 | + componentProps: { | |
174 | + options: [ | |
175 | + { label: '启用', value: 1 }, | |
176 | + { label: '停用', value: 0 }, | |
177 | + ], | |
178 | + }, | |
179 | + }, | |
180 | + { | |
181 | + label: '备注', | |
182 | + field: 'remark', | |
183 | + component: 'InputTextArea', | |
184 | + }, | |
185 | +]; | |
186 | + | |
187 | +export const isMessage = (type: string) => { | |
188 | + return type === MessageEnum.IS_SMS; | |
189 | +}; | |
190 | +export const isEmail = (type: string) => { | |
191 | + return type === MessageEnum.IS_EMAIL; | |
192 | +}; | ... | ... |
src/views/alarm/template/index.vue
0 → 100644
1 | +<template> | |
2 | + <div> | |
3 | + <BasicTable @register="registerTable"> | |
4 | + <template #toolbar> | |
5 | + <a-button type="primary" @click="handleCreate"> 新增联系人 </a-button> | |
6 | + <a-button type="primary" color="error" @click="handleDelete"> 批量删除 </a-button> | |
7 | + </template> | |
8 | + <template #action="{ record }"> | |
9 | + <TableAction | |
10 | + :actions="[ | |
11 | + { | |
12 | + label: '编辑', | |
13 | + icon: 'clarity:note-edit-line', | |
14 | + onClick: handleEdit.bind(null, record), | |
15 | + }, | |
16 | + { | |
17 | + label: '删除', | |
18 | + icon: 'ant-design:delete-outlined', | |
19 | + color: 'error', | |
20 | + popConfirm: { | |
21 | + title: '是否确认删除', | |
22 | + confirm: handleDelete.bind(null, record), | |
23 | + }, | |
24 | + }, | |
25 | + ]" | |
26 | + /> | |
27 | + </template> | |
28 | + </BasicTable> | |
29 | + <ContactDrawer @register="registerDrawer" @success="handleSuccess" /> | |
30 | + </div> | |
31 | +</template> | |
32 | + | |
33 | +<script lang="ts"> | |
34 | + import { defineComponent } from 'vue'; | |
35 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
36 | + // import { useGo } from '/@/hooks/web/usePage'; | |
37 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
38 | + import { useDrawer } from '/@/components/Drawer'; | |
39 | + import ContactDrawer from './ContactDrawer.vue'; | |
40 | + import { getAlarmContact, deleteAlarmContact } from '/@/api/alarm/contact/alarmContact'; | |
41 | + import { searchFormSchema, columns } from './config.data'; | |
42 | + import {} from '/@/api/alarm/contact/alarmContact'; | |
43 | + export default defineComponent({ | |
44 | + components: { | |
45 | + BasicTable, | |
46 | + TableAction, | |
47 | + ContactDrawer, | |
48 | + }, | |
49 | + setup() { | |
50 | + const [registerTable, { reload }] = useTable({ | |
51 | + api: getAlarmContact, | |
52 | + columns, | |
53 | + formConfig: { | |
54 | + labelWidth: 120, | |
55 | + schemas: searchFormSchema, | |
56 | + }, | |
57 | + useSearchForm: true, | |
58 | + showTableSetting: true, | |
59 | + bordered: true, | |
60 | + showIndexColumn: false, | |
61 | + actionColumn: { | |
62 | + width: 180, | |
63 | + title: '操作', | |
64 | + dataIndex: 'action', | |
65 | + slots: { customRender: 'action' }, | |
66 | + fixed: 'right', | |
67 | + }, | |
68 | + }); | |
69 | + const [registerDrawer, { openDrawer }] = useDrawer(); | |
70 | + const { createMessage } = useMessage(); | |
71 | + const handleCreate = () => { | |
72 | + openDrawer(true, { | |
73 | + isUpdate: false, | |
74 | + }); | |
75 | + }; | |
76 | + const handleEdit = (record: Recordable) => { | |
77 | + openDrawer(true, { | |
78 | + record, | |
79 | + isUpdate: true, | |
80 | + }); | |
81 | + }; | |
82 | + const handleDelete = async (record: Recordable) => { | |
83 | + let ids: string[] = [record.id]; | |
84 | + console.log(ids); | |
85 | + try { | |
86 | + await deleteAlarmContact(ids); | |
87 | + createMessage.success('删除联系人成功'); | |
88 | + handleSuccess(); | |
89 | + } catch (e) { | |
90 | + createMessage.error('删除失败'); | |
91 | + } | |
92 | + }; | |
93 | + // 刷新 | |
94 | + const handleSuccess = () => { | |
95 | + reload(); | |
96 | + }; | |
97 | + return { | |
98 | + handleEdit, | |
99 | + handleCreate, | |
100 | + handleDelete, | |
101 | + registerTable, | |
102 | + registerDrawer, | |
103 | + reload, | |
104 | + }; | |
105 | + }, | |
106 | + }); | |
107 | +</script> | ... | ... |
... | ... | @@ -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 | } | ... | ... |
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"; | |
5 | -import {DeviceTypeEnum,DeviceState} from "/@/api/device/model/deviceModel"; | |
3 | +import { findDictItemByCode } from '/@/api/system/dict'; | |
4 | +import { MessageEnum } from '/@/enums/messageEnum'; | |
5 | +import { DeviceTypeEnum, DeviceState } from '/@/api/device/model/deviceModel'; | |
6 | +// 表格列数据 | |
6 | 7 | export const columns: BasicColumn[] = [ |
7 | 8 | { |
8 | 9 | title: '设备名称', |
... | ... | @@ -13,7 +14,7 @@ export const columns: BasicColumn[] = [ |
13 | 14 | title: '设备类型', |
14 | 15 | dataIndex: 'deviceType', |
15 | 16 | width: 200, |
16 | - slots:{customRender:'deviceType'}, | |
17 | + slots: { customRender: 'deviceType' }, | |
17 | 18 | }, |
18 | 19 | { |
19 | 20 | title: '设备配置', |
... | ... | @@ -24,7 +25,7 @@ export const columns: BasicColumn[] = [ |
24 | 25 | { |
25 | 26 | title: '标签', |
26 | 27 | dataIndex: 'label', |
27 | - width: 180 | |
28 | + width: 180, | |
28 | 29 | }, |
29 | 30 | { |
30 | 31 | title: '配置信息', |
... | ... | @@ -38,7 +39,6 @@ export const columns: BasicColumn[] = [ |
38 | 39 | width: 120, |
39 | 40 | slots: { customRender: 'deviceState' }, |
40 | 41 | }, |
41 | - | |
42 | 42 | { |
43 | 43 | title: '最后连接时间', |
44 | 44 | dataIndex: 'lastConnectTime', |
... | ... | @@ -51,6 +51,7 @@ export const columns: BasicColumn[] = [ |
51 | 51 | }, |
52 | 52 | ]; |
53 | 53 | |
54 | +// 查询字段 | |
54 | 55 | export const searchFormSchema: FormSchema[] = [ |
55 | 56 | { |
56 | 57 | field: 'deviceType', |
... | ... | @@ -86,20 +87,13 @@ export const searchFormSchema: FormSchema[] = [ |
86 | 87 | }, |
87 | 88 | ]; |
88 | 89 | |
89 | - | |
90 | -export const isMessage = (type:string)=>{ | |
91 | - return type===MessageEnum.IS_SMS; | |
92 | -} | |
93 | -export const isEmail = (type:string)=>{ | |
94 | - return type===MessageEnum.IS_EMAIL; | |
95 | -} | |
96 | - | |
90 | +// 弹框配置项 | |
97 | 91 | export const formSchema: FormSchema[] = [ |
98 | 92 | { |
99 | 93 | field: 'configName', |
100 | 94 | label: '配置名称', |
101 | 95 | required: true, |
102 | - component:'Input' | |
96 | + component: 'Input', | |
103 | 97 | }, |
104 | 98 | { |
105 | 99 | field: 'messageType', |
... | ... | @@ -107,12 +101,12 @@ export const formSchema: FormSchema[] = [ |
107 | 101 | required: true, |
108 | 102 | component: 'ApiSelect', |
109 | 103 | componentProps: { |
110 | - api:findDictItemByCode, | |
111 | - params:{ | |
112 | - dictCode:"message_type" | |
104 | + api: findDictItemByCode, | |
105 | + params: { | |
106 | + dictCode: 'message_type', | |
113 | 107 | }, |
114 | - labelField:'itemText', | |
115 | - valueField:'itemValue', | |
108 | + labelField: 'itemText', | |
109 | + valueField: 'itemValue', | |
116 | 110 | }, |
117 | 111 | }, |
118 | 112 | { |
... | ... | @@ -121,70 +115,70 @@ export const formSchema: FormSchema[] = [ |
121 | 115 | required: true, |
122 | 116 | component: 'ApiSelect', |
123 | 117 | componentProps: { |
124 | - api:findDictItemByCode, | |
125 | - params:{ | |
126 | - dictCode:"platform_type" | |
118 | + api: findDictItemByCode, | |
119 | + params: { | |
120 | + dictCode: 'platform_type', | |
127 | 121 | }, |
128 | - labelField:'itemText', | |
129 | - valueField:'itemValue', | |
122 | + labelField: 'itemText', | |
123 | + valueField: 'itemValue', | |
130 | 124 | }, |
131 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | |
125 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | |
132 | 126 | }, |
133 | 127 | { |
134 | 128 | field: 'accessKeyId', |
135 | 129 | label: 'accessKeyId', |
136 | 130 | required: true, |
137 | - component:'Input', | |
138 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | |
131 | + component: 'Input', | |
132 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | |
139 | 133 | }, |
140 | 134 | { |
141 | 135 | field: 'accessKeySecret', |
142 | 136 | label: 'accessKeySecret', |
143 | 137 | required: true, |
144 | - component:'Input', | |
145 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | |
138 | + component: 'Input', | |
139 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | |
146 | 140 | }, |
147 | 141 | { |
148 | 142 | field: 'host', |
149 | 143 | label: '服务器地址', |
150 | - defaultValue:'smtp.163.com', | |
144 | + defaultValue: 'smtp.163.com', | |
151 | 145 | required: true, |
152 | - component:'Input', | |
153 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | |
146 | + component: 'Input', | |
147 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
154 | 148 | }, |
155 | 149 | { |
156 | 150 | field: 'port', |
157 | 151 | label: '端口', |
158 | 152 | defaultValue: 25, |
159 | 153 | required: true, |
160 | - component:'InputNumber', | |
161 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | |
154 | + component: 'InputNumber', | |
155 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
162 | 156 | }, |
163 | 157 | { |
164 | 158 | field: 'username', |
165 | 159 | label: '用户名', |
166 | 160 | required: true, |
167 | - component:'Input', | |
168 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | |
161 | + component: 'Input', | |
162 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
169 | 163 | }, |
170 | 164 | { |
171 | 165 | field: 'password', |
172 | 166 | label: '密码', |
173 | 167 | required: true, |
174 | - component:'InputPassword', | |
175 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | |
168 | + component: 'InputPassword', | |
169 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | |
176 | 170 | }, |
177 | 171 | { |
178 | 172 | field: 'config', |
179 | 173 | label: '消息配置', |
180 | - component:'Input', | |
181 | - show:false, | |
174 | + component: 'Input', | |
175 | + show: false, | |
182 | 176 | }, |
183 | 177 | { |
184 | 178 | field: 'id', |
185 | 179 | label: '主键', |
186 | - component:'Input', | |
187 | - show:false, | |
180 | + component: 'Input', | |
181 | + show: false, | |
188 | 182 | }, |
189 | 183 | { |
190 | 184 | field: 'status', |
... | ... | @@ -202,5 +196,12 @@ export const formSchema: FormSchema[] = [ |
202 | 196 | label: '备注', |
203 | 197 | field: 'remark', |
204 | 198 | component: 'InputTextArea', |
205 | - } | |
199 | + }, | |
206 | 200 | ]; |
201 | + | |
202 | +export const isMessage = (type: string) => { | |
203 | + return type === MessageEnum.IS_SMS; | |
204 | +}; | |
205 | +export const isEmail = (type: string) => { | |
206 | + return type === MessageEnum.IS_EMAIL; | |
207 | +}; | ... | ... |
... | ... | @@ -4,40 +4,61 @@ |
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 | - <template #deviceProfile="{record}"> | |
11 | - <a-button type="link" class="ml-2" @click="goDeviceProfile"> {{record.deviceProfile.name}} </a-button> | |
10 | + <template #deviceProfile="{ record }"> | |
11 | + <a-button type="link" class="ml-2" @click="goDeviceProfile"> | |
12 | + {{ record.deviceProfile.name }} | |
13 | + </a-button> | |
12 | 14 | </template> |
13 | - <template #deviceType = "{record}"> | |
15 | + <template #deviceType="{ record }"> | |
14 | 16 | <Tag color="success" class="ml-2"> |
15 | - {{record.deviceType==DeviceTypeEnum.GATEWAY ?'网关设备': | |
16 | - record.deviceType==DeviceTypeEnum.DIRECT_CONNECTION ?'直连设备':'网关子设备'}} | |
17 | + {{ | |
18 | + record.deviceType == DeviceTypeEnum.GATEWAY | |
19 | + ? '网关设备' | |
20 | + : record.deviceType == DeviceTypeEnum.DIRECT_CONNECTION | |
21 | + ? '直连设备' | |
22 | + : '网关子设备' | |
23 | + }} | |
17 | 24 | </Tag> |
18 | 25 | </template> |
19 | - <template #deviceState = "{record}"> | |
20 | - <Tag :color="record.deviceState==DeviceState.INACTIVE?'warning':record.deviceState==DeviceState.ONLINE?'success':'error'" class="ml-2"> | |
21 | - {{record.deviceState==DeviceState.INACTIVE ?'待激活': | |
22 | - record.deviceState==DeviceState.ONLINE ?'在线':'离线'}} | |
26 | + <template #deviceState="{ record }"> | |
27 | + <Tag | |
28 | + :color=" | |
29 | + record.deviceState == DeviceState.INACTIVE | |
30 | + ? 'warning' | |
31 | + : record.deviceState == DeviceState.ONLINE | |
32 | + ? 'success' | |
33 | + : 'error' | |
34 | + " | |
35 | + class="ml-2" | |
36 | + > | |
37 | + {{ | |
38 | + record.deviceState == DeviceState.INACTIVE | |
39 | + ? '待激活' | |
40 | + : record.deviceState == DeviceState.ONLINE | |
41 | + ? '在线' | |
42 | + : '离线' | |
43 | + }} | |
23 | 44 | </Tag> |
24 | 45 | </template> |
25 | 46 | <template #action="{ record }"> |
26 | 47 | <TableAction |
27 | 48 | :actions="[ |
28 | 49 | { |
29 | - label:'编辑', | |
50 | + label: '编辑', | |
30 | 51 | icon: 'clarity:note-edit-line', |
31 | 52 | onClick: handleEdit.bind(null, record), |
32 | 53 | }, |
33 | 54 | { |
34 | - label:'删除', | |
55 | + label: '删除', | |
35 | 56 | icon: 'ant-design:delete-outlined', |
36 | 57 | color: 'error', |
37 | 58 | popConfirm: { |
38 | 59 | title: '是否确认删除', |
39 | 60 | confirm: handleDelete.bind(null, record), |
40 | - } | |
61 | + }, | |
41 | 62 | }, |
42 | 63 | ]" |
43 | 64 | /> |
... | ... | @@ -47,93 +68,94 @@ |
47 | 68 | </div> |
48 | 69 | </template> |
49 | 70 | <script lang="ts"> |
50 | -import { defineComponent,h} from 'vue'; | |
51 | -import {DeviceState, DeviceTypeEnum} from "/@/api/device/model/deviceModel"; | |
52 | -import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
53 | -import { useDrawer } from '/@/components/Drawer'; | |
54 | -import ConfigDrawer from './DeviceDrawer.vue'; | |
55 | -import { columns, searchFormSchema } from './config.data'; | |
56 | -import {Modal, Tag} from 'ant-design-vue'; | |
57 | -import { CodeEditor,JsonPreview } from '/@/components/CodeEditor'; | |
58 | -import {useMessage} from "/@/hooks/web/useMessage"; | |
59 | -import {deleteDevice, devicePage} from "/@/api/device/deviceManager"; | |
60 | -import {PageEnum} from "/@/enums/pageEnum"; | |
61 | -import {useGo} from "/@/hooks/web/usePage"; | |
71 | + import { defineComponent, h } from 'vue'; | |
72 | + import { DeviceState, DeviceTypeEnum } from '/@/api/device/model/deviceModel'; | |
73 | + 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 { JsonPreview } from '/@/components/CodeEditor'; | |
79 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
80 | + import { deleteDevice, devicePage } from '/@/api/device/deviceManager'; | |
81 | + import { PageEnum } from '/@/enums/pageEnum'; | |
82 | + import { useGo } from '/@/hooks/web/usePage'; | |
62 | 83 | |
63 | -export default defineComponent({ | |
64 | - name: 'DeviceManagement', | |
65 | - components: { BasicTable, ConfigDrawer, TableAction ,CodeEditor,Tag}, | |
66 | - setup() { | |
67 | - const [registerDrawer, { openDrawer }] = useDrawer(); | |
68 | - const {createMessage} = useMessage(); | |
69 | - const go = useGo(); | |
70 | - const [registerTable, { reload }] = useTable({ | |
71 | - title: '设备列表', | |
72 | - api: devicePage, | |
73 | - columns, | |
74 | - formConfig: { | |
75 | - labelWidth: 120, | |
76 | - schemas: searchFormSchema, | |
77 | - }, | |
78 | - useSearchForm: true, | |
79 | - showTableSetting: true, | |
80 | - bordered: true, | |
81 | - showIndexColumn: false, | |
82 | - actionColumn: { | |
83 | - width: 180, | |
84 | - title: '操作', | |
85 | - dataIndex: 'action', | |
86 | - slots: { customRender: 'action' }, | |
87 | - fixed: undefined, | |
88 | - }, | |
89 | - }); | |
90 | - | |
91 | - function handleCreate() { | |
92 | - openDrawer(true, { | |
93 | - isUpdate: false, | |
94 | - }); | |
95 | - } | |
96 | - | |
97 | - function handleEdit(record: Recordable) { | |
98 | - openDrawer(true, { | |
99 | - record, | |
100 | - isUpdate: true, | |
101 | - }); | |
102 | - } | |
103 | - | |
104 | - function handleDelete(record: Recordable) { | |
105 | - let ids = [record.id]; | |
106 | - deleteDevice(ids).then(()=>{ | |
107 | - createMessage.success("删除设备成功") | |
108 | - handleSuccess() | |
109 | - }); | |
110 | - } | |
111 | - | |
112 | - function handleSuccess() { | |
113 | - reload(); | |
114 | - } | |
115 | - function showData(record: Recordable){ | |
116 | - Modal.info({ | |
117 | - title: '当前配置', | |
118 | - width:480, | |
119 | - content: h(JsonPreview, { data: JSON.parse(JSON.stringify(record.deviceInfo)) }), | |
84 | + export default defineComponent({ | |
85 | + name: 'DeviceManagement', | |
86 | + components: { BasicTable, ConfigDrawer, TableAction, Tag }, | |
87 | + setup() { | |
88 | + const go = useGo(); | |
89 | + const { createMessage } = useMessage(); | |
90 | + const [registerDrawer, { openDrawer }] = useDrawer(); | |
91 | + const [registerTable, { reload }] = useTable({ | |
92 | + title: '设备列表', | |
93 | + api: devicePage, | |
94 | + columns, | |
95 | + formConfig: { | |
96 | + labelWidth: 120, | |
97 | + schemas: searchFormSchema, | |
98 | + }, | |
99 | + useSearchForm: true, | |
100 | + showTableSetting: true, | |
101 | + bordered: true, | |
102 | + showIndexColumn: false, | |
103 | + actionColumn: { | |
104 | + width: 180, | |
105 | + title: '操作', | |
106 | + dataIndex: 'action', | |
107 | + slots: { customRender: 'action' }, | |
108 | + fixed: undefined, | |
109 | + }, | |
120 | 110 | }); |
121 | - } | |
122 | - function goDeviceProfile(){ | |
123 | - go(PageEnum.DEVICE_PROFILE) | |
124 | - } | |
125 | - return { | |
126 | - registerTable, | |
127 | - registerDrawer, | |
128 | - showData, | |
129 | - handleCreate, | |
130 | - handleEdit, | |
131 | - handleDelete, | |
132 | - handleSuccess, | |
133 | - goDeviceProfile, | |
134 | - DeviceTypeEnum, | |
135 | - DeviceState | |
136 | - }; | |
137 | - }, | |
138 | -}); | |
111 | + // 新增 | |
112 | + function handleCreate() { | |
113 | + openDrawer(true, { | |
114 | + isUpdate: false, | |
115 | + }); | |
116 | + } | |
117 | + // 更新 | |
118 | + function handleEdit(record: Recordable) { | |
119 | + openDrawer(true, { | |
120 | + record, | |
121 | + isUpdate: true, | |
122 | + }); | |
123 | + } | |
124 | + // 删除 | |
125 | + function handleDelete(record: Recordable) { | |
126 | + let ids = [record.id]; | |
127 | + deleteDevice(ids).then(() => { | |
128 | + createMessage.success('删除设备成功'); | |
129 | + handleSuccess(); | |
130 | + }); | |
131 | + } | |
132 | + // 刷新 | |
133 | + function handleSuccess() { | |
134 | + reload(); | |
135 | + } | |
136 | + // 查看某一个设备具体信息 | |
137 | + function showData(record: Recordable) { | |
138 | + Modal.info({ | |
139 | + title: '当前配置', | |
140 | + width: 480, | |
141 | + content: h(JsonPreview, { data: JSON.parse(JSON.stringify(record.deviceInfo)) }), | |
142 | + }); | |
143 | + } | |
144 | + function goDeviceProfile() { | |
145 | + go(PageEnum.DEVICE_PROFILE); | |
146 | + } | |
147 | + return { | |
148 | + registerTable, | |
149 | + registerDrawer, | |
150 | + showData, | |
151 | + handleCreate, | |
152 | + handleEdit, | |
153 | + handleDelete, | |
154 | + handleSuccess, | |
155 | + goDeviceProfile, | |
156 | + DeviceTypeEnum, | |
157 | + DeviceState, | |
158 | + }; | |
159 | + }, | |
160 | + }); | |
139 | 161 | </script> | ... | ... |
... | ... | @@ -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> | ... | ... |
... | ... | @@ -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 | } | ... | ... |
... | ... | @@ -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> | ... | ... |
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | </template> |
14 | 14 | |
15 | 15 | <script lang="ts"> |
16 | - import { Tabs, } from 'ant-design-vue'; | |
16 | + import { Tabs } from 'ant-design-vue'; | |
17 | 17 | import { defineComponent } from 'vue'; |
18 | 18 | import SmsLog from './item/SmsLog.vue'; |
19 | 19 | import EmailLog from './item/EmailLog.vue'; | ... | ... |
1 | 1 | <template> |
2 | - <BasicModal v-bind="$attrs" @register="register" title="邮件发送参数" | |
3 | - :okButtonProps="{ disabled: true }" | |
4 | - @ok="handleOK" | |
5 | - width="700px"> | |
2 | + <BasicModal | |
3 | + v-bind="$attrs" | |
4 | + @register="register" | |
5 | + title="邮件发送参数" | |
6 | + :okButtonProps="{ disabled: true }" | |
7 | + @ok="handleOK" | |
8 | + width="700px" | |
9 | + > | |
6 | 10 | <div class="pt-6px pr-6px"> |
7 | - <BasicForm @register="registerForm"/> | |
11 | + <BasicForm @register="registerForm" /> | |
8 | 12 | </div> |
9 | 13 | </BasicModal> |
10 | 14 | </template> |
11 | 15 | <script lang="ts"> |
12 | -import { defineComponent,h } from 'vue'; | |
13 | -import { BasicModal, useModalInner } from '/@/components/Modal'; | |
14 | -import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; | |
15 | -import { Tinymce } from '/@/components/Tinymce'; | |
16 | -const schemas: FormSchema[] = [ | |
17 | - { | |
18 | - field: 'emailBody', | |
19 | - component: 'Input', | |
20 | - label: '', | |
21 | - rules: [{ required: true }], | |
22 | - render: ({ model, field }) => { | |
23 | - return h(Tinymce, { | |
24 | - value: model[field], | |
25 | - showImageUpload:false, | |
26 | - onChange: (value: string) => { | |
27 | - model[field] = value; | |
16 | + import { defineComponent, h } from 'vue'; | |
17 | + import { BasicModal, useModalInner } from '/@/components/Modal'; | |
18 | + import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; | |
19 | + import { Tinymce } from '/@/components/Tinymce'; | |
20 | + const schemas: FormSchema[] = [ | |
21 | + { | |
22 | + field: 'emailBody', | |
23 | + component: 'Input', | |
24 | + label: '', | |
25 | + rules: [{ required: true }], | |
26 | + render: ({ model, field }) => { | |
27 | + return h(Tinymce, { | |
28 | + value: model[field], | |
29 | + showImageUpload: false, | |
30 | + onChange: (value: string) => { | |
31 | + model[field] = value; | |
32 | + }, | |
33 | + }); | |
34 | + }, | |
35 | + }, | |
36 | + ]; | |
37 | + export default defineComponent({ | |
38 | + components: { BasicModal, BasicForm }, | |
39 | + setup() { | |
40 | + const [registerForm, { resetFields, setFieldsValue }] = useForm({ | |
41 | + labelWidth: 70, | |
42 | + schemas, | |
43 | + showActionButtonGroup: false, | |
44 | + actionColOptions: { | |
45 | + span: 24, | |
28 | 46 | }, |
29 | 47 | }); |
30 | - }, | |
31 | - }, | |
32 | -]; | |
33 | -export default defineComponent({ | |
34 | - components: { BasicModal, BasicForm}, | |
35 | - setup() { | |
36 | - const [registerForm,{resetFields,setFieldsValue},] = useForm({ | |
37 | - labelWidth: 70, | |
38 | - schemas, | |
39 | - showActionButtonGroup: false, | |
40 | - actionColOptions: { | |
41 | - span: 24, | |
42 | - }, | |
43 | - }); | |
44 | - const [register,{closeModal}] = useModalInner(async(data) => { | |
45 | - await resetFields(); | |
46 | - await setFieldsValue({ | |
47 | - ...data.record, | |
48 | + const [register, { closeModal }] = useModalInner(async (data) => { | |
49 | + await resetFields(); | |
50 | + await setFieldsValue({ | |
51 | + ...data.record, | |
52 | + }); | |
48 | 53 | }); |
49 | - }); | |
50 | 54 | |
51 | - async function handleOK() { | |
52 | - closeModal(); | |
53 | - } | |
55 | + async function handleOK() { | |
56 | + closeModal(); | |
57 | + } | |
54 | 58 | |
55 | - return { register, schemas, registerForm, handleOK }; | |
56 | - }, | |
57 | -}); | |
59 | + return { register, schemas, registerForm, handleOK }; | |
60 | + }, | |
61 | + }); | |
58 | 62 | </script> | ... | ... |
... | ... | @@ -8,12 +8,12 @@ |
8 | 8 | <TableAction |
9 | 9 | :actions="[ |
10 | 10 | { |
11 | - label:'查看', | |
11 | + label: '查看', | |
12 | 12 | icon: 'ant-design:fund-view-outlined', |
13 | 13 | onClick: handleModal.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: { |
... | ... | @@ -25,81 +25,79 @@ |
25 | 25 | /> |
26 | 26 | </template> |
27 | 27 | </BasicTable> |
28 | - <EmailDetail @register="registerModal"/> | |
28 | + <EmailDetail @register="registerModal" /> | |
29 | 29 | </div> |
30 | 30 | </template> |
31 | 31 | <script lang="ts"> |
32 | -import { defineComponent } from 'vue'; | |
32 | + import { defineComponent } from 'vue'; | |
33 | 33 | |
34 | -import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
35 | -import { BasicDrawer,useDrawerInner } from '/@/components/Drawer'; | |
36 | -import { columns, searchFormSchema } from './email.data'; | |
37 | -import {Tag} from "ant-design-vue"; | |
38 | -import {useMessage} from "/@/hooks/web/useMessage"; | |
39 | -import {deleteSmsLog, mailLogPage} from "/@/api/message/records"; | |
40 | -import {useModal} from "/@/components/Modal"; | |
41 | -import EmailDetail from "/@/views/message/records/item/EmailDetail.vue"; | |
42 | -export default defineComponent({ | |
43 | - name: 'EmailLog', | |
44 | - components: {EmailDetail, BasicDrawer, BasicTable, TableAction ,Tag}, | |
45 | - setup() { | |
46 | - const [registerModal, { openModal}] = useModal(); | |
47 | - const { createMessage } = useMessage(); | |
48 | - const [register] = useDrawerInner(() => { | |
49 | - }); | |
50 | - const [registerTable, { reload }] = useTable({ | |
51 | - title: '邮件发送列表', | |
52 | - api: mailLogPage, | |
53 | - columns, | |
54 | - formConfig: { | |
55 | - labelWidth: 120, | |
56 | - schemas: searchFormSchema, | |
57 | - fieldMapToTime: [['sendTime', ['startTime', 'endTime'], 'YYYY-MM-DD HH:mm:ss']], | |
58 | - }, | |
59 | - useSearchForm: true, | |
60 | - showTableSetting: true, | |
61 | - bordered: true, | |
62 | - showIndexColumn: false, | |
63 | - actionColumn: { | |
64 | - width: 140, | |
65 | - title: '操作', | |
66 | - dataIndex: 'action', | |
67 | - slots: { customRender: 'action' }, | |
68 | - fixed: undefined, | |
69 | - }, | |
70 | - immediate:true | |
71 | - }); | |
34 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
35 | + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | |
36 | + import { columns, searchFormSchema } from './email.data'; | |
37 | + import { Tag } from 'ant-design-vue'; | |
38 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
39 | + import { deleteSmsLog, mailLogPage } from '/@/api/message/records'; | |
40 | + import { useModal } from '/@/components/Modal'; | |
41 | + import EmailDetail from '/@/views/message/records/item/EmailDetail.vue'; | |
42 | + export default defineComponent({ | |
43 | + name: 'EmailLog', | |
44 | + components: { EmailDetail, BasicDrawer, BasicTable, TableAction, Tag }, | |
45 | + setup() { | |
46 | + const [registerModal, { openModal }] = useModal(); | |
47 | + const { createMessage } = useMessage(); | |
48 | + const [register] = useDrawerInner(() => {}); | |
49 | + const [registerTable, { reload }] = useTable({ | |
50 | + title: '邮件发送列表', | |
51 | + api: mailLogPage, | |
52 | + columns, | |
53 | + formConfig: { | |
54 | + labelWidth: 120, | |
55 | + schemas: searchFormSchema, | |
56 | + fieldMapToTime: [['sendTime', ['startTime', 'endTime'], 'YYYY-MM-DD HH:mm:ss']], | |
57 | + }, | |
58 | + useSearchForm: true, | |
59 | + showTableSetting: true, | |
60 | + bordered: true, | |
61 | + showIndexColumn: false, | |
62 | + actionColumn: { | |
63 | + width: 140, | |
64 | + title: '操作', | |
65 | + dataIndex: 'action', | |
66 | + slots: { customRender: 'action' }, | |
67 | + fixed: undefined, | |
68 | + }, | |
69 | + immediate: true, | |
70 | + }); | |
72 | 71 | |
73 | - function handleCreate() { | |
74 | - } | |
72 | + function handleCreate() {} | |
75 | 73 | |
76 | - function handleModal(record: Recordable) { | |
77 | - openModal(true,{ | |
78 | - record, | |
79 | - }) | |
80 | - } | |
74 | + function handleModal(record: Recordable) { | |
75 | + openModal(true, { | |
76 | + record, | |
77 | + }); | |
78 | + } | |
81 | 79 | |
82 | - function handleDelete(record: Recordable) { | |
83 | - let ids = [record.id]; | |
84 | - deleteSmsLog(ids).then((result)=>{ | |
85 | - createMessage.success(result.message) | |
86 | - handleSuccess() | |
87 | - }); | |
88 | - } | |
80 | + function handleDelete(record: Recordable) { | |
81 | + let ids = [record.id]; | |
82 | + deleteSmsLog(ids).then((result) => { | |
83 | + createMessage.success(result.message); | |
84 | + handleSuccess(); | |
85 | + }); | |
86 | + } | |
89 | 87 | |
90 | - function handleSuccess() { | |
91 | - reload(); | |
92 | - } | |
88 | + function handleSuccess() { | |
89 | + reload(); | |
90 | + } | |
93 | 91 | |
94 | - return { | |
95 | - register, | |
96 | - registerTable, | |
97 | - registerModal, | |
98 | - handleCreate, | |
99 | - handleDelete, | |
100 | - handleModal, | |
101 | - handleSuccess | |
102 | - }; | |
103 | - }, | |
104 | -}); | |
92 | + return { | |
93 | + register, | |
94 | + registerTable, | |
95 | + registerModal, | |
96 | + handleCreate, | |
97 | + handleDelete, | |
98 | + handleModal, | |
99 | + handleSuccess, | |
100 | + }; | |
101 | + }, | |
102 | + }); | |
105 | 103 | </script> | ... | ... |
... | ... | @@ -8,12 +8,12 @@ |
8 | 8 | <TableAction |
9 | 9 | :actions="[ |
10 | 10 | { |
11 | - label:'查看', | |
11 | + label: '查看', | |
12 | 12 | icon: 'ant-design:fund-view-outlined', |
13 | 13 | onClick: handleQuery.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: { |
... | ... | @@ -28,76 +28,74 @@ |
28 | 28 | </div> |
29 | 29 | </template> |
30 | 30 | <script lang="ts"> |
31 | -import {defineComponent, h} from 'vue'; | |
31 | + import { defineComponent, h } from 'vue'; | |
32 | 32 | |
33 | -import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
34 | -import { BasicDrawer,useDrawerInner } from '/@/components/Drawer'; | |
35 | -import { columns, searchFormSchema } from './sms.data'; | |
36 | -import {Modal, Tag} from "ant-design-vue"; | |
37 | -import {useMessage} from "/@/hooks/web/useMessage"; | |
38 | -import {smsLogPage,deleteSmsLog} from "/@/api/message/records"; | |
39 | -import {JsonPreview} from "/@/components/CodeEditor"; | |
33 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
34 | + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | |
35 | + import { columns, searchFormSchema } from './sms.data'; | |
36 | + import { Modal, Tag } from 'ant-design-vue'; | |
37 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
38 | + import { smsLogPage, deleteSmsLog } from '/@/api/message/records'; | |
39 | + import { JsonPreview } from '/@/components/CodeEditor'; | |
40 | 40 | |
41 | -export default defineComponent({ | |
42 | - name: 'SmsLog', | |
43 | - components: {BasicDrawer, BasicTable, TableAction ,Tag}, | |
44 | - setup() { | |
45 | - const { createMessage } = useMessage(); | |
46 | - const [register] = useDrawerInner(() => { | |
47 | - }); | |
48 | - const [registerTable, { reload }] = useTable({ | |
49 | - title: '短信发送列表', | |
50 | - api: smsLogPage, | |
51 | - columns, | |
52 | - formConfig: { | |
53 | - labelWidth: 120, | |
54 | - schemas: searchFormSchema, | |
55 | - fieldMapToTime: [['sendTime', ['startTime', 'endTime'], 'YYYY-MM-DD HH:mm:ss']], | |
56 | - }, | |
57 | - useSearchForm: true, | |
58 | - showTableSetting: true, | |
59 | - bordered: true, | |
60 | - showIndexColumn: false, | |
61 | - actionColumn: { | |
62 | - width: 140, | |
63 | - title: '操作', | |
64 | - dataIndex: 'action', | |
65 | - slots: { customRender: 'action' }, | |
66 | - fixed: undefined, | |
67 | - }, | |
68 | - }); | |
41 | + export default defineComponent({ | |
42 | + name: 'SmsLog', | |
43 | + components: { BasicDrawer, BasicTable, TableAction, Tag }, | |
44 | + setup() { | |
45 | + const { createMessage } = useMessage(); | |
46 | + const [register] = useDrawerInner(() => {}); | |
47 | + const [registerTable, { reload }] = useTable({ | |
48 | + title: '短信发送列表', | |
49 | + api: smsLogPage, | |
50 | + columns, | |
51 | + formConfig: { | |
52 | + labelWidth: 120, | |
53 | + schemas: searchFormSchema, | |
54 | + fieldMapToTime: [['sendTime', ['startTime', 'endTime'], 'YYYY-MM-DD HH:mm:ss']], | |
55 | + }, | |
56 | + useSearchForm: true, | |
57 | + showTableSetting: true, | |
58 | + bordered: true, | |
59 | + showIndexColumn: false, | |
60 | + actionColumn: { | |
61 | + width: 140, | |
62 | + title: '操作', | |
63 | + dataIndex: 'action', | |
64 | + slots: { customRender: 'action' }, | |
65 | + fixed: undefined, | |
66 | + }, | |
67 | + }); | |
69 | 68 | |
70 | - function handleCreate() { | |
71 | - } | |
69 | + function handleCreate() {} | |
72 | 70 | |
73 | - function handleQuery(record: Recordable) { | |
74 | - Modal.info({ | |
75 | - title: '当前配置', | |
76 | - width:480, | |
77 | - content: h(JsonPreview, { data: JSON.parse(JSON.stringify(record.templateParam)) }), | |
78 | - }); | |
79 | - } | |
71 | + function handleQuery(record: Recordable) { | |
72 | + Modal.info({ | |
73 | + title: '当前配置', | |
74 | + width: 480, | |
75 | + content: h(JsonPreview, { data: JSON.parse(JSON.stringify(record.templateParam)) }), | |
76 | + }); | |
77 | + } | |
80 | 78 | |
81 | - function handleDelete(record: Recordable) { | |
82 | - let ids = [record.id]; | |
83 | - deleteSmsLog(ids).then((result)=>{ | |
84 | - createMessage.success(result.message) | |
85 | - handleSuccess() | |
86 | - }); | |
87 | - } | |
79 | + function handleDelete(record: Recordable) { | |
80 | + let ids = [record.id]; | |
81 | + deleteSmsLog(ids).then((result) => { | |
82 | + createMessage.success(result.message); | |
83 | + handleSuccess(); | |
84 | + }); | |
85 | + } | |
88 | 86 | |
89 | - function handleSuccess() { | |
90 | - reload(); | |
91 | - } | |
87 | + function handleSuccess() { | |
88 | + reload(); | |
89 | + } | |
92 | 90 | |
93 | - return { | |
94 | - register, | |
95 | - registerTable, | |
96 | - handleCreate, | |
97 | - handleDelete, | |
98 | - handleSuccess, | |
99 | - handleQuery | |
100 | - }; | |
101 | - }, | |
102 | -}); | |
91 | + return { | |
92 | + register, | |
93 | + registerTable, | |
94 | + handleCreate, | |
95 | + handleDelete, | |
96 | + handleSuccess, | |
97 | + handleQuery, | |
98 | + }; | |
99 | + }, | |
100 | + }); | |
103 | 101 | </script> | ... | ... |
1 | 1 | <template> |
2 | - <BasicModal v-bind="$attrs" @register="register" title="邮件发送参数" @ok="handleOK" | |
3 | - width="700px"> | |
2 | + <BasicModal | |
3 | + v-bind="$attrs" | |
4 | + @register="register" | |
5 | + title="邮件发送参数" | |
6 | + @ok="handleOK" | |
7 | + width="700px" | |
8 | + > | |
4 | 9 | <div class="pt-6px pr-6px"> |
5 | - <BasicForm @register="registerForm"/> | |
10 | + <BasicForm @register="registerForm" /> | |
6 | 11 | </div> |
7 | 12 | </BasicModal> |
8 | 13 | </template> |
9 | 14 | <script lang="ts"> |
10 | -import { defineComponent,h } from 'vue'; | |
11 | -import { BasicModal, useModalInner } from '/@/components/Modal'; | |
12 | -import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; | |
13 | -import {useMessage} from "/@/hooks/web/useMessage"; | |
14 | -import { Tinymce } from '/@/components/Tinymce'; | |
15 | -import {sendEmail} from "/@/api/message/template"; | |
16 | -const schemas: FormSchema[] = [ | |
17 | - { | |
18 | - field: 'id', | |
19 | - component: 'Input', | |
20 | - label: 'id', | |
21 | - show:false | |
22 | - }, | |
23 | - { | |
24 | - field: 'templatePurpose', | |
25 | - label: '用途', | |
26 | - component:'Input', | |
27 | - show:false, | |
28 | - }, | |
29 | - { | |
30 | - field: 'messageType', | |
31 | - component: 'Input', | |
32 | - label: 'messageType', | |
33 | - show:false | |
34 | - }, | |
35 | - { | |
36 | - field: 'subject', | |
37 | - component: 'Input', | |
38 | - label: '邮件主题', | |
39 | - required: true, | |
40 | - colProps: { | |
41 | - span: 12, | |
15 | + import { defineComponent, h } from 'vue'; | |
16 | + import { BasicModal, useModalInner } from '/@/components/Modal'; | |
17 | + import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; | |
18 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
19 | + import { Tinymce } from '/@/components/Tinymce'; | |
20 | + import { sendEmail } from '/@/api/message/template'; | |
21 | + const schemas: FormSchema[] = [ | |
22 | + { | |
23 | + field: 'id', | |
24 | + component: 'Input', | |
25 | + label: 'id', | |
26 | + show: false, | |
42 | 27 | }, |
43 | - }, | |
44 | - { | |
45 | - field: 'to', | |
46 | - component: 'Input', | |
47 | - label: '主送', | |
48 | - required: true, | |
49 | - colProps: { | |
50 | - span: 12, | |
28 | + { | |
29 | + field: 'templatePurpose', | |
30 | + label: '用途', | |
31 | + component: 'Input', | |
32 | + show: false, | |
51 | 33 | }, |
52 | - }, | |
53 | - { | |
54 | - field: 'cc', | |
55 | - component: 'Input', | |
56 | - label: '抄送', | |
57 | - colProps: { | |
58 | - span: 12, | |
34 | + { | |
35 | + field: 'messageType', | |
36 | + component: 'Input', | |
37 | + label: 'messageType', | |
38 | + show: false, | |
59 | 39 | }, |
60 | - }, | |
61 | - { | |
62 | - field: 'bcc', | |
63 | - component: 'Input', | |
64 | - label: '密送', | |
65 | - colProps: { | |
66 | - span: 12, | |
40 | + { | |
41 | + field: 'subject', | |
42 | + component: 'Input', | |
43 | + label: '邮件主题', | |
44 | + required: true, | |
45 | + colProps: { | |
46 | + span: 12, | |
47 | + }, | |
67 | 48 | }, |
68 | - }, | |
69 | - { | |
70 | - field: 'body', | |
71 | - component: 'Input', | |
72 | - label: '邮件内容', | |
73 | - rules: [{ required: true }], | |
74 | - render: ({ model, field }) => { | |
75 | - return h(Tinymce, { | |
76 | - value: model[field], | |
77 | - onChange: (value: string) => { | |
78 | - model[field] = value; | |
79 | - }, | |
80 | - }); | |
49 | + { | |
50 | + field: 'to', | |
51 | + component: 'Input', | |
52 | + label: '主送', | |
53 | + required: true, | |
54 | + colProps: { | |
55 | + span: 12, | |
56 | + }, | |
81 | 57 | }, |
82 | - }, | |
83 | -]; | |
84 | -export default defineComponent({ | |
85 | - components: { BasicModal, BasicForm}, | |
86 | - setup() { | |
87 | - const {createMessage} = useMessage(); | |
88 | - const [registerForm,{validate,resetFields,setFieldsValue},] = useForm({ | |
89 | - labelWidth: 70, | |
90 | - schemas, | |
91 | - showActionButtonGroup: false, | |
92 | - actionColOptions: { | |
93 | - span: 24, | |
58 | + { | |
59 | + field: 'cc', | |
60 | + component: 'Input', | |
61 | + label: '抄送', | |
62 | + colProps: { | |
63 | + span: 12, | |
94 | 64 | }, |
95 | - }); | |
96 | - const [register,{closeModal}] = useModalInner(async(data) => { | |
97 | - await resetFields(); | |
98 | - await setFieldsValue({ | |
99 | - ...data.record, | |
65 | + }, | |
66 | + { | |
67 | + field: 'bcc', | |
68 | + component: 'Input', | |
69 | + label: '密送', | |
70 | + colProps: { | |
71 | + span: 12, | |
72 | + }, | |
73 | + }, | |
74 | + { | |
75 | + field: 'body', | |
76 | + component: 'Input', | |
77 | + label: '邮件内容', | |
78 | + rules: [{ required: true }], | |
79 | + render: ({ model, field }) => { | |
80 | + return h(Tinymce, { | |
81 | + value: model[field], | |
82 | + onChange: (value: string) => { | |
83 | + model[field] = value; | |
84 | + }, | |
85 | + }); | |
86 | + }, | |
87 | + }, | |
88 | + ]; | |
89 | + export default defineComponent({ | |
90 | + components: { BasicModal, BasicForm }, | |
91 | + setup() { | |
92 | + const { createMessage } = useMessage(); | |
93 | + const [registerForm, { validate, resetFields, setFieldsValue }] = useForm({ | |
94 | + labelWidth: 70, | |
95 | + schemas, | |
96 | + showActionButtonGroup: false, | |
97 | + actionColOptions: { | |
98 | + span: 24, | |
99 | + }, | |
100 | + }); | |
101 | + const [register, { closeModal }] = useModalInner(async (data) => { | |
102 | + await resetFields(); | |
103 | + await setFieldsValue({ | |
104 | + ...data.record, | |
105 | + }); | |
100 | 106 | }); |
101 | - }); | |
102 | 107 | |
103 | - async function handleOK() { | |
104 | - const values = await validate(); | |
105 | - const to = Reflect.get(values,"to").split(","); | |
106 | - const cc = Reflect.get(values,"cc"); | |
107 | - const bcc = Reflect.get(values,"bcc"); | |
108 | - if(typeof (cc) != "undefined"){ | |
109 | - cc.split(","); | |
110 | - Reflect.set(values,"cc",cc) | |
111 | - } | |
112 | - if(typeof (bcc) != "undefined"){ | |
113 | - bcc.split(","); | |
114 | - Reflect.set(values,"bcc",bcc) | |
108 | + async function handleOK() { | |
109 | + const values = await validate(); | |
110 | + const to = Reflect.get(values, 'to').split(','); | |
111 | + const cc = Reflect.get(values, 'cc'); | |
112 | + const bcc = Reflect.get(values, 'bcc'); | |
113 | + if (typeof cc != 'undefined') { | |
114 | + cc.split(','); | |
115 | + Reflect.set(values, 'cc', cc); | |
116 | + } | |
117 | + if (typeof bcc != 'undefined') { | |
118 | + bcc.split(','); | |
119 | + Reflect.set(values, 'bcc', bcc); | |
120 | + } | |
121 | + Reflect.set(values, 'to', to); | |
122 | + Reflect.set(values, 'emailFormatEnum', 'HTML'); | |
123 | + await sendEmail(values); | |
124 | + console.log(values, 'values'); | |
125 | + closeModal(); | |
126 | + createMessage.success('发送成功'); | |
115 | 127 | } |
116 | - Reflect.set(values,"to",to) | |
117 | - Reflect.set(values,"emailFormatEnum","HTML") | |
118 | - await sendEmail(values); | |
119 | - console.log(values,"values") | |
120 | - closeModal(); | |
121 | - createMessage.success("发送成功") | |
122 | - } | |
123 | 128 | |
124 | - return { register, schemas, registerForm, handleOK }; | |
125 | - }, | |
126 | -}); | |
129 | + return { register, schemas, registerForm, handleOK }; | |
130 | + }, | |
131 | + }); | |
127 | 132 | </script> | ... | ... |
1 | 1 | <template> |
2 | - <BasicModal | |
3 | - v-bind="$attrs" | |
4 | - @register="register" | |
5 | - title="发送参数" | |
6 | - @ok="handleOK" | |
7 | - > | |
2 | + <BasicModal v-bind="$attrs" @register="register" title="发送参数" @ok="handleOK"> | |
8 | 3 | <div class="pt-4px pr-4px"> |
9 | - <BasicForm @register="registerForm"/> | |
4 | + <BasicForm @register="registerForm" /> | |
10 | 5 | </div> |
11 | 6 | </BasicModal> |
12 | 7 | </template> |
13 | 8 | <script lang="ts"> |
14 | -import { defineComponent } from 'vue'; | |
15 | -import { BasicModal, useModalInner } from '/@/components/Modal'; | |
16 | -import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; | |
17 | -import {sendSms} from "/@/api/message/template"; | |
18 | -import {useMessage} from "/@/hooks/web/useMessage"; | |
19 | -const schemas: FormSchema[] = [ | |
20 | - { | |
21 | - field: 'id', | |
22 | - component: 'Input', | |
23 | - label: 'id', | |
24 | - show:false | |
25 | - }, | |
26 | - { | |
27 | - field: 'templatePurpose', | |
28 | - label: '用途', | |
29 | - component:'Input', | |
30 | - show:false, | |
31 | - }, | |
32 | - { | |
33 | - field: 'messageType', | |
34 | - component: 'Input', | |
35 | - label: 'messageType', | |
36 | - show:false | |
37 | - }, | |
38 | - { | |
39 | - field: 'phoneNumbers', | |
40 | - component: 'Input', | |
41 | - label: '手机号码', | |
42 | - required: true, | |
43 | - }, | |
44 | - { | |
45 | - field: 'params', | |
46 | - component: 'InputTextArea', | |
47 | - label: '短信参数', | |
48 | - required: true, | |
49 | - componentProps:{ | |
50 | - placeholder: '示例:{"code":"3654"}', | |
51 | - } | |
52 | - }, | |
53 | - { | |
54 | - field: 'remark', | |
55 | - component: 'InputTextArea', | |
56 | - label: '备注', | |
57 | - }, | |
58 | -]; | |
59 | -export default defineComponent({ | |
60 | - components: { BasicModal, BasicForm}, | |
61 | - setup() { | |
62 | - const {createMessage} = useMessage(); | |
63 | - const [registerForm,{validate,resetFields,setFieldsValue},] = useForm({ | |
64 | - labelWidth: 70, | |
65 | - schemas, | |
66 | - showActionButtonGroup: false, | |
67 | - actionColOptions: { | |
68 | - span: 24, | |
9 | + import { defineComponent } from 'vue'; | |
10 | + import { BasicModal, useModalInner } from '/@/components/Modal'; | |
11 | + import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; | |
12 | + import { sendSms } from '/@/api/message/template'; | |
13 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
14 | + const schemas: FormSchema[] = [ | |
15 | + { | |
16 | + field: 'id', | |
17 | + component: 'Input', | |
18 | + label: 'id', | |
19 | + show: false, | |
20 | + }, | |
21 | + { | |
22 | + field: 'templatePurpose', | |
23 | + label: '用途', | |
24 | + component: 'Input', | |
25 | + show: false, | |
26 | + }, | |
27 | + { | |
28 | + field: 'messageType', | |
29 | + component: 'Input', | |
30 | + label: 'messageType', | |
31 | + show: false, | |
32 | + }, | |
33 | + { | |
34 | + field: 'phoneNumbers', | |
35 | + component: 'Input', | |
36 | + label: '手机号码', | |
37 | + required: true, | |
38 | + }, | |
39 | + { | |
40 | + field: 'params', | |
41 | + component: 'InputTextArea', | |
42 | + label: '短信参数', | |
43 | + required: true, | |
44 | + componentProps: { | |
45 | + placeholder: '示例:{"code":"3654"}', | |
69 | 46 | }, |
70 | - }); | |
71 | - const [register,{closeModal}] = useModalInner(async(data) => { | |
72 | - await resetFields(); | |
73 | - await setFieldsValue({ | |
74 | - ...data.record, | |
47 | + }, | |
48 | + { | |
49 | + field: 'remark', | |
50 | + component: 'InputTextArea', | |
51 | + label: '备注', | |
52 | + }, | |
53 | + ]; | |
54 | + export default defineComponent({ | |
55 | + components: { BasicModal, BasicForm }, | |
56 | + setup() { | |
57 | + const { createMessage } = useMessage(); | |
58 | + const [registerForm, { validate, resetFields, setFieldsValue }] = useForm({ | |
59 | + labelWidth: 70, | |
60 | + schemas, | |
61 | + showActionButtonGroup: false, | |
62 | + actionColOptions: { | |
63 | + span: 24, | |
64 | + }, | |
65 | + }); | |
66 | + const [register, { closeModal }] = useModalInner(async (data) => { | |
67 | + await resetFields(); | |
68 | + await setFieldsValue({ | |
69 | + ...data.record, | |
70 | + }); | |
75 | 71 | }); |
76 | - }); | |
77 | 72 | |
78 | - async function handleOK() { | |
79 | - const values = await validate(); | |
80 | - //将字符串转为json | |
81 | - const smsParams = JSON.parse(Reflect.get(values,'params')) | |
82 | - Reflect.set(values, 'params', smsParams); | |
83 | - await sendSms(values) | |
84 | - closeModal(); | |
85 | - createMessage.success("发送成功") | |
86 | - } | |
73 | + async function handleOK() { | |
74 | + const values = await validate(); | |
75 | + //将字符串转为json | |
76 | + const smsParams = JSON.parse(Reflect.get(values, 'params')); | |
77 | + Reflect.set(values, 'params', smsParams); | |
78 | + await sendSms(values); | |
79 | + closeModal(); | |
80 | + createMessage.success('发送成功'); | |
81 | + } | |
87 | 82 | |
88 | - return {register, schemas, registerForm, handleOK }; | |
89 | - }, | |
90 | -}); | |
83 | + return { register, schemas, registerForm, handleOK }; | |
84 | + }, | |
85 | + }); | |
91 | 86 | </script> | ... | ... |
... | ... | @@ -4,11 +4,11 @@ |
4 | 4 | @register="registerDrawer" |
5 | 5 | showFooter |
6 | 6 | :title="getTitle" |
7 | - :helpMessage="['用户登录、忘记密码模板平台只提供{code}参数','初始密码设置平台提供{name}参数']" | |
7 | + :helpMessage="['用户登录、忘记密码模板平台只提供{code}参数', '初始密码设置平台提供{name}参数']" | |
8 | 8 | width="500px" |
9 | 9 | @ok="handleSubmit" |
10 | 10 | > |
11 | - <BasicForm @register="registerForm"/> | |
11 | + <BasicForm @register="registerForm" /> | |
12 | 12 | </BasicDrawer> |
13 | 13 | </template> |
14 | 14 | <script lang="ts"> |
... | ... | @@ -16,15 +16,15 @@ |
16 | 16 | import { BasicForm, useForm } from '/@/components/Form'; |
17 | 17 | import { formSchema } from './template.data'; |
18 | 18 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
19 | - import {saveOrEditMessageTemplate} from "/@/api/message/template"; | |
20 | - import {useMessage} from "/@/hooks/web/useMessage"; | |
19 | + import { saveOrEditMessageTemplate } from '/@/api/message/template'; | |
20 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
21 | 21 | export default defineComponent({ |
22 | 22 | name: 'TemplateDrawer', |
23 | 23 | components: { BasicDrawer, BasicForm }, |
24 | 24 | emits: ['success', 'register'], |
25 | 25 | setup(_, { emit }) { |
26 | 26 | const isUpdate = ref(true); |
27 | - const [registerForm, { validate,setFieldsValue,resetFields }] = useForm({ | |
27 | + const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ | |
28 | 28 | labelWidth: 120, |
29 | 29 | schemas: formSchema, |
30 | 30 | showActionButtonGroup: false, |
... | ... | @@ -36,8 +36,8 @@ |
36 | 36 | isUpdate.value = !!data?.isUpdate; |
37 | 37 | if (unref(isUpdate)) { |
38 | 38 | const config = data.record.config; |
39 | - for (const key in config){ | |
40 | - Reflect.set(data.record, key+'', config[key]); | |
39 | + for (const key in config) { | |
40 | + Reflect.set(data.record, key + '', config[key]); | |
41 | 41 | } |
42 | 42 | await setFieldsValue({ |
43 | 43 | ...data.record, |
... | ... | @@ -52,27 +52,27 @@ |
52 | 52 | const values = await validate(); |
53 | 53 | const { createMessage } = useMessage(); |
54 | 54 | setDrawerProps({ confirmLoading: true }); |
55 | - let config={}; | |
56 | - if(values.messageType === 'PHONE_MESSAGE'){ | |
57 | - config ={ | |
58 | - "accessKeyId":values.accessKeyId, | |
59 | - "accessKeySecret":values.accessKeySecret, | |
60 | - } | |
61 | - }else if(values.messageType === 'EMAIL_MESSAGE'){ | |
62 | - config ={ | |
63 | - "host":values.host, | |
64 | - "port":values.port, | |
65 | - "username":values.username, | |
66 | - "password":values.password, | |
67 | - } | |
55 | + let config = {}; | |
56 | + if (values.messageType === 'PHONE_MESSAGE') { | |
57 | + config = { | |
58 | + accessKeyId: values.accessKeyId, | |
59 | + accessKeySecret: values.accessKeySecret, | |
60 | + }; | |
61 | + } else if (values.messageType === 'EMAIL_MESSAGE') { | |
62 | + config = { | |
63 | + host: values.host, | |
64 | + port: values.port, | |
65 | + username: values.username, | |
66 | + password: values.password, | |
67 | + }; | |
68 | 68 | } |
69 | 69 | Reflect.set(values, 'config', config); |
70 | - let saveMessage = "添加成功"; | |
71 | - let updateMessage = "修改成功"; | |
72 | - await saveOrEditMessageTemplate(values,unref(isUpdate)); | |
70 | + let saveMessage = '添加成功'; | |
71 | + let updateMessage = '修改成功'; | |
72 | + await saveOrEditMessageTemplate(values, unref(isUpdate)); | |
73 | 73 | closeDrawer(); |
74 | 74 | emit('success'); |
75 | - createMessage.success(unref(isUpdate)?updateMessage:saveMessage); | |
75 | + createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | |
76 | 76 | } finally { |
77 | 77 | setDrawerProps({ confirmLoading: false }); |
78 | 78 | } | ... | ... |
... | ... | @@ -4,24 +4,26 @@ |
4 | 4 | <template #toolbar> |
5 | 5 | <a-button type="primary" @click="handleCreate"> 新增模板 </a-button> |
6 | 6 | </template> |
7 | - <template #config="{record}"> | |
8 | - <a-button type="link" class="ml-2" @click="goConfig"> {{record.messageConfig.configName}} </a-button> | |
7 | + <template #config="{ record }"> | |
8 | + <a-button type="link" class="ml-2" @click="goConfig"> | |
9 | + {{ record.messageConfig.configName }} | |
10 | + </a-button> | |
9 | 11 | </template> |
10 | 12 | <template #action="{ record }"> |
11 | 13 | <TableAction |
12 | 14 | :actions="[ |
13 | 15 | { |
14 | - label:'发送', | |
16 | + label: '发送', | |
15 | 17 | icon: 'ant-design:send-outlined', |
16 | 18 | onClick: handleModal.bind(null, record), |
17 | 19 | }, |
18 | 20 | { |
19 | - label:'编辑', | |
21 | + label: '编辑', | |
20 | 22 | icon: 'clarity:note-edit-line', |
21 | 23 | onClick: handleEdit.bind(null, record), |
22 | 24 | }, |
23 | 25 | { |
24 | - label:'删除', | |
26 | + label: '删除', | |
25 | 27 | icon: 'ant-design:delete-outlined', |
26 | 28 | color: 'error', |
27 | 29 | popConfirm: { |
... | ... | @@ -33,119 +35,119 @@ |
33 | 35 | /> |
34 | 36 | </template> |
35 | 37 | </BasicTable> |
36 | - <SendSms @register="registerModal"/> | |
37 | - <SendEmail @register="registerMailModal"/> | |
38 | + <SendSms @register="registerModal" /> | |
39 | + <SendEmail @register="registerMailModal" /> | |
38 | 40 | <TemplateDrawer @register="registerDrawer" @success="handleSuccess" /> |
39 | 41 | </div> |
40 | 42 | </template> |
41 | 43 | <script lang="ts"> |
42 | -import {defineComponent} from 'vue'; | |
44 | + import { defineComponent } from 'vue'; | |
43 | 45 | |
44 | -import {BasicTable, TableAction, useTable} from '/@/components/Table'; | |
45 | -import {useDrawer} from '/@/components/Drawer'; | |
46 | -import TemplateDrawer from './TemplateDrawer.vue'; | |
47 | -import {columns, searchFormSchema} from './template.data'; | |
48 | -import {CodeEditor} from '/@/components/CodeEditor'; | |
49 | -import {useMessage} from "/@/hooks/web/useMessage"; | |
50 | -import {deleteMessageTemplate, messageTemplatePage} from "/@/api/message/template"; | |
51 | -import {Tag} from "ant-design-vue"; | |
52 | -import {useGo} from '/@/hooks/web/usePage'; | |
53 | -import {PageEnum} from "/@/enums/pageEnum"; | |
54 | -import { useModal } from '/@/components/Modal'; | |
55 | -import SendSms from "/@/views/message/template/SendSms.vue"; | |
56 | -import {MessageEnum} from "/@/enums/messageEnum"; | |
57 | -import SendEmail from "/@/views/message/template/SendEmail.vue"; | |
46 | + import { BasicTable, TableAction, useTable } from '/@/components/Table'; | |
47 | + import { useDrawer } from '/@/components/Drawer'; | |
48 | + import TemplateDrawer from './TemplateDrawer.vue'; | |
49 | + import { columns, searchFormSchema } from './template.data'; | |
50 | + import { CodeEditor } from '/@/components/CodeEditor'; | |
51 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
52 | + import { deleteMessageTemplate, messageTemplatePage } from '/@/api/message/template'; | |
53 | + import { Tag } from 'ant-design-vue'; | |
54 | + import { useGo } from '/@/hooks/web/usePage'; | |
55 | + import { PageEnum } from '/@/enums/pageEnum'; | |
56 | + import { useModal } from '/@/components/Modal'; | |
57 | + import SendSms from '/@/views/message/template/SendSms.vue'; | |
58 | + import { MessageEnum } from '/@/enums/messageEnum'; | |
59 | + import SendEmail from '/@/views/message/template/SendEmail.vue'; | |
58 | 60 | |
59 | -export default defineComponent({ | |
60 | - name: 'MessageTemplateManagement', | |
61 | - components: {SendSms,SendEmail, BasicTable, TemplateDrawer, TableAction ,CodeEditor,Tag}, | |
62 | - setup() { | |
63 | - const [registerModal, { openModal:openModal }] = useModal(); | |
64 | - const [registerMailModal, { openModal:openMailModal }] = useModal(); | |
65 | - const go = useGo(); | |
66 | - const [registerDrawer, { openDrawer }] = useDrawer(); | |
67 | - const {createMessage} = useMessage(); | |
68 | - const [registerTable, { reload }] = useTable({ | |
69 | - title: '消息模板列表', | |
70 | - api: messageTemplatePage, | |
71 | - columns, | |
72 | - formConfig: { | |
73 | - labelWidth: 120, | |
74 | - schemas: searchFormSchema, | |
75 | - }, | |
76 | - useSearchForm: true, | |
77 | - showTableSetting: true, | |
78 | - bordered: true, | |
79 | - showIndexColumn: false, | |
80 | - actionColumn: { | |
81 | - width: 180, | |
82 | - title: '操作', | |
83 | - dataIndex: 'action', | |
84 | - slots: { customRender: 'action' }, | |
85 | - fixed: undefined, | |
86 | - }, | |
87 | - }); | |
88 | - | |
89 | - function handleCreate() { | |
90 | - openDrawer(true, { | |
91 | - isUpdate: false, | |
92 | - }); | |
93 | - } | |
94 | - | |
95 | - function handleEdit(record: Recordable) { | |
96 | - openDrawer(true, { | |
97 | - record, | |
98 | - isUpdate: true, | |
61 | + export default defineComponent({ | |
62 | + name: 'MessageTemplateManagement', | |
63 | + components: { SendSms, SendEmail, BasicTable, TemplateDrawer, TableAction, CodeEditor, Tag }, | |
64 | + setup() { | |
65 | + const [registerModal, { openModal: openModal }] = useModal(); | |
66 | + const [registerMailModal, { openModal: openMailModal }] = useModal(); | |
67 | + const go = useGo(); | |
68 | + const [registerDrawer, { openDrawer }] = useDrawer(); | |
69 | + const { createMessage } = useMessage(); | |
70 | + const [registerTable, { reload }] = useTable({ | |
71 | + title: '消息模板列表', | |
72 | + api: messageTemplatePage, | |
73 | + columns, | |
74 | + formConfig: { | |
75 | + labelWidth: 120, | |
76 | + schemas: searchFormSchema, | |
77 | + }, | |
78 | + useSearchForm: true, | |
79 | + showTableSetting: true, | |
80 | + bordered: true, | |
81 | + showIndexColumn: false, | |
82 | + actionColumn: { | |
83 | + width: 180, | |
84 | + title: '操作', | |
85 | + dataIndex: 'action', | |
86 | + slots: { customRender: 'action' }, | |
87 | + fixed: undefined, | |
88 | + }, | |
99 | 89 | }); |
100 | - } | |
101 | 90 | |
102 | - function handleModal(record: Recordable){ | |
103 | - let openSms = false; | |
104 | - let openEmail = false; | |
105 | - const messageType = Reflect.get(record,"messageType"); | |
106 | - if(messageType===MessageEnum.IS_SMS){ | |
107 | - openSms = true; | |
108 | - }else if(messageType===MessageEnum.IS_EMAIL){ | |
109 | - openEmail = true; | |
91 | + function handleCreate() { | |
92 | + openDrawer(true, { | |
93 | + isUpdate: false, | |
94 | + }); | |
110 | 95 | } |
111 | - if(openSms){ | |
112 | - openModal(openSms,{ | |
96 | + | |
97 | + function handleEdit(record: Recordable) { | |
98 | + openDrawer(true, { | |
113 | 99 | record, |
114 | - }) | |
100 | + isUpdate: true, | |
101 | + }); | |
115 | 102 | } |
116 | - if(openEmail){ | |
117 | - openMailModal(openEmail,{ | |
118 | - record, | |
119 | - }) | |
103 | + | |
104 | + function handleModal(record: Recordable) { | |
105 | + let openSms = false; | |
106 | + let openEmail = false; | |
107 | + const messageType = Reflect.get(record, 'messageType'); | |
108 | + if (messageType === MessageEnum.IS_SMS) { | |
109 | + openSms = true; | |
110 | + } else if (messageType === MessageEnum.IS_EMAIL) { | |
111 | + openEmail = true; | |
112 | + } | |
113 | + if (openSms) { | |
114 | + openModal(openSms, { | |
115 | + record, | |
116 | + }); | |
117 | + } | |
118 | + if (openEmail) { | |
119 | + openMailModal(openEmail, { | |
120 | + record, | |
121 | + }); | |
122 | + } | |
120 | 123 | } |
121 | - } | |
122 | 124 | |
123 | - function handleDelete(record: Recordable) { | |
124 | - let ids = [record.id]; | |
125 | - deleteMessageTemplate(ids).then((result)=>{ | |
126 | - createMessage.success(result.message) | |
127 | - handleSuccess() | |
128 | - }); | |
129 | - } | |
125 | + function handleDelete(record: Recordable) { | |
126 | + let ids = [record.id]; | |
127 | + deleteMessageTemplate(ids).then((result) => { | |
128 | + createMessage.success(result.message); | |
129 | + handleSuccess(); | |
130 | + }); | |
131 | + } | |
130 | 132 | |
131 | - function handleSuccess() { | |
132 | - reload(); | |
133 | - } | |
134 | - function goConfig(){ | |
135 | - go(PageEnum.MESSAGE_CONFIG) | |
136 | - } | |
137 | - return { | |
138 | - registerTable, | |
139 | - registerDrawer, | |
140 | - registerModal, | |
141 | - registerMailModal, | |
142 | - handleCreate, | |
143 | - handleEdit, | |
144 | - handleDelete, | |
145 | - handleSuccess, | |
146 | - handleModal, | |
147 | - goConfig, | |
148 | - }; | |
149 | - }, | |
150 | -}); | |
133 | + function handleSuccess() { | |
134 | + reload(); | |
135 | + } | |
136 | + function goConfig() { | |
137 | + go(PageEnum.MESSAGE_CONFIG); | |
138 | + } | |
139 | + return { | |
140 | + registerTable, | |
141 | + registerDrawer, | |
142 | + registerModal, | |
143 | + registerMailModal, | |
144 | + handleCreate, | |
145 | + handleEdit, | |
146 | + handleDelete, | |
147 | + handleSuccess, | |
148 | + handleModal, | |
149 | + goConfig, | |
150 | + }; | |
151 | + }, | |
152 | + }); | |
151 | 153 | </script> | ... | ... |
... | ... | @@ -16,11 +16,7 @@ |
16 | 16 | <div class="hidden min-h-full pl-4 mr-4 xl:flex xl:flex-col xl:w-6/12"> |
17 | 17 | <AppLogo class="-enter-x" /> |
18 | 18 | <div class="my-auto"> |
19 | - <img | |
20 | - :alt="title" | |
21 | - src="../../../assets/images/iot.png" | |
22 | - class="w-4/5 -mt-16 -enter-x" | |
23 | - /> | |
19 | + <img :alt="title" src="../../../assets/images/iot.png" class="w-4/5 -mt-16 -enter-x" /> | |
24 | 20 | <div class="mt-10 font-medium text-white -enter-x"> |
25 | 21 | <span class="inline-block mt-4 text-3xl"> {{ t('sys.login.signInTitle') }}</span> |
26 | 22 | </div> | ... | ... |
... | ... | @@ -25,8 +25,6 @@ |
25 | 25 | /> |
26 | 26 | </FormItem> |
27 | 27 | |
28 | - | |
29 | - | |
30 | 28 | <FormItem class="enter-x"> |
31 | 29 | <Button type="primary" size="large" block @click="handleLogin" :loading="loading"> |
32 | 30 | {{ t('sys.login.loginButton') }} |
... | ... | @@ -44,10 +42,9 @@ |
44 | 42 | </Button> |
45 | 43 | </ACol> |
46 | 44 | </ARow> |
47 | - <ARow class="enter-x"> | |
45 | + <ARow class="enter-x"> | |
48 | 46 | <ACol :span="12"> |
49 | - <FormItem> | |
50 | - </FormItem> | |
47 | + <FormItem> </FormItem> | |
51 | 48 | </ACol> |
52 | 49 | <ACol :span="12"> |
53 | 50 | <FormItem :style="{ 'text-align': 'right' }"> |
... | ... | @@ -123,9 +120,12 @@ |
123 | 120 | } catch (error) { |
124 | 121 | createErrorModal({ |
125 | 122 | title: t('sys.api.loginFailed'), |
126 | - content: (error.response && error.response.status == 401)? | |
127 | - t('sys.api.passwordOrUserNameError') | |
128 | - :(error.code == 'ECONNABORTED'?t('sys.api.timeoutMessage'):t('sys.api.apiRequestFailed')), | |
123 | + content: | |
124 | + error.response && error.response.status == 401 | |
125 | + ? t('sys.api.passwordOrUserNameError') | |
126 | + : error.code == 'ECONNABORTED' | |
127 | + ? t('sys.api.timeoutMessage') | |
128 | + : t('sys.api.apiRequestFailed'), | |
129 | 129 | getContainer: () => document.body.querySelector(`.${prefixCls}`) || document.body, |
130 | 130 | }); |
131 | 131 | } finally { | ... | ... |
... | ... | @@ -32,15 +32,15 @@ |
32 | 32 | </template> |
33 | 33 | </template> |
34 | 34 | <script lang="ts" setup> |
35 | -import {reactive, ref, computed, unref, toRaw} from 'vue'; | |
36 | - import { Form, Input, Button,message } from 'ant-design-vue'; | |
35 | + import { reactive, ref, computed, unref, toRaw } from 'vue'; | |
36 | + import { Form, Input, Button, message } from 'ant-design-vue'; | |
37 | 37 | import { CountdownInput } from '/@/components/CountDown'; |
38 | 38 | import LoginFormTitle from './LoginFormTitle.vue'; |
39 | 39 | import { useI18n } from '/@/hooks/web/useI18n'; |
40 | 40 | import { useLoginState, useFormRules, useFormValid, LoginStateEnum } from './useLogin'; |
41 | - import {SendLoginSmsCode, smsCodeLoginApi} from "/@/api/sys/user"; | |
42 | - import {useUserStore} from "/@/store/modules/user"; | |
43 | - import {useMessage} from "/@/hooks/web/useMessage"; | |
41 | + import { SendLoginSmsCode, smsCodeLoginApi } from '/@/api/sys/user'; | |
42 | + import { useUserStore } from '/@/store/modules/user'; | |
43 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
44 | 44 | const { notification, createErrorModal } = useMessage(); |
45 | 45 | |
46 | 46 | const FormItem = Form.Item; |
... | ... | @@ -57,18 +57,18 @@ import {reactive, ref, computed, unref, toRaw} from 'vue'; |
57 | 57 | }); |
58 | 58 | |
59 | 59 | async function sendLoginSms() { |
60 | - const reg = /^[1](([3][0-9])|([4][0,1,4-9])|([5][0-3,5-9])|([6][2,5,6,7])|([7][0-8])|([8][0-9])|([9][0-3,5-9]))[0-9]{8}$/; | |
61 | - if(reg.test(formData.phoneNumber)){ | |
62 | - const sendRes = await SendLoginSmsCode(formData.phoneNumber); | |
63 | - if(!sendRes){ | |
64 | - message.error('发送失败'); | |
65 | - return false; | |
66 | - } | |
60 | + const reg = | |
61 | + /^[1](([3][0-9])|([4][0,1,4-9])|([5][0-3,5-9])|([6][2,5,6,7])|([7][0-8])|([8][0-9])|([9][0-3,5-9]))[0-9]{8}$/; | |
62 | + if (reg.test(formData.phoneNumber)) { | |
63 | + const sendRes = await SendLoginSmsCode(formData.phoneNumber); | |
64 | + if (!sendRes) { | |
65 | + message.error('发送失败'); | |
66 | + return false; | |
67 | + } | |
67 | 68 | return true; |
68 | - }else{ | |
69 | + } else { | |
69 | 70 | message.error('请输入正确手机号码'); |
70 | 71 | } |
71 | - | |
72 | 72 | } |
73 | 73 | |
74 | 74 | const { validForm } = useFormValid(formRef); | ... | ... |
1 | 1 | <template> |
2 | - <PageWrapper | |
3 | - :title="`用户资料`" | |
4 | - contentBackground | |
5 | - @back="goBack" | |
6 | - > | |
7 | - <Description | |
8 | - size="middle" | |
9 | - @register="register" | |
10 | - /> | |
2 | + <PageWrapper :title="`用户资料`" contentBackground @back="goBack"> | |
3 | + <Description size="middle" @register="register" /> | |
11 | 4 | </PageWrapper> |
12 | 5 | </template> |
13 | 6 | |
... | ... | @@ -16,48 +9,52 @@ |
16 | 9 | import { useRoute } from 'vue-router'; |
17 | 10 | import { PageWrapper } from '/@/components/Page'; |
18 | 11 | import { useGo } from '/@/hooks/web/usePage'; |
19 | - import {Description} from "../../../components/Description"; | |
12 | + import { Description } from '../../../components/Description'; | |
20 | 13 | import { useTabs } from '/@/hooks/web/useTabs'; |
21 | 14 | import { Tabs } from 'ant-design-vue'; |
22 | - import {getAccountInfo} from "../../../api/system/system"; | |
23 | - import {accountSchema} from "./account.detail.data"; | |
24 | - import {useDescription} from "../../../components/Description"; | |
15 | + import { getAccountInfo } from '../../../api/system/system'; | |
16 | + import { accountSchema } from './account.detail.data'; | |
17 | + import { useDescription } from '../../../components/Description'; | |
25 | 18 | const accountData = {}; |
26 | 19 | export default defineComponent({ |
27 | 20 | name: 'AccountDetail', |
28 | - components: { PageWrapper, ATabs: Tabs, ATabPane: Tabs.TabPane,Description }, | |
21 | + components: { PageWrapper, ATabs: Tabs, ATabPane: Tabs.TabPane, Description }, | |
29 | 22 | setup() { |
30 | 23 | const route = useRoute(); |
31 | 24 | const go = useGo(); |
32 | 25 | const { setTitle } = useTabs(); |
33 | - const [register,methods] = useDescription({ | |
34 | - title:"账号基础信息", | |
35 | - data:accountData, | |
36 | - bordered:false, | |
37 | - schema:accountSchema, | |
38 | - column:3 | |
39 | - }) | |
40 | - getAccountInfo(route.params?.id).then((result)=>{ | |
41 | - Reflect.set(accountData,"realName",result.realName); | |
42 | - Reflect.set(accountData,"phoneNumber",result.phoneNumber); | |
43 | - Reflect.set(accountData,"email",result.email); | |
44 | - Reflect.set(accountData,"username",result.username); | |
45 | - Reflect.set(accountData,"enabled",result.enabled?"正常":!result.enabled?"禁用":"已过期"); | |
46 | - Reflect.set(accountData,"accountExpireTime",result.accountExpireTime); | |
47 | - Reflect.set(accountData,"createTime",result.createTime); | |
48 | - Reflect.set(accountData,"updateTime",result.updateTime); | |
49 | - Reflect.set(accountData,"deptId",result.deptId); | |
50 | - console.log(accountData,"accountData") | |
26 | + const [register, methods] = useDescription({ | |
27 | + title: '账号基础信息', | |
28 | + data: accountData, | |
29 | + bordered: false, | |
30 | + schema: accountSchema, | |
31 | + column: 3, | |
32 | + }); | |
33 | + getAccountInfo(route.params?.id).then((result) => { | |
34 | + Reflect.set(accountData, 'realName', result.realName); | |
35 | + Reflect.set(accountData, 'phoneNumber', result.phoneNumber); | |
36 | + Reflect.set(accountData, 'email', result.email); | |
37 | + Reflect.set(accountData, 'username', result.username); | |
38 | + Reflect.set( | |
39 | + accountData, | |
40 | + 'enabled', | |
41 | + result.enabled ? '正常' : !result.enabled ? '禁用' : '已过期' | |
42 | + ); | |
43 | + Reflect.set(accountData, 'accountExpireTime', result.accountExpireTime); | |
44 | + Reflect.set(accountData, 'createTime', result.createTime); | |
45 | + Reflect.set(accountData, 'updateTime', result.updateTime); | |
46 | + Reflect.set(accountData, 'deptId', result.deptId); | |
47 | + console.log(accountData, 'accountData'); | |
51 | 48 | // 设置Tab的标题(不会影响页面标题) |
52 | 49 | setTitle('详情:用户' + result.realName); |
53 | - methods.setDescProps(accountData) | |
50 | + methods.setDescProps(accountData); | |
54 | 51 | }); |
55 | 52 | // 页面左侧点击返回链接时的操作 |
56 | 53 | function goBack() { |
57 | 54 | // 本例的效果时点击返回始终跳转到账号列表页,实际应用时可返回上一页 |
58 | 55 | go('/system/account'); |
59 | 56 | } |
60 | - return {goBack,accountSchema,accountData,register }; | |
57 | + return { goBack, accountSchema, accountData, register }; | |
61 | 58 | }, |
62 | 59 | }); |
63 | 60 | </script> | ... | ... |
1 | 1 | <template> |
2 | - <BasicModal width="650px" v-bind="$attrs" @register="registerModal" :title="getTitle" | |
3 | - @ok="handleSubmit"> | |
2 | + <BasicModal | |
3 | + width="650px" | |
4 | + v-bind="$attrs" | |
5 | + @register="registerModal" | |
6 | + :title="getTitle" | |
7 | + @ok="handleSubmit" | |
8 | + > | |
4 | 9 | <BasicForm @register="registerForm"> |
5 | 10 | <template #groupId="{ model, field }"> |
6 | 11 | <BasicTree |
... | ... | @@ -17,100 +22,101 @@ |
17 | 22 | </BasicModal> |
18 | 23 | </template> |
19 | 24 | <script lang="ts"> |
20 | -import {defineComponent, ref, computed, unref} from 'vue'; | |
21 | -import {BasicModal, useModalInner} from '/@/components/Modal'; | |
22 | -import {BasicForm, useForm} from '/@/components/Form/index'; | |
23 | -import {accountFormSchema} from './account.data'; | |
24 | -import {findCurrentUserRelation, getDeptList, SaveOrUpdateUserInfo} from '/@/api/system/system'; | |
25 | -import {BasicTree, TreeItem} from "/@/components/Tree"; | |
26 | -import {findCurrentUserGroups} from "/@/api/system/group"; | |
27 | -import {RoleOrGroupParam} from "/@/api/system/model/systemModel"; | |
28 | -import {useMessage} from "/@/hooks/web/useMessage"; | |
29 | -export default defineComponent({ | |
30 | - name: 'AccountModal', | |
31 | - components: {BasicModal, BasicForm, BasicTree}, | |
32 | - emits: ['success', 'register'], | |
33 | - setup(_, {emit}) { | |
34 | - const isUpdate = ref(true); | |
35 | - const rowId = ref(''); | |
36 | - const groupTreeData = ref<TreeItem[]>([]); | |
37 | - const checkGroup = ref<string[]>([]); | |
38 | - const [registerForm, {setFieldsValue, updateSchema, resetFields, validate}] = useForm({ | |
39 | - labelWidth: 100, | |
40 | - schemas: accountFormSchema, | |
41 | - showActionButtonGroup: false, | |
42 | - actionColOptions: { | |
43 | - span: 18, | |
44 | - }, | |
45 | - }); | |
25 | + import { defineComponent, ref, computed, unref } from 'vue'; | |
26 | + import { BasicModal, useModalInner } from '/@/components/Modal'; | |
27 | + import { BasicForm, useForm } from '/@/components/Form/index'; | |
28 | + import { accountFormSchema } from './account.data'; | |
29 | + import { findCurrentUserRelation, getDeptList, SaveOrUpdateUserInfo } from '/@/api/system/system'; | |
30 | + import { BasicTree, TreeItem } from '/@/components/Tree'; | |
31 | + import { findCurrentUserGroups } from '/@/api/system/group'; | |
32 | + import { RoleOrGroupParam } from '/@/api/system/model/systemModel'; | |
33 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
34 | + export default defineComponent({ | |
35 | + name: 'AccountModal', | |
36 | + components: { BasicModal, BasicForm, BasicTree }, | |
37 | + emits: ['success', 'register'], | |
38 | + setup(_, { emit }) { | |
39 | + const isUpdate = ref(true); | |
40 | + const rowId = ref(''); | |
41 | + const groupTreeData = ref<TreeItem[]>([]); | |
42 | + const checkGroup = ref<string[]>([]); | |
43 | + const [registerForm, { setFieldsValue, updateSchema, resetFields, validate }] = useForm({ | |
44 | + labelWidth: 100, | |
45 | + schemas: accountFormSchema, | |
46 | + showActionButtonGroup: false, | |
47 | + actionColOptions: { | |
48 | + span: 18, | |
49 | + }, | |
50 | + }); | |
46 | 51 | |
47 | - const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |
48 | - await resetFields(); | |
49 | - setModalProps({confirmLoading: false}); | |
50 | - isUpdate.value = !!data?.isUpdate; | |
51 | - const groupListModel = await findCurrentUserGroups(); | |
52 | - if (unref(groupTreeData).length === 0) { | |
53 | - let treeValues = new Array<TreeItem>(); | |
54 | - groupListModel.map((item) => { | |
55 | - const groupData = { | |
56 | - name: item.name, | |
57 | - key: item.id, | |
58 | - id: item.id, | |
59 | - children: item.children as any as TreeItem[], | |
60 | - } | |
61 | - treeValues.push(groupData); | |
62 | - }) | |
63 | - groupTreeData.value = treeValues; | |
64 | - } | |
52 | + const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { | |
53 | + await resetFields(); | |
54 | + setModalProps({ confirmLoading: false }); | |
55 | + isUpdate.value = !!data?.isUpdate; | |
56 | + const groupListModel = await findCurrentUserGroups(); | |
57 | + if (unref(groupTreeData).length === 0) { | |
58 | + let treeValues = new Array<TreeItem>(); | |
59 | + groupListModel.map((item) => { | |
60 | + const groupData = { | |
61 | + name: item.name, | |
62 | + key: item.id, | |
63 | + id: item.id, | |
64 | + children: item.children as any as TreeItem[], | |
65 | + }; | |
66 | + treeValues.push(groupData); | |
67 | + }); | |
68 | + groupTreeData.value = treeValues; | |
69 | + } | |
65 | 70 | |
66 | - if (unref(isUpdate)) { | |
67 | - rowId.value = data.record.id; | |
68 | - const roleParams = new RoleOrGroupParam(rowId.value,true,false); | |
69 | - findCurrentUserRelation(roleParams).then((result)=>{ | |
70 | - Reflect.set(data.record,"roleIds",result); | |
71 | - Reflect.set(data.record,"password","******"); | |
72 | - setFieldsValue({ | |
73 | - ...data.record, | |
71 | + if (unref(isUpdate)) { | |
72 | + rowId.value = data.record.id; | |
73 | + const roleParams = new RoleOrGroupParam(rowId.value, true, false); | |
74 | + findCurrentUserRelation(roleParams).then((result) => { | |
75 | + Reflect.set(data.record, 'roleIds', result); | |
76 | + Reflect.set(data.record, 'password', '******'); | |
77 | + setFieldsValue({ | |
78 | + ...data.record, | |
79 | + }); | |
74 | 80 | }); |
75 | - }) | |
76 | - const groupParams = new RoleOrGroupParam(rowId.value,false,true); | |
77 | - checkGroup.value = await findCurrentUserRelation(groupParams); | |
78 | - } | |
79 | - const deptData = await getDeptList(); | |
80 | - await updateSchema([ | |
81 | - { | |
82 | - field: 'username', | |
83 | - dynamicDisabled: unref(isUpdate), | |
84 | - }, | |
85 | - { | |
86 | - field: 'deptId', | |
87 | - componentProps: { | |
88 | - treeData: deptData | |
81 | + const groupParams = new RoleOrGroupParam(rowId.value, false, true); | |
82 | + checkGroup.value = await findCurrentUserRelation(groupParams); | |
83 | + } | |
84 | + const deptData = await getDeptList(); | |
85 | + await updateSchema([ | |
86 | + { | |
87 | + field: 'username', | |
88 | + dynamicDisabled: unref(isUpdate), | |
89 | 89 | }, |
90 | - }, | |
91 | - ]); | |
92 | - }); | |
90 | + { | |
91 | + field: 'deptId', | |
92 | + componentProps: { | |
93 | + treeData: deptData, | |
94 | + }, | |
95 | + }, | |
96 | + ]); | |
97 | + }); | |
93 | 98 | |
94 | - const getTitle = computed(() => (!unref(isUpdate) ? '新增账号' : '编辑账号')); | |
99 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增账号' : '编辑账号')); | |
95 | 100 | |
96 | - async function handleSubmit() { | |
97 | - try { | |
98 | - const { createMessage } = useMessage(); | |
99 | - const values = await validate(); | |
100 | - values.accountExpireTime = (typeof values.accountExpireTime != 'undefined' && | |
101 | - values.accountExpireTime != null) ? | |
102 | - values.accountExpireTime.format('YYYY-MM-DD HH:mm:ss') : null | |
103 | - setModalProps({confirmLoading: true}); | |
104 | - await SaveOrUpdateUserInfo(values, unref(isUpdate)); | |
105 | - closeModal(); | |
106 | - emit('success', {isUpdate: unref(isUpdate), values: {...values, id: rowId.value}}); | |
107 | - createMessage.success(unref(isUpdate)?"编辑成功":"新增成功"); | |
108 | - } finally { | |
109 | - setModalProps({confirmLoading: false}); | |
101 | + async function handleSubmit() { | |
102 | + try { | |
103 | + const { createMessage } = useMessage(); | |
104 | + const values = await validate(); | |
105 | + values.accountExpireTime = | |
106 | + typeof values.accountExpireTime != 'undefined' && values.accountExpireTime != null | |
107 | + ? values.accountExpireTime.format('YYYY-MM-DD HH:mm:ss') | |
108 | + : null; | |
109 | + setModalProps({ confirmLoading: true }); | |
110 | + await SaveOrUpdateUserInfo(values, unref(isUpdate)); | |
111 | + closeModal(); | |
112 | + emit('success', { isUpdate: unref(isUpdate), values: { ...values, id: rowId.value } }); | |
113 | + createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功'); | |
114 | + } finally { | |
115 | + setModalProps({ confirmLoading: false }); | |
116 | + } | |
110 | 117 | } |
111 | - } | |
112 | 118 | |
113 | - return {registerModal, registerForm, getTitle, handleSubmit, groupTreeData,checkGroup}; | |
114 | - }, | |
115 | -}); | |
119 | + return { registerModal, registerForm, getTitle, handleSubmit, groupTreeData, checkGroup }; | |
120 | + }, | |
121 | + }); | |
116 | 122 | </script> | ... | ... |
... | ... | @@ -7,32 +7,42 @@ |
7 | 7 | </template> |
8 | 8 | <template #status="{ record }"> |
9 | 9 | <Tag |
10 | - :color="record.userStatusEnum==='NORMAL'?'green':(record.userStatusEnum==='DISABLED'?'red':'orange')"> | |
10 | + :color=" | |
11 | + record.userStatusEnum === 'NORMAL' | |
12 | + ? 'green' | |
13 | + : record.userStatusEnum === 'DISABLED' | |
14 | + ? 'red' | |
15 | + : 'orange' | |
16 | + " | |
17 | + > | |
11 | 18 | {{ |
12 | - record.userStatusEnum === 'NORMAL' ? '正常' : (record.userStatusEnum === 'DISABLED' ? '已禁用' : '已过期') | |
19 | + record.userStatusEnum === 'NORMAL' | |
20 | + ? '正常' | |
21 | + : record.userStatusEnum === 'DISABLED' | |
22 | + ? '已禁用' | |
23 | + : '已过期' | |
13 | 24 | }} |
14 | 25 | </Tag> |
15 | 26 | </template> |
16 | 27 | <template #action="{ record }"> |
17 | 28 | <TableAction |
18 | - :actions=" | |
19 | -[ | |
29 | + :actions="[ | |
20 | 30 | { |
21 | - label:'用户详情', | |
31 | + label: '用户详情', | |
22 | 32 | icon: 'clarity:info-standard-line', |
23 | 33 | tooltip: '用户详情', |
24 | 34 | onClick: handleView.bind(null, record), |
25 | 35 | ifShow: record.level != 0, |
26 | 36 | }, |
27 | 37 | { |
28 | - label:'编辑', | |
38 | + label: '编辑', | |
29 | 39 | icon: 'clarity:note-edit-line', |
30 | 40 | tooltip: '编辑', |
31 | 41 | onClick: handleEdit.bind(null, record), |
32 | 42 | ifShow: record.level != 0, |
33 | 43 | }, |
34 | 44 | { |
35 | - label:'删除', | |
45 | + label: '删除', | |
36 | 46 | icon: 'ant-design:delete-outlined', |
37 | 47 | color: 'error', |
38 | 48 | tooltip: '删除', |
... | ... | @@ -52,26 +62,26 @@ |
52 | 62 | <script lang="ts"> |
53 | 63 | import { defineComponent, reactive } from 'vue'; |
54 | 64 | |
55 | - import {TenantCodeEnum} from '/@/enums/codeEnum'; | |
65 | + import { TenantCodeEnum } from '/@/enums/codeEnum'; | |
56 | 66 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
57 | - import {deleteUser, getAccountList} from '/@/api/system/system'; | |
67 | + import { deleteUser, getAccountList } from '/@/api/system/system'; | |
58 | 68 | import { PageWrapper } from '/@/components/Page'; |
59 | 69 | import DeptTree from './DeptTree.vue'; |
60 | - import {Tag} from "ant-design-vue"; | |
70 | + import { Tag } from 'ant-design-vue'; | |
61 | 71 | import { useModal } from '/@/components/Modal'; |
62 | 72 | import AccountModal from './AccountModal.vue'; |
63 | 73 | |
64 | 74 | import { columns, searchFormSchema } from './account.data'; |
65 | 75 | import { useGo } from '/@/hooks/web/usePage'; |
66 | - import {useMessage} from "/@/hooks/web/useMessage"; | |
76 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
67 | 77 | |
68 | 78 | export default defineComponent({ |
69 | 79 | name: 'AccountManagement', |
70 | - components: { BasicTable, PageWrapper, DeptTree, AccountModal, TableAction,Tag }, | |
80 | + components: { BasicTable, PageWrapper, DeptTree, AccountModal, TableAction, Tag }, | |
71 | 81 | setup() { |
72 | 82 | const go = useGo(); |
73 | 83 | const [registerModal, { openModal }] = useModal(); |
74 | - const {createMessage} = useMessage(); | |
84 | + const { createMessage } = useMessage(); | |
75 | 85 | const searchInfo = reactive<Recordable>({}); |
76 | 86 | const [registerTable, { reload, updateTableDataRecord }] = useTable({ |
77 | 87 | title: '账号列表', |
... | ... | @@ -113,10 +123,10 @@ |
113 | 123 | |
114 | 124 | function handleDelete(record: Recordable) { |
115 | 125 | let ids = [record.id]; |
116 | - deleteUser(ids).then(()=>{ | |
117 | - createMessage.success("删除成功") | |
126 | + deleteUser(ids).then(() => { | |
127 | + createMessage.success('删除成功'); | |
118 | 128 | reload(); |
119 | - }) | |
129 | + }); | |
120 | 130 | } |
121 | 131 | |
122 | 132 | function handleSuccess({ isUpdate, values }) { |
... | ... | @@ -148,7 +158,7 @@ |
148 | 158 | handleSelect, |
149 | 159 | handleView, |
150 | 160 | searchInfo, |
151 | - TenantCodeEnum | |
161 | + TenantCodeEnum, | |
152 | 162 | }; |
153 | 163 | }, |
154 | 164 | }); | ... | ... |