Commit 86368a4a47b0ed93775a6e6ddf020279b2a53d4d
Merge branch 'main' into 'ft-dev'
# Conflicts: # .env.development # src/views/device/config.data.ts # src/views/device/index.vue # src/views/system/role/RoleDrawer.vue
Showing
125 changed files
with
4429 additions
and
2932 deletions
@@ -6,9 +6,7 @@ VITE_PUBLIC_PATH = / | @@ -6,9 +6,7 @@ VITE_PUBLIC_PATH = / | ||
6 | 6 | ||
7 | # Cross-domain proxy, you can configure multiple | 7 | # Cross-domain proxy, you can configure multiple |
8 | # Please note that no line breaks | 8 | # Please note that no line breaks |
9 | -# If Use Online Mock,Address Is ["https://www.fastmock.site/mock/87187f474cb8128e88a517a04d77d80c/api"] | ||
10 | -VITE_PROXY = [["/api","http://192.168.10.116:8082/api"],["/upload","http://localhost:3300/upload"]] | ||
11 | -# VITE_PROXY = [["/api","https://www.fastmock.site/mock/87187f474cb8128e88a517a04d77d80c/api]",["/upload","http://localhost:3300/upload"]] | 9 | +VITE_PROXY = [["/api","http://192.168.10.120:8082/api"],["/upload","http://192.168.10.120:3300/upload"]] |
12 | # VITE_PROXY=[["/api","https://vvbin.cn/test"]] | 10 | # VITE_PROXY=[["/api","https://vvbin.cn/test"]] |
13 | 11 | ||
14 | # Delete console | 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; |
@@ -8,7 +8,6 @@ | @@ -8,7 +8,6 @@ | ||
8 | name="viewport" | 8 | name="viewport" |
9 | content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" | 9 | content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" |
10 | /> | 10 | /> |
11 | - | ||
12 | <title><%= title %></title> | 11 | <title><%= title %></title> |
13 | <link rel="icon" href="/favicon.ico" /> | 12 | <link rel="icon" href="/favicon.ico" /> |
14 | </head> | 13 | </head> |
@@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
21 | "clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite", | 21 | "clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite", |
22 | "clean:lib": "rimraf node_modules", | 22 | "clean:lib": "rimraf node_modules", |
23 | "lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix", | 23 | "lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix", |
24 | - "lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"", | 24 | + "lint:prettier": "prettier --write \"src/**/*.{js,json,ts,tsx,css,less,scss,vue,html,md}\"", |
25 | "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", | 25 | "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", |
26 | "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js", | 26 | "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js", |
27 | "lint:pretty": "pretty-quick --staged", | 27 | "lint:pretty": "pretty-quick --staged", |
@@ -59,6 +59,7 @@ | @@ -59,6 +59,7 @@ | ||
59 | "tinymce": "^5.8.2", | 59 | "tinymce": "^5.8.2", |
60 | "vditor": "^3.8.6", | 60 | "vditor": "^3.8.6", |
61 | "vue": "3.2.2", | 61 | "vue": "3.2.2", |
62 | + "vue-baidu-map": "^0.21.22", | ||
62 | "vue-i18n": "9.1.7", | 63 | "vue-i18n": "9.1.7", |
63 | "vue-json-pretty": "^2.0.4", | 64 | "vue-json-pretty": "^2.0.4", |
64 | "vue-router": "^4.0.11", | 65 | "vue-router": "^4.0.11", |
src/api/alarm/contact/alarmContact.ts
0 → 100644
1 | +import { defHttp } from '/@/utils/http/axios'; | ||
2 | +import type { | ||
3 | + ContactPageParams, | ||
4 | + ContactModal, | ||
5 | + ContactParams, | ||
6 | + ContactInfo, | ||
7 | +} from './model/alarmContactModal'; | ||
8 | +import { getPageData } from '../../base'; | ||
9 | +enum Api { | ||
10 | + alarmContact = '/alarmContact', | ||
11 | + updateAlarmContact = '/alarmContact/update', | ||
12 | +} | ||
13 | + | ||
14 | +// 获取 | ||
15 | +export const getAlarmContact = (params: ContactPageParams) => { | ||
16 | + return getPageData<ContactModal>(params, Api.alarmContact); | ||
17 | +}; | ||
18 | + | ||
19 | +// 新增 | ||
20 | +export const addAlarmContact = (params: ContactParams) => { | ||
21 | + return defHttp.post({ | ||
22 | + url: Api.alarmContact, | ||
23 | + data: params, | ||
24 | + }); | ||
25 | +}; | ||
26 | + | ||
27 | +// 更新 | ||
28 | +export const updateAlarmContact = (params: ContactParams) => { | ||
29 | + return defHttp.post({ | ||
30 | + url: Api.updateAlarmContact, | ||
31 | + data: params, | ||
32 | + }); | ||
33 | +}; | ||
34 | + | ||
35 | +// 删除 | ||
36 | +export const deleteAlarmContact = (ids: string[]) => { | ||
37 | + return defHttp.delete({ | ||
38 | + url: Api.alarmContact, | ||
39 | + data: ids, | ||
40 | + }); | ||
41 | +}; | ||
42 | + | ||
43 | +// 新增或者编辑 | ||
44 | +export const saveOrEditAlarmContact = (params: ContactInfo, isUpdate: boolean) => { | ||
45 | + if (isUpdate) return updateAlarmContact(params); | ||
46 | + addAlarmContact(params); | ||
47 | +}; |
1 | +import { BasicPageParams } from '/@/api/model/baseModel'; | ||
2 | + | ||
3 | +interface ContactItemsModal { | ||
4 | + id: string; | ||
5 | + createTime: string; | ||
6 | + enabled: boolean; | ||
7 | + username: string; | ||
8 | + department: string; | ||
9 | + phone: string; | ||
10 | +} | ||
11 | +export type ContactPageParams = BasicPageParams & { username: string; organizationId: string }; | ||
12 | + | ||
13 | +export interface ContactModal { | ||
14 | + items: ContactItemsModal[]; | ||
15 | + total: number; | ||
16 | +} | ||
17 | + | ||
18 | +export interface ContactParams { | ||
19 | + phone: string; | ||
20 | + username: string; | ||
21 | + department?: string; | ||
22 | + email?: string; | ||
23 | + wechat?: string; | ||
24 | + addPeople?: string; | ||
25 | + remark?: string; | ||
26 | +} | ||
27 | + | ||
28 | +export type ContactInfo = ContactParams; |
1 | -import {defHttp} from '/@/utils/http/axios'; | 1 | +import { defHttp } from '/@/utils/http/axios'; |
2 | 2 | ||
3 | export interface PageData<T> { | 3 | export interface PageData<T> { |
4 | total: number; | 4 | total: number; |
@@ -14,7 +14,7 @@ export interface BaseQueryParams { | @@ -14,7 +14,7 @@ export interface BaseQueryParams { | ||
14 | pageSize: number; | 14 | pageSize: number; |
15 | page: number; | 15 | page: number; |
16 | orderFiled?: string; | 16 | orderFiled?: string; |
17 | - orderType?: OrderType | 17 | + orderType?: OrderType; |
18 | } | 18 | } |
19 | 19 | ||
20 | export class BaseQueryRequest implements BaseQueryParams { | 20 | export class BaseQueryRequest implements BaseQueryParams { |
@@ -23,7 +23,7 @@ export class BaseQueryRequest implements BaseQueryParams { | @@ -23,7 +23,7 @@ export class BaseQueryRequest implements BaseQueryParams { | ||
23 | page: number; | 23 | page: number; |
24 | pageSize: number; | 24 | pageSize: number; |
25 | 25 | ||
26 | - constructor(page: number = 1, pageSize: number = 10) { | 26 | + constructor(page = 1, pageSize = 10) { |
27 | this.page = page; | 27 | this.page = page; |
28 | this.pageSize = pageSize; | 28 | this.pageSize = pageSize; |
29 | } | 29 | } |
@@ -41,16 +41,13 @@ export class BaseQueryRequest implements BaseQueryParams { | @@ -41,16 +41,13 @@ export class BaseQueryRequest implements BaseQueryParams { | ||
41 | } | 41 | } |
42 | 42 | ||
43 | setPageSize(pageSize: number) { | 43 | setPageSize(pageSize: number) { |
44 | - this.pageSize = pageSize | 44 | + this.pageSize = pageSize; |
45 | } | 45 | } |
46 | - | ||
47 | } | 46 | } |
48 | 47 | ||
49 | export function getPageData<T>(params: BaseQueryParams, url: string): Promise<PageData<T>> { | 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 | import { | 2 | import { |
3 | DeviceModel, | 3 | DeviceModel, |
4 | DeviceProfileModel, | 4 | DeviceProfileModel, |
5 | DeviceProfileQueryParam, | 5 | DeviceProfileQueryParam, |
6 | - DeviceQueryParam | ||
7 | -} from "/@/api/device/model/deviceModel"; | 6 | + DeviceQueryParam, |
7 | +} from '/@/api/device/model/deviceModel'; | ||
8 | 8 | ||
9 | enum DeviceManagerApi { | 9 | enum DeviceManagerApi { |
10 | /** | 10 | /** |
11 | * 设备URL | 11 | * 设备URL |
12 | */ | 12 | */ |
13 | - DEVICE_URL = "/device", | 13 | + DEVICE_URL = '/device', |
14 | /** | 14 | /** |
15 | * 设备配置URL | 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 | return defHttp.get<DeviceModel>({ | 21 | return defHttp.get<DeviceModel>({ |
22 | url: DeviceManagerApi.DEVICE_URL, | 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,9 +31,9 @@ export const devicePage = (params: DeviceQueryParam) =>{ | ||
31 | export const deviceProfilePage = (params: DeviceProfileQueryParam) => { | 31 | export const deviceProfilePage = (params: DeviceProfileQueryParam) => { |
32 | return defHttp.get<DeviceProfileModel>({ | 32 | return defHttp.get<DeviceProfileModel>({ |
33 | url: DeviceManagerApi.DEVICE_PROFILE_URL, | 33 | url: DeviceManagerApi.DEVICE_PROFILE_URL, |
34 | - params | 34 | + params, |
35 | }); | 35 | }); |
36 | -} | 36 | +}; |
37 | /** | 37 | /** |
38 | * 删除设备配置 | 38 | * 删除设备配置 |
39 | * @param ids 删除的ids | 39 | * @param ids 删除的ids |
@@ -41,11 +41,11 @@ export const deviceProfilePage = (params: DeviceProfileQueryParam) => { | @@ -41,11 +41,11 @@ export const deviceProfilePage = (params: DeviceProfileQueryParam) => { | ||
41 | export const deleteDeviceProfile = (ids: string[]) => { | 41 | export const deleteDeviceProfile = (ids: string[]) => { |
42 | return defHttp.delete({ | 42 | return defHttp.delete({ |
43 | url: DeviceManagerApi.DEVICE_PROFILE_URL, | 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,8 +54,8 @@ export const deleteDeviceProfile = (ids: string[]) => { | ||
54 | export const deleteDevice = (ids: string[]) => { | 54 | export const deleteDevice = (ids: string[]) => { |
55 | return defHttp.delete({ | 55 | return defHttp.delete({ |
56 | url: DeviceManagerApi.DEVICE_URL, | 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 | export enum DeviceState { | 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 | export type DeviceParam = { | 14 | export type DeviceParam = { |
15 | - name?:string, | ||
16 | - deviceProfileId?:string | ||
17 | -} | 15 | + name?: string; |
16 | + deviceProfileId?: string; | ||
17 | +}; | ||
18 | export type DeviceProfileParam = { | 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 | import { defHttp } from '/@/utils/http/axios'; | 1 | import { defHttp } from '/@/utils/http/axios'; |
2 | import { | 2 | import { |
3 | MessageConfig, | 3 | MessageConfig, |
4 | - MessageConfigParams, MessageConfigResult, | 4 | + MessageConfigParams, |
5 | + MessageConfigResult, | ||
5 | MessageConfigResultModel, | 6 | MessageConfigResultModel, |
6 | - MessageParams | 7 | + MessageParams, |
7 | } from './model/configModel'; | 8 | } from './model/configModel'; |
8 | 9 | ||
9 | - | ||
10 | enum MessageConfigApi { | 10 | enum MessageConfigApi { |
11 | CONFIG_URL = '/message', | 11 | CONFIG_URL = '/message', |
12 | } | 12 | } |
@@ -14,13 +14,13 @@ enum MessageConfigApi { | @@ -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 | return defHttp.post<MessageConfigResult>({ | 19 | return defHttp.post<MessageConfigResult>({ |
20 | - url: MessageConfigApi.CONFIG_URL + "/find", | 20 | + url: MessageConfigApi.CONFIG_URL + '/find', |
21 | params, | 21 | params, |
22 | - }) | ||
23 | -} | 22 | + }); |
23 | +}; | ||
24 | 24 | ||
25 | /** | 25 | /** |
26 | * @description: 获取MessageConfig分页数据 | 26 | * @description: 获取MessageConfig分页数据 |
@@ -41,14 +41,14 @@ export const saveOrEditMessageConfig = (params: MessageConfig, isUpdate: boolean | @@ -41,14 +41,14 @@ export const saveOrEditMessageConfig = (params: MessageConfig, isUpdate: boolean | ||
41 | return defHttp.put<MessageConfigResultModel>({ | 41 | return defHttp.put<MessageConfigResultModel>({ |
42 | url: MessageConfigApi.CONFIG_URL, | 42 | url: MessageConfigApi.CONFIG_URL, |
43 | params, | 43 | params, |
44 | - }) | 44 | + }); |
45 | } else { | 45 | } else { |
46 | return defHttp.post<MessageConfigResultModel>({ | 46 | return defHttp.post<MessageConfigResultModel>({ |
47 | url: MessageConfigApi.CONFIG_URL, | 47 | url: MessageConfigApi.CONFIG_URL, |
48 | params, | 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,15 +56,15 @@ export const saveOrEditMessageConfig = (params: MessageConfig, isUpdate: boolean | ||
56 | * @param messageType 消息类型 | 56 | * @param messageType 消息类型 |
57 | * @param status 状态 | 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 | defHttp.put<MessageConfigResultModel>({ | 60 | defHttp.put<MessageConfigResultModel>({ |
61 | url: MessageConfigApi.CONFIG_URL, | 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 | * 删除MessageConfig | 69 | * 删除MessageConfig |
70 | * @param ids 删除id数组 | 70 | * @param ids 删除id数组 |
@@ -73,6 +73,6 @@ export const deleteMessageConfig = (ids: string[]) => | @@ -73,6 +73,6 @@ export const deleteMessageConfig = (ids: string[]) => | ||
73 | defHttp.delete({ | 73 | defHttp.delete({ |
74 | url: MessageConfigApi.CONFIG_URL, | 74 | url: MessageConfigApi.CONFIG_URL, |
75 | data: { | 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 | * @description: Request list interface parameters | 3 | * @description: Request list interface parameters |
7 | */ | 4 | */ |
8 | export type MessageConfigParams = BasicPageParams & MessageParams; | 5 | export type MessageConfigParams = BasicPageParams & MessageParams; |
9 | 6 | ||
10 | export type MessageParams = { | 7 | export type MessageParams = { |
11 | - status?:number; | ||
12 | - messageType?:string; | ||
13 | -} | 8 | + status?: number; |
9 | + messageType?: string; | ||
10 | +}; | ||
14 | 11 | ||
15 | export interface MessageConfig { | 12 | export interface MessageConfig { |
16 | id: string; | 13 | id: string; |
17 | - configName:string; | 14 | + configName: string; |
18 | messageType: string; | 15 | messageType: string; |
19 | platformType: string; | 16 | platformType: string; |
20 | config: ConfigParams; | 17 | config: ConfigParams; |
@@ -22,13 +19,13 @@ export interface MessageConfig { | @@ -22,13 +19,13 @@ export interface MessageConfig { | ||
22 | updateTime: string; | 19 | updateTime: string; |
23 | status: number; | 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 | export type MessageRecordsParams = BasicPageParams; | 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 | * @description: Request list interface parameters | 4 | * @description: Request list interface parameters |
@@ -15,23 +12,23 @@ export interface MessageTemplate { | @@ -15,23 +12,23 @@ export interface MessageTemplate { | ||
15 | } | 12 | } |
16 | 13 | ||
17 | export type SmsParams = { | 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 | export type EmailParams = { | 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 | export interface MessageResult { | 30 | export interface MessageResult { |
34 | - result:boolean | 31 | + result: boolean; |
35 | } | 32 | } |
36 | 33 | ||
37 | /** | 34 | /** |
1 | -import {defHttp} from '/@/utils/http/axios'; | 1 | +import { defHttp } from '/@/utils/http/axios'; |
2 | import { | 2 | import { |
3 | MailLogModelResult, | 3 | MailLogModelResult, |
4 | MessageRecordsParams, | 4 | MessageRecordsParams, |
5 | - SmsLogModelResult | ||
6 | -} from "/@/api/message/model/recordsModel"; | 5 | + SmsLogModelResult, |
6 | +} from '/@/api/message/model/recordsModel'; | ||
7 | 7 | ||
8 | enum MessageRecordsApi { | 8 | enum MessageRecordsApi { |
9 | - SMS_RECORDS = "/smsLog", | ||
10 | - EMAIL_RECORDS = "/mailLog" | 9 | + SMS_RECORDS = '/smsLog', |
10 | + EMAIL_RECORDS = '/mailLog', | ||
11 | } | 11 | } |
12 | 12 | ||
13 | /** | 13 | /** |
@@ -17,30 +17,30 @@ enum MessageRecordsApi { | @@ -17,30 +17,30 @@ enum MessageRecordsApi { | ||
17 | export const smsLogPage = (params: MessageRecordsParams) => { | 17 | export const smsLogPage = (params: MessageRecordsParams) => { |
18 | return defHttp.get<SmsLogModelResult>({ | 18 | return defHttp.get<SmsLogModelResult>({ |
19 | url: MessageRecordsApi.SMS_RECORDS, | 19 | url: MessageRecordsApi.SMS_RECORDS, |
20 | - params | ||
21 | - }) | ||
22 | -} | 20 | + params, |
21 | + }); | ||
22 | +}; | ||
23 | 23 | ||
24 | /** | 24 | /** |
25 | * 获取邮件发送记录【分页】 | 25 | * 获取邮件发送记录【分页】 |
26 | * @param params 查询参数 | 26 | * @param params 查询参数 |
27 | */ | 27 | */ |
28 | -export const mailLogPage=(params:MessageRecordsParams)=>{ | 28 | +export const mailLogPage = (params: MessageRecordsParams) => { |
29 | return defHttp.get<MailLogModelResult>({ | 29 | return defHttp.get<MailLogModelResult>({ |
30 | url: MessageRecordsApi.EMAIL_RECORDS, | 30 | url: MessageRecordsApi.EMAIL_RECORDS, |
31 | - params | ||
32 | - }) | ||
33 | -} | 31 | + params, |
32 | + }); | ||
33 | +}; | ||
34 | 34 | ||
35 | /** | 35 | /** |
36 | * 删除邮件记录 | 36 | * 删除邮件记录 |
37 | * @param ids 邮件记录ID | 37 | * @param ids 邮件记录ID |
38 | */ | 38 | */ |
39 | -export const deleteMailLog =(ids: string[]) => | 39 | +export const deleteMailLog = (ids: string[]) => |
40 | defHttp.delete({ | 40 | defHttp.delete({ |
41 | url: MessageRecordsApi.EMAIL_RECORDS, | 41 | url: MessageRecordsApi.EMAIL_RECORDS, |
42 | data: { | 42 | data: { |
43 | - ids: ids | 43 | + ids: ids, |
44 | }, | 44 | }, |
45 | }); | 45 | }); |
46 | /** | 46 | /** |
@@ -51,6 +51,6 @@ export const deleteSmsLog = (ids: string[]) => | @@ -51,6 +51,6 @@ export const deleteSmsLog = (ids: string[]) => | ||
51 | defHttp.delete({ | 51 | defHttp.delete({ |
52 | url: MessageRecordsApi.SMS_RECORDS, | 52 | url: MessageRecordsApi.SMS_RECORDS, |
53 | data: { | 53 | data: { |
54 | - ids: ids | 54 | + ids: ids, |
55 | }, | 55 | }, |
56 | }); | 56 | }); |
1 | import { defHttp } from '/@/utils/http/axios'; | 1 | import { defHttp } from '/@/utils/http/axios'; |
2 | import { | 2 | import { |
3 | - EmailParams, MessageResultModel, | 3 | + EmailParams, |
4 | + MessageResultModel, | ||
4 | MessageTemplate, | 5 | MessageTemplate, |
5 | MessageTemplateParams, | 6 | MessageTemplateParams, |
6 | - MessageTemplateResultModel, SmsParams | ||
7 | -} from "/@/api/message/model/templateModel"; | ||
8 | -import {MessageConfigResultModel} from "/@/api/message/model/configModel"; | 7 | + MessageTemplateResultModel, |
8 | + SmsParams, | ||
9 | +} from '/@/api/message/model/templateModel'; | ||
10 | +import { MessageConfigResultModel } from '/@/api/message/model/configModel'; | ||
9 | 11 | ||
10 | enum MessageTemplateApi { | 12 | enum MessageTemplateApi { |
11 | TEMPLATE_URL = '/template', | 13 | TEMPLATE_URL = '/template', |
@@ -15,19 +17,19 @@ enum MessageTemplateApi { | @@ -15,19 +17,19 @@ enum MessageTemplateApi { | ||
15 | * 短信发送 | 17 | * 短信发送 |
16 | * @param params 发送参数 | 18 | * @param params 发送参数 |
17 | */ | 19 | */ |
18 | -export const sendSms=(params: SmsParams)=>{ | 20 | +export const sendSms = (params: SmsParams) => { |
19 | return defHttp.post<MessageResultModel>({ | 21 | return defHttp.post<MessageResultModel>({ |
20 | - url: MessageTemplateApi.TEMPLATE_URL+"/sendSms", | 22 | + url: MessageTemplateApi.TEMPLATE_URL + '/sendSms', |
21 | params, | 23 | params, |
22 | - }) | ||
23 | -} | 24 | + }); |
25 | +}; | ||
24 | 26 | ||
25 | -export const sendEmail=(params:EmailParams)=>{ | 27 | +export const sendEmail = (params: EmailParams) => { |
26 | return defHttp.post<MessageResultModel>({ | 28 | return defHttp.post<MessageResultModel>({ |
27 | - url: MessageTemplateApi.TEMPLATE_URL+"/sendEmail", | 29 | + url: MessageTemplateApi.TEMPLATE_URL + '/sendEmail', |
28 | params, | 30 | params, |
29 | - }) | ||
30 | -} | 31 | + }); |
32 | +}; | ||
31 | 33 | ||
32 | export const messageTemplatePage = (params: MessageTemplateParams) => | 34 | export const messageTemplatePage = (params: MessageTemplateParams) => |
33 | defHttp.get<MessageTemplateResultModel>({ | 35 | defHttp.get<MessageTemplateResultModel>({ |
@@ -35,7 +37,6 @@ export const messageTemplatePage = (params: MessageTemplateParams) => | @@ -35,7 +37,6 @@ export const messageTemplatePage = (params: MessageTemplateParams) => | ||
35 | params, | 37 | params, |
36 | }); | 38 | }); |
37 | 39 | ||
38 | - | ||
39 | /** | 40 | /** |
40 | * 更新或保存MessageTemplate配置 | 41 | * 更新或保存MessageTemplate配置 |
41 | * @param params 参数 | 42 | * @param params 参数 |
@@ -46,14 +47,14 @@ export const saveOrEditMessageTemplate = (params: MessageTemplate, isUpdate: boo | @@ -46,14 +47,14 @@ export const saveOrEditMessageTemplate = (params: MessageTemplate, isUpdate: boo | ||
46 | return defHttp.put<MessageTemplateResultModel>({ | 47 | return defHttp.put<MessageTemplateResultModel>({ |
47 | url: MessageTemplateApi.TEMPLATE_URL, | 48 | url: MessageTemplateApi.TEMPLATE_URL, |
48 | params, | 49 | params, |
49 | - }) | 50 | + }); |
50 | } else { | 51 | } else { |
51 | return defHttp.post<MessageTemplateResultModel>({ | 52 | return defHttp.post<MessageTemplateResultModel>({ |
52 | url: MessageTemplateApi.TEMPLATE_URL, | 53 | url: MessageTemplateApi.TEMPLATE_URL, |
53 | params, | 54 | params, |
54 | - }) | 55 | + }); |
55 | } | 56 | } |
56 | -} | 57 | +}; |
57 | 58 | ||
58 | /** | 59 | /** |
59 | * 删除MessageConfig | 60 | * 删除MessageConfig |
@@ -63,21 +64,26 @@ export const deleteMessageTemplate = (ids: string[]) => | @@ -63,21 +64,26 @@ export const deleteMessageTemplate = (ids: string[]) => | ||
63 | defHttp.delete({ | 64 | defHttp.delete({ |
64 | url: MessageTemplateApi.TEMPLATE_URL, | 65 | url: MessageTemplateApi.TEMPLATE_URL, |
65 | data: { | 66 | data: { |
66 | - ids: ids | 67 | + ids: ids, |
67 | }, | 68 | }, |
68 | - }) | 69 | + }); |
69 | /** | 70 | /** |
70 | * 更新模板状态 | 71 | * 更新模板状态 |
71 | * @param id 配置id | 72 | * @param id 配置id |
72 | * @param status 状态 | 73 | * @param status 状态 |
73 | */ | 74 | */ |
74 | -export const setMessageTemplateStatus=(id:string,templatePurpose:string,messageType:string,status:number) => | 75 | +export const setMessageTemplateStatus = ( |
76 | + id: string, | ||
77 | + templatePurpose: string, | ||
78 | + messageType: string, | ||
79 | + status: number | ||
80 | +) => | ||
75 | defHttp.put<MessageConfigResultModel>({ | 81 | defHttp.put<MessageConfigResultModel>({ |
76 | url: MessageTemplateApi.TEMPLATE_URL, | 82 | url: MessageTemplateApi.TEMPLATE_URL, |
77 | - data:{ | ||
78 | - "id":id, | ||
79 | - "status":status, | ||
80 | - "templatePurpose":templatePurpose, | ||
81 | - "messageType":messageType | 83 | + data: { |
84 | + id: id, | ||
85 | + status: status, | ||
86 | + templatePurpose: templatePurpose, | ||
87 | + messageType: messageType, | ||
82 | }, | 88 | }, |
83 | - }) | 89 | + }); |
@@ -3,10 +3,10 @@ export interface BasicPageParams { | @@ -3,10 +3,10 @@ export interface BasicPageParams { | ||
3 | pageSize: number; | 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 | export interface BasicFetchResult<T extends any> { | 12 | export interface BasicFetchResult<T extends any> { |
1 | -import {defHttp} from "/@/utils/http/axios"; | ||
2 | -import {FileUploadResponse} from "/@/api/oss/FileUploadResponse"; | 1 | +import { defHttp } from '/@/utils/http/axios'; |
2 | +import { FileUploadResponse } from '/@/api/oss/FileUploadResponse'; | ||
3 | 3 | ||
4 | enum Api { | 4 | enum Api { |
5 | BaseUploadUrl = '/oss/upload', | 5 | BaseUploadUrl = '/oss/upload', |
6 | } | 6 | } |
7 | 7 | ||
8 | export const upload = (file) => { | 8 | export const upload = (file) => { |
9 | - return defHttp.post<FileUploadResponse>({url: Api.BaseUploadUrl, params: file}) | ||
10 | -} | 9 | + return defHttp.post<FileUploadResponse>({ url: Api.BaseUploadUrl, params: file }); |
10 | +}; |
1 | export interface JwtModel { | 1 | export interface JwtModel { |
2 | - userId: string; | ||
3 | - username: string; | ||
4 | - tenantCode: string; | ||
5 | - tenantName: string; | ||
6 | - exp: number; | ||
7 | - role: string[]; | ||
8 | - } | ||
9 | - | ||
2 | + userId: string; | ||
3 | + username: string; | ||
4 | + tenantCode: string; | ||
5 | + tenantName: string; | ||
6 | + exp: number; | ||
7 | + role: string[]; | ||
8 | +} |
1 | -import {defHttp} from '/@/utils/http/axios'; | ||
2 | -import {getMenuListResultModel} from './model/menuModel'; | ||
3 | -import {useUserStore} from '/@/store/modules/user'; | ||
4 | -import {RoleEnum} from '/@/enums/roleEnum'; | 1 | +import { defHttp } from '/@/utils/http/axios'; |
2 | +import { getMenuListResultModel } from './model/menuModel'; | ||
3 | +import { useUserStore } from '/@/store/modules/user'; | ||
4 | +import { RoleEnum } from '/@/enums/roleEnum'; | ||
5 | 5 | ||
6 | enum Api { | 6 | enum Api { |
7 | BaseMenuUrl = '/menu', | 7 | BaseMenuUrl = '/menu', |
8 | GetMenuList = '/menu/me/menus', | 8 | GetMenuList = '/menu/me/menus', |
9 | SysAdminMenuList = '/admin/me/menus', | 9 | SysAdminMenuList = '/admin/me/menus', |
10 | - GetMenuIdsByRoleId = '/menu/getMenuIdsByRoleId/' | 10 | + GetMenuIdsByRoleId = '/menu/getMenuIdsByRoleId/', |
11 | } | 11 | } |
12 | 12 | ||
13 | /** | 13 | /** |
@@ -17,17 +17,17 @@ enum Api { | @@ -17,17 +17,17 @@ enum Api { | ||
17 | export const getMenuList = () => { | 17 | export const getMenuList = () => { |
18 | const userStore = useUserStore(); | 18 | const userStore = useUserStore(); |
19 | let url = Api.GetMenuList; | 19 | let url = Api.GetMenuList; |
20 | - if (userStore.getRoleList.find(v => v == RoleEnum.ROLE_SYS_ADMIN)) { | 20 | + if (userStore.getRoleList.find((v) => v == RoleEnum.ROLE_SYS_ADMIN)) { |
21 | url = Api.SysAdminMenuList; | 21 | url = Api.SysAdminMenuList; |
22 | } | 22 | } |
23 | - return defHttp.get<getMenuListResultModel>({url: url}); | 23 | + return defHttp.get<getMenuListResultModel>({ url: url }); |
24 | }; | 24 | }; |
25 | 25 | ||
26 | export const delMenu = (menuIds: string[]) => { | 26 | export const delMenu = (menuIds: string[]) => { |
27 | - let url = Api.BaseMenuUrl; | ||
28 | - return defHttp.delete({url: url, data: menuIds}) | ||
29 | -} | 27 | + const url = Api.BaseMenuUrl; |
28 | + return defHttp.delete({ url: url, data: menuIds }); | ||
29 | +}; | ||
30 | export const getMenusIdsByRoleId = (roleId: string) => { | 30 | export const getMenusIdsByRoleId = (roleId: string) => { |
31 | - let url = Api.GetMenuIdsByRoleId + roleId; | ||
32 | - return defHttp.get<Array<string>>({url: url}); | ||
33 | -} | 31 | + const url = Api.GetMenuIdsByRoleId + roleId; |
32 | + return defHttp.get<Array<string>>({ url: url }); | ||
33 | +}; |
@@ -9,9 +9,9 @@ export interface RouteItem { | @@ -9,9 +9,9 @@ export interface RouteItem { | ||
9 | redirect?: string; | 9 | redirect?: string; |
10 | caseSensitive?: boolean; | 10 | caseSensitive?: boolean; |
11 | children?: RouteItem[]; | 11 | children?: RouteItem[]; |
12 | - menuName?:string; | ||
13 | - icon?:string; | ||
14 | - key?:string; | 12 | + menuName?: string; |
13 | + icon?: string; | ||
14 | + key?: string; | ||
15 | } | 15 | } |
16 | 16 | ||
17 | /** | 17 | /** |
@@ -42,8 +42,7 @@ export interface GetUserInfoModel { | @@ -42,8 +42,7 @@ export interface GetUserInfoModel { | ||
42 | // 介绍 | 42 | // 介绍 |
43 | desc?: string; | 43 | desc?: string; |
44 | } | 44 | } |
45 | - export interface UserInfoModel{ | ||
46 | - | 45 | +export interface UserInfoModel { |
47 | userId: string | number; | 46 | userId: string | number; |
48 | username: string; | 47 | username: string; |
49 | realName: string; | 48 | realName: string; |
@@ -52,10 +51,9 @@ export interface GetUserInfoModel { | @@ -52,10 +51,9 @@ export interface GetUserInfoModel { | ||
52 | tenantName: string; | 51 | tenantName: string; |
53 | roles: string[]; | 52 | roles: string[]; |
54 | plainRoles?: PlainRoleInfo[]; | 53 | plainRoles?: PlainRoleInfo[]; |
55 | - } | 54 | +} |
56 | 55 | ||
57 | - export interface PlainRoleInfo { | 56 | +export interface PlainRoleInfo { |
58 | roleName: string; | 57 | roleName: string; |
59 | roleId: string; | 58 | roleId: string; |
60 | } | 59 | } |
61 | - |
@@ -5,7 +5,7 @@ import { | @@ -5,7 +5,7 @@ import { | ||
5 | GetUserInfoModel, | 5 | GetUserInfoModel, |
6 | UserInfoModel, | 6 | UserInfoModel, |
7 | RefreshTokenParams, | 7 | RefreshTokenParams, |
8 | - SmsLoginParams | 8 | + SmsLoginParams, |
9 | } from './model/userModel'; | 9 | } from './model/userModel'; |
10 | 10 | ||
11 | import { ErrorMessageMode } from '/#/axios'; | 11 | import { ErrorMessageMode } from '/#/axios'; |
@@ -18,7 +18,7 @@ enum Api { | @@ -18,7 +18,7 @@ enum Api { | ||
18 | GetMyInfo = '/user/me/info', | 18 | GetMyInfo = '/user/me/info', |
19 | GetPermCode = '/role/me/permissions', | 19 | GetPermCode = '/role/me/permissions', |
20 | RefreshToken = '/auth/token', | 20 | RefreshToken = '/auth/token', |
21 | - SendLoginSmsCode = '/noauth/sendLoginSmsCode/' | 21 | + SendLoginSmsCode = '/noauth/sendLoginSmsCode/', |
22 | } | 22 | } |
23 | 23 | ||
24 | /** | 24 | /** |
@@ -35,7 +35,7 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') | @@ -35,7 +35,7 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') | ||
35 | } | 35 | } |
36 | ); | 36 | ); |
37 | } | 37 | } |
38 | -export function getMyInfo(){ | 38 | +export function getMyInfo() { |
39 | return defHttp.get<UserInfoModel>({ url: Api.GetMyInfo }); | 39 | return defHttp.get<UserInfoModel>({ url: Api.GetMyInfo }); |
40 | } | 40 | } |
41 | /** | 41 | /** |
@@ -48,19 +48,17 @@ export function getUserInfo() { | @@ -48,19 +48,17 @@ export function getUserInfo() { | ||
48 | export function getPermCode() { | 48 | export function getPermCode() { |
49 | return defHttp.get<string[]>({ url: Api.GetPermCode }); | 49 | return defHttp.get<string[]>({ url: Api.GetPermCode }); |
50 | } | 50 | } |
51 | -export async function SendLoginSmsCode(phoneNumber:string){ | ||
52 | - return await defHttp.post<boolean>({url:Api.SendLoginSmsCode+phoneNumber}) | 51 | +export async function SendLoginSmsCode(phoneNumber: string) { |
52 | + return await defHttp.post<boolean>({ url: Api.SendLoginSmsCode + phoneNumber }); | ||
53 | } | 53 | } |
54 | export function doLogout() { | 54 | export function doLogout() { |
55 | // return defHttp.get({ url: Api.Logout }); | 55 | // return defHttp.get({ url: Api.Logout }); |
56 | } | 56 | } |
57 | -export function doRefreshToken(params:RefreshTokenParams){ | ||
58 | - return defHttp.post<LoginResultModel>( | ||
59 | - { | ||
60 | - url: Api.RefreshToken, | ||
61 | - params, | ||
62 | - } | ||
63 | - ); | 57 | +export function doRefreshToken(params: RefreshTokenParams) { |
58 | + return defHttp.post<LoginResultModel>({ | ||
59 | + url: Api.RefreshToken, | ||
60 | + params, | ||
61 | + }); | ||
64 | } | 62 | } |
65 | export function smsCodeLoginApi(params: SmsLoginParams, mode: ErrorMessageMode = 'modal') { | 63 | export function smsCodeLoginApi(params: SmsLoginParams, mode: ErrorMessageMode = 'modal') { |
66 | return defHttp.post<LoginResultModel>( | 64 | return defHttp.post<LoginResultModel>( |
1 | -import {defHttp} from '/@/utils/http/axios'; | 1 | +import { defHttp } from '/@/utils/http/axios'; |
2 | 2 | ||
3 | -import {DeptListGetResultModel, DeptListItem} from "/@/api/system/model/deptModel"; | ||
4 | - | ||
5 | -import {DeptOperationApiResult, DeptOperationParams} from "/@/api/system/model/deptModel"; | ||
6 | -import {ErrorMessageMode} from "/#/axios"; | 3 | +import { DeptListGetResultModel, DeptListItem } from '/@/api/system/model/deptModel'; |
7 | 4 | ||
5 | +import { DeptOperationApiResult, DeptOperationParams } from '/@/api/system/model/deptModel'; | ||
6 | +import { ErrorMessageMode } from '/#/axios'; | ||
8 | 7 | ||
9 | enum Api { | 8 | enum Api { |
10 | DeptList = '/dept/all', | 9 | DeptList = '/dept/all', |
@@ -17,7 +16,11 @@ export const getDeptList = (params?: DeptListItem) => | @@ -17,7 +16,11 @@ export const getDeptList = (params?: DeptListItem) => | ||
17 | /** | 16 | /** |
18 | * @description: save or edit dept api | 17 | * @description: save or edit dept api |
19 | */ | 18 | */ |
20 | -export function saveOrEditDeptApi(params: DeptOperationParams, update: boolean = false, mode: ErrorMessageMode = 'modal') { | 19 | +export function saveOrEditDeptApi( |
20 | + params: DeptOperationParams, | ||
21 | + update = false, | ||
22 | + mode: ErrorMessageMode = 'modal' | ||
23 | +) { | ||
21 | if (!update) { | 24 | if (!update) { |
22 | return defHttp.post<DeptOperationApiResult>( | 25 | return defHttp.post<DeptOperationApiResult>( |
23 | { | 26 | { |
@@ -29,11 +32,14 @@ export function saveOrEditDeptApi(params: DeptOperationParams, update: boolean = | @@ -29,11 +32,14 @@ export function saveOrEditDeptApi(params: DeptOperationParams, update: boolean = | ||
29 | } | 32 | } |
30 | ); | 33 | ); |
31 | } else { | 34 | } else { |
32 | - return defHttp.put<DeptOperationApiResult>({url: Api.basicUrl, params}, {errorMessageMode: mode}); | 35 | + return defHttp.put<DeptOperationApiResult>( |
36 | + { url: Api.basicUrl, params }, | ||
37 | + { errorMessageMode: mode } | ||
38 | + ); | ||
33 | } | 39 | } |
34 | } | 40 | } |
35 | 41 | ||
36 | export const delDept = (menuIds: string[]) => { | 42 | export const delDept = (menuIds: string[]) => { |
37 | - let url = Api.basicUrl; | ||
38 | - return defHttp.delete({url: url, data: menuIds}) | ||
39 | -} | 43 | + const url = Api.basicUrl; |
44 | + return defHttp.delete({ url: url, data: menuIds }); | ||
45 | +}; |
1 | -import {defHttp} from '/@/utils/http/axios'; | 1 | +import { defHttp } from '/@/utils/http/axios'; |
2 | import { | 2 | import { |
3 | SysDictItem, | 3 | SysDictItem, |
4 | SysDict, | 4 | SysDict, |
5 | SysDictParams, | 5 | SysDictParams, |
6 | SysDictItemParams, | 6 | SysDictItemParams, |
7 | SysDictResultModel, | 7 | SysDictResultModel, |
8 | - SysDictItemResultModel, SysDictItemResult, DictCodeParams | 8 | + SysDictItemResultModel, |
9 | + SysDictItemResult, | ||
10 | + DictCodeParams, | ||
9 | } from './model/dictModel'; | 11 | } from './model/dictModel'; |
10 | 12 | ||
11 | - | ||
12 | enum SysDictApi { | 13 | enum SysDictApi { |
13 | CONFIG_URL = '/dict', | 14 | CONFIG_URL = '/dict', |
14 | - CONFIG_ITEM_URL = '/dictItem' | 15 | + CONFIG_ITEM_URL = '/dictItem', |
15 | } | 16 | } |
16 | 17 | ||
17 | /** | 18 | /** |
18 | * 查找字典值 | 19 | * 查找字典值 |
19 | * @param code | 20 | * @param code |
20 | */ | 21 | */ |
21 | -export const findDictItemByCode=(params? : DictCodeParams)=> | ||
22 | -{ | 22 | +export const findDictItemByCode = (params?: DictCodeParams) => { |
23 | return defHttp.post<SysDictItemResult>({ | 23 | return defHttp.post<SysDictItemResult>({ |
24 | - url: SysDictApi.CONFIG_ITEM_URL + "/find", | 24 | + url: SysDictApi.CONFIG_ITEM_URL + '/find', |
25 | params, | 25 | params, |
26 | - }) | 26 | + }); |
27 | }; | 27 | }; |
28 | 28 | ||
29 | /** | 29 | /** |
@@ -56,14 +56,14 @@ export const saveOrEditDictItem = (params: SysDictItem, isUpdate: boolean) => { | @@ -56,14 +56,14 @@ export const saveOrEditDictItem = (params: SysDictItem, isUpdate: boolean) => { | ||
56 | return defHttp.put<SysDictItemResultModel>({ | 56 | return defHttp.put<SysDictItemResultModel>({ |
57 | url: SysDictApi.CONFIG_ITEM_URL, | 57 | url: SysDictApi.CONFIG_ITEM_URL, |
58 | params, | 58 | params, |
59 | - }) | 59 | + }); |
60 | } else { | 60 | } else { |
61 | return defHttp.post<SysDictItemResultModel>({ | 61 | return defHttp.post<SysDictItemResultModel>({ |
62 | url: SysDictApi.CONFIG_ITEM_URL, | 62 | url: SysDictApi.CONFIG_ITEM_URL, |
63 | params, | 63 | params, |
64 | - }) | 64 | + }); |
65 | } | 65 | } |
66 | -} | 66 | +}; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * 修改DictItem的状态 | 69 | * 修改DictItem的状态 |
@@ -74,11 +74,11 @@ export const setDictItemStatus = (id: string, status: number) => { | @@ -74,11 +74,11 @@ export const setDictItemStatus = (id: string, status: number) => { | ||
74 | return defHttp.put<SysDictItemResultModel>({ | 74 | return defHttp.put<SysDictItemResultModel>({ |
75 | url: SysDictApi.CONFIG_ITEM_URL, | 75 | url: SysDictApi.CONFIG_ITEM_URL, |
76 | data: { | 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,29 +90,32 @@ export const saveOrEditDict = (params: SysDict, isUpdate: boolean) => { | ||
90 | return defHttp.put<SysDictResultModel>({ | 90 | return defHttp.put<SysDictResultModel>({ |
91 | url: SysDictApi.CONFIG_URL, | 91 | url: SysDictApi.CONFIG_URL, |
92 | params, | 92 | params, |
93 | - }) | 93 | + }); |
94 | } else { | 94 | } else { |
95 | return defHttp.post<SysDictResultModel>({ | 95 | return defHttp.post<SysDictResultModel>({ |
96 | url: SysDictApi.CONFIG_URL, | 96 | url: SysDictApi.CONFIG_URL, |
97 | params, | 97 | params, |
98 | - }) | 98 | + }); |
99 | } | 99 | } |
100 | -} | 100 | +}; |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * 删除SysDict | 103 | * 删除SysDict |
104 | * @param ids 删除id数组 | 104 | * @param ids 删除id数组 |
105 | */ | 105 | */ |
106 | export const deleteDict = (ids: string[]) => | 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 | * 删除SysDictItem | 120 | * 删除SysDictItem |
118 | * @param ids 删除id数组 | 121 | * @param ids 删除id数组 |
@@ -121,7 +124,6 @@ export const deleteDictItem = (ids: string[]) => | @@ -121,7 +124,6 @@ export const deleteDictItem = (ids: string[]) => | ||
121 | defHttp.delete({ | 124 | defHttp.delete({ |
122 | url: SysDictApi.CONFIG_ITEM_URL, | 125 | url: SysDictApi.CONFIG_ITEM_URL, |
123 | data: { | 126 | data: { |
124 | - ids: ids | 127 | + ids: ids, |
125 | }, | 128 | }, |
126 | - }) | ||
127 | - | 129 | + }); |
1 | -import {defHttp} from "/@/utils/http/axios"; | ||
2 | -import {GroupListResultModel} from "/@/api/system/model/groupModel"; | 1 | +import { defHttp } from '/@/utils/http/axios'; |
2 | +import { GroupListResultModel } from '/@/api/system/model/groupModel'; | ||
3 | 3 | ||
4 | enum GroupApi { | 4 | enum GroupApi { |
5 | - BASE_URL="/organization" | 5 | + BASE_URL = '/organization', |
6 | } | 6 | } |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * 查询当前用户的所属组织 | 9 | * 查询当前用户的所属组织 |
10 | */ | 10 | */ |
11 | -export const findCurrentUserGroups=()=> | 11 | +export const findCurrentUserGroups = () => |
12 | defHttp.get<GroupListResultModel>({ | 12 | defHttp.get<GroupListResultModel>({ |
13 | - url: GroupApi.BASE_URL+"/me/organizations", | 13 | + url: GroupApi.BASE_URL + '/me/organizations', |
14 | }); | 14 | }); |
1 | -import {MenuOperationParams, MenuOperationApiResult} from "/@/api/system/model/menuModel"; | ||
2 | -import {ErrorMessageMode} from "/#/axios"; | ||
3 | -import {defHttp} from "/@/utils/http/axios"; | ||
4 | - | 1 | +import { MenuOperationParams, MenuOperationApiResult } from '/@/api/system/model/menuModel'; |
2 | +import { ErrorMessageMode } from '/#/axios'; | ||
3 | +import { defHttp } from '/@/utils/http/axios'; | ||
5 | 4 | ||
6 | enum Api { | 5 | enum Api { |
7 | Save = '/menu', | 6 | Save = '/menu', |
@@ -10,7 +9,11 @@ enum Api { | @@ -10,7 +9,11 @@ enum Api { | ||
10 | /** | 9 | /** |
11 | * @description: save menu api | 10 | * @description: save menu api |
12 | */ | 11 | */ |
13 | -export function saveMenuApi(params: MenuOperationParams, update: boolean = false, mode: ErrorMessageMode = 'modal') { | 12 | +export function saveMenuApi( |
13 | + params: MenuOperationParams, | ||
14 | + update: boolean = false, | ||
15 | + mode: ErrorMessageMode = 'modal' | ||
16 | +) { | ||
14 | console.log(params); | 17 | console.log(params); |
15 | if (!update) { | 18 | if (!update) { |
16 | return defHttp.post<MenuOperationApiResult>( | 19 | return defHttp.post<MenuOperationApiResult>( |
@@ -23,6 +26,9 @@ export function saveMenuApi(params: MenuOperationParams, update: boolean = false | @@ -23,6 +26,9 @@ export function saveMenuApi(params: MenuOperationParams, update: boolean = false | ||
23 | } | 26 | } |
24 | ); | 27 | ); |
25 | } else { | 28 | } else { |
26 | - return defHttp.put<MenuOperationApiResult>({url: Api.Save, params}, {errorMessageMode: mode}); | 29 | + return defHttp.put<MenuOperationApiResult>( |
30 | + { url: Api.Save, params }, | ||
31 | + { errorMessageMode: mode } | ||
32 | + ); | ||
27 | } | 33 | } |
28 | } | 34 | } |
1 | -import {BasicFetchResult} from "/@/api/model/baseModel"; | 1 | +import { BasicFetchResult } from '/@/api/model/baseModel'; |
2 | 2 | ||
3 | export interface DeptOperationParams { | 3 | export interface DeptOperationParams { |
4 | id: string; | 4 | id: string; |
@@ -6,18 +6,16 @@ export interface DeptOperationParams { | @@ -6,18 +6,16 @@ export interface DeptOperationParams { | ||
6 | createTime: string; | 6 | createTime: string; |
7 | tenantCode: string; | 7 | tenantCode: string; |
8 | parentId?: string; | 8 | parentId?: string; |
9 | - orderNo:number; | ||
10 | - status:number; | 9 | + orderNo: number; |
10 | + status: number; | ||
11 | remark: string; | 11 | remark: string; |
12 | } | 12 | } |
13 | 13 | ||
14 | - | ||
15 | export interface DeptOperationApiResult { | 14 | export interface DeptOperationApiResult { |
16 | message: string; | 15 | message: string; |
17 | code: number; | 16 | code: number; |
18 | } | 17 | } |
19 | 18 | ||
20 | - | ||
21 | export interface DeptListItem { | 19 | export interface DeptListItem { |
22 | id: string; | 20 | id: string; |
23 | deptName: string; | 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 | * @description: Request list interface parameters | 3 | * @description: Request list interface parameters |
7 | */ | 4 | */ |
8 | export type SysDictParams = BasicPageParams & DictParams; | 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 | export type DictParams = { | 12 | export type DictParams = { |
16 | - dictName?:string; | ||
17 | - dictCode?:string; | ||
18 | -} | 13 | + dictName?: string; |
14 | + dictCode?: string; | ||
15 | +}; | ||
19 | 16 | ||
20 | export interface SysDict { | 17 | export interface SysDict { |
21 | id: string; | 18 | id: string; |
@@ -28,17 +25,17 @@ export interface SysDict { | @@ -28,17 +25,17 @@ export interface SysDict { | ||
28 | } | 25 | } |
29 | 26 | ||
30 | export type DictItemParams = { | 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 | id: string; | 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 | createTime: string; | 39 | createTime: string; |
43 | updateTime: string; | 40 | updateTime: string; |
44 | } | 41 | } |
@@ -51,4 +48,3 @@ export type SysDictResultModel = BasicFetchResult<SysDict>; | @@ -51,4 +48,3 @@ export type SysDictResultModel = BasicFetchResult<SysDict>; | ||
51 | export type SysDictItemResultModel = BasicFetchResult<SysDictItem>; | 48 | export type SysDictItemResultModel = BasicFetchResult<SysDictItem>; |
52 | 49 | ||
53 | export type SysDictItemResult = SysDictItem; | 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 | export type GroupListResultModel = GroupItem[]; | 9 | export type GroupListResultModel = GroupItem[]; |
1 | - | ||
2 | export interface MenuOperationApiResult { | 1 | export interface MenuOperationApiResult { |
3 | message: string; | 2 | message: string; |
4 | code: number; | 3 | code: number; |
5 | } | 4 | } |
6 | 5 | ||
7 | - | ||
8 | export interface MenuOperationParams { | 6 | export interface MenuOperationParams { |
9 | path: string; | 7 | path: string; |
10 | component: any; | 8 | component: any; |
11 | - type:string; | ||
12 | - parentId:string; | 9 | + type: string; |
10 | + parentId: string; | ||
13 | meta: metaModel; | 11 | meta: metaModel; |
14 | name?: string; | 12 | name?: string; |
15 | alias?: string | string[]; | 13 | alias?: string | string[]; |
@@ -21,8 +19,8 @@ export interface MenuOperationParams { | @@ -21,8 +19,8 @@ export interface MenuOperationParams { | ||
21 | export interface metaModel { | 19 | export interface metaModel { |
22 | icon: string; | 20 | icon: string; |
23 | title: string; | 21 | title: string; |
24 | - isLink:boolean; | ||
25 | - menuType:number; | 22 | + isLink: boolean; |
23 | + menuType: number; | ||
26 | ignoreKeepAlive?: boolean; | 24 | ignoreKeepAlive?: boolean; |
27 | hideMenu: boolean; | 25 | hideMenu: boolean; |
28 | status: number; | 26 | status: number; |
1 | -import {BasicPageParams, BasicFetchResult} from '/@/api/model/baseModel'; | 1 | +import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel'; |
2 | 2 | ||
3 | export type AccountParams = BasicPageParams & { | 3 | export type AccountParams = BasicPageParams & { |
4 | account?: string; | 4 | account?: string; |
@@ -6,7 +6,7 @@ export type AccountParams = BasicPageParams & { | @@ -6,7 +6,7 @@ export type AccountParams = BasicPageParams & { | ||
6 | }; | 6 | }; |
7 | 7 | ||
8 | export type RoleParams = { | 8 | export type RoleParams = { |
9 | - roleType?:string; | 9 | + roleType?: string; |
10 | roleName?: string; | 10 | roleName?: string; |
11 | status?: string; | 11 | status?: string; |
12 | }; | 12 | }; |
@@ -30,10 +30,10 @@ export interface AccountListItem { | @@ -30,10 +30,10 @@ export interface AccountListItem { | ||
30 | email: string; | 30 | email: string; |
31 | realName: string; | 31 | realName: string; |
32 | roles: any; | 32 | roles: any; |
33 | - groupIds:any; | 33 | + groupIds: any; |
34 | createTime: string; | 34 | createTime: string; |
35 | deptId: string; | 35 | deptId: string; |
36 | - accountExpireTime?:string; | 36 | + accountExpireTime?: string; |
37 | } | 37 | } |
38 | 38 | ||
39 | export interface OrganizationListItem { | 39 | export interface OrganizationListItem { |
@@ -69,16 +69,16 @@ export interface RoleReqDTO { | @@ -69,16 +69,16 @@ export interface RoleReqDTO { | ||
69 | } | 69 | } |
70 | 70 | ||
71 | export interface ChangeAccountParams { | 71 | export interface ChangeAccountParams { |
72 | - userId?:string; | ||
73 | - password?:string; | ||
74 | - resetPassword?:string; | 72 | + userId?: string; |
73 | + password?: string; | ||
74 | + resetPassword?: string; | ||
75 | } | 75 | } |
76 | 76 | ||
77 | export class RoleOrOrganizationParam { | 77 | export class RoleOrOrganizationParam { |
78 | - userId:string; | ||
79 | - queryRole:boolean; | ||
80 | - queryOrganization:boolean; | ||
81 | - constructor(userId:string,queryRole:boolean,queryOrganization:boolean){ | 78 | + userId: string; |
79 | + queryRole: boolean; | ||
80 | + queryOrganization: boolean; | ||
81 | + constructor(userId: string, queryRole: boolean, queryOrganization: boolean) { | ||
82 | this.queryRole = queryRole; | 82 | this.queryRole = queryRole; |
83 | this.queryOrganization = queryOrganization; | 83 | this.queryOrganization = queryOrganization; |
84 | this.userId = userId; | 84 | this.userId = userId; |
@@ -99,4 +99,3 @@ export type RolePageListGetResultModel = BasicFetchResult<RoleListItem>; | @@ -99,4 +99,3 @@ export type RolePageListGetResultModel = BasicFetchResult<RoleListItem>; | ||
99 | export type RoleListGetResultModel = RoleListItem[]; | 99 | export type RoleListGetResultModel = RoleListItem[]; |
100 | 100 | ||
101 | export type AccountListModel = AccountListItem; | 101 | export type AccountListModel = AccountListItem; |
102 | - |
@@ -15,7 +15,7 @@ import { | @@ -15,7 +15,7 @@ import { | ||
15 | RoleOrOrganizationParam, | 15 | RoleOrOrganizationParam, |
16 | ChangeAccountParams, | 16 | ChangeAccountParams, |
17 | } from './model/systemModel'; | 17 | } from './model/systemModel'; |
18 | -import {defHttp} from '/@/utils/http/axios'; | 18 | +import { defHttp } from '/@/utils/http/axios'; |
19 | 19 | ||
20 | enum Api { | 20 | enum Api { |
21 | AccountList = '/user/page', | 21 | AccountList = '/user/page', |
@@ -28,33 +28,34 @@ enum Api { | @@ -28,33 +28,34 @@ enum Api { | ||
28 | DeleteRole = '/role', | 28 | DeleteRole = '/role', |
29 | GetAllRoleList = '/role/find/list', | 29 | GetAllRoleList = '/role/find/list', |
30 | BaseUserUrl = '/user', | 30 | BaseUserUrl = '/user', |
31 | - BaseOrganization = '/organization' | 31 | + BaseOrganization = '/organization', |
32 | } | 32 | } |
33 | 33 | ||
34 | -export const getAccountInfo=(userId:string)=> | ||
35 | - defHttp.get<AccountListModel>({url: Api.BaseUserUrl+"/"+userId}) | 34 | +export const getAccountInfo = (userId: string) => |
35 | + defHttp.get<AccountListModel>({ url: Api.BaseUserUrl + '/' + userId }); | ||
36 | 36 | ||
37 | export const getAccountList = (params: AccountParams) => | 37 | export const getAccountList = (params: AccountParams) => |
38 | - defHttp.get<AccountListGetResultModel>({url: Api.AccountList, params}); | ||
39 | - | 38 | + defHttp.get<AccountListGetResultModel>({ url: Api.AccountList, params }); |
40 | /** | 39 | /** |
41 | * 获取组织列表 | 40 | * 获取组织列表 |
42 | * @param params 请求参数 | 41 | * @param params 请求参数 |
43 | */ | 42 | */ |
44 | export const getOrganizationList = (params?: OrganizationListItem) => | 43 | export const getOrganizationList = (params?: OrganizationListItem) => |
45 | - defHttp.get<OrganizationListGetResultModel>({url: Api.BaseOrganization+'/me/organizations', params}); | 44 | + defHttp.get<OrganizationListGetResultModel>({ |
45 | + url: Api.BaseOrganization + '/me/organizations', | ||
46 | + params, | ||
47 | + }); | ||
46 | 48 | ||
47 | /** | 49 | /** |
48 | * 更新或者保存组织 | 50 | * 更新或者保存组织 |
49 | * @param params | 51 | * @param params |
50 | * @param isUpdate | 52 | * @param isUpdate |
51 | */ | 53 | */ |
52 | -export const saveOrUpdateOrganization = (params?:OrganizationListItem,isUpdate?:boolean) => | ||
53 | -{ | ||
54 | - if(isUpdate){ | ||
55 | - return defHttp.put<OrganizationListGetResultModel>({url: Api.BaseOrganization, params}); | ||
56 | - }else{ | ||
57 | - return defHttp.post<OrganizationListGetResultModel>({url: Api.BaseOrganization, params}); | 54 | +export const saveOrUpdateOrganization = (params?: OrganizationListItem, isUpdate?: boolean) => { |
55 | + if (isUpdate) { | ||
56 | + return defHttp.put<OrganizationListGetResultModel>({ url: Api.BaseOrganization, params }); | ||
57 | + } else { | ||
58 | + return defHttp.post<OrganizationListGetResultModel>({ url: Api.BaseOrganization, params }); | ||
58 | } | 59 | } |
59 | }; | 60 | }; |
60 | 61 | ||
@@ -63,32 +64,31 @@ export const saveOrUpdateOrganization = (params?:OrganizationListItem,isUpdate?: | @@ -63,32 +64,31 @@ export const saveOrUpdateOrganization = (params?:OrganizationListItem,isUpdate?: | ||
63 | * @param ids 删除的ID | 64 | * @param ids 删除的ID |
64 | */ | 65 | */ |
65 | export const delOrganization = (ids: string[]) => | 66 | export const delOrganization = (ids: string[]) => |
66 | - defHttp.delete({url: Api.BaseOrganization, data: ids}) | ||
67 | - | 67 | + defHttp.delete({ url: Api.BaseOrganization, data: ids }); |
68 | 68 | ||
69 | export const getMenuList = (params?: MenuParams) => | 69 | export const getMenuList = (params?: MenuParams) => |
70 | - defHttp.get<MenuListGetResultModel>({url: Api.MenuList, params}); | 70 | + defHttp.get<MenuListGetResultModel>({ url: Api.MenuList, params }); |
71 | 71 | ||
72 | export const getRoleListByPage = (params?: RolePageParams) => | 72 | export const getRoleListByPage = (params?: RolePageParams) => |
73 | - defHttp.get<RolePageListGetResultModel>({url: Api.RolePageList, params}); | ||
74 | -export const getTenantRoleListByPage= (params?: RolePageParams) => | ||
75 | - defHttp.get<RolePageListGetResultModel>({url: Api.RolePageList, params}); | 73 | + defHttp.get<RolePageListGetResultModel>({ url: Api.RolePageList, params }); |
74 | +export const getTenantRoleListByPage = (params?: RolePageParams) => | ||
75 | + defHttp.get<RolePageListGetResultModel>({ url: Api.RolePageList, params }); | ||
76 | 76 | ||
77 | export const getAllRoleList = (params?: RoleParams) => | 77 | export const getAllRoleList = (params?: RoleParams) => |
78 | - defHttp.post<RoleListGetResultModel>({url: Api.GetAllRoleList, params}); | 78 | + defHttp.post<RoleListGetResultModel>({ url: Api.GetAllRoleList, params }); |
79 | 79 | ||
80 | export const setRoleStatus = (id: number, status: number) => | 80 | export const setRoleStatus = (id: number, status: number) => |
81 | - defHttp.put({url: Api.setRoleStatus + id + "/" + status}); | 81 | + defHttp.put({ url: Api.setRoleStatus + id + '/' + status }); |
82 | export const saveOrUpdateRoleInfoWithMenu = async (roleRequestDto: RoleReqDTO) => { | 82 | export const saveOrUpdateRoleInfoWithMenu = async (roleRequestDto: RoleReqDTO) => { |
83 | - await defHttp.post({url: Api.SaveOrUpdateRoleInfoWithMenu, params: roleRequestDto}); | ||
84 | -} | 83 | + await defHttp.post({ url: Api.SaveOrUpdateRoleInfoWithMenu, params: roleRequestDto }); |
84 | +}; | ||
85 | 85 | ||
86 | export const isAccountExist = (account: string) => | 86 | export const isAccountExist = (account: string) => |
87 | - defHttp.get({url: Api.IsAccountExist + account}, {errorMessageMode: 'none'}); | 87 | + defHttp.get({ url: Api.IsAccountExist + account }, { errorMessageMode: 'none' }); |
88 | 88 | ||
89 | export const delRole = async (roleIds: string[]) => { | 89 | export const delRole = async (roleIds: string[]) => { |
90 | - await defHttp.delete({url: Api.DeleteRole, params: roleIds}); | ||
91 | -} | 90 | + await defHttp.delete({ url: Api.DeleteRole, params: roleIds }); |
91 | +}; | ||
92 | 92 | ||
93 | /** | 93 | /** |
94 | * 更新或添加用户信息 | 94 | * 更新或添加用户信息 |
@@ -96,19 +96,19 @@ export const delRole = async (roleIds: string[]) => { | @@ -96,19 +96,19 @@ export const delRole = async (roleIds: string[]) => { | ||
96 | * @param isUpdate | 96 | * @param isUpdate |
97 | * @constructor | 97 | * @constructor |
98 | */ | 98 | */ |
99 | -export const SaveOrUpdateUserInfo = (params: AccountListItem, isUpdate: boolean)=>{ | 99 | +export const SaveOrUpdateUserInfo = (params: AccountListItem, isUpdate: boolean) => { |
100 | if (isUpdate) { | 100 | if (isUpdate) { |
101 | return defHttp.put<AccountListModel>({ | 101 | return defHttp.put<AccountListModel>({ |
102 | url: Api.BaseUserUrl, | 102 | url: Api.BaseUserUrl, |
103 | params, | 103 | params, |
104 | - }) | 104 | + }); |
105 | } else { | 105 | } else { |
106 | return defHttp.post<AccountListModel>({ | 106 | return defHttp.post<AccountListModel>({ |
107 | url: Api.BaseUserUrl, | 107 | url: Api.BaseUserUrl, |
108 | params, | 108 | params, |
109 | - }) | 109 | + }); |
110 | } | 110 | } |
111 | -} | 111 | +}; |
112 | /** | 112 | /** |
113 | * 删除User | 113 | * 删除User |
114 | * @param ids 删除id数组 | 114 | * @param ids 删除id数组 |
@@ -117,26 +117,27 @@ export const deleteUser = (ids: string[]) => | @@ -117,26 +117,27 @@ export const deleteUser = (ids: string[]) => | ||
117 | defHttp.delete({ | 117 | defHttp.delete({ |
118 | url: Api.BaseUserUrl, | 118 | url: Api.BaseUserUrl, |
119 | data: { | 119 | data: { |
120 | - ids: ids | 120 | + ids: ids, |
121 | }, | 121 | }, |
122 | - }) | 122 | + }); |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * 查询当前用户的关系 | 125 | * 查询当前用户的关系 |
126 | * @param params | 126 | * @param params |
127 | */ | 127 | */ |
128 | -export const findCurrentUserRelation=(params:RoleOrOrganizationParam)=> | 128 | + |
129 | +export const findCurrentUserRelation = (params: RoleOrOrganizationParam) => | ||
129 | defHttp.post<Array<string>>({ | 130 | defHttp.post<Array<string>>({ |
130 | - url: Api.BaseUserUrl+"/relation", | ||
131 | - params:params | 131 | + url: Api.BaseUserUrl + '/relation', |
132 | + params: params, | ||
132 | }); | 133 | }); |
133 | 134 | ||
134 | /** | 135 | /** |
135 | * 修改密码 | 136 | * 修改密码 |
136 | * @param params | 137 | * @param params |
137 | */ | 138 | */ |
138 | -export const resetPassword=(params:ChangeAccountParams)=> | 139 | +export const resetPassword = (params: ChangeAccountParams) => |
139 | defHttp.post({ | 140 | defHttp.post({ |
140 | - url: Api.BaseUserUrl + "/reset", | ||
141 | - params:params | 141 | + url: Api.BaseUserUrl + '/reset', |
142 | + params: params, | ||
142 | }); | 143 | }); |
1 | -import {getPageData} from '../base'; | 1 | +import { getPageData } from '../base'; |
2 | import { | 2 | import { |
3 | SendResetPasswordEmailMsg, | 3 | SendResetPasswordEmailMsg, |
4 | TenantAdminPageRequestParams, | 4 | TenantAdminPageRequestParams, |
5 | TenantDTO, | 5 | TenantDTO, |
6 | TenantPageRequestParams, | 6 | TenantPageRequestParams, |
7 | - TenantRequestDTO, UserDTO | 7 | + TenantRequestDTO, |
8 | + UserDTO, | ||
8 | } from './tenantInfo'; | 9 | } from './tenantInfo'; |
9 | -import {defHttp} from "/@/utils/http/axios"; | 10 | +import { defHttp } from '/@/utils/http/axios'; |
10 | 11 | ||
11 | enum Api { | 12 | enum Api { |
12 | userPage = '/user/page', | 13 | userPage = '/user/page', |
13 | tenantPage = '/admin/tenant/page', | 14 | tenantPage = '/admin/tenant/page', |
14 | saveTenantAdmin = '/user/saveTenantAdmin', | 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 | deleteTenantAdmin = '/admin/user/deleteTenantAdmin', | 20 | deleteTenantAdmin = '/admin/user/deleteTenantAdmin', |
20 | - getTenantRoles="/admin/tenant/roles/", | 21 | + getTenantRoles = '/admin/tenant/roles/', |
21 | } | 22 | } |
22 | 23 | ||
23 | export function getTenantPage(params: TenantPageRequestParams) { | 24 | export function getTenantPage(params: TenantPageRequestParams) { |
@@ -29,63 +30,49 @@ export function getTenantAdminPage(params: TenantAdminPageRequestParams) { | @@ -29,63 +30,49 @@ export function getTenantAdminPage(params: TenantAdminPageRequestParams) { | ||
29 | } | 30 | } |
30 | 31 | ||
31 | export async function saveTenantAdmin(params: UserDTO) { | 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 | export async function updateOrCreateTenant(params: TenantRequestDTO) { | 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 | export async function deleteTenant(tenantIds: Array<string>) { | 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 | export async function deleteTenantAdmin(adminIds: Array<string>) { | 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 | export async function resetPassword(params: string) { | 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 | export async function sendMessageOrEmail(params: SendResetPasswordEmailMsg) { | 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 | export enum TenantStatusEnum { | 3 | export enum TenantStatusEnum { |
4 | NORMAL = 'NORMAL', | 4 | NORMAL = 'NORMAL', |
@@ -54,13 +54,13 @@ export interface UserDTO { | @@ -54,13 +54,13 @@ export interface UserDTO { | ||
54 | accountExpireTime: string; | 54 | accountExpireTime: string; |
55 | createTime: string; | 55 | createTime: string; |
56 | updateTime: string; | 56 | updateTime: string; |
57 | - userStatusEnum: UserStatusEnum | 57 | + userStatusEnum: UserStatusEnum; |
58 | hasPassword?: boolean; | 58 | hasPassword?: boolean; |
59 | } | 59 | } |
60 | 60 | ||
61 | export enum MessageTypeEnum { | 61 | export enum MessageTypeEnum { |
62 | EMAIL_MESSAGE = 'EMAIL_MESSAGE', | 62 | EMAIL_MESSAGE = 'EMAIL_MESSAGE', |
63 | - PHONE_MESSAGE = 'PHONE_MESSAGE' | 63 | + PHONE_MESSAGE = 'PHONE_MESSAGE', |
64 | } | 64 | } |
65 | 65 | ||
66 | export class SendResetPasswordEmailMsg { | 66 | export class SendResetPasswordEmailMsg { |
@@ -71,13 +71,12 @@ export class SendResetPasswordEmailMsg { | @@ -71,13 +71,12 @@ export class SendResetPasswordEmailMsg { | ||
71 | this.userId = userId; | 71 | this.userId = userId; |
72 | this.messageTypeEnum = msgType; | 72 | this.messageTypeEnum = msgType; |
73 | } | 73 | } |
74 | - | ||
75 | } | 74 | } |
76 | 75 | ||
77 | export class TenantPageRequest extends BaseQueryRequest { | 76 | export class TenantPageRequest extends BaseQueryRequest { |
78 | tenantName: string | undefined; | 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 | super(page, pageSize); | 80 | super(page, pageSize); |
82 | this.tenantName = tenantName; | 81 | this.tenantName = tenantName; |
83 | } | 82 | } |
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <template> | 5 | <template> |
6 | <div class="anticon" :class="getAppLogoClass" @click="goHome"> | 6 | <div class="anticon" :class="getAppLogoClass" @click="goHome"> |
7 | <img src="../../../assets/images/logo.png" /> | 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 | {{ title }} | 9 | {{ title }} |
10 | </div> | 10 | </div> |
11 | </div> | 11 | </div> |
@@ -75,7 +75,7 @@ export function useDrawer(): UseDrawerReturnType { | @@ -75,7 +75,7 @@ export function useDrawer(): UseDrawerReturnType { | ||
75 | 75 | ||
76 | openDrawer: <T = any>(visible = true, data?: T, openOnSet = true): void => { | 76 | openDrawer: <T = any>(visible = true, data?: T, openOnSet = true): void => { |
77 | getInstance()?.setDrawerProps({ | 77 | getInstance()?.setDrawerProps({ |
78 | - visible: visible, | 78 | + visible, |
79 | }); | 79 | }); |
80 | if (!data) return; | 80 | if (!data) return; |
81 | 81 |
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 | <template #centerFooter> | 16 | <template #centerFooter> |
17 | <a-button | 17 | <a-button |
18 | @click="handleStartUpload" | 18 | @click="handleStartUpload" |
@@ -10,5 +10,5 @@ export enum PageEnum { | @@ -10,5 +10,5 @@ export enum PageEnum { | ||
10 | //消息配置 | 10 | //消息配置 |
11 | MESSAGE_CONFIG = '/config/message', | 11 | MESSAGE_CONFIG = '/config/message', |
12 | //设备配置 | 12 | //设备配置 |
13 | - DEVICE_PROFILE = '/deviceManager/deviceProfile' | 13 | + DEVICE_PROFILE = '/deviceManager/deviceProfile', |
14 | } | 14 | } |
1 | -export enum InputRegExp{ | 1 | +export enum InputRegExp { |
2 | /** | 2 | /** |
3 | * 密码中必须包含大小写 字母、数字、特称字符,至少8个字符,最多30个字符; | 3 | * 密码中必须包含大小写 字母、数字、特称字符,至少8个字符,最多30个字符; |
4 | */ | 4 | */ |
5 | - PASSWORD_INPUT='(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,30}' | 5 | + PASSWORD_INPUT = '(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,30}', |
6 | } | 6 | } |
1 | export enum RoleEnum { | 1 | export enum RoleEnum { |
2 | - ROLE_SYS_ADMIN = "ROLE_SYS_ADMIN", | ||
3 | - ROLE_TENANT_ADMIN = "ROLE_TENANT_ADMIN", | ||
4 | - ROLE_NORMAL_USER = "ROLE_NORMAL_USER", | ||
5 | - ROLE_PLATFORM_ADMIN="ROLE_PLATFORM_ADMIN" | 2 | + ROLE_SYS_ADMIN = 'ROLE_SYS_ADMIN', |
3 | + ROLE_TENANT_ADMIN = 'ROLE_TENANT_ADMIN', | ||
4 | + ROLE_NORMAL_USER = 'ROLE_NORMAL_USER', | ||
5 | + ROLE_PLATFORM_ADMIN = 'ROLE_PLATFORM_ADMIN', | ||
6 | } | 6 | } |
1 | export default { | 1 | export default { |
2 | - common:{ | ||
3 | - createTime:"create time", | ||
4 | - updateTime:"update time", | ||
5 | - operation:"operation", | ||
6 | - remark:"remark", | ||
7 | - enable:"enable", | ||
8 | - disable:"disable", | ||
9 | - sort:"sort", | ||
10 | - status:"status", | 2 | + common: { |
3 | + createTime: 'create time', | ||
4 | + updateTime: 'update time', | ||
5 | + operation: 'operation', | ||
6 | + remark: 'remark', | ||
7 | + enable: 'enable', | ||
8 | + disable: 'disable', | ||
9 | + sort: 'sort', | ||
10 | + status: 'status', | ||
11 | }, | 11 | }, |
12 | - tenant:{ | ||
13 | - tenant:"tenant", | ||
14 | - tenantManagement:"tenant management", | ||
15 | - tenantSetting:"tenant setting" | ||
16 | - }, | ||
17 | - organization:{ | ||
18 | - queryOrganizationName:"organization name", | ||
19 | - toolOrganizationList:"organization list", | ||
20 | - toolCreateOrganization:"create organization", | ||
21 | - toolEditOrganization:"edit organization", | ||
22 | - parentOrganization:"parent organization", | 12 | + tenant: { |
13 | + tenant: 'tenant', | ||
14 | + tenantManagement: 'tenant management', | ||
15 | + tenantSetting: 'tenant setting', | ||
23 | }, | 16 | }, |
24 | - dept:{ | ||
25 | - queryDeptName:"dept name", | ||
26 | - queryDeptStatus:"status", | ||
27 | - toolDeptList:"dept list", | ||
28 | - toolCreateDept:"create dept", | ||
29 | - toolEditDept:"edit dept", | ||
30 | - tableTitleDeptSort:"sort", | ||
31 | - tableTitleDeptCreateTime:"create time", | ||
32 | - tableTitleDeptOperation:"operation", | ||
33 | - drawerTitleDeptEnable:"enable", | ||
34 | - drawerTitleDeptDisable:"disable", | ||
35 | - drawerTitleDeptParentDept:"parent dept", | ||
36 | - tableTitleMemo:"memo" | 17 | + organization: { |
18 | + queryOrganizationName: 'organization name', | ||
19 | + toolOrganizationList: 'organization list', | ||
20 | + toolCreateOrganization: 'create organization', | ||
21 | + toolEditOrganization: 'edit organization', | ||
22 | + parentOrganization: 'parent organization', | ||
37 | }, | 23 | }, |
38 | - system:{ | ||
39 | - system:"system", | ||
40 | - accountManagement:"account management", | ||
41 | - roleManagement:"role management", | ||
42 | - menuManagement:"menu management", | ||
43 | - deptManagement:"dept management", | ||
44 | - modifyPassword:"modify password", | ||
45 | - pageSystemTitleCreateMenu:"create menu", | ||
46 | - pageSystemTitleCreateTenant:"new tenant", | ||
47 | - pageSystemTitleEditMenu:"edit menu", | ||
48 | - pageSystemTitleEditTenant:"edit tenant", | ||
49 | - pageSystemTitleOperation:"operation", | ||
50 | - pageSystemTitleWhetherDelete:"Are you sure to delete", | ||
51 | - pageSystemTitleMenuList:"menu list", | ||
52 | - menuEditPagesMenuType:"menu type", | ||
53 | - menuEditPagesDirectory:"directory", | ||
54 | - menuEditPagesMenu:"menu", | ||
55 | - menuEditPagesButton:"button", | ||
56 | - menuEditPagesParentMenu:"parent menu", | ||
57 | - menuEditPagesRouterAddress:"router address", | ||
58 | - menuEditPagesComponentsPath:"components", | ||
59 | - menuEditPagesIsExt:"is ext", | ||
60 | - menuEditPagesIsKeepAlive:"is keep alive", | ||
61 | - menuEditPagesIsHide:"is hide", | ||
62 | - menuEditPagesYes:"yes", | ||
63 | - menuEditPagesNo:"no", | ||
64 | - tableTitleSystemMenuName:"menu name", | ||
65 | - tableTitleSystemIcon:"icon", | ||
66 | - tableTitleSystemPermissionTag:"permission tag", | ||
67 | - tableTitleSystemComponents:"components", | ||
68 | - tableTitleSystemSort:"sort", | ||
69 | - tableTitleSystemStatus:"status", | ||
70 | - tableTitleSystemCreateTime:"create time", | ||
71 | - tableTitleSystemEnable:"enable", | ||
72 | - tableTitleSystemStop:"disable", | ||
73 | - tableSuccessStatus:"success", | ||
74 | - tableFailedStatus:"failed", | ||
75 | - } | ||
76 | - }; | 24 | + dept: { |
25 | + queryDeptName: 'dept name', | ||
26 | + queryDeptStatus: 'status', | ||
27 | + toolDeptList: 'dept list', | ||
28 | + toolCreateDept: 'create dept', | ||
29 | + toolEditDept: 'edit dept', | ||
30 | + tableTitleDeptSort: 'sort', | ||
31 | + tableTitleDeptCreateTime: 'create time', | ||
32 | + tableTitleDeptOperation: 'operation', | ||
33 | + drawerTitleDeptEnable: 'enable', | ||
34 | + drawerTitleDeptDisable: 'disable', | ||
35 | + drawerTitleDeptParentDept: 'parent dept', | ||
36 | + tableTitleMemo: 'memo', | ||
37 | + }, | ||
38 | + system: { | ||
39 | + system: 'system', | ||
40 | + accountManagement: 'account management', | ||
41 | + roleManagement: 'role management', | ||
42 | + menuManagement: 'menu management', | ||
43 | + deptManagement: 'dept management', | ||
44 | + modifyPassword: 'modify password', | ||
45 | + pageSystemTitleCreateMenu: 'create menu', | ||
46 | + pageSystemTitleCreateTenant: 'new tenant', | ||
47 | + pageSystemTitleEditMenu: 'edit menu', | ||
48 | + pageSystemTitleEditTenant: 'edit tenant', | ||
49 | + pageSystemTitleOperation: 'operation', | ||
50 | + pageSystemTitleWhetherDelete: 'Are you sure to delete', | ||
51 | + pageSystemTitleMenuList: 'menu list', | ||
52 | + menuEditPagesMenuType: 'menu type', | ||
53 | + menuEditPagesDirectory: 'directory', | ||
54 | + menuEditPagesMenu: 'menu', | ||
55 | + menuEditPagesButton: 'button', | ||
56 | + menuEditPagesParentMenu: 'parent menu', | ||
57 | + menuEditPagesRouterAddress: 'router address', | ||
58 | + menuEditPagesComponentsPath: 'components', | ||
59 | + menuEditPagesIsExt: 'is ext', | ||
60 | + menuEditPagesIsKeepAlive: 'is keep alive', | ||
61 | + menuEditPagesIsHide: 'is hide', | ||
62 | + menuEditPagesYes: 'yes', | ||
63 | + menuEditPagesNo: 'no', | ||
64 | + tableTitleSystemMenuName: 'menu name', | ||
65 | + tableTitleSystemIcon: 'icon', | ||
66 | + tableTitleSystemPermissionTag: 'permission tag', | ||
67 | + tableTitleSystemComponents: 'components', | ||
68 | + tableTitleSystemSort: 'sort', | ||
69 | + tableTitleSystemStatus: 'status', | ||
70 | + tableTitleSystemCreateTime: 'create time', | ||
71 | + tableTitleSystemEnable: 'enable', | ||
72 | + tableTitleSystemStop: 'disable', | ||
73 | + tableSuccessStatus: 'success', | ||
74 | + tableFailedStatus: 'failed', | ||
75 | + }, | ||
76 | +}; |
@@ -2,7 +2,7 @@ export default { | @@ -2,7 +2,7 @@ export default { | ||
2 | api: { | 2 | api: { |
3 | operationFailed: 'Operation failed', | 3 | operationFailed: 'Operation failed', |
4 | errorTip: 'Error Tip', | 4 | errorTip: 'Error Tip', |
5 | - passwordOrUserNameError:'username or password not correct', | 5 | + passwordOrUserNameError: 'username or password not correct', |
6 | loginFailed: 'Login Failed', | 6 | loginFailed: 'Login Failed', |
7 | errorMessage: 'The operation failed, the system is abnormal!', | 7 | errorMessage: 'The operation failed, the system is abnormal!', |
8 | timeoutMessage: 'Login timed out, please log in again!', | 8 | timeoutMessage: 'Login timed out, please log in again!', |
1 | export default { | 1 | export default { |
2 | - common:{ | ||
3 | - createTime:"创建时间", | ||
4 | - updateTime:"更新时间", | ||
5 | - operation:"操作", | ||
6 | - remark:"备注", | ||
7 | - enable:"启用", | ||
8 | - disable:"禁用", | ||
9 | - sort:"排序", | ||
10 | - status:"状态" | ||
11 | - }, | ||
12 | - tenant:{ | ||
13 | - tenant:"租户", | ||
14 | - tenantManagement:"租户管理", | ||
15 | - tenantSetting:"租户设置" | ||
16 | - }, | ||
17 | - organization:{ | ||
18 | - queryOrganizationName:"组织名称", | ||
19 | - toolOrganizationList:"组织列表", | ||
20 | - toolCreateOrganization:"新增组织", | ||
21 | - toolEditOrganization:"编辑组织", | ||
22 | - parentOrganization:"上级组织", | 2 | + common: { |
3 | + createTime: '创建时间', | ||
4 | + updateTime: '更新时间', | ||
5 | + operation: '操作', | ||
6 | + remark: '备注', | ||
7 | + enable: '启用', | ||
8 | + disable: '禁用', | ||
9 | + sort: '排序', | ||
10 | + status: '状态', | ||
23 | }, | 11 | }, |
24 | - dept:{ | ||
25 | - queryDeptName:"部门名称", | ||
26 | - queryDeptStatus:"状态", | ||
27 | - toolDeptList:"部门列表", | ||
28 | - toolCreateDept:"新增部门", | ||
29 | - toolEditDept:"编辑部门", | ||
30 | - tableTitleDeptSort:"排序", | ||
31 | - tableTitleDeptCreateTime:"创建时间", | ||
32 | - tableTitleDeptOperation:"操作", | ||
33 | - drawerTitleDeptEnable:"启用", | ||
34 | - drawerTitleDeptDisable:"停用", | ||
35 | - drawerTitleDeptParentDept:"上级部门", | ||
36 | - tableTitleMemo:"备注" | 12 | + tenant: { |
13 | + tenant: '租户', | ||
14 | + tenantManagement: '租户管理', | ||
15 | + tenantSetting: '租户设置', | ||
37 | }, | 16 | }, |
38 | - system:{ | ||
39 | - system:"系统管理", | ||
40 | - accountManagement:"账号管理", | ||
41 | - roleManagement:"角色管理", | ||
42 | - menuManagement:"菜单管理", | ||
43 | - deptManagement:"部门管理", | ||
44 | - modifyPassword:"修改密码", | ||
45 | - pageSystemTitleCreateMenu:"新增菜单", | ||
46 | - pageSystemTitleCreateTenant:"新增租户", | ||
47 | - pageSystemTitleEditMenu:"编辑菜单", | ||
48 | - pageSystemTitleEditTenant:"编辑租户", | ||
49 | - pageSystemTitleOperation:"操作", | ||
50 | - pageSystemTitleWhetherDelete:"是否确认删除", | ||
51 | - pageSystemTitleMenuList:"菜单列表", | ||
52 | - menuEditPagesMenuType:"菜单类型", | ||
53 | - menuEditPagesDirectory:"目录", | ||
54 | - menuEditPagesMenu:"菜单", | ||
55 | - menuEditPagesButton:"按钮", | ||
56 | - menuEditPagesParentMenu:"上级菜单", | ||
57 | - menuEditPagesRouterAddress:"路由地址", | ||
58 | - menuEditPagesComponentsPath:"组件路径", | ||
59 | - menuEditPagesIsExt:"是否外链", | ||
60 | - menuEditPagesIsKeepAlive:"是否缓存", | ||
61 | - menuEditPagesIsHide:"是否隐藏", | ||
62 | - menuEditPagesYes:"是", | ||
63 | - menuEditPagesNo:"否", | ||
64 | - tableTitleSystemMenuName:"菜单名称", | ||
65 | - tableTitleSystemIcon:"图标", | ||
66 | - tableTitleSystemPermissionTag:"权限标识", | ||
67 | - tableTitleSystemComponents:"组件", | ||
68 | - tableTitleSystemSort:"排序", | ||
69 | - tableTitleSystemStatus:"状态", | ||
70 | - tableTitleSystemCreateTime:"创建时间", | ||
71 | - tableTitleSystemEnable:"启用", | ||
72 | - tableTitleSystemStop:"停用", | ||
73 | - tableSuccessStatus:"成功", | ||
74 | - tableFailedStatus:"失败", | ||
75 | - } | ||
76 | - }; | 17 | + organization: { |
18 | + queryOrganizationName: '组织名称', | ||
19 | + toolOrganizationList: '组织列表', | ||
20 | + toolCreateOrganization: '新增组织', | ||
21 | + toolEditOrganization: '编辑组织', | ||
22 | + parentOrganization: '上级组织', | ||
23 | + }, | ||
24 | + dept: { | ||
25 | + queryDeptName: '部门名称', | ||
26 | + queryDeptStatus: '状态', | ||
27 | + toolDeptList: '部门列表', | ||
28 | + toolCreateDept: '新增部门', | ||
29 | + toolEditDept: '编辑部门', | ||
30 | + tableTitleDeptSort: '排序', | ||
31 | + tableTitleDeptCreateTime: '创建时间', | ||
32 | + tableTitleDeptOperation: '操作', | ||
33 | + drawerTitleDeptEnable: '启用', | ||
34 | + drawerTitleDeptDisable: '停用', | ||
35 | + drawerTitleDeptParentDept: '上级部门', | ||
36 | + tableTitleMemo: '备注', | ||
37 | + }, | ||
38 | + system: { | ||
39 | + system: '系统管理', | ||
40 | + accountManagement: '账号管理', | ||
41 | + roleManagement: '角色管理', | ||
42 | + menuManagement: '菜单管理', | ||
43 | + deptManagement: '部门管理', | ||
44 | + modifyPassword: '修改密码', | ||
45 | + pageSystemTitleCreateMenu: '新增菜单', | ||
46 | + pageSystemTitleCreateTenant: '新增租户', | ||
47 | + pageSystemTitleEditMenu: '编辑菜单', | ||
48 | + pageSystemTitleEditTenant: '编辑租户', | ||
49 | + pageSystemTitleOperation: '操作', | ||
50 | + pageSystemTitleWhetherDelete: '是否确认删除', | ||
51 | + pageSystemTitleMenuList: '菜单列表', | ||
52 | + menuEditPagesMenuType: '菜单类型', | ||
53 | + menuEditPagesDirectory: '目录', | ||
54 | + menuEditPagesMenu: '菜单', | ||
55 | + menuEditPagesButton: '按钮', | ||
56 | + menuEditPagesParentMenu: '上级菜单', | ||
57 | + menuEditPagesRouterAddress: '路由地址', | ||
58 | + menuEditPagesComponentsPath: '组件路径', | ||
59 | + menuEditPagesIsExt: '是否外链', | ||
60 | + menuEditPagesIsKeepAlive: '是否缓存', | ||
61 | + menuEditPagesIsHide: '是否隐藏', | ||
62 | + menuEditPagesYes: '是', | ||
63 | + menuEditPagesNo: '否', | ||
64 | + tableTitleSystemMenuName: '菜单名称', | ||
65 | + tableTitleSystemIcon: '图标', | ||
66 | + tableTitleSystemPermissionTag: '权限标识', | ||
67 | + tableTitleSystemComponents: '组件', | ||
68 | + tableTitleSystemSort: '排序', | ||
69 | + tableTitleSystemStatus: '状态', | ||
70 | + tableTitleSystemCreateTime: '创建时间', | ||
71 | + tableTitleSystemEnable: '启用', | ||
72 | + tableTitleSystemStop: '停用', | ||
73 | + tableSuccessStatus: '成功', | ||
74 | + tableFailedStatus: '失败', | ||
75 | + }, | ||
76 | +}; |
@@ -2,7 +2,7 @@ export default { | @@ -2,7 +2,7 @@ export default { | ||
2 | api: { | 2 | api: { |
3 | operationFailed: '操作失败', | 3 | operationFailed: '操作失败', |
4 | errorTip: '错误提示', | 4 | errorTip: '错误提示', |
5 | - passwordOrUserNameError:'用户名或密码不正确', | 5 | + passwordOrUserNameError: '用户名或密码不正确', |
6 | loginFailed: '登录失败', | 6 | loginFailed: '登录失败', |
7 | errorMessage: '操作失败,系统异常!', | 7 | errorMessage: '操作失败,系统异常!', |
8 | timeoutMessage: '登录超时,请重新登录!', | 8 | timeoutMessage: '登录超时,请重新登录!', |
@@ -63,9 +63,9 @@ export function initAppConfigStore() { | @@ -63,9 +63,9 @@ export function initAppConfigStore() { | ||
63 | // init store | 63 | // init store |
64 | localeStore.initLocale(); | 64 | localeStore.initLocale(); |
65 | 65 | ||
66 | - const userInfo = Persistent.getLocal(USER_INFO_KEY) as UserInfo | 66 | + const userInfo = Persistent.getLocal(USER_INFO_KEY) as UserInfo; |
67 | const userStore = useUserStore(); | 67 | const userStore = useUserStore(); |
68 | - if(userInfo){ | 68 | + if (userInfo) { |
69 | userStore.setUserInfo(userInfo); | 69 | userStore.setUserInfo(userInfo); |
70 | userStore.jwtToken = Persistent.getLocal(JWT_TOKEN_KEY) as string; | 70 | userStore.jwtToken = Persistent.getLocal(JWT_TOKEN_KEY) as string; |
71 | userStore.refreshToken = Persistent.getLocal(REFRESH_TOKEN_KEY) as string; | 71 | userStore.refreshToken = Persistent.getLocal(REFRESH_TOKEN_KEY) as string; |
@@ -26,6 +26,9 @@ if (import.meta.env.DEV) { | @@ -26,6 +26,9 @@ if (import.meta.env.DEV) { | ||
26 | async function bootstrap() { | 26 | async function bootstrap() { |
27 | const app = createApp(App); | 27 | const app = createApp(App); |
28 | 28 | ||
29 | + // app.use(VueBaidu, { | ||
30 | + // ak: '7uOPPyAHn2Y2ZryeQqHtcRqtIY374vKa', | ||
31 | + // }); | ||
29 | // Configure store | 32 | // Configure store |
30 | setupStore(app); | 33 | setupStore(app); |
31 | 34 |
@@ -188,7 +188,7 @@ export const usePermissionStore = defineStore({ | @@ -188,7 +188,7 @@ export const usePermissionStore = defineStore({ | ||
188 | routeList = (await getMenuList()) as AppRouteRecordRaw[]; | 188 | routeList = (await getMenuList()) as AppRouteRecordRaw[]; |
189 | } catch (error) { | 189 | } catch (error) { |
190 | console.error(error); | 190 | console.error(error); |
191 | - } // Dynamically introduce components | 191 | + } // Dynamically introduce components |
192 | routeList = transformObjToRoute(routeList); | 192 | routeList = transformObjToRoute(routeList); |
193 | 193 | ||
194 | // Background routing to menu structure | 194 | // Background routing to menu structure |
@@ -4,15 +4,21 @@ import { defineStore } from 'pinia'; | @@ -4,15 +4,21 @@ import { defineStore } from 'pinia'; | ||
4 | import { store } from '/@/store'; | 4 | import { store } from '/@/store'; |
5 | import { RoleEnum } from '/@/enums/roleEnum'; | 5 | import { RoleEnum } from '/@/enums/roleEnum'; |
6 | import { PageEnum } from '/@/enums/pageEnum'; | 6 | import { PageEnum } from '/@/enums/pageEnum'; |
7 | -import { JWT_TOKEN_KEY, REFRESH_TOKEN_KEY, ROLES_KEY, TOKEN_KEY, USER_INFO_KEY } from '/@/enums/cacheEnum'; | 7 | +import { |
8 | + JWT_TOKEN_KEY, | ||
9 | + REFRESH_TOKEN_KEY, | ||
10 | + ROLES_KEY, | ||
11 | + TOKEN_KEY, | ||
12 | + USER_INFO_KEY, | ||
13 | +} from '/@/enums/cacheEnum'; | ||
8 | import { getAuthCache, setAuthCache } from '/@/utils/auth'; | 14 | import { getAuthCache, setAuthCache } from '/@/utils/auth'; |
9 | import { | 15 | import { |
10 | LoginParams, | 16 | LoginParams, |
11 | LoginResultModel, | 17 | LoginResultModel, |
12 | RefreshTokenParams, | 18 | RefreshTokenParams, |
13 | - SmsLoginParams | 19 | + SmsLoginParams, |
14 | } from '/@/api/sys/model/userModel'; | 20 | } from '/@/api/sys/model/userModel'; |
15 | -import {doRefreshToken, getMyInfo, loginApi, smsCodeLoginApi} from '/@/api/sys/user'; | 21 | +import { doRefreshToken, getMyInfo, loginApi, smsCodeLoginApi } from '/@/api/sys/user'; |
16 | import { useI18n } from '/@/hooks/web/useI18n'; | 22 | import { useI18n } from '/@/hooks/web/useI18n'; |
17 | import { useMessage } from '/@/hooks/web/useMessage'; | 23 | import { useMessage } from '/@/hooks/web/useMessage'; |
18 | import { router } from '/@/router'; | 24 | import { router } from '/@/router'; |
@@ -26,8 +32,8 @@ interface UserState { | @@ -26,8 +32,8 @@ interface UserState { | ||
26 | roleList: RoleEnum[]; | 32 | roleList: RoleEnum[]; |
27 | sessionTimeout?: boolean; | 33 | sessionTimeout?: boolean; |
28 | lastUpdateTime: number; | 34 | lastUpdateTime: number; |
29 | - jwtToken?:string; | ||
30 | - refreshToken?:string; | 35 | + jwtToken?: string; |
36 | + refreshToken?: string; | ||
31 | } | 37 | } |
32 | 38 | ||
33 | export const useUserStore = defineStore({ | 39 | export const useUserStore = defineStore({ |
@@ -38,7 +44,7 @@ export const useUserStore = defineStore({ | @@ -38,7 +44,7 @@ export const useUserStore = defineStore({ | ||
38 | // token | 44 | // token |
39 | jwtToken: undefined, | 45 | jwtToken: undefined, |
40 | //refresh Token | 46 | //refresh Token |
41 | - refreshToken:undefined, | 47 | + refreshToken: undefined, |
42 | // roleList | 48 | // roleList |
43 | roleList: [], | 49 | roleList: [], |
44 | // Whether the login expired | 50 | // Whether the login expired |
@@ -67,11 +73,11 @@ export const useUserStore = defineStore({ | @@ -67,11 +73,11 @@ export const useUserStore = defineStore({ | ||
67 | }, | 73 | }, |
68 | }, | 74 | }, |
69 | actions: { | 75 | actions: { |
70 | - storeToken(jwtToken:string,refreshToken:string){ | 76 | + storeToken(jwtToken: string, refreshToken: string) { |
71 | this.jwtToken = jwtToken; | 77 | this.jwtToken = jwtToken; |
72 | this.refreshToken = refreshToken; | 78 | this.refreshToken = refreshToken; |
73 | - setAuthCache(JWT_TOKEN_KEY,jwtToken); | ||
74 | - setAuthCache(REFRESH_TOKEN_KEY,refreshToken); | 79 | + setAuthCache(JWT_TOKEN_KEY, jwtToken); |
80 | + setAuthCache(REFRESH_TOKEN_KEY, refreshToken); | ||
75 | }, | 81 | }, |
76 | setToken(info: string | undefined) { | 82 | setToken(info: string | undefined) { |
77 | this.token = info; | 83 | this.token = info; |
@@ -107,34 +113,34 @@ export const useUserStore = defineStore({ | @@ -107,34 +113,34 @@ export const useUserStore = defineStore({ | ||
107 | try { | 113 | try { |
108 | const { goHome = true, mode, ...loginParams } = params; | 114 | const { goHome = true, mode, ...loginParams } = params; |
109 | const data = await loginApi(loginParams, mode); | 115 | const data = await loginApi(loginParams, mode); |
110 | - return this.process(data,goHome); | 116 | + return this.process(data, goHome); |
111 | } catch (error) { | 117 | } catch (error) { |
112 | return Promise.reject(error); | 118 | return Promise.reject(error); |
113 | } | 119 | } |
114 | }, | 120 | }, |
115 | - async process(data: LoginResultModel, goHome?: boolean): Promise<UserInfo | null> { | ||
116 | - const {token, refreshToken} = data; | ||
117 | - this.storeToken(token, refreshToken); | ||
118 | - // get user info | ||
119 | - const userInfo = await this.getMyUserInfoAction(); | 121 | + async process(data: LoginResultModel, goHome?: boolean): Promise<UserInfo | null> { |
122 | + const { token, refreshToken } = data; | ||
123 | + this.storeToken(token, refreshToken); | ||
124 | + // get user info | ||
125 | + const userInfo = await this.getMyUserInfoAction(); | ||
120 | 126 | ||
121 | - const sessionTimeout = this.sessionTimeout; | ||
122 | - if (sessionTimeout) { | ||
123 | - this.setSessionTimeout(false); | ||
124 | - } else if (goHome) { | ||
125 | - const permissionStore = usePermissionStore(); | ||
126 | - if (!permissionStore.isDynamicAddedRoute) { | ||
127 | - const routes = await permissionStore.buildRoutesAction(); | ||
128 | - routes.forEach((route) => { | ||
129 | - router.addRoute(route as unknown as RouteRecordRaw); | ||
130 | - }); | ||
131 | - router.addRoute(PAGE_NOT_FOUND_ROUTE as unknown as RouteRecordRaw); | ||
132 | - permissionStore.setDynamicAddedRoute(true); | ||
133 | - } | ||
134 | - await router.replace(userInfo.homePath || PageEnum.BASE_HOME); | ||
135 | - } | ||
136 | - return userInfo; | ||
137 | - }, | 127 | + const sessionTimeout = this.sessionTimeout; |
128 | + if (sessionTimeout) { | ||
129 | + this.setSessionTimeout(false); | ||
130 | + } else if (goHome) { | ||
131 | + const permissionStore = usePermissionStore(); | ||
132 | + if (!permissionStore.isDynamicAddedRoute) { | ||
133 | + const routes = await permissionStore.buildRoutesAction(); | ||
134 | + routes.forEach((route) => { | ||
135 | + router.addRoute(route as unknown as RouteRecordRaw); | ||
136 | + }); | ||
137 | + router.addRoute(PAGE_NOT_FOUND_ROUTE as unknown as RouteRecordRaw); | ||
138 | + permissionStore.setDynamicAddedRoute(true); | ||
139 | + } | ||
140 | + await router.replace(userInfo.homePath || PageEnum.BASE_HOME); | ||
141 | + } | ||
142 | + return userInfo; | ||
143 | + }, | ||
138 | async smsCodelogin( | 144 | async smsCodelogin( |
139 | params: SmsLoginParams & { | 145 | params: SmsLoginParams & { |
140 | goHome?: boolean; | 146 | goHome?: boolean; |
@@ -144,7 +150,7 @@ export const useUserStore = defineStore({ | @@ -144,7 +150,7 @@ export const useUserStore = defineStore({ | ||
144 | try { | 150 | try { |
145 | const { goHome = true, mode, ...loginParams } = params; | 151 | const { goHome = true, mode, ...loginParams } = params; |
146 | const data = await smsCodeLoginApi(loginParams, mode); | 152 | const data = await smsCodeLoginApi(loginParams, mode); |
147 | - return this.process(data,goHome); | 153 | + return this.process(data, goHome); |
148 | } catch (error) { | 154 | } catch (error) { |
149 | return Promise.reject(error); | 155 | return Promise.reject(error); |
150 | } | 156 | } |
@@ -167,21 +173,21 @@ export const useUserStore = defineStore({ | @@ -167,21 +173,21 @@ export const useUserStore = defineStore({ | ||
167 | // console.log('注销Token失败'); | 173 | // console.log('注销Token失败'); |
168 | // } | 174 | // } |
169 | this.resetState(); | 175 | this.resetState(); |
170 | - setAuthCache(JWT_TOKEN_KEY,undefined); | ||
171 | - setAuthCache(REFRESH_TOKEN_KEY,undefined); | 176 | + setAuthCache(JWT_TOKEN_KEY, undefined); |
177 | + setAuthCache(REFRESH_TOKEN_KEY, undefined); | ||
172 | // this.setSessionTimeout(false); | 178 | // this.setSessionTimeout(false); |
173 | // goLogin && router.push(PageEnum.BASE_LOGIN); | 179 | // goLogin && router.push(PageEnum.BASE_LOGIN); |
174 | await router.push(PageEnum.BASE_LOGIN); | 180 | await router.push(PageEnum.BASE_LOGIN); |
175 | }, | 181 | }, |
176 | 182 | ||
177 | - async doRefresh(){ | ||
178 | - try{ | ||
179 | - const req = {"refreshToken":this.refreshToken} as RefreshTokenParams; | 183 | + async doRefresh() { |
184 | + try { | ||
185 | + const req = { refreshToken: this.refreshToken } as RefreshTokenParams; | ||
180 | const data = await doRefreshToken(req); | 186 | const data = await doRefreshToken(req); |
181 | const { token, refreshToken } = data; | 187 | const { token, refreshToken } = data; |
182 | - this.storeToken(token,refreshToken); | ||
183 | - }catch(error){ | ||
184 | - this.logout() | 188 | + this.storeToken(token, refreshToken); |
189 | + } catch (error) { | ||
190 | + this.logout(); | ||
185 | } | 191 | } |
186 | }, | 192 | }, |
187 | 193 | ||
@@ -207,4 +213,3 @@ export const useUserStore = defineStore({ | @@ -207,4 +213,3 @@ export const useUserStore = defineStore({ | ||
207 | export function useUserStoreWithOut() { | 213 | export function useUserStoreWithOut() { |
208 | return useUserStore(store); | 214 | return useUserStore(store); |
209 | } | 215 | } |
210 | - |
1 | import { Persistent, BasicKeys } from '/@/utils/cache/persistent'; | 1 | import { Persistent, BasicKeys } from '/@/utils/cache/persistent'; |
2 | import { CacheTypeEnum } from '/@/enums/cacheEnum'; | 2 | import { CacheTypeEnum } from '/@/enums/cacheEnum'; |
3 | import projectSetting from '/@/settings/projectSetting'; | 3 | import projectSetting from '/@/settings/projectSetting'; |
4 | -import { JWT_TOKEN_KEY,REFRESH_TOKEN_KEY } from '/@/enums/cacheEnum'; | 4 | +import { JWT_TOKEN_KEY, REFRESH_TOKEN_KEY } from '/@/enums/cacheEnum'; |
5 | 5 | ||
6 | const { permissionCacheType } = projectSetting; | 6 | const { permissionCacheType } = projectSetting; |
7 | const isLocal = permissionCacheType === CacheTypeEnum.LOCAL; | 7 | const isLocal = permissionCacheType === CacheTypeEnum.LOCAL; |
@@ -20,9 +20,9 @@ export function clearAuthCache(immediate = true) { | @@ -20,9 +20,9 @@ export function clearAuthCache(immediate = true) { | ||
20 | const fn = isLocal ? Persistent.clearLocal : Persistent.clearSession; | 20 | const fn = isLocal ? Persistent.clearLocal : Persistent.clearSession; |
21 | return fn(immediate); | 21 | return fn(immediate); |
22 | } | 22 | } |
23 | -export function getJwtToken(){ | ||
24 | - return getAuthCache(JWT_TOKEN_KEY); | 23 | +export function getJwtToken() { |
24 | + return getAuthCache(JWT_TOKEN_KEY); | ||
25 | } | 25 | } |
26 | -export function getRefreshToken(){ | 26 | +export function getRefreshToken() { |
27 | return getAuthCache(REFRESH_TOKEN_KEY); | 27 | return getAuthCache(REFRESH_TOKEN_KEY); |
28 | } | 28 | } |
@@ -105,11 +105,23 @@ window.addEventListener('beforeunload', function () { | @@ -105,11 +105,23 @@ window.addEventListener('beforeunload', function () { | ||
105 | // LOCK_INFO_KEY 在锁屏和解锁时写入,此处也不应修改 | 105 | // LOCK_INFO_KEY 在锁屏和解锁时写入,此处也不应修改 |
106 | ls.set(APP_LOCAL_CACHE_KEY, { | 106 | ls.set(APP_LOCAL_CACHE_KEY, { |
107 | ...omit(localMemory.getCache, LOCK_INFO_KEY), | 107 | ...omit(localMemory.getCache, LOCK_INFO_KEY), |
108 | - ...pick(ls.get(APP_LOCAL_CACHE_KEY), [TOKEN_KEY,JWT_TOKEN_KEY,REFRESH_TOKEN_KEY, USER_INFO_KEY, LOCK_INFO_KEY]), | 108 | + ...pick(ls.get(APP_LOCAL_CACHE_KEY), [ |
109 | + TOKEN_KEY, | ||
110 | + JWT_TOKEN_KEY, | ||
111 | + REFRESH_TOKEN_KEY, | ||
112 | + USER_INFO_KEY, | ||
113 | + LOCK_INFO_KEY, | ||
114 | + ]), | ||
109 | }); | 115 | }); |
110 | ss.set(APP_SESSION_CACHE_KEY, { | 116 | ss.set(APP_SESSION_CACHE_KEY, { |
111 | ...omit(sessionMemory.getCache, LOCK_INFO_KEY), | 117 | ...omit(sessionMemory.getCache, LOCK_INFO_KEY), |
112 | - ...pick(ss.get(APP_SESSION_CACHE_KEY), [TOKEN_KEY,JWT_TOKEN_KEY,REFRESH_TOKEN_KEY, USER_INFO_KEY, LOCK_INFO_KEY]), | 118 | + ...pick(ss.get(APP_SESSION_CACHE_KEY), [ |
119 | + TOKEN_KEY, | ||
120 | + JWT_TOKEN_KEY, | ||
121 | + REFRESH_TOKEN_KEY, | ||
122 | + USER_INFO_KEY, | ||
123 | + LOCK_INFO_KEY, | ||
124 | + ]), | ||
113 | }); | 125 | }); |
114 | }); | 126 | }); |
115 | 127 |
src/utils/fnUtils.ts
0 → 100644
1 | +export const copyTransFun = (arr: any[]) => { | ||
2 | + arr.forEach((item) => { | ||
3 | + if (item.name) { | ||
4 | + item.label = item.name; | ||
5 | + delete item.name; | ||
6 | + } | ||
7 | + if (item.id) { | ||
8 | + item.value = item.id; | ||
9 | + delete item.id; | ||
10 | + } | ||
11 | + if (item.children) { | ||
12 | + if (item.children.length) { | ||
13 | + copyTransFun(item.children); | ||
14 | + } | ||
15 | + } | ||
16 | + }); | ||
17 | +}; |
@@ -10,7 +10,7 @@ import { ContentTypeEnum } from '/@/enums/httpEnum'; | @@ -10,7 +10,7 @@ import { ContentTypeEnum } from '/@/enums/httpEnum'; | ||
10 | import { RequestEnum } from '/@/enums/httpEnum'; | 10 | import { RequestEnum } from '/@/enums/httpEnum'; |
11 | import { useUserStore } from '/@/store/modules/user'; | 11 | import { useUserStore } from '/@/store/modules/user'; |
12 | import { JwtModel } from '/@/api/sys/jwtModel'; | 12 | import { JwtModel } from '/@/api/sys/jwtModel'; |
13 | -import jwt_decode from "jwt-decode"; | 13 | +import jwt_decode from 'jwt-decode'; |
14 | 14 | ||
15 | export * from './axiosTransform'; | 15 | export * from './axiosTransform'; |
16 | 16 | ||
@@ -20,14 +20,14 @@ export * from './axiosTransform'; | @@ -20,14 +20,14 @@ export * from './axiosTransform'; | ||
20 | export class VAxios { | 20 | export class VAxios { |
21 | private axiosInstance: AxiosInstance; | 21 | private axiosInstance: AxiosInstance; |
22 | private readonly options: CreateAxiosOptions; | 22 | private readonly options: CreateAxiosOptions; |
23 | - private waitingQueue:any[]; | 23 | + private waitingQueue: any[]; |
24 | private refreshing = false; | 24 | private refreshing = false; |
25 | 25 | ||
26 | constructor(options: CreateAxiosOptions) { | 26 | constructor(options: CreateAxiosOptions) { |
27 | this.options = options; | 27 | this.options = options; |
28 | this.axiosInstance = axios.create(options); | 28 | this.axiosInstance = axios.create(options); |
29 | this.setupInterceptors(); | 29 | this.setupInterceptors(); |
30 | - this.waitingQueue=[]; | 30 | + this.waitingQueue = []; |
31 | } | 31 | } |
32 | 32 | ||
33 | /** | 33 | /** |
@@ -69,15 +69,15 @@ export class VAxios { | @@ -69,15 +69,15 @@ export class VAxios { | ||
69 | * JWT 自动刷新 | 69 | * JWT 自动刷新 |
70 | * @description: 自动刷新token | 70 | * @description: 自动刷新token |
71 | */ | 71 | */ |
72 | - private isNeedTokenURL(url, arr = ['/auth/login', '/auth/token']) { | 72 | + private isNeedTokenURL(url, arr = ['/auth/login', '/auth/token']) { |
73 | return !arr.some((val) => url.indexOf(val) > -1); | 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 | // 创建一个未完成的promise,把改变状态的resolve方法交给请求token结束后执行 | 81 | // 创建一个未完成的promise,把改变状态的resolve方法交给请求token结束后执行 |
82 | const promise = new Promise((resolve) => { | 82 | const promise = new Promise((resolve) => { |
83 | console.log('等待新token'); | 83 | console.log('等待新token'); |
@@ -88,7 +88,7 @@ export class VAxios { | @@ -88,7 +88,7 @@ export class VAxios { | ||
88 | this.refreshing = true; | 88 | this.refreshing = true; |
89 | // 模拟请求刷新Token接口,当接口返回数据时执行then方法 TODO 添加catch捕获异常 | 89 | // 模拟请求刷新Token接口,当接口返回数据时执行then方法 TODO 添加catch捕获异常 |
90 | doRefreshTokenApi().then(() => { | 90 | doRefreshTokenApi().then(() => { |
91 | - console.log('刷新token成功,放行队列中的请求',this.waitingQueue.length); | 91 | + console.log('刷新token成功,放行队列中的请求', this.waitingQueue.length); |
92 | this.refreshing = false; | 92 | this.refreshing = false; |
93 | this.waitingQueue.forEach((cb) => cb()); | 93 | this.waitingQueue.forEach((cb) => cb()); |
94 | this.waitingQueue.length = 0; | 94 | this.waitingQueue.length = 0; |
@@ -116,19 +116,18 @@ export class VAxios { | @@ -116,19 +116,18 @@ export class VAxios { | ||
116 | // Request interceptor configuration processing | 116 | // Request interceptor configuration processing |
117 | this.axiosInstance.interceptors.request.use(async (config: AxiosRequestConfig) => { | 117 | this.axiosInstance.interceptors.request.use(async (config: AxiosRequestConfig) => { |
118 | // If cancel repeat request is turned on, then cancel repeat request is prohibited | 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 | userStore.logout(); | 128 | userStore.logout(); |
129 | - } | ||
130 | - | ||
131 | - } | 129 | + } |
130 | + } | ||
132 | const { | 131 | const { |
133 | headers: { ignoreCancelToken }, | 132 | headers: { ignoreCancelToken }, |
134 | } = config; | 133 | } = config; |
@@ -93,7 +93,7 @@ const transform: AxiosTransform = { | @@ -93,7 +93,7 @@ const transform: AxiosTransform = { | ||
93 | const token = getJwtToken(); | 93 | const token = getJwtToken(); |
94 | if (token && (config as Recordable)?.requestOptions?.withToken !== false) { | 94 | if (token && (config as Recordable)?.requestOptions?.withToken !== false) { |
95 | // jwt token | 95 | // jwt token |
96 | - config.headers["X-Authorization"] = options.authenticationScheme | 96 | + config.headers['X-Authorization'] = options.authenticationScheme |
97 | ? `${options.authenticationScheme} ${token}` | 97 | ? `${options.authenticationScheme} ${token}` |
98 | : token; | 98 | : token; |
99 | } | 99 | } |
@@ -111,10 +111,10 @@ const transform: AxiosTransform = { | @@ -111,10 +111,10 @@ const transform: AxiosTransform = { | ||
111 | * @description: 响应错误处理 | 111 | * @description: 响应错误处理 |
112 | */ | 112 | */ |
113 | responseInterceptorsCatch: (error: any) => { | 113 | responseInterceptorsCatch: (error: any) => { |
114 | - const {t} = useI18n(); | 114 | + const { t } = useI18n(); |
115 | const errorLogStore = useErrorLogStoreWithOut(); | 115 | const errorLogStore = useErrorLogStoreWithOut(); |
116 | errorLogStore.addAjaxErrorInfo(error); | 116 | errorLogStore.addAjaxErrorInfo(error); |
117 | - const {response, code, message, config} = error || {}; | 117 | + const { response, code, message, config } = error || {}; |
118 | const errorMessageMode = config?.requestOptions?.errorMessageMode || 'none'; | 118 | const errorMessageMode = config?.requestOptions?.errorMessageMode || 'none'; |
119 | const msg: string = response?.data?.msg ?? ''; | 119 | const msg: string = response?.data?.msg ?? ''; |
120 | const err: string = error?.toString?.() ?? ''; | 120 | const err: string = error?.toString?.() ?? ''; |
@@ -130,13 +130,13 @@ const transform: AxiosTransform = { | @@ -130,13 +130,13 @@ const transform: AxiosTransform = { | ||
130 | 130 | ||
131 | if (errMessage) { | 131 | if (errMessage) { |
132 | if (errorMessageMode === 'modal') { | 132 | if (errorMessageMode === 'modal') { |
133 | - createErrorModal({title: t('sys.api.errorTip'), content: errMessage}); | 133 | + createErrorModal({ title: t('sys.api.errorTip'), content: errMessage }); |
134 | } else if (errorMessageMode === 'message') { | 134 | } else if (errorMessageMode === 'message') { |
135 | createMessage.error(errMessage); | 135 | createMessage.error(errMessage); |
136 | } | 136 | } |
137 | return Promise.reject(error); | 137 | return Promise.reject(error); |
138 | } | 138 | } |
139 | - } catch (error) { | 139 | + } catch (error: any) { |
140 | throw new Error(error); | 140 | throw new Error(error); |
141 | } | 141 | } |
142 | 142 |
1 | /* list To Tree */ | 1 | /* list To Tree */ |
2 | 2 | ||
3 | -import {getMenuListResultModel} from "/@/api/sys/model/menuModel"; | ||
4 | -import {useI18n} from "/@/hooks/web/useI18n"; | ||
5 | - | 3 | +import { getMenuListResultModel } from '/@/api/sys/model/menuModel'; |
4 | +import { useI18n } from '/@/hooks/web/useI18n'; | ||
6 | 5 | ||
7 | export function listToTree(lists: getMenuListResultModel): getMenuListResultModel { | 6 | export function listToTree(lists: getMenuListResultModel): getMenuListResultModel { |
8 | const { t } = useI18n(); //加载国际化 | 7 | const { t } = useI18n(); //加载国际化 |
9 | - lists.forEach(goods => { | 8 | + lists.forEach((goods) => { |
10 | goods['menuName'] = t(goods.meta.title); // 为goods添加属性menuName | 9 | goods['menuName'] = t(goods.meta.title); // 为goods添加属性menuName |
11 | 10 | ||
12 | // console.log(goods.children?.length); | 11 | // console.log(goods.children?.length); |
13 | - if(goods.children?.length){ | ||
14 | - goods.children.forEach(goodChildren => { | 12 | + if (goods.children?.length) { |
13 | + goods.children.forEach((goodChildren) => { | ||
15 | goodChildren['menuName'] = t(goodChildren.meta.title); // 为goodChildren添加属性menuName | 14 | goodChildren['menuName'] = t(goodChildren.meta.title); // 为goodChildren添加属性menuName |
16 | - }) | 15 | + }); |
17 | } | 16 | } |
18 | - }) | 17 | + }); |
19 | 18 | ||
20 | return lists; | 19 | return lists; |
21 | - | ||
22 | } | 20 | } |
23 | - | ||
24 | - | ||
25 | - | ||
26 | - | ||
27 | - | ||
28 | - | ||
29 | - |
src/views/alarm/position/config.data.ts
0 → 100644
1 | +import { FormSchema } from '/@/components/Table'; | ||
2 | +export const formSchema: FormSchema[] = [ | ||
3 | + { | ||
4 | + field: 'organization', | ||
5 | + label: '', | ||
6 | + component: 'TreeSelect', | ||
7 | + componentProps: {}, | ||
8 | + }, | ||
9 | + { | ||
10 | + field: 'organization', | ||
11 | + label: '', | ||
12 | + component: 'Select', | ||
13 | + componentProps: {}, | ||
14 | + }, | ||
15 | + { | ||
16 | + field: 'device', | ||
17 | + label: '', | ||
18 | + slot: 'device', | ||
19 | + component: 'Input', | ||
20 | + }, | ||
21 | +]; |
src/views/alarm/position/index.vue
0 → 100644
1 | +<template> | ||
2 | + <div class="wrapper"> | ||
3 | + <div ref="wrapRef" :style="{ height, width }"> </div> | ||
4 | + <div class="right-wrap"> | ||
5 | + <BasicForm @register="registerForm"> | ||
6 | + <template #device> | ||
7 | + <div class="flex justify-between"> | ||
8 | + <a-input v-model:value="deviceValue" placeholder="请输入设备名称" style="width: 70%" /> | ||
9 | + <a-button color="success" @click="handleReset" class="w-1/4">复位查询</a-button> | ||
10 | + </div> | ||
11 | + </template> | ||
12 | + </BasicForm> | ||
13 | + <div> | ||
14 | + <RadioGroup v-model:value="deviceStatus"> | ||
15 | + <Radio :value="1">全部</Radio> | ||
16 | + <Radio :value="2">在线</Radio> | ||
17 | + <Radio :value="3">离线</Radio> | ||
18 | + <Radio :value="4">报警</Radio> | ||
19 | + </RadioGroup> | ||
20 | + <div class="scroll-wrap"> | ||
21 | + <ScrollContainer ref="scrollRef"> | ||
22 | + <template | ||
23 | + v-for="(item, index) in 10" | ||
24 | + :key="index" | ||
25 | + :class="{ active: currentIndex == index }" | ||
26 | + @click="bander(index)" | ||
27 | + > | ||
28 | + <div class="flex" style="border-bottom: 1px solid #ccc"> | ||
29 | + <div> | ||
30 | + <div class="flex"> | ||
31 | + <div class="font-bold ml-5">名称 </div> | ||
32 | + <div class="ml-5">发动机{{ item }}</div> | ||
33 | + </div> | ||
34 | + <div class="flex"> | ||
35 | + <div class="font-bold ml-5">位置 </div> | ||
36 | + <div class="ml-5 font-bold">四川省成都市高新区{{ item }}</div> | ||
37 | + </div> | ||
38 | + </div> | ||
39 | + <div class="self-center ml-10"><Tag color="default">离线</Tag></div> | ||
40 | + </div> | ||
41 | + </template> | ||
42 | + </ScrollContainer> | ||
43 | + </div> | ||
44 | + <div class="flex justify-end"> | ||
45 | + <Pagination v-model:current="current" :total="50" size="small" show-less-items /> | ||
46 | + </div> | ||
47 | + </div> | ||
48 | + </div> | ||
49 | + </div> | ||
50 | +</template> | ||
51 | +<script lang="ts"> | ||
52 | + import { defineComponent, ref, nextTick, unref, onMounted } from 'vue'; | ||
53 | + import { useScript } from '/@/hooks/web/useScript'; | ||
54 | + import { BasicForm, useForm } from '/@/components/Form/index'; | ||
55 | + import { formSchema } from './config.data'; | ||
56 | + import { RadioGroup, Radio, Tag, Pagination } from 'ant-design-vue'; | ||
57 | + import { ScrollContainer, ScrollActionType } from '/@/components/Container/index'; | ||
58 | + export default defineComponent({ | ||
59 | + name: 'BaiduMap', | ||
60 | + components: { | ||
61 | + BasicForm, | ||
62 | + RadioGroup, | ||
63 | + Radio, | ||
64 | + Tag, | ||
65 | + ScrollContainer, | ||
66 | + Pagination, | ||
67 | + }, | ||
68 | + props: { | ||
69 | + width: { | ||
70 | + type: String, | ||
71 | + default: '100%', | ||
72 | + }, | ||
73 | + height: { | ||
74 | + type: String, | ||
75 | + default: 'calc(100vh - 78px)', | ||
76 | + }, | ||
77 | + }, | ||
78 | + | ||
79 | + setup() { | ||
80 | + const BAI_DU_MAP_URL = | ||
81 | + 'https://api.map.baidu.com/getscript?v=3.0&ak=7uOPPyAHn2Y2ZryeQqHtcRqtIY374vKa'; | ||
82 | + const wrapRef = ref<HTMLDivElement | null>(null); | ||
83 | + const scrollRef = ref<Nullable<ScrollActionType>>(null); | ||
84 | + const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); | ||
85 | + async function initMap() { | ||
86 | + await toPromise(); | ||
87 | + await nextTick(); | ||
88 | + const wrapEl = unref(wrapRef); | ||
89 | + const BMap = (window as any).BMap; | ||
90 | + if (!wrapEl) return; | ||
91 | + const map = new BMap.Map(wrapEl); | ||
92 | + const point = new BMap.Point(116.14282, 35.19515); | ||
93 | + map.centerAndZoom(point, 15); | ||
94 | + map.enableScrollWheelZoom(true); | ||
95 | + } | ||
96 | + onMounted(() => { | ||
97 | + initMap(); | ||
98 | + }); | ||
99 | + const deviceValue = ref(''); | ||
100 | + const deviceStatus = ref(1); | ||
101 | + const current = ref(2); | ||
102 | + const currentIndex = ref(1); | ||
103 | + const bander = (index: number) => { | ||
104 | + currentIndex.value = index; | ||
105 | + }; | ||
106 | + const [registerForm] = useForm({ | ||
107 | + labelWidth: 90, | ||
108 | + schemas: formSchema, | ||
109 | + showActionButtonGroup: false, | ||
110 | + }); | ||
111 | + const handleReset = () => { | ||
112 | + deviceValue.value = ''; | ||
113 | + }; | ||
114 | + return { | ||
115 | + wrapRef, | ||
116 | + registerForm, | ||
117 | + deviceValue, | ||
118 | + deviceStatus, | ||
119 | + handleReset, | ||
120 | + scrollRef, | ||
121 | + current, | ||
122 | + currentIndex, | ||
123 | + bander, | ||
124 | + }; | ||
125 | + }, | ||
126 | + }); | ||
127 | +</script> | ||
128 | + | ||
129 | +<style scoped> | ||
130 | + .wrapper { | ||
131 | + position: relative; | ||
132 | + } | ||
133 | + .active { | ||
134 | + background-color: #fff; | ||
135 | + } | ||
136 | + .right-wrap { | ||
137 | + padding-top: 10px; | ||
138 | + width: 20%; | ||
139 | + height: 80%; | ||
140 | + position: absolute; | ||
141 | + right: 5%; | ||
142 | + top: 10%; | ||
143 | + background-color: #f3f8fe; | ||
144 | + } | ||
145 | + .scroll-wrap { | ||
146 | + height: 450px; | ||
147 | + background-color: #f3f8fe; | ||
148 | + } | ||
149 | +</style> |
src/views/alarm/template/ContactDrawer.vue
renamed from
src/views/device/DeviceDrawer.vue
@@ -4,10 +4,10 @@ | @@ -4,10 +4,10 @@ | ||
4 | @register="registerDrawer" | 4 | @register="registerDrawer" |
5 | showFooter | 5 | showFooter |
6 | :title="getTitle" | 6 | :title="getTitle" |
7 | - width="500px" | 7 | + width="30%" |
8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
9 | > | 9 | > |
10 | - <BasicForm @register="registerForm"/> | 10 | + <BasicForm @register="registerForm" /> |
11 | </BasicDrawer> | 11 | </BasicDrawer> |
12 | </template> | 12 | </template> |
13 | <script lang="ts"> | 13 | <script lang="ts"> |
@@ -15,17 +15,17 @@ | @@ -15,17 +15,17 @@ | ||
15 | import { BasicForm, useForm } from '/@/components/Form'; | 15 | import { BasicForm, useForm } from '/@/components/Form'; |
16 | import { formSchema } from './config.data'; | 16 | import { formSchema } from './config.data'; |
17 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 17 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
18 | - import {saveOrEditMessageConfig} from "/@/api/message/config"; | ||
19 | - import {useMessage} from "/@/hooks/web/useMessage"; | 18 | + import { saveOrEditAlarmContact } from '/@/api/alarm/contact/alarmContact'; |
19 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
20 | 20 | ||
21 | export default defineComponent({ | 21 | export default defineComponent({ |
22 | - name: 'ConfigDrawer', | 22 | + name: 'ContactDrawer', |
23 | components: { BasicDrawer, BasicForm }, | 23 | components: { BasicDrawer, BasicForm }, |
24 | emits: ['success', 'register'], | 24 | emits: ['success', 'register'], |
25 | setup(_, { emit }) { | 25 | setup(_, { emit }) { |
26 | const isUpdate = ref(true); | 26 | const isUpdate = ref(true); |
27 | 27 | ||
28 | - const [registerForm, { validate,setFieldsValue,resetFields }] = useForm({ | 28 | + const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ |
29 | labelWidth: 120, | 29 | labelWidth: 120, |
30 | schemas: formSchema, | 30 | schemas: formSchema, |
31 | showActionButtonGroup: false, | 31 | showActionButtonGroup: false, |
@@ -36,53 +36,34 @@ | @@ -36,53 +36,34 @@ | ||
36 | setDrawerProps({ confirmLoading: false }); | 36 | setDrawerProps({ confirmLoading: false }); |
37 | isUpdate.value = !!data?.isUpdate; | 37 | isUpdate.value = !!data?.isUpdate; |
38 | if (unref(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({ | 39 | await setFieldsValue({ |
44 | ...data.record, | 40 | ...data.record, |
45 | }); | 41 | }); |
46 | } | 42 | } |
47 | }); | 43 | }); |
48 | 44 | ||
49 | - const getTitle = computed(() => (!unref(isUpdate) ? '新增消息配置' : '编辑消息配置')); | 45 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增联系人配置' : '编辑联系人配置')); |
50 | 46 | ||
51 | async function handleSubmit() { | 47 | async function handleSubmit() { |
52 | try { | 48 | try { |
53 | const values = await validate(); | 49 | const values = await validate(); |
54 | const { createMessage } = useMessage(); | 50 | const { createMessage } = useMessage(); |
55 | setDrawerProps({ confirmLoading: true }); | 51 | setDrawerProps({ confirmLoading: true }); |
56 | - let config={}; | ||
57 | - if(values.messageType === 'PHONE_MESSAGE'){ | ||
58 | - config ={ | ||
59 | - "accessKeyId":values.accessKeyId, | ||
60 | - "accessKeySecret":values.accessKeySecret, | ||
61 | - } | ||
62 | - }else if(values.messageType === 'EMAIL_MESSAGE'){ | ||
63 | - config ={ | ||
64 | - "host":values.host, | ||
65 | - "port":values.port, | ||
66 | - "username":values.username, | ||
67 | - "password":values.password, | ||
68 | - } | ||
69 | - } | ||
70 | - Reflect.set(values, 'config', config); | ||
71 | - let saveMessage = "添加成功"; | ||
72 | - let updateMessage = "修改成功"; | ||
73 | - await saveOrEditMessageConfig(values, unref(isUpdate)); | 52 | + let saveMessage = '添加成功'; |
53 | + let updateMessage = '修改成功'; | ||
54 | + await saveOrEditAlarmContact(values, unref(isUpdate)); | ||
74 | closeDrawer(); | 55 | closeDrawer(); |
75 | emit('success'); | 56 | emit('success'); |
76 | - createMessage.success(unref(isUpdate)?updateMessage:saveMessage); | 57 | + createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); |
77 | } finally { | 58 | } finally { |
78 | setDrawerProps({ confirmLoading: false }); | 59 | setDrawerProps({ confirmLoading: false }); |
79 | } | 60 | } |
80 | } | 61 | } |
81 | 62 | ||
82 | return { | 63 | return { |
64 | + getTitle, | ||
83 | registerDrawer, | 65 | registerDrawer, |
84 | registerForm, | 66 | registerForm, |
85 | - getTitle, | ||
86 | handleSubmit, | 67 | handleSubmit, |
87 | }; | 68 | }; |
88 | }, | 69 | }, |
src/views/alarm/template/config.data.ts
0 → 100644
1 | +import { BasicColumn } from '/@/components/Table'; | ||
2 | +import { FormSchema } from '/@/components/Table'; | ||
3 | +import { getOrganizationList } from '/@/api/system/system'; | ||
4 | +import { copyTransFun } from '/@/utils/fnUtils'; | ||
5 | +// 表格列数据 | ||
6 | +export const columns: BasicColumn[] = [ | ||
7 | + { | ||
8 | + title: '姓名', | ||
9 | + dataIndex: 'username', | ||
10 | + width: 120, | ||
11 | + }, | ||
12 | + { | ||
13 | + title: '所属组织', | ||
14 | + dataIndex: 'organizationId', | ||
15 | + width: 160, | ||
16 | + }, | ||
17 | + { | ||
18 | + title: '手机', | ||
19 | + dataIndex: 'phone', | ||
20 | + width: 160, | ||
21 | + }, | ||
22 | + { | ||
23 | + title: '邮箱', | ||
24 | + dataIndex: 'email', | ||
25 | + width: 160, | ||
26 | + }, | ||
27 | + { | ||
28 | + title: '微信', | ||
29 | + dataIndex: 'wechat', | ||
30 | + width: 180, | ||
31 | + }, | ||
32 | + { | ||
33 | + title: '备注', | ||
34 | + dataIndex: 'remark', | ||
35 | + width: 120, | ||
36 | + }, | ||
37 | + { | ||
38 | + title: '添加人', | ||
39 | + dataIndex: 'addPeople', | ||
40 | + width: 180, | ||
41 | + }, | ||
42 | + { | ||
43 | + title: '添加时间', | ||
44 | + dataIndex: 'createTime', | ||
45 | + width: 180, | ||
46 | + }, | ||
47 | + { | ||
48 | + title: '更新时间', | ||
49 | + dataIndex: 'updateTime', | ||
50 | + width: 180, | ||
51 | + }, | ||
52 | +]; | ||
53 | + | ||
54 | +// 查询字段 | ||
55 | +export const searchFormSchema: FormSchema[] = [ | ||
56 | + { | ||
57 | + field: 'username', | ||
58 | + label: '联系人姓名', | ||
59 | + component: 'Input', | ||
60 | + colProps: { span: 6 }, | ||
61 | + componentProps: { | ||
62 | + placeholder: '请输入联系人姓名', | ||
63 | + }, | ||
64 | + }, | ||
65 | +]; | ||
66 | + | ||
67 | +// 弹框配置项 | ||
68 | +export const formSchema: FormSchema[] = [ | ||
69 | + { | ||
70 | + field: 'username', | ||
71 | + label: '联系人姓名', | ||
72 | + required: true, | ||
73 | + component: 'Input', | ||
74 | + componentProps: { | ||
75 | + placeholder: '请输入联系人姓名', | ||
76 | + }, | ||
77 | + }, | ||
78 | + { | ||
79 | + field: 'organizationId', | ||
80 | + label: '所属组织', | ||
81 | + component: 'ApiTreeSelect', | ||
82 | + componentProps: { | ||
83 | + api: async () => { | ||
84 | + const data = await getOrganizationList(); | ||
85 | + copyTransFun(data as any as any[]); | ||
86 | + return data; | ||
87 | + }, | ||
88 | + }, | ||
89 | + }, | ||
90 | + { | ||
91 | + field: 'phone', | ||
92 | + label: '手机号码', | ||
93 | + required: true, | ||
94 | + component: 'Input', | ||
95 | + componentProps: { | ||
96 | + placeholder: '请输入手机号码', | ||
97 | + }, | ||
98 | + }, | ||
99 | + { | ||
100 | + field: 'email', | ||
101 | + label: '邮箱', | ||
102 | + component: 'Input', | ||
103 | + componentProps: { | ||
104 | + placeholder: '请输入邮箱', | ||
105 | + }, | ||
106 | + }, | ||
107 | + { | ||
108 | + field: 'wechat', | ||
109 | + label: '微信', | ||
110 | + component: 'Input', | ||
111 | + componentProps: { | ||
112 | + placeholder: '请输入微信号', | ||
113 | + }, | ||
114 | + }, | ||
115 | + { | ||
116 | + field: 'addPeople', | ||
117 | + label: '添加人', | ||
118 | + component: 'Input', | ||
119 | + componentProps: { | ||
120 | + placeholder: '请输入添加人', | ||
121 | + }, | ||
122 | + }, | ||
123 | + { | ||
124 | + field: 'remark', | ||
125 | + label: '备注', | ||
126 | + component: 'InputTextArea', | ||
127 | + componentProps: { | ||
128 | + placeholder: '', | ||
129 | + }, | ||
130 | + }, | ||
131 | + { | ||
132 | + field: 'id', | ||
133 | + label: '', | ||
134 | + component: 'Input', | ||
135 | + componentProps: { | ||
136 | + style: { | ||
137 | + display: 'none', | ||
138 | + }, | ||
139 | + }, | ||
140 | + }, | ||
141 | +]; |
src/views/alarm/template/index.vue
0 → 100644
1 | +<template> | ||
2 | + <PageWrapper dense contentFullHeight fixedHeight contentClass="flex"> | ||
3 | + <OrganizationIdTree class="w-1/4 xl:w-1/5" @select="handleSelect" /> | ||
4 | + <BasicTable @register="registerTable" :searchInfo="searchInfo" class="w-3/4 xl:w-4/5"> | ||
5 | + <template #toolbar> | ||
6 | + <a-button type="primary" @click="handleCreateOrEdit(null)"> 新增联系人 </a-button> | ||
7 | + <a-button | ||
8 | + type="primary" | ||
9 | + color="error" | ||
10 | + @click="handleDeleteOrBatchDelete(null)" | ||
11 | + :disabled="hasBatchDelete" | ||
12 | + > | ||
13 | + 批量删除 | ||
14 | + </a-button> | ||
15 | + </template> | ||
16 | + <template #action="{ record }"> | ||
17 | + <TableAction | ||
18 | + :actions="[ | ||
19 | + { | ||
20 | + label: '编辑', | ||
21 | + icon: 'clarity:note-edit-line', | ||
22 | + onClick: handleCreateOrEdit.bind(null, record), | ||
23 | + }, | ||
24 | + { | ||
25 | + label: '删除', | ||
26 | + icon: 'ant-design:delete-outlined', | ||
27 | + color: 'error', | ||
28 | + popConfirm: { | ||
29 | + title: '是否确认删除', | ||
30 | + confirm: handleDeleteOrBatchDelete.bind(null, record), | ||
31 | + }, | ||
32 | + }, | ||
33 | + ]" | ||
34 | + /> | ||
35 | + </template> | ||
36 | + </BasicTable> | ||
37 | + </PageWrapper> | ||
38 | + <ContactDrawer @register="registerDrawer" @success="handleSuccess" /> | ||
39 | +</template> | ||
40 | + | ||
41 | +<script lang="ts"> | ||
42 | + import { defineComponent, reactive, ref, computed } from 'vue'; | ||
43 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | ||
44 | + import { PageWrapper } from '/@/components/Page'; | ||
45 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
46 | + import { useDrawer } from '/@/components/Drawer'; | ||
47 | + import ContactDrawer from './ContactDrawer.vue'; | ||
48 | + import OrganizationIdTree from '../../common/OrganizationIdTree.vue'; | ||
49 | + import { getAlarmContact, deleteAlarmContact } from '/@/api/alarm/contact/alarmContact'; | ||
50 | + import { searchFormSchema, columns } from './config.data'; | ||
51 | + export default defineComponent({ | ||
52 | + components: { | ||
53 | + PageWrapper, | ||
54 | + OrganizationIdTree, | ||
55 | + BasicTable, | ||
56 | + TableAction, | ||
57 | + ContactDrawer, | ||
58 | + }, | ||
59 | + setup() { | ||
60 | + let selectedRowIds = ref<string[]>([]); | ||
61 | + const hasBatchDelete = computed(() => selectedRowIds.value.length <= 0); | ||
62 | + // 复选框事件 | ||
63 | + const onSelectRowChange = (selectedRowKeys: string[]) => { | ||
64 | + selectedRowIds.value = selectedRowKeys; | ||
65 | + }; | ||
66 | + // 表格hooks | ||
67 | + const [registerTable, { reload }] = useTable({ | ||
68 | + api: getAlarmContact, | ||
69 | + columns, | ||
70 | + formConfig: { | ||
71 | + labelWidth: 120, | ||
72 | + schemas: searchFormSchema, | ||
73 | + }, | ||
74 | + useSearchForm: true, | ||
75 | + showTableSetting: true, | ||
76 | + bordered: true, | ||
77 | + rowSelection: { | ||
78 | + onChange: onSelectRowChange, | ||
79 | + type: 'checkbox', | ||
80 | + }, | ||
81 | + rowKey: 'id', | ||
82 | + actionColumn: { | ||
83 | + width: 180, | ||
84 | + title: '操作', | ||
85 | + dataIndex: 'action', | ||
86 | + slots: { customRender: 'action' }, | ||
87 | + fixed: 'right', | ||
88 | + }, | ||
89 | + }); | ||
90 | + // 弹框 | ||
91 | + const [registerDrawer, { openDrawer }] = useDrawer(); | ||
92 | + const { createMessage } = useMessage(); | ||
93 | + const searchInfo = reactive<Recordable>({}); | ||
94 | + // 刷新 | ||
95 | + const handleSuccess = () => { | ||
96 | + reload(); | ||
97 | + }; | ||
98 | + // 新增或编辑 | ||
99 | + const handleCreateOrEdit = (record: Recordable) => { | ||
100 | + if (record) { | ||
101 | + openDrawer(true, { | ||
102 | + isUpdate: true, | ||
103 | + record, | ||
104 | + }); | ||
105 | + } else { | ||
106 | + openDrawer(true, { | ||
107 | + isUpdate: false, | ||
108 | + }); | ||
109 | + } | ||
110 | + }; | ||
111 | + // 删除或批量删除 | ||
112 | + const handleDeleteOrBatchDelete = async (record?: Recordable) => { | ||
113 | + if (record) { | ||
114 | + try { | ||
115 | + await deleteAlarmContact([record.id]); | ||
116 | + createMessage.success('删除联系人成功'); | ||
117 | + handleSuccess(); | ||
118 | + } catch (e) { | ||
119 | + createMessage.error('删除失败'); | ||
120 | + } | ||
121 | + } else { | ||
122 | + try { | ||
123 | + await deleteAlarmContact(selectedRowIds.value); | ||
124 | + createMessage.success('批量删除联系人成功'); | ||
125 | + handleSuccess(); | ||
126 | + } catch (e) { | ||
127 | + createMessage.info('删除失败'); | ||
128 | + } | ||
129 | + } | ||
130 | + }; | ||
131 | + | ||
132 | + // 树形选择器 | ||
133 | + const handleSelect = (organizationId: string) => { | ||
134 | + searchInfo.organizationId = organizationId; | ||
135 | + handleSuccess(); | ||
136 | + }; | ||
137 | + return { | ||
138 | + searchInfo, | ||
139 | + hasBatchDelete, | ||
140 | + handleCreateOrEdit, | ||
141 | + handleDeleteOrBatchDelete, | ||
142 | + handleSelect, | ||
143 | + handleSuccess, | ||
144 | + registerTable, | ||
145 | + registerDrawer, | ||
146 | + }; | ||
147 | + }, | ||
148 | + }); | ||
149 | +</script> |
src/views/device/DeviceModal.vue
0 → 100644
1 | +<template> | ||
2 | + <BasicModal | ||
3 | + v-bind="$attrs" | ||
4 | + width="55rem" | ||
5 | + @register="register" | ||
6 | + :title="getTitle" | ||
7 | + @visible-change="handleVisibleChange" | ||
8 | + @cancel="handleCancel" | ||
9 | + > | ||
10 | + <div class="step-form-form"> | ||
11 | + <a-steps :current="current"> | ||
12 | + <a-step title="填写设备信息" /> | ||
13 | + <a-step title="添加设备凭证" /> | ||
14 | + </a-steps> | ||
15 | + </div> | ||
16 | + <div class="mt-5"> | ||
17 | + <DeviceStep1 @next="handleStep1Next" v-show="current === 0" /> | ||
18 | + <DeviceStep2 | ||
19 | + @prev="handleStepPrev" | ||
20 | + @next="handleStep2Next" | ||
21 | + v-show="current === 1" | ||
22 | + v-if="initStep2" | ||
23 | + /> | ||
24 | + </div> | ||
25 | + </BasicModal> | ||
26 | +</template> | ||
27 | +<script lang="ts"> | ||
28 | + import { defineComponent, ref, nextTick, computed, unref, reactive, toRefs } from 'vue'; | ||
29 | + import { BasicModal, useModalInner } from '/@/components/Modal'; | ||
30 | + import DeviceStep1 from '/@/views/device/step/DeviceStep1.vue'; | ||
31 | + import DeviceStep2 from '/@/views/device/step/DeviceStep2.vue'; | ||
32 | + import { Steps } from 'ant-design-vue'; | ||
33 | + export default defineComponent({ | ||
34 | + name: 'DeviceModal', | ||
35 | + components: { | ||
36 | + BasicModal, | ||
37 | + DeviceStep1, | ||
38 | + DeviceStep2, | ||
39 | + [Steps.name]: Steps, | ||
40 | + [Steps.Step.name]: Steps.Step, | ||
41 | + }, | ||
42 | + props: { | ||
43 | + userData: { type: Object }, | ||
44 | + }, | ||
45 | + setup(props) { | ||
46 | + const state = reactive({ | ||
47 | + initStep2: false, | ||
48 | + }); | ||
49 | + const current = ref(0); | ||
50 | + const isUpdate = ref(true); | ||
51 | + const modelRef = ref({}); | ||
52 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增设备' : '编辑设备')); | ||
53 | + | ||
54 | + const [register] = useModalInner((data) => { | ||
55 | + isUpdate.value = !!data?.isUpdate; | ||
56 | + data && onDataReceive(data); | ||
57 | + }); | ||
58 | + | ||
59 | + function handleStepPrev() { | ||
60 | + current.value--; | ||
61 | + } | ||
62 | + function handleStep1Next(step1Values: any) { | ||
63 | + current.value++; | ||
64 | + state.initStep2 = true; | ||
65 | + console.log(step1Values); | ||
66 | + } | ||
67 | + function handleStep2Next(step2Values: any) { | ||
68 | + current.value++; | ||
69 | + console.log(step2Values); | ||
70 | + } | ||
71 | + function handleRedo() { | ||
72 | + current.value = 0; | ||
73 | + state.initStep2 = false; | ||
74 | + } | ||
75 | + function handleCancel() { | ||
76 | + console.log('关闭了弹框'); | ||
77 | + } | ||
78 | + | ||
79 | + function onDataReceive(data) { | ||
80 | + console.log('Data Received', data); | ||
81 | + // 方式1; | ||
82 | + // setFieldsValue({ | ||
83 | + // field2: data.data, | ||
84 | + // field1: data.info, | ||
85 | + // }); | ||
86 | + | ||
87 | + // // 方式2 | ||
88 | + modelRef.value = { field2: data.data, field1: data.info }; | ||
89 | + | ||
90 | + // setProps({ | ||
91 | + // model:{ field2: data.data, field1: data.info } | ||
92 | + // }) | ||
93 | + } | ||
94 | + | ||
95 | + function handleVisibleChange(v) { | ||
96 | + v && props.userData && nextTick(() => onDataReceive(props.userData)); | ||
97 | + } | ||
98 | + | ||
99 | + return { | ||
100 | + register, | ||
101 | + model: modelRef, | ||
102 | + getTitle, | ||
103 | + handleVisibleChange, | ||
104 | + current, | ||
105 | + ...toRefs(state), | ||
106 | + handleStepPrev, | ||
107 | + handleStep1Next, | ||
108 | + handleStep2Next, | ||
109 | + handleCancel, | ||
110 | + handleRedo, | ||
111 | + }; | ||
112 | + }, | ||
113 | + }); | ||
114 | +</script> |
@@ -3,6 +3,7 @@ import { FormSchema } from '/@/components/Table'; | @@ -3,6 +3,7 @@ import { FormSchema } from '/@/components/Table'; | ||
3 | import { findDictItemByCode } from '/@/api/system/dict'; | 3 | import { findDictItemByCode } from '/@/api/system/dict'; |
4 | import { MessageEnum } from '/@/enums/messageEnum'; | 4 | import { MessageEnum } from '/@/enums/messageEnum'; |
5 | import { DeviceTypeEnum, DeviceState } from '/@/api/device/model/deviceModel'; | 5 | import { DeviceTypeEnum, DeviceState } from '/@/api/device/model/deviceModel'; |
6 | +// 表格列数据 | ||
6 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ |
7 | { | 8 | { |
8 | title: '默认', | 9 | title: '默认', |
@@ -41,7 +42,6 @@ export const columns: BasicColumn[] = [ | @@ -41,7 +42,6 @@ export const columns: BasicColumn[] = [ | ||
41 | width: 120, | 42 | width: 120, |
42 | slots: { customRender: 'deviceState' }, | 43 | slots: { customRender: 'deviceState' }, |
43 | }, | 44 | }, |
44 | - | ||
45 | { | 45 | { |
46 | title: '最后连接时间', | 46 | title: '最后连接时间', |
47 | dataIndex: 'lastConnectTime', | 47 | dataIndex: 'lastConnectTime', |
@@ -54,6 +54,7 @@ export const columns: BasicColumn[] = [ | @@ -54,6 +54,7 @@ export const columns: BasicColumn[] = [ | ||
54 | }, | 54 | }, |
55 | ]; | 55 | ]; |
56 | 56 | ||
57 | +// 查询字段 | ||
57 | export const searchFormSchema: FormSchema[] = [ | 58 | export const searchFormSchema: FormSchema[] = [ |
58 | { | 59 | { |
59 | field: 'deviceType', | 60 | field: 'deviceType', |
@@ -89,13 +90,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -89,13 +90,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
89 | }, | 90 | }, |
90 | ]; | 91 | ]; |
91 | 92 | ||
92 | -export const isMessage = (type: string) => { | ||
93 | - return type === MessageEnum.IS_SMS; | ||
94 | -}; | ||
95 | -export const isEmail = (type: string) => { | ||
96 | - return type === MessageEnum.IS_EMAIL; | ||
97 | -}; | ||
98 | - | 93 | +// 弹框配置项 |
99 | export const formSchema: FormSchema[] = [ | 94 | export const formSchema: FormSchema[] = [ |
100 | { | 95 | { |
101 | field: 'configName', | 96 | field: 'configName', |
@@ -206,3 +201,10 @@ export const formSchema: FormSchema[] = [ | @@ -206,3 +201,10 @@ export const formSchema: FormSchema[] = [ | ||
206 | component: 'InputTextArea', | 201 | component: 'InputTextArea', |
207 | }, | 202 | }, |
208 | ]; | 203 | ]; |
204 | + | ||
205 | +export const isMessage = (type: string) => { | ||
206 | + return type === MessageEnum.IS_SMS; | ||
207 | +}; | ||
208 | +export const isEmail = (type: string) => { | ||
209 | + return type === MessageEnum.IS_EMAIL; | ||
210 | +}; |
src/views/device/device.data.ts
0 → 100644
1 | +import { BasicColumn } from '/@/components/Table'; | ||
2 | +import { FormSchema } from '/@/components/Table'; | ||
3 | +import { findDictItemByCode } from '/@/api/system/dict'; | ||
4 | +import { DeviceTypeEnum, DeviceState } from '/@/api/device/model/deviceModel'; | ||
5 | +export const columns: BasicColumn[] = [ | ||
6 | + { | ||
7 | + title: '设备名称', | ||
8 | + dataIndex: 'name', | ||
9 | + width: 120, | ||
10 | + }, | ||
11 | + { | ||
12 | + title: '设备类型', | ||
13 | + dataIndex: 'deviceType', | ||
14 | + width: 100, | ||
15 | + slots: { customRender: 'deviceType' }, | ||
16 | + }, | ||
17 | + { | ||
18 | + title: '设备配置', | ||
19 | + dataIndex: 'deviceProfile.name', | ||
20 | + width: 160, | ||
21 | + slots: { customRender: 'deviceProfile' }, | ||
22 | + }, | ||
23 | + | ||
24 | + { | ||
25 | + title: '所属组织', | ||
26 | + dataIndex: 'organizationId', | ||
27 | + slots: { customRender: 'organizationId' }, | ||
28 | + }, | ||
29 | + { | ||
30 | + title: '标签', | ||
31 | + dataIndex: 'label', | ||
32 | + width: 180, | ||
33 | + }, | ||
34 | + { | ||
35 | + title: '状态', | ||
36 | + dataIndex: 'deviceState', | ||
37 | + width: 120, | ||
38 | + slots: { customRender: 'deviceState' }, | ||
39 | + }, | ||
40 | + | ||
41 | + { | ||
42 | + title: '最后连接时间', | ||
43 | + dataIndex: 'lastConnectTime', | ||
44 | + width: 180, | ||
45 | + }, | ||
46 | +]; | ||
47 | + | ||
48 | +export const searchFormSchema: FormSchema[] = [ | ||
49 | + { | ||
50 | + field: 'deviceType', | ||
51 | + label: '设备类型', | ||
52 | + component: 'Select', | ||
53 | + componentProps: { | ||
54 | + options: [ | ||
55 | + { label: '网关设备', value: DeviceTypeEnum.GATEWAY }, | ||
56 | + { label: '直连设备', value: DeviceTypeEnum.DIRECT_CONNECTION }, | ||
57 | + { label: '网关子设备', value: DeviceTypeEnum.SENSOR }, | ||
58 | + ], | ||
59 | + }, | ||
60 | + colProps: { span: 4 }, | ||
61 | + }, | ||
62 | + { | ||
63 | + field: 'deviceState', | ||
64 | + label: '设备状态', | ||
65 | + component: 'Select', | ||
66 | + componentProps: { | ||
67 | + options: [ | ||
68 | + { label: '待激活', value: DeviceState.INACTIVE }, | ||
69 | + { label: '在线', value: DeviceState.ONLINE }, | ||
70 | + { label: '离线', value: DeviceState.OFFLINE }, | ||
71 | + ], | ||
72 | + }, | ||
73 | + colProps: { span: 4 }, | ||
74 | + }, | ||
75 | + { | ||
76 | + field: 'name', | ||
77 | + label: '设备名称', | ||
78 | + component: 'Input', | ||
79 | + colProps: { span: 8 }, | ||
80 | + }, | ||
81 | +]; | ||
82 | + | ||
83 | +export const formSchema: FormSchema[] = [ | ||
84 | + { | ||
85 | + field: 'icon', | ||
86 | + label: '设备图片: ', | ||
87 | + slot: 'iconSelect', | ||
88 | + component: 'Input', | ||
89 | + }, | ||
90 | + { | ||
91 | + field: 'name', | ||
92 | + label: '设备名称', | ||
93 | + required: true, | ||
94 | + component: 'Input', | ||
95 | + componentProps: { | ||
96 | + maxLength: 30, | ||
97 | + }, | ||
98 | + }, | ||
99 | + { | ||
100 | + field: 'deviceType', | ||
101 | + label: '设备类型', | ||
102 | + required: true, | ||
103 | + component: 'ApiSelect', | ||
104 | + componentProps: { | ||
105 | + api: findDictItemByCode, | ||
106 | + params: { | ||
107 | + dictCode: 'device_type', | ||
108 | + }, | ||
109 | + labelField: 'itemText', | ||
110 | + valueField: 'itemValue', | ||
111 | + }, | ||
112 | + }, | ||
113 | + { | ||
114 | + field: 'label', | ||
115 | + label: '设备标签', | ||
116 | + component: 'Input', | ||
117 | + componentProps: { | ||
118 | + maxLength: 255, | ||
119 | + }, | ||
120 | + }, | ||
121 | + { | ||
122 | + label: '备注', | ||
123 | + field: 'remark', | ||
124 | + component: 'InputTextArea', | ||
125 | + }, | ||
126 | +]; |
1 | <template> | 1 | <template> |
2 | - <div> | ||
3 | - <BasicTable @register="registerTable"> | 2 | + <PageWrapper dense contentFullHeight fixedHeight contentClass="flex"> |
3 | + <OrganizationIdTree class="w-1/6 xl:w-1/5" @select="handleSelect" /> | ||
4 | + <BasicTable @register="registerTable" class="w-5/6 xl:w-4/5"> | ||
4 | <template #toolbar> | 5 | <template #toolbar> |
5 | <a-button type="primary" @click="handleCreate"> 新增设备 </a-button> | 6 | <a-button type="primary" @click="handleCreate"> 新增设备 </a-button> |
6 | </template> | 7 | </template> |
7 | - <template #config="{ record }"> | ||
8 | - <a-button type="link" class="ml-2" @click="showData(record)"> 查看配置 </a-button> | ||
9 | - </template> | ||
10 | <template #deviceProfile="{ record }"> | 8 | <template #deviceProfile="{ record }"> |
11 | <a-button type="link" class="ml-2" @click="goDeviceProfile"> | 9 | <a-button type="link" class="ml-2" @click="goDeviceProfile"> |
12 | {{ record.deviceProfile.name }} | 10 | {{ record.deviceProfile.name }} |
13 | </a-button> | 11 | </a-button> |
14 | </template> | 12 | </template> |
13 | + <template #organizationId="{ record }"> | ||
14 | + {{ record.organizationDTO.name }} | ||
15 | + </template> | ||
15 | <template #deviceType="{ record }"> | 16 | <template #deviceType="{ record }"> |
16 | <Tag color="success" class="ml-2"> | 17 | <Tag color="success" class="ml-2"> |
17 | {{ | 18 | {{ |
18 | - record.deviceType == DeviceTypeEnum.GATEWAY | 19 | + record.deviceType === DeviceTypeEnum.GATEWAY |
19 | ? '网关设备' | 20 | ? '网关设备' |
20 | - : record.deviceType == DeviceTypeEnum.DIRECT_CONNECTION | 21 | + : record.deviceType === DeviceTypeEnum.DIRECT_CONNECTION |
21 | ? '直连设备' | 22 | ? '直连设备' |
22 | : '网关子设备' | 23 | : '网关子设备' |
23 | }} | 24 | }} |
@@ -64,30 +65,44 @@ | @@ -64,30 +65,44 @@ | ||
64 | /> | 65 | /> |
65 | </template> | 66 | </template> |
66 | </BasicTable> | 67 | </BasicTable> |
67 | - <ConfigDrawer @register="registerDrawer" @success="handleSuccess" /> | ||
68 | - </div> | 68 | + <!-- <ConfigDrawer @register="registerDrawer" @success="handleSuccess" /> --> |
69 | + <DeviceModal @register="registerModal" @success="handleSuccess" /> | ||
70 | + </PageWrapper> | ||
69 | </template> | 71 | </template> |
70 | <script lang="ts"> | 72 | <script lang="ts"> |
71 | - import { defineComponent, h } from 'vue'; | 73 | + import { defineComponent, reactive } from 'vue'; |
72 | import { DeviceState, DeviceTypeEnum } from '/@/api/device/model/deviceModel'; | 74 | import { DeviceState, DeviceTypeEnum } from '/@/api/device/model/deviceModel'; |
73 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 75 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
74 | - import { useDrawer } from '/@/components/Drawer'; | ||
75 | - import ConfigDrawer from './DeviceDrawer.vue'; | ||
76 | - import { columns, searchFormSchema } from './config.data'; | ||
77 | - import { Modal, Tag } from 'ant-design-vue'; | ||
78 | - import { CodeEditor, JsonPreview } from '/@/components/CodeEditor'; | 76 | + // import { useDrawer } from '/@/components/Drawer'; |
77 | + // import ConfigDrawer from './DeviceDrawer.vue'; | ||
78 | + import { columns, searchFormSchema } from './device.data'; | ||
79 | + import { Tag } from 'ant-design-vue'; | ||
79 | import { useMessage } from '/@/hooks/web/useMessage'; | 80 | import { useMessage } from '/@/hooks/web/useMessage'; |
80 | import { deleteDevice, devicePage } from '/@/api/device/deviceManager'; | 81 | import { deleteDevice, devicePage } from '/@/api/device/deviceManager'; |
81 | import { PageEnum } from '/@/enums/pageEnum'; | 82 | import { PageEnum } from '/@/enums/pageEnum'; |
82 | import { useGo } from '/@/hooks/web/usePage'; | 83 | import { useGo } from '/@/hooks/web/usePage'; |
84 | + import { PageWrapper } from '/@/components/Page'; | ||
85 | + import OrganizationIdTree from '/@/views/common/OrganizationIdTree.vue'; | ||
86 | + import { useModal } from '/@/components/Modal'; | ||
87 | + import DeviceModal from '/@/views/device/DeviceModal.vue'; | ||
83 | 88 | ||
84 | export default defineComponent({ | 89 | export default defineComponent({ |
85 | name: 'DeviceManagement', | 90 | name: 'DeviceManagement', |
86 | - components: { BasicTable, ConfigDrawer, TableAction, CodeEditor, Tag }, | 91 | + components: { |
92 | + BasicTable, | ||
93 | + // ConfigDrawer, | ||
94 | + PageWrapper, | ||
95 | + TableAction, | ||
96 | + OrganizationIdTree, | ||
97 | + Tag, | ||
98 | + DeviceModal, | ||
99 | + }, | ||
87 | setup() { | 100 | setup() { |
88 | - const [registerDrawer, { openDrawer }] = useDrawer(); | 101 | + // const [registerDrawer, { openDrawer }] = useDrawer(); |
89 | const { createMessage } = useMessage(); | 102 | const { createMessage } = useMessage(); |
90 | const go = useGo(); | 103 | const go = useGo(); |
104 | + const searchInfo = reactive<Recordable>({}); | ||
105 | + const [registerModal, { openModal }] = useModal(); | ||
91 | const [registerTable, { reload }] = useTable({ | 106 | const [registerTable, { reload }] = useTable({ |
92 | title: '设备列表', | 107 | title: '设备列表', |
93 | api: devicePage, | 108 | api: devicePage, |
@@ -100,6 +115,7 @@ | @@ -100,6 +115,7 @@ | ||
100 | showTableSetting: true, | 115 | showTableSetting: true, |
101 | bordered: true, | 116 | bordered: true, |
102 | showIndexColumn: false, | 117 | showIndexColumn: false, |
118 | + searchInfo: searchInfo, | ||
103 | actionColumn: { | 119 | actionColumn: { |
104 | width: 180, | 120 | width: 180, |
105 | title: '操作', | 121 | title: '操作', |
@@ -110,15 +126,15 @@ | @@ -110,15 +126,15 @@ | ||
110 | }); | 126 | }); |
111 | 127 | ||
112 | function handleCreate() { | 128 | function handleCreate() { |
113 | - openDrawer(true, { | 129 | + openModal(true, { |
114 | isUpdate: false, | 130 | isUpdate: false, |
115 | }); | 131 | }); |
116 | } | 132 | } |
117 | 133 | ||
118 | function handleEdit(record: Recordable) { | 134 | function handleEdit(record: Recordable) { |
119 | - openDrawer(true, { | ||
120 | - record, | 135 | + openModal(true, { |
121 | isUpdate: true, | 136 | isUpdate: true, |
137 | + record, | ||
122 | }); | 138 | }); |
123 | } | 139 | } |
124 | 140 | ||
@@ -133,20 +149,16 @@ | @@ -133,20 +149,16 @@ | ||
133 | function handleSuccess() { | 149 | function handleSuccess() { |
134 | reload(); | 150 | reload(); |
135 | } | 151 | } |
136 | - function showData(record: Recordable) { | ||
137 | - Modal.info({ | ||
138 | - title: '当前配置', | ||
139 | - width: 480, | ||
140 | - content: h(JsonPreview, { data: JSON.parse(JSON.stringify(record.deviceInfo)) }), | ||
141 | - }); | 152 | + function handleSelect(organization) { |
153 | + searchInfo.organizationId = organization; | ||
154 | + handleSuccess(); | ||
142 | } | 155 | } |
143 | function goDeviceProfile() { | 156 | function goDeviceProfile() { |
144 | go(PageEnum.DEVICE_PROFILE); | 157 | go(PageEnum.DEVICE_PROFILE); |
145 | } | 158 | } |
146 | return { | 159 | return { |
147 | registerTable, | 160 | registerTable, |
148 | - registerDrawer, | ||
149 | - showData, | 161 | + // registerDrawer, |
150 | handleCreate, | 162 | handleCreate, |
151 | handleEdit, | 163 | handleEdit, |
152 | handleDelete, | 164 | handleDelete, |
@@ -154,6 +166,9 @@ | @@ -154,6 +166,9 @@ | ||
154 | goDeviceProfile, | 166 | goDeviceProfile, |
155 | DeviceTypeEnum, | 167 | DeviceTypeEnum, |
156 | DeviceState, | 168 | DeviceState, |
169 | + handleSelect, | ||
170 | + searchInfo, | ||
171 | + registerModal, | ||
157 | }; | 172 | }; |
158 | }, | 173 | }, |
159 | }); | 174 | }); |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | width="500px" | 7 | width="500px" |
8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
9 | > | 9 | > |
10 | - <BasicForm @register="registerForm"/> | 10 | + <BasicForm @register="registerForm" /> |
11 | </BasicDrawer> | 11 | </BasicDrawer> |
12 | </template> | 12 | </template> |
13 | <script lang="ts"> | 13 | <script lang="ts"> |
@@ -15,8 +15,8 @@ | @@ -15,8 +15,8 @@ | ||
15 | import { BasicForm, useForm } from '/@/components/Form'; | 15 | import { BasicForm, useForm } from '/@/components/Form'; |
16 | import { formSchema } from './device.profile.data'; | 16 | import { formSchema } from './device.profile.data'; |
17 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 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 | export default defineComponent({ | 21 | export default defineComponent({ |
22 | name: 'DeviceProfileDrawer', | 22 | name: 'DeviceProfileDrawer', |
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | setup(_, { emit }) { | 25 | setup(_, { emit }) { |
26 | const isUpdate = ref(true); | 26 | const isUpdate = ref(true); |
27 | 27 | ||
28 | - const [registerForm, { validate,setFieldsValue,resetFields }] = useForm({ | 28 | + const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ |
29 | labelWidth: 120, | 29 | labelWidth: 120, |
30 | schemas: formSchema, | 30 | schemas: formSchema, |
31 | showActionButtonGroup: false, | 31 | showActionButtonGroup: false, |
@@ -37,8 +37,8 @@ | @@ -37,8 +37,8 @@ | ||
37 | isUpdate.value = !!data?.isUpdate; | 37 | isUpdate.value = !!data?.isUpdate; |
38 | if (unref(isUpdate)) { | 38 | if (unref(isUpdate)) { |
39 | const config = data.record.config; | 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 | await setFieldsValue({ | 43 | await setFieldsValue({ |
44 | ...data.record, | 44 | ...data.record, |
@@ -53,27 +53,27 @@ | @@ -53,27 +53,27 @@ | ||
53 | const values = await validate(); | 53 | const values = await validate(); |
54 | const { createMessage } = useMessage(); | 54 | const { createMessage } = useMessage(); |
55 | setDrawerProps({ confirmLoading: true }); | 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 | Reflect.set(values, 'config', config); | 70 | Reflect.set(values, 'config', config); |
71 | - let saveMessage = "添加成功"; | ||
72 | - let updateMessage = "修改成功"; | 71 | + let saveMessage = '添加成功'; |
72 | + let updateMessage = '修改成功'; | ||
73 | await saveOrEditMessageConfig(values, unref(isUpdate)); | 73 | await saveOrEditMessageConfig(values, unref(isUpdate)); |
74 | closeDrawer(); | 74 | closeDrawer(); |
75 | emit('success'); | 75 | emit('success'); |
76 | - createMessage.success(unref(isUpdate)?updateMessage:saveMessage); | 76 | + createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); |
77 | } finally { | 77 | } finally { |
78 | setDrawerProps({ confirmLoading: false }); | 78 | setDrawerProps({ confirmLoading: false }); |
79 | } | 79 | } |
1 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; |
2 | import { FormSchema } from '/@/components/Table'; | 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 | export const columns: BasicColumn[] = [ | 5 | export const columns: BasicColumn[] = [ |
6 | { | 6 | { |
7 | title: '配置名称', | 7 | title: '配置名称', |
@@ -34,20 +34,19 @@ export const searchFormSchema: FormSchema[] = [ | @@ -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 | export const formSchema: FormSchema[] = [ | 44 | export const formSchema: FormSchema[] = [ |
46 | { | 45 | { |
47 | field: 'configName', | 46 | field: 'configName', |
48 | label: '配置名称', | 47 | label: '配置名称', |
49 | required: true, | 48 | required: true, |
50 | - component:'Input' | 49 | + component: 'Input', |
51 | }, | 50 | }, |
52 | { | 51 | { |
53 | field: 'messageType', | 52 | field: 'messageType', |
@@ -55,12 +54,12 @@ export const formSchema: FormSchema[] = [ | @@ -55,12 +54,12 @@ export const formSchema: FormSchema[] = [ | ||
55 | required: true, | 54 | required: true, |
56 | component: 'ApiSelect', | 55 | component: 'ApiSelect', |
57 | componentProps: { | 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,70 +68,70 @@ export const formSchema: FormSchema[] = [ | ||
69 | required: true, | 68 | required: true, |
70 | component: 'ApiSelect', | 69 | component: 'ApiSelect', |
71 | componentProps: { | 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 | field: 'accessKeyId', | 81 | field: 'accessKeyId', |
83 | label: 'accessKeyId', | 82 | label: 'accessKeyId', |
84 | required: true, | 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 | field: 'accessKeySecret', | 88 | field: 'accessKeySecret', |
90 | label: 'accessKeySecret', | 89 | label: 'accessKeySecret', |
91 | required: true, | 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 | field: 'host', | 95 | field: 'host', |
97 | label: '服务器地址', | 96 | label: '服务器地址', |
98 | - defaultValue:'smtp.163.com', | 97 | + defaultValue: 'smtp.163.com', |
99 | required: true, | 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 | field: 'port', | 103 | field: 'port', |
105 | label: '端口', | 104 | label: '端口', |
106 | defaultValue: 25, | 105 | defaultValue: 25, |
107 | required: true, | 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 | field: 'username', | 111 | field: 'username', |
113 | label: '用户名', | 112 | label: '用户名', |
114 | required: true, | 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 | field: 'password', | 118 | field: 'password', |
120 | label: '密码', | 119 | label: '密码', |
121 | required: true, | 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 | field: 'config', | 125 | field: 'config', |
127 | label: '消息配置', | 126 | label: '消息配置', |
128 | - component:'Input', | ||
129 | - show:false, | 127 | + component: 'Input', |
128 | + show: false, | ||
130 | }, | 129 | }, |
131 | { | 130 | { |
132 | field: 'id', | 131 | field: 'id', |
133 | label: '主键', | 132 | label: '主键', |
134 | - component:'Input', | ||
135 | - show:false, | 133 | + component: 'Input', |
134 | + show: false, | ||
136 | }, | 135 | }, |
137 | { | 136 | { |
138 | field: 'status', | 137 | field: 'status', |
@@ -150,5 +149,5 @@ export const formSchema: FormSchema[] = [ | @@ -150,5 +149,5 @@ export const formSchema: FormSchema[] = [ | ||
150 | label: '备注', | 149 | label: '备注', |
151 | field: 'remark', | 150 | field: 'remark', |
152 | component: 'InputTextArea', | 151 | component: 'InputTextArea', |
153 | - } | 152 | + }, |
154 | ]; | 153 | ]; |
@@ -8,18 +8,18 @@ | @@ -8,18 +8,18 @@ | ||
8 | <TableAction | 8 | <TableAction |
9 | :actions="[ | 9 | :actions="[ |
10 | { | 10 | { |
11 | - label:'编辑', | 11 | + label: '编辑', |
12 | icon: 'clarity:note-edit-line', | 12 | icon: 'clarity:note-edit-line', |
13 | onClick: handleEdit.bind(null, record), | 13 | onClick: handleEdit.bind(null, record), |
14 | }, | 14 | }, |
15 | { | 15 | { |
16 | - label:'删除', | 16 | + label: '删除', |
17 | icon: 'ant-design:delete-outlined', | 17 | icon: 'ant-design:delete-outlined', |
18 | color: 'error', | 18 | color: 'error', |
19 | popConfirm: { | 19 | popConfirm: { |
20 | title: '是否确认删除', | 20 | title: '是否确认删除', |
21 | confirm: handleDelete.bind(null, record), | 21 | confirm: handleDelete.bind(null, record), |
22 | - } | 22 | + }, |
23 | }, | 23 | }, |
24 | ]" | 24 | ]" |
25 | /> | 25 | /> |
@@ -29,71 +29,71 @@ | @@ -29,71 +29,71 @@ | ||
29 | </div> | 29 | </div> |
30 | </template> | 30 | </template> |
31 | <script lang="ts"> | 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 | </script> | 99 | </script> |
src/views/device/step/DeviceStep1.vue
0 → 100644
1 | +<template> | ||
2 | + <div class="step1"> | ||
3 | + <div class="step1-form"> | ||
4 | + <BasicForm @register="register"> | ||
5 | + <template #iconSelect> | ||
6 | + <Upload | ||
7 | + name="avatar" | ||
8 | + list-type="picture-card" | ||
9 | + class="avatar-uploader" | ||
10 | + :show-upload-list="false" | ||
11 | + :customRequest="customUpload" | ||
12 | + :before-upload="beforeUpload" | ||
13 | + > | ||
14 | + <img v-if="devicePic" :src="devicePic" alt="avatar" /> | ||
15 | + <div v-else> | ||
16 | + <!-- <LoadingOutlined v-if="loading" /> --> | ||
17 | + <PlusOutlined /> | ||
18 | + <div class="ant-upload-text">图片上传</div> | ||
19 | + </div> | ||
20 | + </Upload> | ||
21 | + </template> | ||
22 | + <template #devicePosition> | ||
23 | + <Input disabled v-model:value="positionState.address"> | ||
24 | + <template #addonAfter> | ||
25 | + <EnvironmentTwoTone @click="selectPosition" /> | ||
26 | + </template> | ||
27 | + </Input> | ||
28 | + </template> | ||
29 | + </BasicForm> | ||
30 | + </div> | ||
31 | + <Modal v-model:visible="visible" title="设备位置" @ok="handleOk" width="800px"> | ||
32 | + <div> | ||
33 | + <a-form :label-col="labelCol"> | ||
34 | + <a-row :gutter="20"> | ||
35 | + <a-col :span="8"> | ||
36 | + <a-form-item label="经度"> | ||
37 | + <Input type="input" v-model:value="positionState.lng" disabled /> | ||
38 | + </a-form-item> | ||
39 | + </a-col> | ||
40 | + <a-col :span="8"> | ||
41 | + <a-form-item label="纬度"> | ||
42 | + <Input type="input" v-model:value="positionState.lat" disabled /> | ||
43 | + </a-form-item> | ||
44 | + </a-col> | ||
45 | + </a-row> | ||
46 | + </a-form> | ||
47 | + <div ref="wrapRef" style="height: 300px; width: 90%" class="ml-6"></div> | ||
48 | + </div> | ||
49 | + </Modal> | ||
50 | + </div> | ||
51 | +</template> | ||
52 | +<script lang="ts"> | ||
53 | + import { defineComponent, ref, nextTick, unref, reactive } from 'vue'; | ||
54 | + import { BasicForm, useForm } from '/@/components/Form'; | ||
55 | + import { step1Schemas } from './data'; | ||
56 | + import { useScript } from '/@/hooks/web/useScript'; | ||
57 | + import { ScrollActionType } from '/@/components/Container/index'; | ||
58 | + import { Input, Divider, Upload, message, Modal, Form, Row, Col } from 'ant-design-vue'; | ||
59 | + import { EnvironmentTwoTone, LoadingOutlined, PlusOutlined } from '@ant-design/icons-vue'; | ||
60 | + import { upload } from '/@/api/oss/ossFileUploader'; | ||
61 | + import { FileItem } from '/@/components/Upload/src/typing'; | ||
62 | + | ||
63 | + export default defineComponent({ | ||
64 | + components: { | ||
65 | + BasicForm, | ||
66 | + Input, | ||
67 | + [Input.Group.name]: Input.Group, | ||
68 | + [Divider.name]: Divider, | ||
69 | + Upload, | ||
70 | + EnvironmentTwoTone, | ||
71 | + // LoadingOutlined, | ||
72 | + PlusOutlined, | ||
73 | + Modal, | ||
74 | + [Form.name]: Form, | ||
75 | + [Form.Item.name]: Form.Item, | ||
76 | + [Row.name]: Row, | ||
77 | + [Col.name]: Col, | ||
78 | + }, | ||
79 | + emits: ['next'], | ||
80 | + setup(_, { emit }) { | ||
81 | + const devicePic = ref(''); | ||
82 | + const positionState = reactive({ | ||
83 | + lng: '', | ||
84 | + lat: '', | ||
85 | + address: '', | ||
86 | + }); | ||
87 | + const [register, { validate }] = useForm({ | ||
88 | + labelWidth: 100, | ||
89 | + schemas: step1Schemas, | ||
90 | + actionColOptions: { | ||
91 | + span: 14, | ||
92 | + }, | ||
93 | + showResetButton: false, | ||
94 | + submitButtonOptions: { | ||
95 | + text: '下一步', | ||
96 | + }, | ||
97 | + submitFunc: customSubmitFunc, | ||
98 | + }); | ||
99 | + | ||
100 | + async function customSubmitFunc() { | ||
101 | + try { | ||
102 | + let values = await validate(); | ||
103 | + values = { devicePic: devicePic.value, ...positionState, ...values }; | ||
104 | + delete values.icon; | ||
105 | + delete values.devicePosition; | ||
106 | + emit('next', values); | ||
107 | + // 获取输入的数据 | ||
108 | + } catch (error) {} | ||
109 | + } | ||
110 | + // 图片上传 | ||
111 | + async function customUpload({ file }) { | ||
112 | + if (beforeUpload(file)) { | ||
113 | + const formData = new FormData(); | ||
114 | + formData.append('file', file); | ||
115 | + const response = await upload(formData); | ||
116 | + if (response.fileStaticUri) { | ||
117 | + devicePic.value = response.fileStaticUri; | ||
118 | + } | ||
119 | + } | ||
120 | + } | ||
121 | + const beforeUpload = (file: FileItem) => { | ||
122 | + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; | ||
123 | + if (!isJpgOrPng) { | ||
124 | + message.error('只能上传图片文件!'); | ||
125 | + } | ||
126 | + const isLt2M = (file.size as number) / 1024 / 1024 < 2; | ||
127 | + if (!isLt2M) { | ||
128 | + message.error('图片大小不能超过2MB!'); | ||
129 | + } | ||
130 | + return isJpgOrPng && isLt2M; | ||
131 | + }; | ||
132 | + | ||
133 | + // 地图的弹框 | ||
134 | + const visible = ref(false); | ||
135 | + const selectPosition = () => { | ||
136 | + visible.value = true; | ||
137 | + initMap(); | ||
138 | + }; | ||
139 | + | ||
140 | + // 地图 | ||
141 | + const BAI_DU_MAP_URL = | ||
142 | + 'https://api.map.baidu.com/getscript?v=3.0&ak=7uOPPyAHn2Y2ZryeQqHtcRqtIY374vKa'; | ||
143 | + const wrapRef = ref<HTMLDivElement | null>(null); | ||
144 | + const scrollRef = ref<Nullable<ScrollActionType>>(null); | ||
145 | + const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); | ||
146 | + async function initMap() { | ||
147 | + await toPromise(); | ||
148 | + await nextTick(); | ||
149 | + const wrapEl = unref(wrapRef); | ||
150 | + const BMap = (window as any).BMap; | ||
151 | + if (!wrapEl) return; | ||
152 | + const map = new BMap.Map(wrapEl); | ||
153 | + map.addEventListener('click', () => { | ||
154 | + const { lat, lng } = map.he; | ||
155 | + positionState.lat = lat + ''; | ||
156 | + positionState.lng = lng + ''; | ||
157 | + let gc = new BMap.Geocoder(); | ||
158 | + let newPoint = new BMap.Point(lng, lat); | ||
159 | + gc.getLocation(newPoint, (rs) => { | ||
160 | + let addComp = rs.addressComponents; | ||
161 | + //获取详细的地址,精确到街道的名称 | ||
162 | + let addrname = addComp.city + addComp.district + addComp.street + addComp.streetNumber; | ||
163 | + positionState.address = addrname; | ||
164 | + }); | ||
165 | + }); | ||
166 | + const point = new BMap.Point(104.04813399999999, 30.54348986021446); | ||
167 | + map.centerAndZoom(point, 15); | ||
168 | + map.enableScrollWheelZoom(true); | ||
169 | + } | ||
170 | + // 确定选择的位置 | ||
171 | + const handleOk = () => { | ||
172 | + visible.value = false; | ||
173 | + }; | ||
174 | + return { | ||
175 | + positionState, | ||
176 | + register, | ||
177 | + beforeUpload, | ||
178 | + customUpload, | ||
179 | + selectPosition, | ||
180 | + devicePic, | ||
181 | + visible, | ||
182 | + scrollRef, | ||
183 | + handleOk, | ||
184 | + wrapRef, | ||
185 | + labelCol: { style: { width: '40px' } }, | ||
186 | + }; | ||
187 | + }, | ||
188 | + }); | ||
189 | +</script> | ||
190 | +<style lang="less" scoped> | ||
191 | + .step1 { | ||
192 | + &-form { | ||
193 | + width: 450px; | ||
194 | + margin: 0 auto; | ||
195 | + } | ||
196 | + | ||
197 | + h3 { | ||
198 | + margin: 0 0 12px; | ||
199 | + font-size: 16px; | ||
200 | + line-height: 32px; | ||
201 | + color: @text-color; | ||
202 | + } | ||
203 | + | ||
204 | + h4 { | ||
205 | + margin: 0 0 4px; | ||
206 | + font-size: 14px; | ||
207 | + line-height: 22px; | ||
208 | + color: @text-color; | ||
209 | + } | ||
210 | + | ||
211 | + p { | ||
212 | + color: @text-color; | ||
213 | + } | ||
214 | + } | ||
215 | + | ||
216 | + .pay-select { | ||
217 | + width: 20%; | ||
218 | + } | ||
219 | + | ||
220 | + .pay-input { | ||
221 | + width: 70%; | ||
222 | + } | ||
223 | +</style> |
src/views/device/step/DeviceStep2.vue
0 → 100644
1 | +<template> | ||
2 | + <div class="step2"> | ||
3 | + <div><input type="checkbox" v-model="isCreaentials" @click="checked" /> 添加凭证 </div> | ||
4 | + | ||
5 | + <a-form :label-col="labelCol" :wrapper-col="wrapperCol" v-if="isCreaentials"> | ||
6 | + <a-form-item label="凭据类型"> | ||
7 | + <a-select | ||
8 | + v-model:value="creaentialsType" | ||
9 | + style="width: 200px" | ||
10 | + @change="handleChange" | ||
11 | + placeholder="请选择凭据类型" | ||
12 | + :options="options" | ||
13 | + /> | ||
14 | + </a-form-item> | ||
15 | + <div v-if="creaentialsType === 'Access token'"> | ||
16 | + <a-form-item label="访问令牌"> | ||
17 | + <a-input type="input" style="width: 200px" v-model:value="token" /> | ||
18 | + </a-form-item> | ||
19 | + </div> | ||
20 | + <div v-else-if="creaentialsType === 'X.509'"> | ||
21 | + <a-form-item label="RSA公钥"> | ||
22 | + <a-input type="input" style="width: 200px" v-model:value="publicKey" /> | ||
23 | + </a-form-item> | ||
24 | + </div> | ||
25 | + <div v-else> | ||
26 | + <a-form-item label="客户端ID"> | ||
27 | + <a-input type="input" style="width: 200px" v-model:value="clientId" /> | ||
28 | + </a-form-item> | ||
29 | + <a-form-item label="用户名"> | ||
30 | + <a-input type="input" style="width: 200px" v-model:value="username" /> | ||
31 | + </a-form-item> | ||
32 | + <a-form-item label="密码"> | ||
33 | + <a-input type="password" style="width: 200px" v-model:value="password" /> | ||
34 | + </a-form-item> | ||
35 | + </div> | ||
36 | + </a-form> | ||
37 | + | ||
38 | + <div class="flex justify-start"> | ||
39 | + <a-button class="mr-5" @click="prevStep">上一步</a-button> | ||
40 | + </div> | ||
41 | + </div> | ||
42 | +</template> | ||
43 | +<script lang="ts"> | ||
44 | + import { defineComponent, reactive, ref, toRefs } from 'vue'; | ||
45 | + | ||
46 | + import { Input, Form, Select, Button, SelectProps } from 'ant-design-vue'; | ||
47 | + export default defineComponent({ | ||
48 | + components: { | ||
49 | + [Form.name]: Form, | ||
50 | + [Form.Item.name]: Form.Item, | ||
51 | + [Input.name]: Input, | ||
52 | + [Select.name]: Select, | ||
53 | + [Button.name]: Button, | ||
54 | + }, | ||
55 | + emits: ['prev'], | ||
56 | + setup(_, { emit }) { | ||
57 | + const isCreaentials = ref(false); | ||
58 | + const creaentialsType = ref('Access token'); | ||
59 | + const creaentialsPassword = reactive({ | ||
60 | + token: '', | ||
61 | + publicKey: '', | ||
62 | + clientId: '', | ||
63 | + username: '', | ||
64 | + password: '', | ||
65 | + }); | ||
66 | + const options = ref<SelectProps['options']>([ | ||
67 | + { | ||
68 | + value: 'Access token', | ||
69 | + label: 'Access token', | ||
70 | + }, | ||
71 | + | ||
72 | + { | ||
73 | + value: 'X.509', | ||
74 | + label: 'X.509', | ||
75 | + }, | ||
76 | + { | ||
77 | + value: 'MQTT Basic', | ||
78 | + label: 'MQTT Basic', | ||
79 | + }, | ||
80 | + ]); | ||
81 | + const checked = () => { | ||
82 | + isCreaentials.value = !isCreaentials.value; | ||
83 | + }; | ||
84 | + const prevStep = () => { | ||
85 | + emit('prev'); | ||
86 | + }; | ||
87 | + // 切换凭证类型时,重置字段 | ||
88 | + const handleChange = (value) => { | ||
89 | + if (value === 'Access token') { | ||
90 | + creaentialsPassword.token = ''; | ||
91 | + } else if (value === 'X.509') { | ||
92 | + creaentialsPassword.publicKey = ''; | ||
93 | + } else { | ||
94 | + creaentialsPassword.clientId = ''; | ||
95 | + creaentialsPassword.username = ''; | ||
96 | + creaentialsPassword.password = ''; | ||
97 | + } | ||
98 | + }; | ||
99 | + return { | ||
100 | + ...toRefs(creaentialsPassword), | ||
101 | + creaentialsType, | ||
102 | + isCreaentials, | ||
103 | + options, | ||
104 | + handleChange, | ||
105 | + prevStep, | ||
106 | + checked, | ||
107 | + labelCol: { style: { width: '150px' } }, | ||
108 | + wrapperCol: { span: 18 }, | ||
109 | + }; | ||
110 | + }, | ||
111 | + }); | ||
112 | +</script> | ||
113 | +<style lang="less" scoped> | ||
114 | + .step2 { | ||
115 | + width: 500px; | ||
116 | + margin: 0 auto; | ||
117 | + } | ||
118 | +</style> |
src/views/device/step/StepIndexDemo.vue
0 → 100644
1 | +<template> | ||
2 | + <PageWrapper | ||
3 | + title="分步表单" | ||
4 | + contentBackground | ||
5 | + content=" 将一个冗长或用户不熟悉的表单任务分成多个步骤,指导用户完成。" | ||
6 | + contentClass="p-4" | ||
7 | + > | ||
8 | + <div class="step-form-form"> | ||
9 | + <a-steps :current="current"> | ||
10 | + <a-step title="填写转账信息" /> | ||
11 | + <a-step title="确认转账信息" /> | ||
12 | + <a-step title="完成" /> | ||
13 | + </a-steps> | ||
14 | + </div> | ||
15 | + <div class="mt-5"> | ||
16 | + <Step1 @next="handleStep1Next" v-show="current === 0" /> | ||
17 | + <Step2 | ||
18 | + @prev="handleStepPrev" | ||
19 | + @next="handleStep2Next" | ||
20 | + v-show="current === 1" | ||
21 | + v-if="initSetp2" | ||
22 | + /> | ||
23 | + </div> | ||
24 | + </PageWrapper> | ||
25 | +</template> | ||
26 | +<script lang="ts"> | ||
27 | + import { defineComponent, ref, reactive, toRefs } from 'vue'; | ||
28 | + import Step1 from './DeviceStep1.vue'; | ||
29 | + import Step2 from './DeviceStep2.vue'; | ||
30 | + import { PageWrapper } from '/@/components/Page'; | ||
31 | + import { Steps } from 'ant-design-vue'; | ||
32 | + | ||
33 | + export default defineComponent({ | ||
34 | + name: 'FormStepPage', | ||
35 | + components: { | ||
36 | + Step1, | ||
37 | + Step2, | ||
38 | + | ||
39 | + PageWrapper, | ||
40 | + [Steps.name]: Steps, | ||
41 | + [Steps.Step.name]: Steps.Step, | ||
42 | + }, | ||
43 | + setup() { | ||
44 | + const current = ref(1); | ||
45 | + | ||
46 | + const state = reactive({ | ||
47 | + initSetp2: false, | ||
48 | + }); | ||
49 | + | ||
50 | + function handleStep1Next(step1Values: any) { | ||
51 | + current.value++; | ||
52 | + state.initSetp2 = true; | ||
53 | + console.log(step1Values); | ||
54 | + } | ||
55 | + | ||
56 | + function handleStepPrev() { | ||
57 | + current.value--; | ||
58 | + } | ||
59 | + | ||
60 | + function handleStep2Next(step2Values: any) { | ||
61 | + current.value++; | ||
62 | + console.log(step2Values); | ||
63 | + } | ||
64 | + | ||
65 | + function handleRedo() { | ||
66 | + current.value = 0; | ||
67 | + state.initSetp2 = false; | ||
68 | + } | ||
69 | + | ||
70 | + return { | ||
71 | + current, | ||
72 | + handleStep1Next, | ||
73 | + handleStep2Next, | ||
74 | + handleRedo, | ||
75 | + handleStepPrev, | ||
76 | + ...toRefs(state), | ||
77 | + }; | ||
78 | + }, | ||
79 | + }); | ||
80 | +</script> | ||
81 | +<style lang="less" scoped> | ||
82 | + .step-form-content { | ||
83 | + padding: 24px; | ||
84 | + background-color: @component-background; | ||
85 | + } | ||
86 | + | ||
87 | + .step-form-form { | ||
88 | + width: 750px; | ||
89 | + margin: 0 auto; | ||
90 | + } | ||
91 | +</style> |
src/views/device/step/data.ts
0 → 100644
1 | +import { FormSchema } from '/@/components/Form'; | ||
2 | +import { findDictItemByCode } from '/@/api/system/dict'; | ||
3 | + | ||
4 | +export const step1Schemas: FormSchema[] = [ | ||
5 | + { | ||
6 | + field: 'icon', | ||
7 | + label: '设备图片: ', | ||
8 | + slot: 'iconSelect', | ||
9 | + component: 'Input', | ||
10 | + }, | ||
11 | + { | ||
12 | + field: 'name', | ||
13 | + label: '设备名称', | ||
14 | + required: true, | ||
15 | + component: 'Input', | ||
16 | + componentProps: { | ||
17 | + maxLength: 30, | ||
18 | + }, | ||
19 | + }, | ||
20 | + { | ||
21 | + field: 'deviceType', | ||
22 | + label: '设备类型', | ||
23 | + required: true, | ||
24 | + component: 'ApiSelect', | ||
25 | + componentProps: { | ||
26 | + api: findDictItemByCode, | ||
27 | + params: { | ||
28 | + dictCode: 'device_type', | ||
29 | + }, | ||
30 | + labelField: 'itemText', | ||
31 | + valueField: 'itemValue', | ||
32 | + }, | ||
33 | + }, | ||
34 | + { | ||
35 | + field: 'label', | ||
36 | + label: '设备标签', | ||
37 | + component: 'Input', | ||
38 | + componentProps: { | ||
39 | + maxLength: 255, | ||
40 | + }, | ||
41 | + }, | ||
42 | + { | ||
43 | + field: 'devicePosition', | ||
44 | + label: '设备位置', | ||
45 | + component: 'Input', | ||
46 | + slot: 'devicePosition', | ||
47 | + }, | ||
48 | + { | ||
49 | + label: '备注', | ||
50 | + field: 'remark', | ||
51 | + component: 'InputTextArea', | ||
52 | + }, | ||
53 | +]; |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | width="500px" | 7 | width="500px" |
8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
9 | > | 9 | > |
10 | - <BasicForm @register="registerForm"/> | 10 | + <BasicForm @register="registerForm" /> |
11 | </BasicDrawer> | 11 | </BasicDrawer> |
12 | </template> | 12 | </template> |
13 | <script lang="ts"> | 13 | <script lang="ts"> |
@@ -15,8 +15,8 @@ | @@ -15,8 +15,8 @@ | ||
15 | import { BasicForm, useForm } from '/@/components/Form'; | 15 | import { BasicForm, useForm } from '/@/components/Form'; |
16 | import { formSchema } from './config.data'; | 16 | import { formSchema } from './config.data'; |
17 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 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 | export default defineComponent({ | 21 | export default defineComponent({ |
22 | name: 'ConfigDrawer', | 22 | name: 'ConfigDrawer', |
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | setup(_, { emit }) { | 25 | setup(_, { emit }) { |
26 | const isUpdate = ref(true); | 26 | const isUpdate = ref(true); |
27 | 27 | ||
28 | - const [registerForm, { validate,setFieldsValue,resetFields }] = useForm({ | 28 | + const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ |
29 | labelWidth: 120, | 29 | labelWidth: 120, |
30 | schemas: formSchema, | 30 | schemas: formSchema, |
31 | showActionButtonGroup: false, | 31 | showActionButtonGroup: false, |
@@ -37,8 +37,8 @@ | @@ -37,8 +37,8 @@ | ||
37 | isUpdate.value = !!data?.isUpdate; | 37 | isUpdate.value = !!data?.isUpdate; |
38 | if (unref(isUpdate)) { | 38 | if (unref(isUpdate)) { |
39 | const config = data.record.config; | 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 | await setFieldsValue({ | 43 | await setFieldsValue({ |
44 | ...data.record, | 44 | ...data.record, |
@@ -53,27 +53,27 @@ | @@ -53,27 +53,27 @@ | ||
53 | const values = await validate(); | 53 | const values = await validate(); |
54 | const { createMessage } = useMessage(); | 54 | const { createMessage } = useMessage(); |
55 | setDrawerProps({ confirmLoading: true }); | 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 | Reflect.set(values, 'config', config); | 70 | Reflect.set(values, 'config', config); |
71 | - let saveMessage = "添加成功"; | ||
72 | - let updateMessage = "修改成功"; | 71 | + let saveMessage = '添加成功'; |
72 | + let updateMessage = '修改成功'; | ||
73 | await saveOrEditMessageConfig(values, unref(isUpdate)); | 73 | await saveOrEditMessageConfig(values, unref(isUpdate)); |
74 | closeDrawer(); | 74 | closeDrawer(); |
75 | emit('success'); | 75 | emit('success'); |
76 | - createMessage.success(unref(isUpdate)?updateMessage:saveMessage); | 76 | + createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); |
77 | } finally { | 77 | } finally { |
78 | setDrawerProps({ confirmLoading: false }); | 78 | setDrawerProps({ confirmLoading: false }); |
79 | } | 79 | } |
@@ -2,10 +2,10 @@ import { BasicColumn } from '/@/components/Table'; | @@ -2,10 +2,10 @@ import { BasicColumn } from '/@/components/Table'; | ||
2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; |
3 | import { h } from 'vue'; | 3 | import { h } from 'vue'; |
4 | import { Switch } from 'ant-design-vue'; | 4 | import { Switch } from 'ant-design-vue'; |
5 | -import {setMessageConfigStatus} from "/@/api/message/config"; | 5 | +import { setMessageConfigStatus } from '/@/api/message/config'; |
6 | import { useMessage } from '/@/hooks/web/useMessage'; | 6 | import { useMessage } from '/@/hooks/web/useMessage'; |
7 | -import {findDictItemByCode} from "/@/api/system/dict"; | ||
8 | -import {MessageEnum} from "/@/enums/messageEnum"; | 7 | +import { findDictItemByCode } from '/@/api/system/dict'; |
8 | +import { MessageEnum } from '/@/enums/messageEnum'; | ||
9 | export const columns: BasicColumn[] = [ | 9 | export const columns: BasicColumn[] = [ |
10 | { | 10 | { |
11 | title: '配置名称', | 11 | title: '配置名称', |
@@ -45,7 +45,7 @@ export const columns: BasicColumn[] = [ | @@ -45,7 +45,7 @@ export const columns: BasicColumn[] = [ | ||
45 | record.pendingStatus = true; | 45 | record.pendingStatus = true; |
46 | const newStatus = checked ? 1 : 0; | 46 | const newStatus = checked ? 1 : 0; |
47 | const { createMessage } = useMessage(); | 47 | const { createMessage } = useMessage(); |
48 | - setMessageConfigStatus(record.id, record.messageType,newStatus) | 48 | + setMessageConfigStatus(record.id, record.messageType, newStatus) |
49 | .then(() => { | 49 | .then(() => { |
50 | record.status = newStatus; | 50 | record.status = newStatus; |
51 | createMessage.success(`修改成功`); | 51 | createMessage.success(`修改成功`); |
@@ -96,20 +96,19 @@ export const searchFormSchema: FormSchema[] = [ | @@ -96,20 +96,19 @@ export const searchFormSchema: FormSchema[] = [ | ||
96 | }, | 96 | }, |
97 | ]; | 97 | ]; |
98 | 98 | ||
99 | - | ||
100 | -export const isMessage = (type:string)=>{ | ||
101 | - return type===MessageEnum.IS_SMS; | ||
102 | -} | ||
103 | -export const isEmail = (type:string)=>{ | ||
104 | - return type===MessageEnum.IS_EMAIL; | ||
105 | -} | 99 | +export const isMessage = (type: string) => { |
100 | + return type === MessageEnum.IS_SMS; | ||
101 | +}; | ||
102 | +export const isEmail = (type: string) => { | ||
103 | + return type === MessageEnum.IS_EMAIL; | ||
104 | +}; | ||
106 | 105 | ||
107 | export const formSchema: FormSchema[] = [ | 106 | export const formSchema: FormSchema[] = [ |
108 | { | 107 | { |
109 | field: 'configName', | 108 | field: 'configName', |
110 | label: '配置名称', | 109 | label: '配置名称', |
111 | required: true, | 110 | required: true, |
112 | - component:'Input' | 111 | + component: 'Input', |
113 | }, | 112 | }, |
114 | { | 113 | { |
115 | field: 'messageType', | 114 | field: 'messageType', |
@@ -117,12 +116,12 @@ export const formSchema: FormSchema[] = [ | @@ -117,12 +116,12 @@ export const formSchema: FormSchema[] = [ | ||
117 | required: true, | 116 | required: true, |
118 | component: 'ApiSelect', | 117 | component: 'ApiSelect', |
119 | componentProps: { | 118 | componentProps: { |
120 | - api:findDictItemByCode, | ||
121 | - params:{ | ||
122 | - dictCode:"message_type" | 119 | + api: findDictItemByCode, |
120 | + params: { | ||
121 | + dictCode: 'message_type', | ||
123 | }, | 122 | }, |
124 | - labelField:'itemText', | ||
125 | - valueField:'itemValue', | 123 | + labelField: 'itemText', |
124 | + valueField: 'itemValue', | ||
126 | }, | 125 | }, |
127 | }, | 126 | }, |
128 | { | 127 | { |
@@ -131,70 +130,70 @@ export const formSchema: FormSchema[] = [ | @@ -131,70 +130,70 @@ export const formSchema: FormSchema[] = [ | ||
131 | required: true, | 130 | required: true, |
132 | component: 'ApiSelect', | 131 | component: 'ApiSelect', |
133 | componentProps: { | 132 | componentProps: { |
134 | - api:findDictItemByCode, | ||
135 | - params:{ | ||
136 | - dictCode:"platform_type" | 133 | + api: findDictItemByCode, |
134 | + params: { | ||
135 | + dictCode: 'platform_type', | ||
137 | }, | 136 | }, |
138 | - labelField:'itemText', | ||
139 | - valueField:'itemValue', | 137 | + labelField: 'itemText', |
138 | + valueField: 'itemValue', | ||
140 | }, | 139 | }, |
141 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | 140 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), |
142 | }, | 141 | }, |
143 | { | 142 | { |
144 | field: 'accessKeyId', | 143 | field: 'accessKeyId', |
145 | label: 'accessKeyId', | 144 | label: 'accessKeyId', |
146 | required: true, | 145 | required: true, |
147 | - component:'Input', | ||
148 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | 146 | + component: 'Input', |
147 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | ||
149 | }, | 148 | }, |
150 | { | 149 | { |
151 | field: 'accessKeySecret', | 150 | field: 'accessKeySecret', |
152 | label: 'accessKeySecret', | 151 | label: 'accessKeySecret', |
153 | required: true, | 152 | required: true, |
154 | - component:'Input', | ||
155 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | 153 | + component: 'Input', |
154 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | ||
156 | }, | 155 | }, |
157 | { | 156 | { |
158 | field: 'host', | 157 | field: 'host', |
159 | label: '服务器地址', | 158 | label: '服务器地址', |
160 | - defaultValue:'smtp.163.com', | 159 | + defaultValue: 'smtp.163.com', |
161 | required: true, | 160 | required: true, |
162 | - component:'Input', | ||
163 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | 161 | + component: 'Input', |
162 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | ||
164 | }, | 163 | }, |
165 | { | 164 | { |
166 | field: 'port', | 165 | field: 'port', |
167 | label: '端口', | 166 | label: '端口', |
168 | defaultValue: 25, | 167 | defaultValue: 25, |
169 | required: true, | 168 | required: true, |
170 | - component:'InputNumber', | ||
171 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | 169 | + component: 'InputNumber', |
170 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | ||
172 | }, | 171 | }, |
173 | { | 172 | { |
174 | field: 'username', | 173 | field: 'username', |
175 | label: '用户名', | 174 | label: '用户名', |
176 | required: true, | 175 | required: true, |
177 | - component:'Input', | ||
178 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | 176 | + component: 'Input', |
177 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | ||
179 | }, | 178 | }, |
180 | { | 179 | { |
181 | field: 'password', | 180 | field: 'password', |
182 | label: '密码', | 181 | label: '密码', |
183 | required: true, | 182 | required: true, |
184 | - component:'InputPassword', | ||
185 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | 183 | + component: 'InputPassword', |
184 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | ||
186 | }, | 185 | }, |
187 | { | 186 | { |
188 | field: 'config', | 187 | field: 'config', |
189 | label: '消息配置', | 188 | label: '消息配置', |
190 | - component:'Input', | ||
191 | - show:false, | 189 | + component: 'Input', |
190 | + show: false, | ||
192 | }, | 191 | }, |
193 | { | 192 | { |
194 | field: 'id', | 193 | field: 'id', |
195 | label: '主键', | 194 | label: '主键', |
196 | - component:'Input', | ||
197 | - show:false, | 195 | + component: 'Input', |
196 | + show: false, | ||
198 | }, | 197 | }, |
199 | { | 198 | { |
200 | field: 'status', | 199 | field: 'status', |
@@ -212,5 +211,5 @@ export const formSchema: FormSchema[] = [ | @@ -212,5 +211,5 @@ export const formSchema: FormSchema[] = [ | ||
212 | label: '备注', | 211 | label: '备注', |
213 | field: 'remark', | 212 | field: 'remark', |
214 | component: 'InputTextArea', | 213 | component: 'InputTextArea', |
215 | - } | 214 | + }, |
216 | ]; | 215 | ]; |
@@ -4,26 +4,26 @@ | @@ -4,26 +4,26 @@ | ||
4 | <template #toolbar> | 4 | <template #toolbar> |
5 | <a-button type="primary" @click="handleCreate"> 新增配置 </a-button> | 5 | <a-button type="primary" @click="handleCreate"> 新增配置 </a-button> |
6 | </template> | 6 | </template> |
7 | - <template #config="{record}"> | 7 | + <template #config="{ record }"> |
8 | <a-button type="link" class="ml-2" @click="showData(record)"> 查看配置 </a-button> | 8 | <a-button type="link" class="ml-2" @click="showData(record)"> 查看配置 </a-button> |
9 | </template> | 9 | </template> |
10 | <template #action="{ record }"> | 10 | <template #action="{ record }"> |
11 | <TableAction | 11 | <TableAction |
12 | :actions="[ | 12 | :actions="[ |
13 | { | 13 | { |
14 | - label:'编辑', | 14 | + label: '编辑', |
15 | icon: 'clarity:note-edit-line', | 15 | icon: 'clarity:note-edit-line', |
16 | onClick: handleEdit.bind(null, record), | 16 | onClick: handleEdit.bind(null, record), |
17 | }, | 17 | }, |
18 | { | 18 | { |
19 | - label:'删除', | 19 | + label: '删除', |
20 | icon: 'ant-design:delete-outlined', | 20 | icon: 'ant-design:delete-outlined', |
21 | color: 'error', | 21 | color: 'error', |
22 | popConfirm: { | 22 | popConfirm: { |
23 | title: '是否确认删除', | 23 | title: '是否确认删除', |
24 | confirm: handleDelete.bind(null, record), | 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,83 +33,83 @@ | ||
33 | </div> | 33 | </div> |
34 | </template> | 34 | </template> |
35 | <script lang="ts"> | 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 | </script> | 115 | </script> |
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | </template> | 13 | </template> |
14 | 14 | ||
15 | <script lang="ts"> | 15 | <script lang="ts"> |
16 | - import { Tabs, } from 'ant-design-vue'; | 16 | + import { Tabs } from 'ant-design-vue'; |
17 | import { defineComponent } from 'vue'; | 17 | import { defineComponent } from 'vue'; |
18 | import SmsLog from './item/SmsLog.vue'; | 18 | import SmsLog from './item/SmsLog.vue'; |
19 | import EmailLog from './item/EmailLog.vue'; | 19 | import EmailLog from './item/EmailLog.vue'; |
1 | <template> | 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 | <div class="pt-6px pr-6px"> | 10 | <div class="pt-6px pr-6px"> |
7 | - <BasicForm @register="registerForm"/> | 11 | + <BasicForm @register="registerForm" /> |
8 | </div> | 12 | </div> |
9 | </BasicModal> | 13 | </BasicModal> |
10 | </template> | 14 | </template> |
11 | <script lang="ts"> | 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 | </script> | 62 | </script> |
@@ -8,12 +8,12 @@ | @@ -8,12 +8,12 @@ | ||
8 | <TableAction | 8 | <TableAction |
9 | :actions="[ | 9 | :actions="[ |
10 | { | 10 | { |
11 | - label:'查看', | 11 | + label: '查看', |
12 | icon: 'ant-design:fund-view-outlined', | 12 | icon: 'ant-design:fund-view-outlined', |
13 | onClick: handleModal.bind(null, record), | 13 | onClick: handleModal.bind(null, record), |
14 | }, | 14 | }, |
15 | { | 15 | { |
16 | - label:'删除', | 16 | + label: '删除', |
17 | icon: 'ant-design:delete-outlined', | 17 | icon: 'ant-design:delete-outlined', |
18 | color: 'error', | 18 | color: 'error', |
19 | popConfirm: { | 19 | popConfirm: { |
@@ -25,81 +25,79 @@ | @@ -25,81 +25,79 @@ | ||
25 | /> | 25 | /> |
26 | </template> | 26 | </template> |
27 | </BasicTable> | 27 | </BasicTable> |
28 | - <EmailDetail @register="registerModal"/> | 28 | + <EmailDetail @register="registerModal" /> |
29 | </div> | 29 | </div> |
30 | </template> | 30 | </template> |
31 | <script lang="ts"> | 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 | </script> | 103 | </script> |
@@ -8,12 +8,12 @@ | @@ -8,12 +8,12 @@ | ||
8 | <TableAction | 8 | <TableAction |
9 | :actions="[ | 9 | :actions="[ |
10 | { | 10 | { |
11 | - label:'查看', | 11 | + label: '查看', |
12 | icon: 'ant-design:fund-view-outlined', | 12 | icon: 'ant-design:fund-view-outlined', |
13 | onClick: handleQuery.bind(null, record), | 13 | onClick: handleQuery.bind(null, record), |
14 | }, | 14 | }, |
15 | { | 15 | { |
16 | - label:'删除', | 16 | + label: '删除', |
17 | icon: 'ant-design:delete-outlined', | 17 | icon: 'ant-design:delete-outlined', |
18 | color: 'error', | 18 | color: 'error', |
19 | popConfirm: { | 19 | popConfirm: { |
@@ -28,76 +28,74 @@ | @@ -28,76 +28,74 @@ | ||
28 | </div> | 28 | </div> |
29 | </template> | 29 | </template> |
30 | <script lang="ts"> | 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 | </script> | 101 | </script> |
1 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; |
2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; |
3 | -import {h} from "vue"; | ||
4 | -import {Tag} from "ant-design-vue"; | ||
5 | -import {useI18n} from "/@/hooks/web/useI18n"; | 3 | +import { h } from 'vue'; |
4 | +import { Tag } from 'ant-design-vue'; | ||
5 | +import { useI18n } from '/@/hooks/web/useI18n'; | ||
6 | const { t } = useI18n(); | 6 | const { t } = useI18n(); |
7 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ |
8 | { | 8 | { |
@@ -13,7 +13,7 @@ export const columns: BasicColumn[] = [ | @@ -13,7 +13,7 @@ export const columns: BasicColumn[] = [ | ||
13 | { | 13 | { |
14 | title: '收件人', | 14 | title: '收件人', |
15 | dataIndex: 'emailTo', | 15 | dataIndex: 'emailTo', |
16 | - width:160, | 16 | + width: 160, |
17 | }, | 17 | }, |
18 | { | 18 | { |
19 | title: '状态', | 19 | title: '状态', |
@@ -23,21 +23,21 @@ export const columns: BasicColumn[] = [ | @@ -23,21 +23,21 @@ export const columns: BasicColumn[] = [ | ||
23 | const status = record.status; | 23 | const status = record.status; |
24 | const success = status === 'SUCCESS'; | 24 | const success = status === 'SUCCESS'; |
25 | const color = success ? 'green' : 'red'; | 25 | const color = success ? 'green' : 'red'; |
26 | - let successText:string = t('routes.common.system.tableSuccessStatus'); | ||
27 | - let failedText:string = t('routes.common.system.tableFailedStatus'); | 26 | + let successText: string = t('routes.common.system.tableSuccessStatus'); |
27 | + let failedText: string = t('routes.common.system.tableFailedStatus'); | ||
28 | const text = success ? successText : failedText; | 28 | const text = success ? successText : failedText; |
29 | return h(Tag, { color: color }, () => text); | 29 | return h(Tag, { color: color }, () => text); |
30 | - } | 30 | + }, |
31 | }, | 31 | }, |
32 | { | 32 | { |
33 | title: '用途', | 33 | title: '用途', |
34 | dataIndex: 'templatePurposeDictText', | 34 | dataIndex: 'templatePurposeDictText', |
35 | - width:160, | 35 | + width: 160, |
36 | }, | 36 | }, |
37 | { | 37 | { |
38 | title: '备注', | 38 | title: '备注', |
39 | dataIndex: 'remark', | 39 | dataIndex: 'remark', |
40 | - width:160, | 40 | + width: 160, |
41 | }, | 41 | }, |
42 | { | 42 | { |
43 | title: '发送时间', | 43 | title: '发送时间', |
1 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; |
2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; |
3 | -import {h} from "vue"; | ||
4 | -import {Tag} from "ant-design-vue"; | ||
5 | -import {useI18n} from "/@/hooks/web/useI18n"; | 3 | +import { h } from 'vue'; |
4 | +import { Tag } from 'ant-design-vue'; | ||
5 | +import { useI18n } from '/@/hooks/web/useI18n'; | ||
6 | const { t } = useI18n(); | 6 | const { t } = useI18n(); |
7 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ |
8 | { | 8 | { |
@@ -13,7 +13,7 @@ export const columns: BasicColumn[] = [ | @@ -13,7 +13,7 @@ export const columns: BasicColumn[] = [ | ||
13 | { | 13 | { |
14 | title: '短信平台', | 14 | title: '短信平台', |
15 | dataIndex: 'typeDictText', | 15 | dataIndex: 'typeDictText', |
16 | - width:180, | 16 | + width: 180, |
17 | }, | 17 | }, |
18 | { | 18 | { |
19 | title: '用途', | 19 | title: '用途', |
@@ -28,11 +28,11 @@ export const columns: BasicColumn[] = [ | @@ -28,11 +28,11 @@ export const columns: BasicColumn[] = [ | ||
28 | const status = record.status; | 28 | const status = record.status; |
29 | const success = status === 'SUCCESS'; | 29 | const success = status === 'SUCCESS'; |
30 | const color = success ? 'green' : 'red'; | 30 | const color = success ? 'green' : 'red'; |
31 | - let successText:string = t('routes.common.system.tableSuccessStatus'); | ||
32 | - let failedText:string = t('routes.common.system.tableFailedStatus'); | 31 | + let successText: string = t('routes.common.system.tableSuccessStatus'); |
32 | + let failedText: string = t('routes.common.system.tableFailedStatus'); | ||
33 | const text = success ? successText : failedText; | 33 | const text = success ? successText : failedText; |
34 | return h(Tag, { color: color }, () => text); | 34 | return h(Tag, { color: color }, () => text); |
35 | - } | 35 | + }, |
36 | }, | 36 | }, |
37 | { | 37 | { |
38 | title: '备注', | 38 | title: '备注', |
1 | <template> | 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 | <div class="pt-6px pr-6px"> | 9 | <div class="pt-6px pr-6px"> |
5 | - <BasicForm @register="registerForm"/> | 10 | + <BasicForm @register="registerForm" /> |
6 | </div> | 11 | </div> |
7 | </BasicModal> | 12 | </BasicModal> |
8 | </template> | 13 | </template> |
9 | <script lang="ts"> | 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 | </script> | 132 | </script> |
1 | <template> | 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 | <div class="pt-4px pr-4px"> | 3 | <div class="pt-4px pr-4px"> |
9 | - <BasicForm @register="registerForm"/> | 4 | + <BasicForm @register="registerForm" /> |
10 | </div> | 5 | </div> |
11 | </BasicModal> | 6 | </BasicModal> |
12 | </template> | 7 | </template> |
13 | <script lang="ts"> | 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 | </script> | 86 | </script> |
@@ -4,11 +4,11 @@ | @@ -4,11 +4,11 @@ | ||
4 | @register="registerDrawer" | 4 | @register="registerDrawer" |
5 | showFooter | 5 | showFooter |
6 | :title="getTitle" | 6 | :title="getTitle" |
7 | - :helpMessage="['用户登录、忘记密码模板平台只提供{code}参数','初始密码设置平台提供{name}参数']" | 7 | + :helpMessage="['用户登录、忘记密码模板平台只提供{code}参数', '初始密码设置平台提供{name}参数']" |
8 | width="500px" | 8 | width="500px" |
9 | @ok="handleSubmit" | 9 | @ok="handleSubmit" |
10 | > | 10 | > |
11 | - <BasicForm @register="registerForm"/> | 11 | + <BasicForm @register="registerForm" /> |
12 | </BasicDrawer> | 12 | </BasicDrawer> |
13 | </template> | 13 | </template> |
14 | <script lang="ts"> | 14 | <script lang="ts"> |
@@ -16,15 +16,15 @@ | @@ -16,15 +16,15 @@ | ||
16 | import { BasicForm, useForm } from '/@/components/Form'; | 16 | import { BasicForm, useForm } from '/@/components/Form'; |
17 | import { formSchema } from './template.data'; | 17 | import { formSchema } from './template.data'; |
18 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 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 | export default defineComponent({ | 21 | export default defineComponent({ |
22 | name: 'TemplateDrawer', | 22 | name: 'TemplateDrawer', |
23 | components: { BasicDrawer, BasicForm }, | 23 | components: { BasicDrawer, BasicForm }, |
24 | emits: ['success', 'register'], | 24 | emits: ['success', 'register'], |
25 | setup(_, { emit }) { | 25 | setup(_, { emit }) { |
26 | const isUpdate = ref(true); | 26 | const isUpdate = ref(true); |
27 | - const [registerForm, { validate,setFieldsValue,resetFields }] = useForm({ | 27 | + const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ |
28 | labelWidth: 120, | 28 | labelWidth: 120, |
29 | schemas: formSchema, | 29 | schemas: formSchema, |
30 | showActionButtonGroup: false, | 30 | showActionButtonGroup: false, |
@@ -36,8 +36,8 @@ | @@ -36,8 +36,8 @@ | ||
36 | isUpdate.value = !!data?.isUpdate; | 36 | isUpdate.value = !!data?.isUpdate; |
37 | if (unref(isUpdate)) { | 37 | if (unref(isUpdate)) { |
38 | const config = data.record.config; | 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 | await setFieldsValue({ | 42 | await setFieldsValue({ |
43 | ...data.record, | 43 | ...data.record, |
@@ -52,27 +52,27 @@ | @@ -52,27 +52,27 @@ | ||
52 | const values = await validate(); | 52 | const values = await validate(); |
53 | const { createMessage } = useMessage(); | 53 | const { createMessage } = useMessage(); |
54 | setDrawerProps({ confirmLoading: true }); | 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 | Reflect.set(values, 'config', config); | 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 | closeDrawer(); | 73 | closeDrawer(); |
74 | emit('success'); | 74 | emit('success'); |
75 | - createMessage.success(unref(isUpdate)?updateMessage:saveMessage); | 75 | + createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); |
76 | } finally { | 76 | } finally { |
77 | setDrawerProps({ confirmLoading: false }); | 77 | setDrawerProps({ confirmLoading: false }); |
78 | } | 78 | } |
@@ -4,24 +4,26 @@ | @@ -4,24 +4,26 @@ | ||
4 | <template #toolbar> | 4 | <template #toolbar> |
5 | <a-button type="primary" @click="handleCreate"> 新增模板 </a-button> | 5 | <a-button type="primary" @click="handleCreate"> 新增模板 </a-button> |
6 | </template> | 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 | </template> | 11 | </template> |
10 | <template #action="{ record }"> | 12 | <template #action="{ record }"> |
11 | <TableAction | 13 | <TableAction |
12 | :actions="[ | 14 | :actions="[ |
13 | { | 15 | { |
14 | - label:'发送', | 16 | + label: '发送', |
15 | icon: 'ant-design:send-outlined', | 17 | icon: 'ant-design:send-outlined', |
16 | onClick: handleModal.bind(null, record), | 18 | onClick: handleModal.bind(null, record), |
17 | }, | 19 | }, |
18 | { | 20 | { |
19 | - label:'编辑', | 21 | + label: '编辑', |
20 | icon: 'clarity:note-edit-line', | 22 | icon: 'clarity:note-edit-line', |
21 | onClick: handleEdit.bind(null, record), | 23 | onClick: handleEdit.bind(null, record), |
22 | }, | 24 | }, |
23 | { | 25 | { |
24 | - label:'删除', | 26 | + label: '删除', |
25 | icon: 'ant-design:delete-outlined', | 27 | icon: 'ant-design:delete-outlined', |
26 | color: 'error', | 28 | color: 'error', |
27 | popConfirm: { | 29 | popConfirm: { |
@@ -33,119 +35,119 @@ | @@ -33,119 +35,119 @@ | ||
33 | /> | 35 | /> |
34 | </template> | 36 | </template> |
35 | </BasicTable> | 37 | </BasicTable> |
36 | - <SendSms @register="registerModal"/> | ||
37 | - <SendEmail @register="registerMailModal"/> | 38 | + <SendSms @register="registerModal" /> |
39 | + <SendEmail @register="registerMailModal" /> | ||
38 | <TemplateDrawer @register="registerDrawer" @success="handleSuccess" /> | 40 | <TemplateDrawer @register="registerDrawer" @success="handleSuccess" /> |
39 | </div> | 41 | </div> |
40 | </template> | 42 | </template> |
41 | <script lang="ts"> | 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 | record, | 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 | </script> | 153 | </script> |
1 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; |
2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; |
3 | -import {findDictItemByCode} from "/@/api/system/dict"; | ||
4 | -import {findMessageConfig} from "/@/api/message/config"; | ||
5 | -import {isMessage} from "/@/views/message/config/config.data"; | ||
6 | -import {h} from "vue"; | ||
7 | -import {Switch} from "ant-design-vue"; | ||
8 | -import {useMessage} from "/@/hooks/web/useMessage"; | ||
9 | -import {setMessageTemplateStatus} from "/@/api/message/template"; | 3 | +import { findDictItemByCode } from '/@/api/system/dict'; |
4 | +import { findMessageConfig } from '/@/api/message/config'; | ||
5 | +import { isMessage } from '/@/views/message/config/config.data'; | ||
6 | +import { h } from 'vue'; | ||
7 | +import { Switch } from 'ant-design-vue'; | ||
8 | +import { useMessage } from '/@/hooks/web/useMessage'; | ||
9 | +import { setMessageTemplateStatus } from '/@/api/message/template'; | ||
10 | 10 | ||
11 | export const columns: BasicColumn[] = [ | 11 | export const columns: BasicColumn[] = [ |
12 | { | 12 | { |
@@ -31,8 +31,8 @@ export const columns: BasicColumn[] = [ | @@ -31,8 +31,8 @@ export const columns: BasicColumn[] = [ | ||
31 | width: 180, | 31 | width: 180, |
32 | }, | 32 | }, |
33 | { | 33 | { |
34 | - title:'模板用途', | ||
35 | - dataIndex:'templatePurposeDictText', | 34 | + title: '模板用途', |
35 | + dataIndex: 'templatePurposeDictText', | ||
36 | width: 180, | 36 | width: 180, |
37 | }, | 37 | }, |
38 | { | 38 | { |
@@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | @@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | ||
52 | record.pendingStatus = true; | 52 | record.pendingStatus = true; |
53 | const newStatus = checked ? 1 : 0; | 53 | const newStatus = checked ? 1 : 0; |
54 | const { createMessage } = useMessage(); | 54 | const { createMessage } = useMessage(); |
55 | - setMessageTemplateStatus(record.id,record.templatePurpose,record.messageType,newStatus) | 55 | + setMessageTemplateStatus(record.id, record.templatePurpose, record.messageType, newStatus) |
56 | .then(() => { | 56 | .then(() => { |
57 | record.status = newStatus; | 57 | record.status = newStatus; |
58 | createMessage.success(`修改成功`); | 58 | createMessage.success(`修改成功`); |
@@ -68,7 +68,7 @@ export const columns: BasicColumn[] = [ | @@ -68,7 +68,7 @@ export const columns: BasicColumn[] = [ | ||
68 | title: '模板用途', | 68 | title: '模板用途', |
69 | dataIndex: 'templatePurpose', | 69 | dataIndex: 'templatePurpose', |
70 | width: 180, | 70 | width: 180, |
71 | - ifShow:false | 71 | + ifShow: false, |
72 | }, | 72 | }, |
73 | { | 73 | { |
74 | title: '创建时间', | 74 | title: '创建时间', |
@@ -96,8 +96,8 @@ export const formSchema: FormSchema[] = [ | @@ -96,8 +96,8 @@ export const formSchema: FormSchema[] = [ | ||
96 | { | 96 | { |
97 | field: 'id', | 97 | field: 'id', |
98 | label: '主键', | 98 | label: '主键', |
99 | - component:'Input', | ||
100 | - show:false, | 99 | + component: 'Input', |
100 | + show: false, | ||
101 | }, | 101 | }, |
102 | { | 102 | { |
103 | field: 'messageType', | 103 | field: 'messageType', |
@@ -105,12 +105,12 @@ export const formSchema: FormSchema[] = [ | @@ -105,12 +105,12 @@ export const formSchema: FormSchema[] = [ | ||
105 | required: true, | 105 | required: true, |
106 | component: 'ApiSelect', | 106 | component: 'ApiSelect', |
107 | componentProps: { | 107 | componentProps: { |
108 | - api:findDictItemByCode, | ||
109 | - params:{ | ||
110 | - dictCode:"message_type" | 108 | + api: findDictItemByCode, |
109 | + params: { | ||
110 | + dictCode: 'message_type', | ||
111 | }, | 111 | }, |
112 | - labelField:'itemText', | ||
113 | - valueField:'itemValue', | 112 | + labelField: 'itemText', |
113 | + valueField: 'itemValue', | ||
114 | }, | 114 | }, |
115 | }, | 115 | }, |
116 | { | 116 | { |
@@ -119,13 +119,13 @@ export const formSchema: FormSchema[] = [ | @@ -119,13 +119,13 @@ export const formSchema: FormSchema[] = [ | ||
119 | required: true, | 119 | required: true, |
120 | component: 'ApiSelect', | 120 | component: 'ApiSelect', |
121 | componentProps: { | 121 | componentProps: { |
122 | - api:findMessageConfig, | ||
123 | - params:{ | ||
124 | - messageType:({values}) => Reflect.get(values,'messageType') | 122 | + api: findMessageConfig, |
123 | + params: { | ||
124 | + messageType: ({ values }) => Reflect.get(values, 'messageType'), | ||
125 | }, | 125 | }, |
126 | - immediate:true, | ||
127 | - labelField:'configName', | ||
128 | - valueField:'id', | 126 | + immediate: true, |
127 | + labelField: 'configName', | ||
128 | + valueField: 'id', | ||
129 | }, | 129 | }, |
130 | }, | 130 | }, |
131 | { | 131 | { |
@@ -139,14 +139,14 @@ export const formSchema: FormSchema[] = [ | @@ -139,14 +139,14 @@ export const formSchema: FormSchema[] = [ | ||
139 | label: '模板编号', | 139 | label: '模板编号', |
140 | required: true, | 140 | required: true, |
141 | component: 'Input', | 141 | component: 'Input', |
142 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | 142 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), |
143 | }, | 143 | }, |
144 | { | 144 | { |
145 | field: 'signName', | 145 | field: 'signName', |
146 | label: '签名', | 146 | label: '签名', |
147 | - required:true, | 147 | + required: true, |
148 | component: 'Input', | 148 | component: 'Input', |
149 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | 149 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), |
150 | }, | 150 | }, |
151 | { | 151 | { |
152 | field: 'templatePurpose', | 152 | field: 'templatePurpose', |
@@ -155,12 +155,12 @@ export const formSchema: FormSchema[] = [ | @@ -155,12 +155,12 @@ export const formSchema: FormSchema[] = [ | ||
155 | component: 'ApiSelect', | 155 | component: 'ApiSelect', |
156 | helpMessage: ['用户登录、忘记密码模板平台只提供"code"参数', '初始密码设置平台提供"name"参数'], | 156 | helpMessage: ['用户登录、忘记密码模板平台只提供"code"参数', '初始密码设置平台提供"name"参数'], |
157 | componentProps: { | 157 | componentProps: { |
158 | - api:findDictItemByCode, | ||
159 | - params:{ | ||
160 | - dictCode:"template_purpose" | 158 | + api: findDictItemByCode, |
159 | + params: { | ||
160 | + dictCode: 'template_purpose', | ||
161 | }, | 161 | }, |
162 | - labelField:'itemText', | ||
163 | - valueField:'itemValue', | 162 | + labelField: 'itemText', |
163 | + valueField: 'itemValue', | ||
164 | }, | 164 | }, |
165 | }, | 165 | }, |
166 | ]; | 166 | ]; |
@@ -16,11 +16,7 @@ | @@ -16,11 +16,7 @@ | ||
16 | <div class="hidden min-h-full pl-4 mr-4 xl:flex xl:flex-col xl:w-6/12"> | 16 | <div class="hidden min-h-full pl-4 mr-4 xl:flex xl:flex-col xl:w-6/12"> |
17 | <AppLogo class="-enter-x" /> | 17 | <AppLogo class="-enter-x" /> |
18 | <div class="my-auto"> | 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 | <div class="mt-10 font-medium text-white -enter-x"> | 20 | <div class="mt-10 font-medium text-white -enter-x"> |
25 | <span class="inline-block mt-4 text-3xl"> {{ t('sys.login.signInTitle') }}</span> | 21 | <span class="inline-block mt-4 text-3xl"> {{ t('sys.login.signInTitle') }}</span> |
26 | </div> | 22 | </div> |
@@ -25,8 +25,6 @@ | @@ -25,8 +25,6 @@ | ||
25 | /> | 25 | /> |
26 | </FormItem> | 26 | </FormItem> |
27 | 27 | ||
28 | - | ||
29 | - | ||
30 | <FormItem class="enter-x"> | 28 | <FormItem class="enter-x"> |
31 | <Button type="primary" size="large" block @click="handleLogin" :loading="loading"> | 29 | <Button type="primary" size="large" block @click="handleLogin" :loading="loading"> |
32 | {{ t('sys.login.loginButton') }} | 30 | {{ t('sys.login.loginButton') }} |
@@ -44,10 +42,9 @@ | @@ -44,10 +42,9 @@ | ||
44 | </Button> | 42 | </Button> |
45 | </ACol> | 43 | </ACol> |
46 | </ARow> | 44 | </ARow> |
47 | - <ARow class="enter-x"> | 45 | + <ARow class="enter-x"> |
48 | <ACol :span="12"> | 46 | <ACol :span="12"> |
49 | - <FormItem> | ||
50 | - </FormItem> | 47 | + <FormItem> </FormItem> |
51 | </ACol> | 48 | </ACol> |
52 | <ACol :span="12"> | 49 | <ACol :span="12"> |
53 | <FormItem :style="{ 'text-align': 'right' }"> | 50 | <FormItem :style="{ 'text-align': 'right' }"> |
@@ -123,9 +120,12 @@ | @@ -123,9 +120,12 @@ | ||
123 | } catch (error) { | 120 | } catch (error) { |
124 | createErrorModal({ | 121 | createErrorModal({ |
125 | title: t('sys.api.loginFailed'), | 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 | getContainer: () => document.body.querySelector(`.${prefixCls}`) || document.body, | 129 | getContainer: () => document.body.querySelector(`.${prefixCls}`) || document.body, |
130 | }); | 130 | }); |
131 | } finally { | 131 | } finally { |
@@ -32,15 +32,15 @@ | @@ -32,15 +32,15 @@ | ||
32 | </template> | 32 | </template> |
33 | </template> | 33 | </template> |
34 | <script lang="ts" setup> | 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 | import { CountdownInput } from '/@/components/CountDown'; | 37 | import { CountdownInput } from '/@/components/CountDown'; |
38 | import LoginFormTitle from './LoginFormTitle.vue'; | 38 | import LoginFormTitle from './LoginFormTitle.vue'; |
39 | import { useI18n } from '/@/hooks/web/useI18n'; | 39 | import { useI18n } from '/@/hooks/web/useI18n'; |
40 | import { useLoginState, useFormRules, useFormValid, LoginStateEnum } from './useLogin'; | 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 | const { notification, createErrorModal } = useMessage(); | 44 | const { notification, createErrorModal } = useMessage(); |
45 | 45 | ||
46 | const FormItem = Form.Item; | 46 | const FormItem = Form.Item; |
@@ -57,18 +57,18 @@ import {reactive, ref, computed, unref, toRaw} from 'vue'; | @@ -57,18 +57,18 @@ import {reactive, ref, computed, unref, toRaw} from 'vue'; | ||
57 | }); | 57 | }); |
58 | 58 | ||
59 | async function sendLoginSms() { | 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 | return true; | 68 | return true; |
68 | - }else{ | 69 | + } else { |
69 | message.error('请输入正确手机号码'); | 70 | message.error('请输入正确手机号码'); |
70 | } | 71 | } |
71 | - | ||
72 | } | 72 | } |
73 | 73 | ||
74 | const { validForm } = useFormValid(formRef); | 74 | const { validForm } = useFormValid(formRef); |
1 | <template> | 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 | </PageWrapper> | 4 | </PageWrapper> |
12 | </template> | 5 | </template> |
13 | 6 | ||
@@ -16,48 +9,52 @@ | @@ -16,48 +9,52 @@ | ||
16 | import { useRoute } from 'vue-router'; | 9 | import { useRoute } from 'vue-router'; |
17 | import { PageWrapper } from '/@/components/Page'; | 10 | import { PageWrapper } from '/@/components/Page'; |
18 | import { useGo } from '/@/hooks/web/usePage'; | 11 | import { useGo } from '/@/hooks/web/usePage'; |
19 | - import {Description} from "../../../components/Description"; | 12 | + import { Description } from '../../../components/Description'; |
20 | import { useTabs } from '/@/hooks/web/useTabs'; | 13 | import { useTabs } from '/@/hooks/web/useTabs'; |
21 | import { Tabs } from 'ant-design-vue'; | 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 | const accountData = {}; | 18 | const accountData = {}; |
26 | export default defineComponent({ | 19 | export default defineComponent({ |
27 | name: 'AccountDetail', | 20 | name: 'AccountDetail', |
28 | - components: { PageWrapper, ATabs: Tabs, ATabPane: Tabs.TabPane,Description }, | 21 | + components: { PageWrapper, ATabs: Tabs, ATabPane: Tabs.TabPane, Description }, |
29 | setup() { | 22 | setup() { |
30 | const route = useRoute(); | 23 | const route = useRoute(); |
31 | const go = useGo(); | 24 | const go = useGo(); |
32 | const { setTitle } = useTabs(); | 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 | // 设置Tab的标题(不会影响页面标题) | 48 | // 设置Tab的标题(不会影响页面标题) |
52 | setTitle('详情:用户' + result.realName); | 49 | setTitle('详情:用户' + result.realName); |
53 | - methods.setDescProps(accountData) | 50 | + methods.setDescProps(accountData); |
54 | }); | 51 | }); |
55 | // 页面左侧点击返回链接时的操作 | 52 | // 页面左侧点击返回链接时的操作 |
56 | function goBack() { | 53 | function goBack() { |
57 | // 本例的效果时点击返回始终跳转到账号列表页,实际应用时可返回上一页 | 54 | // 本例的效果时点击返回始终跳转到账号列表页,实际应用时可返回上一页 |
58 | go('/system/account'); | 55 | go('/system/account'); |
59 | } | 56 | } |
60 | - return {goBack,accountSchema,accountData,register }; | 57 | + return { goBack, accountSchema, accountData, register }; |
61 | }, | 58 | }, |
62 | }); | 59 | }); |
63 | </script> | 60 | </script> |
1 | <template> | 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 | <BasicForm @register="registerForm"> | 9 | <BasicForm @register="registerForm"> |
5 | <template #organizationId="{ model, field }"> | 10 | <template #organizationId="{ model, field }"> |
6 | <BasicTree | 11 | <BasicTree |
@@ -17,100 +22,111 @@ | @@ -17,100 +22,111 @@ | ||
17 | </BasicModal> | 22 | </BasicModal> |
18 | </template> | 23 | </template> |
19 | <script lang="ts"> | 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, getOrganizationList, SaveOrUpdateUserInfo} from '/@/api/system/system'; | ||
25 | -import {BasicTree, TreeItem} from "/@/components/Tree"; | ||
26 | -import {findCurrentUserGroups} from "/@/api/system/group"; | ||
27 | -import {RoleOrOrganizationParam} 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 organizationTreeData = 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 { | ||
30 | + findCurrentUserRelation, | ||
31 | + getOrganizationList, | ||
32 | + SaveOrUpdateUserInfo, | ||
33 | + } from '/@/api/system/system'; | ||
34 | + import { BasicTree, TreeItem } from '/@/components/Tree'; | ||
35 | + import { findCurrentUserGroups } from '/@/api/system/group'; | ||
36 | + import { RoleOrOrganizationParam } from '/@/api/system/model/systemModel'; | ||
37 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
38 | + export default defineComponent({ | ||
39 | + name: 'AccountModal', | ||
40 | + components: { BasicModal, BasicForm, BasicTree }, | ||
41 | + emits: ['success', 'register'], | ||
42 | + setup(_, { emit }) { | ||
43 | + const isUpdate = ref(true); | ||
44 | + const rowId = ref(''); | ||
45 | + const organizationTreeData = ref<TreeItem[]>([]); | ||
46 | + const checkGroup = ref<string[]>([]); | ||
47 | + const [registerForm, { setFieldsValue, updateSchema, resetFields, validate }] = useForm({ | ||
48 | + labelWidth: 100, | ||
49 | + schemas: accountFormSchema, | ||
50 | + showActionButtonGroup: false, | ||
51 | + actionColOptions: { | ||
52 | + span: 18, | ||
53 | + }, | ||
54 | + }); | ||
46 | 55 | ||
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(organizationTreeData).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 | - organizationTreeData.value = treeValues; | ||
64 | - } | 56 | + const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { |
57 | + await resetFields(); | ||
58 | + setModalProps({ confirmLoading: false }); | ||
59 | + isUpdate.value = !!data?.isUpdate; | ||
60 | + const groupListModel = await findCurrentUserGroups(); | ||
61 | + if (unref(organizationTreeData).length === 0) { | ||
62 | + let treeValues = new Array<TreeItem>(); | ||
63 | + groupListModel.map((item) => { | ||
64 | + const groupData = { | ||
65 | + name: item.name, | ||
66 | + key: item.id, | ||
67 | + id: item.id, | ||
68 | + children: item.children as any as TreeItem[], | ||
69 | + }; | ||
70 | + treeValues.push(groupData); | ||
71 | + }); | ||
72 | + organizationTreeData.value = treeValues; | ||
73 | + } | ||
65 | 74 | ||
66 | - if (unref(isUpdate)) { | ||
67 | - rowId.value = data.record.id; | ||
68 | - const roleParams = new RoleOrOrganizationParam(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, | 75 | + if (unref(isUpdate)) { |
76 | + rowId.value = data.record.id; | ||
77 | + const roleParams = new RoleOrOrganizationParam(rowId.value, true, false); | ||
78 | + findCurrentUserRelation(roleParams).then((result) => { | ||
79 | + Reflect.set(data.record, 'roleIds', result); | ||
80 | + Reflect.set(data.record, 'password', '******'); | ||
81 | + setFieldsValue({ | ||
82 | + ...data.record, | ||
83 | + }); | ||
74 | }); | 84 | }); |
75 | - }) | ||
76 | - const organizationParams = new RoleOrOrganizationParam(rowId.value,false,true); | ||
77 | - checkGroup.value = await findCurrentUserRelation(organizationParams); | ||
78 | - } | ||
79 | - const deptData = await getOrganizationList(); | ||
80 | - await updateSchema([ | ||
81 | - { | ||
82 | - field: 'username', | ||
83 | - dynamicDisabled: unref(isUpdate), | ||
84 | - }, | ||
85 | - { | ||
86 | - field: 'deptId', | ||
87 | - componentProps: { | ||
88 | - treeData: deptData | 85 | + const organizationParams = new RoleOrOrganizationParam(rowId.value, false, true); |
86 | + checkGroup.value = await findCurrentUserRelation(organizationParams); | ||
87 | + } | ||
88 | + const deptData = await getOrganizationList(); | ||
89 | + await updateSchema([ | ||
90 | + { | ||
91 | + field: 'username', | ||
92 | + dynamicDisabled: unref(isUpdate), | ||
89 | }, | 93 | }, |
90 | - }, | ||
91 | - ]); | ||
92 | - }); | 94 | + { |
95 | + field: 'deptId', | ||
96 | + componentProps: { | ||
97 | + treeData: deptData, | ||
98 | + }, | ||
99 | + }, | ||
100 | + ]); | ||
101 | + }); | ||
93 | 102 | ||
94 | - const getTitle = computed(() => (!unref(isUpdate) ? '新增账号' : '编辑账号')); | 103 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增账号' : '编辑账号')); |
95 | 104 | ||
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}); | 105 | + async function handleSubmit() { |
106 | + try { | ||
107 | + const { createMessage } = useMessage(); | ||
108 | + const values = await validate(); | ||
109 | + values.accountExpireTime = | ||
110 | + typeof values.accountExpireTime != 'undefined' && values.accountExpireTime != null | ||
111 | + ? values.accountExpireTime.format('YYYY-MM-DD HH:mm:ss') | ||
112 | + : null; | ||
113 | + setModalProps({ confirmLoading: true }); | ||
114 | + await SaveOrUpdateUserInfo(values, unref(isUpdate)); | ||
115 | + closeModal(); | ||
116 | + emit('success', { isUpdate: unref(isUpdate), values: { ...values, id: rowId.value } }); | ||
117 | + createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功'); | ||
118 | + } finally { | ||
119 | + setModalProps({ confirmLoading: false }); | ||
120 | + } | ||
110 | } | 121 | } |
111 | - } | ||
112 | - | ||
113 | - return {registerModal, registerForm, getTitle, handleSubmit, organizationTreeData,checkGroup}; | ||
114 | - }, | ||
115 | -}); | 122 | + return { |
123 | + registerModal, | ||
124 | + registerForm, | ||
125 | + getTitle, | ||
126 | + handleSubmit, | ||
127 | + organizationTreeData, | ||
128 | + checkGroup, | ||
129 | + }; | ||
130 | + }, | ||
131 | + }); | ||
116 | </script> | 132 | </script> |
@@ -32,7 +32,7 @@ export const columns: BasicColumn[] = [ | @@ -32,7 +32,7 @@ export const columns: BasicColumn[] = [ | ||
32 | title: '状态', | 32 | title: '状态', |
33 | dataIndex: 'userStatusEnum', | 33 | dataIndex: 'userStatusEnum', |
34 | width: 120, | 34 | width: 120, |
35 | - slots: {customRender: 'status'} | 35 | + slots: { customRender: 'status' }, |
36 | }, | 36 | }, |
37 | ]; | 37 | ]; |
38 | 38 | ||
@@ -56,15 +56,15 @@ export const accountFormSchema: FormSchema[] = [ | @@ -56,15 +56,15 @@ export const accountFormSchema: FormSchema[] = [ | ||
56 | field: 'id', | 56 | field: 'id', |
57 | label: 'id', | 57 | label: 'id', |
58 | component: 'Input', | 58 | component: 'Input', |
59 | - show:false | 59 | + show: false, |
60 | }, | 60 | }, |
61 | { | 61 | { |
62 | field: 'username', | 62 | field: 'username', |
63 | label: '用户名', | 63 | label: '用户名', |
64 | component: 'Input', | 64 | component: 'Input', |
65 | colProps: { span: 12 }, | 65 | colProps: { span: 12 }, |
66 | - dynamicDisabled:false, | ||
67 | - dynamicRules:({values}) =>{ | 66 | + dynamicDisabled: false, |
67 | + dynamicRules: ({ values }) => { | ||
68 | return [ | 68 | return [ |
69 | { | 69 | { |
70 | message: '请输入用户名', | 70 | message: '请输入用户名', |
@@ -73,28 +73,26 @@ export const accountFormSchema: FormSchema[] = [ | @@ -73,28 +73,26 @@ export const accountFormSchema: FormSchema[] = [ | ||
73 | { | 73 | { |
74 | validator(_, value) { | 74 | validator(_, value) { |
75 | return new Promise((resolve, reject) => { | 75 | return new Promise((resolve, reject) => { |
76 | - if(value == '') | ||
77 | - { | 76 | + if (value == '') { |
78 | reject('请输入用户名'); | 77 | reject('请输入用户名'); |
79 | - }else { | ||
80 | - if(values.username !=undefined && values.id == undefined){ | ||
81 | - isAccountExist(value) | ||
82 | - .then((data) => { | ||
83 | - if(data.data !=null){ | ||
84 | - reject('用户已存在'); | ||
85 | - }else{ | ||
86 | - resolve() | ||
87 | - } | ||
88 | - }); | ||
89 | - }else{ | ||
90 | - resolve() | 78 | + } else { |
79 | + if (values.username != undefined && values.id == undefined) { | ||
80 | + isAccountExist(value).then((data) => { | ||
81 | + if (data.data != null) { | ||
82 | + reject('用户已存在'); | ||
83 | + } else { | ||
84 | + resolve(); | ||
85 | + } | ||
86 | + }); | ||
87 | + } else { | ||
88 | + resolve(); | ||
91 | } | 89 | } |
92 | } | 90 | } |
93 | }); | 91 | }); |
94 | }, | 92 | }, |
95 | }, | 93 | }, |
96 | ]; | 94 | ]; |
97 | - } | 95 | + }, |
98 | }, | 96 | }, |
99 | { | 97 | { |
100 | field: 'password', | 98 | field: 'password', |
@@ -149,10 +147,10 @@ export const accountFormSchema: FormSchema[] = [ | @@ -149,10 +147,10 @@ export const accountFormSchema: FormSchema[] = [ | ||
149 | label: '有效期: ', | 147 | label: '有效期: ', |
150 | component: 'DatePicker', | 148 | component: 'DatePicker', |
151 | colProps: { span: 12 }, | 149 | colProps: { span: 12 }, |
152 | - componentProps:{ | ||
153 | - showTime:true, | ||
154 | - format:'YYYY-MM-DD HH:mm:ss' | ||
155 | - } | 150 | + componentProps: { |
151 | + showTime: true, | ||
152 | + format: 'YYYY-MM-DD HH:mm:ss', | ||
153 | + }, | ||
156 | }, | 154 | }, |
157 | { | 155 | { |
158 | field: 'enabled', | 156 | field: 'enabled', |
@@ -162,8 +160,8 @@ export const accountFormSchema: FormSchema[] = [ | @@ -162,8 +160,8 @@ export const accountFormSchema: FormSchema[] = [ | ||
162 | defaultValue: true, | 160 | defaultValue: true, |
163 | componentProps: { | 161 | componentProps: { |
164 | options: [ | 162 | options: [ |
165 | - {label: '启用', value: true}, | ||
166 | - {label: '禁用', value: false}, | 163 | + { label: '启用', value: true }, |
164 | + { label: '禁用', value: false }, | ||
167 | ], | 165 | ], |
168 | }, | 166 | }, |
169 | }, | 167 | }, |
@@ -171,6 +169,6 @@ export const accountFormSchema: FormSchema[] = [ | @@ -171,6 +169,6 @@ export const accountFormSchema: FormSchema[] = [ | ||
171 | field: 'organizationIds', | 169 | field: 'organizationIds', |
172 | label: ' ', | 170 | label: ' ', |
173 | component: 'Input', | 171 | component: 'Input', |
174 | - slot:'organizationId', | 172 | + slot: 'organizationId', |
175 | }, | 173 | }, |
176 | ]; | 174 | ]; |
@@ -7,32 +7,42 @@ | @@ -7,32 +7,42 @@ | ||
7 | </template> | 7 | </template> |
8 | <template #status="{ record }"> | 8 | <template #status="{ record }"> |
9 | <Tag | 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 | </Tag> | 25 | </Tag> |
15 | </template> | 26 | </template> |
16 | <template #action="{ record }"> | 27 | <template #action="{ record }"> |
17 | <TableAction | 28 | <TableAction |
18 | - :actions=" | ||
19 | -[ | 29 | + :actions="[ |
20 | { | 30 | { |
21 | - label:'用户详情', | 31 | + label: '用户详情', |
22 | icon: 'clarity:info-standard-line', | 32 | icon: 'clarity:info-standard-line', |
23 | tooltip: '用户详情', | 33 | tooltip: '用户详情', |
24 | onClick: handleView.bind(null, record), | 34 | onClick: handleView.bind(null, record), |
25 | ifShow: record.level != 0, | 35 | ifShow: record.level != 0, |
26 | }, | 36 | }, |
27 | { | 37 | { |
28 | - label:'编辑', | 38 | + label: '编辑', |
29 | icon: 'clarity:note-edit-line', | 39 | icon: 'clarity:note-edit-line', |
30 | tooltip: '编辑', | 40 | tooltip: '编辑', |
31 | onClick: handleEdit.bind(null, record), | 41 | onClick: handleEdit.bind(null, record), |
32 | ifShow: record.level != 0, | 42 | ifShow: record.level != 0, |
33 | }, | 43 | }, |
34 | { | 44 | { |
35 | - label:'删除', | 45 | + label: '删除', |
36 | icon: 'ant-design:delete-outlined', | 46 | icon: 'ant-design:delete-outlined', |
37 | color: 'error', | 47 | color: 'error', |
38 | tooltip: '删除', | 48 | tooltip: '删除', |
@@ -52,26 +62,27 @@ | @@ -52,26 +62,27 @@ | ||
52 | <script lang="ts"> | 62 | <script lang="ts"> |
53 | import { defineComponent, reactive } from 'vue'; | 63 | import { defineComponent, reactive } from 'vue'; |
54 | 64 | ||
55 | - import {TenantCodeEnum} from '/@/enums/codeEnum'; | 65 | + import { TenantCodeEnum } from '/@/enums/codeEnum'; |
56 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 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 | import { PageWrapper } from '/@/components/Page'; | 68 | import { PageWrapper } from '/@/components/Page'; |
69 | + | ||
59 | import OrganizationIdTree from '../../common/OrganizationIdTree.vue'; | 70 | import OrganizationIdTree from '../../common/OrganizationIdTree.vue'; |
60 | - import {Tag} from "ant-design-vue"; | 71 | + import { Tag } from 'ant-design-vue'; |
61 | import { useModal } from '/@/components/Modal'; | 72 | import { useModal } from '/@/components/Modal'; |
62 | import AccountModal from './AccountModal.vue'; | 73 | import AccountModal from './AccountModal.vue'; |
63 | 74 | ||
64 | import { columns, searchFormSchema } from './account.data'; | 75 | import { columns, searchFormSchema } from './account.data'; |
65 | import { useGo } from '/@/hooks/web/usePage'; | 76 | import { useGo } from '/@/hooks/web/usePage'; |
66 | - import {useMessage} from "/@/hooks/web/useMessage"; | 77 | + import { useMessage } from '/@/hooks/web/useMessage'; |
67 | 78 | ||
68 | export default defineComponent({ | 79 | export default defineComponent({ |
69 | name: 'AccountManagement', | 80 | name: 'AccountManagement', |
70 | - components: { BasicTable, PageWrapper, OrganizationIdTree, AccountModal, TableAction,Tag }, | 81 | + components: { BasicTable, PageWrapper, OrganizationIdTree, AccountModal, TableAction, Tag }, |
71 | setup() { | 82 | setup() { |
72 | const go = useGo(); | 83 | const go = useGo(); |
73 | const [registerModal, { openModal }] = useModal(); | 84 | const [registerModal, { openModal }] = useModal(); |
74 | - const {createMessage} = useMessage(); | 85 | + const { createMessage } = useMessage(); |
75 | const searchInfo = reactive<Recordable>({}); | 86 | const searchInfo = reactive<Recordable>({}); |
76 | const [registerTable, { reload, updateTableDataRecord }] = useTable({ | 87 | const [registerTable, { reload, updateTableDataRecord }] = useTable({ |
77 | title: '账号列表', | 88 | title: '账号列表', |
@@ -113,10 +124,10 @@ | @@ -113,10 +124,10 @@ | ||
113 | 124 | ||
114 | function handleDelete(record: Recordable) { | 125 | function handleDelete(record: Recordable) { |
115 | let ids = [record.id]; | 126 | let ids = [record.id]; |
116 | - deleteUser(ids).then(()=>{ | ||
117 | - createMessage.success("删除成功") | 127 | + deleteUser(ids).then(() => { |
128 | + createMessage.success('删除成功'); | ||
118 | reload(); | 129 | reload(); |
119 | - }) | 130 | + }); |
120 | } | 131 | } |
121 | 132 | ||
122 | function handleSuccess({ isUpdate, values }) { | 133 | function handleSuccess({ isUpdate, values }) { |
@@ -148,7 +159,7 @@ | @@ -148,7 +159,7 @@ | ||
148 | handleSelect, | 159 | handleSelect, |
149 | handleView, | 160 | handleView, |
150 | searchInfo, | 161 | searchInfo, |
151 | - TenantCodeEnum | 162 | + TenantCodeEnum, |
152 | }; | 163 | }; |
153 | }, | 164 | }, |
154 | }); | 165 | }); |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | width="500px" | 7 | width="500px" |
8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
9 | > | 9 | > |
10 | - <BasicForm @register="registerForm"/> | 10 | + <BasicForm @register="registerForm" /> |
11 | </BasicDrawer> | 11 | </BasicDrawer> |
12 | </template> | 12 | </template> |
13 | <script lang="ts"> | 13 | <script lang="ts"> |
@@ -49,18 +49,17 @@ | @@ -49,18 +49,17 @@ | ||
49 | const values = await validate(); | 49 | const values = await validate(); |
50 | const { createMessage } = useMessage(); | 50 | const { createMessage } = useMessage(); |
51 | setDrawerProps({ confirmLoading: true }); | 51 | setDrawerProps({ confirmLoading: true }); |
52 | - let successMessage="添加成功"; | 52 | + let successMessage = '添加成功'; |
53 | //如果是修改需要传入id | 53 | //如果是修改需要传入id |
54 | - if(unref(isUpdate)){ | ||
55 | - successMessage = "修改成功"; | 54 | + if (unref(isUpdate)) { |
55 | + successMessage = '修改成功'; | ||
56 | Reflect.set(values, 'id', id); | 56 | Reflect.set(values, 'id', id); |
57 | } | 57 | } |
58 | - await saveOrEditDict(values,unref(isUpdate)).then(() =>{ | 58 | + await saveOrEditDict(values, unref(isUpdate)).then(() => { |
59 | closeDrawer(); | 59 | closeDrawer(); |
60 | emit('success'); | 60 | emit('success'); |
61 | createMessage.success(successMessage); | 61 | createMessage.success(successMessage); |
62 | - }) | ||
63 | - | 62 | + }); |
64 | } finally { | 63 | } finally { |
65 | setDrawerProps({ confirmLoading: false }); | 64 | setDrawerProps({ confirmLoading: false }); |
66 | } | 65 | } |
@@ -25,7 +25,7 @@ export const columns: BasicColumn[] = [ | @@ -25,7 +25,7 @@ export const columns: BasicColumn[] = [ | ||
25 | { | 25 | { |
26 | title: '更新时间', | 26 | title: '更新时间', |
27 | dataIndex: 'updateTime', | 27 | dataIndex: 'updateTime', |
28 | - width: 180 | 28 | + width: 180, |
29 | }, | 29 | }, |
30 | ]; | 30 | ]; |
31 | 31 | ||
@@ -49,7 +49,7 @@ export const formSchema: FormSchema[] = [ | @@ -49,7 +49,7 @@ export const formSchema: FormSchema[] = [ | ||
49 | field: 'dictName', | 49 | field: 'dictName', |
50 | label: '字典名称', | 50 | label: '字典名称', |
51 | required: true, | 51 | required: true, |
52 | - component: 'Input' | 52 | + component: 'Input', |
53 | }, | 53 | }, |
54 | { | 54 | { |
55 | field: 'dictCode', | 55 | field: 'dictCode', |
@@ -8,17 +8,17 @@ | @@ -8,17 +8,17 @@ | ||
8 | <TableAction | 8 | <TableAction |
9 | :actions="[ | 9 | :actions="[ |
10 | { | 10 | { |
11 | - label:'字典值配置', | 11 | + label: '字典值配置', |
12 | icon: 'ant-design:appstore-add-outlined', | 12 | icon: 'ant-design:appstore-add-outlined', |
13 | onClick: handleItem.bind(null, record), | 13 | onClick: handleItem.bind(null, record), |
14 | }, | 14 | }, |
15 | { | 15 | { |
16 | - label:'编辑', | 16 | + label: '编辑', |
17 | icon: 'clarity:note-edit-line', | 17 | icon: 'clarity:note-edit-line', |
18 | onClick: handleEdit.bind(null, record), | 18 | onClick: handleEdit.bind(null, record), |
19 | }, | 19 | }, |
20 | { | 20 | { |
21 | - label:'删除', | 21 | + label: '删除', |
22 | icon: 'ant-design:delete-outlined', | 22 | icon: 'ant-design:delete-outlined', |
23 | color: 'error', | 23 | color: 'error', |
24 | popConfirm: { | 24 | popConfirm: { |
@@ -36,30 +36,30 @@ | @@ -36,30 +36,30 @@ | ||
36 | </template> | 36 | </template> |
37 | </BasicTable> | 37 | </BasicTable> |
38 | <DictDrawer @register="registerDrawer" @success="handleSuccess" /> | 38 | <DictDrawer @register="registerDrawer" @success="handleSuccess" /> |
39 | - <ItemIndex @register="registerItemDrawer" @success="handleSuccess"/> | 39 | + <ItemIndex @register="registerItemDrawer" @success="handleSuccess" /> |
40 | </div> | 40 | </div> |
41 | </template> | 41 | </template> |
42 | <script lang="ts"> | 42 | <script lang="ts"> |
43 | import { defineComponent } from 'vue'; | 43 | import { defineComponent } from 'vue'; |
44 | 44 | ||
45 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 45 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
46 | - import { sysDictPage,deleteDict } from '/@/api/system/dict'; | 46 | + import { sysDictPage, deleteDict } from '/@/api/system/dict'; |
47 | 47 | ||
48 | import { useDrawer } from '/@/components/Drawer'; | 48 | import { useDrawer } from '/@/components/Drawer'; |
49 | import DictDrawer from './DictDrawer.vue'; | 49 | import DictDrawer from './DictDrawer.vue'; |
50 | import ItemIndex from './item/ItemIndex.vue'; | 50 | import ItemIndex from './item/ItemIndex.vue'; |
51 | 51 | ||
52 | import { columns, searchFormSchema } from './dict.data'; | 52 | import { columns, searchFormSchema } from './dict.data'; |
53 | - import {Tag} from "ant-design-vue"; | ||
54 | - import {useMessage} from "/@/hooks/web/useMessage"; | 53 | + import { Tag } from 'ant-design-vue'; |
54 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
55 | 55 | ||
56 | export default defineComponent({ | 56 | export default defineComponent({ |
57 | name: 'DictManagement', | 57 | name: 'DictManagement', |
58 | - components: { BasicTable, DictDrawer,ItemIndex, TableAction ,Tag}, | 58 | + components: { BasicTable, DictDrawer, ItemIndex, TableAction, Tag }, |
59 | setup() { | 59 | setup() { |
60 | const { createMessage } = useMessage(); | 60 | const { createMessage } = useMessage(); |
61 | - const [registerDrawer, { openDrawer:openDrawer }] = useDrawer(); | ||
62 | - const [registerItemDrawer, { openDrawer: openItemDrawer}] = useDrawer(); | 61 | + const [registerDrawer, { openDrawer: openDrawer }] = useDrawer(); |
62 | + const [registerItemDrawer, { openDrawer: openItemDrawer }] = useDrawer(); | ||
63 | const [registerTable, { reload }] = useTable({ | 63 | const [registerTable, { reload }] = useTable({ |
64 | title: '字典配置列表', | 64 | title: '字典配置列表', |
65 | api: sysDictPage, | 65 | api: sysDictPage, |
@@ -94,17 +94,17 @@ | @@ -94,17 +94,17 @@ | ||
94 | }); | 94 | }); |
95 | } | 95 | } |
96 | 96 | ||
97 | - function handleItem(record: Recordable){ | 97 | + function handleItem(record: Recordable) { |
98 | openItemDrawer(true, { | 98 | openItemDrawer(true, { |
99 | - id:record.id, | 99 | + id: record.id, |
100 | }); | 100 | }); |
101 | } | 101 | } |
102 | 102 | ||
103 | function handleDelete(record: Recordable) { | 103 | function handleDelete(record: Recordable) { |
104 | let ids = [record.id]; | 104 | let ids = [record.id]; |
105 | - deleteDict(ids).then((result)=>{ | ||
106 | - createMessage.success(result.message) | ||
107 | - handleSuccess() | 105 | + deleteDict(ids).then((result) => { |
106 | + createMessage.success(result.message); | ||
107 | + handleSuccess(); | ||
108 | }); | 108 | }); |
109 | } | 109 | } |
110 | 110 |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | width="500px" | 7 | width="500px" |
8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
9 | > | 9 | > |
10 | - <BasicForm @register="registerForm"/> | 10 | + <BasicForm @register="registerForm" /> |
11 | </BasicDrawer> | 11 | </BasicDrawer> |
12 | </template> | 12 | </template> |
13 | <script lang="ts"> | 13 | <script lang="ts"> |
@@ -29,7 +29,7 @@ | @@ -29,7 +29,7 @@ | ||
29 | schemas: formSchema, | 29 | schemas: formSchema, |
30 | showActionButtonGroup: false, | 30 | showActionButtonGroup: false, |
31 | }); | 31 | }); |
32 | - let dictId,id; | 32 | + let dictId, id; |
33 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | 33 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
34 | await resetFields(); | 34 | await resetFields(); |
35 | setDrawerProps({ confirmLoading: false }); | 35 | setDrawerProps({ confirmLoading: false }); |
@@ -50,16 +50,16 @@ | @@ -50,16 +50,16 @@ | ||
50 | const values = await validate(); | 50 | const values = await validate(); |
51 | const { createMessage } = useMessage(); | 51 | const { createMessage } = useMessage(); |
52 | setDrawerProps({ confirmLoading: true }); | 52 | setDrawerProps({ confirmLoading: true }); |
53 | - let message="添加成功"; | ||
54 | - if(unref(isUpdate)){ | 53 | + let message = '添加成功'; |
54 | + if (unref(isUpdate)) { | ||
55 | //如果是修改需要传入id | 55 | //如果是修改需要传入id |
56 | Reflect.set(values, 'id', id); | 56 | Reflect.set(values, 'id', id); |
57 | - message = "修改成功"; | ||
58 | - }else{ | 57 | + message = '修改成功'; |
58 | + } else { | ||
59 | //添加需要dictId | 59 | //添加需要dictId |
60 | Reflect.set(values, 'dictId', dictId); | 60 | Reflect.set(values, 'dictId', dictId); |
61 | } | 61 | } |
62 | - await saveOrEditDictItem(values,unref(isUpdate)); | 62 | + await saveOrEditDictItem(values, unref(isUpdate)); |
63 | closeDrawer(); | 63 | closeDrawer(); |
64 | emit('success'); | 64 | emit('success'); |
65 | createMessage.success(message); | 65 | createMessage.success(message); |
@@ -8,22 +8,22 @@ | @@ -8,22 +8,22 @@ | ||
8 | <template #action="{ record }"> | 8 | <template #action="{ record }"> |
9 | <TableAction | 9 | <TableAction |
10 | :actions="[ | 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), | 11 | + { |
12 | + label: '编辑', | ||
13 | + icon: 'clarity:note-edit-line', | ||
14 | + onClick: handleEdit.bind(null, record), | ||
23 | }, | 15 | }, |
24 | - ifShow: record.status ==0 | ||
25 | - }, | ||
26 | - ]" | 16 | + { |
17 | + label: '删除', | ||
18 | + icon: 'ant-design:delete-outlined', | ||
19 | + color: 'error', | ||
20 | + popConfirm: { | ||
21 | + title: '是否确认删除', | ||
22 | + confirm: handleDelete.bind(null, record), | ||
23 | + }, | ||
24 | + ifShow: record.status == 0, | ||
25 | + }, | ||
26 | + ]" | ||
27 | /> | 27 | /> |
28 | </template> | 28 | </template> |
29 | </BasicTable> | 29 | </BasicTable> |
@@ -35,18 +35,18 @@ | @@ -35,18 +35,18 @@ | ||
35 | import { defineComponent } from 'vue'; | 35 | import { defineComponent } from 'vue'; |
36 | 36 | ||
37 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 37 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
38 | - import { sysDictItemPage,deleteDictItem } from '/@/api/system/dict'; | 38 | + import { sysDictItemPage, deleteDictItem } from '/@/api/system/dict'; |
39 | 39 | ||
40 | - import { BasicDrawer,useDrawer,useDrawerInner } from '/@/components/Drawer'; | ||
41 | - import ItemDrawer from "/@/views/system/dict/item/ItemDrawer.vue"; | 40 | + import { BasicDrawer, useDrawer, useDrawerInner } from '/@/components/Drawer'; |
41 | + import ItemDrawer from '/@/views/system/dict/item/ItemDrawer.vue'; | ||
42 | 42 | ||
43 | import { columns, searchFormSchema } from './dict.item.data'; | 43 | import { columns, searchFormSchema } from './dict.item.data'; |
44 | - import {Tag} from "ant-design-vue"; | ||
45 | - import {useMessage} from "/@/hooks/web/useMessage"; | 44 | + import { Tag } from 'ant-design-vue'; |
45 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
46 | 46 | ||
47 | export default defineComponent({ | 47 | export default defineComponent({ |
48 | name: 'ItemIndex', | 48 | name: 'ItemIndex', |
49 | - components: {BasicDrawer, BasicTable, ItemDrawer, TableAction ,Tag}, | 49 | + components: { BasicDrawer, BasicTable, ItemDrawer, TableAction, Tag }, |
50 | setup() { | 50 | setup() { |
51 | let dictId; | 51 | let dictId; |
52 | const { createMessage } = useMessage(); | 52 | const { createMessage } = useMessage(); |
@@ -73,14 +73,14 @@ | @@ -73,14 +73,14 @@ | ||
73 | slots: { customRender: 'action' }, | 73 | slots: { customRender: 'action' }, |
74 | fixed: undefined, | 74 | fixed: undefined, |
75 | }, | 75 | }, |
76 | - beforeFetch:getDictId, | ||
77 | - immediate:true | 76 | + beforeFetch: getDictId, |
77 | + immediate: true, | ||
78 | }); | 78 | }); |
79 | 79 | ||
80 | function handleCreate() { | 80 | function handleCreate() { |
81 | openDrawer(true, { | 81 | openDrawer(true, { |
82 | isUpdate: false, | 82 | isUpdate: false, |
83 | - dictId:dictId, | 83 | + dictId: dictId, |
84 | }); | 84 | }); |
85 | } | 85 | } |
86 | 86 | ||
@@ -88,7 +88,7 @@ | @@ -88,7 +88,7 @@ | ||
88 | * 获取父页面传递的dictId值 | 88 | * 获取父页面传递的dictId值 |
89 | * @param data 请求之前的参数 | 89 | * @param data 请求之前的参数 |
90 | */ | 90 | */ |
91 | - function getDictId(data){ | 91 | + function getDictId(data) { |
92 | Reflect.set(data, 'dictId', dictId); | 92 | Reflect.set(data, 'dictId', dictId); |
93 | } | 93 | } |
94 | 94 | ||
@@ -101,9 +101,9 @@ | @@ -101,9 +101,9 @@ | ||
101 | 101 | ||
102 | function handleDelete(record: Recordable) { | 102 | function handleDelete(record: Recordable) { |
103 | let ids = [record.id]; | 103 | let ids = [record.id]; |
104 | - deleteDictItem(ids).then((result)=>{ | ||
105 | - createMessage.success(result.message) | ||
106 | - handleSuccess() | 104 | + deleteDictItem(ids).then((result) => { |
105 | + createMessage.success(result.message); | ||
106 | + handleSuccess(); | ||
107 | }); | 107 | }); |
108 | } | 108 | } |
109 | 109 | ||
@@ -118,7 +118,7 @@ | @@ -118,7 +118,7 @@ | ||
118 | handleCreate, | 118 | handleCreate, |
119 | handleEdit, | 119 | handleEdit, |
120 | handleDelete, | 120 | handleDelete, |
121 | - handleSuccess | 121 | + handleSuccess, |
122 | }; | 122 | }; |
123 | }, | 123 | }, |
124 | }); | 124 | }); |
1 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; |
2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; |
3 | -import {h} from "vue"; | ||
4 | -import {Switch} from "ant-design-vue"; | ||
5 | -import {setDictItemStatus} from "/@/api/system/dict"; | ||
6 | -import {useMessage} from "/@/hooks/web/useMessage"; | 3 | +import { h } from 'vue'; |
4 | +import { Switch } from 'ant-design-vue'; | ||
5 | +import { setDictItemStatus } from '/@/api/system/dict'; | ||
6 | +import { useMessage } from '/@/hooks/web/useMessage'; | ||
7 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ |
8 | { | 8 | { |
9 | title: '文本值', | 9 | title: '文本值', |
@@ -13,7 +13,7 @@ export const columns: BasicColumn[] = [ | @@ -13,7 +13,7 @@ export const columns: BasicColumn[] = [ | ||
13 | { | 13 | { |
14 | title: '字典值', | 14 | title: '字典值', |
15 | dataIndex: 'itemValue', | 15 | dataIndex: 'itemValue', |
16 | - width:180, | 16 | + width: 180, |
17 | }, | 17 | }, |
18 | { | 18 | { |
19 | title: '描述', | 19 | title: '描述', |
@@ -37,7 +37,7 @@ export const columns: BasicColumn[] = [ | @@ -37,7 +37,7 @@ export const columns: BasicColumn[] = [ | ||
37 | record.pendingStatus = true; | 37 | record.pendingStatus = true; |
38 | const newStatus = checked ? 1 : 0; | 38 | const newStatus = checked ? 1 : 0; |
39 | const { createMessage } = useMessage(); | 39 | const { createMessage } = useMessage(); |
40 | - setDictItemStatus(record.id,newStatus) | 40 | + setDictItemStatus(record.id, newStatus) |
41 | .then(() => { | 41 | .then(() => { |
42 | record.status = newStatus; | 42 | record.status = newStatus; |
43 | createMessage.success(`修改成功`); | 43 | createMessage.success(`修改成功`); |
@@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | @@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | ||
52 | { | 52 | { |
53 | title: '排序', | 53 | title: '排序', |
54 | dataIndex: 'sort', | 54 | dataIndex: 'sort', |
55 | - width: 80 | 55 | + width: 80, |
56 | }, | 56 | }, |
57 | { | 57 | { |
58 | title: '创建时间', | 58 | title: '创建时间', |
@@ -72,7 +72,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -72,7 +72,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
72 | field: 'dictId', | 72 | field: 'dictId', |
73 | label: '文本值', | 73 | label: '文本值', |
74 | component: 'Input', | 74 | component: 'Input', |
75 | - show:false, | 75 | + show: false, |
76 | }, | 76 | }, |
77 | ]; | 77 | ]; |
78 | 78 | ||
@@ -81,7 +81,7 @@ export const formSchema: FormSchema[] = [ | @@ -81,7 +81,7 @@ export const formSchema: FormSchema[] = [ | ||
81 | field: 'itemText', | 81 | field: 'itemText', |
82 | label: '文本值', | 82 | label: '文本值', |
83 | required: true, | 83 | required: true, |
84 | - component: 'Input' | 84 | + component: 'Input', |
85 | }, | 85 | }, |
86 | { | 86 | { |
87 | field: 'itemValue', | 87 | field: 'itemValue', |
@@ -93,7 +93,7 @@ export const formSchema: FormSchema[] = [ | @@ -93,7 +93,7 @@ export const formSchema: FormSchema[] = [ | ||
93 | field: 'sort', | 93 | field: 'sort', |
94 | label: '排序', | 94 | label: '排序', |
95 | component: 'InputNumber', | 95 | component: 'InputNumber', |
96 | - defaultValue:1, | 96 | + defaultValue: 1, |
97 | }, | 97 | }, |
98 | { | 98 | { |
99 | field: 'status', | 99 | field: 'status', |
@@ -7,138 +7,140 @@ | @@ -7,138 +7,140 @@ | ||
7 | width="50%" | 7 | width="50%" |
8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
9 | > | 9 | > |
10 | - <BasicForm @register="registerForm"/> | 10 | + <BasicForm @register="registerForm" /> |
11 | </BasicDrawer> | 11 | </BasicDrawer> |
12 | </template> | 12 | </template> |
13 | <script lang="ts"> | 13 | <script lang="ts"> |
14 | -import {defineComponent, ref, computed, unref} from 'vue'; | ||
15 | -import {BasicForm, useForm} from '/@/components/Form/index'; | ||
16 | -import {formSchema} from './menu.data'; | ||
17 | -import {BasicDrawer, useDrawerInner} from '/@/components/Drawer'; | ||
18 | - | ||
19 | -// 加载菜单 | ||
20 | -import {getMenuList} from '/@/api/sys/menu'; | ||
21 | - | ||
22 | -import {saveMenuApi} from '/@/api/system/menu'; | ||
23 | -import {listToTree} from '/@/utils/menuUtil'; | ||
24 | - | ||
25 | -import {useI18n} from "/@/hooks/web/useI18n"; | ||
26 | -import {metaModel} from '/@/api/system/model/menuModel'; | ||
27 | - | ||
28 | - | ||
29 | -export default defineComponent({ | ||
30 | - name: 'MenuDrawer', | ||
31 | - components: {BasicDrawer, BasicForm}, | ||
32 | - emits: ['success', 'register'], | ||
33 | - setup(_, {emit}) { | ||
34 | - const isUpdate = ref(true); | ||
35 | - let menuId; | ||
36 | - | ||
37 | - const [registerForm, {resetFields, setFieldsValue, updateSchema, validate}] = useForm({ | ||
38 | - labelWidth: 100, | ||
39 | - schemas: formSchema, | ||
40 | - showActionButtonGroup: false, | ||
41 | - baseColProps: {lg: 12, md: 24}, | ||
42 | - }); | ||
43 | - const {t} = useI18n(); //加载国际化 | ||
44 | - | ||
45 | - //默认传递页面数据 | ||
46 | - const [registerDrawer, {setDrawerProps, closeDrawer}] = useDrawerInner(async (data) => { | ||
47 | - resetFields(); | ||
48 | - setDrawerProps({confirmLoading: false}); | ||
49 | - isUpdate.value = !!data?.isUpdate; | ||
50 | - | ||
51 | - //初始化,菜单名称为可用 | ||
52 | - updateSchema({field: 'title', componentProps: {disabled: false}}); | ||
53 | - //如果是编辑操作,设置页面数据 | ||
54 | - if (unref(isUpdate)) { | ||
55 | - | ||
56 | - console.log("------------编辑时获得的值-----------------------"); | ||
57 | - console.log(data.record); | ||
58 | - | ||
59 | - // // 动态设置 表单值 | ||
60 | - // | ||
61 | - let menuObj: metaModel = Reflect.get(data.record, 'meta'); | ||
62 | - Reflect.set(data.record, 'menuType', menuObj.menuType);//meta.menuType | ||
63 | - Reflect.set(data.record, 'title', menuObj.title);//meta.title | ||
64 | - Reflect.set(data.record, 'icon', menuObj.icon);//meta.icon | ||
65 | - Reflect.set(data.record, 'hideMenu', menuObj.hideMenu);//meta.hideMenu | ||
66 | - Reflect.set(data.record, 'ignoreKeepAlive', menuObj.ignoreKeepAlive);//meta.ignoreKeepAlive | ||
67 | - Reflect.set(data.record, 'isLink', menuObj.isLink);//meta.isLink | ||
68 | - Reflect.set(data.record, 'status', menuObj.status);//meta.status | ||
69 | - //为表单赋值 | ||
70 | - setFieldsValue({ | ||
71 | - ...data.record, | ||
72 | - }); | ||
73 | - | ||
74 | - //编辑模式,菜单名称为不可用 | ||
75 | - updateSchema({field: 'title', componentProps: {disabled: true,}}); | ||
76 | - } | ||
77 | - if (isUpdate.value) { | ||
78 | - menuId = Reflect.get(data.record, 'id'); | ||
79 | - } | ||
80 | - //加载菜单 | ||
81 | - let treeData = await getMenuList(); | ||
82 | - treeData = listToTree(treeData); | ||
83 | - updateSchema({ | ||
84 | - field: 'parentId', | ||
85 | - componentProps: {treeData}, | 14 | + import { defineComponent, ref, computed, unref } from 'vue'; |
15 | + import { BasicForm, useForm } from '/@/components/Form/index'; | ||
16 | + import { formSchema } from './menu.data'; | ||
17 | + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | ||
18 | + | ||
19 | + // 加载菜单 | ||
20 | + import { getMenuList } from '/@/api/sys/menu'; | ||
21 | + | ||
22 | + import { saveMenuApi } from '/@/api/system/menu'; | ||
23 | + import { listToTree } from '/@/utils/menuUtil'; | ||
24 | + | ||
25 | + import { useI18n } from '/@/hooks/web/useI18n'; | ||
26 | + import { metaModel } from '/@/api/system/model/menuModel'; | ||
27 | + | ||
28 | + export default defineComponent({ | ||
29 | + name: 'MenuDrawer', | ||
30 | + components: { BasicDrawer, BasicForm }, | ||
31 | + emits: ['success', 'register'], | ||
32 | + setup(_, { emit }) { | ||
33 | + const isUpdate = ref(true); | ||
34 | + let menuId; | ||
35 | + | ||
36 | + const [registerForm, { resetFields, setFieldsValue, updateSchema, validate }] = useForm({ | ||
37 | + labelWidth: 100, | ||
38 | + schemas: formSchema, | ||
39 | + showActionButtonGroup: false, | ||
40 | + baseColProps: { lg: 12, md: 24 }, | ||
86 | }); | 41 | }); |
87 | - }); | ||
88 | - | ||
89 | - //得到页面标题 | ||
90 | - const getTitle = computed(() => (!unref(isUpdate) ? t('routes.common.system.pageSystemTitleCreateMenu') : t('routes.common.system.pageSystemTitleEditMenu'))); | ||
91 | - | ||
92 | - //提交按钮 | ||
93 | - async function handleSubmit() { | ||
94 | - try { | ||
95 | - const values = await validate(); | ||
96 | - setDrawerProps({confirmLoading: true}); | ||
97 | - // TODO custom api | ||
98 | - | ||
99 | - // 处理权限标识为null时,后台空指针 | ||
100 | - let permissionStr: string = Reflect.get(values, 'permission'); | ||
101 | - if (permissionStr === undefined || permissionStr === null) { | ||
102 | - Reflect.set(values, 'permission', " "); | ||
103 | - } | ||
104 | - | ||
105 | - // 添加属性; | ||
106 | - //当前作为默认管理员操作; | ||
107 | - Reflect.set(values, 'type', 'SYSADMIN'); | ||
108 | - Reflect.set(values, 'name', Reflect.get(values, 'title')); | ||
109 | - //当前选择为菜单时操作 | ||
110 | - let menuType: string = Reflect.get(values, 'menuType'); | ||
111 | - if (menuType === '0') { | ||
112 | - Reflect.set(values, 'component', 'LAYOUT'); | 42 | + const { t } = useI18n(); //加载国际化 |
43 | + | ||
44 | + //默认传递页面数据 | ||
45 | + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | ||
46 | + resetFields(); | ||
47 | + setDrawerProps({ confirmLoading: false }); | ||
48 | + isUpdate.value = !!data?.isUpdate; | ||
49 | + | ||
50 | + //初始化,菜单名称为可用 | ||
51 | + updateSchema({ field: 'title', componentProps: { disabled: false } }); | ||
52 | + //如果是编辑操作,设置页面数据 | ||
53 | + if (unref(isUpdate)) { | ||
54 | + console.log('------------编辑时获得的值-----------------------'); | ||
55 | + console.log(data.record); | ||
56 | + | ||
57 | + // // 动态设置 表单值 | ||
58 | + // | ||
59 | + let menuObj: metaModel = Reflect.get(data.record, 'meta'); | ||
60 | + Reflect.set(data.record, 'menuType', menuObj.menuType); //meta.menuType | ||
61 | + Reflect.set(data.record, 'title', menuObj.title); //meta.title | ||
62 | + Reflect.set(data.record, 'icon', menuObj.icon); //meta.icon | ||
63 | + Reflect.set(data.record, 'hideMenu', menuObj.hideMenu); //meta.hideMenu | ||
64 | + Reflect.set(data.record, 'ignoreKeepAlive', menuObj.ignoreKeepAlive); //meta.ignoreKeepAlive | ||
65 | + Reflect.set(data.record, 'isLink', menuObj.isLink); //meta.isLink | ||
66 | + Reflect.set(data.record, 'status', menuObj.status); //meta.status | ||
67 | + //为表单赋值 | ||
68 | + setFieldsValue({ | ||
69 | + ...data.record, | ||
70 | + }); | ||
71 | + | ||
72 | + //编辑模式,菜单名称为不可用 | ||
73 | + updateSchema({ field: 'title', componentProps: { disabled: true } }); | ||
113 | } | 74 | } |
114 | if (isUpdate.value) { | 75 | if (isUpdate.value) { |
115 | - Reflect.set(values, 'id', menuId); | 76 | + menuId = Reflect.get(data.record, 'id'); |
116 | } | 77 | } |
78 | + //加载菜单 | ||
79 | + let treeData = await getMenuList(); | ||
80 | + treeData = listToTree(treeData); | ||
81 | + updateSchema({ | ||
82 | + field: 'parentId', | ||
83 | + componentProps: { treeData }, | ||
84 | + }); | ||
85 | + }); | ||
117 | 86 | ||
118 | - //为meta设置值 | ||
119 | - const metaTemp: metaModel = { | ||
120 | - icon: Reflect.get(values, 'icon'), | ||
121 | - title: Reflect.get(values, 'title'), | ||
122 | - isLink: Reflect.get(values, 'isLink'), | ||
123 | - menuType: Reflect.get(values, 'menuType'), | ||
124 | - ignoreKeepAlive: Reflect.get(values, 'ignoreKeepAlive'), //[创建菜单,才需要] | ||
125 | - hideMenu: Reflect.get(values, 'hideMenu'), | ||
126 | - status: Reflect.get(values, 'status'), | 87 | + //得到页面标题 |
88 | + const getTitle = computed(() => | ||
89 | + !unref(isUpdate) | ||
90 | + ? t('routes.common.system.pageSystemTitleCreateMenu') | ||
91 | + : t('routes.common.system.pageSystemTitleEditMenu') | ||
92 | + ); | ||
93 | + | ||
94 | + //提交按钮 | ||
95 | + async function handleSubmit() { | ||
96 | + try { | ||
97 | + const values = await validate(); | ||
98 | + setDrawerProps({ confirmLoading: true }); | ||
99 | + // TODO custom api | ||
100 | + | ||
101 | + // 处理权限标识为null时,后台空指针 | ||
102 | + let permissionStr: string = Reflect.get(values, 'permission'); | ||
103 | + if (permissionStr === undefined || permissionStr === null) { | ||
104 | + Reflect.set(values, 'permission', ' '); | ||
105 | + } | ||
106 | + | ||
107 | + // 添加属性; | ||
108 | + //当前作为默认管理员操作; | ||
109 | + Reflect.set(values, 'type', 'SYSADMIN'); | ||
110 | + Reflect.set(values, 'name', Reflect.get(values, 'title')); | ||
111 | + //当前选择为菜单时操作 | ||
112 | + let menuType: string = Reflect.get(values, 'menuType'); | ||
113 | + if (menuType === '0') { | ||
114 | + Reflect.set(values, 'component', 'LAYOUT'); | ||
115 | + } | ||
116 | + if (isUpdate.value) { | ||
117 | + Reflect.set(values, 'id', menuId); | ||
118 | + } | ||
119 | + | ||
120 | + //为meta设置值 | ||
121 | + const metaTemp: metaModel = { | ||
122 | + icon: Reflect.get(values, 'icon'), | ||
123 | + title: Reflect.get(values, 'title'), | ||
124 | + isLink: Reflect.get(values, 'isLink'), | ||
125 | + menuType: Reflect.get(values, 'menuType'), | ||
126 | + ignoreKeepAlive: Reflect.get(values, 'ignoreKeepAlive'), //[创建菜单,才需要] | ||
127 | + hideMenu: Reflect.get(values, 'hideMenu'), | ||
128 | + status: Reflect.get(values, 'status'), | ||
129 | + }; | ||
130 | + Reflect.set(values, 'meta', metaTemp); | ||
131 | + | ||
132 | + // saveMenu | ||
133 | + const data = await saveMenuApi(values, isUpdate.value); | ||
134 | + console.log('_______保存返回结果____data:' + data); | ||
135 | + | ||
136 | + closeDrawer(); //关闭侧框 | ||
137 | + emit('success'); | ||
138 | + } finally { | ||
139 | + setDrawerProps({ confirmLoading: false }); | ||
127 | } | 140 | } |
128 | - Reflect.set(values, 'meta', metaTemp); | ||
129 | - | ||
130 | - // saveMenu | ||
131 | - const data = await saveMenuApi(values, isUpdate.value); | ||
132 | - console.log("_______保存返回结果____data:" + data); | ||
133 | - | ||
134 | - closeDrawer();//关闭侧框 | ||
135 | - emit('success'); | ||
136 | - } finally { | ||
137 | - setDrawerProps({confirmLoading: false}); | ||
138 | } | 141 | } |
139 | - } | ||
140 | 142 | ||
141 | - return {registerDrawer, registerForm, getTitle, handleSubmit}; | ||
142 | - }, | ||
143 | -}); | 143 | + return { registerDrawer, registerForm, getTitle, handleSubmit }; |
144 | + }, | ||
145 | + }); | ||
144 | </script> | 146 | </script> |
@@ -3,12 +3,12 @@ | @@ -3,12 +3,12 @@ | ||
3 | <!-- register 用于注册 useTable,如果需要使用useTable提供的 api,必须将 register 传入组件的 onRegister--> | 3 | <!-- register 用于注册 useTable,如果需要使用useTable提供的 api,必须将 register 传入组件的 onRegister--> |
4 | <!-- @fetch-success接口请求成功后触发 --> | 4 | <!-- @fetch-success接口请求成功后触发 --> |
5 | <BasicTable @register="registerTable" @fetch-success="onFetchSuccess"> | 5 | <BasicTable @register="registerTable" @fetch-success="onFetchSuccess"> |
6 | - | ||
7 | <!-- 通过模板,加载工具栏 --> | 6 | <!-- 通过模板,加载工具栏 --> |
8 | <template #toolbar> | 7 | <template #toolbar> |
9 | <a-button type="primary" @click="handleCreate"> | 8 | <a-button type="primary" @click="handleCreate"> |
10 | {{ getI18nCreateMenu }} | 9 | {{ getI18nCreateMenu }} |
11 | - </a-button> <!-- 新增菜单--> | 10 | + </a-button> |
11 | + <!-- 新增菜单--> | ||
12 | </template> | 12 | </template> |
13 | 13 | ||
14 | <!-- 表格单项,操作 --> | 14 | <!-- 表格单项,操作 --> |
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | icon: 'ant-design:delete-outlined', | 23 | icon: 'ant-design:delete-outlined', |
24 | color: 'error', | 24 | color: 'error', |
25 | popConfirm: { | 25 | popConfirm: { |
26 | - title: getDeleteTitle(),//是否确认删除//getDeleteTitle() | 26 | + title: getDeleteTitle(), //是否确认删除//getDeleteTitle() |
27 | confirm: handleDelete.bind(null, record), | 27 | confirm: handleDelete.bind(null, record), |
28 | }, | 28 | }, |
29 | }, | 29 | }, |
@@ -33,135 +33,135 @@ | @@ -33,135 +33,135 @@ | ||
33 | </BasicTable> | 33 | </BasicTable> |
34 | 34 | ||
35 | <!-- 弹出框 --> | 35 | <!-- 弹出框 --> |
36 | - <MenuDrawer @register="registerDrawer" @success="handleSuccess"/> | 36 | + <MenuDrawer @register="registerDrawer" @success="handleSuccess" /> |
37 | </div> | 37 | </div> |
38 | </template> | 38 | </template> |
39 | <script lang="ts"> | 39 | <script lang="ts"> |
40 | -//导入所需插件 | ||
41 | -import {computed, defineComponent, nextTick} from 'vue'; | ||
42 | - | ||
43 | -// 导入表格组件,表格事件 | ||
44 | -import {BasicTable, useTable, TableAction} from '/@/components/Table'; | ||
45 | - | ||
46 | -// 加载表格数据 | ||
47 | -import {getMenuList, delMenu} from '/@/api/sys/menu'; | ||
48 | -// 加载自定义侧边弹出框 组件 | ||
49 | -import {useDrawer} from '/@/components/Drawer'; | ||
50 | - | ||
51 | -// 导入子页面【新增、修改】 | ||
52 | -import MenuDrawer from './MenuDrawer.vue'; | ||
53 | - | ||
54 | -// 导入列 属性,和搜索栏内容 | ||
55 | -import {columns, searchFormSchema} from './menu.data'; | ||
56 | -import {useI18n} from "/@/hooks/web/useI18n"; | ||
57 | -import {notification} from "ant-design-vue"; | ||
58 | - | ||
59 | -// 自定义表格组件和属性 | ||
60 | -export default defineComponent({ | ||
61 | - name: 'MenuManagement', | ||
62 | - components: {BasicTable, MenuDrawer, TableAction}, | ||
63 | - setup() { | ||
64 | - const [registerDrawer, {openDrawer}] = useDrawer();//使用右侧弹出框 | ||
65 | - const {t} = useI18n(); //加载国际化 | ||
66 | - // 新增菜单 | ||
67 | - const getI18nCreateMenu = computed(() => t('routes.common.system.pageSystemTitleCreateMenu')); | ||
68 | - | ||
69 | - const [registerTable, {reload, expandAll}] = useTable({ | ||
70 | - title: t('routes.common.system.pageSystemTitleMenuList'),//'菜单列表' | ||
71 | - api: getMenuList, //加载数据 | ||
72 | - columns, //加载列 | ||
73 | - // formConfig: { | ||
74 | - // labelWidth: 120, | ||
75 | - // schemas: searchFormSchema, | ||
76 | - // }, | ||
77 | - isTreeTable: true, | ||
78 | - pagination: false, | ||
79 | - striped: false, | ||
80 | - // useSearchForm: true, | ||
81 | - showTableSetting: true, | ||
82 | - bordered: true, | ||
83 | - showIndexColumn: false, | ||
84 | - canResize: false, | ||
85 | - actionColumn: { | ||
86 | - width: 80, | ||
87 | - title: t('routes.common.system.pageSystemTitleOperation'),//操作 | ||
88 | - dataIndex: 'action', | ||
89 | - slots: {customRender: 'action'}, | ||
90 | - fixed: undefined, | ||
91 | - }, | ||
92 | - }); | ||
93 | - | ||
94 | - /** | ||
95 | - * 获得删除提示框的文字 | ||
96 | - */ | ||
97 | - function getDeleteTitle(): string { | ||
98 | - let labelText = t('routes.common.system.pageSystemTitleWhetherDelete'); | ||
99 | - return labelText | ||
100 | - } | ||
101 | - | ||
102 | - /** | ||
103 | - * 打开新增菜单 | ||
104 | - */ | ||
105 | - function handleCreate() { | ||
106 | - openDrawer(true, { | ||
107 | - isUpdate: false, | 40 | + //导入所需插件 |
41 | + import { computed, defineComponent, nextTick } from 'vue'; | ||
42 | + | ||
43 | + // 导入表格组件,表格事件 | ||
44 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | ||
45 | + | ||
46 | + // 加载表格数据 | ||
47 | + import { getMenuList, delMenu } from '/@/api/sys/menu'; | ||
48 | + // 加载自定义侧边弹出框 组件 | ||
49 | + import { useDrawer } from '/@/components/Drawer'; | ||
50 | + | ||
51 | + // 导入子页面【新增、修改】 | ||
52 | + import MenuDrawer from './MenuDrawer.vue'; | ||
53 | + | ||
54 | + // 导入列 属性,和搜索栏内容 | ||
55 | + import { columns, searchFormSchema } from './menu.data'; | ||
56 | + import { useI18n } from '/@/hooks/web/useI18n'; | ||
57 | + import { notification } from 'ant-design-vue'; | ||
58 | + | ||
59 | + // 自定义表格组件和属性 | ||
60 | + export default defineComponent({ | ||
61 | + name: 'MenuManagement', | ||
62 | + components: { BasicTable, MenuDrawer, TableAction }, | ||
63 | + setup() { | ||
64 | + const [registerDrawer, { openDrawer }] = useDrawer(); //使用右侧弹出框 | ||
65 | + const { t } = useI18n(); //加载国际化 | ||
66 | + // 新增菜单 | ||
67 | + const getI18nCreateMenu = computed(() => t('routes.common.system.pageSystemTitleCreateMenu')); | ||
68 | + | ||
69 | + const [registerTable, { reload, expandAll }] = useTable({ | ||
70 | + title: t('routes.common.system.pageSystemTitleMenuList'), //'菜单列表' | ||
71 | + api: getMenuList, //加载数据 | ||
72 | + columns, //加载列 | ||
73 | + // formConfig: { | ||
74 | + // labelWidth: 120, | ||
75 | + // schemas: searchFormSchema, | ||
76 | + // }, | ||
77 | + isTreeTable: true, | ||
78 | + pagination: false, | ||
79 | + striped: false, | ||
80 | + // useSearchForm: true, | ||
81 | + showTableSetting: true, | ||
82 | + bordered: true, | ||
83 | + showIndexColumn: false, | ||
84 | + canResize: false, | ||
85 | + actionColumn: { | ||
86 | + width: 80, | ||
87 | + title: t('routes.common.system.pageSystemTitleOperation'), //操作 | ||
88 | + dataIndex: 'action', | ||
89 | + slots: { customRender: 'action' }, | ||
90 | + fixed: undefined, | ||
91 | + }, | ||
108 | }); | 92 | }); |
109 | - } | ||
110 | 93 | ||
111 | - /** | ||
112 | - * 打开 编辑菜单 | ||
113 | - * @param record | ||
114 | - */ | ||
115 | - function handleEdit(record: Recordable) { | ||
116 | - console.log("----------------------------333-------------"+record.parentId); | ||
117 | - openDrawer(true, { | ||
118 | - record, | ||
119 | - isUpdate: true, | ||
120 | - }); | ||
121 | - } | 94 | + /** |
95 | + * 获得删除提示框的文字 | ||
96 | + */ | ||
97 | + function getDeleteTitle(): string { | ||
98 | + let labelText = t('routes.common.system.pageSystemTitleWhetherDelete'); | ||
99 | + return labelText; | ||
100 | + } | ||
122 | 101 | ||
123 | - /** | ||
124 | - * 执行 删除操作 | ||
125 | - * @param record | ||
126 | - */ | ||
127 | - async function handleDelete(record: Recordable) { | ||
128 | - try { | ||
129 | - let ids = [record.id,]; | ||
130 | - await delMenu(ids); | ||
131 | - notification.success({ | ||
132 | - message: "成功", | ||
133 | - description: "删除菜单成功", | ||
134 | - duration: 3, | 102 | + /** |
103 | + * 打开新增菜单 | ||
104 | + */ | ||
105 | + function handleCreate() { | ||
106 | + openDrawer(true, { | ||
107 | + isUpdate: false, | ||
135 | }); | 108 | }); |
136 | - await reload(); | ||
137 | - } catch (e) { | ||
138 | - return Promise.reject(e); | ||
139 | } | 109 | } |
140 | - } | ||
141 | 110 | ||
142 | - /** | ||
143 | - * 操作成功,重新加载页面 | ||
144 | - */ | ||
145 | - function handleSuccess() { | ||
146 | - reload(); | ||
147 | - } | 111 | + /** |
112 | + * 打开 编辑菜单 | ||
113 | + * @param record | ||
114 | + */ | ||
115 | + function handleEdit(record: Recordable) { | ||
116 | + console.log('----------------------------333-------------' + record.parentId); | ||
117 | + openDrawer(true, { | ||
118 | + record, | ||
119 | + isUpdate: true, | ||
120 | + }); | ||
121 | + } | ||
148 | 122 | ||
149 | - function onFetchSuccess() { | ||
150 | - // 演示默认展开所有表项 | ||
151 | - nextTick(expandAll); | ||
152 | - } | 123 | + /** |
124 | + * 执行 删除操作 | ||
125 | + * @param record | ||
126 | + */ | ||
127 | + async function handleDelete(record: Recordable) { | ||
128 | + try { | ||
129 | + let ids = [record.id]; | ||
130 | + await delMenu(ids); | ||
131 | + notification.success({ | ||
132 | + message: '成功', | ||
133 | + description: '删除菜单成功', | ||
134 | + duration: 3, | ||
135 | + }); | ||
136 | + await reload(); | ||
137 | + } catch (e) { | ||
138 | + return Promise.reject(e); | ||
139 | + } | ||
140 | + } | ||
141 | + | ||
142 | + /** | ||
143 | + * 操作成功,重新加载页面 | ||
144 | + */ | ||
145 | + function handleSuccess() { | ||
146 | + reload(); | ||
147 | + } | ||
148 | + | ||
149 | + function onFetchSuccess() { | ||
150 | + // 演示默认展开所有表项 | ||
151 | + nextTick(expandAll); | ||
152 | + } | ||
153 | 153 | ||
154 | - return { | ||
155 | - getDeleteTitle, | ||
156 | - getI18nCreateMenu, | ||
157 | - registerTable, | ||
158 | - registerDrawer, | ||
159 | - handleCreate, | ||
160 | - handleEdit, | ||
161 | - handleDelete, | ||
162 | - handleSuccess, | ||
163 | - onFetchSuccess, | ||
164 | - }; | ||
165 | - }, | ||
166 | -}); | 154 | + return { |
155 | + getDeleteTitle, | ||
156 | + getI18nCreateMenu, | ||
157 | + registerTable, | ||
158 | + registerDrawer, | ||
159 | + handleCreate, | ||
160 | + handleEdit, | ||
161 | + handleDelete, | ||
162 | + handleSuccess, | ||
163 | + onFetchSuccess, | ||
164 | + }; | ||
165 | + }, | ||
166 | + }); | ||
167 | </script> | 167 | </script> |
@@ -3,24 +3,24 @@ import { FormSchema } from '/@/components/Table'; | @@ -3,24 +3,24 @@ import { FormSchema } from '/@/components/Table'; | ||
3 | import { h } from 'vue'; | 3 | import { h } from 'vue'; |
4 | import { Tag } from 'ant-design-vue'; | 4 | import { Tag } from 'ant-design-vue'; |
5 | import { Icon } from '/@/components/Icon'; | 5 | import { Icon } from '/@/components/Icon'; |
6 | -import {useI18n} from "/@/hooks/web/useI18n"; | 6 | +import { useI18n } from '/@/hooks/web/useI18n'; |
7 | const { t } = useI18n(); | 7 | const { t } = useI18n(); |
8 | 8 | ||
9 | //菜单管理页,所需的列 配置 | 9 | //菜单管理页,所需的列 配置 |
10 | export const columns: BasicColumn[] = [ | 10 | export const columns: BasicColumn[] = [ |
11 | { | 11 | { |
12 | - title: t('routes.common.system.tableTitleSystemMenuName'),//菜单名称 | 12 | + title: t('routes.common.system.tableTitleSystemMenuName'), //菜单名称 |
13 | // title:'菜单名称', | 13 | // title:'菜单名称', |
14 | dataIndex: 'meta.title', | 14 | dataIndex: 'meta.title', |
15 | width: 200, | 15 | width: 200, |
16 | align: 'left', | 16 | align: 'left', |
17 | customRender: ({ record }) => { | 17 | customRender: ({ record }) => { |
18 | - record = t(record.meta.title);//国际化处理 | 18 | + record = t(record.meta.title); //国际化处理 |
19 | return record; | 19 | return record; |
20 | }, | 20 | }, |
21 | }, | 21 | }, |
22 | { | 22 | { |
23 | - title: t('routes.common.system.tableTitleSystemIcon'),//图标 | 23 | + title: t('routes.common.system.tableTitleSystemIcon'), //图标 |
24 | // title:'图标', | 24 | // title:'图标', |
25 | dataIndex: 'meta.icon', | 25 | dataIndex: 'meta.icon', |
26 | width: 50, | 26 | width: 50, |
@@ -29,24 +29,24 @@ export const columns: BasicColumn[] = [ | @@ -29,24 +29,24 @@ export const columns: BasicColumn[] = [ | ||
29 | }, | 29 | }, |
30 | }, | 30 | }, |
31 | { | 31 | { |
32 | - title: t('routes.common.system.tableTitleSystemPermissionTag'),//权限标识 | 32 | + title: t('routes.common.system.tableTitleSystemPermissionTag'), //权限标识 |
33 | // title:'权限标识', | 33 | // title:'权限标识', |
34 | dataIndex: 'permission', | 34 | dataIndex: 'permission', |
35 | width: 180, | 35 | width: 180, |
36 | }, | 36 | }, |
37 | { | 37 | { |
38 | - title: t('routes.common.system.tableTitleSystemComponents'),//'组件' | 38 | + title: t('routes.common.system.tableTitleSystemComponents'), //'组件' |
39 | // title:'组件', | 39 | // title:'组件', |
40 | dataIndex: 'component', | 40 | dataIndex: 'component', |
41 | }, | 41 | }, |
42 | { | 42 | { |
43 | - title: t('routes.common.system.tableTitleSystemSort'),//'排序' | 43 | + title: t('routes.common.system.tableTitleSystemSort'), //'排序' |
44 | // title:'排序', | 44 | // title:'排序', |
45 | dataIndex: 'sort', | 45 | dataIndex: 'sort', |
46 | width: 50, | 46 | width: 50, |
47 | }, | 47 | }, |
48 | { | 48 | { |
49 | - title: t('routes.common.system.tableTitleSystemStatus'),//'状态' | 49 | + title: t('routes.common.system.tableTitleSystemStatus'), //'状态' |
50 | // title:'状态', | 50 | // title:'状态', |
51 | dataIndex: 'status', | 51 | dataIndex: 'status', |
52 | width: 80, | 52 | width: 80, |
@@ -54,14 +54,14 @@ export const columns: BasicColumn[] = [ | @@ -54,14 +54,14 @@ export const columns: BasicColumn[] = [ | ||
54 | const status = record.meta.status; | 54 | const status = record.meta.status; |
55 | const enable = ~~status === 0; | 55 | const enable = ~~status === 0; |
56 | const color = enable ? 'green' : 'red'; | 56 | const color = enable ? 'green' : 'red'; |
57 | - let enableText:string = t('routes.common.system.tableTitleSystemEnable');//国际化处理--启用 | ||
58 | - let stopText:string = t('routes.common.system.tableTitleSystemStop');//国际化处理--停用 | 57 | + let enableText: string = t('routes.common.system.tableTitleSystemEnable'); //国际化处理--启用 |
58 | + let stopText: string = t('routes.common.system.tableTitleSystemStop'); //国际化处理--停用 | ||
59 | const text = enable ? enableText : stopText; | 59 | const text = enable ? enableText : stopText; |
60 | return h(Tag, { color: color }, () => text); | 60 | return h(Tag, { color: color }, () => text); |
61 | }, | 61 | }, |
62 | }, | 62 | }, |
63 | { | 63 | { |
64 | - title: t('routes.common.system.tableTitleSystemCreateTime'),//'创建时间' | 64 | + title: t('routes.common.system.tableTitleSystemCreateTime'), //'创建时间' |
65 | // title:'创建时间', | 65 | // title:'创建时间', |
66 | dataIndex: 'createTime', | 66 | dataIndex: 'createTime', |
67 | width: 180, | 67 | width: 180, |
@@ -76,14 +76,14 @@ const isButton = (type: string) => type === '2'; | @@ -76,14 +76,14 @@ const isButton = (type: string) => type === '2'; | ||
76 | export const searchFormSchema: FormSchema[] = [ | 76 | export const searchFormSchema: FormSchema[] = [ |
77 | { | 77 | { |
78 | field: 'menuName', | 78 | field: 'menuName', |
79 | - label: t('routes.common.system.tableTitleSystemMenuName'),//菜单名称 | 79 | + label: t('routes.common.system.tableTitleSystemMenuName'), //菜单名称 |
80 | // label: '菜单名称', | 80 | // label: '菜单名称', |
81 | component: 'Input', | 81 | component: 'Input', |
82 | colProps: { span: 8 }, | 82 | colProps: { span: 8 }, |
83 | }, | 83 | }, |
84 | { | 84 | { |
85 | field: 'status', | 85 | field: 'status', |
86 | - label: t('routes.common.system.tableTitleSystemStatus'),//状态 | 86 | + label: t('routes.common.system.tableTitleSystemStatus'), //状态 |
87 | // label: '状态', | 87 | // label: '状态', |
88 | component: 'Select', | 88 | component: 'Select', |
89 | componentProps: { | 89 | componentProps: { |
@@ -99,38 +99,35 @@ export const searchFormSchema: FormSchema[] = [ | @@ -99,38 +99,35 @@ export const searchFormSchema: FormSchema[] = [ | ||
99 | }, | 99 | }, |
100 | ]; | 100 | ]; |
101 | 101 | ||
102 | - | ||
103 | - | ||
104 | - | ||
105 | //----------------------------------新增、编辑---------------------------------------------------------- | 102 | //----------------------------------新增、编辑---------------------------------------------------------- |
106 | export const formSchema: FormSchema[] = [ | 103 | export const formSchema: FormSchema[] = [ |
107 | { | 104 | { |
108 | field: 'menuType', | 105 | field: 'menuType', |
109 | - label: t('routes.common.system.menuEditPagesMenuType'),//菜单类型 | 106 | + label: t('routes.common.system.menuEditPagesMenuType'), //菜单类型 |
110 | component: 'RadioButtonGroup', | 107 | component: 'RadioButtonGroup', |
111 | defaultValue: '0', | 108 | defaultValue: '0', |
112 | componentProps: { | 109 | componentProps: { |
113 | options: [ | 110 | options: [ |
114 | - { label: t('routes.common.system.menuEditPagesDirectory'), value: '0' },//目录 | ||
115 | - { label: t('routes.common.system.menuEditPagesMenu'), value: '1' },//菜单 | ||
116 | - { label: t('routes.common.system.menuEditPagesButton'), value: '2' },//按钮 | 111 | + { label: t('routes.common.system.menuEditPagesDirectory'), value: '0' }, //目录 |
112 | + { label: t('routes.common.system.menuEditPagesMenu'), value: '1' }, //菜单 | ||
113 | + { label: t('routes.common.system.menuEditPagesButton'), value: '2' }, //按钮 | ||
117 | ], | 114 | ], |
118 | onChange: (e) => { | 115 | onChange: (e) => { |
119 | - console.log("--------11111---------------",e); | 116 | + console.log('--------11111---------------', e); |
120 | }, | 117 | }, |
121 | }, | 118 | }, |
122 | colProps: { lg: 24, md: 24 }, | 119 | colProps: { lg: 24, md: 24 }, |
123 | }, | 120 | }, |
124 | { | 121 | { |
125 | field: 'title', | 122 | field: 'title', |
126 | - label: t('routes.common.system.tableTitleSystemMenuName'),//菜单名称 | 123 | + label: t('routes.common.system.tableTitleSystemMenuName'), //菜单名称 |
127 | component: 'Input', | 124 | component: 'Input', |
128 | required: true, | 125 | required: true, |
129 | }, | 126 | }, |
130 | 127 | ||
131 | { | 128 | { |
132 | field: 'parentId', | 129 | field: 'parentId', |
133 | - label: t('routes.common.system.menuEditPagesParentMenu'),//上级菜单 | 130 | + label: t('routes.common.system.menuEditPagesParentMenu'), //上级菜单 |
134 | component: 'TreeSelect', | 131 | component: 'TreeSelect', |
135 | componentProps: { | 132 | componentProps: { |
136 | replaceFields: { | 133 | replaceFields: { |
@@ -144,88 +141,88 @@ export const formSchema: FormSchema[] = [ | @@ -144,88 +141,88 @@ export const formSchema: FormSchema[] = [ | ||
144 | 141 | ||
145 | { | 142 | { |
146 | field: 'sort', | 143 | field: 'sort', |
147 | - label: t('routes.common.system.tableTitleSystemSort'),//排序 | 144 | + label: t('routes.common.system.tableTitleSystemSort'), //排序 |
148 | component: 'InputNumber', | 145 | component: 'InputNumber', |
149 | required: true, | 146 | required: true, |
150 | }, | 147 | }, |
151 | { | 148 | { |
152 | field: 'icon', | 149 | field: 'icon', |
153 | - label: t('routes.common.system.tableTitleSystemIcon'),//图标 | 150 | + label: t('routes.common.system.tableTitleSystemIcon'), //图标 |
154 | component: 'IconPicker', | 151 | component: 'IconPicker', |
155 | required: true, | 152 | required: true, |
156 | - ifShow: ({ values }) => !isButton(Reflect.get(values,'menuType')), | 153 | + ifShow: ({ values }) => !isButton(Reflect.get(values, 'menuType')), |
157 | }, | 154 | }, |
158 | 155 | ||
159 | { | 156 | { |
160 | field: 'path', | 157 | field: 'path', |
161 | - label: t('routes.common.system.menuEditPagesRouterAddress'),//路由地址 | 158 | + label: t('routes.common.system.menuEditPagesRouterAddress'), //路由地址 |
162 | component: 'Input', | 159 | component: 'Input', |
163 | required: true, | 160 | required: true, |
164 | - ifShow: ({ values }) => !isButton(Reflect.get(values,'menuType')), | 161 | + ifShow: ({ values }) => !isButton(Reflect.get(values, 'menuType')), |
165 | }, | 162 | }, |
166 | { | 163 | { |
167 | field: 'component', | 164 | field: 'component', |
168 | - label: t('routes.common.system.menuEditPagesComponentsPath'),//组件路径 | 165 | + label: t('routes.common.system.menuEditPagesComponentsPath'), //组件路径 |
169 | component: 'Input', | 166 | component: 'Input', |
170 | - ifShow: ({ values }) => isMenu(Reflect.get(values,'menuType')), | 167 | + ifShow: ({ values }) => isMenu(Reflect.get(values, 'menuType')), |
171 | }, | 168 | }, |
172 | { | 169 | { |
173 | field: 'permission', | 170 | field: 'permission', |
174 | - label: t('routes.common.system.tableTitleSystemPermissionTag'),//权限标识 | 171 | + label: t('routes.common.system.tableTitleSystemPermissionTag'), //权限标识 |
175 | component: 'Input', | 172 | component: 'Input', |
176 | - ifShow: ({ values }) => !isDir(Reflect.get(values,'menuType')), | 173 | + ifShow: ({ values }) => !isDir(Reflect.get(values, 'menuType')), |
177 | }, | 174 | }, |
178 | { | 175 | { |
179 | field: 'status', | 176 | field: 'status', |
180 | - label: t('routes.common.system.tableTitleSystemStatus'),//状态 | 177 | + label: t('routes.common.system.tableTitleSystemStatus'), //状态 |
181 | component: 'RadioButtonGroup', | 178 | component: 'RadioButtonGroup', |
182 | defaultValue: '0', | 179 | defaultValue: '0', |
183 | componentProps: { | 180 | componentProps: { |
184 | options: [ | 181 | options: [ |
185 | - { label: t('routes.common.system.tableTitleSystemEnable'), value: '0' },//启用 | ||
186 | - { label: t('routes.common.system.tableTitleSystemStop'), value: '1' },//禁用 | 182 | + { label: t('routes.common.system.tableTitleSystemEnable'), value: '0' }, //启用 |
183 | + { label: t('routes.common.system.tableTitleSystemStop'), value: '1' }, //禁用 | ||
187 | ], | 184 | ], |
188 | }, | 185 | }, |
189 | }, | 186 | }, |
190 | { | 187 | { |
191 | field: 'isLink', | 188 | field: 'isLink', |
192 | - label: t('routes.common.system.menuEditPagesIsExt'),//是否外链 | 189 | + label: t('routes.common.system.menuEditPagesIsExt'), //是否外链 |
193 | component: 'RadioButtonGroup', | 190 | component: 'RadioButtonGroup', |
194 | defaultValue: false, | 191 | defaultValue: false, |
195 | componentProps: { | 192 | componentProps: { |
196 | options: [ | 193 | options: [ |
197 | - { label: t('routes.common.system.menuEditPagesYes'), value: true },//是 | ||
198 | - { label: t('routes.common.system.menuEditPagesNo'), value: false },//否 | 194 | + { label: t('routes.common.system.menuEditPagesYes'), value: true }, //是 |
195 | + { label: t('routes.common.system.menuEditPagesNo'), value: false }, //否 | ||
199 | ], | 196 | ], |
200 | }, | 197 | }, |
201 | - ifShow: ({ values }) => !isButton(Reflect.get(values,'menuType')), | 198 | + ifShow: ({ values }) => !isButton(Reflect.get(values, 'menuType')), |
202 | }, | 199 | }, |
203 | 200 | ||
204 | { | 201 | { |
205 | field: 'ignoreKeepAlive', | 202 | field: 'ignoreKeepAlive', |
206 | - label: t('routes.common.system.menuEditPagesIsKeepAlive'),//是否缓存 | 203 | + label: t('routes.common.system.menuEditPagesIsKeepAlive'), //是否缓存 |
207 | component: 'RadioButtonGroup', | 204 | component: 'RadioButtonGroup', |
208 | defaultValue: false, | 205 | defaultValue: false, |
209 | componentProps: { | 206 | componentProps: { |
210 | options: [ | 207 | options: [ |
211 | - { label: t('routes.common.system.menuEditPagesYes'), value: true },//是 | ||
212 | - { label: t('routes.common.system.menuEditPagesNo'), value: false },//否 | 208 | + { label: t('routes.common.system.menuEditPagesYes'), value: true }, //是 |
209 | + { label: t('routes.common.system.menuEditPagesNo'), value: false }, //否 | ||
213 | ], | 210 | ], |
214 | }, | 211 | }, |
215 | - ifShow: ({ values }) => isMenu(Reflect.get(values,'menuType')), | 212 | + ifShow: ({ values }) => isMenu(Reflect.get(values, 'menuType')), |
216 | }, | 213 | }, |
217 | 214 | ||
218 | { | 215 | { |
219 | field: 'hideMenu', | 216 | field: 'hideMenu', |
220 | - label: t('routes.common.system.menuEditPagesIsHide'),//是否隐藏 | 217 | + label: t('routes.common.system.menuEditPagesIsHide'), //是否隐藏 |
221 | component: 'RadioButtonGroup', | 218 | component: 'RadioButtonGroup', |
222 | defaultValue: false, | 219 | defaultValue: false, |
223 | componentProps: { | 220 | componentProps: { |
224 | options: [ | 221 | options: [ |
225 | - { label: t('routes.common.system.menuEditPagesYes'), value: true },//是 | ||
226 | - { label: t('routes.common.system.menuEditPagesNo'), value: false },//否 | 222 | + { label: t('routes.common.system.menuEditPagesYes'), value: true }, //是 |
223 | + { label: t('routes.common.system.menuEditPagesNo'), value: false }, //否 | ||
227 | ], | 224 | ], |
228 | }, | 225 | }, |
229 | - ifShow: ({ values }) => !isButton(Reflect.get(values,'menuType')), | 226 | + ifShow: ({ values }) => !isButton(Reflect.get(values, 'menuType')), |
230 | }, | 227 | }, |
231 | ]; | 228 | ]; |
@@ -7,76 +7,78 @@ | @@ -7,76 +7,78 @@ | ||
7 | width="30%" | 7 | width="30%" |
8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
9 | > | 9 | > |
10 | - <BasicForm @register="registerForm"/> | 10 | + <BasicForm @register="registerForm" /> |
11 | </BasicDrawer> | 11 | </BasicDrawer> |
12 | </template> | 12 | </template> |
13 | <script lang="ts"> | 13 | <script lang="ts"> |
14 | -import {defineComponent, ref, computed, unref} from 'vue'; | ||
15 | -import {BasicForm, useForm} from '/@/components/Form'; | ||
16 | -import {formSchema} from './organization.data'; | ||
17 | -import {BasicDrawer, useDrawerInner} from '/@/components/Drawer'; | ||
18 | -import {useI18n} from "/@/hooks/web/useI18n"; | ||
19 | -import {getOrganizationList, saveOrUpdateOrganization} from "/@/api/system/system"; | ||
20 | -export default defineComponent({ | ||
21 | - name: 'OrganizationDrawer', | ||
22 | - components: {BasicDrawer, BasicForm}, | ||
23 | - emits: ['success', 'register'], | ||
24 | - setup(_, {emit}) { | ||
25 | - const isUpdate = ref(true); | ||
26 | - let organizationId; | 14 | + import { defineComponent, ref, computed, unref } from 'vue'; |
15 | + import { BasicForm, useForm } from '/@/components/Form'; | ||
16 | + import { formSchema } from './organization.data'; | ||
17 | + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | ||
18 | + import { useI18n } from '/@/hooks/web/useI18n'; | ||
19 | + import { getOrganizationList, saveOrUpdateOrganization } from '/@/api/system/system'; | ||
20 | + export default defineComponent({ | ||
21 | + name: 'OrganizationDrawer', | ||
22 | + components: { BasicDrawer, BasicForm }, | ||
23 | + emits: ['success', 'register'], | ||
24 | + setup(_, { emit }) { | ||
25 | + const isUpdate = ref(true); | ||
26 | + let organizationId; | ||
27 | 27 | ||
28 | - const [registerForm, {resetFields, setFieldsValue, updateSchema, validate}] = useForm({ | ||
29 | - labelWidth: 100, | ||
30 | - schemas: formSchema, | ||
31 | - showActionButtonGroup: false | ||
32 | - }); | ||
33 | - const {t} = useI18n(); //加载国际化 | 28 | + const [registerForm, { resetFields, setFieldsValue, updateSchema, validate }] = useForm({ |
29 | + labelWidth: 100, | ||
30 | + schemas: formSchema, | ||
31 | + showActionButtonGroup: false, | ||
32 | + }); | ||
33 | + const { t } = useI18n(); //加载国际化 | ||
34 | 34 | ||
35 | - //默认传递页面数据 | ||
36 | - const [registerDrawer, {setDrawerProps, closeDrawer}] = useDrawerInner(async (data) => { | ||
37 | - await resetFields(); | ||
38 | - setDrawerProps({confirmLoading: false}); | ||
39 | - isUpdate.value = !!data?.isUpdate; | 35 | + //默认传递页面数据 |
36 | + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | ||
37 | + await resetFields(); | ||
38 | + setDrawerProps({ confirmLoading: false }); | ||
39 | + isUpdate.value = !!data?.isUpdate; | ||
40 | 40 | ||
41 | - //如果是编辑操作,设置页面数据 | ||
42 | - if (unref(isUpdate)) { | ||
43 | - //为表单赋值 | ||
44 | - await setFieldsValue({ | ||
45 | - ...data.record, | 41 | + //如果是编辑操作,设置页面数据 |
42 | + if (unref(isUpdate)) { | ||
43 | + //为表单赋值 | ||
44 | + await setFieldsValue({ | ||
45 | + ...data.record, | ||
46 | + }); | ||
47 | + } | ||
48 | + if (isUpdate.value) { | ||
49 | + organizationId = Reflect.get(data.record, 'id'); | ||
50 | + } | ||
51 | + let treeData = await getOrganizationList(); | ||
52 | + await updateSchema({ | ||
53 | + field: 'parentId', | ||
54 | + componentProps: { treeData }, | ||
46 | }); | 55 | }); |
47 | - | ||
48 | - } | ||
49 | - if (isUpdate.value) { | ||
50 | - organizationId = Reflect.get(data.record, 'id'); | ||
51 | - } | ||
52 | - let treeData = await getOrganizationList(); | ||
53 | - await updateSchema({ | ||
54 | - field: 'parentId', | ||
55 | - componentProps: {treeData}, | ||
56 | }); | 56 | }); |
57 | - }); | ||
58 | 57 | ||
59 | - //得到页面标题 | ||
60 | - const getTitle = computed(() => (!unref(isUpdate) ? t('routes.common.organization.toolCreateOrganization') : t('routes.common.organization.toolEditOrganization'))); | 58 | + //得到页面标题 |
59 | + const getTitle = computed(() => | ||
60 | + !unref(isUpdate) | ||
61 | + ? t('routes.common.organization.toolCreateOrganization') | ||
62 | + : t('routes.common.organization.toolEditOrganization') | ||
63 | + ); | ||
61 | 64 | ||
62 | - //提交按钮 | ||
63 | - async function handleSubmit() { | ||
64 | - try { | ||
65 | - const values = await validate(); | ||
66 | - setDrawerProps({confirmLoading: true}); | ||
67 | - | ||
68 | - if (isUpdate.value) { | ||
69 | - Reflect.set(values, 'id', organizationId); | 65 | + //提交按钮 |
66 | + async function handleSubmit() { | ||
67 | + try { | ||
68 | + const values = await validate(); | ||
69 | + setDrawerProps({ confirmLoading: true }); | ||
70 | + if (isUpdate.value) { | ||
71 | + Reflect.set(values, 'id', organizationId); | ||
72 | + } | ||
73 | + await saveOrUpdateOrganization(values, isUpdate.value); | ||
74 | + closeDrawer(); //关闭侧框 | ||
75 | + emit('success'); | ||
76 | + } finally { | ||
77 | + setDrawerProps({ confirmLoading: false }); | ||
70 | } | 78 | } |
71 | - await saveOrUpdateOrganization(values, isUpdate.value); | ||
72 | - closeDrawer();//关闭侧框 | ||
73 | - emit('success'); | ||
74 | - } finally { | ||
75 | - setDrawerProps({confirmLoading: false}); | ||
76 | } | 79 | } |
77 | - } | ||
78 | 80 | ||
79 | - return {registerDrawer, registerForm, getTitle, handleSubmit}; | ||
80 | - }, | ||
81 | -}); | 81 | + return { registerDrawer, registerForm, getTitle, handleSubmit }; |
82 | + }, | ||
83 | + }); | ||
82 | </script> | 84 | </script> |
@@ -10,16 +10,16 @@ | @@ -10,16 +10,16 @@ | ||
10 | <TableAction | 10 | <TableAction |
11 | :actions="[ | 11 | :actions="[ |
12 | { | 12 | { |
13 | - label:'编辑', | 13 | + label: '编辑', |
14 | icon: 'clarity:note-edit-line', | 14 | icon: 'clarity:note-edit-line', |
15 | onClick: handleEdit.bind(null, record), | 15 | onClick: handleEdit.bind(null, record), |
16 | }, | 16 | }, |
17 | { | 17 | { |
18 | - label:'删除', | 18 | + label: '删除', |
19 | icon: 'ant-design:delete-outlined', | 19 | icon: 'ant-design:delete-outlined', |
20 | color: 'error', | 20 | color: 'error', |
21 | popConfirm: { | 21 | popConfirm: { |
22 | - title: getDeleteTitle(),//是否确认删除//getDeleteTitle() | 22 | + title: getDeleteTitle(), //是否确认删除//getDeleteTitle() |
23 | confirm: handleDelete.bind(null, record), | 23 | confirm: handleDelete.bind(null, record), |
24 | }, | 24 | }, |
25 | }, | 25 | }, |
@@ -31,27 +31,28 @@ | @@ -31,27 +31,28 @@ | ||
31 | </div> | 31 | </div> |
32 | </template> | 32 | </template> |
33 | <script lang="ts"> | 33 | <script lang="ts"> |
34 | - import {computed, defineComponent, nextTick} from 'vue'; | 34 | + import { computed, defineComponent, nextTick } from 'vue'; |
35 | 35 | ||
36 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 36 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
37 | 37 | ||
38 | // 加载自定义侧边弹出框 组件 | 38 | // 加载自定义侧边弹出框 组件 |
39 | - import {useDrawer} from '/@/components/Drawer'; | 39 | + |
40 | + import { useDrawer } from '/@/components/Drawer'; | ||
40 | import DeptDrawer from './OrganizationDrawer.vue'; | 41 | import DeptDrawer from './OrganizationDrawer.vue'; |
41 | import { columns } from './organization.data'; | 42 | import { columns } from './organization.data'; |
42 | - import {useI18n} from "/@/hooks/web/useI18n"; | ||
43 | - import {delOrganization, getOrganizationList} from "/@/api/system/system"; | ||
44 | - import {useMessage} from "/@/hooks/web/useMessage"; | 43 | + import { useI18n } from '/@/hooks/web/useI18n'; |
44 | + import { delOrganization, getOrganizationList } from '/@/api/system/system'; | ||
45 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
45 | 46 | ||
46 | export default defineComponent({ | 47 | export default defineComponent({ |
47 | name: 'DeptManagement', | 48 | name: 'DeptManagement', |
48 | components: { BasicTable, DeptDrawer, TableAction }, | 49 | components: { BasicTable, DeptDrawer, TableAction }, |
49 | setup() { | 50 | setup() { |
50 | const [registerModal, { openDrawer }] = useDrawer(); | 51 | const [registerModal, { openDrawer }] = useDrawer(); |
51 | - const {t} = useI18n(); //加载国际化 | 52 | + const { t } = useI18n(); //加载国际化 |
52 | const getI18n = computed(() => t('routes.common.organization.toolCreateOrganization')); | 53 | const getI18n = computed(() => t('routes.common.organization.toolCreateOrganization')); |
53 | - const {createMessage} = useMessage(); | ||
54 | - const [registerTable, { reload,expandAll }] = useTable({ | 54 | + const { createMessage } = useMessage(); |
55 | + const [registerTable, { reload, expandAll }] = useTable({ | ||
55 | title: t('routes.common.organization.toolOrganizationList'), | 56 | title: t('routes.common.organization.toolOrganizationList'), |
56 | api: getOrganizationList, | 57 | api: getOrganizationList, |
57 | columns, | 58 | columns, |
@@ -65,7 +66,7 @@ | @@ -65,7 +66,7 @@ | ||
65 | canResize: false, | 66 | canResize: false, |
66 | actionColumn: { | 67 | actionColumn: { |
67 | width: 80, | 68 | width: 80, |
68 | - title: t('routes.common.common.operation'),//操作 | 69 | + title: t('routes.common.common.operation'), //操作 |
69 | dataIndex: 'action', | 70 | dataIndex: 'action', |
70 | slots: { customRender: 'action' }, | 71 | slots: { customRender: 'action' }, |
71 | fixed: undefined, | 72 | fixed: undefined, |
@@ -76,7 +77,7 @@ | @@ -76,7 +77,7 @@ | ||
76 | */ | 77 | */ |
77 | function getDeleteTitle(): string { | 78 | function getDeleteTitle(): string { |
78 | let labelText = t('routes.common.system.pageSystemTitleWhetherDelete'); | 79 | let labelText = t('routes.common.system.pageSystemTitleWhetherDelete'); |
79 | - return labelText | 80 | + return labelText; |
80 | } | 81 | } |
81 | 82 | ||
82 | function handleCreate() { | 83 | function handleCreate() { |
@@ -95,9 +96,9 @@ | @@ -95,9 +96,9 @@ | ||
95 | async function handleDelete(record: Recordable) { | 96 | async function handleDelete(record: Recordable) { |
96 | // console.log(record); | 97 | // console.log(record); |
97 | try { | 98 | try { |
98 | - let ids = [record.id,]; | ||
99 | - await delOrganization(ids).then(()=>{ | ||
100 | - createMessage.success("删除组织成功"); | 99 | + let ids = [record.id]; |
100 | + await delOrganization(ids).then(() => { | ||
101 | + createMessage.success('删除组织成功'); | ||
101 | handleSuccess(); | 102 | handleSuccess(); |
102 | }); | 103 | }); |
103 | } catch (e) { | 104 | } catch (e) { |
@@ -115,9 +116,9 @@ | @@ -115,9 +116,9 @@ | ||
115 | } | 116 | } |
116 | 117 | ||
117 | return { | 118 | return { |
119 | + getI18n, | ||
118 | registerTable, | 120 | registerTable, |
119 | registerModal, | 121 | registerModal, |
120 | - getI18n, | ||
121 | getDeleteTitle, | 122 | getDeleteTitle, |
122 | handleCreate, | 123 | handleCreate, |
123 | handleEdit, | 124 | handleEdit, |
1 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; |
2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; |
3 | -import {useI18n} from "/@/hooks/web/useI18n"; | 3 | +import { useI18n } from '/@/hooks/web/useI18n'; |
4 | const { t } = useI18n(); | 4 | const { t } = useI18n(); |
5 | 5 | ||
6 | export const columns: BasicColumn[] = [ | 6 | export const columns: BasicColumn[] = [ |
@@ -11,17 +11,17 @@ export const columns: BasicColumn[] = [ | @@ -11,17 +11,17 @@ export const columns: BasicColumn[] = [ | ||
11 | align: 'left', | 11 | align: 'left', |
12 | }, | 12 | }, |
13 | { | 13 | { |
14 | - title: t('routes.common.common.sort'),//排序 | 14 | + title: t('routes.common.common.sort'), //排序 |
15 | dataIndex: 'sort', | 15 | dataIndex: 'sort', |
16 | width: 50, | 16 | width: 50, |
17 | }, | 17 | }, |
18 | { | 18 | { |
19 | - title: t('routes.common.common.createTime'),//创建时间 | 19 | + title: t('routes.common.common.createTime'), //创建时间 |
20 | dataIndex: 'createTime', | 20 | dataIndex: 'createTime', |
21 | width: 180, | 21 | width: 180, |
22 | }, | 22 | }, |
23 | { | 23 | { |
24 | - title: t('routes.common.common.remark'),//备注 | 24 | + title: t('routes.common.common.remark'), //备注 |
25 | dataIndex: 'remark', | 25 | dataIndex: 'remark', |
26 | width: 300, | 26 | width: 300, |
27 | }, | 27 | }, |
@@ -49,12 +49,12 @@ export const formSchema: FormSchema[] = [ | @@ -49,12 +49,12 @@ export const formSchema: FormSchema[] = [ | ||
49 | }, | 49 | }, |
50 | { | 50 | { |
51 | field: 'sort', | 51 | field: 'sort', |
52 | - label: t('routes.common.common.sort'),//排序 | 52 | + label: t('routes.common.common.sort'), //排序 |
53 | component: 'InputNumber', | 53 | component: 'InputNumber', |
54 | required: true, | 54 | required: true, |
55 | }, | 55 | }, |
56 | { | 56 | { |
57 | - label: t('routes.common.common.remark'),//备注 | 57 | + label: t('routes.common.common.remark'), //备注 |
58 | field: 'remark', | 58 | field: 'remark', |
59 | component: 'InputTextArea', | 59 | component: 'InputTextArea', |
60 | }, | 60 | }, |
@@ -13,15 +13,15 @@ | @@ -13,15 +13,15 @@ | ||
13 | import { defineComponent } from 'vue'; | 13 | import { defineComponent } from 'vue'; |
14 | import { PageWrapper } from '/@/components/Page'; | 14 | import { PageWrapper } from '/@/components/Page'; |
15 | import { BasicForm, useForm } from '/@/components/Form'; | 15 | import { BasicForm, useForm } from '/@/components/Form'; |
16 | - import {USER_INFO_KEY} from "/@/enums/cacheEnum"; | ||
17 | - import {getAuthCache} from "/@/utils/auth"; | 16 | + import { USER_INFO_KEY } from '/@/enums/cacheEnum'; |
17 | + import { getAuthCache } from '/@/utils/auth'; | ||
18 | import { formSchema } from './pwd.data'; | 18 | import { formSchema } from './pwd.data'; |
19 | - import {resetPassword} from "/@/api/system/system"; | ||
20 | - import {useMultipleTabStore} from "/@/store/modules/multipleTab"; | ||
21 | - import {useUserStore} from "/@/store/modules/user"; | ||
22 | - import {useAppStore} from "/@/store/modules/app"; | ||
23 | - import {usePermissionStore} from "/@/store/modules/permission"; | ||
24 | - import {useMessage} from "/@/hooks/web/useMessage"; | 19 | + import { resetPassword } from '/@/api/system/system'; |
20 | + import { useMultipleTabStore } from '/@/store/modules/multipleTab'; | ||
21 | + import { useUserStore } from '/@/store/modules/user'; | ||
22 | + import { useAppStore } from '/@/store/modules/app'; | ||
23 | + import { usePermissionStore } from '/@/store/modules/permission'; | ||
24 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
25 | export default defineComponent({ | 25 | export default defineComponent({ |
26 | name: 'ChangePassword', | 26 | name: 'ChangePassword', |
27 | components: { BasicForm, PageWrapper }, | 27 | components: { BasicForm, PageWrapper }, |
@@ -36,31 +36,31 @@ | @@ -36,31 +36,31 @@ | ||
36 | const userStore = useUserStore(); | 36 | const userStore = useUserStore(); |
37 | const appStore = useAppStore(); | 37 | const appStore = useAppStore(); |
38 | const permissionStore = usePermissionStore(); | 38 | const permissionStore = usePermissionStore(); |
39 | - const {createMessage} = useMessage(); | 39 | + const { createMessage } = useMessage(); |
40 | const userInfo = getAuthCache(USER_INFO_KEY); | 40 | const userInfo = getAuthCache(USER_INFO_KEY); |
41 | - console.log(userInfo,"userInfo") | 41 | + console.log(userInfo, 'userInfo'); |
42 | async function handleSubmit() { | 42 | async function handleSubmit() { |
43 | try { | 43 | try { |
44 | const values = await validate(); | 44 | const values = await validate(); |
45 | const { passwordOld, passwordNew } = values; | 45 | const { passwordOld, passwordNew } = values; |
46 | const params = { | 46 | const params = { |
47 | - userId:userInfo.userId, | ||
48 | - password:passwordOld, | ||
49 | - resetPassword:passwordNew | 47 | + userId: userInfo.userId, |
48 | + password: passwordOld, | ||
49 | + resetPassword: passwordNew, | ||
50 | }; | 50 | }; |
51 | 51 | ||
52 | - await resetPassword(params).then((result)=>{ | ||
53 | - if(result.data){ | ||
54 | - createMessage.success("修改成功"); | ||
55 | - setTimeout(function (){ | ||
56 | - localStorage.clear(); | ||
57 | - appStore.resetAllState(); | ||
58 | - permissionStore.resetState(); | ||
59 | - tabStore.resetState(); | ||
60 | - userStore.resetState(); | ||
61 | - location.reload(); | ||
62 | - },500) | ||
63 | - } | 52 | + await resetPassword(params).then((result) => { |
53 | + if (result.data) { | ||
54 | + createMessage.success('修改成功'); | ||
55 | + setTimeout(function () { | ||
56 | + localStorage.clear(); | ||
57 | + appStore.resetAllState(); | ||
58 | + permissionStore.resetState(); | ||
59 | + tabStore.resetState(); | ||
60 | + userStore.resetState(); | ||
61 | + location.reload(); | ||
62 | + }, 500); | ||
63 | + } | ||
64 | }); | 64 | }); |
65 | } catch (error) {} | 65 | } catch (error) {} |
66 | } | 66 | } |
1 | import { FormSchema } from '/@/components/Form'; | 1 | import { FormSchema } from '/@/components/Form'; |
2 | -import {InputRegExp} from "/@/enums/regexpEnum"; | 2 | +import { InputRegExp } from '/@/enums/regexpEnum'; |
3 | export const formSchema: FormSchema[] = [ | 3 | export const formSchema: FormSchema[] = [ |
4 | { | 4 | { |
5 | field: 'passwordOld', | 5 | field: 'passwordOld', |
@@ -39,8 +39,10 @@ export const formSchema: FormSchema[] = [ | @@ -39,8 +39,10 @@ export const formSchema: FormSchema[] = [ | ||
39 | } | 39 | } |
40 | 40 | ||
41 | const pwdRegex = new RegExp(InputRegExp.PASSWORD_INPUT); | 41 | const pwdRegex = new RegExp(InputRegExp.PASSWORD_INPUT); |
42 | - if(!pwdRegex.test(value)){ | ||
43 | - return Promise.reject('密码中必须包含大小写 字母、数字、特称字符,至少8个字符,最多30个字符'); | 42 | + if (!pwdRegex.test(value)) { |
43 | + return Promise.reject( | ||
44 | + '密码中必须包含大小写 字母、数字、特称字符,至少8个字符,最多30个字符' | ||
45 | + ); | ||
44 | } | 46 | } |
45 | return Promise.resolve(); | 47 | return Promise.resolve(); |
46 | }, | 48 | }, |
@@ -24,11 +24,16 @@ | @@ -24,11 +24,16 @@ | ||
24 | </BasicForm> | 24 | </BasicForm> |
25 | </BasicDrawer> | 25 | </BasicDrawer> |
26 | </template> | 26 | </template> |
27 | + | ||
27 | <script lang="ts"> | 28 | <script lang="ts"> |
28 | import { defineComponent, ref, computed, unref, getCurrentInstance } from 'vue'; | 29 | import { defineComponent, ref, computed, unref, getCurrentInstance } from 'vue'; |
30 | + | ||
29 | import { BasicForm, useForm } from '/@/components/Form/index'; | 31 | import { BasicForm, useForm } from '/@/components/Form/index'; |
32 | + | ||
30 | import { formSchema } from './role.data'; | 33 | import { formSchema } from './role.data'; |
34 | + | ||
31 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 35 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
36 | + | ||
32 | import { BasicTree, TreeItem } from '/@/components/Tree'; | 37 | import { BasicTree, TreeItem } from '/@/components/Tree'; |
33 | 38 | ||
34 | const { t } = useI18n(); //加载国际化 | 39 | const { t } = useI18n(); //加载国际化 |
@@ -36,33 +41,53 @@ | @@ -36,33 +41,53 @@ | ||
36 | // import { getMenuList } from '/@/api/demo/system'; | 41 | // import { getMenuList } from '/@/api/demo/system'; |
37 | 42 | ||
38 | // 加载菜单数据 | 43 | // 加载菜单数据 |
44 | + | ||
39 | import { getMenuList, getMenusIdsByRoleId } from '/@/api/sys/menu'; | 45 | import { getMenuList, getMenusIdsByRoleId } from '/@/api/sys/menu'; |
46 | + | ||
40 | import { useI18n } from '/@/hooks/web/useI18n'; | 47 | import { useI18n } from '/@/hooks/web/useI18n'; |
48 | + | ||
41 | import { RouteItem } from '/@/api/sys/model/menuModel'; | 49 | import { RouteItem } from '/@/api/sys/model/menuModel'; |
50 | + | ||
42 | import { saveOrUpdateRoleInfoWithMenu } from '/@/api/system/system'; | 51 | import { saveOrUpdateRoleInfoWithMenu } from '/@/api/system/system'; |
52 | + import { useChildrenIdsRemoveParentId } from '/@/hooks/web/useChildrenIdsRemoveParentId'; | ||
43 | export default defineComponent({ | 53 | export default defineComponent({ |
44 | name: 'RoleDrawer', | 54 | name: 'RoleDrawer', |
55 | + | ||
45 | components: { BasicDrawer, BasicForm, BasicTree }, | 56 | components: { BasicDrawer, BasicForm, BasicTree }, |
57 | + | ||
46 | emits: ['success', 'register'], | 58 | emits: ['success', 'register'], |
59 | + | ||
47 | setup(_, { emit }) { | 60 | setup(_, { emit }) { |
48 | const { proxy } = getCurrentInstance(); | 61 | const { proxy } = getCurrentInstance(); |
62 | + | ||
49 | const isUpdate = ref<boolean>(true); | 63 | const isUpdate = ref<boolean>(true); |
64 | + | ||
50 | const treeData = ref<TreeItem[]>([]); | 65 | const treeData = ref<TreeItem[]>([]); |
66 | + | ||
51 | const roleMenus = ref<string[]>([]); | 67 | const roleMenus = ref<string[]>([]); |
68 | + | ||
52 | const allCheckedKeys = ref<string[]>(); | 69 | const allCheckedKeys = ref<string[]>(); |
70 | + | ||
53 | const roleHalfCheckedKeys = ref<string[]>([]); | 71 | const roleHalfCheckedKeys = ref<string[]>([]); |
72 | + | ||
54 | const roleId = ref<string>(''); | 73 | const roleId = ref<string>(''); |
74 | + | ||
55 | const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ | 75 | const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ |
56 | labelWidth: 90, | 76 | labelWidth: 90, |
77 | + | ||
57 | schemas: formSchema, | 78 | schemas: formSchema, |
79 | + | ||
58 | showActionButtonGroup: false, | 80 | showActionButtonGroup: false, |
59 | }); | 81 | }); |
60 | 82 | ||
61 | function processChildren(items: RouteItem[]) { | 83 | function processChildren(items: RouteItem[]) { |
62 | items.map((item) => { | 84 | items.map((item) => { |
63 | item.menuName = t(item.meta.title); | 85 | item.menuName = t(item.meta.title); |
86 | + | ||
64 | item.icon = item.meta.icon; | 87 | item.icon = item.meta.icon; |
88 | + | ||
65 | item.key = item.id; | 89 | item.key = item.id; |
90 | + | ||
66 | if (item.children) { | 91 | if (item.children) { |
67 | processChildren(item.children); | 92 | processChildren(item.children); |
68 | } | 93 | } |
@@ -70,56 +95,75 @@ | @@ -70,56 +95,75 @@ | ||
70 | } | 95 | } |
71 | 96 | ||
72 | /** | 97 | /** |
98 | + | ||
73 | * 根据角色id获取所有的菜单ids----里面包含父级id---会造成回显数据时 | 99 | * 根据角色id获取所有的菜单ids----里面包含父级id---会造成回显数据时 |
100 | + | ||
74 | * 存在父级id则默认勾选所有子级id | 101 | * 存在父级id则默认勾选所有子级id |
102 | + | ||
75 | */ | 103 | */ |
76 | - function useChildrenIdsRemoveParentId(str, arr) { | ||
77 | - let index = arr.indexOf(str); | ||
78 | - arr.splice(index, 1); | ||
79 | - return arr; | ||
80 | - } | ||
81 | 104 | ||
82 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | 105 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
83 | resetFields(); | 106 | resetFields(); |
107 | + | ||
84 | roleId.value = ''; | 108 | roleId.value = ''; |
109 | + | ||
85 | setDrawerProps({ confirmLoading: false }); | 110 | setDrawerProps({ confirmLoading: false }); |
111 | + | ||
86 | // 需要在setFieldsValue之前先填充treeData,否则Tree组件可能会报key not exist警告 | 112 | // 需要在setFieldsValue之前先填充treeData,否则Tree组件可能会报key not exist警告 |
113 | + | ||
87 | if (unref(treeData).length === 0) { | 114 | if (unref(treeData).length === 0) { |
88 | // 获取全部的菜单 | 115 | // 获取全部的菜单 |
116 | + | ||
89 | const menuListModel = await getMenuList(); | 117 | const menuListModel = await getMenuList(); |
118 | + | ||
90 | processChildren(menuListModel); | 119 | processChildren(menuListModel); |
120 | + | ||
91 | let treeValues: TreeItem[] = []; | 121 | let treeValues: TreeItem[] = []; |
122 | + | ||
92 | menuListModel.map((item) => { | 123 | menuListModel.map((item) => { |
93 | const data = { | 124 | const data = { |
94 | menuName: t(item.meta.title), | 125 | menuName: t(item.meta.title), |
126 | + | ||
95 | icon: item.meta.icon, | 127 | icon: item.meta.icon, |
128 | + | ||
96 | key: item.id, | 129 | key: item.id, |
130 | + | ||
97 | children: item.children as any as TreeItem[], | 131 | children: item.children as any as TreeItem[], |
98 | }; | 132 | }; |
133 | + | ||
99 | treeValues.push(data); | 134 | treeValues.push(data); |
100 | }); | 135 | }); |
136 | + | ||
101 | treeData.value = treeValues; | 137 | treeData.value = treeValues; |
102 | } | 138 | } |
103 | 139 | ||
104 | if (unref(isUpdate)) { | 140 | if (unref(isUpdate)) { |
105 | if (data.record) { | 141 | if (data.record) { |
106 | // // 通过角色id去获取角色对应的菜单的ids | 142 | // // 通过角色id去获取角色对应的菜单的ids |
143 | + | ||
107 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); | 144 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); |
145 | + | ||
108 | console.log(roleMenus.value); | 146 | console.log(roleMenus.value); |
147 | + | ||
109 | console.log(treeData.value); | 148 | console.log(treeData.value); |
149 | + | ||
110 | treeData.value.map((m) => { | 150 | treeData.value.map((m) => { |
111 | roleMenus.value.map((m1) => { | 151 | roleMenus.value.map((m1) => { |
112 | if (m.key === m1) { | 152 | if (m.key === m1) { |
113 | - proxy.useChildrenIdsRemoveParentId(m1, roleMenus.value); | 153 | + useChildrenIdsRemoveParentId(m1, roleMenus.value); |
114 | } | 154 | } |
115 | }); | 155 | }); |
116 | }); | 156 | }); |
157 | + | ||
117 | console.log(roleMenus.value); | 158 | console.log(roleMenus.value); |
159 | + | ||
118 | proxy.$refs.tree.setCheckedKeys(roleMenus.value); | 160 | proxy.$refs.tree.setCheckedKeys(roleMenus.value); |
161 | + | ||
119 | // console.log(roleMenus.value, 'roleMenus.value'); | 162 | // console.log(roleMenus.value, 'roleMenus.value'); |
120 | - // // TODO: 角色回显问题:待解决 | 163 | + |
121 | roleId.value = data.record.id; | 164 | roleId.value = data.record.id; |
122 | } | 165 | } |
166 | + | ||
123 | setFieldsValue({ | 167 | setFieldsValue({ |
124 | ...data.record, | 168 | ...data.record, |
125 | }); | 169 | }); |
@@ -131,38 +175,58 @@ | @@ -131,38 +175,58 @@ | ||
131 | async function handleSubmit() { | 175 | async function handleSubmit() { |
132 | try { | 176 | try { |
133 | const values = await validate(); | 177 | const values = await validate(); |
178 | + | ||
134 | setDrawerProps({ confirmLoading: true }); | 179 | setDrawerProps({ confirmLoading: true }); |
180 | + | ||
135 | const req = { | 181 | const req = { |
136 | id: roleId.value, | 182 | id: roleId.value, |
183 | + | ||
137 | name: values.name, | 184 | name: values.name, |
185 | + | ||
138 | remark: values.remark, | 186 | remark: values.remark, |
187 | + | ||
139 | status: values.status, | 188 | status: values.status, |
189 | + | ||
140 | menu: allCheckedKeys.value as string[], | 190 | menu: allCheckedKeys.value as string[], |
141 | }; | 191 | }; |
192 | + | ||
142 | saveOrUpdateRoleInfoWithMenu(req).then(() => { | 193 | saveOrUpdateRoleInfoWithMenu(req).then(() => { |
143 | closeDrawer(); | 194 | closeDrawer(); |
195 | + | ||
144 | emit('success'); | 196 | emit('success'); |
145 | }); | 197 | }); |
146 | } finally { | 198 | } finally { |
147 | setDrawerProps({ confirmLoading: false }); | 199 | setDrawerProps({ confirmLoading: false }); |
148 | } | 200 | } |
149 | } | 201 | } |
202 | + | ||
150 | // Tree check事件 | 203 | // Tree check事件 |
204 | + | ||
151 | const handleCheckClick = (checkedKeys: string[], { halfCheckedKeys }) => { | 205 | const handleCheckClick = (checkedKeys: string[], { halfCheckedKeys }) => { |
152 | allCheckedKeys.value = [...checkedKeys, ...halfCheckedKeys]; | 206 | allCheckedKeys.value = [...checkedKeys, ...halfCheckedKeys]; |
207 | + | ||
153 | // 父节点 | 208 | // 父节点 |
209 | + | ||
154 | roleHalfCheckedKeys.value = halfCheckedKeys; | 210 | roleHalfCheckedKeys.value = halfCheckedKeys; |
155 | }; | 211 | }; |
156 | 212 | ||
157 | return { | 213 | return { |
158 | allCheckedKeys, | 214 | allCheckedKeys, |
215 | + | ||
159 | registerDrawer, | 216 | registerDrawer, |
217 | + | ||
160 | registerForm, | 218 | registerForm, |
219 | + | ||
161 | getTitle, | 220 | getTitle, |
221 | + | ||
162 | handleSubmit, | 222 | handleSubmit, |
223 | + | ||
163 | treeData, | 224 | treeData, |
225 | + | ||
164 | roleMenus, | 226 | roleMenus, |
227 | + | ||
165 | handleCheckClick, | 228 | handleCheckClick, |
229 | + | ||
166 | useChildrenIdsRemoveParentId, | 230 | useChildrenIdsRemoveParentId, |
167 | }; | 231 | }; |
168 | }, | 232 | }, |
@@ -8,15 +8,15 @@ | @@ -8,15 +8,15 @@ | ||
8 | <TableAction | 8 | <TableAction |
9 | :actions="[ | 9 | :actions="[ |
10 | { | 10 | { |
11 | - label:'编辑', | 11 | + label: '编辑', |
12 | icon: 'clarity:note-edit-line', | 12 | icon: 'clarity:note-edit-line', |
13 | onClick: handleEdit.bind(null, record), | 13 | onClick: handleEdit.bind(null, record), |
14 | }, | 14 | }, |
15 | { | 15 | { |
16 | - label:'删除', | 16 | + label: '删除', |
17 | icon: 'ant-design:delete-outlined', | 17 | icon: 'ant-design:delete-outlined', |
18 | color: 'error', | 18 | color: 'error', |
19 | - ifShow:record.roleType!=RoleEnum.ROLE_SYS_ADMIN, | 19 | + ifShow: record.roleType != RoleEnum.ROLE_SYS_ADMIN, |
20 | popConfirm: { | 20 | popConfirm: { |
21 | title: '是否确认删除', | 21 | title: '是否确认删除', |
22 | confirm: handleDelete.bind(null, record), | 22 | confirm: handleDelete.bind(null, record), |
@@ -33,12 +33,12 @@ | @@ -33,12 +33,12 @@ | ||
33 | import { defineComponent } from 'vue'; | 33 | import { defineComponent } from 'vue'; |
34 | 34 | ||
35 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 35 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
36 | - import {delRole, getRoleListByPage} from '/@/api/system/system'; | 36 | + import { delRole, getRoleListByPage } from '/@/api/system/system'; |
37 | 37 | ||
38 | import { useDrawer } from '/@/components/Drawer'; | 38 | import { useDrawer } from '/@/components/Drawer'; |
39 | import RoleDrawer from './RoleDrawer.vue'; | 39 | import RoleDrawer from './RoleDrawer.vue'; |
40 | import { columns, searchFormSchema } from './role.data'; | 40 | import { columns, searchFormSchema } from './role.data'; |
41 | - import {RoleEnum} from "/@/enums/roleEnum"; | 41 | + import { RoleEnum } from '/@/enums/roleEnum'; |
42 | 42 | ||
43 | export default defineComponent({ | 43 | export default defineComponent({ |
44 | name: 'RoleManagement', | 44 | name: 'RoleManagement', |
@@ -49,10 +49,10 @@ | @@ -49,10 +49,10 @@ | ||
49 | title: '角色列表', | 49 | title: '角色列表', |
50 | api: getRoleListByPage, | 50 | api: getRoleListByPage, |
51 | columns, | 51 | columns, |
52 | - tableSetting:{ | ||
53 | - redo:true, | ||
54 | - size:false, | ||
55 | - setting:false | 52 | + tableSetting: { |
53 | + redo: true, | ||
54 | + size: false, | ||
55 | + setting: false, | ||
56 | }, | 56 | }, |
57 | formConfig: { | 57 | formConfig: { |
58 | labelWidth: 120, | 58 | labelWidth: 120, |
@@ -85,11 +85,10 @@ | @@ -85,11 +85,10 @@ | ||
85 | } | 85 | } |
86 | 86 | ||
87 | async function handleDelete(record: Recordable) { | 87 | async function handleDelete(record: Recordable) { |
88 | - const roleIds = [record.id] | ||
89 | - delRole(roleIds).then(()=>{ | 88 | + const roleIds = [record.id]; |
89 | + delRole(roleIds).then(() => { | ||
90 | reload(); | 90 | reload(); |
91 | - }) | ||
92 | - | 91 | + }); |
93 | } | 92 | } |
94 | function handleSuccess() { | 93 | function handleSuccess() { |
95 | reload(); | 94 | reload(); |
@@ -102,7 +101,7 @@ | @@ -102,7 +101,7 @@ | ||
102 | handleEdit, | 101 | handleEdit, |
103 | handleDelete, | 102 | handleDelete, |
104 | handleSuccess, | 103 | handleSuccess, |
105 | - RoleEnum | 104 | + RoleEnum, |
106 | }; | 105 | }; |
107 | }, | 106 | }, |
108 | }); | 107 | }); |
1 | -import {BasicColumn} from '/@/components/Table'; | ||
2 | -import {FormSchema} from '/@/components/Table'; | ||
3 | -import {h} from 'vue'; | ||
4 | -import {Switch} from 'ant-design-vue'; | ||
5 | -import {setRoleStatus} from '/@/api/system/system'; | ||
6 | -import {useMessage} from '/@/hooks/web/useMessage'; | 1 | +import { BasicColumn } from '/@/components/Table'; |
2 | +import { FormSchema } from '/@/components/Table'; | ||
3 | +import { h } from 'vue'; | ||
4 | +import { Switch } from 'ant-design-vue'; | ||
5 | +import { setRoleStatus } from '/@/api/system/system'; | ||
6 | +import { useMessage } from '/@/hooks/web/useMessage'; | ||
7 | 7 | ||
8 | export const columns: BasicColumn[] = [ | 8 | export const columns: BasicColumn[] = [ |
9 | { | 9 | { |
@@ -20,7 +20,7 @@ export const columns: BasicColumn[] = [ | @@ -20,7 +20,7 @@ export const columns: BasicColumn[] = [ | ||
20 | title: '状态', | 20 | title: '状态', |
21 | dataIndex: 'status', | 21 | dataIndex: 'status', |
22 | width: 120, | 22 | width: 120, |
23 | - customRender: ({record}) => { | 23 | + customRender: ({ record }) => { |
24 | if (!Reflect.has(record, 'pendingStatus')) { | 24 | if (!Reflect.has(record, 'pendingStatus')) { |
25 | record.pendingStatus = false; | 25 | record.pendingStatus = false; |
26 | } | 26 | } |
@@ -32,7 +32,7 @@ export const columns: BasicColumn[] = [ | @@ -32,7 +32,7 @@ export const columns: BasicColumn[] = [ | ||
32 | onChange(checked: boolean) { | 32 | onChange(checked: boolean) { |
33 | record.pendingStatus = true; | 33 | record.pendingStatus = true; |
34 | const newStatus = checked ? 1 : 0; | 34 | const newStatus = checked ? 1 : 0; |
35 | - const {createMessage} = useMessage(); | 35 | + const { createMessage } = useMessage(); |
36 | setRoleStatus(record.id, newStatus) | 36 | setRoleStatus(record.id, newStatus) |
37 | .then(() => { | 37 | .then(() => { |
38 | record.status = newStatus; | 38 | record.status = newStatus; |
@@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | @@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | ||
52 | { | 52 | { |
53 | title: '备注', | 53 | title: '备注', |
54 | dataIndex: 'remark', | 54 | dataIndex: 'remark', |
55 | - width:240, | 55 | + width: 240, |
56 | }, | 56 | }, |
57 | { | 57 | { |
58 | title: '创建时间', | 58 | title: '创建时间', |
@@ -66,7 +66,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -66,7 +66,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
66 | field: 'roleName', | 66 | field: 'roleName', |
67 | label: '角色名称', | 67 | label: '角色名称', |
68 | component: 'Input', | 68 | component: 'Input', |
69 | - colProps: {span: 8}, | 69 | + colProps: { span: 8 }, |
70 | }, | 70 | }, |
71 | { | 71 | { |
72 | field: 'status', | 72 | field: 'status', |
@@ -74,11 +74,11 @@ export const searchFormSchema: FormSchema[] = [ | @@ -74,11 +74,11 @@ export const searchFormSchema: FormSchema[] = [ | ||
74 | component: 'Select', | 74 | component: 'Select', |
75 | componentProps: { | 75 | componentProps: { |
76 | options: [ | 76 | options: [ |
77 | - {label: '启用', value: 1}, | ||
78 | - {label: '停用', value: 0}, | 77 | + { label: '启用', value: 1 }, |
78 | + { label: '停用', value: 0 }, | ||
79 | ], | 79 | ], |
80 | }, | 80 | }, |
81 | - colProps: {span: 8}, | 81 | + colProps: { span: 8 }, |
82 | }, | 82 | }, |
83 | ]; | 83 | ]; |
84 | 84 | ||
@@ -96,8 +96,8 @@ export const formSchema: FormSchema[] = [ | @@ -96,8 +96,8 @@ export const formSchema: FormSchema[] = [ | ||
96 | defaultValue: 0, | 96 | defaultValue: 0, |
97 | componentProps: { | 97 | componentProps: { |
98 | options: [ | 98 | options: [ |
99 | - {label: '启用', value: 1}, | ||
100 | - {label: '停用', value: 0}, | 99 | + { label: '启用', value: 1 }, |
100 | + { label: '停用', value: 0 }, | ||
101 | ], | 101 | ], |
102 | }, | 102 | }, |
103 | }, | 103 | }, |
@@ -7,9 +7,7 @@ | @@ -7,9 +7,7 @@ | ||
7 | width="60%" | 7 | width="60%" |
8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
9 | > | 9 | > |
10 | - <BasicTable | ||
11 | - @register="tenantAdminTable" | ||
12 | - > | 10 | + <BasicTable @register="tenantAdminTable"> |
13 | <template #toolbar> | 11 | <template #toolbar> |
14 | <a-button type="primary" @click="handleCreateTenantAdmin">新增租户管理员</a-button> | 12 | <a-button type="primary" @click="handleCreateTenantAdmin">新增租户管理员</a-button> |
15 | </template> | 13 | </template> |
@@ -17,31 +15,31 @@ | @@ -17,31 +15,31 @@ | ||
17 | <TableAction | 15 | <TableAction |
18 | :actions="[ | 16 | :actions="[ |
19 | { | 17 | { |
20 | - label:'短信激活', | 18 | + label: '短信激活', |
21 | icon: 'ant-design:send-outlined', | 19 | icon: 'ant-design:send-outlined', |
22 | - tooltip:'发送激活短信', | ||
23 | - ifShow:record.phoneNumber!=null&& !record.hasPassword, | 20 | + tooltip: '发送激活短信', |
21 | + ifShow: record.phoneNumber != null && !record.hasPassword, | ||
24 | onClick: handleSendMsg.bind(null, record), | 22 | onClick: handleSendMsg.bind(null, record), |
25 | }, | 23 | }, |
26 | { | 24 | { |
27 | - label:'清除密码', | 25 | + label: '清除密码', |
28 | icon: 'ant-design:clear-outlined', | 26 | icon: 'ant-design:clear-outlined', |
29 | - tooltip:'清除密码', | 27 | + tooltip: '清除密码', |
30 | ifShow: record.hasPassword, | 28 | ifShow: record.hasPassword, |
31 | onClick: handleResetPassword.bind(null, record), | 29 | onClick: handleResetPassword.bind(null, record), |
32 | }, | 30 | }, |
33 | - { | ||
34 | - label:'编辑', | ||
35 | - icon: 'clarity:note-edit-line', | ||
36 | - tooltip:'编辑', | ||
37 | - onClick: handleEdit.bind(null, record), | 31 | + { |
32 | + label: '编辑', | ||
33 | + icon: 'clarity:note-edit-line', | ||
34 | + tooltip: '编辑', | ||
35 | + onClick: handleEdit.bind(null, record), | ||
38 | }, | 36 | }, |
39 | - { | ||
40 | - label:'删除', | ||
41 | - icon: 'ant-design:delete-outlined', | ||
42 | - tooltip:'删除', | ||
43 | - color: 'error', | ||
44 | - popConfirm: { | 37 | + { |
38 | + label: '删除', | ||
39 | + icon: 'ant-design:delete-outlined', | ||
40 | + tooltip: '删除', | ||
41 | + color: 'error', | ||
42 | + popConfirm: { | ||
45 | title: '是否确认删除', | 43 | title: '是否确认删除', |
46 | confirm: handleDelete.bind(null, record), | 44 | confirm: handleDelete.bind(null, record), |
47 | }, | 45 | }, |
@@ -51,156 +49,169 @@ | @@ -51,156 +49,169 @@ | ||
51 | </template> | 49 | </template> |
52 | <template #status="{ record }"> | 50 | <template #status="{ record }"> |
53 | <Tag | 51 | <Tag |
54 | - :color="record.userStatusEnum==='NORMAL'?'green':(record.userStatusEnum==='DISABLED'?'red':'orange')"> | 52 | + :color=" |
53 | + record.userStatusEnum === 'NORMAL' | ||
54 | + ? 'green' | ||
55 | + : record.userStatusEnum === 'DISABLED' | ||
56 | + ? 'red' | ||
57 | + : 'orange' | ||
58 | + " | ||
59 | + > | ||
55 | {{ | 60 | {{ |
56 | - record.userStatusEnum === 'NORMAL' ? '正常' : (record.userStatusEnum === 'DISABLED' ? '已禁用' : '已过期') | 61 | + record.userStatusEnum === 'NORMAL' |
62 | + ? '正常' | ||
63 | + : record.userStatusEnum === 'DISABLED' | ||
64 | + ? '已禁用' | ||
65 | + : '已过期' | ||
57 | }} | 66 | }} |
58 | </Tag> | 67 | </Tag> |
59 | </template> | 68 | </template> |
60 | </BasicTable> | 69 | </BasicTable> |
61 | - <TenantAdminFormDrawer @register="tenantAdminFormDrawer" @success="handleSuccess"/> | 70 | + <TenantAdminFormDrawer @register="tenantAdminFormDrawer" @success="handleSuccess" /> |
62 | </BasicDrawer> | 71 | </BasicDrawer> |
63 | </template> | 72 | </template> |
64 | <script lang="ts"> | 73 | <script lang="ts"> |
65 | -import {defineComponent, ref} from 'vue'; | ||
66 | -import {BasicDrawer, useDrawer, useDrawerInner} from '/@/components/Drawer'; | ||
67 | -import {BasicColumn, BasicTable, TableAction, useTable} from '/@/components/Table'; | ||
68 | -import { | ||
69 | - deleteTenantAdmin, | ||
70 | - getTenantAdminPage, | ||
71 | - resetPassword, | ||
72 | - sendMessageOrEmail | ||
73 | -} from "/@/api/tenant/tenantApi"; | ||
74 | -import {Tag} from 'ant-design-vue'; | ||
75 | -import TenantAdminFormDrawer from "./TenantAdminFormDrawer.vue" | ||
76 | -import {MessageTypeEnum, SendResetPasswordEmailMsg} from "/@/api/tenant/tenantInfo"; | ||
77 | -import {useMessage} from "/@/hooks/web/useMessage"; | ||
78 | -import {RoleEnum} from "/@/enums/roleEnum"; | ||
79 | -export default defineComponent({ | ||
80 | - name: 'TenantAdminDrawer', | ||
81 | - components: { | ||
82 | - BasicDrawer, BasicTable, TenantAdminFormDrawer, Tag, TableAction | ||
83 | - }, | ||
84 | - setup() { | ||
85 | - const{createMessage} =useMessage(); | ||
86 | - const [tenantAdminFormDrawer, {openDrawer: openTenantAdminFormDrawer}] = useDrawer(); | ||
87 | - | ||
88 | - function handleCreateTenantAdmin() { | ||
89 | - openTenantAdminFormDrawer(true, { | ||
90 | - isUpdate: false, | ||
91 | - tenantCode: tenantCode | ||
92 | - }); | ||
93 | - } | 74 | + import { defineComponent, ref } from 'vue'; |
75 | + import { BasicDrawer, useDrawer, useDrawerInner } from '/@/components/Drawer'; | ||
76 | + import { BasicColumn, BasicTable, TableAction, useTable } from '/@/components/Table'; | ||
77 | + import { | ||
78 | + deleteTenantAdmin, | ||
79 | + getTenantAdminPage, | ||
80 | + resetPassword, | ||
81 | + sendMessageOrEmail, | ||
82 | + } from '/@/api/tenant/tenantApi'; | ||
83 | + import { Tag } from 'ant-design-vue'; | ||
84 | + import TenantAdminFormDrawer from './TenantAdminFormDrawer.vue'; | ||
85 | + import { MessageTypeEnum, SendResetPasswordEmailMsg } from '/@/api/tenant/tenantInfo'; | ||
86 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
87 | + import { RoleEnum } from '/@/enums/roleEnum'; | ||
88 | + export default defineComponent({ | ||
89 | + name: 'TenantAdminDrawer', | ||
90 | + components: { | ||
91 | + BasicDrawer, | ||
92 | + BasicTable, | ||
93 | + TenantAdminFormDrawer, | ||
94 | + Tag, | ||
95 | + TableAction, | ||
96 | + }, | ||
97 | + setup() { | ||
98 | + const { createMessage } = useMessage(); | ||
99 | + const [tenantAdminFormDrawer, { openDrawer: openTenantAdminFormDrawer }] = useDrawer(); | ||
94 | 100 | ||
95 | - function handleEdit(record: Recordable) { | ||
96 | - openTenantAdminFormDrawer(true, { | ||
97 | - isUpdate: true, | ||
98 | - record, | ||
99 | - tenantCode: tenantCode | ||
100 | - }); | ||
101 | - } | 101 | + function handleCreateTenantAdmin() { |
102 | + openTenantAdminFormDrawer(true, { | ||
103 | + isUpdate: false, | ||
104 | + tenantCode: tenantCode, | ||
105 | + }); | ||
106 | + } | ||
102 | 107 | ||
103 | - function handleDelete(record: Recordable) { | ||
104 | - deleteTenantAdmin([record.id]); | ||
105 | - createMessage.success("删除成功"); | ||
106 | - handleSuccess(); | ||
107 | - } | 108 | + function handleEdit(record: Recordable) { |
109 | + openTenantAdminFormDrawer(true, { | ||
110 | + isUpdate: true, | ||
111 | + record, | ||
112 | + tenantCode: tenantCode, | ||
113 | + }); | ||
114 | + } | ||
108 | 115 | ||
109 | - function handleResetPassword(record: Recordable) { | ||
110 | - resetPassword(record.id); | ||
111 | - createMessage.success("清空密码成功"); | ||
112 | - handleSuccess(); | ||
113 | - } | ||
114 | - function handleSendMsg(record: Recordable) { | ||
115 | - const req = new SendResetPasswordEmailMsg(record.id, MessageTypeEnum.PHONE_MESSAGE) | ||
116 | - sendMessageOrEmail(req).then(()=>{ | ||
117 | - createMessage.success("短信发送成功"); | 116 | + function handleDelete(record: Recordable) { |
117 | + deleteTenantAdmin([record.id]); | ||
118 | + createMessage.success('删除成功'); | ||
118 | handleSuccess(); | 119 | handleSuccess(); |
119 | - }); | ||
120 | - } | ||
121 | - | 120 | + } |
122 | 121 | ||
123 | - const tenantAdminColumns = [ | ||
124 | - { | ||
125 | - title: '用户名', | ||
126 | - dataIndex: 'username', | ||
127 | - width: 50, | ||
128 | - }, | ||
129 | - { | ||
130 | - title: '真实名字', | ||
131 | - dataIndex: 'realName', | ||
132 | - width: 50, | ||
133 | - }, | ||
134 | - { | ||
135 | - title: '电话号码', | ||
136 | - dataIndex: 'phoneNumber', | ||
137 | - width: 50, | ||
138 | - }, | ||
139 | - { | ||
140 | - title: '邮箱', | ||
141 | - dataIndex: 'email', | ||
142 | - width: 70, | ||
143 | - }, | ||
144 | - { | ||
145 | - title: '状态', | ||
146 | - dataIndex: 'userStatus', | ||
147 | - width: 30, | ||
148 | - slots: {customRender: 'status'}, | ||
149 | - }, | ||
150 | - ]; | ||
151 | - const tenantCode = ref(""); | ||
152 | - const [tenantAdminTable, {reload}] = useTable({ | ||
153 | - api: getTenantAdminPage, | ||
154 | - columns: tenantAdminColumns as BasicColumn[], | ||
155 | - showTableSetting: true, | ||
156 | - bordered: true, | ||
157 | - showIndexColumn: false, | ||
158 | - searchInfo: { | ||
159 | - tenantCode: tenantCode, | ||
160 | - roleType: RoleEnum.ROLE_TENANT_ADMIN | ||
161 | - }, | ||
162 | - actionColumn: { | ||
163 | - width: 100, | ||
164 | - title: '操作', | ||
165 | - dataIndex: 'action', | ||
166 | - slots: {customRender: 'action'}, | ||
167 | - fixed: undefined, | ||
168 | - }, | ||
169 | - tableSetting: { | ||
170 | - redo: true, | ||
171 | - size: false, | ||
172 | - setting: false | 122 | + function handleResetPassword(record: Recordable) { |
123 | + resetPassword(record.id); | ||
124 | + createMessage.success('清空密码成功'); | ||
125 | + handleSuccess(); | ||
126 | + } | ||
127 | + function handleSendMsg(record: Recordable) { | ||
128 | + const req = new SendResetPasswordEmailMsg(record.id, MessageTypeEnum.PHONE_MESSAGE); | ||
129 | + sendMessageOrEmail(req).then(() => { | ||
130 | + createMessage.success('短信发送成功'); | ||
131 | + handleSuccess(); | ||
132 | + }); | ||
173 | } | 133 | } |
174 | - }); | ||
175 | - //默认传递页面数据 | ||
176 | - const [tenantAdminDrawer, {closeDrawer}] = useDrawerInner(async (data) => { | ||
177 | - tenantCode.value = data.record.tenantCode; | ||
178 | - await reload(); | ||
179 | - }); | ||
180 | 134 | ||
181 | - //提交按钮 | ||
182 | - async function handleSubmit() { | ||
183 | - closeDrawer();//关闭侧框 | ||
184 | - } | 135 | + const tenantAdminColumns = [ |
136 | + { | ||
137 | + title: '用户名', | ||
138 | + dataIndex: 'username', | ||
139 | + width: 50, | ||
140 | + }, | ||
141 | + { | ||
142 | + title: '真实名字', | ||
143 | + dataIndex: 'realName', | ||
144 | + width: 50, | ||
145 | + }, | ||
146 | + { | ||
147 | + title: '电话号码', | ||
148 | + dataIndex: 'phoneNumber', | ||
149 | + width: 50, | ||
150 | + }, | ||
151 | + { | ||
152 | + title: '邮箱', | ||
153 | + dataIndex: 'email', | ||
154 | + width: 70, | ||
155 | + }, | ||
156 | + { | ||
157 | + title: '状态', | ||
158 | + dataIndex: 'userStatus', | ||
159 | + width: 30, | ||
160 | + slots: { customRender: 'status' }, | ||
161 | + }, | ||
162 | + ]; | ||
163 | + const tenantCode = ref(''); | ||
164 | + const [tenantAdminTable, { reload }] = useTable({ | ||
165 | + api: getTenantAdminPage, | ||
166 | + columns: tenantAdminColumns as BasicColumn[], | ||
167 | + showTableSetting: true, | ||
168 | + bordered: true, | ||
169 | + showIndexColumn: false, | ||
170 | + searchInfo: { | ||
171 | + tenantCode: tenantCode, | ||
172 | + roleType: RoleEnum.ROLE_TENANT_ADMIN, | ||
173 | + }, | ||
174 | + actionColumn: { | ||
175 | + width: 100, | ||
176 | + title: '操作', | ||
177 | + dataIndex: 'action', | ||
178 | + slots: { customRender: 'action' }, | ||
179 | + fixed: undefined, | ||
180 | + }, | ||
181 | + tableSetting: { | ||
182 | + redo: true, | ||
183 | + size: false, | ||
184 | + setting: false, | ||
185 | + }, | ||
186 | + }); | ||
187 | + //默认传递页面数据 | ||
188 | + const [tenantAdminDrawer, { closeDrawer }] = useDrawerInner(async (data) => { | ||
189 | + tenantCode.value = data.record.tenantCode; | ||
190 | + await reload(); | ||
191 | + }); | ||
185 | 192 | ||
186 | - function handleSuccess() { | ||
187 | - reload(); | ||
188 | - } | 193 | + //提交按钮 |
194 | + async function handleSubmit() { | ||
195 | + closeDrawer(); //关闭侧框 | ||
196 | + } | ||
189 | 197 | ||
190 | - return { | ||
191 | - tenantAdminDrawer, | ||
192 | - handleCreateTenantAdmin, | ||
193 | - handleSubmit, | ||
194 | - tenantAdminTable, | ||
195 | - tenantCode, | ||
196 | - tenantAdminFormDrawer, | ||
197 | - handleSuccess, | ||
198 | - handleEdit, | ||
199 | - handleDelete, | ||
200 | - handleResetPassword, | ||
201 | - handleSendMsg | 198 | + function handleSuccess() { |
199 | + reload(); | ||
200 | + } | ||
202 | 201 | ||
203 | - }; | ||
204 | - }, | ||
205 | -}); | 202 | + return { |
203 | + tenantAdminDrawer, | ||
204 | + handleCreateTenantAdmin, | ||
205 | + handleSubmit, | ||
206 | + tenantAdminTable, | ||
207 | + tenantCode, | ||
208 | + tenantAdminFormDrawer, | ||
209 | + handleSuccess, | ||
210 | + handleEdit, | ||
211 | + handleDelete, | ||
212 | + handleResetPassword, | ||
213 | + handleSendMsg, | ||
214 | + }; | ||
215 | + }, | ||
216 | + }); | ||
206 | </script> | 217 | </script> |
@@ -7,120 +7,123 @@ | @@ -7,120 +7,123 @@ | ||
7 | width="60%" | 7 | width="60%" |
8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
9 | > | 9 | > |
10 | - <BasicForm @register="tenantAdminForm"> | ||
11 | - </BasicForm> | 10 | + <BasicForm @register="tenantAdminForm"> </BasicForm> |
12 | </BasicDrawer> | 11 | </BasicDrawer> |
13 | </template> | 12 | </template> |
14 | <script lang="ts"> | 13 | <script lang="ts"> |
15 | -import {computed, defineComponent, ref, unref} from 'vue'; | ||
16 | -import {BasicDrawer, useDrawerInner} from '/@/components/Drawer'; | ||
17 | -import {BasicForm, FormSchema, useForm} from '/@/components/Form/index'; | ||
18 | -import {saveTenantAdmin} from "/@/api/tenant/tenantApi"; | ||
19 | -import {UserDTO} from "/@/api/tenant/tenantInfo"; | 14 | + import { computed, defineComponent, ref, unref } from 'vue'; |
15 | + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | ||
16 | + import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; | ||
17 | + import { saveTenantAdmin } from '/@/api/tenant/tenantApi'; | ||
18 | + import { UserDTO } from '/@/api/tenant/tenantInfo'; | ||
20 | 19 | ||
21 | -export default defineComponent({ | ||
22 | - name: 'TenantAdminFormDrawer', | ||
23 | - components: { | ||
24 | - BasicDrawer, BasicForm | ||
25 | - }, | ||
26 | - setup(_, {emit}) { | ||
27 | - const isUpdate = ref(true); | ||
28 | - const tenantCode = ref(""); | ||
29 | - const formSchema: FormSchema[] = [ | ||
30 | - { | ||
31 | - field: 'id', | ||
32 | - label: 'id:', | ||
33 | - show: false, | ||
34 | - component: 'Input', | ||
35 | - }, | ||
36 | - { | ||
37 | - field: 'username', | ||
38 | - label: '账号:', | ||
39 | - required: true, | ||
40 | - component: 'Input', | ||
41 | - }, | ||
42 | - { | ||
43 | - field: 'realName', | ||
44 | - label: '真实名字:', | ||
45 | - required: true, | ||
46 | - component: 'Input', | ||
47 | - }, | ||
48 | - { | ||
49 | - field: 'phoneNumber', | ||
50 | - label: '电话号码:', | ||
51 | - required: true, | ||
52 | - component: 'Input', | ||
53 | - }, | ||
54 | - { | ||
55 | - field: 'email', | ||
56 | - label: '邮件:', | ||
57 | - required: true, | ||
58 | - component: 'Input', | ||
59 | - }, | ||
60 | - { | ||
61 | - field: 'enabled', | ||
62 | - label: '状态', | ||
63 | - required: true, | ||
64 | - component: 'RadioButtonGroup', | ||
65 | - defaultValue: true, | ||
66 | - componentProps: { | ||
67 | - options: [ | ||
68 | - {label: '启用', value: true}, | ||
69 | - {label: '停用', value: false}, | ||
70 | - ], | 20 | + export default defineComponent({ |
21 | + name: 'TenantAdminFormDrawer', | ||
22 | + components: { | ||
23 | + BasicDrawer, | ||
24 | + BasicForm, | ||
25 | + }, | ||
26 | + setup(_, { emit }) { | ||
27 | + const isUpdate = ref(true); | ||
28 | + const tenantCode = ref(''); | ||
29 | + const formSchema: FormSchema[] = [ | ||
30 | + { | ||
31 | + field: 'id', | ||
32 | + label: 'id:', | ||
33 | + show: false, | ||
34 | + component: 'Input', | ||
71 | }, | 35 | }, |
72 | - }, | ||
73 | - ] | ||
74 | - const [tenantAdminForm, {resetFields, setFieldsValue, updateSchema, validate}] = useForm({ | ||
75 | - labelWidth: 100, | ||
76 | - schemas: formSchema, | ||
77 | - showActionButtonGroup: false, | ||
78 | - baseColProps: {lg: 24, md: 24}, | ||
79 | - }); | ||
80 | - const [tenantAdminFormDrawer, {setDrawerProps, closeDrawer}] = useDrawerInner(async (data) => { | ||
81 | - await resetFields(); | ||
82 | - isUpdate.value = !!data?.isUpdate; | ||
83 | - tenantCode.value = data?.tenantCode; | ||
84 | - await updateSchema({field: 'title', componentProps: {disabled: false}}); | ||
85 | - if (unref(isUpdate)) { | ||
86 | - await setFieldsValue({ | ||
87 | - ...data.record, | ||
88 | - }); | ||
89 | - } | ||
90 | - }); | ||
91 | - const getTitle = computed(() => (!unref(isUpdate) ? '新增租户管理员' : '编辑租户管理员')); | ||
92 | - | ||
93 | - async function handleSubmit() { | ||
94 | - try { | ||
95 | - const values = await validate(); | ||
96 | - const requestParams = { | ||
97 | - id: values.id, | ||
98 | - username: values.username, | ||
99 | - realName: values.realName, | ||
100 | - phoneNumber: values.phoneNumber, | ||
101 | - email: values.email, | ||
102 | - enabled: values.enabled, | ||
103 | - tenantExpireTime: (typeof values.tenantExpireTime != 'undefined' && values.tenantExpireTime != null) ? values.tenantExpireTime.format('YYYY-MM-DD HH:mm:ss') : null, | ||
104 | - tenantCode: tenantCode.value | 36 | + { |
37 | + field: 'username', | ||
38 | + label: '账号:', | ||
39 | + required: true, | ||
40 | + component: 'Input', | ||
41 | + }, | ||
42 | + { | ||
43 | + field: 'realName', | ||
44 | + label: '真实名字:', | ||
45 | + required: true, | ||
46 | + component: 'Input', | ||
47 | + }, | ||
48 | + { | ||
49 | + field: 'phoneNumber', | ||
50 | + label: '电话号码:', | ||
51 | + required: true, | ||
52 | + component: 'Input', | ||
53 | + }, | ||
54 | + { | ||
55 | + field: 'email', | ||
56 | + label: '邮件:', | ||
57 | + required: true, | ||
58 | + component: 'Input', | ||
59 | + }, | ||
60 | + { | ||
61 | + field: 'enabled', | ||
62 | + label: '状态', | ||
63 | + required: true, | ||
64 | + component: 'RadioButtonGroup', | ||
65 | + defaultValue: true, | ||
66 | + componentProps: { | ||
67 | + options: [ | ||
68 | + { label: '启用', value: true }, | ||
69 | + { label: '停用', value: false }, | ||
70 | + ], | ||
71 | + }, | ||
72 | + }, | ||
73 | + ]; | ||
74 | + const [tenantAdminForm, { resetFields, setFieldsValue, updateSchema, validate }] = useForm({ | ||
75 | + labelWidth: 100, | ||
76 | + schemas: formSchema, | ||
77 | + showActionButtonGroup: false, | ||
78 | + baseColProps: { lg: 24, md: 24 }, | ||
79 | + }); | ||
80 | + const [tenantAdminFormDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner( | ||
81 | + async (data) => { | ||
82 | + await resetFields(); | ||
83 | + isUpdate.value = !!data?.isUpdate; | ||
84 | + tenantCode.value = data?.tenantCode; | ||
85 | + await updateSchema({ field: 'title', componentProps: { disabled: false } }); | ||
86 | + if (unref(isUpdate)) { | ||
87 | + await setFieldsValue({ | ||
88 | + ...data.record, | ||
89 | + }); | ||
90 | + } | ||
105 | } | 91 | } |
106 | - setDrawerProps({confirmLoading: true}); | ||
107 | - saveTenantAdmin(requestParams as any as UserDTO).then(() => { | ||
108 | - closeDrawer();//关闭侧框 | ||
109 | - emit('success'); | ||
110 | - }) | 92 | + ); |
93 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增租户管理员' : '编辑租户管理员')); | ||
111 | 94 | ||
112 | - } finally { | ||
113 | - setDrawerProps({confirmLoading: false}); | 95 | + async function handleSubmit() { |
96 | + try { | ||
97 | + const values = await validate(); | ||
98 | + const requestParams = { | ||
99 | + id: values.id, | ||
100 | + username: values.username, | ||
101 | + realName: values.realName, | ||
102 | + phoneNumber: values.phoneNumber, | ||
103 | + email: values.email, | ||
104 | + enabled: values.enabled, | ||
105 | + tenantExpireTime: | ||
106 | + typeof values.tenantExpireTime != 'undefined' && values.tenantExpireTime != null | ||
107 | + ? values.tenantExpireTime.format('YYYY-MM-DD HH:mm:ss') | ||
108 | + : null, | ||
109 | + tenantCode: tenantCode.value, | ||
110 | + }; | ||
111 | + setDrawerProps({ confirmLoading: true }); | ||
112 | + saveTenantAdmin(requestParams as any as UserDTO).then(() => { | ||
113 | + closeDrawer(); //关闭侧框 | ||
114 | + emit('success'); | ||
115 | + }); | ||
116 | + } finally { | ||
117 | + setDrawerProps({ confirmLoading: false }); | ||
118 | + } | ||
114 | } | 119 | } |
115 | 120 | ||
116 | - } | ||
117 | - | ||
118 | - return { | ||
119 | - tenantAdminFormDrawer, | ||
120 | - handleSubmit, | ||
121 | - tenantAdminForm, | ||
122 | - getTitle | ||
123 | - }; | ||
124 | - }, | ||
125 | -}); | 121 | + return { |
122 | + tenantAdminFormDrawer, | ||
123 | + handleSubmit, | ||
124 | + tenantAdminForm, | ||
125 | + getTitle, | ||
126 | + }; | ||
127 | + }, | ||
128 | + }); | ||
126 | </script> | 129 | </script> |
@@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
17 | :customRequest="customUpload" | 17 | :customRequest="customUpload" |
18 | :before-upload="beforeUpload" | 18 | :before-upload="beforeUpload" |
19 | > | 19 | > |
20 | - <img v-if="tenantLogo" :src="tenantLogo" alt="avatar"/> | 20 | + <img v-if="tenantLogo" :src="tenantLogo" alt="avatar" /> |
21 | <div v-else> | 21 | <div v-else> |
22 | <loading-outlined v-if="loading"></loading-outlined> | 22 | <loading-outlined v-if="loading"></loading-outlined> |
23 | <plus-outlined v-else></plus-outlined> | 23 | <plus-outlined v-else></plus-outlined> |
@@ -29,130 +29,138 @@ | @@ -29,130 +29,138 @@ | ||
29 | </BasicDrawer> | 29 | </BasicDrawer> |
30 | </template> | 30 | </template> |
31 | <script lang="ts"> | 31 | <script lang="ts"> |
32 | -import {defineComponent, ref, computed, unref} from 'vue'; | ||
33 | -import {BasicForm, useForm} from '/@/components/Form/index'; | ||
34 | -import {BasicDrawer, useDrawerInner} from '/@/components/Drawer'; | ||
35 | -import {CollapseContainer} from '/@/components/Container'; | ||
36 | -import {CropperImage, CropperAvatar} from '/@/components/Cropper'; | ||
37 | -import {PlusOutlined, LoadingOutlined} from '@ant-design/icons-vue'; | ||
38 | -import {message, Upload} from 'ant-design-vue'; | 32 | + import { defineComponent, ref, computed, unref } from 'vue'; |
33 | + import { BasicForm, useForm } from '/@/components/Form/index'; | ||
34 | + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | ||
35 | + import { CollapseContainer } from '/@/components/Container'; | ||
36 | + import { CropperImage, CropperAvatar } from '/@/components/Cropper'; | ||
37 | + import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; | ||
38 | + import { message, Upload } from 'ant-design-vue'; | ||
39 | 39 | ||
40 | -import {useI18n} from "/@/hooks/web/useI18n"; | ||
41 | -import {tenantFormSchema} from "/@/views/tenant/management/tenantBaseColumns"; | ||
42 | -import {FileItem} from "/@/components/Upload/src/typing"; | ||
43 | -import {upload} from "/@/api/oss/ossFileUploader"; | ||
44 | -import {getTenantRoles, updateOrCreateTenant} from "/@/api/tenant/tenantApi"; | 40 | + import { useI18n } from '/@/hooks/web/useI18n'; |
41 | + import { tenantFormSchema } from '/@/views/tenant/management/tenantBaseColumns'; | ||
42 | + import { FileItem } from '/@/components/Upload/src/typing'; | ||
43 | + import { upload } from '/@/api/oss/ossFileUploader'; | ||
44 | + import { getTenantRoles, updateOrCreateTenant } from '/@/api/tenant/tenantApi'; | ||
45 | 45 | ||
46 | + export default defineComponent({ | ||
47 | + name: 'TenantDrawer', | ||
48 | + components: { | ||
49 | + BasicDrawer, | ||
50 | + BasicForm, | ||
51 | + CropperImage, | ||
52 | + CollapseContainer, | ||
53 | + CropperAvatar, | ||
54 | + Upload, | ||
55 | + PlusOutlined, | ||
56 | + LoadingOutlined, | ||
57 | + }, | ||
58 | + emits: ['success', 'register'], | ||
59 | + setup(_, { emit }) { | ||
60 | + const isUpdate = ref(true); | ||
61 | + const tenantLogo = ref(''); | ||
46 | 62 | ||
47 | -export default defineComponent({ | ||
48 | - name: 'TenantDrawer', | ||
49 | - components: { | ||
50 | - BasicDrawer, BasicForm, CropperImage, | ||
51 | - CollapseContainer, | ||
52 | - CropperAvatar, | ||
53 | - Upload, | ||
54 | - PlusOutlined, LoadingOutlined | ||
55 | - }, | ||
56 | - emits: ['success', 'register'], | ||
57 | - setup(_, {emit}) { | ||
58 | - const isUpdate = ref(true); | ||
59 | - const tenantLogo = ref(""); | ||
60 | - | ||
61 | - async function customUpload({file}) { | ||
62 | - if (beforeUpload(file)) { | ||
63 | - const formData = new FormData() | ||
64 | - formData.append('file', file) | ||
65 | - const response = await upload(formData); | ||
66 | - if (response.fileStaticUri) { | ||
67 | - tenantLogo.value = response.fileStaticUri; | 63 | + async function customUpload({ file }) { |
64 | + if (beforeUpload(file)) { | ||
65 | + const formData = new FormData(); | ||
66 | + formData.append('file', file); | ||
67 | + const response = await upload(formData); | ||
68 | + if (response.fileStaticUri) { | ||
69 | + tenantLogo.value = response.fileStaticUri; | ||
70 | + } | ||
68 | } | 71 | } |
69 | } | 72 | } |
70 | - } | ||
71 | 73 | ||
72 | - const beforeUpload = (file: FileItem) => { | ||
73 | - const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; | ||
74 | - if (!isJpgOrPng) { | ||
75 | - message.error('只能上传图片文件!'); | ||
76 | - } | ||
77 | - const isLt2M = file.size as number / 1024 / 1024 < 2; | ||
78 | - if (!isLt2M) { | ||
79 | - message.error('图片大小不能超过2MB!'); | ||
80 | - } | ||
81 | - return isJpgOrPng && isLt2M; | ||
82 | - }; | ||
83 | - const [tenantForm, {resetFields, setFieldsValue, updateSchema, validate}] = useForm({ | ||
84 | - labelWidth: 100, | ||
85 | - schemas: tenantFormSchema, | ||
86 | - showActionButtonGroup: false, | ||
87 | - baseColProps: {lg: 24, md: 24}, | ||
88 | - }); | ||
89 | - const {t} = useI18n(); //加载国际化 | 74 | + const beforeUpload = (file: FileItem) => { |
75 | + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; | ||
76 | + if (!isJpgOrPng) { | ||
77 | + message.error('只能上传图片文件!'); | ||
78 | + } | ||
79 | + const isLt2M = (file.size as number) / 1024 / 1024 < 2; | ||
80 | + if (!isLt2M) { | ||
81 | + message.error('图片大小不能超过2MB!'); | ||
82 | + } | ||
83 | + return isJpgOrPng && isLt2M; | ||
84 | + }; | ||
85 | + const [tenantForm, { resetFields, setFieldsValue, updateSchema, validate }] = useForm({ | ||
86 | + labelWidth: 100, | ||
87 | + schemas: tenantFormSchema, | ||
88 | + showActionButtonGroup: false, | ||
89 | + baseColProps: { lg: 24, md: 24 }, | ||
90 | + }); | ||
91 | + const { t } = useI18n(); //加载国际化 | ||
90 | 92 | ||
91 | - //默认传递页面数据 | ||
92 | - const [registerDrawer, {setDrawerProps, closeDrawer}] = useDrawerInner(async (data) => { | ||
93 | - await resetFields(); | ||
94 | - tenantLogo.value = ""; | ||
95 | - setDrawerProps({confirmLoading: false}); | ||
96 | - isUpdate.value = !!data?.isUpdate; | 93 | + //默认传递页面数据 |
94 | + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | ||
95 | + await resetFields(); | ||
96 | + tenantLogo.value = ''; | ||
97 | + setDrawerProps({ confirmLoading: false }); | ||
98 | + isUpdate.value = !!data?.isUpdate; | ||
97 | 99 | ||
98 | - //初始化,菜单名称为可用 | ||
99 | - await updateSchema({field: 'title', componentProps: {disabled: false}}); | ||
100 | - //如果是编辑操作,设置页面数据 | ||
101 | - if (unref(isUpdate)) { | ||
102 | - getTenantRoles(data.record.tenantCode).then((result)=>{ | ||
103 | - Reflect.set(data.record,"roleIds",result); | ||
104 | - //为表单赋值 | ||
105 | - setFieldsValue({ | ||
106 | - ...data.record, | 100 | + //初始化,菜单名称为可用 |
101 | + await updateSchema({ field: 'title', componentProps: { disabled: false } }); | ||
102 | + //如果是编辑操作,设置页面数据 | ||
103 | + if (unref(isUpdate)) { | ||
104 | + getTenantRoles(data.record.tenantCode).then((result) => { | ||
105 | + Reflect.set(data.record, 'roleIds', result); | ||
106 | + //为表单赋值 | ||
107 | + setFieldsValue({ | ||
108 | + ...data.record, | ||
109 | + }); | ||
110 | + tenantLogo.value = data.record.icon; | ||
111 | + //编辑模式,菜单名称为不可用 | ||
112 | + updateSchema({ field: 'title', componentProps: { disabled: true } }); | ||
107 | }); | 113 | }); |
108 | - tenantLogo.value = data.record.icon; | ||
109 | - //编辑模式,菜单名称为不可用 | ||
110 | - updateSchema({field: 'title', componentProps: {disabled: true,}}); | ||
111 | - }); | ||
112 | - } | ||
113 | - }); | ||
114 | - //得到页面标题 | ||
115 | - const getTitle = computed(() => (!unref(isUpdate) ? t('routes.common.system.pageSystemTitleCreateTenant') : t('routes.common.system.pageSystemTitleEditTenant'))); | ||
116 | - | ||
117 | - //提交按钮 | ||
118 | - async function handleSubmit() { | ||
119 | - try { | ||
120 | - const values = await validate(); | ||
121 | - setDrawerProps({confirmLoading: true}); | ||
122 | - const req = { | ||
123 | - id: values.id, | ||
124 | - icon: tenantLogo.value, | ||
125 | - name: values.name, | ||
126 | - enabled: values.enabled, | ||
127 | - description: values.description, | ||
128 | - roleIds:values.roleIds, | ||
129 | - tenantExpireTime: (typeof values.tenantExpireTime != 'undefined' && values.tenantExpireTime != null) ? values.tenantExpireTime.format('YYYY-MM-DD HH:mm:ss') : null | ||
130 | - }; | ||
131 | - updateOrCreateTenant(req).then(() => { | ||
132 | - closeDrawer();//关闭侧框 | ||
133 | - emit('success'); | ||
134 | - }); | 114 | + } |
115 | + }); | ||
116 | + //得到页面标题 | ||
117 | + const getTitle = computed(() => | ||
118 | + !unref(isUpdate) | ||
119 | + ? t('routes.common.system.pageSystemTitleCreateTenant') | ||
120 | + : t('routes.common.system.pageSystemTitleEditTenant') | ||
121 | + ); | ||
135 | 122 | ||
136 | - } finally { | ||
137 | - setDrawerProps({confirmLoading: false}); | 123 | + //提交按钮 |
124 | + async function handleSubmit() { | ||
125 | + try { | ||
126 | + const values = await validate(); | ||
127 | + setDrawerProps({ confirmLoading: true }); | ||
128 | + const req = { | ||
129 | + id: values.id, | ||
130 | + icon: tenantLogo.value, | ||
131 | + name: values.name, | ||
132 | + enabled: values.enabled, | ||
133 | + description: values.description, | ||
134 | + roleIds: values.roleIds, | ||
135 | + tenantExpireTime: | ||
136 | + typeof values.tenantExpireTime != 'undefined' && values.tenantExpireTime != null | ||
137 | + ? values.tenantExpireTime.format('YYYY-MM-DD HH:mm:ss') | ||
138 | + : null, | ||
139 | + }; | ||
140 | + updateOrCreateTenant(req).then(() => { | ||
141 | + closeDrawer(); //关闭侧框 | ||
142 | + emit('success'); | ||
143 | + }); | ||
144 | + } finally { | ||
145 | + setDrawerProps({ confirmLoading: false }); | ||
146 | + } | ||
138 | } | 147 | } |
139 | - } | ||
140 | 148 | ||
141 | - return { | ||
142 | - registerDrawer, | ||
143 | - tenantForm, | ||
144 | - getTitle, | ||
145 | - handleSubmit, | ||
146 | - tenantLogo, | ||
147 | - beforeUpload, | ||
148 | - customUpload, | ||
149 | - }; | ||
150 | - }, | ||
151 | -}); | 149 | + return { |
150 | + registerDrawer, | ||
151 | + tenantForm, | ||
152 | + getTitle, | ||
153 | + handleSubmit, | ||
154 | + tenantLogo, | ||
155 | + beforeUpload, | ||
156 | + customUpload, | ||
157 | + }; | ||
158 | + }, | ||
159 | + }); | ||
152 | </script> | 160 | </script> |
153 | <style> | 161 | <style> |
154 | -.ant-upload-select-picture-card i { | ||
155 | - font-size: 32px; | ||
156 | - color: #999; | ||
157 | -} | 162 | + .ant-upload-select-picture-card i { |
163 | + font-size: 32px; | ||
164 | + color: #999; | ||
165 | + } | ||
158 | </style> | 166 | </style> |
1 | <template> | 1 | <template> |
2 | <div class="p-4"> | 2 | <div class="p-4"> |
3 | - <BasicTable | ||
4 | - @register="tenantTable" | ||
5 | - > | 3 | + <BasicTable @register="tenantTable"> |
6 | <template #toolbar> | 4 | <template #toolbar> |
7 | <a-button type="primary" @click="handleCreate"> 新增租户</a-button> | 5 | <a-button type="primary" @click="handleCreate"> 新增租户</a-button> |
8 | </template> | 6 | </template> |
9 | <template #img="{ record }"> | 7 | <template #img="{ record }"> |
10 | - <TableImg :size="30" :showBadge="false" :simpleShow="true" | ||
11 | - :imgList="(typeof record.icon!=='undefined'&& record.icon!=='' && record.icon!=null)?[record.icon]:null"/> | 8 | + <TableImg |
9 | + :size="30" | ||
10 | + :showBadge="false" | ||
11 | + :simpleShow="true" | ||
12 | + :imgList=" | ||
13 | + typeof record.icon !== 'undefined' && record.icon !== '' && record.icon != null | ||
14 | + ? [record.icon] | ||
15 | + : null | ||
16 | + " | ||
17 | + /> | ||
12 | </template> | 18 | </template> |
13 | <template #status="{ record }"> | 19 | <template #status="{ record }"> |
14 | <Tag | 20 | <Tag |
15 | - :color="record.tenantStatus==='NORMAL'?'green':(record.tenantStatus==='DISABLED'?'red':'orange')"> | 21 | + :color=" |
22 | + record.tenantStatus === 'NORMAL' | ||
23 | + ? 'green' | ||
24 | + : record.tenantStatus === 'DISABLED' | ||
25 | + ? 'red' | ||
26 | + : 'orange' | ||
27 | + " | ||
28 | + > | ||
16 | {{ | 29 | {{ |
17 | - record.tenantStatus === 'NORMAL' ? '正常' : (record.tenantStatus === 'DISABLED' ? '已禁用' : '已过期') | 30 | + record.tenantStatus === 'NORMAL' |
31 | + ? '正常' | ||
32 | + : record.tenantStatus === 'DISABLED' | ||
33 | + ? '已禁用' | ||
34 | + : '已过期' | ||
18 | }} | 35 | }} |
19 | </Tag> | 36 | </Tag> |
20 | </template> | 37 | </template> |
21 | <template #action="{ record }"> | 38 | <template #action="{ record }"> |
22 | <TableAction | 39 | <TableAction |
23 | - :actions=" | ||
24 | -[ | ||
25 | - { | 40 | + :actions="[ |
41 | + { | ||
26 | icon: 'ant-design:usergroup-add-outlined', | 42 | icon: 'ant-design:usergroup-add-outlined', |
27 | - label:'租户管理员', | 43 | + label: '租户管理员', |
28 | onClick: handleTenantAdminDrawer.bind(null, record), | 44 | onClick: handleTenantAdminDrawer.bind(null, record), |
29 | }, | 45 | }, |
30 | { | 46 | { |
31 | icon: 'clarity:note-edit-line', | 47 | icon: 'clarity:note-edit-line', |
32 | - label:'编辑', | 48 | + label: '编辑', |
33 | onClick: handleEdit.bind(null, record), | 49 | onClick: handleEdit.bind(null, record), |
34 | }, | 50 | }, |
35 | { | 51 | { |
36 | icon: 'ant-design:delete-outlined', | 52 | icon: 'ant-design:delete-outlined', |
37 | - label:'删除', | 53 | + label: '删除', |
38 | color: 'error', | 54 | color: 'error', |
39 | popConfirm: { | 55 | popConfirm: { |
40 | title: '是否确认删除', | 56 | title: '是否确认删除', |
@@ -45,99 +61,98 @@ | @@ -45,99 +61,98 @@ | ||
45 | /> | 61 | /> |
46 | </template> | 62 | </template> |
47 | </BasicTable> | 63 | </BasicTable> |
48 | - <TenantDrawer @register="tenantDrawer" @success="handleSuccess"/> | ||
49 | - <TenantAdminDrawer @register="tenantAdminDrawer"/> | 64 | + <TenantDrawer @register="tenantDrawer" @success="handleSuccess" /> |
65 | + <TenantAdminDrawer @register="tenantAdminDrawer" /> | ||
50 | </div> | 66 | </div> |
51 | </template> | 67 | </template> |
52 | <script lang="ts"> | 68 | <script lang="ts"> |
53 | -import {defineComponent} from 'vue'; | ||
54 | -import {BasicTable, TableImg, TableAction, useTable, FormSchema} from '/@/components/Table'; | ||
55 | -import {Avatar, Tag} from 'ant-design-vue'; | ||
56 | -import {getBasicColumns} from './tenantBaseColumns'; | ||
57 | -import {deleteTenant, getTenantPage} from '/@/api/tenant/tenantApi'; | ||
58 | -import {useDrawer} from "/@/components/Drawer"; | ||
59 | -import TenantDrawer from "./TenantDrawer.vue" | ||
60 | -import TenantAdminDrawer from "./TenantAdminDrawer.vue" | ||
61 | -export default defineComponent({ | ||
62 | - components: {BasicTable, Avatar, TableImg, Tag, TableAction, TenantDrawer, TenantAdminDrawer}, | ||
63 | - setup() { | ||
64 | - const [tenantDrawer, {openDrawer: openDrawer}] = useDrawer(); | ||
65 | - const [tenantAdminDrawer, {openDrawer: openTenantAdminDrawer}] = useDrawer(); | ||
66 | - | ||
67 | - function handleDelete(record: Recordable) { | ||
68 | - deleteTenant([record.id]).then(() => { | ||
69 | - reload(); | ||
70 | - }); | ||
71 | - } | 69 | + import { defineComponent } from 'vue'; |
70 | + import { BasicTable, TableImg, TableAction, useTable, FormSchema } from '/@/components/Table'; | ||
71 | + import { Avatar, Tag } from 'ant-design-vue'; | ||
72 | + import { getBasicColumns } from './tenantBaseColumns'; | ||
73 | + import { deleteTenant, getTenantPage } from '/@/api/tenant/tenantApi'; | ||
74 | + import { useDrawer } from '/@/components/Drawer'; | ||
75 | + import TenantDrawer from './TenantDrawer.vue'; | ||
76 | + import TenantAdminDrawer from './TenantAdminDrawer.vue'; | ||
77 | + export default defineComponent({ | ||
78 | + components: { BasicTable, Avatar, TableImg, Tag, TableAction, TenantDrawer, TenantAdminDrawer }, | ||
79 | + setup() { | ||
80 | + const [tenantDrawer, { openDrawer: openDrawer }] = useDrawer(); | ||
81 | + const [tenantAdminDrawer, { openDrawer: openTenantAdminDrawer }] = useDrawer(); | ||
72 | 82 | ||
73 | - function handleCreate() { | ||
74 | - openDrawer(true, { | ||
75 | - isUpdate: false, | ||
76 | - }); | ||
77 | - } | 83 | + function handleDelete(record: Recordable) { |
84 | + deleteTenant([record.id]).then(() => { | ||
85 | + reload(); | ||
86 | + }); | ||
87 | + } | ||
78 | 88 | ||
79 | - function handleEdit(record: Recordable) { | ||
80 | - openDrawer(true, { | ||
81 | - record, | ||
82 | - isUpdate: true, | ||
83 | - }); | ||
84 | - } | 89 | + function handleCreate() { |
90 | + openDrawer(true, { | ||
91 | + isUpdate: false, | ||
92 | + }); | ||
93 | + } | ||
85 | 94 | ||
86 | - function handleTenantAdminDrawer(record: Recordable) { | ||
87 | - openTenantAdminDrawer(true, { | ||
88 | - record | ||
89 | - }); | 95 | + function handleEdit(record: Recordable) { |
96 | + openDrawer(true, { | ||
97 | + record, | ||
98 | + isUpdate: true, | ||
99 | + }); | ||
100 | + } | ||
90 | 101 | ||
91 | - } | 102 | + function handleTenantAdminDrawer(record: Recordable) { |
103 | + openTenantAdminDrawer(true, { | ||
104 | + record, | ||
105 | + }); | ||
106 | + } | ||
92 | 107 | ||
93 | - const searchFiled: FormSchema[] = [ | ||
94 | - { | ||
95 | - field: 'tenantName', | ||
96 | - label: '租户名称', | ||
97 | - component: 'Input', | ||
98 | - colProps: {span: 8}, | ||
99 | - }, | ||
100 | - ]; | 108 | + const searchFiled: FormSchema[] = [ |
109 | + { | ||
110 | + field: 'tenantName', | ||
111 | + label: '租户名称', | ||
112 | + component: 'Input', | ||
113 | + colProps: { span: 8 }, | ||
114 | + }, | ||
115 | + ]; | ||
101 | 116 | ||
102 | - function handleSuccess() { | ||
103 | - reload(); | ||
104 | - } | 117 | + function handleSuccess() { |
118 | + reload(); | ||
119 | + } | ||
105 | 120 | ||
106 | - const [tenantTable, {reload}] = useTable({ | ||
107 | - title: '租户', | ||
108 | - api: getTenantPage, | ||
109 | - columns: getBasicColumns(), | ||
110 | - useSearchForm: true, | ||
111 | - showTableSetting: true, | ||
112 | - bordered: true, | ||
113 | - showIndexColumn: false, | ||
114 | - tableSetting: { | ||
115 | - redo: true, | ||
116 | - size: false, | ||
117 | - setting: false | ||
118 | - }, | ||
119 | - formConfig: { | ||
120 | - labelWidth: 120, | ||
121 | - schemas: searchFiled, | ||
122 | - }, | ||
123 | - actionColumn: { | ||
124 | - width: 150, | ||
125 | - title: '操作', | ||
126 | - dataIndex: 'action', | ||
127 | - slots: {customRender: 'action'}, | ||
128 | - fixed: undefined, | ||
129 | - }, | ||
130 | - }); | ||
131 | - return { | ||
132 | - tenantTable, | ||
133 | - handleEdit, | ||
134 | - handleDelete, | ||
135 | - handleCreate, | ||
136 | - tenantDrawer, | ||
137 | - tenantAdminDrawer, | ||
138 | - handleSuccess, | ||
139 | - handleTenantAdminDrawer, | ||
140 | - }; | ||
141 | - }, | ||
142 | -}); | 121 | + const [tenantTable, { reload }] = useTable({ |
122 | + title: '租户', | ||
123 | + api: getTenantPage, | ||
124 | + columns: getBasicColumns(), | ||
125 | + useSearchForm: true, | ||
126 | + showTableSetting: true, | ||
127 | + bordered: true, | ||
128 | + showIndexColumn: false, | ||
129 | + tableSetting: { | ||
130 | + redo: true, | ||
131 | + size: false, | ||
132 | + setting: false, | ||
133 | + }, | ||
134 | + formConfig: { | ||
135 | + labelWidth: 120, | ||
136 | + schemas: searchFiled, | ||
137 | + }, | ||
138 | + actionColumn: { | ||
139 | + width: 150, | ||
140 | + title: '操作', | ||
141 | + dataIndex: 'action', | ||
142 | + slots: { customRender: 'action' }, | ||
143 | + fixed: undefined, | ||
144 | + }, | ||
145 | + }); | ||
146 | + return { | ||
147 | + tenantTable, | ||
148 | + handleEdit, | ||
149 | + handleDelete, | ||
150 | + handleCreate, | ||
151 | + tenantDrawer, | ||
152 | + tenantAdminDrawer, | ||
153 | + handleSuccess, | ||
154 | + handleTenantAdminDrawer, | ||
155 | + }; | ||
156 | + }, | ||
157 | + }); | ||
143 | </script> | 158 | </script> |
1 | -import { BasicColumn } from "/@/components/Table/src/types/table"; | ||
2 | -import {FormSchema} from "/@/components/Form"; | ||
3 | -import {getAllRoleList} from "/@/api/system/system"; | ||
4 | -import {RoleEnum} from "/@/enums/roleEnum"; | 1 | +import { BasicColumn } from '/@/components/Table/src/types/table'; |
2 | +import { FormSchema } from '/@/components/Form'; | ||
3 | +import { getAllRoleList } from '/@/api/system/system'; | ||
4 | +import { RoleEnum } from '/@/enums/roleEnum'; | ||
5 | 5 | ||
6 | export function getBasicColumns(): BasicColumn[] { | 6 | export function getBasicColumns(): BasicColumn[] { |
7 | - return [ | ||
8 | - { | ||
9 | - title: '图标', | ||
10 | - dataIndex: 'icon', | ||
11 | - fixed: 'left', | ||
12 | - width: 50, | ||
13 | - slots: { customRender: 'img' }, | ||
14 | - }, | ||
15 | - { | ||
16 | - title: '名称', | ||
17 | - dataIndex: 'name', | ||
18 | - width: 150, | ||
19 | - }, | ||
20 | - { | ||
21 | - title: '描述', | ||
22 | - dataIndex: 'description', | ||
23 | - width: 150, | ||
24 | - }, | ||
25 | - { | ||
26 | - title: '状态', | ||
27 | - dataIndex: 'userStatusEnum', | ||
28 | - width: 50, | ||
29 | - slots: { customRender: 'status' }, | ||
30 | - }, | ||
31 | - { | ||
32 | - title: '有效期', | ||
33 | - dataIndex: 'tenantExpireTime', | ||
34 | - width: 150, | ||
35 | - }, | ||
36 | - { | ||
37 | - title: '创建时间', | ||
38 | - dataIndex: 'createTime', | ||
39 | - width: 150, | ||
40 | - }, | ||
41 | - ] | ||
42 | - } | 7 | + return [ |
8 | + { | ||
9 | + title: '图标', | ||
10 | + dataIndex: 'icon', | ||
11 | + fixed: 'left', | ||
12 | + width: 50, | ||
13 | + slots: { customRender: 'img' }, | ||
14 | + }, | ||
15 | + { | ||
16 | + title: '名称', | ||
17 | + dataIndex: 'name', | ||
18 | + width: 150, | ||
19 | + }, | ||
20 | + { | ||
21 | + title: '描述', | ||
22 | + dataIndex: 'description', | ||
23 | + width: 150, | ||
24 | + }, | ||
25 | + { | ||
26 | + title: '状态', | ||
27 | + dataIndex: 'userStatusEnum', | ||
28 | + width: 50, | ||
29 | + slots: { customRender: 'status' }, | ||
30 | + }, | ||
31 | + { | ||
32 | + title: '有效期', | ||
33 | + dataIndex: 'tenantExpireTime', | ||
34 | + width: 150, | ||
35 | + }, | ||
36 | + { | ||
37 | + title: '创建时间', | ||
38 | + dataIndex: 'createTime', | ||
39 | + width: 150, | ||
40 | + }, | ||
41 | + ]; | ||
42 | +} | ||
43 | export const tenantFormSchema: FormSchema[] = [ | 43 | export const tenantFormSchema: FormSchema[] = [ |
44 | { | 44 | { |
45 | field: 'id', | 45 | field: 'id', |
46 | label: 'id', | 46 | label: 'id', |
47 | slot: 'iconSelect', | 47 | slot: 'iconSelect', |
48 | component: 'Input', | 48 | component: 'Input', |
49 | - show:false | 49 | + show: false, |
50 | }, | 50 | }, |
51 | { | 51 | { |
52 | field: 'icon', | 52 | field: 'icon', |
@@ -67,12 +67,12 @@ export const tenantFormSchema: FormSchema[] = [ | @@ -67,12 +67,12 @@ export const tenantFormSchema: FormSchema[] = [ | ||
67 | required: true, | 67 | required: true, |
68 | componentProps: { | 68 | componentProps: { |
69 | mode: 'multiple', | 69 | mode: 'multiple', |
70 | - api:getAllRoleList, | ||
71 | - params:{ | ||
72 | - roleType:RoleEnum.ROLE_TENANT_ADMIN | 70 | + api: getAllRoleList, |
71 | + params: { | ||
72 | + roleType: RoleEnum.ROLE_TENANT_ADMIN, | ||
73 | }, | 73 | }, |
74 | - labelField:'name', | ||
75 | - valueField:'id', | 74 | + labelField: 'name', |
75 | + valueField: 'id', | ||
76 | }, | 76 | }, |
77 | }, | 77 | }, |
78 | { | 78 | { |
@@ -82,8 +82,8 @@ export const tenantFormSchema: FormSchema[] = [ | @@ -82,8 +82,8 @@ export const tenantFormSchema: FormSchema[] = [ | ||
82 | defaultValue: true, | 82 | defaultValue: true, |
83 | componentProps: { | 83 | componentProps: { |
84 | options: [ | 84 | options: [ |
85 | - {label: '启用', value: true}, | ||
86 | - {label: '停用', value: false}, | 85 | + { label: '启用', value: true }, |
86 | + { label: '停用', value: false }, | ||
87 | ], | 87 | ], |
88 | }, | 88 | }, |
89 | }, | 89 | }, |
@@ -91,15 +91,14 @@ export const tenantFormSchema: FormSchema[] = [ | @@ -91,15 +91,14 @@ export const tenantFormSchema: FormSchema[] = [ | ||
91 | field: 'tenantExpireTime', | 91 | field: 'tenantExpireTime', |
92 | label: '有效期: ', | 92 | label: '有效期: ', |
93 | component: 'DatePicker', | 93 | component: 'DatePicker', |
94 | - componentProps:{ | ||
95 | - showTime:true, | ||
96 | - format:'YYYY-MM-DD HH:mm:ss' | ||
97 | - } | 94 | + componentProps: { |
95 | + showTime: true, | ||
96 | + format: 'YYYY-MM-DD HH:mm:ss', | ||
97 | + }, | ||
98 | }, | 98 | }, |
99 | { | 99 | { |
100 | label: '备注: ', | 100 | label: '备注: ', |
101 | field: 'description', | 101 | field: 'description', |
102 | component: 'InputTextArea', | 102 | component: 'InputTextArea', |
103 | }, | 103 | }, |
104 | - | ||
105 | ]; | 104 | ]; |
@@ -23,113 +23,113 @@ | @@ -23,113 +23,113 @@ | ||
23 | </BasicDrawer> | 23 | </BasicDrawer> |
24 | </template> | 24 | </template> |
25 | <script lang="ts"> | 25 | <script lang="ts"> |
26 | -import {defineComponent, ref, computed, unref} from 'vue'; | ||
27 | -import {BasicForm, useForm} from '/@/components/Form/index'; | ||
28 | -import {formSchema} from './role.data'; | ||
29 | -import {BasicDrawer, useDrawerInner} from '/@/components/Drawer'; | ||
30 | -import {BasicTree, TreeItem} from '/@/components/Tree'; | 26 | + import { defineComponent, ref, computed, unref } from 'vue'; |
27 | + import { BasicForm, useForm } from '/@/components/Form/index'; | ||
28 | + import { formSchema } from './role.data'; | ||
29 | + import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | ||
30 | + import { BasicTree, TreeItem } from '/@/components/Tree'; | ||
31 | 31 | ||
32 | -const {t} = useI18n(); //加载国际化 | 32 | + const { t } = useI18n(); //加载国际化 |
33 | 33 | ||
34 | -// import { getMenuList } from '/@/api/demo/system'; | 34 | + // import { getMenuList } from '/@/api/demo/system'; |
35 | 35 | ||
36 | -// 加载菜单数据 | ||
37 | -import {getMenuList, getMenusIdsByRoleId} from '/@/api/sys/menu'; | ||
38 | -import {useI18n} from "/@/hooks/web/useI18n"; | ||
39 | -import {RouteItem} from "/@/api/sys/model/menuModel"; | ||
40 | -import {saveOrUpdateRoleInfoWithMenu} from "/@/api/system/system"; | ||
41 | -import {RoleEnum} from "/@/enums/roleEnum"; | ||
42 | -export default defineComponent({ | ||
43 | - name: 'RoleDrawer', | ||
44 | - components: {BasicDrawer, BasicForm, BasicTree}, | ||
45 | - emits: ['success', 'register'], | ||
46 | - setup(_, {emit}) { | ||
47 | - const isUpdate = ref(true); | ||
48 | - const treeData = ref<TreeItem[]>([]); | ||
49 | - const roleMenus = ref<string[]>([]); | ||
50 | - const roleId = ref(""); | 36 | + // 加载菜单数据 |
37 | + import { getMenuList, getMenusIdsByRoleId } from '/@/api/sys/menu'; | ||
38 | + import { useI18n } from '/@/hooks/web/useI18n'; | ||
39 | + import { RouteItem } from '/@/api/sys/model/menuModel'; | ||
40 | + import { saveOrUpdateRoleInfoWithMenu } from '/@/api/system/system'; | ||
41 | + import { RoleEnum } from '/@/enums/roleEnum'; | ||
42 | + export default defineComponent({ | ||
43 | + name: 'RoleDrawer', | ||
44 | + components: { BasicDrawer, BasicForm, BasicTree }, | ||
45 | + emits: ['success', 'register'], | ||
46 | + setup(_, { emit }) { | ||
47 | + const isUpdate = ref(true); | ||
48 | + const treeData = ref<TreeItem[]>([]); | ||
49 | + const roleMenus = ref<string[]>([]); | ||
50 | + const roleId = ref(''); | ||
51 | 51 | ||
52 | - const [registerForm, {resetFields, setFieldsValue, validate}] = useForm({ | ||
53 | - labelWidth: 90, | ||
54 | - schemas: formSchema, | ||
55 | - showActionButtonGroup: false, | ||
56 | - }); | ||
57 | - | ||
58 | - function processChildren(items: RouteItem[]) { | ||
59 | - items.map((item) => { | ||
60 | - item.menuName = t(item.meta.title); | ||
61 | - item.icon = item.meta.icon; | ||
62 | - item.key=item.id; | ||
63 | - if (item.children) { | ||
64 | - processChildren(item.children); | ||
65 | - } | 52 | + const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ |
53 | + labelWidth: 90, | ||
54 | + schemas: formSchema, | ||
55 | + showActionButtonGroup: false, | ||
66 | }); | 56 | }); |
67 | - } | ||
68 | 57 | ||
69 | - const [registerDrawer, {setDrawerProps, closeDrawer}] = useDrawerInner(async (data) => { | ||
70 | - resetFields(); | ||
71 | - roleId.value = ""; | ||
72 | - setDrawerProps({confirmLoading: false}); | ||
73 | - // 需要在setFieldsValue之前先填充treeData,否则Tree组件可能会报key not exist警告 | ||
74 | - if (unref(treeData).length === 0) { | ||
75 | - const menuListModel = await getMenuList(); | ||
76 | - processChildren(menuListModel); | ||
77 | - let treeValues = new Array<TreeItem>(); | ||
78 | - menuListModel.map((item) => { | ||
79 | - const data = { | ||
80 | - menuName: t(item.meta.title), | ||
81 | - icon: item.meta.icon, | ||
82 | - key: item.id, | ||
83 | - children: item.children as any as TreeItem[], | 58 | + function processChildren(items: RouteItem[]) { |
59 | + items.map((item) => { | ||
60 | + item.menuName = t(item.meta.title); | ||
61 | + item.icon = item.meta.icon; | ||
62 | + item.key = item.id; | ||
63 | + if (item.children) { | ||
64 | + processChildren(item.children); | ||
84 | } | 65 | } |
85 | - treeValues.push(data); | ||
86 | - }) | ||
87 | - treeData.value = treeValues; | ||
88 | - } | ||
89 | - if (data.record) { | ||
90 | - roleMenus.value = await getMenusIdsByRoleId(data.record.id); | ||
91 | - roleId.value = data.record.id; | ||
92 | - } | ||
93 | - isUpdate.value = !!data?.isUpdate; | ||
94 | - if (unref(isUpdate)) { | ||
95 | - setFieldsValue({ | ||
96 | - ...data.record, | ||
97 | }); | 66 | }); |
98 | } | 67 | } |
99 | - }); | ||
100 | 68 | ||
101 | - const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); | 69 | + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
70 | + resetFields(); | ||
71 | + roleId.value = ''; | ||
72 | + setDrawerProps({ confirmLoading: false }); | ||
73 | + // 需要在setFieldsValue之前先填充treeData,否则Tree组件可能会报key not exist警告 | ||
74 | + if (unref(treeData).length === 0) { | ||
75 | + const menuListModel = await getMenuList(); | ||
76 | + processChildren(menuListModel); | ||
77 | + let treeValues = new Array<TreeItem>(); | ||
78 | + menuListModel.map((item) => { | ||
79 | + const data = { | ||
80 | + menuName: t(item.meta.title), | ||
81 | + icon: item.meta.icon, | ||
82 | + key: item.id, | ||
83 | + children: item.children as any as TreeItem[], | ||
84 | + }; | ||
85 | + treeValues.push(data); | ||
86 | + }); | ||
87 | + treeData.value = treeValues; | ||
88 | + } | ||
89 | + if (data.record) { | ||
90 | + roleMenus.value = await getMenusIdsByRoleId(data.record.id); | ||
91 | + roleId.value = data.record.id; | ||
92 | + } | ||
93 | + isUpdate.value = !!data?.isUpdate; | ||
94 | + if (unref(isUpdate)) { | ||
95 | + setFieldsValue({ | ||
96 | + ...data.record, | ||
97 | + }); | ||
98 | + } | ||
99 | + }); | ||
100 | + | ||
101 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); | ||
102 | 102 | ||
103 | - async function handleSubmit() { | ||
104 | - try { | ||
105 | - const values = await validate(); | ||
106 | - setDrawerProps({confirmLoading: true}); | ||
107 | - const req = { | ||
108 | - id: roleId.value, | ||
109 | - name: values.name, | ||
110 | - remark: values.remark, | ||
111 | - status: values.status, | ||
112 | - roleType: RoleEnum.ROLE_TENANT_ADMIN, | ||
113 | - menu: [...values.menu] | 103 | + async function handleSubmit() { |
104 | + try { | ||
105 | + const values = await validate(); | ||
106 | + setDrawerProps({ confirmLoading: true }); | ||
107 | + const req = { | ||
108 | + id: roleId.value, | ||
109 | + name: values.name, | ||
110 | + remark: values.remark, | ||
111 | + status: values.status, | ||
112 | + roleType: RoleEnum.ROLE_TENANT_ADMIN, | ||
113 | + menu: [...values.menu], | ||
114 | + }; | ||
115 | + console.log(req, '请求参数'); | ||
116 | + saveOrUpdateRoleInfoWithMenu(req).then(() => { | ||
117 | + closeDrawer(); | ||
118 | + emit('success'); | ||
119 | + }); | ||
120 | + } finally { | ||
121 | + setDrawerProps({ confirmLoading: false }); | ||
114 | } | 122 | } |
115 | - console.log(req,"请求参数") | ||
116 | - saveOrUpdateRoleInfoWithMenu(req).then(()=>{ | ||
117 | - closeDrawer(); | ||
118 | - emit('success'); | ||
119 | - }) | ||
120 | - } finally { | ||
121 | - setDrawerProps({confirmLoading: false}); | ||
122 | } | 123 | } |
123 | - } | ||
124 | 124 | ||
125 | - return { | ||
126 | - registerDrawer, | ||
127 | - registerForm, | ||
128 | - getTitle, | ||
129 | - handleSubmit, | ||
130 | - treeData, | ||
131 | - roleMenus, | ||
132 | - }; | ||
133 | - }, | ||
134 | -}); | 125 | + return { |
126 | + registerDrawer, | ||
127 | + registerForm, | ||
128 | + getTitle, | ||
129 | + handleSubmit, | ||
130 | + treeData, | ||
131 | + roleMenus, | ||
132 | + }; | ||
133 | + }, | ||
134 | + }); | ||
135 | </script> | 135 | </script> |
@@ -8,12 +8,12 @@ | @@ -8,12 +8,12 @@ | ||
8 | <TableAction | 8 | <TableAction |
9 | :actions="[ | 9 | :actions="[ |
10 | { | 10 | { |
11 | - label:'编辑', | 11 | + label: '编辑', |
12 | icon: 'clarity:note-edit-line', | 12 | icon: 'clarity:note-edit-line', |
13 | onClick: handleEdit.bind(null, record), | 13 | onClick: handleEdit.bind(null, record), |
14 | }, | 14 | }, |
15 | { | 15 | { |
16 | - label:'删除', | 16 | + label: '删除', |
17 | icon: 'ant-design:delete-outlined', | 17 | icon: 'ant-design:delete-outlined', |
18 | color: 'error', | 18 | color: 'error', |
19 | popConfirm: { | 19 | popConfirm: { |
@@ -32,12 +32,12 @@ | @@ -32,12 +32,12 @@ | ||
32 | import { defineComponent } from 'vue'; | 32 | import { defineComponent } from 'vue'; |
33 | 33 | ||
34 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 34 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
35 | - import {delRole, getRoleListByPage} from '/@/api/system/system'; | 35 | + import { delRole, getRoleListByPage } from '/@/api/system/system'; |
36 | 36 | ||
37 | import { useDrawer } from '/@/components/Drawer'; | 37 | import { useDrawer } from '/@/components/Drawer'; |
38 | import RoleDrawer from './RoleDrawer.vue'; | 38 | import RoleDrawer from './RoleDrawer.vue'; |
39 | import { columns, searchFormSchema } from './role.data'; | 39 | import { columns, searchFormSchema } from './role.data'; |
40 | - import {RoleEnum} from "/@/enums/roleEnum"; | 40 | + import { RoleEnum } from '/@/enums/roleEnum'; |
41 | 41 | ||
42 | export default defineComponent({ | 42 | export default defineComponent({ |
43 | name: 'TenantRoleManagement', | 43 | name: 'TenantRoleManagement', |
@@ -48,10 +48,10 @@ | @@ -48,10 +48,10 @@ | ||
48 | title: '租户角色列表', | 48 | title: '租户角色列表', |
49 | api: getRoleListByPage, | 49 | api: getRoleListByPage, |
50 | columns, | 50 | columns, |
51 | - tableSetting:{ | ||
52 | - redo:true, | ||
53 | - size:false, | ||
54 | - setting:false | 51 | + tableSetting: { |
52 | + redo: true, | ||
53 | + size: false, | ||
54 | + setting: false, | ||
55 | }, | 55 | }, |
56 | formConfig: { | 56 | formConfig: { |
57 | labelWidth: 120, | 57 | labelWidth: 120, |
@@ -84,11 +84,10 @@ | @@ -84,11 +84,10 @@ | ||
84 | } | 84 | } |
85 | 85 | ||
86 | async function handleDelete(record: Recordable) { | 86 | async function handleDelete(record: Recordable) { |
87 | - const roleIds = [record.id] | ||
88 | - delRole(roleIds).then(()=>{ | 87 | + const roleIds = [record.id]; |
88 | + delRole(roleIds).then(() => { | ||
89 | reload(); | 89 | reload(); |
90 | - }) | ||
91 | - | 90 | + }); |
92 | } | 91 | } |
93 | function handleSuccess() { | 92 | function handleSuccess() { |
94 | reload(); | 93 | reload(); |
@@ -101,7 +100,7 @@ | @@ -101,7 +100,7 @@ | ||
101 | handleEdit, | 100 | handleEdit, |
102 | handleDelete, | 101 | handleDelete, |
103 | handleSuccess, | 102 | handleSuccess, |
104 | - RoleEnum | 103 | + RoleEnum, |
105 | }; | 104 | }; |
106 | }, | 105 | }, |
107 | }); | 106 | }); |
1 | -import {BasicColumn} from '/@/components/Table'; | ||
2 | -import {FormSchema} from '/@/components/Table'; | ||
3 | -import {h} from 'vue'; | ||
4 | -import {Switch} from 'ant-design-vue'; | ||
5 | -import {setRoleStatus} from '/@/api/system/system'; | ||
6 | -import {useMessage} from '/@/hooks/web/useMessage'; | ||
7 | -import {RoleEnum} from "/@/enums/roleEnum"; | 1 | +import { BasicColumn } from '/@/components/Table'; |
2 | +import { FormSchema } from '/@/components/Table'; | ||
3 | +import { h } from 'vue'; | ||
4 | +import { Switch } from 'ant-design-vue'; | ||
5 | +import { setRoleStatus } from '/@/api/system/system'; | ||
6 | +import { useMessage } from '/@/hooks/web/useMessage'; | ||
7 | +import { RoleEnum } from '/@/enums/roleEnum'; | ||
8 | export const columns: BasicColumn[] = [ | 8 | export const columns: BasicColumn[] = [ |
9 | { | 9 | { |
10 | title: '角色名称', | 10 | title: '角色名称', |
@@ -20,7 +20,7 @@ export const columns: BasicColumn[] = [ | @@ -20,7 +20,7 @@ export const columns: BasicColumn[] = [ | ||
20 | title: '状态', | 20 | title: '状态', |
21 | dataIndex: 'status', | 21 | dataIndex: 'status', |
22 | width: 120, | 22 | width: 120, |
23 | - customRender: ({record}) => { | 23 | + customRender: ({ record }) => { |
24 | if (!Reflect.has(record, 'pendingStatus')) { | 24 | if (!Reflect.has(record, 'pendingStatus')) { |
25 | record.pendingStatus = false; | 25 | record.pendingStatus = false; |
26 | } | 26 | } |
@@ -32,7 +32,7 @@ export const columns: BasicColumn[] = [ | @@ -32,7 +32,7 @@ export const columns: BasicColumn[] = [ | ||
32 | onChange(checked: boolean) { | 32 | onChange(checked: boolean) { |
33 | record.pendingStatus = true; | 33 | record.pendingStatus = true; |
34 | const newStatus = checked ? 1 : 0; | 34 | const newStatus = checked ? 1 : 0; |
35 | - const {createMessage} = useMessage(); | 35 | + const { createMessage } = useMessage(); |
36 | setRoleStatus(record.id, newStatus) | 36 | setRoleStatus(record.id, newStatus) |
37 | .then(() => { | 37 | .then(() => { |
38 | record.status = newStatus; | 38 | record.status = newStatus; |
@@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | @@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | ||
52 | { | 52 | { |
53 | title: '备注', | 53 | title: '备注', |
54 | dataIndex: 'remark', | 54 | dataIndex: 'remark', |
55 | - width:240, | 55 | + width: 240, |
56 | }, | 56 | }, |
57 | { | 57 | { |
58 | title: '创建时间', | 58 | title: '创建时间', |
@@ -66,15 +66,15 @@ export const searchFormSchema: FormSchema[] = [ | @@ -66,15 +66,15 @@ export const searchFormSchema: FormSchema[] = [ | ||
66 | field: 'roleName', | 66 | field: 'roleName', |
67 | label: '角色名称', | 67 | label: '角色名称', |
68 | component: 'Input', | 68 | component: 'Input', |
69 | - colProps: {span: 8}, | 69 | + colProps: { span: 8 }, |
70 | }, | 70 | }, |
71 | { | 71 | { |
72 | field: 'roleType', | 72 | field: 'roleType', |
73 | label: '', | 73 | label: '', |
74 | component: 'Input', | 74 | component: 'Input', |
75 | - colProps: {span: 8}, | ||
76 | - defaultValue:RoleEnum.ROLE_TENANT_ADMIN, | ||
77 | - ifShow:false | 75 | + colProps: { span: 8 }, |
76 | + defaultValue: RoleEnum.ROLE_TENANT_ADMIN, | ||
77 | + ifShow: false, | ||
78 | }, | 78 | }, |
79 | { | 79 | { |
80 | field: 'status', | 80 | field: 'status', |
@@ -82,11 +82,11 @@ export const searchFormSchema: FormSchema[] = [ | @@ -82,11 +82,11 @@ export const searchFormSchema: FormSchema[] = [ | ||
82 | component: 'Select', | 82 | component: 'Select', |
83 | componentProps: { | 83 | componentProps: { |
84 | options: [ | 84 | options: [ |
85 | - {label: '启用', value: 1}, | ||
86 | - {label: '停用', value: 0}, | 85 | + { label: '启用', value: 1 }, |
86 | + { label: '停用', value: 0 }, | ||
87 | ], | 87 | ], |
88 | }, | 88 | }, |
89 | - colProps: {span: 8}, | 89 | + colProps: { span: 8 }, |
90 | }, | 90 | }, |
91 | ]; | 91 | ]; |
92 | 92 | ||
@@ -104,8 +104,8 @@ export const formSchema: FormSchema[] = [ | @@ -104,8 +104,8 @@ export const formSchema: FormSchema[] = [ | ||
104 | defaultValue: 0, | 104 | defaultValue: 0, |
105 | componentProps: { | 105 | componentProps: { |
106 | options: [ | 106 | options: [ |
107 | - {label: '启用', value: 1}, | ||
108 | - {label: '停用', value: 0}, | 107 | + { label: '启用', value: 1 }, |
108 | + { label: '停用', value: 0 }, | ||
109 | ], | 109 | ], |
110 | }, | 110 | }, |
111 | }, | 111 | }, |
@@ -21,7 +21,7 @@ export interface RequestOptions { | @@ -21,7 +21,7 @@ export interface RequestOptions { | ||
21 | ignoreCancelToken?: boolean; | 21 | ignoreCancelToken?: boolean; |
22 | // Whether to send token in header | 22 | // Whether to send token in header |
23 | withToken?: boolean; | 23 | withToken?: boolean; |
24 | - catchFirst?:boolean; | 24 | + catchFirst?: boolean; |
25 | } | 25 | } |
26 | 26 | ||
27 | export interface Result<T = any> { | 27 | export interface Result<T = any> { |
@@ -3069,6 +3069,33 @@ bluebird@^3.5.0, bluebird@^3.7.2: | @@ -3069,6 +3069,33 @@ bluebird@^3.5.0, bluebird@^3.7.2: | ||
3069 | resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" | 3069 | resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" |
3070 | integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== | 3070 | integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== |
3071 | 3071 | ||
3072 | +bmaplib.curveline@^1.0.0: | ||
3073 | + version "1.0.0" | ||
3074 | + resolved "https://registry.npmjs.org/bmaplib.curveline/-/bmaplib.curveline-1.0.0.tgz#826eb0bf1c59fad1b23142be66fc360cf009aea2" | ||
3075 | + integrity sha512-9wcFMVhiYxNPqpvsLDAADn3qDhNzXp2mA6VyHSHg2XOAgSooC7ZiujdFhy0sp+0QYjTfJ/MjmLuNoUg2HHxH4Q== | ||
3076 | + | ||
3077 | +bmaplib.heatmap@^1.0.4: | ||
3078 | + version "1.0.4" | ||
3079 | + resolved "https://registry.npmjs.org/bmaplib.heatmap/-/bmaplib.heatmap-1.0.4.tgz#30161262771fe78af35705ff92457725de5d9850" | ||
3080 | + integrity sha512-rmhqUARBpUSJ9jXzUI2j7dIOqnc38bqubkx/8a349U2qtw/ulLUwyzRD535OrA8G7w5cz4aPKm6/rNvUAarg/Q== | ||
3081 | + | ||
3082 | +bmaplib.lushu@^1.0.7: | ||
3083 | + version "1.0.7" | ||
3084 | + resolved "https://registry.npmjs.org/bmaplib.lushu/-/bmaplib.lushu-1.0.7.tgz#77c17dcf7148d30c46e8430c7ff86b20e418b8b8" | ||
3085 | + integrity sha512-LVvgpESPii6xGxyjnQjq8u+ic4NjvhdCPV/RiSS/PGTUdZKeTDS7prSpleJLZH3ES0+oc0gYn8bw0LtPYUSz2w== | ||
3086 | + | ||
3087 | +bmaplib.markerclusterer@^1.0.13: | ||
3088 | + version "1.0.13" | ||
3089 | + resolved "https://registry.npmjs.org/bmaplib.markerclusterer/-/bmaplib.markerclusterer-1.0.13.tgz#442d71a6c40844ee47d01f6db2166b54530b5bd1" | ||
3090 | + integrity sha512-VrLyWSiuDEVNi0yUfwOhFQ6z1oEEHS4w36GNu3iASu6p52QIx9uAXMUkuSCHReNR0bj2Cp9SA1dSx5RpojXajQ== | ||
3091 | + dependencies: | ||
3092 | + bmaplib.texticonoverlay "^1.0.2" | ||
3093 | + | ||
3094 | +bmaplib.texticonoverlay@^1.0.2: | ||
3095 | + version "1.0.2" | ||
3096 | + resolved "https://registry.npmjs.org/bmaplib.texticonoverlay/-/bmaplib.texticonoverlay-1.0.2.tgz#d78546ea0f036d9fe964983796315b6c112a05bf" | ||
3097 | + integrity sha512-4ZTWr4ZP3B6qEWput5Tut16CfZgII38YwM3bpyb4gFTQyORlKYryFp9WHWrwZZaHlOyYDAXG9SX0hka43jTADg== | ||
3098 | + | ||
3072 | boolbase@^1.0.0: | 3099 | boolbase@^1.0.0: |
3073 | version "1.0.0" | 3100 | version "1.0.0" |
3074 | resolved "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" | 3101 | resolved "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" |
@@ -4558,7 +4585,7 @@ enquirer@^2.3.5, enquirer@^2.3.6: | @@ -4558,7 +4585,7 @@ enquirer@^2.3.5, enquirer@^2.3.6: | ||
4558 | dependencies: | 4585 | dependencies: |
4559 | ansi-colors "^4.1.1" | 4586 | ansi-colors "^4.1.1" |
4560 | 4587 | ||
4561 | -entities@^1.1.1: | 4588 | +entities@^1.1.1, entities@~1.1.1: |
4562 | version "1.1.2" | 4589 | version "1.1.2" |
4563 | resolved "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" | 4590 | resolved "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" |
4564 | integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== | 4591 | integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== |
@@ -7442,6 +7469,13 @@ lines-and-columns@^1.1.6: | @@ -7442,6 +7469,13 @@ lines-and-columns@^1.1.6: | ||
7442 | resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" | 7469 | resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" |
7443 | integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= | 7470 | integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= |
7444 | 7471 | ||
7472 | +linkify-it@^2.0.0: | ||
7473 | + version "2.2.0" | ||
7474 | + resolved "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf" | ||
7475 | + integrity sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw== | ||
7476 | + dependencies: | ||
7477 | + uc.micro "^1.0.1" | ||
7478 | + | ||
7445 | lint-staged@^11.1.2: | 7479 | lint-staged@^11.1.2: |
7446 | version "11.1.2" | 7480 | version "11.1.2" |
7447 | resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-11.1.2.tgz#4dd78782ae43ee6ebf2969cad9af67a46b33cd90" | 7481 | resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-11.1.2.tgz#4dd78782ae43ee6ebf2969cad9af67a46b33cd90" |
@@ -7753,6 +7787,17 @@ map-visit@^1.0.0: | @@ -7753,6 +7787,17 @@ map-visit@^1.0.0: | ||
7753 | dependencies: | 7787 | dependencies: |
7754 | object-visit "^1.0.0" | 7788 | object-visit "^1.0.0" |
7755 | 7789 | ||
7790 | +markdown-it@^8.4.0: | ||
7791 | + version "8.4.2" | ||
7792 | + resolved "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz#386f98998dc15a37722aa7722084f4020bdd9b54" | ||
7793 | + integrity sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ== | ||
7794 | + dependencies: | ||
7795 | + argparse "^1.0.7" | ||
7796 | + entities "~1.1.1" | ||
7797 | + linkify-it "^2.0.0" | ||
7798 | + mdurl "^1.0.1" | ||
7799 | + uc.micro "^1.0.5" | ||
7800 | + | ||
7756 | mathml-tag-names@^2.1.3: | 7801 | mathml-tag-names@^2.1.3: |
7757 | version "2.1.3" | 7802 | version "2.1.3" |
7758 | resolved "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3" | 7803 | resolved "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3" |
@@ -7791,6 +7836,11 @@ mdn-data@2.0.14: | @@ -7791,6 +7836,11 @@ mdn-data@2.0.14: | ||
7791 | resolved "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50" | 7836 | resolved "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50" |
7792 | integrity sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow== | 7837 | integrity sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow== |
7793 | 7838 | ||
7839 | +mdurl@^1.0.1: | ||
7840 | + version "1.0.1" | ||
7841 | + resolved "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" | ||
7842 | + integrity sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4= | ||
7843 | + | ||
7794 | memorystream@^0.3.1: | 7844 | memorystream@^0.3.1: |
7795 | version "0.3.1" | 7845 | version "0.3.1" |
7796 | resolved "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" | 7846 | resolved "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" |
@@ -10912,6 +10962,11 @@ typescript@4.3.5: | @@ -10912,6 +10962,11 @@ typescript@4.3.5: | ||
10912 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4" | 10962 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4" |
10913 | integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA== | 10963 | integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA== |
10914 | 10964 | ||
10965 | +uc.micro@^1.0.1, uc.micro@^1.0.5: | ||
10966 | + version "1.0.6" | ||
10967 | + resolved "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" | ||
10968 | + integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== | ||
10969 | + | ||
10915 | uglify-js@^3.1.4: | 10970 | uglify-js@^3.1.4: |
10916 | version "3.13.9" | 10971 | version "3.13.9" |
10917 | resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.9.tgz#4d8d21dcd497f29cfd8e9378b9df123ad025999b" | 10972 | resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.9.tgz#4d8d21dcd497f29cfd8e9378b9df123ad025999b" |
@@ -11442,6 +11497,17 @@ vscode-vue-languageservice@^0.27.0: | @@ -11442,6 +11497,17 @@ vscode-vue-languageservice@^0.27.0: | ||
11442 | vscode-pug-languageservice "^0.27.1" | 11497 | vscode-pug-languageservice "^0.27.1" |
11443 | vscode-typescript-languageservice "^0.27.1" | 11498 | vscode-typescript-languageservice "^0.27.1" |
11444 | 11499 | ||
11500 | +vue-baidu-map@^0.21.22: | ||
11501 | + version "0.21.22" | ||
11502 | + resolved "https://registry.npmjs.org/vue-baidu-map/-/vue-baidu-map-0.21.22.tgz#6b76a91ef34f18a782d732ab0f541a1a3aa069e0" | ||
11503 | + integrity sha512-WQMPCih4UTh0AZCKKH/OVOYnyAWjfRNeK6BIeoLmscyY5aF8zzlJhz/NOHLb3mdztIpB0Z6aohn4Jd9mfCSjQw== | ||
11504 | + dependencies: | ||
11505 | + bmaplib.curveline "^1.0.0" | ||
11506 | + bmaplib.heatmap "^1.0.4" | ||
11507 | + bmaplib.lushu "^1.0.7" | ||
11508 | + bmaplib.markerclusterer "^1.0.13" | ||
11509 | + markdown-it "^8.4.0" | ||
11510 | + | ||
11445 | vue-demi@*: | 11511 | vue-demi@*: |
11446 | version "0.9.1" | 11512 | version "0.9.1" |
11447 | resolved "https://registry.npmjs.org/vue-demi/-/vue-demi-0.9.1.tgz#25d6e1ebd4d4010757ff3571e2bf6a1d7bf3de82" | 11513 | resolved "https://registry.npmjs.org/vue-demi/-/vue-demi-0.9.1.tgz#25d6e1ebd4d4010757ff3571e2bf6a1d7bf3de82" |