Showing
51 changed files
with
872 additions
and
685 deletions
| @@ -6,7 +6,7 @@ VITE_PUBLIC_PATH = / | @@ -6,7 +6,7 @@ VITE_PUBLIC_PATH = / | ||
| 6 | 6 | ||
| 7 | # Cross-domain proxy, you can configure multiple | 7 | # Cross-domain proxy, you can configure multiple | 
| 8 | # Please note that no line breaks | 8 | # Please note that no line breaks | 
| 9 | -VITE_PROXY = [["/api","http://192.168.10.123:8082/api"],["/upload","http://192.168.10.125:3300/upload"]] | 9 | +VITE_PROXY = [["/api","http://192.168.10.122:8082/api"],["/upload","http://192.168.10.122:3300/upload"]] | 
| 10 | # VITE_PROXY=[["/api","https://vvbin.cn/test"]] | 10 | # VITE_PROXY=[["/api","https://vvbin.cn/test"]] | 
| 11 | 11 | ||
| 12 | # Delete console | 12 | # Delete console | 
| @@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
| 21 | "clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite", | 21 | "clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite", | 
| 22 | "clean:lib": "rimraf node_modules", | 22 | "clean:lib": "rimraf node_modules", | 
| 23 | "lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix", | 23 | "lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix", | 
| 24 | - "lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"", | 24 | + "lint:prettier": "prettier --write \"src/**/*.{js,json,ts,tsx,css,less,scss,vue,html,md}\"", | 
| 25 | "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", | 25 | "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", | 
| 26 | "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js", | 26 | "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js", | 
| 27 | "lint:pretty": "pretty-quick --staged", | 27 | "lint:pretty": "pretty-quick --staged", | 
| 1 | import { defHttp } from '/@/utils/http/axios'; | 1 | import { defHttp } from '/@/utils/http/axios'; | 
| 2 | -import type { BasicPageParams } from '/@/api/model/baseModel'; | ||
| 3 | -import type { ContactModal, ContactParams } from './modal/alarmContactModel'; | 2 | +import type { | 
| 3 | + ContactPageParams, | ||
| 4 | + ContactModal, | ||
| 5 | + ContactParams, | ||
| 6 | + ContactInfo, | ||
| 7 | +} from './model/alarmContactModal'; | ||
| 4 | import { getPageData } from '../../base'; | 8 | import { getPageData } from '../../base'; | 
| 5 | enum Api { | 9 | enum Api { | 
| 6 | alarmContact = '/alarmContact', | 10 | alarmContact = '/alarmContact', | 
| @@ -8,7 +12,7 @@ enum Api { | @@ -8,7 +12,7 @@ enum Api { | ||
| 8 | } | 12 | } | 
| 9 | 13 | ||
| 10 | // 获取 | 14 | // 获取 | 
| 11 | -export const getAlarmContact = (params: BasicPageParams) => { | 15 | +export const getAlarmContact = (params: ContactPageParams) => { | 
| 12 | return getPageData<ContactModal>(params, Api.alarmContact); | 16 | return getPageData<ContactModal>(params, Api.alarmContact); | 
| 13 | }; | 17 | }; | 
| 14 | 18 | ||
| @@ -16,9 +20,7 @@ export const getAlarmContact = (params: BasicPageParams) => { | @@ -16,9 +20,7 @@ export const getAlarmContact = (params: BasicPageParams) => { | ||
| 16 | export const addAlarmContact = (params: ContactParams) => { | 20 | export const addAlarmContact = (params: ContactParams) => { | 
| 17 | return defHttp.post({ | 21 | return defHttp.post({ | 
| 18 | url: Api.alarmContact, | 22 | url: Api.alarmContact, | 
| 19 | - data: { | ||
| 20 | - params, | ||
| 21 | - }, | 23 | + data: params, | 
| 22 | }); | 24 | }); | 
| 23 | }; | 25 | }; | 
| 24 | 26 | ||
| @@ -26,9 +28,7 @@ export const addAlarmContact = (params: ContactParams) => { | @@ -26,9 +28,7 @@ export const addAlarmContact = (params: ContactParams) => { | ||
| 26 | export const updateAlarmContact = (params: ContactParams) => { | 28 | export const updateAlarmContact = (params: ContactParams) => { | 
| 27 | return defHttp.post({ | 29 | return defHttp.post({ | 
| 28 | url: Api.updateAlarmContact, | 30 | url: Api.updateAlarmContact, | 
| 29 | - data: { | ||
| 30 | - params, | ||
| 31 | - }, | 31 | + data: params, | 
| 32 | }); | 32 | }); | 
| 33 | }; | 33 | }; | 
| 34 | 34 | ||
| @@ -39,3 +39,9 @@ export const deleteAlarmContact = (ids: string[]) => { | @@ -39,3 +39,9 @@ export const deleteAlarmContact = (ids: string[]) => { | ||
| 39 | data: ids, | 39 | data: ids, | 
| 40 | }); | 40 | }); | 
| 41 | }; | 41 | }; | 
| 42 | + | ||
| 43 | +// 新增或者编辑 | ||
| 44 | +export const saveOrEditAlarmContact = (params: ContactInfo, isUpdate: boolean) => { | ||
| 45 | + if (isUpdate) return updateAlarmContact(params); | ||
| 46 | + addAlarmContact(params); | ||
| 47 | +}; | 
src/api/alarm/contact/model/alarmContactModal.ts
renamed from
src/api/alarm/contact/modal/alarmContactModel.ts
| 1 | +import { BasicPageParams } from '/@/api/model/baseModel'; | ||
| 2 | + | ||
| 1 | interface ContactItemsModal { | 3 | interface ContactItemsModal { | 
| 2 | id: string; | 4 | id: string; | 
| 3 | createTime: string; | 5 | createTime: string; | 
| @@ -6,6 +8,7 @@ interface ContactItemsModal { | @@ -6,6 +8,7 @@ interface ContactItemsModal { | ||
| 6 | department: string; | 8 | department: string; | 
| 7 | phone: string; | 9 | phone: string; | 
| 8 | } | 10 | } | 
| 11 | +export type ContactPageParams = BasicPageParams & { username: string; organizationId: string }; | ||
| 9 | 12 | ||
| 10 | export interface ContactModal { | 13 | export interface ContactModal { | 
| 11 | items: ContactItemsModal[]; | 14 | items: ContactItemsModal[]; | 
| @@ -17,8 +20,9 @@ export interface ContactParams { | @@ -17,8 +20,9 @@ export interface ContactParams { | ||
| 17 | username: string; | 20 | username: string; | 
| 18 | department?: string; | 21 | department?: string; | 
| 19 | email?: string; | 22 | email?: string; | 
| 20 | - enabled?: boolean; | ||
| 21 | wechat?: string; | 23 | wechat?: string; | 
| 22 | addPeople?: string; | 24 | addPeople?: string; | 
| 23 | remark?: string; | 25 | remark?: string; | 
| 24 | } | 26 | } | 
| 27 | + | ||
| 28 | +export type ContactInfo = ContactParams; | 
| 1 | -import {defHttp} from '/@/utils/http/axios'; | 1 | +import { defHttp } from '/@/utils/http/axios'; | 
| 2 | import { | 2 | import { | 
| 3 | MailLogModelResult, | 3 | MailLogModelResult, | 
| 4 | MessageRecordsParams, | 4 | MessageRecordsParams, | 
| 5 | - SmsLogModelResult | ||
| 6 | -} from "/@/api/message/model/recordsModel"; | 5 | + SmsLogModelResult, | 
| 6 | +} from '/@/api/message/model/recordsModel'; | ||
| 7 | 7 | ||
| 8 | enum MessageRecordsApi { | 8 | enum MessageRecordsApi { | 
| 9 | - SMS_RECORDS = "/smsLog", | ||
| 10 | - EMAIL_RECORDS = "/mailLog" | 9 | + SMS_RECORDS = '/smsLog', | 
| 10 | + EMAIL_RECORDS = '/mailLog', | ||
| 11 | } | 11 | } | 
| 12 | 12 | ||
| 13 | /** | 13 | /** | 
| @@ -17,30 +17,30 @@ enum MessageRecordsApi { | @@ -17,30 +17,30 @@ enum MessageRecordsApi { | ||
| 17 | export const smsLogPage = (params: MessageRecordsParams) => { | 17 | export const smsLogPage = (params: MessageRecordsParams) => { | 
| 18 | return defHttp.get<SmsLogModelResult>({ | 18 | return defHttp.get<SmsLogModelResult>({ | 
| 19 | url: MessageRecordsApi.SMS_RECORDS, | 19 | url: MessageRecordsApi.SMS_RECORDS, | 
| 20 | - params | ||
| 21 | - }) | ||
| 22 | -} | 20 | + params, | 
| 21 | + }); | ||
| 22 | +}; | ||
| 23 | 23 | ||
| 24 | /** | 24 | /** | 
| 25 | * 获取邮件发送记录【分页】 | 25 | * 获取邮件发送记录【分页】 | 
| 26 | * @param params 查询参数 | 26 | * @param params 查询参数 | 
| 27 | */ | 27 | */ | 
| 28 | -export const mailLogPage=(params:MessageRecordsParams)=>{ | 28 | +export const mailLogPage = (params: MessageRecordsParams) => { | 
| 29 | return defHttp.get<MailLogModelResult>({ | 29 | return defHttp.get<MailLogModelResult>({ | 
| 30 | url: MessageRecordsApi.EMAIL_RECORDS, | 30 | url: MessageRecordsApi.EMAIL_RECORDS, | 
| 31 | - params | ||
| 32 | - }) | ||
| 33 | -} | 31 | + params, | 
| 32 | + }); | ||
| 33 | +}; | ||
| 34 | 34 | ||
| 35 | /** | 35 | /** | 
| 36 | * 删除邮件记录 | 36 | * 删除邮件记录 | 
| 37 | * @param ids 邮件记录ID | 37 | * @param ids 邮件记录ID | 
| 38 | */ | 38 | */ | 
| 39 | -export const deleteMailLog =(ids: string[]) => | 39 | +export const deleteMailLog = (ids: string[]) => | 
| 40 | defHttp.delete({ | 40 | defHttp.delete({ | 
| 41 | url: MessageRecordsApi.EMAIL_RECORDS, | 41 | url: MessageRecordsApi.EMAIL_RECORDS, | 
| 42 | data: { | 42 | data: { | 
| 43 | - ids: ids | 43 | + ids: ids, | 
| 44 | }, | 44 | }, | 
| 45 | }); | 45 | }); | 
| 46 | /** | 46 | /** | 
| @@ -51,6 +51,6 @@ export const deleteSmsLog = (ids: string[]) => | @@ -51,6 +51,6 @@ export const deleteSmsLog = (ids: string[]) => | ||
| 51 | defHttp.delete({ | 51 | defHttp.delete({ | 
| 52 | url: MessageRecordsApi.SMS_RECORDS, | 52 | url: MessageRecordsApi.SMS_RECORDS, | 
| 53 | data: { | 53 | data: { | 
| 54 | - ids: ids | 54 | + ids: ids, | 
| 55 | }, | 55 | }, | 
| 56 | }); | 56 | }); | 
| 1 | import { defHttp } from '/@/utils/http/axios'; | 1 | import { defHttp } from '/@/utils/http/axios'; | 
| 2 | import { | 2 | import { | 
| 3 | - EmailParams, MessageResultModel, | 3 | + EmailParams, | 
| 4 | + MessageResultModel, | ||
| 4 | MessageTemplate, | 5 | MessageTemplate, | 
| 5 | MessageTemplateParams, | 6 | MessageTemplateParams, | 
| 6 | - MessageTemplateResultModel, SmsParams | ||
| 7 | -} from "/@/api/message/model/templateModel"; | ||
| 8 | -import {MessageConfigResultModel} from "/@/api/message/model/configModel"; | 7 | + MessageTemplateResultModel, | 
| 8 | + SmsParams, | ||
| 9 | +} from '/@/api/message/model/templateModel'; | ||
| 10 | +import { MessageConfigResultModel } from '/@/api/message/model/configModel'; | ||
| 9 | 11 | ||
| 10 | enum MessageTemplateApi { | 12 | enum MessageTemplateApi { | 
| 11 | TEMPLATE_URL = '/template', | 13 | TEMPLATE_URL = '/template', | 
| @@ -15,19 +17,19 @@ enum MessageTemplateApi { | @@ -15,19 +17,19 @@ enum MessageTemplateApi { | ||
| 15 | * 短信发送 | 17 | * 短信发送 | 
| 16 | * @param params 发送参数 | 18 | * @param params 发送参数 | 
| 17 | */ | 19 | */ | 
| 18 | -export const sendSms=(params: SmsParams)=>{ | 20 | +export const sendSms = (params: SmsParams) => { | 
| 19 | return defHttp.post<MessageResultModel>({ | 21 | return defHttp.post<MessageResultModel>({ | 
| 20 | - url: MessageTemplateApi.TEMPLATE_URL+"/sendSms", | 22 | + url: MessageTemplateApi.TEMPLATE_URL + '/sendSms', | 
| 21 | params, | 23 | params, | 
| 22 | - }) | ||
| 23 | -} | 24 | + }); | 
| 25 | +}; | ||
| 24 | 26 | ||
| 25 | -export const sendEmail=(params:EmailParams)=>{ | 27 | +export const sendEmail = (params: EmailParams) => { | 
| 26 | return defHttp.post<MessageResultModel>({ | 28 | return defHttp.post<MessageResultModel>({ | 
| 27 | - url: MessageTemplateApi.TEMPLATE_URL+"/sendEmail", | 29 | + url: MessageTemplateApi.TEMPLATE_URL + '/sendEmail', | 
| 28 | params, | 30 | params, | 
| 29 | - }) | ||
| 30 | -} | 31 | + }); | 
| 32 | +}; | ||
| 31 | 33 | ||
| 32 | export const messageTemplatePage = (params: MessageTemplateParams) => | 34 | export const messageTemplatePage = (params: MessageTemplateParams) => | 
| 33 | defHttp.get<MessageTemplateResultModel>({ | 35 | defHttp.get<MessageTemplateResultModel>({ | 
| @@ -35,7 +37,6 @@ export const messageTemplatePage = (params: MessageTemplateParams) => | @@ -35,7 +37,6 @@ export const messageTemplatePage = (params: MessageTemplateParams) => | ||
| 35 | params, | 37 | params, | 
| 36 | }); | 38 | }); | 
| 37 | 39 | ||
| 38 | - | ||
| 39 | /** | 40 | /** | 
| 40 | * 更新或保存MessageTemplate配置 | 41 | * 更新或保存MessageTemplate配置 | 
| 41 | * @param params 参数 | 42 | * @param params 参数 | 
| @@ -46,14 +47,14 @@ export const saveOrEditMessageTemplate = (params: MessageTemplate, isUpdate: boo | @@ -46,14 +47,14 @@ export const saveOrEditMessageTemplate = (params: MessageTemplate, isUpdate: boo | ||
| 46 | return defHttp.put<MessageTemplateResultModel>({ | 47 | return defHttp.put<MessageTemplateResultModel>({ | 
| 47 | url: MessageTemplateApi.TEMPLATE_URL, | 48 | url: MessageTemplateApi.TEMPLATE_URL, | 
| 48 | params, | 49 | params, | 
| 49 | - }) | 50 | + }); | 
| 50 | } else { | 51 | } else { | 
| 51 | return defHttp.post<MessageTemplateResultModel>({ | 52 | return defHttp.post<MessageTemplateResultModel>({ | 
| 52 | url: MessageTemplateApi.TEMPLATE_URL, | 53 | url: MessageTemplateApi.TEMPLATE_URL, | 
| 53 | params, | 54 | params, | 
| 54 | - }) | 55 | + }); | 
| 55 | } | 56 | } | 
| 56 | -} | 57 | +}; | 
| 57 | 58 | ||
| 58 | /** | 59 | /** | 
| 59 | * 删除MessageConfig | 60 | * 删除MessageConfig | 
| @@ -63,21 +64,26 @@ export const deleteMessageTemplate = (ids: string[]) => | @@ -63,21 +64,26 @@ export const deleteMessageTemplate = (ids: string[]) => | ||
| 63 | defHttp.delete({ | 64 | defHttp.delete({ | 
| 64 | url: MessageTemplateApi.TEMPLATE_URL, | 65 | url: MessageTemplateApi.TEMPLATE_URL, | 
| 65 | data: { | 66 | data: { | 
| 66 | - ids: ids | 67 | + ids: ids, | 
| 67 | }, | 68 | }, | 
| 68 | - }) | 69 | + }); | 
| 69 | /** | 70 | /** | 
| 70 | * 更新模板状态 | 71 | * 更新模板状态 | 
| 71 | * @param id 配置id | 72 | * @param id 配置id | 
| 72 | * @param status 状态 | 73 | * @param status 状态 | 
| 73 | */ | 74 | */ | 
| 74 | -export const setMessageTemplateStatus=(id:string,templatePurpose:string,messageType:string,status:number) => | 75 | +export const setMessageTemplateStatus = ( | 
| 76 | + id: string, | ||
| 77 | + templatePurpose: string, | ||
| 78 | + messageType: string, | ||
| 79 | + status: number | ||
| 80 | +) => | ||
| 75 | defHttp.put<MessageConfigResultModel>({ | 81 | defHttp.put<MessageConfigResultModel>({ | 
| 76 | url: MessageTemplateApi.TEMPLATE_URL, | 82 | url: MessageTemplateApi.TEMPLATE_URL, | 
| 77 | - data:{ | ||
| 78 | - "id":id, | ||
| 79 | - "status":status, | ||
| 80 | - "templatePurpose":templatePurpose, | ||
| 81 | - "messageType":messageType | 83 | + data: { | 
| 84 | + id: id, | ||
| 85 | + status: status, | ||
| 86 | + templatePurpose: templatePurpose, | ||
| 87 | + messageType: messageType, | ||
| 82 | }, | 88 | }, | 
| 83 | - }) | 89 | + }); | 
| 1 | -import {defHttp} from "/@/utils/http/axios"; | ||
| 2 | -import {FileUploadResponse} from "/@/api/oss/FileUploadResponse"; | 1 | +import { defHttp } from '/@/utils/http/axios'; | 
| 2 | +import { FileUploadResponse } from '/@/api/oss/FileUploadResponse'; | ||
| 3 | 3 | ||
| 4 | enum Api { | 4 | enum Api { | 
| 5 | BaseUploadUrl = '/oss/upload', | 5 | BaseUploadUrl = '/oss/upload', | 
| 6 | } | 6 | } | 
| 7 | 7 | ||
| 8 | export const upload = (file) => { | 8 | export const upload = (file) => { | 
| 9 | - return defHttp.post<FileUploadResponse>({url: Api.BaseUploadUrl, params: file}) | ||
| 10 | -} | 9 | + return defHttp.post<FileUploadResponse>({ url: Api.BaseUploadUrl, params: file }); | 
| 10 | +}; | 
| 1 | export interface JwtModel { | 1 | export interface JwtModel { | 
| 2 | - userId: string; | ||
| 3 | - username: string; | ||
| 4 | - tenantCode: string; | ||
| 5 | - tenantName: string; | ||
| 6 | - exp: number; | ||
| 7 | - role: string[]; | ||
| 8 | - } | ||
| 9 | - | ||
| 2 | + userId: string; | ||
| 3 | + username: string; | ||
| 4 | + tenantCode: string; | ||
| 5 | + tenantName: string; | ||
| 6 | + exp: number; | ||
| 7 | + role: string[]; | ||
| 8 | +} | 
| 1 | -import {defHttp} from '/@/utils/http/axios'; | ||
| 2 | -import {getMenuListResultModel} from './model/menuModel'; | ||
| 3 | -import {useUserStore} from '/@/store/modules/user'; | ||
| 4 | -import {RoleEnum} from '/@/enums/roleEnum'; | 1 | +import { defHttp } from '/@/utils/http/axios'; | 
| 2 | +import { getMenuListResultModel } from './model/menuModel'; | ||
| 3 | +import { useUserStore } from '/@/store/modules/user'; | ||
| 4 | +import { RoleEnum } from '/@/enums/roleEnum'; | ||
| 5 | 5 | ||
| 6 | enum Api { | 6 | enum Api { | 
| 7 | BaseMenuUrl = '/menu', | 7 | BaseMenuUrl = '/menu', | 
| 8 | GetMenuList = '/menu/me/menus', | 8 | GetMenuList = '/menu/me/menus', | 
| 9 | SysAdminMenuList = '/admin/me/menus', | 9 | SysAdminMenuList = '/admin/me/menus', | 
| 10 | - GetMenuIdsByRoleId = '/menu/getMenuIdsByRoleId/' | 10 | + GetMenuIdsByRoleId = '/menu/getMenuIdsByRoleId/', | 
| 11 | } | 11 | } | 
| 12 | 12 | ||
| 13 | /** | 13 | /** | 
| @@ -17,17 +17,17 @@ enum Api { | @@ -17,17 +17,17 @@ enum Api { | ||
| 17 | export const getMenuList = () => { | 17 | export const getMenuList = () => { | 
| 18 | const userStore = useUserStore(); | 18 | const userStore = useUserStore(); | 
| 19 | let url = Api.GetMenuList; | 19 | let url = Api.GetMenuList; | 
| 20 | - if (userStore.getRoleList.find(v => v == RoleEnum.ROLE_SYS_ADMIN)) { | 20 | + if (userStore.getRoleList.find((v) => v == RoleEnum.ROLE_SYS_ADMIN)) { | 
| 21 | url = Api.SysAdminMenuList; | 21 | url = Api.SysAdminMenuList; | 
| 22 | } | 22 | } | 
| 23 | - return defHttp.get<getMenuListResultModel>({url: url}); | 23 | + return defHttp.get<getMenuListResultModel>({ url: url }); | 
| 24 | }; | 24 | }; | 
| 25 | 25 | ||
| 26 | export const delMenu = (menuIds: string[]) => { | 26 | export const delMenu = (menuIds: string[]) => { | 
| 27 | - let url = Api.BaseMenuUrl; | ||
| 28 | - return defHttp.delete({url: url, data: menuIds}) | ||
| 29 | -} | 27 | + const url = Api.BaseMenuUrl; | 
| 28 | + return defHttp.delete({ url: url, data: menuIds }); | ||
| 29 | +}; | ||
| 30 | export const getMenusIdsByRoleId = (roleId: string) => { | 30 | export const getMenusIdsByRoleId = (roleId: string) => { | 
| 31 | - let url = Api.GetMenuIdsByRoleId + roleId; | ||
| 32 | - return defHttp.get<Array<string>>({url: url}); | ||
| 33 | -} | 31 | + const url = Api.GetMenuIdsByRoleId + roleId; | 
| 32 | + return defHttp.get<Array<string>>({ url: url }); | ||
| 33 | +}; | 
| @@ -9,9 +9,9 @@ export interface RouteItem { | @@ -9,9 +9,9 @@ export interface RouteItem { | ||
| 9 | redirect?: string; | 9 | redirect?: string; | 
| 10 | caseSensitive?: boolean; | 10 | caseSensitive?: boolean; | 
| 11 | children?: RouteItem[]; | 11 | children?: RouteItem[]; | 
| 12 | - menuName?:string; | ||
| 13 | - icon?:string; | ||
| 14 | - key?:string; | 12 | + menuName?: string; | 
| 13 | + icon?: string; | ||
| 14 | + key?: string; | ||
| 15 | } | 15 | } | 
| 16 | 16 | ||
| 17 | /** | 17 | /** | 
| @@ -42,8 +42,7 @@ export interface GetUserInfoModel { | @@ -42,8 +42,7 @@ export interface GetUserInfoModel { | ||
| 42 | // 介绍 | 42 | // 介绍 | 
| 43 | desc?: string; | 43 | desc?: string; | 
| 44 | } | 44 | } | 
| 45 | - export interface UserInfoModel{ | ||
| 46 | - | 45 | +export interface UserInfoModel { | 
| 47 | userId: string | number; | 46 | userId: string | number; | 
| 48 | username: string; | 47 | username: string; | 
| 49 | realName: string; | 48 | realName: string; | 
| @@ -52,10 +51,9 @@ export interface GetUserInfoModel { | @@ -52,10 +51,9 @@ export interface GetUserInfoModel { | ||
| 52 | tenantName: string; | 51 | tenantName: string; | 
| 53 | roles: string[]; | 52 | roles: string[]; | 
| 54 | plainRoles?: PlainRoleInfo[]; | 53 | plainRoles?: PlainRoleInfo[]; | 
| 55 | - } | 54 | +} | 
| 56 | 55 | ||
| 57 | - export interface PlainRoleInfo { | 56 | +export interface PlainRoleInfo { | 
| 58 | roleName: string; | 57 | roleName: string; | 
| 59 | roleId: string; | 58 | roleId: string; | 
| 60 | } | 59 | } | 
| 61 | - | 
| @@ -5,7 +5,7 @@ import { | @@ -5,7 +5,7 @@ import { | ||
| 5 | GetUserInfoModel, | 5 | GetUserInfoModel, | 
| 6 | UserInfoModel, | 6 | UserInfoModel, | 
| 7 | RefreshTokenParams, | 7 | RefreshTokenParams, | 
| 8 | - SmsLoginParams | 8 | + SmsLoginParams, | 
| 9 | } from './model/userModel'; | 9 | } from './model/userModel'; | 
| 10 | 10 | ||
| 11 | import { ErrorMessageMode } from '/#/axios'; | 11 | import { ErrorMessageMode } from '/#/axios'; | 
| @@ -18,7 +18,7 @@ enum Api { | @@ -18,7 +18,7 @@ enum Api { | ||
| 18 | GetMyInfo = '/user/me/info', | 18 | GetMyInfo = '/user/me/info', | 
| 19 | GetPermCode = '/role/me/permissions', | 19 | GetPermCode = '/role/me/permissions', | 
| 20 | RefreshToken = '/auth/token', | 20 | RefreshToken = '/auth/token', | 
| 21 | - SendLoginSmsCode = '/noauth/sendLoginSmsCode/' | 21 | + SendLoginSmsCode = '/noauth/sendLoginSmsCode/', | 
| 22 | } | 22 | } | 
| 23 | 23 | ||
| 24 | /** | 24 | /** | 
| @@ -35,7 +35,7 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') | @@ -35,7 +35,7 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') | ||
| 35 | } | 35 | } | 
| 36 | ); | 36 | ); | 
| 37 | } | 37 | } | 
| 38 | -export function getMyInfo(){ | 38 | +export function getMyInfo() { | 
| 39 | return defHttp.get<UserInfoModel>({ url: Api.GetMyInfo }); | 39 | return defHttp.get<UserInfoModel>({ url: Api.GetMyInfo }); | 
| 40 | } | 40 | } | 
| 41 | /** | 41 | /** | 
| @@ -48,19 +48,17 @@ export function getUserInfo() { | @@ -48,19 +48,17 @@ export function getUserInfo() { | ||
| 48 | export function getPermCode() { | 48 | export function getPermCode() { | 
| 49 | return defHttp.get<string[]>({ url: Api.GetPermCode }); | 49 | return defHttp.get<string[]>({ url: Api.GetPermCode }); | 
| 50 | } | 50 | } | 
| 51 | -export async function SendLoginSmsCode(phoneNumber:string){ | ||
| 52 | - return await defHttp.post<boolean>({url:Api.SendLoginSmsCode+phoneNumber}) | 51 | +export async function SendLoginSmsCode(phoneNumber: string) { | 
| 52 | + return await defHttp.post<boolean>({ url: Api.SendLoginSmsCode + phoneNumber }); | ||
| 53 | } | 53 | } | 
| 54 | export function doLogout() { | 54 | export function doLogout() { | 
| 55 | // return defHttp.get({ url: Api.Logout }); | 55 | // return defHttp.get({ url: Api.Logout }); | 
| 56 | } | 56 | } | 
| 57 | -export function doRefreshToken(params:RefreshTokenParams){ | ||
| 58 | - return defHttp.post<LoginResultModel>( | ||
| 59 | - { | ||
| 60 | - url: Api.RefreshToken, | ||
| 61 | - params, | ||
| 62 | - } | ||
| 63 | - ); | 57 | +export function doRefreshToken(params: RefreshTokenParams) { | 
| 58 | + return defHttp.post<LoginResultModel>({ | ||
| 59 | + url: Api.RefreshToken, | ||
| 60 | + params, | ||
| 61 | + }); | ||
| 64 | } | 62 | } | 
| 65 | export function smsCodeLoginApi(params: SmsLoginParams, mode: ErrorMessageMode = 'modal') { | 63 | export function smsCodeLoginApi(params: SmsLoginParams, mode: ErrorMessageMode = 'modal') { | 
| 66 | return defHttp.post<LoginResultModel>( | 64 | return defHttp.post<LoginResultModel>( | 
| 1 | -import {defHttp} from '/@/utils/http/axios'; | 1 | +import { defHttp } from '/@/utils/http/axios'; | 
| 2 | 2 | ||
| 3 | -import {DeptListGetResultModel, DeptListItem} from "/@/api/system/model/deptModel"; | ||
| 4 | - | ||
| 5 | -import {DeptOperationApiResult, DeptOperationParams} from "/@/api/system/model/deptModel"; | ||
| 6 | -import {ErrorMessageMode} from "/#/axios"; | 3 | +import { DeptListGetResultModel, DeptListItem } from '/@/api/system/model/deptModel'; | 
| 7 | 4 | ||
| 5 | +import { DeptOperationApiResult, DeptOperationParams } from '/@/api/system/model/deptModel'; | ||
| 6 | +import { ErrorMessageMode } from '/#/axios'; | ||
| 8 | 7 | ||
| 9 | enum Api { | 8 | enum Api { | 
| 10 | DeptList = '/dept/all', | 9 | DeptList = '/dept/all', | 
| @@ -17,7 +16,11 @@ export const getDeptList = (params?: DeptListItem) => | @@ -17,7 +16,11 @@ export const getDeptList = (params?: DeptListItem) => | ||
| 17 | /** | 16 | /** | 
| 18 | * @description: save or edit dept api | 17 | * @description: save or edit dept api | 
| 19 | */ | 18 | */ | 
| 20 | -export function saveOrEditDeptApi(params: DeptOperationParams, update: boolean = false, mode: ErrorMessageMode = 'modal') { | 19 | +export function saveOrEditDeptApi( | 
| 20 | + params: DeptOperationParams, | ||
| 21 | + update = false, | ||
| 22 | + mode: ErrorMessageMode = 'modal' | ||
| 23 | +) { | ||
| 21 | if (!update) { | 24 | if (!update) { | 
| 22 | return defHttp.post<DeptOperationApiResult>( | 25 | return defHttp.post<DeptOperationApiResult>( | 
| 23 | { | 26 | { | 
| @@ -29,11 +32,14 @@ export function saveOrEditDeptApi(params: DeptOperationParams, update: boolean = | @@ -29,11 +32,14 @@ export function saveOrEditDeptApi(params: DeptOperationParams, update: boolean = | ||
| 29 | } | 32 | } | 
| 30 | ); | 33 | ); | 
| 31 | } else { | 34 | } else { | 
| 32 | - return defHttp.put<DeptOperationApiResult>({url: Api.basicUrl, params}, {errorMessageMode: mode}); | 35 | + return defHttp.put<DeptOperationApiResult>( | 
| 36 | + { url: Api.basicUrl, params }, | ||
| 37 | + { errorMessageMode: mode } | ||
| 38 | + ); | ||
| 33 | } | 39 | } | 
| 34 | } | 40 | } | 
| 35 | 41 | ||
| 36 | export const delDept = (menuIds: string[]) => { | 42 | export const delDept = (menuIds: string[]) => { | 
| 37 | - let url = Api.basicUrl; | ||
| 38 | - return defHttp.delete({url: url, data: menuIds}) | ||
| 39 | -} | 43 | + const url = Api.basicUrl; | 
| 44 | + return defHttp.delete({ url: url, data: menuIds }); | ||
| 45 | +}; | 
| 1 | -import {defHttp} from "/@/utils/http/axios"; | ||
| 2 | -import {GroupListResultModel} from "/@/api/system/model/groupModel"; | 1 | +import { defHttp } from '/@/utils/http/axios'; | 
| 2 | +import { GroupListResultModel } from '/@/api/system/model/groupModel'; | ||
| 3 | 3 | ||
| 4 | enum GroupApi { | 4 | enum GroupApi { | 
| 5 | - BASE_URL="/organization" | 5 | + BASE_URL = '/organization', | 
| 6 | } | 6 | } | 
| 7 | 7 | ||
| 8 | /** | 8 | /** | 
| 9 | * 查询当前用户的所属组织 | 9 | * 查询当前用户的所属组织 | 
| 10 | */ | 10 | */ | 
| 11 | -export const findCurrentUserGroups=()=> | 11 | +export const findCurrentUserGroups = () => | 
| 12 | defHttp.get<GroupListResultModel>({ | 12 | defHttp.get<GroupListResultModel>({ | 
| 13 | - url: GroupApi.BASE_URL+"/me/organizations", | 13 | + url: GroupApi.BASE_URL + '/me/organizations', | 
| 14 | }); | 14 | }); | 
| 1 | -import {MenuOperationParams, MenuOperationApiResult} from "/@/api/system/model/menuModel"; | ||
| 2 | -import {ErrorMessageMode} from "/#/axios"; | ||
| 3 | -import {defHttp} from "/@/utils/http/axios"; | ||
| 4 | - | 1 | +import { MenuOperationParams, MenuOperationApiResult } from '/@/api/system/model/menuModel'; | 
| 2 | +import { ErrorMessageMode } from '/#/axios'; | ||
| 3 | +import { defHttp } from '/@/utils/http/axios'; | ||
| 5 | 4 | ||
| 6 | enum Api { | 5 | enum Api { | 
| 7 | Save = '/menu', | 6 | Save = '/menu', | 
| @@ -10,7 +9,11 @@ enum Api { | @@ -10,7 +9,11 @@ enum Api { | ||
| 10 | /** | 9 | /** | 
| 11 | * @description: save menu api | 10 | * @description: save menu api | 
| 12 | */ | 11 | */ | 
| 13 | -export function saveMenuApi(params: MenuOperationParams, update: boolean = false, mode: ErrorMessageMode = 'modal') { | 12 | +export function saveMenuApi( | 
| 13 | + params: MenuOperationParams, | ||
| 14 | + update: boolean = false, | ||
| 15 | + mode: ErrorMessageMode = 'modal' | ||
| 16 | +) { | ||
| 14 | console.log(params); | 17 | console.log(params); | 
| 15 | if (!update) { | 18 | if (!update) { | 
| 16 | return defHttp.post<MenuOperationApiResult>( | 19 | return defHttp.post<MenuOperationApiResult>( | 
| @@ -23,6 +26,9 @@ export function saveMenuApi(params: MenuOperationParams, update: boolean = false | @@ -23,6 +26,9 @@ export function saveMenuApi(params: MenuOperationParams, update: boolean = false | ||
| 23 | } | 26 | } | 
| 24 | ); | 27 | ); | 
| 25 | } else { | 28 | } else { | 
| 26 | - return defHttp.put<MenuOperationApiResult>({url: Api.Save, params}, {errorMessageMode: mode}); | 29 | + return defHttp.put<MenuOperationApiResult>( | 
| 30 | + { url: Api.Save, params }, | ||
| 31 | + { errorMessageMode: mode } | ||
| 32 | + ); | ||
| 27 | } | 33 | } | 
| 28 | } | 34 | } | 
| 1 | -export enum InputRegExp{ | 1 | +export enum InputRegExp { | 
| 2 | /** | 2 | /** | 
| 3 | * 密码中必须包含大小写 字母、数字、特称字符,至少8个字符,最多30个字符; | 3 | * 密码中必须包含大小写 字母、数字、特称字符,至少8个字符,最多30个字符; | 
| 4 | */ | 4 | */ | 
| 5 | - PASSWORD_INPUT='(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,30}' | 5 | + PASSWORD_INPUT = '(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,30}', | 
| 6 | } | 6 | } | 
| 1 | export enum RoleEnum { | 1 | export enum RoleEnum { | 
| 2 | - ROLE_SYS_ADMIN = "ROLE_SYS_ADMIN", | ||
| 3 | - ROLE_TENANT_ADMIN = "ROLE_TENANT_ADMIN", | ||
| 4 | - ROLE_NORMAL_USER = "ROLE_NORMAL_USER", | ||
| 5 | - ROLE_PLATFORM_ADMIN="ROLE_PLATFORM_ADMIN" | 2 | + ROLE_SYS_ADMIN = 'ROLE_SYS_ADMIN', | 
| 3 | + ROLE_TENANT_ADMIN = 'ROLE_TENANT_ADMIN', | ||
| 4 | + ROLE_NORMAL_USER = 'ROLE_NORMAL_USER', | ||
| 5 | + ROLE_PLATFORM_ADMIN = 'ROLE_PLATFORM_ADMIN', | ||
| 6 | } | 6 | } | 
| 1 | export default { | 1 | export default { | 
| 2 | - common:{ | ||
| 3 | - createTime:"create time", | ||
| 4 | - updateTime:"update time", | ||
| 5 | - operation:"operation", | ||
| 6 | - remark:"remark", | ||
| 7 | - enable:"enable", | ||
| 8 | - disable:"disable", | ||
| 9 | - sort:"sort", | ||
| 10 | - status:"status", | 2 | + common: { | 
| 3 | + createTime: 'create time', | ||
| 4 | + updateTime: 'update time', | ||
| 5 | + operation: 'operation', | ||
| 6 | + remark: 'remark', | ||
| 7 | + enable: 'enable', | ||
| 8 | + disable: 'disable', | ||
| 9 | + sort: 'sort', | ||
| 10 | + status: 'status', | ||
| 11 | }, | 11 | }, | 
| 12 | - tenant:{ | ||
| 13 | - tenant:"tenant", | ||
| 14 | - tenantManagement:"tenant management", | ||
| 15 | - tenantSetting:"tenant setting" | ||
| 16 | - }, | ||
| 17 | - organization:{ | ||
| 18 | - queryOrganizationName:"organization name", | ||
| 19 | - toolOrganizationList:"organization list", | ||
| 20 | - toolCreateOrganization:"create organization", | ||
| 21 | - toolEditOrganization:"edit organization", | ||
| 22 | - parentOrganization:"parent organization", | 12 | + tenant: { | 
| 13 | + tenant: 'tenant', | ||
| 14 | + tenantManagement: 'tenant management', | ||
| 15 | + tenantSetting: 'tenant setting', | ||
| 23 | }, | 16 | }, | 
| 24 | - dept:{ | ||
| 25 | - queryDeptName:"dept name", | ||
| 26 | - queryDeptStatus:"status", | ||
| 27 | - toolDeptList:"dept list", | ||
| 28 | - toolCreateDept:"create dept", | ||
| 29 | - toolEditDept:"edit dept", | ||
| 30 | - tableTitleDeptSort:"sort", | ||
| 31 | - tableTitleDeptCreateTime:"create time", | ||
| 32 | - tableTitleDeptOperation:"operation", | ||
| 33 | - drawerTitleDeptEnable:"enable", | ||
| 34 | - drawerTitleDeptDisable:"disable", | ||
| 35 | - drawerTitleDeptParentDept:"parent dept", | ||
| 36 | - tableTitleMemo:"memo" | 17 | + organization: { | 
| 18 | + queryOrganizationName: 'organization name', | ||
| 19 | + toolOrganizationList: 'organization list', | ||
| 20 | + toolCreateOrganization: 'create organization', | ||
| 21 | + toolEditOrganization: 'edit organization', | ||
| 22 | + parentOrganization: 'parent organization', | ||
| 37 | }, | 23 | }, | 
| 38 | - system:{ | ||
| 39 | - system:"system", | ||
| 40 | - accountManagement:"account management", | ||
| 41 | - roleManagement:"role management", | ||
| 42 | - menuManagement:"menu management", | ||
| 43 | - deptManagement:"dept management", | ||
| 44 | - modifyPassword:"modify password", | ||
| 45 | - pageSystemTitleCreateMenu:"create menu", | ||
| 46 | - pageSystemTitleCreateTenant:"new tenant", | ||
| 47 | - pageSystemTitleEditMenu:"edit menu", | ||
| 48 | - pageSystemTitleEditTenant:"edit tenant", | ||
| 49 | - pageSystemTitleOperation:"operation", | ||
| 50 | - pageSystemTitleWhetherDelete:"Are you sure to delete", | ||
| 51 | - pageSystemTitleMenuList:"menu list", | ||
| 52 | - menuEditPagesMenuType:"menu type", | ||
| 53 | - menuEditPagesDirectory:"directory", | ||
| 54 | - menuEditPagesMenu:"menu", | ||
| 55 | - menuEditPagesButton:"button", | ||
| 56 | - menuEditPagesParentMenu:"parent menu", | ||
| 57 | - menuEditPagesRouterAddress:"router address", | ||
| 58 | - menuEditPagesComponentsPath:"components", | ||
| 59 | - menuEditPagesIsExt:"is ext", | ||
| 60 | - menuEditPagesIsKeepAlive:"is keep alive", | ||
| 61 | - menuEditPagesIsHide:"is hide", | ||
| 62 | - menuEditPagesYes:"yes", | ||
| 63 | - menuEditPagesNo:"no", | ||
| 64 | - tableTitleSystemMenuName:"menu name", | ||
| 65 | - tableTitleSystemIcon:"icon", | ||
| 66 | - tableTitleSystemPermissionTag:"permission tag", | ||
| 67 | - tableTitleSystemComponents:"components", | ||
| 68 | - tableTitleSystemSort:"sort", | ||
| 69 | - tableTitleSystemStatus:"status", | ||
| 70 | - tableTitleSystemCreateTime:"create time", | ||
| 71 | - tableTitleSystemEnable:"enable", | ||
| 72 | - tableTitleSystemStop:"disable", | ||
| 73 | - tableSuccessStatus:"success", | ||
| 74 | - tableFailedStatus:"failed", | ||
| 75 | - } | ||
| 76 | - }; | 24 | + dept: { | 
| 25 | + queryDeptName: 'dept name', | ||
| 26 | + queryDeptStatus: 'status', | ||
| 27 | + toolDeptList: 'dept list', | ||
| 28 | + toolCreateDept: 'create dept', | ||
| 29 | + toolEditDept: 'edit dept', | ||
| 30 | + tableTitleDeptSort: 'sort', | ||
| 31 | + tableTitleDeptCreateTime: 'create time', | ||
| 32 | + tableTitleDeptOperation: 'operation', | ||
| 33 | + drawerTitleDeptEnable: 'enable', | ||
| 34 | + drawerTitleDeptDisable: 'disable', | ||
| 35 | + drawerTitleDeptParentDept: 'parent dept', | ||
| 36 | + tableTitleMemo: 'memo', | ||
| 37 | + }, | ||
| 38 | + system: { | ||
| 39 | + system: 'system', | ||
| 40 | + accountManagement: 'account management', | ||
| 41 | + roleManagement: 'role management', | ||
| 42 | + menuManagement: 'menu management', | ||
| 43 | + deptManagement: 'dept management', | ||
| 44 | + modifyPassword: 'modify password', | ||
| 45 | + pageSystemTitleCreateMenu: 'create menu', | ||
| 46 | + pageSystemTitleCreateTenant: 'new tenant', | ||
| 47 | + pageSystemTitleEditMenu: 'edit menu', | ||
| 48 | + pageSystemTitleEditTenant: 'edit tenant', | ||
| 49 | + pageSystemTitleOperation: 'operation', | ||
| 50 | + pageSystemTitleWhetherDelete: 'Are you sure to delete', | ||
| 51 | + pageSystemTitleMenuList: 'menu list', | ||
| 52 | + menuEditPagesMenuType: 'menu type', | ||
| 53 | + menuEditPagesDirectory: 'directory', | ||
| 54 | + menuEditPagesMenu: 'menu', | ||
| 55 | + menuEditPagesButton: 'button', | ||
| 56 | + menuEditPagesParentMenu: 'parent menu', | ||
| 57 | + menuEditPagesRouterAddress: 'router address', | ||
| 58 | + menuEditPagesComponentsPath: 'components', | ||
| 59 | + menuEditPagesIsExt: 'is ext', | ||
| 60 | + menuEditPagesIsKeepAlive: 'is keep alive', | ||
| 61 | + menuEditPagesIsHide: 'is hide', | ||
| 62 | + menuEditPagesYes: 'yes', | ||
| 63 | + menuEditPagesNo: 'no', | ||
| 64 | + tableTitleSystemMenuName: 'menu name', | ||
| 65 | + tableTitleSystemIcon: 'icon', | ||
| 66 | + tableTitleSystemPermissionTag: 'permission tag', | ||
| 67 | + tableTitleSystemComponents: 'components', | ||
| 68 | + tableTitleSystemSort: 'sort', | ||
| 69 | + tableTitleSystemStatus: 'status', | ||
| 70 | + tableTitleSystemCreateTime: 'create time', | ||
| 71 | + tableTitleSystemEnable: 'enable', | ||
| 72 | + tableTitleSystemStop: 'disable', | ||
| 73 | + tableSuccessStatus: 'success', | ||
| 74 | + tableFailedStatus: 'failed', | ||
| 75 | + }, | ||
| 76 | +}; | 
| @@ -2,7 +2,7 @@ export default { | @@ -2,7 +2,7 @@ export default { | ||
| 2 | api: { | 2 | api: { | 
| 3 | operationFailed: 'Operation failed', | 3 | operationFailed: 'Operation failed', | 
| 4 | errorTip: 'Error Tip', | 4 | errorTip: 'Error Tip', | 
| 5 | - passwordOrUserNameError:'username or password not correct', | 5 | + passwordOrUserNameError: 'username or password not correct', | 
| 6 | loginFailed: 'Login Failed', | 6 | loginFailed: 'Login Failed', | 
| 7 | errorMessage: 'The operation failed, the system is abnormal!', | 7 | errorMessage: 'The operation failed, the system is abnormal!', | 
| 8 | timeoutMessage: 'Login timed out, please log in again!', | 8 | timeoutMessage: 'Login timed out, please log in again!', | 
| @@ -2,7 +2,7 @@ export default { | @@ -2,7 +2,7 @@ export default { | ||
| 2 | api: { | 2 | api: { | 
| 3 | operationFailed: '操作失败', | 3 | operationFailed: '操作失败', | 
| 4 | errorTip: '错误提示', | 4 | errorTip: '错误提示', | 
| 5 | - passwordOrUserNameError:'用户名或密码不正确', | 5 | + passwordOrUserNameError: '用户名或密码不正确', | 
| 6 | loginFailed: '登录失败', | 6 | loginFailed: '登录失败', | 
| 7 | errorMessage: '操作失败,系统异常!', | 7 | errorMessage: '操作失败,系统异常!', | 
| 8 | timeoutMessage: '登录超时,请重新登录!', | 8 | timeoutMessage: '登录超时,请重新登录!', | 
| @@ -63,9 +63,9 @@ export function initAppConfigStore() { | @@ -63,9 +63,9 @@ export function initAppConfigStore() { | ||
| 63 | // init store | 63 | // init store | 
| 64 | localeStore.initLocale(); | 64 | localeStore.initLocale(); | 
| 65 | 65 | ||
| 66 | - const userInfo = Persistent.getLocal(USER_INFO_KEY) as UserInfo | 66 | + const userInfo = Persistent.getLocal(USER_INFO_KEY) as UserInfo; | 
| 67 | const userStore = useUserStore(); | 67 | const userStore = useUserStore(); | 
| 68 | - if(userInfo){ | 68 | + if (userInfo) { | 
| 69 | userStore.setUserInfo(userInfo); | 69 | userStore.setUserInfo(userInfo); | 
| 70 | userStore.jwtToken = Persistent.getLocal(JWT_TOKEN_KEY) as string; | 70 | userStore.jwtToken = Persistent.getLocal(JWT_TOKEN_KEY) as string; | 
| 71 | userStore.refreshToken = Persistent.getLocal(REFRESH_TOKEN_KEY) as string; | 71 | userStore.refreshToken = Persistent.getLocal(REFRESH_TOKEN_KEY) as string; | 
| @@ -188,7 +188,7 @@ export const usePermissionStore = defineStore({ | @@ -188,7 +188,7 @@ export const usePermissionStore = defineStore({ | ||
| 188 | routeList = (await getMenuList()) as AppRouteRecordRaw[]; | 188 | routeList = (await getMenuList()) as AppRouteRecordRaw[]; | 
| 189 | } catch (error) { | 189 | } catch (error) { | 
| 190 | console.error(error); | 190 | console.error(error); | 
| 191 | - } // Dynamically introduce components | 191 | + } // Dynamically introduce components | 
| 192 | routeList = transformObjToRoute(routeList); | 192 | routeList = transformObjToRoute(routeList); | 
| 193 | 193 | ||
| 194 | // Background routing to menu structure | 194 | // Background routing to menu structure | 
| @@ -4,15 +4,21 @@ import { defineStore } from 'pinia'; | @@ -4,15 +4,21 @@ import { defineStore } from 'pinia'; | ||
| 4 | import { store } from '/@/store'; | 4 | import { store } from '/@/store'; | 
| 5 | import { RoleEnum } from '/@/enums/roleEnum'; | 5 | import { RoleEnum } from '/@/enums/roleEnum'; | 
| 6 | import { PageEnum } from '/@/enums/pageEnum'; | 6 | import { PageEnum } from '/@/enums/pageEnum'; | 
| 7 | -import { JWT_TOKEN_KEY, REFRESH_TOKEN_KEY, ROLES_KEY, TOKEN_KEY, USER_INFO_KEY } from '/@/enums/cacheEnum'; | 7 | +import { | 
| 8 | + JWT_TOKEN_KEY, | ||
| 9 | + REFRESH_TOKEN_KEY, | ||
| 10 | + ROLES_KEY, | ||
| 11 | + TOKEN_KEY, | ||
| 12 | + USER_INFO_KEY, | ||
| 13 | +} from '/@/enums/cacheEnum'; | ||
| 8 | import { getAuthCache, setAuthCache } from '/@/utils/auth'; | 14 | import { getAuthCache, setAuthCache } from '/@/utils/auth'; | 
| 9 | import { | 15 | import { | 
| 10 | LoginParams, | 16 | LoginParams, | 
| 11 | LoginResultModel, | 17 | LoginResultModel, | 
| 12 | RefreshTokenParams, | 18 | RefreshTokenParams, | 
| 13 | - SmsLoginParams | 19 | + SmsLoginParams, | 
| 14 | } from '/@/api/sys/model/userModel'; | 20 | } from '/@/api/sys/model/userModel'; | 
| 15 | -import {doRefreshToken, getMyInfo, loginApi, smsCodeLoginApi} from '/@/api/sys/user'; | 21 | +import { doRefreshToken, getMyInfo, loginApi, smsCodeLoginApi } from '/@/api/sys/user'; | 
| 16 | import { useI18n } from '/@/hooks/web/useI18n'; | 22 | import { useI18n } from '/@/hooks/web/useI18n'; | 
| 17 | import { useMessage } from '/@/hooks/web/useMessage'; | 23 | import { useMessage } from '/@/hooks/web/useMessage'; | 
| 18 | import { router } from '/@/router'; | 24 | import { router } from '/@/router'; | 
| @@ -26,8 +32,8 @@ interface UserState { | @@ -26,8 +32,8 @@ interface UserState { | ||
| 26 | roleList: RoleEnum[]; | 32 | roleList: RoleEnum[]; | 
| 27 | sessionTimeout?: boolean; | 33 | sessionTimeout?: boolean; | 
| 28 | lastUpdateTime: number; | 34 | lastUpdateTime: number; | 
| 29 | - jwtToken?:string; | ||
| 30 | - refreshToken?:string; | 35 | + jwtToken?: string; | 
| 36 | + refreshToken?: string; | ||
| 31 | } | 37 | } | 
| 32 | 38 | ||
| 33 | export const useUserStore = defineStore({ | 39 | export const useUserStore = defineStore({ | 
| @@ -38,7 +44,7 @@ export const useUserStore = defineStore({ | @@ -38,7 +44,7 @@ export const useUserStore = defineStore({ | ||
| 38 | // token | 44 | // token | 
| 39 | jwtToken: undefined, | 45 | jwtToken: undefined, | 
| 40 | //refresh Token | 46 | //refresh Token | 
| 41 | - refreshToken:undefined, | 47 | + refreshToken: undefined, | 
| 42 | // roleList | 48 | // roleList | 
| 43 | roleList: [], | 49 | roleList: [], | 
| 44 | // Whether the login expired | 50 | // Whether the login expired | 
| @@ -67,11 +73,11 @@ export const useUserStore = defineStore({ | @@ -67,11 +73,11 @@ export const useUserStore = defineStore({ | ||
| 67 | }, | 73 | }, | 
| 68 | }, | 74 | }, | 
| 69 | actions: { | 75 | actions: { | 
| 70 | - storeToken(jwtToken:string,refreshToken:string){ | 76 | + storeToken(jwtToken: string, refreshToken: string) { | 
| 71 | this.jwtToken = jwtToken; | 77 | this.jwtToken = jwtToken; | 
| 72 | this.refreshToken = refreshToken; | 78 | this.refreshToken = refreshToken; | 
| 73 | - setAuthCache(JWT_TOKEN_KEY,jwtToken); | ||
| 74 | - setAuthCache(REFRESH_TOKEN_KEY,refreshToken); | 79 | + setAuthCache(JWT_TOKEN_KEY, jwtToken); | 
| 80 | + setAuthCache(REFRESH_TOKEN_KEY, refreshToken); | ||
| 75 | }, | 81 | }, | 
| 76 | setToken(info: string | undefined) { | 82 | setToken(info: string | undefined) { | 
| 77 | this.token = info; | 83 | this.token = info; | 
| @@ -107,34 +113,34 @@ export const useUserStore = defineStore({ | @@ -107,34 +113,34 @@ export const useUserStore = defineStore({ | ||
| 107 | try { | 113 | try { | 
| 108 | const { goHome = true, mode, ...loginParams } = params; | 114 | const { goHome = true, mode, ...loginParams } = params; | 
| 109 | const data = await loginApi(loginParams, mode); | 115 | const data = await loginApi(loginParams, mode); | 
| 110 | - return this.process(data,goHome); | 116 | + return this.process(data, goHome); | 
| 111 | } catch (error) { | 117 | } catch (error) { | 
| 112 | return Promise.reject(error); | 118 | return Promise.reject(error); | 
| 113 | } | 119 | } | 
| 114 | }, | 120 | }, | 
| 115 | - async process(data: LoginResultModel, goHome?: boolean): Promise<UserInfo | null> { | ||
| 116 | - const {token, refreshToken} = data; | ||
| 117 | - this.storeToken(token, refreshToken); | ||
| 118 | - // get user info | ||
| 119 | - const userInfo = await this.getMyUserInfoAction(); | 121 | + async process(data: LoginResultModel, goHome?: boolean): Promise<UserInfo | null> { | 
| 122 | + const { token, refreshToken } = data; | ||
| 123 | + this.storeToken(token, refreshToken); | ||
| 124 | + // get user info | ||
| 125 | + const userInfo = await this.getMyUserInfoAction(); | ||
| 120 | 126 | ||
| 121 | - const sessionTimeout = this.sessionTimeout; | ||
| 122 | - if (sessionTimeout) { | ||
| 123 | - this.setSessionTimeout(false); | ||
| 124 | - } else if (goHome) { | ||
| 125 | - const permissionStore = usePermissionStore(); | ||
| 126 | - if (!permissionStore.isDynamicAddedRoute) { | ||
| 127 | - const routes = await permissionStore.buildRoutesAction(); | ||
| 128 | - routes.forEach((route) => { | ||
| 129 | - router.addRoute(route as unknown as RouteRecordRaw); | ||
| 130 | - }); | ||
| 131 | - router.addRoute(PAGE_NOT_FOUND_ROUTE as unknown as RouteRecordRaw); | ||
| 132 | - permissionStore.setDynamicAddedRoute(true); | ||
| 133 | - } | ||
| 134 | - await router.replace(userInfo.homePath || PageEnum.BASE_HOME); | ||
| 135 | - } | ||
| 136 | - return userInfo; | ||
| 137 | - }, | 127 | + const sessionTimeout = this.sessionTimeout; | 
| 128 | + if (sessionTimeout) { | ||
| 129 | + this.setSessionTimeout(false); | ||
| 130 | + } else if (goHome) { | ||
| 131 | + const permissionStore = usePermissionStore(); | ||
| 132 | + if (!permissionStore.isDynamicAddedRoute) { | ||
| 133 | + const routes = await permissionStore.buildRoutesAction(); | ||
| 134 | + routes.forEach((route) => { | ||
| 135 | + router.addRoute(route as unknown as RouteRecordRaw); | ||
| 136 | + }); | ||
| 137 | + router.addRoute(PAGE_NOT_FOUND_ROUTE as unknown as RouteRecordRaw); | ||
| 138 | + permissionStore.setDynamicAddedRoute(true); | ||
| 139 | + } | ||
| 140 | + await router.replace(userInfo.homePath || PageEnum.BASE_HOME); | ||
| 141 | + } | ||
| 142 | + return userInfo; | ||
| 143 | + }, | ||
| 138 | async smsCodelogin( | 144 | async smsCodelogin( | 
| 139 | params: SmsLoginParams & { | 145 | params: SmsLoginParams & { | 
| 140 | goHome?: boolean; | 146 | goHome?: boolean; | 
| @@ -144,7 +150,7 @@ export const useUserStore = defineStore({ | @@ -144,7 +150,7 @@ export const useUserStore = defineStore({ | ||
| 144 | try { | 150 | try { | 
| 145 | const { goHome = true, mode, ...loginParams } = params; | 151 | const { goHome = true, mode, ...loginParams } = params; | 
| 146 | const data = await smsCodeLoginApi(loginParams, mode); | 152 | const data = await smsCodeLoginApi(loginParams, mode); | 
| 147 | - return this.process(data,goHome); | 153 | + return this.process(data, goHome); | 
| 148 | } catch (error) { | 154 | } catch (error) { | 
| 149 | return Promise.reject(error); | 155 | return Promise.reject(error); | 
| 150 | } | 156 | } | 
| @@ -167,21 +173,21 @@ export const useUserStore = defineStore({ | @@ -167,21 +173,21 @@ export const useUserStore = defineStore({ | ||
| 167 | // console.log('注销Token失败'); | 173 | // console.log('注销Token失败'); | 
| 168 | // } | 174 | // } | 
| 169 | this.resetState(); | 175 | this.resetState(); | 
| 170 | - setAuthCache(JWT_TOKEN_KEY,undefined); | ||
| 171 | - setAuthCache(REFRESH_TOKEN_KEY,undefined); | 176 | + setAuthCache(JWT_TOKEN_KEY, undefined); | 
| 177 | + setAuthCache(REFRESH_TOKEN_KEY, undefined); | ||
| 172 | // this.setSessionTimeout(false); | 178 | // this.setSessionTimeout(false); | 
| 173 | // goLogin && router.push(PageEnum.BASE_LOGIN); | 179 | // goLogin && router.push(PageEnum.BASE_LOGIN); | 
| 174 | await router.push(PageEnum.BASE_LOGIN); | 180 | await router.push(PageEnum.BASE_LOGIN); | 
| 175 | }, | 181 | }, | 
| 176 | 182 | ||
| 177 | - async doRefresh(){ | ||
| 178 | - try{ | ||
| 179 | - const req = {"refreshToken":this.refreshToken} as RefreshTokenParams; | 183 | + async doRefresh() { | 
| 184 | + try { | ||
| 185 | + const req = { refreshToken: this.refreshToken } as RefreshTokenParams; | ||
| 180 | const data = await doRefreshToken(req); | 186 | const data = await doRefreshToken(req); | 
| 181 | const { token, refreshToken } = data; | 187 | const { token, refreshToken } = data; | 
| 182 | - this.storeToken(token,refreshToken); | ||
| 183 | - }catch(error){ | ||
| 184 | - this.logout() | 188 | + this.storeToken(token, refreshToken); | 
| 189 | + } catch (error) { | ||
| 190 | + this.logout(); | ||
| 185 | } | 191 | } | 
| 186 | }, | 192 | }, | 
| 187 | 193 | ||
| @@ -207,4 +213,3 @@ export const useUserStore = defineStore({ | @@ -207,4 +213,3 @@ export const useUserStore = defineStore({ | ||
| 207 | export function useUserStoreWithOut() { | 213 | export function useUserStoreWithOut() { | 
| 208 | return useUserStore(store); | 214 | return useUserStore(store); | 
| 209 | } | 215 | } | 
| 210 | - | 
| 1 | import { Persistent, BasicKeys } from '/@/utils/cache/persistent'; | 1 | import { Persistent, BasicKeys } from '/@/utils/cache/persistent'; | 
| 2 | import { CacheTypeEnum } from '/@/enums/cacheEnum'; | 2 | import { CacheTypeEnum } from '/@/enums/cacheEnum'; | 
| 3 | import projectSetting from '/@/settings/projectSetting'; | 3 | import projectSetting from '/@/settings/projectSetting'; | 
| 4 | -import { JWT_TOKEN_KEY,REFRESH_TOKEN_KEY } from '/@/enums/cacheEnum'; | 4 | +import { JWT_TOKEN_KEY, REFRESH_TOKEN_KEY } from '/@/enums/cacheEnum'; | 
| 5 | 5 | ||
| 6 | const { permissionCacheType } = projectSetting; | 6 | const { permissionCacheType } = projectSetting; | 
| 7 | const isLocal = permissionCacheType === CacheTypeEnum.LOCAL; | 7 | const isLocal = permissionCacheType === CacheTypeEnum.LOCAL; | 
| @@ -20,9 +20,9 @@ export function clearAuthCache(immediate = true) { | @@ -20,9 +20,9 @@ export function clearAuthCache(immediate = true) { | ||
| 20 | const fn = isLocal ? Persistent.clearLocal : Persistent.clearSession; | 20 | const fn = isLocal ? Persistent.clearLocal : Persistent.clearSession; | 
| 21 | return fn(immediate); | 21 | return fn(immediate); | 
| 22 | } | 22 | } | 
| 23 | -export function getJwtToken(){ | ||
| 24 | - return getAuthCache(JWT_TOKEN_KEY); | 23 | +export function getJwtToken() { | 
| 24 | + return getAuthCache(JWT_TOKEN_KEY); | ||
| 25 | } | 25 | } | 
| 26 | -export function getRefreshToken(){ | 26 | +export function getRefreshToken() { | 
| 27 | return getAuthCache(REFRESH_TOKEN_KEY); | 27 | return getAuthCache(REFRESH_TOKEN_KEY); | 
| 28 | } | 28 | } | 
| @@ -105,11 +105,23 @@ window.addEventListener('beforeunload', function () { | @@ -105,11 +105,23 @@ window.addEventListener('beforeunload', function () { | ||
| 105 | // LOCK_INFO_KEY 在锁屏和解锁时写入,此处也不应修改 | 105 | // LOCK_INFO_KEY 在锁屏和解锁时写入,此处也不应修改 | 
| 106 | ls.set(APP_LOCAL_CACHE_KEY, { | 106 | ls.set(APP_LOCAL_CACHE_KEY, { | 
| 107 | ...omit(localMemory.getCache, LOCK_INFO_KEY), | 107 | ...omit(localMemory.getCache, LOCK_INFO_KEY), | 
| 108 | - ...pick(ls.get(APP_LOCAL_CACHE_KEY), [TOKEN_KEY,JWT_TOKEN_KEY,REFRESH_TOKEN_KEY, USER_INFO_KEY, LOCK_INFO_KEY]), | 108 | + ...pick(ls.get(APP_LOCAL_CACHE_KEY), [ | 
| 109 | + TOKEN_KEY, | ||
| 110 | + JWT_TOKEN_KEY, | ||
| 111 | + REFRESH_TOKEN_KEY, | ||
| 112 | + USER_INFO_KEY, | ||
| 113 | + LOCK_INFO_KEY, | ||
| 114 | + ]), | ||
| 109 | }); | 115 | }); | 
| 110 | ss.set(APP_SESSION_CACHE_KEY, { | 116 | ss.set(APP_SESSION_CACHE_KEY, { | 
| 111 | ...omit(sessionMemory.getCache, LOCK_INFO_KEY), | 117 | ...omit(sessionMemory.getCache, LOCK_INFO_KEY), | 
| 112 | - ...pick(ss.get(APP_SESSION_CACHE_KEY), [TOKEN_KEY,JWT_TOKEN_KEY,REFRESH_TOKEN_KEY, USER_INFO_KEY, LOCK_INFO_KEY]), | 118 | + ...pick(ss.get(APP_SESSION_CACHE_KEY), [ | 
| 119 | + TOKEN_KEY, | ||
| 120 | + JWT_TOKEN_KEY, | ||
| 121 | + REFRESH_TOKEN_KEY, | ||
| 122 | + USER_INFO_KEY, | ||
| 123 | + LOCK_INFO_KEY, | ||
| 124 | + ]), | ||
| 113 | }); | 125 | }); | 
| 114 | }); | 126 | }); | 
| 115 | 127 | 
| 1 | /* list To Tree */ | 1 | /* list To Tree */ | 
| 2 | 2 | ||
| 3 | -import {getMenuListResultModel} from "/@/api/sys/model/menuModel"; | ||
| 4 | -import {useI18n} from "/@/hooks/web/useI18n"; | ||
| 5 | - | 3 | +import { getMenuListResultModel } from '/@/api/sys/model/menuModel'; | 
| 4 | +import { useI18n } from '/@/hooks/web/useI18n'; | ||
| 6 | 5 | ||
| 7 | export function listToTree(lists: getMenuListResultModel): getMenuListResultModel { | 6 | export function listToTree(lists: getMenuListResultModel): getMenuListResultModel { | 
| 8 | const { t } = useI18n(); //加载国际化 | 7 | const { t } = useI18n(); //加载国际化 | 
| 9 | - lists.forEach(goods => { | 8 | + lists.forEach((goods) => { | 
| 10 | goods['menuName'] = t(goods.meta.title); // 为goods添加属性menuName | 9 | goods['menuName'] = t(goods.meta.title); // 为goods添加属性menuName | 
| 11 | 10 | ||
| 12 | // console.log(goods.children?.length); | 11 | // console.log(goods.children?.length); | 
| 13 | - if(goods.children?.length){ | ||
| 14 | - goods.children.forEach(goodChildren => { | 12 | + if (goods.children?.length) { | 
| 13 | + goods.children.forEach((goodChildren) => { | ||
| 15 | goodChildren['menuName'] = t(goodChildren.meta.title); // 为goodChildren添加属性menuName | 14 | goodChildren['menuName'] = t(goodChildren.meta.title); // 为goodChildren添加属性menuName | 
| 16 | - }) | 15 | + }); | 
| 17 | } | 16 | } | 
| 18 | - }) | 17 | + }); | 
| 19 | 18 | ||
| 20 | return lists; | 19 | return lists; | 
| 21 | - | ||
| 22 | } | 20 | } | 
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - | ||
| 29 | - | 
src/views/alarm/position/config.data.ts
0 → 100644
| 1 | +import { FormSchema } from '/@/components/Table'; | ||
| 2 | +export const formSchema: FormSchema[] = [ | ||
| 3 | + { | ||
| 4 | + field: 'organization', | ||
| 5 | + label: '', | ||
| 6 | + component: 'TreeSelect', | ||
| 7 | + componentProps: {}, | ||
| 8 | + }, | ||
| 9 | + { | ||
| 10 | + field: 'organization', | ||
| 11 | + label: '', | ||
| 12 | + component: 'Select', | ||
| 13 | + componentProps: {}, | ||
| 14 | + }, | ||
| 15 | + { | ||
| 16 | + field: 'device', | ||
| 17 | + label: '', | ||
| 18 | + slot: 'device', | ||
| 19 | + component: 'Input', | ||
| 20 | + }, | ||
| 21 | +]; | 
src/views/alarm/position/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="wrapper"> | ||
| 3 | + <div ref="wrapRef" :style="{ height, width }"> </div> | ||
| 4 | + <div class="right-wrap"> | ||
| 5 | + <BasicForm @register="registerForm"> | ||
| 6 | + <template #device> | ||
| 7 | + <div class="flex justify-between"> | ||
| 8 | + <a-input v-model:value="deviceValue" placeholder="请输入设备名称" style="width: 70%" /> | ||
| 9 | + <a-button color="success" @click="handleReset" class="w-1/4">复位查询</a-button> | ||
| 10 | + </div> | ||
| 11 | + </template> | ||
| 12 | + </BasicForm> | ||
| 13 | + <div> | ||
| 14 | + <RadioGroup v-model:value="deviceStatus"> | ||
| 15 | + <Radio :value="1">全部</Radio> | ||
| 16 | + <Radio :value="2">在线</Radio> | ||
| 17 | + <Radio :value="3">离线</Radio> | ||
| 18 | + <Radio :value="4">报警</Radio> | ||
| 19 | + </RadioGroup> | ||
| 20 | + <div class="scroll-wrap"> | ||
| 21 | + <ScrollContainer ref="scrollRef"> | ||
| 22 | + <template v-for="item in 10" :key="item"> | ||
| 23 | + <div class="flex" style="border-bottom: 1px solid #ccc"> | ||
| 24 | + <div> | ||
| 25 | + <div class="flex"> | ||
| 26 | + <div class="font-bold ml-5">名称 </div> | ||
| 27 | + <div class="ml-5">发动机{{ item }}</div> | ||
| 28 | + </div> | ||
| 29 | + <div class="flex"> | ||
| 30 | + <div class="font-bold ml-5">位置 </div> | ||
| 31 | + <div class="ml-5 font-bold">四川省成都市高新区{{ item }}</div> | ||
| 32 | + </div> | ||
| 33 | + </div> | ||
| 34 | + <div class="self-center ml-10"><Tag color="default">离线</Tag></div> | ||
| 35 | + </div> | ||
| 36 | + </template> | ||
| 37 | + </ScrollContainer> | ||
| 38 | + </div> | ||
| 39 | + <div class="flex justify-end"> | ||
| 40 | + <Pagination v-model:current="current" :total="50" size="small" show-less-items /> | ||
| 41 | + </div> | ||
| 42 | + </div> | ||
| 43 | + </div> | ||
| 44 | + </div> | ||
| 45 | +</template> | ||
| 46 | +<script lang="ts"> | ||
| 47 | + import { defineComponent, ref, nextTick, unref, onMounted } from 'vue'; | ||
| 48 | + import { useScript } from '/@/hooks/web/useScript'; | ||
| 49 | + import { BasicForm, useForm } from '/@/components/Form/index'; | ||
| 50 | + import { formSchema } from './config.data'; | ||
| 51 | + import { RadioGroup, Radio, Tag, Pagination } from 'ant-design-vue'; | ||
| 52 | + import { ScrollContainer, ScrollActionType } from '/@/components/Container/index'; | ||
| 53 | + export default defineComponent({ | ||
| 54 | + name: 'BaiduMap', | ||
| 55 | + components: { | ||
| 56 | + BasicForm, | ||
| 57 | + RadioGroup, | ||
| 58 | + Radio, | ||
| 59 | + Tag, | ||
| 60 | + ScrollContainer, | ||
| 61 | + Pagination, | ||
| 62 | + }, | ||
| 63 | + props: { | ||
| 64 | + width: { | ||
| 65 | + type: String, | ||
| 66 | + default: '100%', | ||
| 67 | + }, | ||
| 68 | + height: { | ||
| 69 | + type: String, | ||
| 70 | + default: 'calc(100vh - 78px)', | ||
| 71 | + }, | ||
| 72 | + }, | ||
| 73 | + | ||
| 74 | + setup() { | ||
| 75 | + const BAI_DU_MAP_URL = | ||
| 76 | + 'https://api.map.baidu.com/getscript?v=3.0&ak=7uOPPyAHn2Y2ZryeQqHtcRqtIY374vKa'; | ||
| 77 | + const wrapRef = ref<HTMLDivElement | null>(null); | ||
| 78 | + const scrollRef = ref<Nullable<ScrollActionType>>(null); | ||
| 79 | + const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); | ||
| 80 | + async function initMap() { | ||
| 81 | + await toPromise(); | ||
| 82 | + await nextTick(); | ||
| 83 | + const wrapEl = unref(wrapRef); | ||
| 84 | + const BMap = (window as any).BMap; | ||
| 85 | + if (!wrapEl) return; | ||
| 86 | + const map = new BMap.Map(wrapEl); | ||
| 87 | + const point = new BMap.Point(116.14282, 35.19515); | ||
| 88 | + map.centerAndZoom(point, 15); | ||
| 89 | + map.enableScrollWheelZoom(true); | ||
| 90 | + } | ||
| 91 | + onMounted(() => { | ||
| 92 | + initMap(); | ||
| 93 | + }); | ||
| 94 | + | ||
| 95 | + const deviceValue = ref(''); | ||
| 96 | + const deviceStatus = ref(1); | ||
| 97 | + const current = ref(2); | ||
| 98 | + const [registerForm] = useForm({ | ||
| 99 | + labelWidth: 90, | ||
| 100 | + schemas: formSchema, | ||
| 101 | + showActionButtonGroup: false, | ||
| 102 | + }); | ||
| 103 | + const handleReset = () => { | ||
| 104 | + deviceValue.value = ''; | ||
| 105 | + }; | ||
| 106 | + return { wrapRef, registerForm, deviceValue, deviceStatus, handleReset, scrollRef, current }; | ||
| 107 | + }, | ||
| 108 | + }); | ||
| 109 | +</script> | ||
| 110 | + | ||
| 111 | +<style scoped> | ||
| 112 | + .wrapper { | ||
| 113 | + position: relative; | ||
| 114 | + } | ||
| 115 | + .right-wrap { | ||
| 116 | + padding-top: 10px; | ||
| 117 | + width: 20%; | ||
| 118 | + height: 80%; | ||
| 119 | + position: absolute; | ||
| 120 | + right: 5%; | ||
| 121 | + top: 10%; | ||
| 122 | + background-color: #f3f8fe; | ||
| 123 | + } | ||
| 124 | + .scroll-wrap { | ||
| 125 | + height: 450px; | ||
| 126 | + background-color: #f3f8fe; | ||
| 127 | + } | ||
| 128 | +</style> | 
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | @register="registerDrawer" | 4 | @register="registerDrawer" | 
| 5 | showFooter | 5 | showFooter | 
| 6 | :title="getTitle" | 6 | :title="getTitle" | 
| 7 | - width="500px" | 7 | + width="30%" | 
| 8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" | 
| 9 | > | 9 | > | 
| 10 | <BasicForm @register="registerForm" /> | 10 | <BasicForm @register="registerForm" /> | 
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | import { BasicForm, useForm } from '/@/components/Form'; | 15 | import { BasicForm, useForm } from '/@/components/Form'; | 
| 16 | import { formSchema } from './config.data'; | 16 | import { formSchema } from './config.data'; | 
| 17 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 17 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 
| 18 | - import { saveOrEditMessageConfig } from '/@/api/message/config'; | 18 | + import { saveOrEditAlarmContact } from '/@/api/alarm/contact/alarmContact'; | 
| 19 | import { useMessage } from '/@/hooks/web/useMessage'; | 19 | import { useMessage } from '/@/hooks/web/useMessage'; | 
| 20 | 20 | ||
| 21 | export default defineComponent({ | 21 | export default defineComponent({ | 
| @@ -36,41 +36,22 @@ | @@ -36,41 +36,22 @@ | ||
| 36 | setDrawerProps({ confirmLoading: false }); | 36 | setDrawerProps({ confirmLoading: false }); | 
| 37 | isUpdate.value = !!data?.isUpdate; | 37 | isUpdate.value = !!data?.isUpdate; | 
| 38 | if (unref(isUpdate)) { | 38 | if (unref(isUpdate)) { | 
| 39 | - const config = data.record.config; | ||
| 40 | - for (const key in config) { | ||
| 41 | - Reflect.set(data.record, key + '', config[key]); | ||
| 42 | - } | ||
| 43 | await setFieldsValue({ | 39 | await setFieldsValue({ | 
| 44 | ...data.record, | 40 | ...data.record, | 
| 45 | }); | 41 | }); | 
| 46 | } | 42 | } | 
| 47 | }); | 43 | }); | 
| 48 | 44 | ||
| 49 | - const getTitle = computed(() => (!unref(isUpdate) ? '新增消息配置' : '编辑消息配置')); | 45 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增联系人配置' : '编辑联系人配置')); | 
| 50 | 46 | ||
| 51 | async function handleSubmit() { | 47 | async function handleSubmit() { | 
| 52 | try { | 48 | try { | 
| 53 | const values = await validate(); | 49 | const values = await validate(); | 
| 54 | const { createMessage } = useMessage(); | 50 | const { createMessage } = useMessage(); | 
| 55 | setDrawerProps({ confirmLoading: true }); | 51 | setDrawerProps({ confirmLoading: true }); | 
| 56 | - let config = {}; | ||
| 57 | - if (values.messageType === 'PHONE_MESSAGE') { | ||
| 58 | - config = { | ||
| 59 | - accessKeyId: values.accessKeyId, | ||
| 60 | - accessKeySecret: values.accessKeySecret, | ||
| 61 | - }; | ||
| 62 | - } else if (values.messageType === 'EMAIL_MESSAGE') { | ||
| 63 | - config = { | ||
| 64 | - host: values.host, | ||
| 65 | - port: values.port, | ||
| 66 | - username: values.username, | ||
| 67 | - password: values.password, | ||
| 68 | - }; | ||
| 69 | - } | ||
| 70 | - Reflect.set(values, 'config', config); | ||
| 71 | let saveMessage = '添加成功'; | 52 | let saveMessage = '添加成功'; | 
| 72 | let updateMessage = '修改成功'; | 53 | let updateMessage = '修改成功'; | 
| 73 | - await saveOrEditMessageConfig(values, unref(isUpdate)); | 54 | + await saveOrEditAlarmContact(values, unref(isUpdate)); | 
| 74 | closeDrawer(); | 55 | closeDrawer(); | 
| 75 | emit('success'); | 56 | emit('success'); | 
| 76 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | 57 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | 
| @@ -80,9 +61,9 @@ | @@ -80,9 +61,9 @@ | ||
| 80 | } | 61 | } | 
| 81 | 62 | ||
| 82 | return { | 63 | return { | 
| 64 | + getTitle, | ||
| 83 | registerDrawer, | 65 | registerDrawer, | 
| 84 | registerForm, | 66 | registerForm, | 
| 85 | - getTitle, | ||
| 86 | handleSubmit, | 67 | handleSubmit, | 
| 87 | }; | 68 | }; | 
| 88 | }, | 69 | }, | 
| 1 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; | 
| 2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; | 
| 3 | -import { findDictItemByCode } from '/@/api/system/dict'; | ||
| 4 | -import { MessageEnum } from '/@/enums/messageEnum'; | 3 | +import { getOrganizationList } from '/@/api/system/system'; | 
| 5 | // 表格列数据 | 4 | // 表格列数据 | 
| 6 | export const columns: BasicColumn[] = [ | 5 | export const columns: BasicColumn[] = [ | 
| 7 | { | 6 | { | 
| 8 | title: '姓名', | 7 | title: '姓名', | 
| 9 | dataIndex: 'username', | 8 | dataIndex: 'username', | 
| 10 | - width: 100, | 9 | + width: 120, | 
| 11 | }, | 10 | }, | 
| 12 | { | 11 | { | 
| 13 | title: '所属组织', | 12 | title: '所属组织', | 
| 14 | - dataIndex: 'department', | ||
| 15 | - width: 200, | 13 | + dataIndex: 'organizationId', | 
| 14 | + width: 160, | ||
| 16 | }, | 15 | }, | 
| 17 | { | 16 | { | 
| 18 | title: '手机', | 17 | title: '手机', | 
| @@ -21,32 +20,32 @@ export const columns: BasicColumn[] = [ | @@ -21,32 +20,32 @@ export const columns: BasicColumn[] = [ | ||
| 21 | }, | 20 | }, | 
| 22 | { | 21 | { | 
| 23 | title: '邮箱', | 22 | title: '邮箱', | 
| 24 | - dataIndex: 'label', | 23 | + dataIndex: 'email', | 
| 25 | width: 160, | 24 | width: 160, | 
| 26 | }, | 25 | }, | 
| 27 | { | 26 | { | 
| 28 | title: '微信', | 27 | title: '微信', | 
| 29 | - dataIndex: 'deviceInfo', | 28 | + dataIndex: 'wechat', | 
| 30 | width: 180, | 29 | width: 180, | 
| 31 | }, | 30 | }, | 
| 32 | { | 31 | { | 
| 33 | title: '备注', | 32 | title: '备注', | 
| 34 | - dataIndex: 'deviceState', | 33 | + dataIndex: 'remark', | 
| 35 | width: 120, | 34 | width: 120, | 
| 36 | }, | 35 | }, | 
| 37 | { | 36 | { | 
| 38 | title: '添加人', | 37 | title: '添加人', | 
| 39 | - dataIndex: 'lastConnectTime', | 38 | + dataIndex: 'addPeople', | 
| 40 | width: 180, | 39 | width: 180, | 
| 41 | }, | 40 | }, | 
| 42 | { | 41 | { | 
| 43 | - title: '更新时间', | ||
| 44 | - dataIndex: 'updateTime', | 42 | + title: '添加时间', | 
| 43 | + dataIndex: 'createTime', | ||
| 45 | width: 180, | 44 | width: 180, | 
| 46 | }, | 45 | }, | 
| 47 | { | 46 | { | 
| 48 | - title: '添加时间', | ||
| 49 | - dataIndex: 'createTime', | 47 | + title: '更新时间', | 
| 48 | + dataIndex: 'updateTime', | ||
| 50 | width: 180, | 49 | width: 180, | 
| 51 | }, | 50 | }, | 
| 52 | ]; | 51 | ]; | 
| @@ -54,21 +53,12 @@ export const columns: BasicColumn[] = [ | @@ -54,21 +53,12 @@ export const columns: BasicColumn[] = [ | ||
| 54 | // 查询字段 | 53 | // 查询字段 | 
| 55 | export const searchFormSchema: FormSchema[] = [ | 54 | export const searchFormSchema: FormSchema[] = [ | 
| 56 | { | 55 | { | 
| 57 | - field: 'department', | ||
| 58 | - label: '所属组织', | ||
| 59 | - component: 'TreeSelect', | ||
| 60 | - componentProps: { | ||
| 61 | - placeholder: '请选择组织', | ||
| 62 | - }, | ||
| 63 | - colProps: { span: 6 }, | ||
| 64 | - }, | ||
| 65 | - { | ||
| 66 | field: 'username', | 56 | field: 'username', | 
| 67 | - label: '用户名', | 57 | + label: '联系人姓名', | 
| 68 | component: 'Input', | 58 | component: 'Input', | 
| 69 | colProps: { span: 6 }, | 59 | colProps: { span: 6 }, | 
| 70 | componentProps: { | 60 | componentProps: { | 
| 71 | - placeholder: '请输入姓名、手机号或邮箱', | 61 | + placeholder: '请输入联系人姓名', | 
| 72 | }, | 62 | }, | 
| 73 | }, | 63 | }, | 
| 74 | ]; | 64 | ]; | 
| @@ -76,117 +66,93 @@ export const searchFormSchema: FormSchema[] = [ | @@ -76,117 +66,93 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 76 | // 弹框配置项 | 66 | // 弹框配置项 | 
| 77 | export const formSchema: FormSchema[] = [ | 67 | export const formSchema: FormSchema[] = [ | 
| 78 | { | 68 | { | 
| 79 | - field: 'configName', | 69 | + field: 'username', | 
| 80 | label: '联系人姓名', | 70 | label: '联系人姓名', | 
| 81 | required: true, | 71 | required: true, | 
| 82 | component: 'Input', | 72 | component: 'Input', | 
| 73 | + componentProps: { | ||
| 74 | + placeholder: '请输入联系人姓名', | ||
| 75 | + }, | ||
| 83 | }, | 76 | }, | 
| 84 | { | 77 | { | 
| 85 | - field: 'messageType', | 78 | + field: 'organizationId', | 
| 86 | label: '所属组织', | 79 | label: '所属组织', | 
| 87 | - required: true, | ||
| 88 | - component: 'ApiSelect', | 80 | + component: 'ApiTreeSelect', | 
| 89 | componentProps: { | 81 | componentProps: { | 
| 90 | - api: findDictItemByCode, | ||
| 91 | - params: { | ||
| 92 | - dictCode: 'message_type', | 82 | + api: async () => { | 
| 83 | + const data = await getOrganizationList(); | ||
| 84 | + | ||
| 85 | + const copyTransFun = (arr: any[]) => { | ||
| 86 | + arr.forEach((item) => { | ||
| 87 | + if (item.name) { | ||
| 88 | + item.label = item.name; | ||
| 89 | + delete item.name; | ||
| 90 | + } | ||
| 91 | + if (item.id) { | ||
| 92 | + item.value = item.id; | ||
| 93 | + delete item.id; | ||
| 94 | + } | ||
| 95 | + if (item.children) { | ||
| 96 | + if (item.children.length) { | ||
| 97 | + copyTransFun(item.children); | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + }); | ||
| 101 | + }; | ||
| 102 | + copyTransFun(data as any as any[]); | ||
| 103 | + return data; | ||
| 93 | }, | 104 | }, | 
| 94 | - labelField: 'itemText', | ||
| 95 | - valueField: 'itemValue', | ||
| 96 | }, | 105 | }, | 
| 97 | }, | 106 | }, | 
| 98 | { | 107 | { | 
| 99 | - field: 'platformType', | 108 | + field: 'phone', | 
| 100 | label: '手机号码', | 109 | label: '手机号码', | 
| 101 | required: true, | 110 | required: true, | 
| 102 | component: 'Input', | 111 | component: 'Input', | 
| 103 | componentProps: { | 112 | componentProps: { | 
| 104 | - api: findDictItemByCode, | ||
| 105 | - params: { | ||
| 106 | - dictCode: 'platform_type', | ||
| 107 | - }, | ||
| 108 | - labelField: 'itemText', | ||
| 109 | - valueField: 'itemValue', | 113 | + placeholder: '请输入手机号码', | 
| 110 | }, | 114 | }, | 
| 111 | }, | 115 | }, | 
| 112 | { | 116 | { | 
| 113 | - field: 'accessKeyId', | ||
| 114 | - label: 'accessKeyId', | ||
| 115 | - required: true, | 117 | + field: 'email', | 
| 118 | + label: '邮箱', | ||
| 116 | component: 'Input', | 119 | component: 'Input', | 
| 117 | - ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | ||
| 118 | - }, | ||
| 119 | - { | ||
| 120 | - field: 'accessKeySecret', | ||
| 121 | - label: 'accessKeySecret', | ||
| 122 | - required: true, | ||
| 123 | - component: 'Input', | ||
| 124 | - ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 120 | + componentProps: { | 
| 121 | + placeholder: '请输入邮箱', | ||
| 122 | + }, | ||
| 125 | }, | 123 | }, | 
| 126 | { | 124 | { | 
| 127 | - field: 'host', | ||
| 128 | - label: '服务器地址', | ||
| 129 | - defaultValue: 'smtp.163.com', | ||
| 130 | - required: true, | 125 | + field: 'wechat', | 
| 126 | + label: '微信', | ||
| 131 | component: 'Input', | 127 | component: 'Input', | 
| 132 | - ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | ||
| 133 | - }, | ||
| 134 | - { | ||
| 135 | - field: 'port', | ||
| 136 | - label: '端口', | ||
| 137 | - defaultValue: 25, | ||
| 138 | - required: true, | ||
| 139 | - component: 'InputNumber', | ||
| 140 | - ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | 128 | + componentProps: { | 
| 129 | + placeholder: '请输入微信号', | ||
| 130 | + }, | ||
| 141 | }, | 131 | }, | 
| 142 | { | 132 | { | 
| 143 | - field: 'username', | ||
| 144 | - label: '用户名', | ||
| 145 | - required: true, | 133 | + field: 'addPeople', | 
| 134 | + label: '添加人', | ||
| 146 | component: 'Input', | 135 | component: 'Input', | 
| 147 | - ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | ||
| 148 | - }, | ||
| 149 | - { | ||
| 150 | - field: 'password', | ||
| 151 | - label: '密码', | ||
| 152 | - required: true, | ||
| 153 | - component: 'InputPassword', | ||
| 154 | - ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | 136 | + componentProps: { | 
| 137 | + placeholder: '请输入添加人', | ||
| 138 | + }, | ||
| 155 | }, | 139 | }, | 
| 156 | { | 140 | { | 
| 157 | - field: 'config', | ||
| 158 | - label: '消息配置', | ||
| 159 | - component: 'Input', | ||
| 160 | - show: false, | 141 | + field: 'remark', | 
| 142 | + label: '备注', | ||
| 143 | + component: 'InputTextArea', | ||
| 144 | + componentProps: { | ||
| 145 | + placeholder: '', | ||
| 146 | + }, | ||
| 161 | }, | 147 | }, | 
| 162 | { | 148 | { | 
| 163 | field: 'id', | 149 | field: 'id', | 
| 164 | - label: '主键', | 150 | + label: '', | 
| 165 | component: 'Input', | 151 | component: 'Input', | 
| 166 | - show: false, | ||
| 167 | - }, | ||
| 168 | - { | ||
| 169 | - field: 'status', | ||
| 170 | - label: '状态', | ||
| 171 | - component: 'RadioButtonGroup', | ||
| 172 | - defaultValue: 0, | ||
| 173 | componentProps: { | 152 | componentProps: { | 
| 174 | - options: [ | ||
| 175 | - { label: '启用', value: 1 }, | ||
| 176 | - { label: '停用', value: 0 }, | ||
| 177 | - ], | 153 | + style: { | 
| 154 | + display: 'none', | ||
| 155 | + }, | ||
| 178 | }, | 156 | }, | 
| 179 | }, | 157 | }, | 
| 180 | - { | ||
| 181 | - label: '备注', | ||
| 182 | - field: 'remark', | ||
| 183 | - component: 'InputTextArea', | ||
| 184 | - }, | ||
| 185 | ]; | 158 | ]; | 
| 186 | - | ||
| 187 | -export const isMessage = (type: string) => { | ||
| 188 | - return type === MessageEnum.IS_SMS; | ||
| 189 | -}; | ||
| 190 | -export const isEmail = (type: string) => { | ||
| 191 | - return type === MessageEnum.IS_EMAIL; | ||
| 192 | -}; | 
| 1 | <template> | 1 | <template> | 
| 2 | - <div> | ||
| 3 | - <BasicTable @register="registerTable"> | 2 | + <PageWrapper dense contentFullHeight fixedHeight contentClass="flex"> | 
| 3 | + <OrganizationIdTree class="w-1/4 xl:w-1/5" @select="handleSelect" /> | ||
| 4 | + <BasicTable | ||
| 5 | + @register="registerTable" | ||
| 6 | + :searchInfo="searchInfo" | ||
| 7 | + class="w-3/4 xl:w-4/5" | ||
| 8 | + :rowSelection="{ | ||
| 9 | + onChange: onSelectChange, | ||
| 10 | + type: 'checkbox', | ||
| 11 | + }" | ||
| 12 | + rowKey="id" | ||
| 13 | + > | ||
| 4 | <template #toolbar> | 14 | <template #toolbar> | 
| 5 | <a-button type="primary" @click="handleCreate"> 新增联系人 </a-button> | 15 | <a-button type="primary" @click="handleCreate"> 新增联系人 </a-button> | 
| 6 | - <a-button type="primary" color="error" @click="handleDelete"> 批量删除 </a-button> | 16 | + <a-button | 
| 17 | + type="primary" | ||
| 18 | + color="error" | ||
| 19 | + @click="handleBatchDelete" | ||
| 20 | + :disabled="hasBatchDelete" | ||
| 21 | + > | ||
| 22 | + 批量删除 | ||
| 23 | + </a-button> | ||
| 7 | </template> | 24 | </template> | 
| 8 | <template #action="{ record }"> | 25 | <template #action="{ record }"> | 
| 9 | <TableAction | 26 | <TableAction | 
| @@ -26,27 +43,31 @@ | @@ -26,27 +43,31 @@ | ||
| 26 | /> | 43 | /> | 
| 27 | </template> | 44 | </template> | 
| 28 | </BasicTable> | 45 | </BasicTable> | 
| 29 | - <ContactDrawer @register="registerDrawer" @success="handleSuccess" /> | ||
| 30 | - </div> | 46 | + </PageWrapper> | 
| 47 | + <ContactDrawer @register="registerDrawer" @success="handleSuccess" /> | ||
| 31 | </template> | 48 | </template> | 
| 32 | 49 | ||
| 33 | <script lang="ts"> | 50 | <script lang="ts"> | 
| 34 | - import { defineComponent } from 'vue'; | 51 | + import { defineComponent, reactive, ref, computed } from 'vue'; | 
| 35 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 52 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 
| 36 | - // import { useGo } from '/@/hooks/web/usePage'; | 53 | + import { PageWrapper } from '/@/components/Page'; | 
| 37 | import { useMessage } from '/@/hooks/web/useMessage'; | 54 | import { useMessage } from '/@/hooks/web/useMessage'; | 
| 38 | import { useDrawer } from '/@/components/Drawer'; | 55 | import { useDrawer } from '/@/components/Drawer'; | 
| 39 | import ContactDrawer from './ContactDrawer.vue'; | 56 | import ContactDrawer from './ContactDrawer.vue'; | 
| 57 | + import OrganizationIdTree from '../../common/OrganizationIdTree.vue'; | ||
| 40 | import { getAlarmContact, deleteAlarmContact } from '/@/api/alarm/contact/alarmContact'; | 58 | import { getAlarmContact, deleteAlarmContact } from '/@/api/alarm/contact/alarmContact'; | 
| 41 | import { searchFormSchema, columns } from './config.data'; | 59 | import { searchFormSchema, columns } from './config.data'; | 
| 42 | - import {} from '/@/api/alarm/contact/alarmContact'; | ||
| 43 | export default defineComponent({ | 60 | export default defineComponent({ | 
| 44 | components: { | 61 | components: { | 
| 62 | + PageWrapper, | ||
| 63 | + OrganizationIdTree, | ||
| 45 | BasicTable, | 64 | BasicTable, | 
| 46 | TableAction, | 65 | TableAction, | 
| 47 | ContactDrawer, | 66 | ContactDrawer, | 
| 48 | }, | 67 | }, | 
| 49 | setup() { | 68 | setup() { | 
| 69 | + let selectedRowIds = ref<string[]>([]); | ||
| 70 | + const hasBatchDelete = computed(() => selectedRowIds.value.length <= 0); | ||
| 50 | const [registerTable, { reload }] = useTable({ | 71 | const [registerTable, { reload }] = useTable({ | 
| 51 | api: getAlarmContact, | 72 | api: getAlarmContact, | 
| 52 | columns, | 73 | columns, | 
| @@ -68,20 +89,23 @@ | @@ -68,20 +89,23 @@ | ||
| 68 | }); | 89 | }); | 
| 69 | const [registerDrawer, { openDrawer }] = useDrawer(); | 90 | const [registerDrawer, { openDrawer }] = useDrawer(); | 
| 70 | const { createMessage } = useMessage(); | 91 | const { createMessage } = useMessage(); | 
| 92 | + const searchInfo = reactive<Recordable>({}); | ||
| 93 | + // 新增 | ||
| 71 | const handleCreate = () => { | 94 | const handleCreate = () => { | 
| 72 | openDrawer(true, { | 95 | openDrawer(true, { | 
| 73 | isUpdate: false, | 96 | isUpdate: false, | 
| 74 | }); | 97 | }); | 
| 75 | }; | 98 | }; | 
| 99 | + // 编辑 | ||
| 76 | const handleEdit = (record: Recordable) => { | 100 | const handleEdit = (record: Recordable) => { | 
| 77 | openDrawer(true, { | 101 | openDrawer(true, { | 
| 78 | - record, | ||
| 79 | isUpdate: true, | 102 | isUpdate: true, | 
| 103 | + record, | ||
| 80 | }); | 104 | }); | 
| 81 | }; | 105 | }; | 
| 106 | + // 删除 | ||
| 82 | const handleDelete = async (record: Recordable) => { | 107 | const handleDelete = async (record: Recordable) => { | 
| 83 | let ids: string[] = [record.id]; | 108 | let ids: string[] = [record.id]; | 
| 84 | - console.log(ids); | ||
| 85 | try { | 109 | try { | 
| 86 | await deleteAlarmContact(ids); | 110 | await deleteAlarmContact(ids); | 
| 87 | createMessage.success('删除联系人成功'); | 111 | createMessage.success('删除联系人成功'); | 
| @@ -90,14 +114,39 @@ | @@ -90,14 +114,39 @@ | ||
| 90 | createMessage.error('删除失败'); | 114 | createMessage.error('删除失败'); | 
| 91 | } | 115 | } | 
| 92 | }; | 116 | }; | 
| 117 | + // 批量删除 | ||
| 118 | + const handleBatchDelete = async () => { | ||
| 119 | + try { | ||
| 120 | + await deleteAlarmContact(selectedRowIds.value); | ||
| 121 | + createMessage.success('批量删除联系人成功'); | ||
| 122 | + handleSuccess(); | ||
| 123 | + } catch (e) { | ||
| 124 | + createMessage.error('删除失败'); | ||
| 125 | + } | ||
| 126 | + }; | ||
| 93 | // 刷新 | 127 | // 刷新 | 
| 94 | const handleSuccess = () => { | 128 | const handleSuccess = () => { | 
| 95 | reload(); | 129 | reload(); | 
| 96 | }; | 130 | }; | 
| 131 | + // 复选框事件 | ||
| 132 | + const onSelectChange = (selectedRowKeys: string[]) => { | ||
| 133 | + selectedRowIds.value = selectedRowKeys; | ||
| 134 | + }; | ||
| 135 | + const handleSelect = (organizationId = '') => { | ||
| 136 | + searchInfo.organizationId = organizationId; | ||
| 137 | + console.log(organizationId); | ||
| 138 | + reload(); | ||
| 139 | + }; | ||
| 97 | return { | 140 | return { | 
| 141 | + searchInfo, | ||
| 142 | + hasBatchDelete, | ||
| 143 | + onSelectChange, | ||
| 144 | + handleBatchDelete, | ||
| 98 | handleEdit, | 145 | handleEdit, | 
| 99 | handleCreate, | 146 | handleCreate, | 
| 100 | handleDelete, | 147 | handleDelete, | 
| 148 | + handleSelect, | ||
| 149 | + handleSuccess, | ||
| 101 | registerTable, | 150 | registerTable, | 
| 102 | registerDrawer, | 151 | registerDrawer, | 
| 103 | reload, | 152 | reload, | 
| @@ -2,10 +2,10 @@ import { BasicColumn } from '/@/components/Table'; | @@ -2,10 +2,10 @@ import { BasicColumn } from '/@/components/Table'; | ||
| 2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; | 
| 3 | import { h } from 'vue'; | 3 | import { h } from 'vue'; | 
| 4 | import { Switch } from 'ant-design-vue'; | 4 | import { Switch } from 'ant-design-vue'; | 
| 5 | -import {setMessageConfigStatus} from "/@/api/message/config"; | 5 | +import { setMessageConfigStatus } from '/@/api/message/config'; | 
| 6 | import { useMessage } from '/@/hooks/web/useMessage'; | 6 | import { useMessage } from '/@/hooks/web/useMessage'; | 
| 7 | -import {findDictItemByCode} from "/@/api/system/dict"; | ||
| 8 | -import {MessageEnum} from "/@/enums/messageEnum"; | 7 | +import { findDictItemByCode } from '/@/api/system/dict'; | 
| 8 | +import { MessageEnum } from '/@/enums/messageEnum'; | ||
| 9 | export const columns: BasicColumn[] = [ | 9 | export const columns: BasicColumn[] = [ | 
| 10 | { | 10 | { | 
| 11 | title: '配置名称', | 11 | title: '配置名称', | 
| @@ -45,7 +45,7 @@ export const columns: BasicColumn[] = [ | @@ -45,7 +45,7 @@ export const columns: BasicColumn[] = [ | ||
| 45 | record.pendingStatus = true; | 45 | record.pendingStatus = true; | 
| 46 | const newStatus = checked ? 1 : 0; | 46 | const newStatus = checked ? 1 : 0; | 
| 47 | const { createMessage } = useMessage(); | 47 | const { createMessage } = useMessage(); | 
| 48 | - setMessageConfigStatus(record.id, record.messageType,newStatus) | 48 | + setMessageConfigStatus(record.id, record.messageType, newStatus) | 
| 49 | .then(() => { | 49 | .then(() => { | 
| 50 | record.status = newStatus; | 50 | record.status = newStatus; | 
| 51 | createMessage.success(`修改成功`); | 51 | createMessage.success(`修改成功`); | 
| @@ -96,20 +96,19 @@ export const searchFormSchema: FormSchema[] = [ | @@ -96,20 +96,19 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 96 | }, | 96 | }, | 
| 97 | ]; | 97 | ]; | 
| 98 | 98 | ||
| 99 | - | ||
| 100 | -export const isMessage = (type:string)=>{ | ||
| 101 | - return type===MessageEnum.IS_SMS; | ||
| 102 | -} | ||
| 103 | -export const isEmail = (type:string)=>{ | ||
| 104 | - return type===MessageEnum.IS_EMAIL; | ||
| 105 | -} | 99 | +export const isMessage = (type: string) => { | 
| 100 | + return type === MessageEnum.IS_SMS; | ||
| 101 | +}; | ||
| 102 | +export const isEmail = (type: string) => { | ||
| 103 | + return type === MessageEnum.IS_EMAIL; | ||
| 104 | +}; | ||
| 106 | 105 | ||
| 107 | export const formSchema: FormSchema[] = [ | 106 | export const formSchema: FormSchema[] = [ | 
| 108 | { | 107 | { | 
| 109 | field: 'configName', | 108 | field: 'configName', | 
| 110 | label: '配置名称', | 109 | label: '配置名称', | 
| 111 | required: true, | 110 | required: true, | 
| 112 | - component:'Input' | 111 | + component: 'Input', | 
| 113 | }, | 112 | }, | 
| 114 | { | 113 | { | 
| 115 | field: 'messageType', | 114 | field: 'messageType', | 
| @@ -117,12 +116,12 @@ export const formSchema: FormSchema[] = [ | @@ -117,12 +116,12 @@ export const formSchema: FormSchema[] = [ | ||
| 117 | required: true, | 116 | required: true, | 
| 118 | component: 'ApiSelect', | 117 | component: 'ApiSelect', | 
| 119 | componentProps: { | 118 | componentProps: { | 
| 120 | - api:findDictItemByCode, | ||
| 121 | - params:{ | ||
| 122 | - dictCode:"message_type" | 119 | + api: findDictItemByCode, | 
| 120 | + params: { | ||
| 121 | + dictCode: 'message_type', | ||
| 123 | }, | 122 | }, | 
| 124 | - labelField:'itemText', | ||
| 125 | - valueField:'itemValue', | 123 | + labelField: 'itemText', | 
| 124 | + valueField: 'itemValue', | ||
| 126 | }, | 125 | }, | 
| 127 | }, | 126 | }, | 
| 128 | { | 127 | { | 
| @@ -131,70 +130,70 @@ export const formSchema: FormSchema[] = [ | @@ -131,70 +130,70 @@ export const formSchema: FormSchema[] = [ | ||
| 131 | required: true, | 130 | required: true, | 
| 132 | component: 'ApiSelect', | 131 | component: 'ApiSelect', | 
| 133 | componentProps: { | 132 | componentProps: { | 
| 134 | - api:findDictItemByCode, | ||
| 135 | - params:{ | ||
| 136 | - dictCode:"platform_type" | 133 | + api: findDictItemByCode, | 
| 134 | + params: { | ||
| 135 | + dictCode: 'platform_type', | ||
| 137 | }, | 136 | }, | 
| 138 | - labelField:'itemText', | ||
| 139 | - valueField:'itemValue', | 137 | + labelField: 'itemText', | 
| 138 | + valueField: 'itemValue', | ||
| 140 | }, | 139 | }, | 
| 141 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | 140 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 
| 142 | }, | 141 | }, | 
| 143 | { | 142 | { | 
| 144 | field: 'accessKeyId', | 143 | field: 'accessKeyId', | 
| 145 | label: 'accessKeyId', | 144 | label: 'accessKeyId', | 
| 146 | required: true, | 145 | required: true, | 
| 147 | - component:'Input', | ||
| 148 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | 146 | + component: 'Input', | 
| 147 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | ||
| 149 | }, | 148 | }, | 
| 150 | { | 149 | { | 
| 151 | field: 'accessKeySecret', | 150 | field: 'accessKeySecret', | 
| 152 | label: 'accessKeySecret', | 151 | label: 'accessKeySecret', | 
| 153 | required: true, | 152 | required: true, | 
| 154 | - component:'Input', | ||
| 155 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | 153 | + component: 'Input', | 
| 154 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | ||
| 156 | }, | 155 | }, | 
| 157 | { | 156 | { | 
| 158 | field: 'host', | 157 | field: 'host', | 
| 159 | label: '服务器地址', | 158 | label: '服务器地址', | 
| 160 | - defaultValue:'smtp.163.com', | 159 | + defaultValue: 'smtp.163.com', | 
| 161 | required: true, | 160 | required: true, | 
| 162 | - component:'Input', | ||
| 163 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | 161 | + component: 'Input', | 
| 162 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | ||
| 164 | }, | 163 | }, | 
| 165 | { | 164 | { | 
| 166 | field: 'port', | 165 | field: 'port', | 
| 167 | label: '端口', | 166 | label: '端口', | 
| 168 | defaultValue: 25, | 167 | defaultValue: 25, | 
| 169 | required: true, | 168 | required: true, | 
| 170 | - component:'InputNumber', | ||
| 171 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | 169 | + component: 'InputNumber', | 
| 170 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | ||
| 172 | }, | 171 | }, | 
| 173 | { | 172 | { | 
| 174 | field: 'username', | 173 | field: 'username', | 
| 175 | label: '用户名', | 174 | label: '用户名', | 
| 176 | required: true, | 175 | required: true, | 
| 177 | - component:'Input', | ||
| 178 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | 176 | + component: 'Input', | 
| 177 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | ||
| 179 | }, | 178 | }, | 
| 180 | { | 179 | { | 
| 181 | field: 'password', | 180 | field: 'password', | 
| 182 | label: '密码', | 181 | label: '密码', | 
| 183 | required: true, | 182 | required: true, | 
| 184 | - component:'InputPassword', | ||
| 185 | - ifShow:({values}) => isEmail(Reflect.get(values,'messageType')), | 183 | + component: 'InputPassword', | 
| 184 | + ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')), | ||
| 186 | }, | 185 | }, | 
| 187 | { | 186 | { | 
| 188 | field: 'config', | 187 | field: 'config', | 
| 189 | label: '消息配置', | 188 | label: '消息配置', | 
| 190 | - component:'Input', | ||
| 191 | - show:false, | 189 | + component: 'Input', | 
| 190 | + show: false, | ||
| 192 | }, | 191 | }, | 
| 193 | { | 192 | { | 
| 194 | field: 'id', | 193 | field: 'id', | 
| 195 | label: '主键', | 194 | label: '主键', | 
| 196 | - component:'Input', | ||
| 197 | - show:false, | 195 | + component: 'Input', | 
| 196 | + show: false, | ||
| 198 | }, | 197 | }, | 
| 199 | { | 198 | { | 
| 200 | field: 'status', | 199 | field: 'status', | 
| @@ -212,5 +211,5 @@ export const formSchema: FormSchema[] = [ | @@ -212,5 +211,5 @@ export const formSchema: FormSchema[] = [ | ||
| 212 | label: '备注', | 211 | label: '备注', | 
| 213 | field: 'remark', | 212 | field: 'remark', | 
| 214 | component: 'InputTextArea', | 213 | component: 'InputTextArea', | 
| 215 | - } | 214 | + }, | 
| 216 | ]; | 215 | ]; | 
| 1 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; | 
| 2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; | 
| 3 | -import {h} from "vue"; | ||
| 4 | -import {Tag} from "ant-design-vue"; | ||
| 5 | -import {useI18n} from "/@/hooks/web/useI18n"; | 3 | +import { h } from 'vue'; | 
| 4 | +import { Tag } from 'ant-design-vue'; | ||
| 5 | +import { useI18n } from '/@/hooks/web/useI18n'; | ||
| 6 | const { t } = useI18n(); | 6 | const { t } = useI18n(); | 
| 7 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ | 
| 8 | { | 8 | { | 
| @@ -13,7 +13,7 @@ export const columns: BasicColumn[] = [ | @@ -13,7 +13,7 @@ export const columns: BasicColumn[] = [ | ||
| 13 | { | 13 | { | 
| 14 | title: '收件人', | 14 | title: '收件人', | 
| 15 | dataIndex: 'emailTo', | 15 | dataIndex: 'emailTo', | 
| 16 | - width:160, | 16 | + width: 160, | 
| 17 | }, | 17 | }, | 
| 18 | { | 18 | { | 
| 19 | title: '状态', | 19 | title: '状态', | 
| @@ -23,21 +23,21 @@ export const columns: BasicColumn[] = [ | @@ -23,21 +23,21 @@ export const columns: BasicColumn[] = [ | ||
| 23 | const status = record.status; | 23 | const status = record.status; | 
| 24 | const success = status === 'SUCCESS'; | 24 | const success = status === 'SUCCESS'; | 
| 25 | const color = success ? 'green' : 'red'; | 25 | const color = success ? 'green' : 'red'; | 
| 26 | - let successText:string = t('routes.common.system.tableSuccessStatus'); | ||
| 27 | - let failedText:string = t('routes.common.system.tableFailedStatus'); | 26 | + let successText: string = t('routes.common.system.tableSuccessStatus'); | 
| 27 | + let failedText: string = t('routes.common.system.tableFailedStatus'); | ||
| 28 | const text = success ? successText : failedText; | 28 | const text = success ? successText : failedText; | 
| 29 | return h(Tag, { color: color }, () => text); | 29 | return h(Tag, { color: color }, () => text); | 
| 30 | - } | 30 | + }, | 
| 31 | }, | 31 | }, | 
| 32 | { | 32 | { | 
| 33 | title: '用途', | 33 | title: '用途', | 
| 34 | dataIndex: 'templatePurposeDictText', | 34 | dataIndex: 'templatePurposeDictText', | 
| 35 | - width:160, | 35 | + width: 160, | 
| 36 | }, | 36 | }, | 
| 37 | { | 37 | { | 
| 38 | title: '备注', | 38 | title: '备注', | 
| 39 | dataIndex: 'remark', | 39 | dataIndex: 'remark', | 
| 40 | - width:160, | 40 | + width: 160, | 
| 41 | }, | 41 | }, | 
| 42 | { | 42 | { | 
| 43 | title: '发送时间', | 43 | title: '发送时间', | 
| 1 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; | 
| 2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; | 
| 3 | -import {h} from "vue"; | ||
| 4 | -import {Tag} from "ant-design-vue"; | ||
| 5 | -import {useI18n} from "/@/hooks/web/useI18n"; | 3 | +import { h } from 'vue'; | 
| 4 | +import { Tag } from 'ant-design-vue'; | ||
| 5 | +import { useI18n } from '/@/hooks/web/useI18n'; | ||
| 6 | const { t } = useI18n(); | 6 | const { t } = useI18n(); | 
| 7 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ | 
| 8 | { | 8 | { | 
| @@ -13,7 +13,7 @@ export const columns: BasicColumn[] = [ | @@ -13,7 +13,7 @@ export const columns: BasicColumn[] = [ | ||
| 13 | { | 13 | { | 
| 14 | title: '短信平台', | 14 | title: '短信平台', | 
| 15 | dataIndex: 'typeDictText', | 15 | dataIndex: 'typeDictText', | 
| 16 | - width:180, | 16 | + width: 180, | 
| 17 | }, | 17 | }, | 
| 18 | { | 18 | { | 
| 19 | title: '用途', | 19 | title: '用途', | 
| @@ -28,11 +28,11 @@ export const columns: BasicColumn[] = [ | @@ -28,11 +28,11 @@ export const columns: BasicColumn[] = [ | ||
| 28 | const status = record.status; | 28 | const status = record.status; | 
| 29 | const success = status === 'SUCCESS'; | 29 | const success = status === 'SUCCESS'; | 
| 30 | const color = success ? 'green' : 'red'; | 30 | const color = success ? 'green' : 'red'; | 
| 31 | - let successText:string = t('routes.common.system.tableSuccessStatus'); | ||
| 32 | - let failedText:string = t('routes.common.system.tableFailedStatus'); | 31 | + let successText: string = t('routes.common.system.tableSuccessStatus'); | 
| 32 | + let failedText: string = t('routes.common.system.tableFailedStatus'); | ||
| 33 | const text = success ? successText : failedText; | 33 | const text = success ? successText : failedText; | 
| 34 | return h(Tag, { color: color }, () => text); | 34 | return h(Tag, { color: color }, () => text); | 
| 35 | - } | 35 | + }, | 
| 36 | }, | 36 | }, | 
| 37 | { | 37 | { | 
| 38 | title: '备注', | 38 | title: '备注', | 
| 1 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; | 
| 2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; | 
| 3 | -import {findDictItemByCode} from "/@/api/system/dict"; | ||
| 4 | -import {findMessageConfig} from "/@/api/message/config"; | ||
| 5 | -import {isMessage} from "/@/views/message/config/config.data"; | ||
| 6 | -import {h} from "vue"; | ||
| 7 | -import {Switch} from "ant-design-vue"; | ||
| 8 | -import {useMessage} from "/@/hooks/web/useMessage"; | ||
| 9 | -import {setMessageTemplateStatus} from "/@/api/message/template"; | 3 | +import { findDictItemByCode } from '/@/api/system/dict'; | 
| 4 | +import { findMessageConfig } from '/@/api/message/config'; | ||
| 5 | +import { isMessage } from '/@/views/message/config/config.data'; | ||
| 6 | +import { h } from 'vue'; | ||
| 7 | +import { Switch } from 'ant-design-vue'; | ||
| 8 | +import { useMessage } from '/@/hooks/web/useMessage'; | ||
| 9 | +import { setMessageTemplateStatus } from '/@/api/message/template'; | ||
| 10 | 10 | ||
| 11 | export const columns: BasicColumn[] = [ | 11 | export const columns: BasicColumn[] = [ | 
| 12 | { | 12 | { | 
| @@ -31,8 +31,8 @@ export const columns: BasicColumn[] = [ | @@ -31,8 +31,8 @@ export const columns: BasicColumn[] = [ | ||
| 31 | width: 180, | 31 | width: 180, | 
| 32 | }, | 32 | }, | 
| 33 | { | 33 | { | 
| 34 | - title:'模板用途', | ||
| 35 | - dataIndex:'templatePurposeDictText', | 34 | + title: '模板用途', | 
| 35 | + dataIndex: 'templatePurposeDictText', | ||
| 36 | width: 180, | 36 | width: 180, | 
| 37 | }, | 37 | }, | 
| 38 | { | 38 | { | 
| @@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | @@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | ||
| 52 | record.pendingStatus = true; | 52 | record.pendingStatus = true; | 
| 53 | const newStatus = checked ? 1 : 0; | 53 | const newStatus = checked ? 1 : 0; | 
| 54 | const { createMessage } = useMessage(); | 54 | const { createMessage } = useMessage(); | 
| 55 | - setMessageTemplateStatus(record.id,record.templatePurpose,record.messageType,newStatus) | 55 | + setMessageTemplateStatus(record.id, record.templatePurpose, record.messageType, newStatus) | 
| 56 | .then(() => { | 56 | .then(() => { | 
| 57 | record.status = newStatus; | 57 | record.status = newStatus; | 
| 58 | createMessage.success(`修改成功`); | 58 | createMessage.success(`修改成功`); | 
| @@ -68,7 +68,7 @@ export const columns: BasicColumn[] = [ | @@ -68,7 +68,7 @@ export const columns: BasicColumn[] = [ | ||
| 68 | title: '模板用途', | 68 | title: '模板用途', | 
| 69 | dataIndex: 'templatePurpose', | 69 | dataIndex: 'templatePurpose', | 
| 70 | width: 180, | 70 | width: 180, | 
| 71 | - ifShow:false | 71 | + ifShow: false, | 
| 72 | }, | 72 | }, | 
| 73 | { | 73 | { | 
| 74 | title: '创建时间', | 74 | title: '创建时间', | 
| @@ -96,8 +96,8 @@ export const formSchema: FormSchema[] = [ | @@ -96,8 +96,8 @@ export const formSchema: FormSchema[] = [ | ||
| 96 | { | 96 | { | 
| 97 | field: 'id', | 97 | field: 'id', | 
| 98 | label: '主键', | 98 | label: '主键', | 
| 99 | - component:'Input', | ||
| 100 | - show:false, | 99 | + component: 'Input', | 
| 100 | + show: false, | ||
| 101 | }, | 101 | }, | 
| 102 | { | 102 | { | 
| 103 | field: 'messageType', | 103 | field: 'messageType', | 
| @@ -105,12 +105,12 @@ export const formSchema: FormSchema[] = [ | @@ -105,12 +105,12 @@ export const formSchema: FormSchema[] = [ | ||
| 105 | required: true, | 105 | required: true, | 
| 106 | component: 'ApiSelect', | 106 | component: 'ApiSelect', | 
| 107 | componentProps: { | 107 | componentProps: { | 
| 108 | - api:findDictItemByCode, | ||
| 109 | - params:{ | ||
| 110 | - dictCode:"message_type" | 108 | + api: findDictItemByCode, | 
| 109 | + params: { | ||
| 110 | + dictCode: 'message_type', | ||
| 111 | }, | 111 | }, | 
| 112 | - labelField:'itemText', | ||
| 113 | - valueField:'itemValue', | 112 | + labelField: 'itemText', | 
| 113 | + valueField: 'itemValue', | ||
| 114 | }, | 114 | }, | 
| 115 | }, | 115 | }, | 
| 116 | { | 116 | { | 
| @@ -119,13 +119,13 @@ export const formSchema: FormSchema[] = [ | @@ -119,13 +119,13 @@ export const formSchema: FormSchema[] = [ | ||
| 119 | required: true, | 119 | required: true, | 
| 120 | component: 'ApiSelect', | 120 | component: 'ApiSelect', | 
| 121 | componentProps: { | 121 | componentProps: { | 
| 122 | - api:findMessageConfig, | ||
| 123 | - params:{ | ||
| 124 | - messageType:({values}) => Reflect.get(values,'messageType') | 122 | + api: findMessageConfig, | 
| 123 | + params: { | ||
| 124 | + messageType: ({ values }) => Reflect.get(values, 'messageType'), | ||
| 125 | }, | 125 | }, | 
| 126 | - immediate:true, | ||
| 127 | - labelField:'configName', | ||
| 128 | - valueField:'id', | 126 | + immediate: true, | 
| 127 | + labelField: 'configName', | ||
| 128 | + valueField: 'id', | ||
| 129 | }, | 129 | }, | 
| 130 | }, | 130 | }, | 
| 131 | { | 131 | { | 
| @@ -139,14 +139,14 @@ export const formSchema: FormSchema[] = [ | @@ -139,14 +139,14 @@ export const formSchema: FormSchema[] = [ | ||
| 139 | label: '模板编号', | 139 | label: '模板编号', | 
| 140 | required: true, | 140 | required: true, | 
| 141 | component: 'Input', | 141 | component: 'Input', | 
| 142 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | 142 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 
| 143 | }, | 143 | }, | 
| 144 | { | 144 | { | 
| 145 | field: 'signName', | 145 | field: 'signName', | 
| 146 | label: '签名', | 146 | label: '签名', | 
| 147 | - required:true, | 147 | + required: true, | 
| 148 | component: 'Input', | 148 | component: 'Input', | 
| 149 | - ifShow:({values}) => isMessage(Reflect.get(values,'messageType')), | 149 | + ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')), | 
| 150 | }, | 150 | }, | 
| 151 | { | 151 | { | 
| 152 | field: 'templatePurpose', | 152 | field: 'templatePurpose', | 
| @@ -155,12 +155,12 @@ export const formSchema: FormSchema[] = [ | @@ -155,12 +155,12 @@ export const formSchema: FormSchema[] = [ | ||
| 155 | component: 'ApiSelect', | 155 | component: 'ApiSelect', | 
| 156 | helpMessage: ['用户登录、忘记密码模板平台只提供"code"参数', '初始密码设置平台提供"name"参数'], | 156 | helpMessage: ['用户登录、忘记密码模板平台只提供"code"参数', '初始密码设置平台提供"name"参数'], | 
| 157 | componentProps: { | 157 | componentProps: { | 
| 158 | - api:findDictItemByCode, | ||
| 159 | - params:{ | ||
| 160 | - dictCode:"template_purpose" | 158 | + api: findDictItemByCode, | 
| 159 | + params: { | ||
| 160 | + dictCode: 'template_purpose', | ||
| 161 | }, | 161 | }, | 
| 162 | - labelField:'itemText', | ||
| 163 | - valueField:'itemValue', | 162 | + labelField: 'itemText', | 
| 163 | + valueField: 'itemValue', | ||
| 164 | }, | 164 | }, | 
| 165 | }, | 165 | }, | 
| 166 | ]; | 166 | ]; | 
| @@ -32,7 +32,7 @@ export const columns: BasicColumn[] = [ | @@ -32,7 +32,7 @@ export const columns: BasicColumn[] = [ | ||
| 32 | title: '状态', | 32 | title: '状态', | 
| 33 | dataIndex: 'userStatusEnum', | 33 | dataIndex: 'userStatusEnum', | 
| 34 | width: 120, | 34 | width: 120, | 
| 35 | - slots: {customRender: 'status'} | 35 | + slots: { customRender: 'status' }, | 
| 36 | }, | 36 | }, | 
| 37 | ]; | 37 | ]; | 
| 38 | 38 | ||
| @@ -56,15 +56,15 @@ export const accountFormSchema: FormSchema[] = [ | @@ -56,15 +56,15 @@ export const accountFormSchema: FormSchema[] = [ | ||
| 56 | field: 'id', | 56 | field: 'id', | 
| 57 | label: 'id', | 57 | label: 'id', | 
| 58 | component: 'Input', | 58 | component: 'Input', | 
| 59 | - show:false | 59 | + show: false, | 
| 60 | }, | 60 | }, | 
| 61 | { | 61 | { | 
| 62 | field: 'username', | 62 | field: 'username', | 
| 63 | label: '用户名', | 63 | label: '用户名', | 
| 64 | component: 'Input', | 64 | component: 'Input', | 
| 65 | colProps: { span: 12 }, | 65 | colProps: { span: 12 }, | 
| 66 | - dynamicDisabled:false, | ||
| 67 | - dynamicRules:({values}) =>{ | 66 | + dynamicDisabled: false, | 
| 67 | + dynamicRules: ({ values }) => { | ||
| 68 | return [ | 68 | return [ | 
| 69 | { | 69 | { | 
| 70 | message: '请输入用户名', | 70 | message: '请输入用户名', | 
| @@ -73,28 +73,26 @@ export const accountFormSchema: FormSchema[] = [ | @@ -73,28 +73,26 @@ export const accountFormSchema: FormSchema[] = [ | ||
| 73 | { | 73 | { | 
| 74 | validator(_, value) { | 74 | validator(_, value) { | 
| 75 | return new Promise((resolve, reject) => { | 75 | return new Promise((resolve, reject) => { | 
| 76 | - if(value == '') | ||
| 77 | - { | 76 | + if (value == '') { | 
| 78 | reject('请输入用户名'); | 77 | reject('请输入用户名'); | 
| 79 | - }else { | ||
| 80 | - if(values.username !=undefined && values.id == undefined){ | ||
| 81 | - isAccountExist(value) | ||
| 82 | - .then((data) => { | ||
| 83 | - if(data.data !=null){ | ||
| 84 | - reject('用户已存在'); | ||
| 85 | - }else{ | ||
| 86 | - resolve() | ||
| 87 | - } | ||
| 88 | - }); | ||
| 89 | - }else{ | ||
| 90 | - resolve() | 78 | + } else { | 
| 79 | + if (values.username != undefined && values.id == undefined) { | ||
| 80 | + isAccountExist(value).then((data) => { | ||
| 81 | + if (data.data != null) { | ||
| 82 | + reject('用户已存在'); | ||
| 83 | + } else { | ||
| 84 | + resolve(); | ||
| 85 | + } | ||
| 86 | + }); | ||
| 87 | + } else { | ||
| 88 | + resolve(); | ||
| 91 | } | 89 | } | 
| 92 | } | 90 | } | 
| 93 | }); | 91 | }); | 
| 94 | }, | 92 | }, | 
| 95 | }, | 93 | }, | 
| 96 | ]; | 94 | ]; | 
| 97 | - } | 95 | + }, | 
| 98 | }, | 96 | }, | 
| 99 | { | 97 | { | 
| 100 | field: 'password', | 98 | field: 'password', | 
| @@ -149,10 +147,10 @@ export const accountFormSchema: FormSchema[] = [ | @@ -149,10 +147,10 @@ export const accountFormSchema: FormSchema[] = [ | ||
| 149 | label: '有效期: ', | 147 | label: '有效期: ', | 
| 150 | component: 'DatePicker', | 148 | component: 'DatePicker', | 
| 151 | colProps: { span: 12 }, | 149 | colProps: { span: 12 }, | 
| 152 | - componentProps:{ | ||
| 153 | - showTime:true, | ||
| 154 | - format:'YYYY-MM-DD HH:mm:ss' | ||
| 155 | - } | 150 | + componentProps: { | 
| 151 | + showTime: true, | ||
| 152 | + format: 'YYYY-MM-DD HH:mm:ss', | ||
| 153 | + }, | ||
| 156 | }, | 154 | }, | 
| 157 | { | 155 | { | 
| 158 | field: 'enabled', | 156 | field: 'enabled', | 
| @@ -162,8 +160,8 @@ export const accountFormSchema: FormSchema[] = [ | @@ -162,8 +160,8 @@ export const accountFormSchema: FormSchema[] = [ | ||
| 162 | defaultValue: true, | 160 | defaultValue: true, | 
| 163 | componentProps: { | 161 | componentProps: { | 
| 164 | options: [ | 162 | options: [ | 
| 165 | - {label: '启用', value: true}, | ||
| 166 | - {label: '禁用', value: false}, | 163 | + { label: '启用', value: true }, | 
| 164 | + { label: '禁用', value: false }, | ||
| 167 | ], | 165 | ], | 
| 168 | }, | 166 | }, | 
| 169 | }, | 167 | }, | 
| @@ -171,6 +169,6 @@ export const accountFormSchema: FormSchema[] = [ | @@ -171,6 +169,6 @@ export const accountFormSchema: FormSchema[] = [ | ||
| 171 | field: 'organizationIds', | 169 | field: 'organizationIds', | 
| 172 | label: ' ', | 170 | label: ' ', | 
| 173 | component: 'Input', | 171 | component: 'Input', | 
| 174 | - slot:'organizationId', | 172 | + slot: 'organizationId', | 
| 175 | }, | 173 | }, | 
| 176 | ]; | 174 | ]; | 
| @@ -78,7 +78,6 @@ | @@ -78,7 +78,6 @@ | ||
| 78 | 78 | ||
| 79 | export default defineComponent({ | 79 | export default defineComponent({ | 
| 80 | name: 'AccountManagement', | 80 | name: 'AccountManagement', | 
| 81 | - | ||
| 82 | components: { BasicTable, PageWrapper, OrganizationIdTree, AccountModal, TableAction, Tag }, | 81 | components: { BasicTable, PageWrapper, OrganizationIdTree, AccountModal, TableAction, Tag }, | 
| 83 | setup() { | 82 | setup() { | 
| 84 | const go = useGo(); | 83 | const go = useGo(); | 
| @@ -25,7 +25,7 @@ export const columns: BasicColumn[] = [ | @@ -25,7 +25,7 @@ export const columns: BasicColumn[] = [ | ||
| 25 | { | 25 | { | 
| 26 | title: '更新时间', | 26 | title: '更新时间', | 
| 27 | dataIndex: 'updateTime', | 27 | dataIndex: 'updateTime', | 
| 28 | - width: 180 | 28 | + width: 180, | 
| 29 | }, | 29 | }, | 
| 30 | ]; | 30 | ]; | 
| 31 | 31 | ||
| @@ -49,7 +49,7 @@ export const formSchema: FormSchema[] = [ | @@ -49,7 +49,7 @@ export const formSchema: FormSchema[] = [ | ||
| 49 | field: 'dictName', | 49 | field: 'dictName', | 
| 50 | label: '字典名称', | 50 | label: '字典名称', | 
| 51 | required: true, | 51 | required: true, | 
| 52 | - component: 'Input' | 52 | + component: 'Input', | 
| 53 | }, | 53 | }, | 
| 54 | { | 54 | { | 
| 55 | field: 'dictCode', | 55 | field: 'dictCode', | 
| 1 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; | 
| 2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; | 
| 3 | -import {h} from "vue"; | ||
| 4 | -import {Switch} from "ant-design-vue"; | ||
| 5 | -import {setDictItemStatus} from "/@/api/system/dict"; | ||
| 6 | -import {useMessage} from "/@/hooks/web/useMessage"; | 3 | +import { h } from 'vue'; | 
| 4 | +import { Switch } from 'ant-design-vue'; | ||
| 5 | +import { setDictItemStatus } from '/@/api/system/dict'; | ||
| 6 | +import { useMessage } from '/@/hooks/web/useMessage'; | ||
| 7 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ | 
| 8 | { | 8 | { | 
| 9 | title: '文本值', | 9 | title: '文本值', | 
| @@ -13,7 +13,7 @@ export const columns: BasicColumn[] = [ | @@ -13,7 +13,7 @@ export const columns: BasicColumn[] = [ | ||
| 13 | { | 13 | { | 
| 14 | title: '字典值', | 14 | title: '字典值', | 
| 15 | dataIndex: 'itemValue', | 15 | dataIndex: 'itemValue', | 
| 16 | - width:180, | 16 | + width: 180, | 
| 17 | }, | 17 | }, | 
| 18 | { | 18 | { | 
| 19 | title: '描述', | 19 | title: '描述', | 
| @@ -37,7 +37,7 @@ export const columns: BasicColumn[] = [ | @@ -37,7 +37,7 @@ export const columns: BasicColumn[] = [ | ||
| 37 | record.pendingStatus = true; | 37 | record.pendingStatus = true; | 
| 38 | const newStatus = checked ? 1 : 0; | 38 | const newStatus = checked ? 1 : 0; | 
| 39 | const { createMessage } = useMessage(); | 39 | const { createMessage } = useMessage(); | 
| 40 | - setDictItemStatus(record.id,newStatus) | 40 | + setDictItemStatus(record.id, newStatus) | 
| 41 | .then(() => { | 41 | .then(() => { | 
| 42 | record.status = newStatus; | 42 | record.status = newStatus; | 
| 43 | createMessage.success(`修改成功`); | 43 | createMessage.success(`修改成功`); | 
| @@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | @@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | ||
| 52 | { | 52 | { | 
| 53 | title: '排序', | 53 | title: '排序', | 
| 54 | dataIndex: 'sort', | 54 | dataIndex: 'sort', | 
| 55 | - width: 80 | 55 | + width: 80, | 
| 56 | }, | 56 | }, | 
| 57 | { | 57 | { | 
| 58 | title: '创建时间', | 58 | title: '创建时间', | 
| @@ -72,7 +72,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -72,7 +72,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 72 | field: 'dictId', | 72 | field: 'dictId', | 
| 73 | label: '文本值', | 73 | label: '文本值', | 
| 74 | component: 'Input', | 74 | component: 'Input', | 
| 75 | - show:false, | 75 | + show: false, | 
| 76 | }, | 76 | }, | 
| 77 | ]; | 77 | ]; | 
| 78 | 78 | ||
| @@ -81,7 +81,7 @@ export const formSchema: FormSchema[] = [ | @@ -81,7 +81,7 @@ export const formSchema: FormSchema[] = [ | ||
| 81 | field: 'itemText', | 81 | field: 'itemText', | 
| 82 | label: '文本值', | 82 | label: '文本值', | 
| 83 | required: true, | 83 | required: true, | 
| 84 | - component: 'Input' | 84 | + component: 'Input', | 
| 85 | }, | 85 | }, | 
| 86 | { | 86 | { | 
| 87 | field: 'itemValue', | 87 | field: 'itemValue', | 
| @@ -93,7 +93,7 @@ export const formSchema: FormSchema[] = [ | @@ -93,7 +93,7 @@ export const formSchema: FormSchema[] = [ | ||
| 93 | field: 'sort', | 93 | field: 'sort', | 
| 94 | label: '排序', | 94 | label: '排序', | 
| 95 | component: 'InputNumber', | 95 | component: 'InputNumber', | 
| 96 | - defaultValue:1, | 96 | + defaultValue: 1, | 
| 97 | }, | 97 | }, | 
| 98 | { | 98 | { | 
| 99 | field: 'status', | 99 | field: 'status', | 
| @@ -3,24 +3,24 @@ import { FormSchema } from '/@/components/Table'; | @@ -3,24 +3,24 @@ import { FormSchema } from '/@/components/Table'; | ||
| 3 | import { h } from 'vue'; | 3 | import { h } from 'vue'; | 
| 4 | import { Tag } from 'ant-design-vue'; | 4 | import { Tag } from 'ant-design-vue'; | 
| 5 | import { Icon } from '/@/components/Icon'; | 5 | import { Icon } from '/@/components/Icon'; | 
| 6 | -import {useI18n} from "/@/hooks/web/useI18n"; | 6 | +import { useI18n } from '/@/hooks/web/useI18n'; | 
| 7 | const { t } = useI18n(); | 7 | const { t } = useI18n(); | 
| 8 | 8 | ||
| 9 | //菜单管理页,所需的列 配置 | 9 | //菜单管理页,所需的列 配置 | 
| 10 | export const columns: BasicColumn[] = [ | 10 | export const columns: BasicColumn[] = [ | 
| 11 | { | 11 | { | 
| 12 | - title: t('routes.common.system.tableTitleSystemMenuName'),//菜单名称 | 12 | + title: t('routes.common.system.tableTitleSystemMenuName'), //菜单名称 | 
| 13 | // title:'菜单名称', | 13 | // title:'菜单名称', | 
| 14 | dataIndex: 'meta.title', | 14 | dataIndex: 'meta.title', | 
| 15 | width: 200, | 15 | width: 200, | 
| 16 | align: 'left', | 16 | align: 'left', | 
| 17 | customRender: ({ record }) => { | 17 | customRender: ({ record }) => { | 
| 18 | - record = t(record.meta.title);//国际化处理 | 18 | + record = t(record.meta.title); //国际化处理 | 
| 19 | return record; | 19 | return record; | 
| 20 | }, | 20 | }, | 
| 21 | }, | 21 | }, | 
| 22 | { | 22 | { | 
| 23 | - title: t('routes.common.system.tableTitleSystemIcon'),//图标 | 23 | + title: t('routes.common.system.tableTitleSystemIcon'), //图标 | 
| 24 | // title:'图标', | 24 | // title:'图标', | 
| 25 | dataIndex: 'meta.icon', | 25 | dataIndex: 'meta.icon', | 
| 26 | width: 50, | 26 | width: 50, | 
| @@ -29,24 +29,24 @@ export const columns: BasicColumn[] = [ | @@ -29,24 +29,24 @@ export const columns: BasicColumn[] = [ | ||
| 29 | }, | 29 | }, | 
| 30 | }, | 30 | }, | 
| 31 | { | 31 | { | 
| 32 | - title: t('routes.common.system.tableTitleSystemPermissionTag'),//权限标识 | 32 | + title: t('routes.common.system.tableTitleSystemPermissionTag'), //权限标识 | 
| 33 | // title:'权限标识', | 33 | // title:'权限标识', | 
| 34 | dataIndex: 'permission', | 34 | dataIndex: 'permission', | 
| 35 | width: 180, | 35 | width: 180, | 
| 36 | }, | 36 | }, | 
| 37 | { | 37 | { | 
| 38 | - title: t('routes.common.system.tableTitleSystemComponents'),//'组件' | 38 | + title: t('routes.common.system.tableTitleSystemComponents'), //'组件' | 
| 39 | // title:'组件', | 39 | // title:'组件', | 
| 40 | dataIndex: 'component', | 40 | dataIndex: 'component', | 
| 41 | }, | 41 | }, | 
| 42 | { | 42 | { | 
| 43 | - title: t('routes.common.system.tableTitleSystemSort'),//'排序' | 43 | + title: t('routes.common.system.tableTitleSystemSort'), //'排序' | 
| 44 | // title:'排序', | 44 | // title:'排序', | 
| 45 | dataIndex: 'sort', | 45 | dataIndex: 'sort', | 
| 46 | width: 50, | 46 | width: 50, | 
| 47 | }, | 47 | }, | 
| 48 | { | 48 | { | 
| 49 | - title: t('routes.common.system.tableTitleSystemStatus'),//'状态' | 49 | + title: t('routes.common.system.tableTitleSystemStatus'), //'状态' | 
| 50 | // title:'状态', | 50 | // title:'状态', | 
| 51 | dataIndex: 'status', | 51 | dataIndex: 'status', | 
| 52 | width: 80, | 52 | width: 80, | 
| @@ -54,14 +54,14 @@ export const columns: BasicColumn[] = [ | @@ -54,14 +54,14 @@ export const columns: BasicColumn[] = [ | ||
| 54 | const status = record.meta.status; | 54 | const status = record.meta.status; | 
| 55 | const enable = ~~status === 0; | 55 | const enable = ~~status === 0; | 
| 56 | const color = enable ? 'green' : 'red'; | 56 | const color = enable ? 'green' : 'red'; | 
| 57 | - let enableText:string = t('routes.common.system.tableTitleSystemEnable');//国际化处理--启用 | ||
| 58 | - let stopText:string = t('routes.common.system.tableTitleSystemStop');//国际化处理--停用 | 57 | + let enableText: string = t('routes.common.system.tableTitleSystemEnable'); //国际化处理--启用 | 
| 58 | + let stopText: string = t('routes.common.system.tableTitleSystemStop'); //国际化处理--停用 | ||
| 59 | const text = enable ? enableText : stopText; | 59 | const text = enable ? enableText : stopText; | 
| 60 | return h(Tag, { color: color }, () => text); | 60 | return h(Tag, { color: color }, () => text); | 
| 61 | }, | 61 | }, | 
| 62 | }, | 62 | }, | 
| 63 | { | 63 | { | 
| 64 | - title: t('routes.common.system.tableTitleSystemCreateTime'),//'创建时间' | 64 | + title: t('routes.common.system.tableTitleSystemCreateTime'), //'创建时间' | 
| 65 | // title:'创建时间', | 65 | // title:'创建时间', | 
| 66 | dataIndex: 'createTime', | 66 | dataIndex: 'createTime', | 
| 67 | width: 180, | 67 | width: 180, | 
| @@ -76,14 +76,14 @@ const isButton = (type: string) => type === '2'; | @@ -76,14 +76,14 @@ const isButton = (type: string) => type === '2'; | ||
| 76 | export const searchFormSchema: FormSchema[] = [ | 76 | export const searchFormSchema: FormSchema[] = [ | 
| 77 | { | 77 | { | 
| 78 | field: 'menuName', | 78 | field: 'menuName', | 
| 79 | - label: t('routes.common.system.tableTitleSystemMenuName'),//菜单名称 | 79 | + label: t('routes.common.system.tableTitleSystemMenuName'), //菜单名称 | 
| 80 | // label: '菜单名称', | 80 | // label: '菜单名称', | 
| 81 | component: 'Input', | 81 | component: 'Input', | 
| 82 | colProps: { span: 8 }, | 82 | colProps: { span: 8 }, | 
| 83 | }, | 83 | }, | 
| 84 | { | 84 | { | 
| 85 | field: 'status', | 85 | field: 'status', | 
| 86 | - label: t('routes.common.system.tableTitleSystemStatus'),//状态 | 86 | + label: t('routes.common.system.tableTitleSystemStatus'), //状态 | 
| 87 | // label: '状态', | 87 | // label: '状态', | 
| 88 | component: 'Select', | 88 | component: 'Select', | 
| 89 | componentProps: { | 89 | componentProps: { | 
| @@ -99,38 +99,35 @@ export const searchFormSchema: FormSchema[] = [ | @@ -99,38 +99,35 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 99 | }, | 99 | }, | 
| 100 | ]; | 100 | ]; | 
| 101 | 101 | ||
| 102 | - | ||
| 103 | - | ||
| 104 | - | ||
| 105 | //----------------------------------新增、编辑---------------------------------------------------------- | 102 | //----------------------------------新增、编辑---------------------------------------------------------- | 
| 106 | export const formSchema: FormSchema[] = [ | 103 | export const formSchema: FormSchema[] = [ | 
| 107 | { | 104 | { | 
| 108 | field: 'menuType', | 105 | field: 'menuType', | 
| 109 | - label: t('routes.common.system.menuEditPagesMenuType'),//菜单类型 | 106 | + label: t('routes.common.system.menuEditPagesMenuType'), //菜单类型 | 
| 110 | component: 'RadioButtonGroup', | 107 | component: 'RadioButtonGroup', | 
| 111 | defaultValue: '0', | 108 | defaultValue: '0', | 
| 112 | componentProps: { | 109 | componentProps: { | 
| 113 | options: [ | 110 | options: [ | 
| 114 | - { label: t('routes.common.system.menuEditPagesDirectory'), value: '0' },//目录 | ||
| 115 | - { label: t('routes.common.system.menuEditPagesMenu'), value: '1' },//菜单 | ||
| 116 | - { label: t('routes.common.system.menuEditPagesButton'), value: '2' },//按钮 | 111 | + { label: t('routes.common.system.menuEditPagesDirectory'), value: '0' }, //目录 | 
| 112 | + { label: t('routes.common.system.menuEditPagesMenu'), value: '1' }, //菜单 | ||
| 113 | + { label: t('routes.common.system.menuEditPagesButton'), value: '2' }, //按钮 | ||
| 117 | ], | 114 | ], | 
| 118 | onChange: (e) => { | 115 | onChange: (e) => { | 
| 119 | - console.log("--------11111---------------",e); | 116 | + console.log('--------11111---------------', e); | 
| 120 | }, | 117 | }, | 
| 121 | }, | 118 | }, | 
| 122 | colProps: { lg: 24, md: 24 }, | 119 | colProps: { lg: 24, md: 24 }, | 
| 123 | }, | 120 | }, | 
| 124 | { | 121 | { | 
| 125 | field: 'title', | 122 | field: 'title', | 
| 126 | - label: t('routes.common.system.tableTitleSystemMenuName'),//菜单名称 | 123 | + label: t('routes.common.system.tableTitleSystemMenuName'), //菜单名称 | 
| 127 | component: 'Input', | 124 | component: 'Input', | 
| 128 | required: true, | 125 | required: true, | 
| 129 | }, | 126 | }, | 
| 130 | 127 | ||
| 131 | { | 128 | { | 
| 132 | field: 'parentId', | 129 | field: 'parentId', | 
| 133 | - label: t('routes.common.system.menuEditPagesParentMenu'),//上级菜单 | 130 | + label: t('routes.common.system.menuEditPagesParentMenu'), //上级菜单 | 
| 134 | component: 'TreeSelect', | 131 | component: 'TreeSelect', | 
| 135 | componentProps: { | 132 | componentProps: { | 
| 136 | replaceFields: { | 133 | replaceFields: { | 
| @@ -144,88 +141,88 @@ export const formSchema: FormSchema[] = [ | @@ -144,88 +141,88 @@ export const formSchema: FormSchema[] = [ | ||
| 144 | 141 | ||
| 145 | { | 142 | { | 
| 146 | field: 'sort', | 143 | field: 'sort', | 
| 147 | - label: t('routes.common.system.tableTitleSystemSort'),//排序 | 144 | + label: t('routes.common.system.tableTitleSystemSort'), //排序 | 
| 148 | component: 'InputNumber', | 145 | component: 'InputNumber', | 
| 149 | required: true, | 146 | required: true, | 
| 150 | }, | 147 | }, | 
| 151 | { | 148 | { | 
| 152 | field: 'icon', | 149 | field: 'icon', | 
| 153 | - label: t('routes.common.system.tableTitleSystemIcon'),//图标 | 150 | + label: t('routes.common.system.tableTitleSystemIcon'), //图标 | 
| 154 | component: 'IconPicker', | 151 | component: 'IconPicker', | 
| 155 | required: true, | 152 | required: true, | 
| 156 | - ifShow: ({ values }) => !isButton(Reflect.get(values,'menuType')), | 153 | + ifShow: ({ values }) => !isButton(Reflect.get(values, 'menuType')), | 
| 157 | }, | 154 | }, | 
| 158 | 155 | ||
| 159 | { | 156 | { | 
| 160 | field: 'path', | 157 | field: 'path', | 
| 161 | - label: t('routes.common.system.menuEditPagesRouterAddress'),//路由地址 | 158 | + label: t('routes.common.system.menuEditPagesRouterAddress'), //路由地址 | 
| 162 | component: 'Input', | 159 | component: 'Input', | 
| 163 | required: true, | 160 | required: true, | 
| 164 | - ifShow: ({ values }) => !isButton(Reflect.get(values,'menuType')), | 161 | + ifShow: ({ values }) => !isButton(Reflect.get(values, 'menuType')), | 
| 165 | }, | 162 | }, | 
| 166 | { | 163 | { | 
| 167 | field: 'component', | 164 | field: 'component', | 
| 168 | - label: t('routes.common.system.menuEditPagesComponentsPath'),//组件路径 | 165 | + label: t('routes.common.system.menuEditPagesComponentsPath'), //组件路径 | 
| 169 | component: 'Input', | 166 | component: 'Input', | 
| 170 | - ifShow: ({ values }) => isMenu(Reflect.get(values,'menuType')), | 167 | + ifShow: ({ values }) => isMenu(Reflect.get(values, 'menuType')), | 
| 171 | }, | 168 | }, | 
| 172 | { | 169 | { | 
| 173 | field: 'permission', | 170 | field: 'permission', | 
| 174 | - label: t('routes.common.system.tableTitleSystemPermissionTag'),//权限标识 | 171 | + label: t('routes.common.system.tableTitleSystemPermissionTag'), //权限标识 | 
| 175 | component: 'Input', | 172 | component: 'Input', | 
| 176 | - ifShow: ({ values }) => !isDir(Reflect.get(values,'menuType')), | 173 | + ifShow: ({ values }) => !isDir(Reflect.get(values, 'menuType')), | 
| 177 | }, | 174 | }, | 
| 178 | { | 175 | { | 
| 179 | field: 'status', | 176 | field: 'status', | 
| 180 | - label: t('routes.common.system.tableTitleSystemStatus'),//状态 | 177 | + label: t('routes.common.system.tableTitleSystemStatus'), //状态 | 
| 181 | component: 'RadioButtonGroup', | 178 | component: 'RadioButtonGroup', | 
| 182 | defaultValue: '0', | 179 | defaultValue: '0', | 
| 183 | componentProps: { | 180 | componentProps: { | 
| 184 | options: [ | 181 | options: [ | 
| 185 | - { label: t('routes.common.system.tableTitleSystemEnable'), value: '0' },//启用 | ||
| 186 | - { label: t('routes.common.system.tableTitleSystemStop'), value: '1' },//禁用 | 182 | + { label: t('routes.common.system.tableTitleSystemEnable'), value: '0' }, //启用 | 
| 183 | + { label: t('routes.common.system.tableTitleSystemStop'), value: '1' }, //禁用 | ||
| 187 | ], | 184 | ], | 
| 188 | }, | 185 | }, | 
| 189 | }, | 186 | }, | 
| 190 | { | 187 | { | 
| 191 | field: 'isLink', | 188 | field: 'isLink', | 
| 192 | - label: t('routes.common.system.menuEditPagesIsExt'),//是否外链 | 189 | + label: t('routes.common.system.menuEditPagesIsExt'), //是否外链 | 
| 193 | component: 'RadioButtonGroup', | 190 | component: 'RadioButtonGroup', | 
| 194 | defaultValue: false, | 191 | defaultValue: false, | 
| 195 | componentProps: { | 192 | componentProps: { | 
| 196 | options: [ | 193 | options: [ | 
| 197 | - { label: t('routes.common.system.menuEditPagesYes'), value: true },//是 | ||
| 198 | - { label: t('routes.common.system.menuEditPagesNo'), value: false },//否 | 194 | + { label: t('routes.common.system.menuEditPagesYes'), value: true }, //是 | 
| 195 | + { label: t('routes.common.system.menuEditPagesNo'), value: false }, //否 | ||
| 199 | ], | 196 | ], | 
| 200 | }, | 197 | }, | 
| 201 | - ifShow: ({ values }) => !isButton(Reflect.get(values,'menuType')), | 198 | + ifShow: ({ values }) => !isButton(Reflect.get(values, 'menuType')), | 
| 202 | }, | 199 | }, | 
| 203 | 200 | ||
| 204 | { | 201 | { | 
| 205 | field: 'ignoreKeepAlive', | 202 | field: 'ignoreKeepAlive', | 
| 206 | - label: t('routes.common.system.menuEditPagesIsKeepAlive'),//是否缓存 | 203 | + label: t('routes.common.system.menuEditPagesIsKeepAlive'), //是否缓存 | 
| 207 | component: 'RadioButtonGroup', | 204 | component: 'RadioButtonGroup', | 
| 208 | defaultValue: false, | 205 | defaultValue: false, | 
| 209 | componentProps: { | 206 | componentProps: { | 
| 210 | options: [ | 207 | options: [ | 
| 211 | - { label: t('routes.common.system.menuEditPagesYes'), value: true },//是 | ||
| 212 | - { label: t('routes.common.system.menuEditPagesNo'), value: false },//否 | 208 | + { label: t('routes.common.system.menuEditPagesYes'), value: true }, //是 | 
| 209 | + { label: t('routes.common.system.menuEditPagesNo'), value: false }, //否 | ||
| 213 | ], | 210 | ], | 
| 214 | }, | 211 | }, | 
| 215 | - ifShow: ({ values }) => isMenu(Reflect.get(values,'menuType')), | 212 | + ifShow: ({ values }) => isMenu(Reflect.get(values, 'menuType')), | 
| 216 | }, | 213 | }, | 
| 217 | 214 | ||
| 218 | { | 215 | { | 
| 219 | field: 'hideMenu', | 216 | field: 'hideMenu', | 
| 220 | - label: t('routes.common.system.menuEditPagesIsHide'),//是否隐藏 | 217 | + label: t('routes.common.system.menuEditPagesIsHide'), //是否隐藏 | 
| 221 | component: 'RadioButtonGroup', | 218 | component: 'RadioButtonGroup', | 
| 222 | defaultValue: false, | 219 | defaultValue: false, | 
| 223 | componentProps: { | 220 | componentProps: { | 
| 224 | options: [ | 221 | options: [ | 
| 225 | - { label: t('routes.common.system.menuEditPagesYes'), value: true },//是 | ||
| 226 | - { label: t('routes.common.system.menuEditPagesNo'), value: false },//否 | 222 | + { label: t('routes.common.system.menuEditPagesYes'), value: true }, //是 | 
| 223 | + { label: t('routes.common.system.menuEditPagesNo'), value: false }, //否 | ||
| 227 | ], | 224 | ], | 
| 228 | }, | 225 | }, | 
| 229 | - ifShow: ({ values }) => !isButton(Reflect.get(values,'menuType')), | 226 | + ifShow: ({ values }) => !isButton(Reflect.get(values, 'menuType')), | 
| 230 | }, | 227 | }, | 
| 231 | ]; | 228 | ]; | 
| 1 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; | 
| 2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; | 
| 3 | -import {useI18n} from "/@/hooks/web/useI18n"; | 3 | +import { useI18n } from '/@/hooks/web/useI18n'; | 
| 4 | const { t } = useI18n(); | 4 | const { t } = useI18n(); | 
| 5 | 5 | ||
| 6 | export const columns: BasicColumn[] = [ | 6 | export const columns: BasicColumn[] = [ | 
| @@ -11,17 +11,17 @@ export const columns: BasicColumn[] = [ | @@ -11,17 +11,17 @@ export const columns: BasicColumn[] = [ | ||
| 11 | align: 'left', | 11 | align: 'left', | 
| 12 | }, | 12 | }, | 
| 13 | { | 13 | { | 
| 14 | - title: t('routes.common.common.sort'),//排序 | 14 | + title: t('routes.common.common.sort'), //排序 | 
| 15 | dataIndex: 'sort', | 15 | dataIndex: 'sort', | 
| 16 | width: 50, | 16 | width: 50, | 
| 17 | }, | 17 | }, | 
| 18 | { | 18 | { | 
| 19 | - title: t('routes.common.common.createTime'),//创建时间 | 19 | + title: t('routes.common.common.createTime'), //创建时间 | 
| 20 | dataIndex: 'createTime', | 20 | dataIndex: 'createTime', | 
| 21 | width: 180, | 21 | width: 180, | 
| 22 | }, | 22 | }, | 
| 23 | { | 23 | { | 
| 24 | - title: t('routes.common.common.remark'),//备注 | 24 | + title: t('routes.common.common.remark'), //备注 | 
| 25 | dataIndex: 'remark', | 25 | dataIndex: 'remark', | 
| 26 | width: 300, | 26 | width: 300, | 
| 27 | }, | 27 | }, | 
| @@ -49,12 +49,12 @@ export const formSchema: FormSchema[] = [ | @@ -49,12 +49,12 @@ export const formSchema: FormSchema[] = [ | ||
| 49 | }, | 49 | }, | 
| 50 | { | 50 | { | 
| 51 | field: 'sort', | 51 | field: 'sort', | 
| 52 | - label: t('routes.common.common.sort'),//排序 | 52 | + label: t('routes.common.common.sort'), //排序 | 
| 53 | component: 'InputNumber', | 53 | component: 'InputNumber', | 
| 54 | required: true, | 54 | required: true, | 
| 55 | }, | 55 | }, | 
| 56 | { | 56 | { | 
| 57 | - label: t('routes.common.common.remark'),//备注 | 57 | + label: t('routes.common.common.remark'), //备注 | 
| 58 | field: 'remark', | 58 | field: 'remark', | 
| 59 | component: 'InputTextArea', | 59 | component: 'InputTextArea', | 
| 60 | }, | 60 | }, | 
| 1 | import { FormSchema } from '/@/components/Form'; | 1 | import { FormSchema } from '/@/components/Form'; | 
| 2 | -import {InputRegExp} from "/@/enums/regexpEnum"; | 2 | +import { InputRegExp } from '/@/enums/regexpEnum'; | 
| 3 | export const formSchema: FormSchema[] = [ | 3 | export const formSchema: FormSchema[] = [ | 
| 4 | { | 4 | { | 
| 5 | field: 'passwordOld', | 5 | field: 'passwordOld', | 
| @@ -39,8 +39,10 @@ export const formSchema: FormSchema[] = [ | @@ -39,8 +39,10 @@ export const formSchema: FormSchema[] = [ | ||
| 39 | } | 39 | } | 
| 40 | 40 | ||
| 41 | const pwdRegex = new RegExp(InputRegExp.PASSWORD_INPUT); | 41 | const pwdRegex = new RegExp(InputRegExp.PASSWORD_INPUT); | 
| 42 | - if(!pwdRegex.test(value)){ | ||
| 43 | - return Promise.reject('密码中必须包含大小写 字母、数字、特称字符,至少8个字符,最多30个字符'); | 42 | + if (!pwdRegex.test(value)) { | 
| 43 | + return Promise.reject( | ||
| 44 | + '密码中必须包含大小写 字母、数字、特称字符,至少8个字符,最多30个字符' | ||
| 45 | + ); | ||
| 44 | } | 46 | } | 
| 45 | return Promise.resolve(); | 47 | return Promise.resolve(); | 
| 46 | }, | 48 | }, | 
| @@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
| 17 | checkable | 17 | checkable | 
| 18 | toolbar | 18 | toolbar | 
| 19 | title="菜单分配" | 19 | title="菜单分配" | 
| 20 | + @check="handleCheckClick" | ||
| 20 | /> | 21 | /> | 
| 21 | </template> | 22 | </template> | 
| 22 | </BasicForm> | 23 | </BasicForm> | 
| @@ -38,17 +39,17 @@ | @@ -38,17 +39,17 @@ | ||
| 38 | import { useI18n } from '/@/hooks/web/useI18n'; | 39 | import { useI18n } from '/@/hooks/web/useI18n'; | 
| 39 | import { RouteItem } from '/@/api/sys/model/menuModel'; | 40 | import { RouteItem } from '/@/api/sys/model/menuModel'; | 
| 40 | import { saveOrUpdateRoleInfoWithMenu } from '/@/api/system/system'; | 41 | import { saveOrUpdateRoleInfoWithMenu } from '/@/api/system/system'; | 
| 41 | - | ||
| 42 | export default defineComponent({ | 42 | export default defineComponent({ | 
| 43 | name: 'RoleDrawer', | 43 | name: 'RoleDrawer', | 
| 44 | components: { BasicDrawer, BasicForm, BasicTree }, | 44 | components: { BasicDrawer, BasicForm, BasicTree }, | 
| 45 | emits: ['success', 'register'], | 45 | emits: ['success', 'register'], | 
| 46 | setup(_, { emit }) { | 46 | setup(_, { emit }) { | 
| 47 | - const isUpdate = ref(true); | 47 | + const isUpdate = ref<boolean>(true); | 
| 48 | const treeData = ref<TreeItem[]>([]); | 48 | const treeData = ref<TreeItem[]>([]); | 
| 49 | const roleMenus = ref<string[]>([]); | 49 | const roleMenus = ref<string[]>([]); | 
| 50 | - const roleId = ref(''); | ||
| 51 | - | 50 | + const allCheckedKeys = ref<string[]>(); | 
| 51 | + const roleHalfCheckedKeys = ref<string[]>([]); | ||
| 52 | + const roleId = ref<string>(''); | ||
| 52 | const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ | 53 | const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ | 
| 53 | labelWidth: 90, | 54 | labelWidth: 90, | 
| 54 | schemas: formSchema, | 55 | schemas: formSchema, | 
| @@ -72,9 +73,10 @@ | @@ -72,9 +73,10 @@ | ||
| 72 | setDrawerProps({ confirmLoading: false }); | 73 | setDrawerProps({ confirmLoading: false }); | 
| 73 | // 需要在setFieldsValue之前先填充treeData,否则Tree组件可能会报key not exist警告 | 74 | // 需要在setFieldsValue之前先填充treeData,否则Tree组件可能会报key not exist警告 | 
| 74 | if (unref(treeData).length === 0) { | 75 | if (unref(treeData).length === 0) { | 
| 76 | + // 获取全部的菜单 | ||
| 75 | const menuListModel = await getMenuList(); | 77 | const menuListModel = await getMenuList(); | 
| 76 | processChildren(menuListModel); | 78 | processChildren(menuListModel); | 
| 77 | - let treeValues = new Array<TreeItem>(); | 79 | + let treeValues: TreeItem[] = []; | 
| 78 | menuListModel.map((item) => { | 80 | menuListModel.map((item) => { | 
| 79 | const data = { | 81 | const data = { | 
| 80 | menuName: t(item.meta.title), | 82 | menuName: t(item.meta.title), | 
| @@ -87,8 +89,10 @@ | @@ -87,8 +89,10 @@ | ||
| 87 | treeData.value = treeValues; | 89 | treeData.value = treeValues; | 
| 88 | } | 90 | } | 
| 89 | if (data.record) { | 91 | if (data.record) { | 
| 92 | + // 通过角色id去获取角色对应的菜单的ids | ||
| 90 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); | 93 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); | 
| 91 | console.log(roleMenus.value, 'roleMenus.value'); | 94 | console.log(roleMenus.value, 'roleMenus.value'); | 
| 95 | + // TODO: 角色回显问题:待解决 | ||
| 92 | roleId.value = data.record.id; | 96 | roleId.value = data.record.id; | 
| 93 | } | 97 | } | 
| 94 | isUpdate.value = !!data?.isUpdate; | 98 | isUpdate.value = !!data?.isUpdate; | 
| @@ -110,7 +114,7 @@ | @@ -110,7 +114,7 @@ | ||
| 110 | name: values.name, | 114 | name: values.name, | 
| 111 | remark: values.remark, | 115 | remark: values.remark, | 
| 112 | status: values.status, | 116 | status: values.status, | 
| 113 | - menu: [...values.menu], | 117 | + menu: allCheckedKeys.value as string[], | 
| 114 | }; | 118 | }; | 
| 115 | saveOrUpdateRoleInfoWithMenu(req).then(() => { | 119 | saveOrUpdateRoleInfoWithMenu(req).then(() => { | 
| 116 | closeDrawer(); | 120 | closeDrawer(); | 
| @@ -120,14 +124,22 @@ | @@ -120,14 +124,22 @@ | ||
| 120 | setDrawerProps({ confirmLoading: false }); | 124 | setDrawerProps({ confirmLoading: false }); | 
| 121 | } | 125 | } | 
| 122 | } | 126 | } | 
| 127 | + // Tree check事件 | ||
| 128 | + const handleCheckClick = (checkedKeys: string[], { halfCheckedKeys }) => { | ||
| 129 | + allCheckedKeys.value = [...checkedKeys, ...halfCheckedKeys]; | ||
| 130 | + // 父节点 | ||
| 131 | + roleHalfCheckedKeys.value = halfCheckedKeys; | ||
| 132 | + }; | ||
| 123 | 133 | ||
| 124 | return { | 134 | return { | 
| 135 | + allCheckedKeys, | ||
| 125 | registerDrawer, | 136 | registerDrawer, | 
| 126 | registerForm, | 137 | registerForm, | 
| 127 | getTitle, | 138 | getTitle, | 
| 128 | handleSubmit, | 139 | handleSubmit, | 
| 129 | treeData, | 140 | treeData, | 
| 130 | roleMenus, | 141 | roleMenus, | 
| 142 | + handleCheckClick, | ||
| 131 | }; | 143 | }; | 
| 132 | }, | 144 | }, | 
| 133 | }); | 145 | }); | 
| 1 | -import {BasicColumn} from '/@/components/Table'; | ||
| 2 | -import {FormSchema} from '/@/components/Table'; | ||
| 3 | -import {h} from 'vue'; | ||
| 4 | -import {Switch} from 'ant-design-vue'; | ||
| 5 | -import {setRoleStatus} from '/@/api/system/system'; | ||
| 6 | -import {useMessage} from '/@/hooks/web/useMessage'; | 1 | +import { BasicColumn } from '/@/components/Table'; | 
| 2 | +import { FormSchema } from '/@/components/Table'; | ||
| 3 | +import { h } from 'vue'; | ||
| 4 | +import { Switch } from 'ant-design-vue'; | ||
| 5 | +import { setRoleStatus } from '/@/api/system/system'; | ||
| 6 | +import { useMessage } from '/@/hooks/web/useMessage'; | ||
| 7 | 7 | ||
| 8 | export const columns: BasicColumn[] = [ | 8 | export const columns: BasicColumn[] = [ | 
| 9 | { | 9 | { | 
| @@ -20,7 +20,7 @@ export const columns: BasicColumn[] = [ | @@ -20,7 +20,7 @@ export const columns: BasicColumn[] = [ | ||
| 20 | title: '状态', | 20 | title: '状态', | 
| 21 | dataIndex: 'status', | 21 | dataIndex: 'status', | 
| 22 | width: 120, | 22 | width: 120, | 
| 23 | - customRender: ({record}) => { | 23 | + customRender: ({ record }) => { | 
| 24 | if (!Reflect.has(record, 'pendingStatus')) { | 24 | if (!Reflect.has(record, 'pendingStatus')) { | 
| 25 | record.pendingStatus = false; | 25 | record.pendingStatus = false; | 
| 26 | } | 26 | } | 
| @@ -32,7 +32,7 @@ export const columns: BasicColumn[] = [ | @@ -32,7 +32,7 @@ export const columns: BasicColumn[] = [ | ||
| 32 | onChange(checked: boolean) { | 32 | onChange(checked: boolean) { | 
| 33 | record.pendingStatus = true; | 33 | record.pendingStatus = true; | 
| 34 | const newStatus = checked ? 1 : 0; | 34 | const newStatus = checked ? 1 : 0; | 
| 35 | - const {createMessage} = useMessage(); | 35 | + const { createMessage } = useMessage(); | 
| 36 | setRoleStatus(record.id, newStatus) | 36 | setRoleStatus(record.id, newStatus) | 
| 37 | .then(() => { | 37 | .then(() => { | 
| 38 | record.status = newStatus; | 38 | record.status = newStatus; | 
| @@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | @@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | ||
| 52 | { | 52 | { | 
| 53 | title: '备注', | 53 | title: '备注', | 
| 54 | dataIndex: 'remark', | 54 | dataIndex: 'remark', | 
| 55 | - width:240, | 55 | + width: 240, | 
| 56 | }, | 56 | }, | 
| 57 | { | 57 | { | 
| 58 | title: '创建时间', | 58 | title: '创建时间', | 
| @@ -66,7 +66,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -66,7 +66,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 66 | field: 'roleName', | 66 | field: 'roleName', | 
| 67 | label: '角色名称', | 67 | label: '角色名称', | 
| 68 | component: 'Input', | 68 | component: 'Input', | 
| 69 | - colProps: {span: 8}, | 69 | + colProps: { span: 8 }, | 
| 70 | }, | 70 | }, | 
| 71 | { | 71 | { | 
| 72 | field: 'status', | 72 | field: 'status', | 
| @@ -74,11 +74,11 @@ export const searchFormSchema: FormSchema[] = [ | @@ -74,11 +74,11 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 74 | component: 'Select', | 74 | component: 'Select', | 
| 75 | componentProps: { | 75 | componentProps: { | 
| 76 | options: [ | 76 | options: [ | 
| 77 | - {label: '启用', value: 1}, | ||
| 78 | - {label: '停用', value: 0}, | 77 | + { label: '启用', value: 1 }, | 
| 78 | + { label: '停用', value: 0 }, | ||
| 79 | ], | 79 | ], | 
| 80 | }, | 80 | }, | 
| 81 | - colProps: {span: 8}, | 81 | + colProps: { span: 8 }, | 
| 82 | }, | 82 | }, | 
| 83 | ]; | 83 | ]; | 
| 84 | 84 | ||
| @@ -96,8 +96,8 @@ export const formSchema: FormSchema[] = [ | @@ -96,8 +96,8 @@ export const formSchema: FormSchema[] = [ | ||
| 96 | defaultValue: 0, | 96 | defaultValue: 0, | 
| 97 | componentProps: { | 97 | componentProps: { | 
| 98 | options: [ | 98 | options: [ | 
| 99 | - {label: '启用', value: 1}, | ||
| 100 | - {label: '停用', value: 0}, | 99 | + { label: '启用', value: 1 }, | 
| 100 | + { label: '停用', value: 0 }, | ||
| 101 | ], | 101 | ], | 
| 102 | }, | 102 | }, | 
| 103 | }, | 103 | }, | 
| 1 | -import { BasicColumn } from "/@/components/Table/src/types/table"; | ||
| 2 | -import {FormSchema} from "/@/components/Form"; | ||
| 3 | -import {getAllRoleList} from "/@/api/system/system"; | ||
| 4 | -import {RoleEnum} from "/@/enums/roleEnum"; | 1 | +import { BasicColumn } from '/@/components/Table/src/types/table'; | 
| 2 | +import { FormSchema } from '/@/components/Form'; | ||
| 3 | +import { getAllRoleList } from '/@/api/system/system'; | ||
| 4 | +import { RoleEnum } from '/@/enums/roleEnum'; | ||
| 5 | 5 | ||
| 6 | export function getBasicColumns(): BasicColumn[] { | 6 | export function getBasicColumns(): BasicColumn[] { | 
| 7 | - return [ | ||
| 8 | - { | ||
| 9 | - title: '图标', | ||
| 10 | - dataIndex: 'icon', | ||
| 11 | - fixed: 'left', | ||
| 12 | - width: 50, | ||
| 13 | - slots: { customRender: 'img' }, | ||
| 14 | - }, | ||
| 15 | - { | ||
| 16 | - title: '名称', | ||
| 17 | - dataIndex: 'name', | ||
| 18 | - width: 150, | ||
| 19 | - }, | ||
| 20 | - { | ||
| 21 | - title: '描述', | ||
| 22 | - dataIndex: 'description', | ||
| 23 | - width: 150, | ||
| 24 | - }, | ||
| 25 | - { | ||
| 26 | - title: '状态', | ||
| 27 | - dataIndex: 'userStatusEnum', | ||
| 28 | - width: 50, | ||
| 29 | - slots: { customRender: 'status' }, | ||
| 30 | - }, | ||
| 31 | - { | ||
| 32 | - title: '有效期', | ||
| 33 | - dataIndex: 'tenantExpireTime', | ||
| 34 | - width: 150, | ||
| 35 | - }, | ||
| 36 | - { | ||
| 37 | - title: '创建时间', | ||
| 38 | - dataIndex: 'createTime', | ||
| 39 | - width: 150, | ||
| 40 | - }, | ||
| 41 | - ] | ||
| 42 | - } | 7 | + return [ | 
| 8 | + { | ||
| 9 | + title: '图标', | ||
| 10 | + dataIndex: 'icon', | ||
| 11 | + fixed: 'left', | ||
| 12 | + width: 50, | ||
| 13 | + slots: { customRender: 'img' }, | ||
| 14 | + }, | ||
| 15 | + { | ||
| 16 | + title: '名称', | ||
| 17 | + dataIndex: 'name', | ||
| 18 | + width: 150, | ||
| 19 | + }, | ||
| 20 | + { | ||
| 21 | + title: '描述', | ||
| 22 | + dataIndex: 'description', | ||
| 23 | + width: 150, | ||
| 24 | + }, | ||
| 25 | + { | ||
| 26 | + title: '状态', | ||
| 27 | + dataIndex: 'userStatusEnum', | ||
| 28 | + width: 50, | ||
| 29 | + slots: { customRender: 'status' }, | ||
| 30 | + }, | ||
| 31 | + { | ||
| 32 | + title: '有效期', | ||
| 33 | + dataIndex: 'tenantExpireTime', | ||
| 34 | + width: 150, | ||
| 35 | + }, | ||
| 36 | + { | ||
| 37 | + title: '创建时间', | ||
| 38 | + dataIndex: 'createTime', | ||
| 39 | + width: 150, | ||
| 40 | + }, | ||
| 41 | + ]; | ||
| 42 | +} | ||
| 43 | export const tenantFormSchema: FormSchema[] = [ | 43 | export const tenantFormSchema: FormSchema[] = [ | 
| 44 | { | 44 | { | 
| 45 | field: 'id', | 45 | field: 'id', | 
| 46 | label: 'id', | 46 | label: 'id', | 
| 47 | slot: 'iconSelect', | 47 | slot: 'iconSelect', | 
| 48 | component: 'Input', | 48 | component: 'Input', | 
| 49 | - show:false | 49 | + show: false, | 
| 50 | }, | 50 | }, | 
| 51 | { | 51 | { | 
| 52 | field: 'icon', | 52 | field: 'icon', | 
| @@ -67,12 +67,12 @@ export const tenantFormSchema: FormSchema[] = [ | @@ -67,12 +67,12 @@ export const tenantFormSchema: FormSchema[] = [ | ||
| 67 | required: true, | 67 | required: true, | 
| 68 | componentProps: { | 68 | componentProps: { | 
| 69 | mode: 'multiple', | 69 | mode: 'multiple', | 
| 70 | - api:getAllRoleList, | ||
| 71 | - params:{ | ||
| 72 | - roleType:RoleEnum.ROLE_TENANT_ADMIN | 70 | + api: getAllRoleList, | 
| 71 | + params: { | ||
| 72 | + roleType: RoleEnum.ROLE_TENANT_ADMIN, | ||
| 73 | }, | 73 | }, | 
| 74 | - labelField:'name', | ||
| 75 | - valueField:'id', | 74 | + labelField: 'name', | 
| 75 | + valueField: 'id', | ||
| 76 | }, | 76 | }, | 
| 77 | }, | 77 | }, | 
| 78 | { | 78 | { | 
| @@ -82,8 +82,8 @@ export const tenantFormSchema: FormSchema[] = [ | @@ -82,8 +82,8 @@ export const tenantFormSchema: FormSchema[] = [ | ||
| 82 | defaultValue: true, | 82 | defaultValue: true, | 
| 83 | componentProps: { | 83 | componentProps: { | 
| 84 | options: [ | 84 | options: [ | 
| 85 | - {label: '启用', value: true}, | ||
| 86 | - {label: '停用', value: false}, | 85 | + { label: '启用', value: true }, | 
| 86 | + { label: '停用', value: false }, | ||
| 87 | ], | 87 | ], | 
| 88 | }, | 88 | }, | 
| 89 | }, | 89 | }, | 
| @@ -91,15 +91,14 @@ export const tenantFormSchema: FormSchema[] = [ | @@ -91,15 +91,14 @@ export const tenantFormSchema: FormSchema[] = [ | ||
| 91 | field: 'tenantExpireTime', | 91 | field: 'tenantExpireTime', | 
| 92 | label: '有效期: ', | 92 | label: '有效期: ', | 
| 93 | component: 'DatePicker', | 93 | component: 'DatePicker', | 
| 94 | - componentProps:{ | ||
| 95 | - showTime:true, | ||
| 96 | - format:'YYYY-MM-DD HH:mm:ss' | ||
| 97 | - } | 94 | + componentProps: { | 
| 95 | + showTime: true, | ||
| 96 | + format: 'YYYY-MM-DD HH:mm:ss', | ||
| 97 | + }, | ||
| 98 | }, | 98 | }, | 
| 99 | { | 99 | { | 
| 100 | label: '备注: ', | 100 | label: '备注: ', | 
| 101 | field: 'description', | 101 | field: 'description', | 
| 102 | component: 'InputTextArea', | 102 | component: 'InputTextArea', | 
| 103 | }, | 103 | }, | 
| 104 | - | ||
| 105 | ]; | 104 | ]; | 
| 1 | -import {BasicColumn} from '/@/components/Table'; | ||
| 2 | -import {FormSchema} from '/@/components/Table'; | ||
| 3 | -import {h} from 'vue'; | ||
| 4 | -import {Switch} from 'ant-design-vue'; | ||
| 5 | -import {setRoleStatus} from '/@/api/system/system'; | ||
| 6 | -import {useMessage} from '/@/hooks/web/useMessage'; | ||
| 7 | -import {RoleEnum} from "/@/enums/roleEnum"; | 1 | +import { BasicColumn } from '/@/components/Table'; | 
| 2 | +import { FormSchema } from '/@/components/Table'; | ||
| 3 | +import { h } from 'vue'; | ||
| 4 | +import { Switch } from 'ant-design-vue'; | ||
| 5 | +import { setRoleStatus } from '/@/api/system/system'; | ||
| 6 | +import { useMessage } from '/@/hooks/web/useMessage'; | ||
| 7 | +import { RoleEnum } from '/@/enums/roleEnum'; | ||
| 8 | export const columns: BasicColumn[] = [ | 8 | export const columns: BasicColumn[] = [ | 
| 9 | { | 9 | { | 
| 10 | title: '角色名称', | 10 | title: '角色名称', | 
| @@ -20,7 +20,7 @@ export const columns: BasicColumn[] = [ | @@ -20,7 +20,7 @@ export const columns: BasicColumn[] = [ | ||
| 20 | title: '状态', | 20 | title: '状态', | 
| 21 | dataIndex: 'status', | 21 | dataIndex: 'status', | 
| 22 | width: 120, | 22 | width: 120, | 
| 23 | - customRender: ({record}) => { | 23 | + customRender: ({ record }) => { | 
| 24 | if (!Reflect.has(record, 'pendingStatus')) { | 24 | if (!Reflect.has(record, 'pendingStatus')) { | 
| 25 | record.pendingStatus = false; | 25 | record.pendingStatus = false; | 
| 26 | } | 26 | } | 
| @@ -32,7 +32,7 @@ export const columns: BasicColumn[] = [ | @@ -32,7 +32,7 @@ export const columns: BasicColumn[] = [ | ||
| 32 | onChange(checked: boolean) { | 32 | onChange(checked: boolean) { | 
| 33 | record.pendingStatus = true; | 33 | record.pendingStatus = true; | 
| 34 | const newStatus = checked ? 1 : 0; | 34 | const newStatus = checked ? 1 : 0; | 
| 35 | - const {createMessage} = useMessage(); | 35 | + const { createMessage } = useMessage(); | 
| 36 | setRoleStatus(record.id, newStatus) | 36 | setRoleStatus(record.id, newStatus) | 
| 37 | .then(() => { | 37 | .then(() => { | 
| 38 | record.status = newStatus; | 38 | record.status = newStatus; | 
| @@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | @@ -52,7 +52,7 @@ export const columns: BasicColumn[] = [ | ||
| 52 | { | 52 | { | 
| 53 | title: '备注', | 53 | title: '备注', | 
| 54 | dataIndex: 'remark', | 54 | dataIndex: 'remark', | 
| 55 | - width:240, | 55 | + width: 240, | 
| 56 | }, | 56 | }, | 
| 57 | { | 57 | { | 
| 58 | title: '创建时间', | 58 | title: '创建时间', | 
| @@ -66,15 +66,15 @@ export const searchFormSchema: FormSchema[] = [ | @@ -66,15 +66,15 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 66 | field: 'roleName', | 66 | field: 'roleName', | 
| 67 | label: '角色名称', | 67 | label: '角色名称', | 
| 68 | component: 'Input', | 68 | component: 'Input', | 
| 69 | - colProps: {span: 8}, | 69 | + colProps: { span: 8 }, | 
| 70 | }, | 70 | }, | 
| 71 | { | 71 | { | 
| 72 | field: 'roleType', | 72 | field: 'roleType', | 
| 73 | label: '', | 73 | label: '', | 
| 74 | component: 'Input', | 74 | component: 'Input', | 
| 75 | - colProps: {span: 8}, | ||
| 76 | - defaultValue:RoleEnum.ROLE_TENANT_ADMIN, | ||
| 77 | - ifShow:false | 75 | + colProps: { span: 8 }, | 
| 76 | + defaultValue: RoleEnum.ROLE_TENANT_ADMIN, | ||
| 77 | + ifShow: false, | ||
| 78 | }, | 78 | }, | 
| 79 | { | 79 | { | 
| 80 | field: 'status', | 80 | field: 'status', | 
| @@ -82,11 +82,11 @@ export const searchFormSchema: FormSchema[] = [ | @@ -82,11 +82,11 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 82 | component: 'Select', | 82 | component: 'Select', | 
| 83 | componentProps: { | 83 | componentProps: { | 
| 84 | options: [ | 84 | options: [ | 
| 85 | - {label: '启用', value: 1}, | ||
| 86 | - {label: '停用', value: 0}, | 85 | + { label: '启用', value: 1 }, | 
| 86 | + { label: '停用', value: 0 }, | ||
| 87 | ], | 87 | ], | 
| 88 | }, | 88 | }, | 
| 89 | - colProps: {span: 8}, | 89 | + colProps: { span: 8 }, | 
| 90 | }, | 90 | }, | 
| 91 | ]; | 91 | ]; | 
| 92 | 92 | ||
| @@ -104,8 +104,8 @@ export const formSchema: FormSchema[] = [ | @@ -104,8 +104,8 @@ export const formSchema: FormSchema[] = [ | ||
| 104 | defaultValue: 0, | 104 | defaultValue: 0, | 
| 105 | componentProps: { | 105 | componentProps: { | 
| 106 | options: [ | 106 | options: [ | 
| 107 | - {label: '启用', value: 1}, | ||
| 108 | - {label: '停用', value: 0}, | 107 | + { label: '启用', value: 1 }, | 
| 108 | + { label: '停用', value: 0 }, | ||
| 109 | ], | 109 | ], | 
| 110 | }, | 110 | }, | 
| 111 | }, | 111 | }, | 
| @@ -21,7 +21,7 @@ export interface RequestOptions { | @@ -21,7 +21,7 @@ export interface RequestOptions { | ||
| 21 | ignoreCancelToken?: boolean; | 21 | ignoreCancelToken?: boolean; | 
| 22 | // Whether to send token in header | 22 | // Whether to send token in header | 
| 23 | withToken?: boolean; | 23 | withToken?: boolean; | 
| 24 | - catchFirst?:boolean; | 24 | + catchFirst?: boolean; | 
| 25 | } | 25 | } | 
| 26 | 26 | ||
| 27 | export interface Result<T = any> { | 27 | export interface Result<T = any> { |