diff --git a/components.d.ts b/components.d.ts index 0f8c824..172664f 100644 --- a/components.d.ts +++ b/components.d.ts @@ -18,6 +18,7 @@ declare module 'vue' { QiunDataCharts: typeof import('./src/components/qiun-data-charts/qiun-data-charts.vue')['default'] QiunError: typeof import('./src/components/qiun-error/qiun-error.vue')['default'] QiunLoading: typeof import('./src/components/qiun-loading/qiun-loading.vue')['default'] + WdActionSheet: typeof import('wot-design-uni/components/wd-action-sheet/wd-action-sheet.vue')['default'] WdBadge: typeof import('wot-design-uni/components/wd-badge/wd-badge.vue')['default'] WdButton: typeof import('wot-design-uni/components/wd-button/wd-button.vue')['default'] WdCalendar: typeof import('wot-design-uni/components/wd-calendar/wd-calendar.vue')['default'] @@ -32,12 +33,11 @@ declare module 'vue' { WdDivider: typeof import('wot-design-uni/components/wd-divider/wd-divider.vue')['default'] WdDropMenu: typeof import('wot-design-uni/components/wd-drop-menu/wd-drop-menu.vue')['default'] WdDropMenuItem: typeof import('wot-design-uni/components/wd-drop-menu-item/wd-drop-menu-item.vue')['default'] + WdFab: typeof import('wot-design-uni/components/wd-fab/wd-fab.vue')['default'] WdForm: typeof import('wot-design-uni/components/wd-form/wd-form.vue')['default'] - WdFormItem: typeof import('wot-design-uni/components/wd-form-item/wd-form-item.vue')['default'] WdGrid: typeof import('wot-design-uni/components/wd-grid/wd-grid.vue')['default'] WdGridItem: typeof import('wot-design-uni/components/wd-grid-item/wd-grid-item.vue')['default'] WdIcon: typeof import('wot-design-uni/components/wd-icon/wd-icon.vue')['default'] - WdImg: typeof import('wot-design-uni/components/wd-img/wd-img.vue')['default'] WdImgCropper: typeof import('wot-design-uni/components/wd-img-cropper/wd-img-cropper.vue')['default'] WdInput: typeof import('wot-design-uni/components/wd-input/wd-input.vue')['default'] WdInputNumber: typeof import('wot-design-uni/components/wd-input-number/wd-input-number.vue')['default'] @@ -46,7 +46,6 @@ declare module 'vue' { WdMessageBox: typeof import('wot-design-uni/components/wd-message-box/wd-message-box.vue')['default'] WdNotify: typeof import('wot-design-uni/components/wd-notify/wd-notify.vue')['default'] WdPopup: typeof import('wot-design-uni/components/wd-popup/wd-popup.vue')['default'] - WdProgress: typeof import('wot-design-uni/components/wd-progress/wd-progress.vue')['default'] WdRadio: typeof import('wot-design-uni/components/wd-radio/wd-radio.vue')['default'] WdRadioGroup: typeof import('wot-design-uni/components/wd-radio-group/wd-radio-group.vue')['default'] WdSearch: typeof import('wot-design-uni/components/wd-search/wd-search.vue')['default'] @@ -59,9 +58,7 @@ declare module 'vue' { WdTabbarItem: typeof import('wot-design-uni/components/wd-tabbar-item/wd-tabbar-item.vue')['default'] WdTabs: typeof import('wot-design-uni/components/wd-tabs/wd-tabs.vue')['default'] WdTag: typeof import('wot-design-uni/components/wd-tag/wd-tag.vue')['default'] - WdText: typeof import('wot-design-uni/components/wd-text/wd-text.vue')['default'] WdTextarea: typeof import('wot-design-uni/components/wd-textarea/wd-textarea.vue')['default'] WdToast: typeof import('wot-design-uni/components/wd-toast/wd-toast.vue')['default'] - WdUpload: typeof import('wot-design-uni/components/wd-upload/wd-upload.vue')['default'] } } diff --git a/src/App.vue b/src/App.vue index 35c1b3c..de40390 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,3 @@ diff --git a/src/api/auth.ts b/src/api/auth.ts index cf2fa64..d17d113 100644 --- a/src/api/auth.ts +++ b/src/api/auth.ts @@ -1,7 +1,7 @@ -import request, { publicRequest } from "@/utils/request"; +import request from "@/utils/request"; const AUTH_BASE_URL = "/api/v1/auth"; -const WECHAT_MINIAPP_AUTH_BASE_URL = "/api/v1/wechat/miniapp/auth"; +const WXMA_AUTH_BASE_URL = "/api/v1/wxma/auth"; export interface LoginData { username: string; @@ -20,7 +20,7 @@ export interface LoginResult { openid?: string; } -export interface CaptchaVO { +export interface Captcha { captchaId: string; captchaBase64: string; } @@ -30,7 +30,7 @@ export interface SmsLoginData { code: string; } -export interface WechatMiniappLoginResult { +export interface WxMaLoginResp { accessToken?: string; refreshToken?: string; tokenType?: string; @@ -40,12 +40,12 @@ export interface WechatMiniappLoginResult { openid?: string; } -export interface WechatMiniappPhoneLoginData { +export interface WxMaPhoneLoginData { loginCode: string; phoneCode: string; } -export interface WechatMiniappBindMobileData { +export interface WxMaBindMobileData { openid: string; mobile: string; smsCode: string; @@ -55,8 +55,8 @@ const AuthAPI = { /** * 获取图形验证码 */ - getCaptcha(): Promise { - return publicRequest({ + getCaptcha(): Promise { + return request({ url: `${AUTH_BASE_URL}/captcha`, method: "GET", }); @@ -66,7 +66,7 @@ const AuthAPI = { * 账号密码登录 */ login(data: LoginData): Promise { - return publicRequest({ + return request({ url: `${AUTH_BASE_URL}/login`, method: "POST", data: data, @@ -80,7 +80,7 @@ const AuthAPI = { */ sendSmsLoginCode(mobile: string): Promise { const mobileSafe = encodeURIComponent(mobile); - return publicRequest({ + return request({ url: `${AUTH_BASE_URL}/sms/code?mobile=${mobileSafe}`, method: "POST", }); @@ -92,7 +92,7 @@ const AuthAPI = { loginBySms(data: SmsLoginData): Promise { const mobileSafe = encodeURIComponent(data.mobile); const codeSafe = encodeURIComponent(data.code); - return publicRequest({ + return request({ url: `${AUTH_BASE_URL}/login/sms?mobile=${mobileSafe}&code=${codeSafe}`, method: "POST", }); @@ -105,9 +105,9 @@ const AuthAPI = { * - 已绑定手机号的用户:直接返回 token,登录成功 * - 未绑定手机号的用户:返回 openid,需调用绑定手机号接口 */ - wechatMiniappSilentLogin(code: string): Promise { - return publicRequest({ - url: `${WECHAT_MINIAPP_AUTH_BASE_URL}/silent-login?code=${encodeURIComponent(code)}`, + wxMaSilentLogin(code: string): Promise { + return request({ + url: `${WXMA_AUTH_BASE_URL}/silent-login?code=${encodeURIComponent(code)}`, method: "POST", }); }, @@ -118,12 +118,11 @@ const AuthAPI = { * 适用场景:企业认证小程序(已开通手机号快捷登录权限) * 一步完成登录,无需绑定流程,自动创建新用户 */ - wechatMiniappPhoneLogin(data: WechatMiniappPhoneLoginData): Promise { - const loginCodeSafe = encodeURIComponent(data.loginCode); - const phoneCodeSafe = encodeURIComponent(data.phoneCode); - return publicRequest({ - url: `${WECHAT_MINIAPP_AUTH_BASE_URL}/phone-login?loginCode=${loginCodeSafe}&phoneCode=${phoneCodeSafe}`, + wxMaPhoneLogin(data: WxMaPhoneLoginData): Promise { + return request({ + url: `${WXMA_AUTH_BASE_URL}/phone-login`, method: "POST", + data: data, }); }, @@ -132,13 +131,11 @@ const AuthAPI = { * * 演示环境说明:短信服务未配置,验证码固定为 123456 */ - wechatMiniappBindMobile(data: WechatMiniappBindMobileData): Promise { - const openidSafe = encodeURIComponent(data.openid); - const mobileSafe = encodeURIComponent(data.mobile); - const smsCodeSafe = encodeURIComponent(data.smsCode); - return publicRequest({ - url: `${WECHAT_MINIAPP_AUTH_BASE_URL}/bind-mobile?openid=${openidSafe}&mobile=${mobileSafe}&smsCode=${smsCodeSafe}`, + wxMaBindMobile(data: WxMaBindMobileData): Promise { + return request({ + url: `${WXMA_AUTH_BASE_URL}/bind-mobile`, method: "POST", + data: data, }); }, @@ -155,8 +152,8 @@ const AuthAPI = { /** * 登出 */ - logout(): Promise { - return request({ + logout() { + return request({ url: `${AUTH_BASE_URL}/logout`, method: "DELETE", }); @@ -166,7 +163,7 @@ const AuthAPI = { * 刷新令牌 */ refreshToken(refreshToken: string): Promise<{ accessToken: string; expiresIn: number }> { - return publicRequest<{ accessToken: string; expiresIn: number }>({ + return request<{ accessToken: string; expiresIn: number }>({ url: `${AUTH_BASE_URL}/refresh-token`, method: "POST", data: { refreshToken }, diff --git a/src/api/config.ts b/src/api/config.ts index d1c97a9..75d3c2a 100644 --- a/src/api/config.ts +++ b/src/api/config.ts @@ -5,7 +5,7 @@ const CONFIG_BASE_URL = "/api/v1/configs"; const ConfigAPI = { /** 获取系统配置分页数据 */ getPage(queryParams: ConfigPageQuery) { - return request({ + return request>({ url: `${CONFIG_BASE_URL}`, method: "GET", data: queryParams, @@ -90,7 +90,7 @@ export interface ConfigForm { } /** 系统配置分页对象 */ -export interface ConfigPageVO { +export interface ConfigItem { /** 主键 */ id?: number; /** 配置名称 */ diff --git a/src/api/dept.ts b/src/api/dept.ts index 7fccee6..bc54d2c 100644 --- a/src/api/dept.ts +++ b/src/api/dept.ts @@ -10,7 +10,7 @@ const DeptAPI = { * @returns 部门树形表格数据 */ getList(queryParams?: DeptQuery) { - return request({ + return request({ url: `${DEPT_BASE_URL}`, method: "GET", data: queryParams, @@ -92,9 +92,9 @@ export interface DeptQuery { } /** 部门类型 */ -export interface DeptVO { +export interface DeptItem { /** 子部门 */ - children?: DeptVO[]; + children?: DeptItem[]; /** 创建时间 */ createTime?: Date; /** 部门ID */ diff --git a/src/api/dict.ts b/src/api/dict.ts index bade754..91f4efb 100644 --- a/src/api/dict.ts +++ b/src/api/dict.ts @@ -4,7 +4,7 @@ const DICT_BASE_URL = "/api/v1/dicts"; const DictAPI = { getPage(queryParams: DictTypePageQuery) { - return request({ + return request>({ url: `${DICT_BASE_URL}`, method: "GET", data: queryParams, @@ -42,7 +42,7 @@ const DictAPI = { }, getItemPage(dictCode: string, queryParams: DictItemPageQuery) { - return request({ + return request>({ url: `${DICT_BASE_URL}/${dictCode}/items`, method: "GET", data: queryParams, @@ -95,7 +95,7 @@ export interface DictTypeForm { remark?: string; } -export interface DictTypePageVO { +export interface DictTypeItem { id?: string; name?: string; dictCode?: string; @@ -116,7 +116,7 @@ export interface DictItemForm { status?: number; } -export interface DictItemPageVO { +export interface DictDataItem { id?: string; dictCode?: string; label?: string; diff --git a/src/api/log.ts b/src/api/log.ts index 5e17546..3fe7f03 100644 --- a/src/api/log.ts +++ b/src/api/log.ts @@ -1,7 +1,6 @@ import request from "@/utils/request"; const LOG_BASE_URL = "/api/v1/logs"; -const STATISTICS_BASE_URL = "/api/v1/statistics"; const LogAPI = { /** @@ -10,7 +9,7 @@ const LogAPI = { * @param queryParams 查询参数 */ getPage(queryParams?: LogPageQuery) { - return request({ + return request>({ url: `${LOG_BASE_URL}`, method: "GET", data: queryParams, @@ -24,8 +23,8 @@ const LogAPI = { * @returns 访问趋势数据 */ getVisitTrend(queryParams: VisitTrendQuery) { - return request({ - url: `${STATISTICS_BASE_URL}/visits/trend`, + return request({ + url: `${LOG_BASE_URL}/views/trend`, method: "GET", data: queryParams, }); @@ -37,8 +36,8 @@ const LogAPI = { * @returns 访问概览数据 */ getVisitStats() { - return request({ - url: `${STATISTICS_BASE_URL}/visits/overview`, + return request({ + url: `${LOG_BASE_URL}/views`, method: "GET", }); }, @@ -57,19 +56,27 @@ export interface LogPageQuery extends PageQuery { } /** - * 系统日志分页VO + * 系统日志分页对象 */ -export interface LogVO { +export interface LogItem { /** 主键 */ id?: number; - /** 日志模块 */ - module?: string; - /** 日志内容 */ + /** 模块 */ + module?: number; + /** 操作类型 */ + actionType?: number; + /** 操作标题 */ + title?: string; + /** 自定义日志内容 */ content?: string; + /** 操作人ID */ + operatorId?: number; + /** 操作人名称 */ + operatorName?: string; /** 请求路径 */ requestUri?: string; /** 请求方法 */ - method?: string; + requestMethod?: string; /** IP 地址 */ ip?: string; /** 地区 */ @@ -78,16 +85,18 @@ export interface LogVO { browser?: string; /** 终端系统 */ os?: string; + /** 状态:0失败 1成功 */ + status?: number; + /** 错误信息 */ + errorMsg?: string; /** 执行时间(毫秒) */ executionTime?: number; - /** 操作人 */ - operator?: string; /** 操作时间 */ createTime?: string; } -/** 访问趋势视图对象 */ -export interface VisitTrendVO { +/** 访问趋势 */ +export interface VisitTrend { /** 日期列表 */ dates: string[]; /** 浏览量(PV) */ @@ -107,7 +116,7 @@ export interface VisitTrendQuery { } /** 访问统计 */ -export interface VisitStatsVO { +export interface VisitStats { /** 今日访客数(UV) */ todayUvCount: number; /** 总访客数 */ diff --git a/src/api/menu.ts b/src/api/menu.ts index 8293a95..2ace207 100644 --- a/src/api/menu.ts +++ b/src/api/menu.ts @@ -5,7 +5,7 @@ const MENU_BASE_URL = "/api/v1/menus"; const MenuAPI = { /** 获取菜单列表 */ getList(queryParams?: MenuQuery) { - return request({ + return request({ url: `${MENU_BASE_URL}`, method: "GET", data: queryParams, @@ -67,9 +67,9 @@ export interface MenuQuery { } /** 菜单类型 */ -export interface MenuVO { +export interface MenuItem { /** 子菜单 */ - children?: MenuVO[]; + children?: MenuItem[]; /** 组件路径 */ component?: string; /** 创建时间 */ diff --git a/src/api/notice.ts b/src/api/notice.ts index b02cfbb..a6503a9 100644 --- a/src/api/notice.ts +++ b/src/api/notice.ts @@ -5,7 +5,7 @@ const NOTICE_BASE_URL = "/api/v1/notices"; const NoticeAPI = { /** 获取通知公告分页数据 */ getPage(queryParams?: NoticePageQuery) { - return request({ + return request>({ url: `${NOTICE_BASE_URL}`, method: "GET", data: queryParams, @@ -97,7 +97,7 @@ const NoticeAPI = { * @param id */ getDetail(id: string) { - return request({ + return request({ url: `${NOTICE_BASE_URL}/${id}/detail`, method: "GET", }); @@ -113,7 +113,7 @@ const NoticeAPI = { /** 获取我的通知分页列表 */ getMyNoticePage(queryParams?: NoticePageQuery) { - return request({ + return request>({ url: `${NOTICE_BASE_URL}/my`, method: "GET", data: queryParams, @@ -151,7 +151,7 @@ export interface NoticeForm { } /** 通知公告分页对象 */ -export interface NoticePageVO { +export interface NoticeItem { id: string; /** 通知标题 */ title?: string; @@ -175,7 +175,7 @@ export interface NoticePageVO { level?: string | number; } -export interface NoticeDetailVO { +export interface NoticeDetail { /** 通知ID */ id?: string; diff --git a/src/api/role.ts b/src/api/role.ts index b18fda6..60e3781 100644 --- a/src/api/role.ts +++ b/src/api/role.ts @@ -5,7 +5,7 @@ const ROLE_BASE_URL = "/api/v1/roles"; const RoleAPI = { /** 获取角色分页数据 */ getPage(queryParams?: RolePageQuery) { - return request({ + return request>({ url: `${ROLE_BASE_URL}`, method: "GET", data: queryParams, @@ -105,7 +105,7 @@ export interface RolePageQuery extends PageQuery { } /** 角色分页对象 */ -export interface RolePageVO { +export interface RoleItem { /** 角色编码 */ code?: string; /** 角色ID */ diff --git a/src/api/user.ts b/src/api/user.ts index 2bfaa87..ded23d1 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -21,7 +21,7 @@ const UserAPI = { * @param queryParams 查询参数 */ getPage(queryParams: UserPageQuery) { - return request({ + return request>({ url: `${USER_BASE_URL}`, method: "GET", data: queryParams, @@ -69,7 +69,7 @@ const UserAPI = { /** 获取个人中心用户信息 */ getProfile() { - return request({ + return request({ url: `${USER_BASE_URL}/profile`, method: "GET", }); @@ -217,7 +217,7 @@ export interface UserPageQuery extends PageQuery { } /** 用户分页对象 */ -export interface UserPageVO { +export interface UserItem { /** 用户头像URL */ avatar?: string; /** 创建时间 */ @@ -243,7 +243,7 @@ export interface UserPageVO { } /** 个人中心用户信息 */ -export interface UserProfileVO { +export interface UserProfile { /** 用户ID */ id?: number; diff --git a/src/components/custom-navbar/index.vue b/src/components/custom-navbar/index.vue index 0c78380..ea3132c 100644 --- a/src/components/custom-navbar/index.vue +++ b/src/components/custom-navbar/index.vue @@ -150,7 +150,7 @@ export default { diff --git a/src/pages/mine/index.vue b/src/pages/mine/index.vue index 53f3f92..139e4bb 100644 --- a/src/pages/mine/index.vue +++ b/src/pages/mine/index.vue @@ -6,8 +6,8 @@ @@ -27,7 +27,7 @@ /> - + @@ -40,14 +40,14 @@ - + {{ isLogin ? userInfo?.username || "未设置账号" : "快捷登录" }} {{ isLogin && deptNameText ? deptNameText : "安全可靠" }} @@ -58,13 +58,13 @@ - + {{ notificationCount }} - + @@ -96,14 +96,14 @@ 开源更新、实战内容、交流群入口,统一在这里查看 - + - - + + 我的资料 @@ -111,8 +111,8 @@ - - + + 账号安全 @@ -128,25 +128,25 @@ 系统工具 - - + + 网络检测 检测接口连通性 - + - - + + 清理缓存 显示当前缓存大小 {{ cacheSize }} - + @@ -155,25 +155,25 @@ 帮助与支持 - - + + 用户协议 了解产品使用规则 - + - - + + 关于系统 产品介绍与联系方式 v{{ appVersion }} - + @@ -204,12 +204,16 @@ + { "name": "official", "style": { - "navigationBarTitleText": "有来技术" + "navigationBarTitleText": "公众号" } } - - diff --git a/src/pages/mine/profile/complete-profile.vue b/src/pages/mine/profile/complete-profile.vue index 61980e8..37fbebb 100644 --- a/src/pages/mine/profile/complete-profile.vue +++ b/src/pages/mine/profile/complete-profile.vue @@ -1,121 +1,98 @@ + +{ + "name": "network", + "style": { + "navigationBarTitleText": "网络测试" + } +} + + diff --git a/src/pages/mine/settings/theme/index.vue b/src/pages/mine/settings/theme/index.vue index cbab2ab..2f0b04e 100644 --- a/src/pages/mine/settings/theme/index.vue +++ b/src/pages/mine/settings/theme/index.vue @@ -74,7 +74,7 @@ @@ -181,23 +181,15 @@ const applyCustomColor = () => { }; // 重置为默认主题 -const handleResetTheme = () => { - uni.showModal({ - title: "确认重置", - content: "确定要重置为默认主题吗?", - success: (res) => { - if (res.confirm) { - setThemeColor(themeColorOptions[0]); - customColor.value = themeColorOptions[0].primary; - - uni.showToast({ - title: "已重置为默认主题", - icon: "success", - duration: 1500, - }); - } - }, - }); +const handleResetTheme = async () => { + try { + await messageBox({ title: "确认重置", msg: "确定要重置为默认主题吗?", type: "warning" }); + setThemeColor(themeColorOptions[0]); + customColor.value = themeColorOptions[0].primary; + toast.success("已重置为默认主题"); + } catch { + // 用户取消 + } }; // 切换暗黑模式 diff --git a/src/pages/work/config/index.vue b/src/pages/work/config/index.vue index 0f94bd5..e3a17dd 100644 --- a/src/pages/work/config/index.vue +++ b/src/pages/work/config/index.vue @@ -44,11 +44,11 @@ - + {{ formData.id ? "编辑配置" : "新增配置" }} @@ -72,13 +72,19 @@ - + - - + @click="openConfigDialog()" + /> + + + @@ -86,20 +92,25 @@ import { onLoad, onReachBottom } from "@dcloudio/uni-app"; import { LoadMoreState } from "wot-design-uni/components/wd-loadmore/types"; import { FormRules } from "wot-design-uni/components/wd-form/types"; -import { useToast } from "wot-design-uni"; -import ConfigAPI, { type ConfigPageQuery, ConfigPageVO, ConfigForm } from "@/api/config"; +import { useToast, useMessage } from "wot-design-uni"; +import ConfigAPI, { type ConfigPageQuery, ConfigItem, ConfigForm } from "@/api/config"; import { hasPermission } from "@/utils/permission"; const toast = useToast(); +const { messageBox } = useMessage(); const loadMoreState = ref("loading"); const formRef = ref(); const submitting = ref(false); const queryParams = reactive({ pageNum: 1, pageSize: 10, keywords: "" }); const total = ref(0); -const pageData = ref([]); +const pageData = ref([]); const dialog = reactive({ visible: false }); +const actionSheetVisible = ref(false); +const actionSheetActions = ref<{ name: string; color?: string }[]>([]); +const currentActionItem = ref(null); + const initialFormData: ConfigForm = { id: undefined, configName: undefined, @@ -179,29 +190,34 @@ function closeConfigDialog() { Object.assign(formData, initialFormData); } +// 操作菜单分发 +function handleActionSelect({ value }: { value: string }) { + const item = currentActionItem.value; + if (value === "编辑") { + openConfigDialog(item.id); + } else if (value === "删除") { + messageBox({ + title: "确认删除", + msg: `确定要删除配置「${item.configName}」吗?`, + type: "warning", + }).then(async () => { + await ConfigAPI.deleteById(item.id!); + toast.success("删除成功"); + loadConfigList(); + }); + } +} + // 更多操作 -function showConfigActions(item: ConfigPageVO) { - const actions: string[] = []; - const actionMap: Record void> = {}; +function showConfigActions(item: ConfigItem) { + const actions: { name: string; color?: string }[] = []; if (hasPermission("sys:config:update")) { - actions.push("编辑"); - actionMap["编辑"] = () => openConfigDialog(item.id); + actions.push({ name: "编辑" }); } if (hasPermission("sys:config:delete")) { - actions.push("删除"); - actionMap["删除"] = async () => { - const { confirm } = await uni.showModal({ - title: "确认删除", - content: `确定要删除配置「${item.configName}」吗?`, - }); - if (confirm) { - await ConfigAPI.deleteById(item.id!); - toast.success("删除成功"); - loadConfigList(); - } - }; + actions.push({ name: "删除", color: "var(--color-danger)" }); } if (actions.length === 0) { @@ -209,13 +225,9 @@ function showConfigActions(item: ConfigPageVO) { return; } - uni.showActionSheet({ - itemList: actions, - success: ({ tapIndex }) => { - const action = actions[tapIndex]; - actionMap[action]?.(); - }, - }); + currentActionItem.value = item; + actionSheetActions.value = actions; + actionSheetVisible.value = true; } onReachBottom(() => { diff --git a/src/pages/work/dept/index.vue b/src/pages/work/dept/index.vue index cd0231b..4c84b11 100644 --- a/src/pages/work/dept/index.vue +++ b/src/pages/work/dept/index.vue @@ -36,11 +36,11 @@ - + {{ formData.id ? "编辑部门" : "新增部门" }} @@ -72,33 +72,42 @@ - - - + @click="openDeptDialog()" + /> + + + @@ -335,11 +342,3 @@ export default { options: { styleIsolation: "shared" } }; } } - - diff --git a/src/pages/work/dict/index.vue b/src/pages/work/dict/index.vue index 965f797..3752e46 100644 --- a/src/pages/work/dict/index.vue +++ b/src/pages/work/dict/index.vue @@ -47,11 +47,11 @@ - + {{ formData.id ? "编辑字典" : "新增字典" }} @@ -77,13 +77,17 @@ - + + - - + @click="openDictDialog()" + /> @@ -96,7 +100,7 @@ import { useToast } from "wot-design-uni"; import DictAPI, { type DictTypeForm, type DictTypePageQuery, - type DictTypePageVO, + type DictTypeItem, } from "@/api/dict"; import { hasPermission } from "@/utils/permission"; @@ -108,7 +112,7 @@ const submitting = ref(false); const queryParams = reactive({ pageNum: 1, pageSize: 10, keywords: "" }); const total = ref(0); -const pageData = ref([]); +const pageData = ref([]); const dialog = reactive({ visible: false }); const initialFormData: DictTypeForm = { @@ -149,7 +153,7 @@ function fetchDictTypeList() { }); } -function openDictItemPage(item: DictTypePageVO) { +function openDictItemPage(item: DictTypeItem) { if (!item.dictCode) return; router.push({ path: "/pages/work/dict/item/index", @@ -192,40 +196,48 @@ function closeDictDialog() { Object.assign(formData, initialFormData); } -function showDictActions(item: DictTypePageVO) { - const actions: string[] = []; +const actionSheetVisible = ref(false); +const actionSheetActions = ref<{ name: string; color?: string }[]>([]); +const pendingAction = ref void>>({}); + +function showDictActions(item: DictTypeItem) { + const actions: { name: string; color?: string }[] = []; const actionMap: Record void> = {}; - actions.push("字典数据"); + actions.push({ name: "字典数据" }); actionMap["字典数据"] = () => openDictItemPage(item); if (hasPermission("sys:dict:update")) { - actions.push("编辑"); + actions.push({ name: "编辑" }); actionMap["编辑"] = () => openDictDialog(item.id); } if (hasPermission("sys:dict:delete")) { - actions.push("删除"); + actions.push({ name: "删除", color: "var(--color-danger)" }); actionMap["删除"] = async () => { - const { confirm } = await uni.showModal({ - title: "确认删除", - content: `确定要删除字典「${item.name}」吗?`, - }); - if (confirm && item.id) { - await DictAPI.deleteByIds(String(item.id)); - toast.success("删除成功"); - loadDictTypeList(); - } + try { + await messageBox({ title: "确认删除", msg: `确定要删除字典「${item.name}」吗?`, type: "warning" }); + if (item.id) { + await DictAPI.deleteByIds(String(item.id)); + toast.success("删除成功"); + loadDictTypeList(); + } + } catch {} }; } - uni.showActionSheet({ - itemList: actions, - success: ({ tapIndex }) => { - const action = actions[tapIndex]; - actionMap[action]?.(); - }, - }); + if (actions.length === 0) { + toast.warning("暂无操作权限"); + return; + } + + actionSheetActions.value = actions; + pendingAction.value = actionMap; + actionSheetVisible.value = true; +} + +function handleActionSelect({ value }: { value: string }) { + pendingAction.value[value]?.(); } onReachBottom(() => { diff --git a/src/pages/work/dict/item/index.vue b/src/pages/work/dict/item/index.vue index 58aa894..7060fd1 100644 --- a/src/pages/work/dict/item/index.vue +++ b/src/pages/work/dict/item/index.vue @@ -49,11 +49,11 @@ - + {{ formData.id ? "编辑字典数据" : "新增字典数据" }} @@ -82,13 +82,17 @@ - + + - - + @click="openItemDialog()" + /> @@ -100,7 +104,7 @@ import { useToast } from "wot-design-uni"; import DictAPI, { type DictItemForm, type DictItemPageQuery, - type DictItemPageVO, + type DictDataItem, } from "@/api/dict"; import { hasPermission } from "@/utils/permission"; @@ -115,7 +119,7 @@ const submitting = ref(false); const queryParams = reactive({ pageNum: 1, pageSize: 10, keywords: "" }); const total = ref(0); -const pageData = ref([]); +const pageData = ref([]); const dialog = reactive({ visible: false }); const initialFormData: DictItemForm = { @@ -210,27 +214,30 @@ function closeItemDialog() { Object.assign(formData, initialFormData); } -function showItemActions(item: DictItemPageVO) { - const actions: string[] = []; +const actionSheetVisible = ref(false); +const actionSheetActions = ref<{ name: string; color?: string }[]>([]); +const pendingAction = ref void>>({}); + +function showItemActions(item: DictDataItem) { + const actions: { name: string; color?: string }[] = []; const actionMap: Record void> = {}; if (hasPermission("sys:dict-item:update")) { - actions.push("编辑"); + actions.push({ name: "编辑" }); actionMap["编辑"] = () => openItemDialog(item.id); } if (hasPermission("sys:dict-item:delete")) { - actions.push("删除"); + actions.push({ name: "删除", color: "var(--color-danger)" }); actionMap["删除"] = async () => { - const { confirm } = await uni.showModal({ - title: "确认删除", - content: `确定要删除字典数据「${item.label}」吗?`, - }); - if (confirm && item.id) { - await DictAPI.deleteItems(dictCode.value, String(item.id)); - toast.success("删除成功"); - loadItemList(); - } + try { + await messageBox({ title: "确认删除", msg: `确定要删除字典数据「${item.label}」吗?`, type: "warning" }); + if (item.id) { + await DictAPI.deleteItems(dictCode.value, String(item.id)); + toast.success("删除成功"); + loadItemList(); + } + } catch {} }; } @@ -239,13 +246,13 @@ function showItemActions(item: DictItemPageVO) { return; } - uni.showActionSheet({ - itemList: actions, - success: ({ tapIndex }) => { - const action = actions[tapIndex]; - actionMap[action]?.(); - }, - }); + actionSheetActions.value = actions; + pendingAction.value = actionMap; + actionSheetVisible.value = true; +} + +function handleActionSelect({ value }: { value: string }) { + pendingAction.value[value]?.(); } onReachBottom(() => { diff --git a/src/pages/work/index.vue b/src/pages/work/index.vue index ea9b75c..99999d1 100644 --- a/src/pages/work/index.vue +++ b/src/pages/work/index.vue @@ -72,8 +72,8 @@ function handleNavClick(item: any) { } router.push({ path: item.url }); - } catch (e) { - console.error("[work] router.push failed:", e, item); + } catch { + // 路由跳转失败已由拦截器处理 } } diff --git a/src/pages/work/log/index.vue b/src/pages/work/log/index.vue index 09c3d8f..6bf339e 100644 --- a/src/pages/work/log/index.vue +++ b/src/pages/work/log/index.vue @@ -21,10 +21,17 @@ - {{ item.operator }} - {{ item.module }} + {{ item.operatorName }} + + {{ item.status === 1 ? "成功" : "失败" }} + - {{ item.content }} + {{ item.title }} @@ -59,21 +66,31 @@ - 日志详情 + 日志详情 - + + - - + + + + + + + 关闭 @@ -86,15 +103,15 @@