Commit 46bfbef2b829f08fc6a0cc0d690e021c4e311d51

Authored by 黄 x
2 parents 07d508e1 c800aa87

Merge branch 'sqy_dev' into 'main'

Sqy dev远程分支与main合并

See merge request huang/yun-teng-iot-front!2
Showing 77 changed files with 2094 additions and 1285 deletions

Too many changes to show.

To preserve performance only 77 of 127 files are displayed.

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