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