update 重构 彻底删除proxy用法 改为vue3官方推荐写法

This commit is contained in:
疯狂的狮子Li
2026-04-10 13:07:37 +08:00
parent eb62402423
commit 9acf52e8a7
144 changed files with 1264 additions and 1082 deletions
+12
View File
@@ -15,5 +15,17 @@
"htmlWhitespaceSensitivity": "ignore", "htmlWhitespaceSensitivity": "ignore",
"experimentalSortPackageJson": { "experimentalSortPackageJson": {
"sortScripts": true "sortScripts": true
},
"sortImports": {
"newlinesBetween": false,
"groups": [
"type-import",
["value-builtin", "value-external"],
"type-internal",
"value-internal",
["type-parent", "type-sibling", "type-index"],
["value-parent", "value-sibling", "value-index"],
"unknown"
]
} }
} }
+8 -1
View File
@@ -8,7 +8,14 @@
"typescript/no-this-alias": "off", "typescript/no-this-alias": "off",
"typescript/no-empty-object-type": "off", "typescript/no-empty-object-type": "off",
"typescript/no-unused-expressions": "off", "typescript/no-unused-expressions": "off",
"prefer-rest-params": "off" "prefer-rest-params": "off",
"import/no-unassigned-import": "off",
"import/no-named-as-default-member": "off",
"import/no-named-as-default": "off",
"no-shadow": "off",
"unicorn/prefer-add-event-listener": "off",
"unicorn/consistent-function-scoping": "off",
"unicorn/no-instanceof-builtins": "off"
}, },
"categories": { "categories": {
"correctness": "error", "correctness": "error",
+1 -1
View File
@@ -5,9 +5,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useAppStore } from '@/store/modules/app';
import { useSettingsStore } from '@/store/modules/settings'; import { useSettingsStore } from '@/store/modules/settings';
import { handleThemeStyle } from '@/utils/theme'; import { handleThemeStyle } from '@/utils/theme';
import { useAppStore } from '@/store/modules/app';
const appStore = useAppStore(); const appStore = useAppStore();
+3 -3
View File
@@ -1,7 +1,7 @@
import type { DemoForm, DemoQuery, DemoVO } from '@/api/demo/demo/types';
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DemoVO, DemoForm, DemoQuery } from '@/api/demo/demo/types';
import { PageResult } from '@/api/types';
/** /**
* 查询测试单列表 * 查询测试单列表
+2 -2
View File
@@ -1,6 +1,6 @@
import type { TreeForm, TreeQuery, TreeVO } from '@/api/demo/tree/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TreeVO, TreeForm, TreeQuery } from '@/api/demo/tree/types';
/** /**
* 查询测试树列表 * 查询测试树列表
+4 -4
View File
@@ -1,8 +1,8 @@
import request from '@/utils/request'; import type { UserInfo } from '@/api/system/user/types';
import { AxiosPromise } from 'axios'; import type { AxiosPromise } from '@/utils/api-types';
import { LoginData, LoginResult, VerifyCodeResult } from './types';
import { UserInfo } from '@/api/system/user/types';
import { closePush } from '@/utils/push'; import { closePush } from '@/utils/push';
import request from '@/utils/request';
import type { LoginData, LoginResult, VerifyCodeResult } from './types';
// pc端固定客户端授权id // pc端固定客户端授权id
const clientId = import.meta.env.VITE_APP_CLIENT_ID; const clientId = import.meta.env.VITE_APP_CLIENT_ID;
+2 -2
View File
@@ -1,6 +1,6 @@
import type { RouteRecordRaw } from 'vue-router';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RouteRecordRaw } from 'vue-router';
// 获取路由 // 获取路由
export function getRouters(): AxiosPromise<RouteRecordRaw[]> { export function getRouters(): AxiosPromise<RouteRecordRaw[]> {
+2 -2
View File
@@ -1,6 +1,6 @@
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios'; import type { CacheVO } from './types';
import { CacheVO } from './types';
// 查询缓存详细 // 查询缓存详细
export function getCache(): AxiosPromise<CacheVO> { export function getCache(): AxiosPromise<CacheVO> {
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { LoginInfoQuery, LoginInfoVO } from './types'; import type { LoginInfoQuery, LoginInfoVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
// 查询登录日志列表 // 查询登录日志列表
export function list(query: LoginInfoQuery): AxiosPromise<PageResult<LoginInfoVO>> { export function list(query: LoginInfoQuery): AxiosPromise<PageResult<LoginInfoVO>> {
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { OnlineQuery, OnlineVO } from './types'; import type { OnlineQuery, OnlineVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
// 查询在线用户列表 // 查询在线用户列表
export function list(query: OnlineQuery): AxiosPromise<PageResult<OnlineVO>> { export function list(query: OnlineQuery): AxiosPromise<PageResult<OnlineVO>> {
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { OperLogQuery, OperLogVO } from './types'; import type { OperLogQuery, OperLogVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
// 查询操作日志列表 // 查询操作日志列表
export function list(query: OperLogQuery): AxiosPromise<PageResult<OperLogVO>> { export function list(query: OperLogQuery): AxiosPromise<PageResult<OperLogVO>> {
+3 -3
View File
@@ -1,7 +1,7 @@
import type { ClientForm, ClientQuery, ClientVO } from '@/api/system/client/types';
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ClientVO, ClientForm, ClientQuery } from '@/api/system/client/types';
import { PageResult } from '@/api/types';
/** /**
* 查询客户端管理列表 * 查询客户端管理列表
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { ConfigForm, ConfigQuery, ConfigVO } from './types'; import type { ConfigForm, ConfigQuery, ConfigVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
// 查询参数列表 // 查询参数列表
export function listConfig(query: ConfigQuery): AxiosPromise<PageResult<ConfigVO>> { export function listConfig(query: ConfigQuery): AxiosPromise<PageResult<ConfigVO>> {
+2 -2
View File
@@ -1,6 +1,6 @@
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios'; import { type DeptForm, type DeptQuery, type DeptVO } from './types';
import { DeptForm, DeptQuery, DeptTreeVO, DeptVO } from './types';
// 查询部门列表 // 查询部门列表
export const listDept = (query?: DeptQuery) => { export const listDept = (query?: DeptQuery) => {
+4 -3
View File
@@ -1,6 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios'; import type { DictDataForm, DictDataQuery, DictDataVO } from './types';
import { DictDataForm, DictDataQuery, DictDataVO } from './types';
// 根据字典类型查询字典数据信息 // 根据字典类型查询字典数据信息
export function getDicts(dictType: string): AxiosPromise<DictDataVO[]> { export function getDicts(dictType: string): AxiosPromise<DictDataVO[]> {
return request({ return request({
@@ -10,7 +11,7 @@ export function getDicts(dictType: string): AxiosPromise<DictDataVO[]> {
} }
// 查询字典数据列表 // 查询字典数据列表
export function listData(query: DictDataQuery): AxiosPromise<DictDataVO[]> { export function listData(query: DictDataQuery): AxiosPromise<PageResult<DictDataVO>> {
return request({ return request({
url: '/system/dict/data/list', url: '/system/dict/data/list',
method: 'get', method: 'get',
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { DictTypeForm, DictTypeVO, DictTypeQuery } from './types'; import type { DictTypeForm, DictTypeQuery, DictTypeVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
// 查询字典类型列表 // 查询字典类型列表
export function listType(query: DictTypeQuery): AxiosPromise<PageResult<DictTypeVO>> { export function listType(query: DictTypeQuery): AxiosPromise<PageResult<DictTypeVO>> {
+2 -2
View File
@@ -1,6 +1,6 @@
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios'; import type { MenuForm, MenuQuery, MenuTreeOption, MenuVO, RoleMenuTree } from './types';
import { MenuQuery, MenuVO, MenuForm, MenuTreeOption, RoleMenuTree } from './types';
// 查询菜单列表 // 查询菜单列表
export const listMenu = (query?: MenuQuery): AxiosPromise<MenuVO[]> => { export const listMenu = (query?: MenuQuery): AxiosPromise<MenuVO[]> => {
+1 -1
View File
@@ -1,4 +1,4 @@
import { MenuTypeEnum } from '@/enums/MenuTypeEnum'; import type { MenuTypeEnum } from '@/enums/MenuTypeEnum';
/** /**
* 菜单树形结构类型 * 菜单树形结构类型
+2 -2
View File
@@ -1,6 +1,6 @@
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios'; import type { MessageBoxVO } from './types';
import { MessageBoxVO } from './types';
export function getMessageBox(): AxiosPromise<MessageBoxVO> { export function getMessageBox(): AxiosPromise<MessageBoxVO> {
return request({ return request({
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { NoticeForm, NoticeQuery, NoticeVO } from './types'; import type { NoticeForm, NoticeQuery, NoticeVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
// 查询公告列表 // 查询公告列表
export function listNotice(query: NoticeQuery): AxiosPromise<PageResult<NoticeVO>> { export function listNotice(query: NoticeQuery): AxiosPromise<PageResult<NoticeVO>> {
return request({ return request({
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { OssQuery, OssVO } from './types'; import type { OssQuery, OssVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
// 查询OSS对象存储列表 // 查询OSS对象存储列表
export function listOss(query: OssQuery): AxiosPromise<PageResult<OssVO>> { export function listOss(query: OssQuery): AxiosPromise<PageResult<OssVO>> {
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { OssConfigForm, OssConfigQuery, OssConfigVO } from './types'; import type { OssConfigForm, OssConfigQuery, OssConfigVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
// 查询对象存储配置列表 // 查询对象存储配置列表
export function listOssConfig(query: OssConfigQuery): AxiosPromise<PageResult<OssConfigVO>> { export function listOssConfig(query: OssConfigQuery): AxiosPromise<PageResult<OssConfigVO>> {
+4 -4
View File
@@ -1,8 +1,8 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { PostForm, PostQuery, PostVO } from './types'; import type { DeptTreeVO } from '../dept/types';
import { AxiosPromise } from 'axios'; import type { PostForm, PostQuery, PostVO } from './types';
import { DeptTreeVO } from '../dept/types';
import { PageResult } from '@/api/types';
// 查询岗位列表 // 查询岗位列表
export function listPost(query: PostQuery): AxiosPromise<PageResult<PostVO>> { export function listPost(query: PostQuery): AxiosPromise<PageResult<PostVO>> {
+4 -5
View File
@@ -1,9 +1,8 @@
import { UserVO } from '@/api/system/user/types'; import type { UserQuery, UserVO } from '@/api/system/user/types';
import { UserQuery } from '@/api/system/user/types'; import type { PageResult } from '@/api/types';
import { AxiosPromise } from 'axios'; import type { AxiosPromise } from '@/utils/api-types';
import { RoleQuery, RoleVO, RoleDeptTree } from './types';
import request from '@/utils/request'; import request from '@/utils/request';
import { PageResult } from '@/api/types'; import type { RoleDeptTree, RoleQuery, RoleVO } from './types';
export const listRole = (query: RoleQuery): AxiosPromise<PageResult<RoleVO>> => { export const listRole = (query: RoleQuery): AxiosPromise<PageResult<RoleVO>> => {
return request({ return request({
+5 -5
View File
@@ -1,10 +1,10 @@
import { DeptTreeVO } from './../dept/types'; import type { RoleVO } from '@/api/system/role/types';
import { RoleVO } from '@/api/system/role/types'; import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserForm, UserQuery, UserVO, UserInfoVO } from './types';
import { parseStrEmpty } from '@/utils/ruoyi'; import { parseStrEmpty } from '@/utils/ruoyi';
import { PageResult } from '@/api/types'; import type { DeptTreeVO } from './../dept/types';
import type { UserForm, UserInfoVO, UserQuery, UserVO } from './types';
/** /**
* 查询用户列表 * 查询用户列表
+4 -2
View File
@@ -1,5 +1,5 @@
import { RoleVO } from '@/api/system/role/types'; import type { PostVO } from '@/api/system/post/types';
import { PostVO } from '@/api/system/post/types'; import type { RoleVO } from '@/api/system/role/types';
/** /**
* 用户信息 * 用户信息
@@ -43,6 +43,8 @@ export interface UserVO extends BaseEntity {
loginDate: string; loginDate: string;
remark: string; remark: string;
deptName: string; deptName: string;
/** 详情接口可能返回嵌套部门 */
dept?: { deptName?: string };
roles: RoleVO[]; roles: RoleVO[];
roleIds: any; roleIds: any;
postIds: any; postIds: any;
+8 -6
View File
@@ -1,7 +1,9 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { DbTableQuery, DbTableVO, TableQuery, TableVO, GenTableVO, DbTableForm } from './types'; import type { DbTableForm, DbTableQuery, DbTableVO, GenTableDetailPayload, TableQuery, TableVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types'; export type { GenTableDetailPayload } from './types';
// 查询生成表数据 // 查询生成表数据
export const listTable = (query: TableQuery): AxiosPromise<PageResult<TableVO>> => { export const listTable = (query: TableQuery): AxiosPromise<PageResult<TableVO>> => {
@@ -21,7 +23,7 @@ export const listDbTable = (query: DbTableQuery): AxiosPromise<PageResult<DbTabl
}; };
// 查询表详细信息 // 查询表详细信息
export const getGenTable = (tableId: string | number): AxiosPromise<GenTableVO> => { export const getGenTable = (tableId: string | number): AxiosPromise<GenTableDetailPayload> => {
return request({ return request({
url: '/tool/gen/' + tableId, url: '/tool/gen/' + tableId,
method: 'get' method: 'get'
@@ -29,7 +31,7 @@ export const getGenTable = (tableId: string | number): AxiosPromise<GenTableVO>
}; };
// 修改代码生成信息 // 修改代码生成信息
export const updateGenTable = (data: DbTableForm): AxiosPromise<GenTableVO> => { export const updateGenTable = (data: DbTableForm): AxiosPromise<unknown> => {
return request({ return request({
url: '/tool/gen', url: '/tool/gen',
method: 'put', method: 'put',
@@ -38,7 +40,7 @@ export const updateGenTable = (data: DbTableForm): AxiosPromise<GenTableVO> => {
}; };
// 导入表 // 导入表
export const importTable = (data: { tables: string; dataName: string }): AxiosPromise<GenTableVO> => { export const importTable = (data: { tables: string; dataName: string }): AxiosPromise<unknown> => {
return request({ return request({
url: '/tool/gen/importTable', url: '/tool/gen/importTable',
method: 'post', method: 'post',
+7 -1
View File
@@ -103,7 +103,13 @@ export interface DbTableQuery extends PageQuery {
tableComment: string; tableComment: string;
} }
export interface GenTableVO { /**
* 代码生成表详情接口 data 结构(与后端 Map 三键一致)
* - info:当前表 GenTable
* - rows:字段列表 GenTableColumn[]
* - tables:全部表 GenTable[](主子表等选项)
*/
export interface GenTableDetailPayload {
info: DbTableVO; info: DbTableVO;
rows: DbColumnVO[]; rows: DbColumnVO[];
tables: DbTableVO[]; tables: DbTableVO[];
+2 -2
View File
@@ -1,6 +1,6 @@
import type { CategoryForm, CategoryQuery, CategoryTreeVO, CategoryVO } from '@/api/workflow/category/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CategoryVO, CategoryForm, CategoryQuery, CategoryTreeVO } from '@/api/workflow/category/types';
/** /**
* 查询流程分类列表 * 查询流程分类列表
+5 -5
View File
@@ -1,12 +1,12 @@
import request from '@/utils/request'; import type { PageResult } from '@/api/types';
import { import type {
FlowDefinitionQuery,
definitionXmlVO, definitionXmlVO,
FlowDefinitionForm, FlowDefinitionForm,
FlowDefinitionQuery,
FlowDefinitionVo FlowDefinitionVo
} from '@/api/workflow/definition/types'; } from '@/api/workflow/definition/types';
import { AxiosPromise } from 'axios'; import type { AxiosPromise } from '@/utils/api-types';
import { PageResult } from '@/api/types'; import request from '@/utils/request';
/** /**
* 获取流程定义列表 * 获取流程定义列表
+4 -4
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
/** /**
* 查询运行中实例列表 * 查询运行中实例列表
@@ -34,7 +34,7 @@ export const pageByFinish = (query: FlowInstanceQuery): AxiosPromise<PageResult<
*/ */
export const flowHisTaskList = (businessId: string | number) => { export const flowHisTaskList = (businessId: string | number) => {
return request({ return request({
url: `/workflow/instance/flowHisTaskList/${businessId}` + '?t' + Math.random(), url: `/workflow/instance/flowHisTaskList/${businessId}?t=${Math.random()}`,
method: 'get' method: 'get'
}); });
}; };
+2 -2
View File
@@ -1,11 +1,11 @@
import { FlowTaskVO } from '@/api/workflow/task/types'; import type { FlowTaskVO } from '@/api/workflow/task/types';
export interface FlowInstanceQuery extends PageQuery { export interface FlowInstanceQuery extends PageQuery {
category?: string | number; category?: string | number;
nodeName?: string; nodeName?: string;
flowCode?: string; flowCode?: string;
flowName?: string; flowName?: string;
createByIds?: string[] | number[]; createByIds?: Array<string | number>;
businessId?: string; businessId?: string;
} }
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LeaveVO, LeaveQuery, LeaveForm } from '@/api/workflow/leave/types';
import { PageResult } from '@/api/types';
/** /**
* 查询请假列表 * 查询请假列表
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { SpelForm, SpelQuery, SpelVO } from '@/api/workflow/spel/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SpelVO, SpelForm, SpelQuery } from '@/api/workflow/spel/types';
import { PageResult } from '@/api/types';
/** /**
* 查询流程spel表达式定义列表 * 查询流程spel表达式定义列表
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { FlowTaskVO, TaskOperationBo, TaskQuery } from '@/api/workflow/task/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TaskQuery, FlowTaskVO, TaskOperationBo } from '@/api/workflow/task/types';
import { PageResult } from '@/api/types';
/** /**
* 查询待办列表 * 查询待办列表
+1 -1
View File
@@ -2,7 +2,7 @@ export interface TaskQuery extends PageQuery {
nodeName?: string; nodeName?: string;
flowCode?: string; flowCode?: string;
flowName?: string; flowName?: string;
createByIds?: string[] | number[]; createByIds?: Array<string | number>;
} }
export interface ParticipantVo { export interface ParticipantVo {
+6 -4
View File
@@ -1,9 +1,11 @@
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types'; import type { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
import tab from '@/plugins/tab';
import router from '@/router';
export default { export default {
routerJump(routerJumpVo: RouterJumpVo, proxy) { routerJump(routerJumpVo: RouterJumpVo) {
proxy.$tab.closePage(proxy.$route); tab.closePage(router.currentRoute.value);
proxy.$router.push({ router.push({
path: routerJumpVo.formPath, path: routerJumpVo.formPath,
query: { query: {
id: routerJumpVo.businessId, id: routerJumpVo.businessId,
+1 -1
View File
@@ -4,7 +4,7 @@
<template v-if="isValueMatch(item.value)"> <template v-if="isValueMatch(item.value)">
<span <span
v-if=" v-if="
(item.elTagType === 'default' || item.elTagType === '') && ((item.elTagType as string) === 'default' || (item.elTagType as string) === '') &&
(item.elTagClass === '' || item.elTagClass == null) (item.elTagClass === '' || item.elTagClass == null)
" "
:key="item.value" :key="item.value"
+20 -22
View File
@@ -15,15 +15,14 @@
<script setup lang="ts"> <script setup lang="ts">
import '@wangeditor-next/editor/dist/css/style.css'; import '@wangeditor-next/editor/dist/css/style.css';
import { Editor as WangEditor, Toolbar as EditorToolbar } from '@wangeditor-next/editor-for-vue';
import type { IDomEditor, IEditorConfig, IToolbarConfig } from '@wangeditor-next/editor'; import type { IDomEditor, IEditorConfig, IToolbarConfig } from '@wangeditor-next/editor';
import { Editor as WangEditor, Toolbar as EditorToolbar } from '@wangeditor-next/editor-for-vue';
import { listByIds } from '@/api/system/oss';
import modal from '@/plugins/modal';
import { propTypes } from '@/utils/propTypes'; import { propTypes } from '@/utils/propTypes';
import { globalHeaders } from '@/utils/request'; import { globalHeaders } from '@/utils/request';
import { listByIds } from '@/api/system/oss';
const OSS_MARKER_RE = /oss:\/\/([\w-]+)/g; const OSS_MARKER_RE = /oss:\/\/([\w-]+)/g;
const props = defineProps({ const props = defineProps({
/* 编辑器的内容 */ /* 编辑器的内容 */
modelValue: propTypes.string, modelValue: propTypes.string,
@@ -42,7 +41,6 @@ const props = defineProps({
}); });
const emit = defineEmits(['update:modelValue']); const emit = defineEmits(['update:modelValue']);
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const editorRef = shallowRef<IDomEditor>(); const editorRef = shallowRef<IDomEditor>();
const content = ref(''); const content = ref('');
@@ -123,7 +121,7 @@ const decodeOssContent = async (html: string): Promise<string> => {
const matches = [...html.matchAll(OSS_MARKER_RE)]; const matches = [...html.matchAll(OSS_MARKER_RE)];
if (matches.length === 0) return html; if (matches.length === 0) return html;
const ossIds = [...new Set(matches.map((m) => m[1]))]; const ossIds = [...new Set(matches.map(m => m[1]))];
try { try {
const res = await listByIds(ossIds.join(',')); const res = await listByIds(ossIds.join(','));
@@ -144,14 +142,14 @@ const decodeOssContent = async (html: string): Promise<string> => {
const validateImageFile = (file: File) => { const validateImageFile = (file: File) => {
const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png', 'image/svg', 'image/svg+xml']; const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png', 'image/svg', 'image/svg+xml'];
if (!allowedTypes.includes(file.type)) { if (!allowedTypes.includes(file.type)) {
proxy?.$modal.msgError('图片格式错误!'); modal.msgError('图片格式错误!');
return false; return false;
} }
if (props.fileSize) { if (props.fileSize) {
const isLt = file.size / 1024 / 1024 < props.fileSize; const isLt = file.size / 1024 / 1024 < props.fileSize;
if (!isLt) { if (!isLt) {
proxy?.$modal.msgError(`上传图片大小不能超过 ${props.fileSize} MB!`); modal.msgError(`上传图片大小不能超过 ${props.fileSize} MB!`);
return false; return false;
} }
} }
@@ -162,14 +160,14 @@ const validateImageFile = (file: File) => {
const validateVideoFile = (file: File) => { const validateVideoFile = (file: File) => {
const allowedTypes = ['video/mp4', 'video/webm', 'video/ogg']; const allowedTypes = ['video/mp4', 'video/webm', 'video/ogg'];
if (!allowedTypes.includes(file.type)) { if (!allowedTypes.includes(file.type)) {
proxy?.$modal.msgError('视频格式错误, 请上传 mp4/webm/ogg 格式!'); modal.msgError('视频格式错误, 请上传 mp4/webm/ogg 格式!');
return false; return false;
} }
if (props.videoSize) { if (props.videoSize) {
const isLt = file.size / 1024 / 1024 < props.videoSize; const isLt = file.size / 1024 / 1024 < props.videoSize;
if (!isLt) { if (!isLt) {
proxy?.$modal.msgError(`上传视频大小不能超过 ${props.videoSize} MB!`); modal.msgError(`上传视频大小不能超过 ${props.videoSize} MB!`);
return false; return false;
} }
} }
@@ -186,17 +184,17 @@ const getUploadImageMenuConfig = () => {
customUpload(file: File, insertFn: (url: string, alt?: string, href?: string) => void) { customUpload(file: File, insertFn: (url: string, alt?: string, href?: string) => void) {
if (!validateImageFile(file)) return; if (!validateImageFile(file)) return;
proxy?.$modal.loading('正在上传图片,请稍候...'); modal.loading('正在上传图片,请稍候...');
const reader = new FileReader(); const reader = new FileReader();
reader.onload = () => { reader.onload = () => {
insertFn(reader.result as string, file.name); insertFn(reader.result as string, file.name);
proxy?.$modal.closeLoading(); modal.closeLoading();
}; };
reader.onerror = () => { reader.onerror = () => {
proxy?.$modal.msgError('图片插入失败'); modal.msgError('图片插入失败');
proxy?.$modal.closeLoading(); modal.closeLoading();
}; };
reader.readAsDataURL(file); reader.readAsDataURL(file);
@@ -209,14 +207,14 @@ const getUploadImageMenuConfig = () => {
async customUpload(file: File, insertFn: (url: string, alt?: string, href?: string) => void) { async customUpload(file: File, insertFn: (url: string, alt?: string, href?: string) => void) {
if (!validateImageFile(file)) return; if (!validateImageFile(file)) return;
proxy?.$modal.loading('正在上传图片,请稍候...'); modal.loading('正在上传图片,请稍候...');
try { try {
const result = await uploadToOss(file); const result = await uploadToOss(file);
insertFn(result.url, file.name, result.url); insertFn(result.url, file.name, result.url);
} catch { } catch {
proxy?.$modal.msgError('图片上传失败'); modal.msgError('图片上传失败');
} finally { } finally {
proxy?.$modal.closeLoading(); modal.closeLoading();
} }
} }
}; };
@@ -227,14 +225,14 @@ const getUploadVideoMenuConfig = () => ({
async customUpload(file: File, insertFn: (url: string, poster?: string) => void) { async customUpload(file: File, insertFn: (url: string, poster?: string) => void) {
if (!validateVideoFile(file)) return; if (!validateVideoFile(file)) return;
proxy?.$modal.loading('正在上传视频,请稍候...'); modal.loading('正在上传视频,请稍候...');
try { try {
const result = await uploadToOss(file); const result = await uploadToOss(file);
insertFn(result.url); insertFn(result.url);
} catch { } catch {
proxy?.$modal.msgError('视频上传失败'); modal.msgError('视频上传失败');
} finally { } finally {
proxy?.$modal.closeLoading(); modal.closeLoading();
} }
} }
}); });
@@ -265,7 +263,7 @@ const syncReadOnly = () => {
watch( watch(
() => props.modelValue, () => props.modelValue,
async (value) => { async value => {
const nextValue = value || ''; const nextValue = value || '';
// 跳过由自身 emit 引起的回传 // 跳过由自身 emit 引起的回传
@@ -283,7 +281,7 @@ watch(
{ immediate: true } { immediate: true }
); );
watch(content, (value) => { watch(content, value => {
if (isResolvingContent.value) return; if (isResolvingContent.value) return;
const encoded = encodeOssContent(value); const encoded = encodeOssContent(value);
+14 -12
View File
@@ -47,8 +47,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { propTypes } from '@/utils/propTypes';
import { delOss, listByIds } from '@/api/system/oss'; import { delOss, listByIds } from '@/api/system/oss';
import modal from '@/plugins/modal';
import { propTypes } from '@/utils/propTypes';
import { globalHeaders } from '@/utils/request'; import { globalHeaders } from '@/utils/request';
const props = defineProps({ const props = defineProps({
@@ -68,7 +69,6 @@ const props = defineProps({
disabled: propTypes.bool.def(false) disabled: propTypes.bool.def(false)
}); });
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const emit = defineEmits(['update:modelValue']); const emit = defineEmits(['update:modelValue']);
const number = ref(0); const number = ref(0);
const uploadList = ref<any[]>([]); const uploadList = ref<any[]>([]);
@@ -94,7 +94,7 @@ watch(
let list: any[] = []; let list: any[] = [];
if (Array.isArray(val)) { if (Array.isArray(val)) {
list = val; list = val;
} else { } else if (typeof val === 'string' || typeof val === 'number') {
const res = await listByIds(val); const res = await listByIds(val);
list = res.data.map(oss => { list = res.data.map(oss => {
return { return {
@@ -103,6 +103,8 @@ watch(
ossId: oss.ossId ossId: oss.ossId
}; };
}); });
} else {
list = [];
} }
// 然后将数组转为对象数组 // 然后将数组转为对象数组
fileList.value = list.map(item => { fileList.value = list.map(item => {
@@ -126,36 +128,36 @@ const handleBeforeUpload = (file: any) => {
const fileExt = fileName[fileName.length - 1]; const fileExt = fileName[fileName.length - 1];
const isTypeOk = props.fileType.indexOf(fileExt) >= 0; const isTypeOk = props.fileType.indexOf(fileExt) >= 0;
if (!isTypeOk) { if (!isTypeOk) {
proxy?.$modal.msgError(`文件格式不正确, 请上传${props.fileType.join('/')}格式文件!`); modal.msgError(`文件格式不正确, 请上传${props.fileType.join('/')}格式文件!`);
return false; return false;
} }
} }
// 校检文件名是否包含特殊字符 // 校检文件名是否包含特殊字符
if (file.name.includes(',')) { if (file.name.includes(',')) {
proxy?.$modal.msgError('文件名不正确,不能包含英文逗号!'); modal.msgError('文件名不正确,不能包含英文逗号!');
return false; return false;
} }
// 校检文件大小 // 校检文件大小
if (props.fileSize) { if (props.fileSize) {
const isLt = file.size / 1024 / 1024 < props.fileSize; const isLt = file.size / 1024 / 1024 < props.fileSize;
if (!isLt) { if (!isLt) {
proxy?.$modal.msgError(`上传文件大小不能超过 ${props.fileSize} MB!`); modal.msgError(`上传文件大小不能超过 ${props.fileSize} MB!`);
return false; return false;
} }
} }
proxy?.$modal.loading('正在上传文件,请稍候...'); modal.loading('正在上传文件,请稍候...');
number.value++; number.value++;
return true; return true;
}; };
// 文件个数超出 // 文件个数超出
const handleExceed = () => { const handleExceed = () => {
proxy?.$modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`); modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`);
}; };
// 上传失败 // 上传失败
const handleUploadError = () => { const handleUploadError = () => {
proxy?.$modal.msgError('上传文件失败'); modal.msgError('上传文件失败');
}; };
// 上传成功回调 // 上传成功回调
@@ -169,8 +171,8 @@ const handleUploadSuccess = (res: any, file: UploadFile) => {
uploadedSuccessfully(); uploadedSuccessfully();
} else { } else {
number.value--; number.value--;
proxy?.$modal.closeLoading(); modal.closeLoading();
proxy?.$modal.msgError(res.msg); modal.msgError(res.msg);
fileUploadRef.value?.handleRemove(file); fileUploadRef.value?.handleRemove(file);
uploadedSuccessfully(); uploadedSuccessfully();
} }
@@ -191,7 +193,7 @@ const uploadedSuccessfully = () => {
uploadList.value = []; uploadList.value = [];
number.value = 0; number.value = 0;
emit('update:modelValue', listToString(fileList.value)); emit('update:modelValue', listToString(fileList.value));
proxy?.$modal.closeLoading(); modal.closeLoading();
} }
}; };
+18 -14
View File
@@ -43,11 +43,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { compressAccurately } from 'image-conversion';
import { listByIds, delOss } from '@/api/system/oss'; import { listByIds, delOss } from '@/api/system/oss';
import { OssVO } from '@/api/system/oss/types'; import { OssVO } from '@/api/system/oss/types';
import modal from '@/plugins/modal';
import { propTypes } from '@/utils/propTypes'; import { propTypes } from '@/utils/propTypes';
import { globalHeaders } from '@/utils/request'; import { globalHeaders } from '@/utils/request';
import { compressAccurately } from 'image-conversion';
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
@@ -74,7 +75,6 @@ const props = defineProps({
compressTargetSize: propTypes.number.def(300) compressTargetSize: propTypes.number.def(300)
}); });
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const emit = defineEmits(['update:modelValue']); const emit = defineEmits(['update:modelValue']);
const number = ref(0); const number = ref(0);
const uploadList = ref<any[]>([]); const uploadList = ref<any[]>([]);
@@ -142,46 +142,50 @@ const handleBeforeUpload = (file: any) => {
isImg = file.type.indexOf('image') > -1; isImg = file.type.indexOf('image') > -1;
} }
if (!isImg) { if (!isImg) {
proxy?.$modal.msgError(`文件格式不正确, 请上传${props.fileType.join('/')}图片格式文件!`); modal.msgError(`文件格式不正确, 请上传${props.fileType.join('/')}图片格式文件!`);
return false; return false;
} }
if (file.name.includes(',')) { if (file.name.includes(',')) {
proxy?.$modal.msgError('文件名不正确,不能包含英文逗号!'); modal.msgError('文件名不正确,不能包含英文逗号!');
return false; return false;
} }
if (props.fileSize) { if (props.fileSize) {
const isLt = file.size / 1024 / 1024 < props.fileSize; const isLt = file.size / 1024 / 1024 < props.fileSize;
if (!isLt) { if (!isLt) {
proxy?.$modal.msgError(`上传头像图片大小不能超过 ${props.fileSize} MB!`); modal.msgError(`上传头像图片大小不能超过 ${props.fileSize} MB!`);
return false; return false;
} }
} }
//压缩图片,开启压缩并且大于指定的压缩大小时才压缩 //压缩图片,开启压缩并且大于指定的压缩大小时才压缩
if (props.compressSupport && file.size / 1024 > props.compressTargetSize) { if (props.compressSupport && file.size / 1024 > props.compressTargetSize) {
proxy?.$modal.loading('正在上传图片,请稍候...'); modal.loading('正在上传图片,请稍候...');
number.value++; number.value++;
return compressAccurately(file, props.compressTargetSize); return compressAccurately(file, props.compressTargetSize);
} else { } else {
proxy?.$modal.loading('正在上传图片,请稍候...'); modal.loading('正在上传图片,请稍候...');
number.value++; number.value++;
} }
}; };
// 文件个数超出 // 文件个数超出
const handleExceed = () => { const handleExceed = () => {
proxy?.$modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`); modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`);
}; };
// 上传成功回调 // 上传成功回调
const handleUploadSuccess = (res: any, file: UploadFile) => { const handleUploadSuccess = (res: any, file: UploadFile) => {
if (res.code === 200) { if (res.code === 200) {
uploadList.value.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId }); uploadList.value.push({
name: res.data.fileName,
url: res.data.url,
ossId: res.data.ossId
});
uploadedSuccessfully(); uploadedSuccessfully();
} else { } else {
number.value--; number.value--;
proxy?.$modal.closeLoading(); modal.closeLoading();
proxy?.$modal.msgError(res.msg); modal.msgError(res.msg);
imageUploadRef.value?.handleRemove(file); imageUploadRef.value?.handleRemove(file);
uploadedSuccessfully(); uploadedSuccessfully();
} }
@@ -207,14 +211,14 @@ const uploadedSuccessfully = () => {
uploadList.value = []; uploadList.value = [];
number.value = 0; number.value = 0;
emit('update:modelValue', listToString(fileList.value)); emit('update:modelValue', listToString(fileList.value));
proxy?.$modal.closeLoading(); modal.closeLoading();
} }
}; };
// 上传失败 // 上传失败
const handleUploadError = () => { const handleUploadError = () => {
proxy?.$modal.msgError('上传图片失败'); modal.msgError('上传图片失败');
proxy?.$modal.closeLoading(); modal.closeLoading();
}; };
// 预览 // 预览
+1 -1
View File
@@ -14,8 +14,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useAppStore } from '@/store/modules/app';
import SvgIcon from '@/components/SvgIcon/index.vue'; import SvgIcon from '@/components/SvgIcon/index.vue';
import { useAppStore } from '@/store/modules/app';
const appStore = useAppStore(); const appStore = useAppStore();
const { locale } = useI18n(); const { locale } = useI18n();
+1 -1
View File
@@ -15,8 +15,8 @@
</template> </template>
<script setup name="Pagination" lang="ts"> <script setup name="Pagination" lang="ts">
import { scrollTo } from '@/utils/scroll-to';
import { propTypes } from '@/utils/propTypes'; import { propTypes } from '@/utils/propTypes';
import { scrollTo } from '@/utils/scroll-to';
const props = defineProps({ const props = defineProps({
total: propTypes.number, total: propTypes.number,
+2 -3
View File
@@ -29,10 +29,9 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue';
import { ComponentInternalInstance } from 'vue';
import { ElForm, FormInstance } from 'element-plus'; import { ElForm, FormInstance } from 'element-plus';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; import { ref } from 'vue';
const emits = defineEmits(['submitCallback', 'cancelCallback']); const emits = defineEmits(['submitCallback', 'cancelCallback']);
const props = defineProps({ const props = defineProps({
title: { title: {
+7 -3
View File
@@ -26,8 +26,12 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useRoute } from 'vue-router';
import tab from '@/plugins/tab';
import router from '@/router';
import { propTypes } from '@/utils/propTypes'; import { propTypes } from '@/utils/propTypes';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
const props = defineProps({ const props = defineProps({
status: propTypes.string.def(''), status: propTypes.string.def(''),
pageType: propTypes.string.def(''), pageType: propTypes.string.def(''),
@@ -66,7 +70,7 @@ const approvalButtonShow = computed(() => {
//返回 //返回
const goBack = () => { const goBack = () => {
proxy.$tab.closePage(proxy.$route); tab.closePage(route);
proxy.$router.go(-1); router.go(-1);
}; };
</script> </script>
+7 -5
View File
@@ -98,12 +98,14 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { flowHisTaskList } from '@/api/workflow/instance';
import { propTypes } from '@/utils/propTypes';
import { listByIds } from '@/api/system/oss'; import { listByIds } from '@/api/system/oss';
import { flowHisTaskList } from '@/api/workflow/instance';
import FlowChart from '@/components/Process/flowChart.vue'; import FlowChart from '@/components/Process/flowChart.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; import download from '@/plugins/download';
const { wf_task_status } = toRefs<any>(proxy?.useDict('wf_task_status')); import { useDict } from '@/utils/dict';
import { propTypes } from '@/utils/propTypes';
const { wf_task_status } = toRefs<any>(useDict('wf_task_status'));
const props = defineProps({ const props = defineProps({
width: propTypes.string.def('80%'), width: propTypes.string.def('80%'),
height: propTypes.string.def('100%') height: propTypes.string.def('100%')
@@ -146,7 +148,7 @@ const getIds = async (ids: string | number) => {
/** 下载按钮操作 */ /** 下载按钮操作 */
const handleDownload = (ossId: string) => { const handleDownload = (ossId: string) => {
proxy?.$download.oss(ossId); download.oss(ossId);
}; };
/** /**
+7 -1
View File
@@ -111,7 +111,13 @@ const applyTransform = () => {
}; };
const getBounds = () => { const getBounds = () => {
if (!imageWrapperRef.value) return { minTranslateX: 0, maxTranslateX: 0, minTranslateY: 0, maxTranslateY: 0 }; if (!imageWrapperRef.value)
return {
minTranslateX: 0,
maxTranslateX: 0,
minTranslateY: 0,
maxTranslateY: 0
};
const imgRect = imageWrapperRef.value.getBoundingClientRect(); const imgRect = imageWrapperRef.value.getBoundingClientRect();
const containerRect = imageWrapperRef.value.parentElement?.getBoundingClientRect() ?? imgRect; const containerRect = imageWrapperRef.value.parentElement?.getBoundingClientRect() ?? imgRect;
+19 -16
View File
@@ -87,11 +87,12 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { propTypes } from '@/utils/propTypes';
import { FlowTaskVO, TaskOperationBo } from '@/api/workflow/task/types';
import UserSelect from '@/components/UserSelect';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { getTask, taskOperation, currentTaskAllUser, terminationTask } from '@/api/workflow/task'; import { getTask, taskOperation, currentTaskAllUser, terminationTask } from '@/api/workflow/task';
import { FlowTaskVO, TaskOperationBo } from '@/api/workflow/task/types';
import UserSelect from '@/components/UserSelect/index.vue';
import modal from '@/plugins/modal';
import { propTypes } from '@/utils/propTypes';
const props = defineProps({ const props = defineProps({
width: propTypes.string.def('50%'), width: propTypes.string.def('50%'),
height: propTypes.string.def('100%') height: propTypes.string.def('100%')
@@ -128,8 +129,10 @@ const task = ref<FlowTaskVO>({
nodeRatio: undefined, nodeRatio: undefined,
version: undefined, version: undefined,
applyNode: undefined, applyNode: undefined,
buttonList: [] buttonList: [],
}); businessCode: '',
businessTitle: ''
} as FlowTaskVO);
const open = (taskId: string) => { const open = (taskId: string) => {
visible.value = true; visible.value = true;
@@ -153,7 +156,7 @@ const handleTransferTask = async data => {
message: '', message: '',
messageType: ['1'] messageType: ['1']
}); });
await proxy?.$modal.confirm('是否确认提交?'); await modal.confirm('是否确认提交?');
loading.value = true; loading.value = true;
buttonDisabled.value = true; buttonDisabled.value = true;
await taskOperation(taskOperationBo, 'transferTask').finally(() => { await taskOperation(taskOperationBo, 'transferTask').finally(() => {
@@ -162,9 +165,9 @@ const handleTransferTask = async data => {
}); });
visible.value = false; visible.value = false;
emits('submitCallback'); emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功'); modal.msgSuccess('操作成功');
} else { } else {
proxy?.$modal.msgWarning('请选择用户!'); modal.msgWarning('请选择用户!');
} }
}; };
//加签 //加签
@@ -180,7 +183,7 @@ const addMultiInstanceUser = async data => {
message: '', message: '',
messageType: ['1'] messageType: ['1']
}); });
await proxy?.$modal.confirm('是否确认提交?'); await modal.confirm('是否确认提交?');
loading.value = true; loading.value = true;
buttonDisabled.value = true; buttonDisabled.value = true;
await taskOperation(taskOperationBo, 'addSignature').finally(() => { await taskOperation(taskOperationBo, 'addSignature').finally(() => {
@@ -189,14 +192,14 @@ const addMultiInstanceUser = async data => {
}); });
visible.value = false; visible.value = false;
emits('submitCallback'); emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功'); modal.msgSuccess('操作成功');
} else { } else {
proxy?.$modal.msgWarning('请选择用户!'); modal.msgWarning('请选择用户!');
} }
}; };
//减签 //减签
const deleteMultiInstanceUser = async row => { const deleteMultiInstanceUser = async row => {
await proxy?.$modal.confirm('是否确认提交?'); await modal.confirm('是否确认提交?');
loading.value = true; loading.value = true;
buttonDisabled.value = true; buttonDisabled.value = true;
const taskOperationBo = reactive<TaskOperationBo>({ const taskOperationBo = reactive<TaskOperationBo>({
@@ -211,7 +214,7 @@ const deleteMultiInstanceUser = async row => {
}); });
visible.value = false; visible.value = false;
emits('submitCallback'); emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功'); modal.msgSuccess('操作成功');
}; };
//获取办理人 //获取办理人
const handleTaskUser = async () => { const handleTaskUser = async () => {
@@ -231,7 +234,7 @@ const handleTerminationTask = async () => {
taskId: task.value.id, taskId: task.value.id,
comment: '' comment: ''
}; };
await proxy?.$modal.confirm('是否确认终止?'); await modal.confirm('是否确认终止?');
loading.value = true; loading.value = true;
buttonDisabled.value = true; buttonDisabled.value = true;
await terminationTask(params).finally(() => { await terminationTask(params).finally(() => {
@@ -240,7 +243,7 @@ const handleTerminationTask = async () => {
}); });
visible.value = false; visible.value = false;
emits('submitCallback'); emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功'); modal.msgSuccess('操作成功');
}; };
/** /**
* 对外暴露子组件方法 * 对外暴露子组件方法
+22 -24
View File
@@ -196,9 +196,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue';
import { ComponentInternalInstance } from 'vue';
import { ElForm } from 'element-plus'; import { ElForm } from 'element-plus';
import { ref } from 'vue';
import { import {
completeTask, completeTask,
backProcess, backProcess,
@@ -209,10 +208,9 @@ import {
currentTaskAllUser, currentTaskAllUser,
getNextNodeList getNextNodeList
} from '@/api/workflow/task'; } from '@/api/workflow/task';
import UserSelect from '@/components/UserSelect';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { FlowCopyVo, FlowTaskVO, TaskOperationBo } from '@/api/workflow/task/types'; import { FlowCopyVo, FlowTaskVO, TaskOperationBo } from '@/api/workflow/task/types';
import UserSelect from '@/components/UserSelect/index.vue';
import modal from '@/plugins/modal';
const userSelectCopyRef = ref<InstanceType<typeof UserSelect>>(); const userSelectCopyRef = ref<InstanceType<typeof UserSelect>>();
const transferTaskRef = ref<InstanceType<typeof UserSelect>>(); const transferTaskRef = ref<InstanceType<typeof UserSelect>>();
@@ -362,7 +360,7 @@ const handleCompleteTask = async () => {
} }
}); });
if (verify) { if (verify) {
proxy?.$modal.msgWarning('请选择审批人!'); modal.msgWarning('请选择审批人!');
return false; return false;
} }
} else { } else {
@@ -379,14 +377,14 @@ const handleCompleteTask = async () => {
}); });
form.value.flowCopyList = flowCopyList; form.value.flowCopyList = flowCopyList;
} }
await proxy?.$modal.confirm('是否确认提交?'); await modal.confirm('是否确认提交?');
loading.value = true; loading.value = true;
buttonDisabled.value = true; buttonDisabled.value = true;
try { try {
await completeTask(form.value); await completeTask(form.value);
dialog.visible = false; dialog.visible = false;
emits('submitCallback'); emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功'); modal.msgSuccess('操作成功');
} finally { } finally {
loading.value = false; loading.value = false;
buttonDisabled.value = false; buttonDisabled.value = false;
@@ -409,7 +407,7 @@ const handleBackProcessOpen = async () => {
/** 驳回流程 */ /** 驳回流程 */
const handleBackProcess = async () => { const handleBackProcess = async () => {
backForm.value.taskId = taskId.value; backForm.value.taskId = taskId.value;
await proxy?.$modal.confirm('是否确认驳回到申请人?'); await modal.confirm('是否确认驳回到申请人?');
loading.value = true; loading.value = true;
backLoading.value = true; backLoading.value = true;
backButtonDisabled.value = true; backButtonDisabled.value = true;
@@ -421,7 +419,7 @@ const handleBackProcess = async () => {
backLoading.value = false; backLoading.value = false;
backButtonDisabled.value = false; backButtonDisabled.value = false;
emits('submitCallback'); emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功'); modal.msgSuccess('操作成功');
}; };
//取消 //取消
const cancel = async () => { const cancel = async () => {
@@ -463,7 +461,7 @@ const addMultiInstanceUser = async data => {
message: form.value.message, message: form.value.message,
messageType: ['1'] messageType: ['1']
}); });
await proxy?.$modal.confirm('是否确认提交?'); await modal.confirm('是否确认提交?');
loading.value = true; loading.value = true;
buttonDisabled.value = true; buttonDisabled.value = true;
await taskOperation(taskOperationBo, 'addSignature').finally(() => { await taskOperation(taskOperationBo, 'addSignature').finally(() => {
@@ -472,14 +470,14 @@ const addMultiInstanceUser = async data => {
}); });
dialog.visible = false; dialog.visible = false;
emits('submitCallback'); emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功'); modal.msgSuccess('操作成功');
} else { } else {
proxy?.$modal.msgWarning('请选择用户!'); modal.msgWarning('请选择用户!');
} }
}; };
//减签 //减签
const deleteMultiInstanceUser = async row => { const deleteMultiInstanceUser = async row => {
await proxy?.$modal.confirm('是否确认提交?'); await modal.confirm('是否确认提交?');
loading.value = true; loading.value = true;
buttonDisabled.value = true; buttonDisabled.value = true;
const taskOperationBo = reactive<TaskOperationBo>({ const taskOperationBo = reactive<TaskOperationBo>({
@@ -494,7 +492,7 @@ const deleteMultiInstanceUser = async row => {
}); });
dialog.visible = false; dialog.visible = false;
emits('submitCallback'); emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功'); modal.msgSuccess('操作成功');
}; };
//打开转办 //打开转办
const openTransferTask = () => { const openTransferTask = () => {
@@ -509,7 +507,7 @@ const handleTransferTask = async data => {
message: form.value.message, message: form.value.message,
messageType: ['1'] messageType: ['1']
}); });
await proxy?.$modal.confirm('是否确认提交?'); await modal.confirm('是否确认提交?');
loading.value = true; loading.value = true;
buttonDisabled.value = true; buttonDisabled.value = true;
await taskOperation(taskOperationBo, 'transferTask').finally(() => { await taskOperation(taskOperationBo, 'transferTask').finally(() => {
@@ -518,9 +516,9 @@ const handleTransferTask = async data => {
}); });
dialog.visible = false; dialog.visible = false;
emits('submitCallback'); emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功'); modal.msgSuccess('操作成功');
} else { } else {
proxy?.$modal.msgWarning('请选择用户!'); modal.msgWarning('请选择用户!');
} }
}; };
@@ -537,7 +535,7 @@ const handleDelegateTask = async data => {
message: form.value.message, message: form.value.message,
messageType: ['1'] messageType: ['1']
}); });
await proxy?.$modal.confirm('是否确认提交?'); await modal.confirm('是否确认提交?');
loading.value = true; loading.value = true;
buttonDisabled.value = true; buttonDisabled.value = true;
await taskOperation(taskOperationBo, 'delegateTask').finally(() => { await taskOperation(taskOperationBo, 'delegateTask').finally(() => {
@@ -546,9 +544,9 @@ const handleDelegateTask = async data => {
}); });
dialog.visible = false; dialog.visible = false;
emits('submitCallback'); emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功'); modal.msgSuccess('操作成功');
} else { } else {
proxy?.$modal.msgWarning('请选择用户!'); modal.msgWarning('请选择用户!');
} }
}; };
//终止任务 //终止任务
@@ -557,7 +555,7 @@ const handleTerminationTask = async () => {
taskId: taskId.value, taskId: taskId.value,
comment: form.value.message comment: form.value.message
}; };
await proxy?.$modal.confirm('是否确认终止?'); await modal.confirm('是否确认终止?');
loading.value = true; loading.value = true;
buttonDisabled.value = true; buttonDisabled.value = true;
await terminationTask(params).finally(() => { await terminationTask(params).finally(() => {
@@ -566,7 +564,7 @@ const handleTerminationTask = async () => {
}); });
dialog.visible = false; dialog.visible = false;
emits('submitCallback'); emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功'); modal.msgSuccess('操作成功');
}; };
const handleTaskUser = async () => { const handleTaskUser = async () => {
const data = await currentTaskAllUser(taskId.value); const data = await currentTaskAllUser(taskId.value);
@@ -581,7 +579,7 @@ const handleTaskUser = async () => {
// 选择人员 // 选择人员
const choosePeople = async data => { const choosePeople = async data => {
if (!data.permissionFlag) { if (!data.permissionFlag) {
proxy?.$modal.msgError('没有可选择的人员,请联系管理员!'); modal.msgError('没有可选择的人员,请联系管理员!');
} }
popUserIds.value = data.permissionFlag; popUserIds.value = data.permissionFlag;
nodeCode.value = data.nodeCode; nodeCode.value = data.nodeCode;
+1 -1
View File
@@ -36,8 +36,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { propTypes } from '@/utils/propTypes';
import cache from '@/plugins/cache'; import cache from '@/plugins/cache';
import { propTypes } from '@/utils/propTypes';
const props = defineProps({ const props = defineProps({
showSearch: propTypes.bool.def(true), showSearch: propTypes.bool.def(true),
+12 -9
View File
@@ -9,8 +9,8 @@
> >
<div class="p-2 role-select-shell"> <div class="p-2 role-select-shell">
<transition <transition
:enter-active-class="proxy?.animate.searchAnimate.enter" :enter-active-class="animateConfig.searchAnimate.enter"
:leave-active-class="proxy?.animate.searchAnimate.leave" :leave-active-class="animateConfig.searchAnimate.leave"
> >
<div v-show="showSearch"> <div v-show="showSearch">
<el-card shadow="hover" class="search-panel selector-card"> <el-card shadow="hover" class="search-panel selector-card">
@@ -81,7 +81,7 @@
</vxe-column> </vxe-column>
<vxe-column field="createTime" title="创建时间" align="center"> <vxe-column field="createTime" title="创建时间" align="center">
<template #default="scope"> <template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</vxe-column> </vxe-column>
</vxe-table> </vxe-table>
@@ -104,10 +104,14 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { RoleVO, RoleQuery } from '@/api/system/role/types';
import { VxeTableInstance } from 'vxe-table'; import { VxeTableInstance } from 'vxe-table';
import useDialog from '@/hooks/useDialog'; import animateConfig from '@/animate';
import api from '@/api/system/role'; import api from '@/api/system/role';
import { RoleVO, RoleQuery } from '@/api/system/role/types';
import useDialog from '@/hooks/useDialog';
import { useDict } from '@/utils/dict';
import { parseTime, addDateRange } from '@/utils/ruoyi';
interface PropType { interface PropType {
modelValue?: RoleVO[] | RoleVO | undefined; modelValue?: RoleVO[] | RoleVO | undefined;
multiple?: boolean; multiple?: boolean;
@@ -120,14 +124,13 @@ const prop = withDefaults(defineProps<PropType>(), {
}); });
const emit = defineEmits(['update:modelValue', 'confirmCallBack']); const emit = defineEmits(['update:modelValue', 'confirmCallBack']);
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const roleList = ref<RoleVO[]>(); const roleList = ref<RoleVO[]>();
const loading = ref(true); const loading = ref(true);
const showSearch = ref(true); const showSearch = ref(true);
const total = ref(0); const total = ref(0);
const dateRange = ref<[DateModelType, DateModelType]>(['', '']); const dateRange = ref<any>(['', '']);
const selectRoleList = ref<RoleVO[]>([]); const selectRoleList = ref<RoleVO[]>([]);
const roleDialog = useDialog({ const roleDialog = useDialog({
@@ -171,7 +174,7 @@ const computedIds = data => {
*/ */
const getList = () => { const getList = () => {
loading.value = true; loading.value = true;
api.listRole(proxy?.addDateRange(queryParams.value, dateRange.value)).then(res => { api.listRole(addDateRange(queryParams.value, dateRange.value)).then(res => {
roleList.value = res.data?.rows; roleList.value = res.data?.rows;
total.value = res.data?.total; total.value = res.data?.total;
loading.value = false; loading.value = false;
+5 -5
View File
@@ -35,12 +35,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { constantRoutes } from '@/router';
import { isHttp } from '@/utils/validate';
import { useAppStore } from '@/store/modules/app';
import { useSettingsStore } from '@/store/modules/settings';
import { usePermissionStore } from '@/store/modules/permission';
import { RouteRecordRaw } from 'vue-router'; import { RouteRecordRaw } from 'vue-router';
import { constantRoutes } from '@/router';
import { useAppStore } from '@/store/modules/app';
import { usePermissionStore } from '@/store/modules/permission';
import { useSettingsStore } from '@/store/modules/settings';
import { isHttp } from '@/utils/validate';
// //
const visibleNumber = ref<number>(-1); const visibleNumber = ref<number>(-1);
+1 -1
View File
@@ -24,7 +24,7 @@
class="mt-2 dept-tree" class="mt-2 dept-tree"
:node-key="nodeKey" :node-key="nodeKey"
:data="data" :data="data"
:props="(treeProps as any)" :props="treeProps as any"
:expand-on-click-node="false" :expand-on-click-node="false"
:filter-node-method="internalFilterNode" :filter-node-method="internalFilterNode"
highlight-current highlight-current
+10 -8
View File
@@ -63,8 +63,8 @@
> >
<div class="p-2user-select-main"> <div class="p-2user-select-main">
<transition <transition
:enter-active-class="proxy?.animate.searchAnimate.enter" :enter-active-class="animateConfig.searchAnimate.enter"
:leave-active-class="proxy?.animate.searchAnimate.leave" :leave-active-class="animateConfig.searchAnimate.leave"
> >
<div v-show="showSearch"> <div v-show="showSearch">
<el-card shadow="hover" class="search-panel selector-card"> <el-card shadow="hover" class="search-panel selector-card">
@@ -167,11 +167,14 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { VxeTableInstance } from 'vxe-table';
import animateConfig from '@/animate';
import { DeptTreeVO, DeptVO } from '@/api/system/dept/types';
import api from '@/api/system/user'; import api from '@/api/system/user';
import { UserQuery, UserVO } from '@/api/system/user/types'; import { UserQuery, UserVO } from '@/api/system/user/types';
import { DeptTreeVO, DeptVO } from '@/api/system/dept/types';
import { VxeTableInstance } from 'vxe-table';
import useDialog from '@/hooks/useDialog'; import useDialog from '@/hooks/useDialog';
import { useDict } from '@/utils/dict';
import { addDateRange } from '@/utils/ruoyi';
interface PropType { interface PropType {
modelValue?: UserVO[] | UserVO | undefined; modelValue?: UserVO[] | UserVO | undefined;
@@ -187,14 +190,13 @@ const prop = withDefaults(defineProps<PropType>(), {
}); });
const emit = defineEmits(['update:modelValue', 'confirmCallBack']); const emit = defineEmits(['update:modelValue', 'confirmCallBack']);
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const userList = ref<UserVO[]>(); const userList = ref<UserVO[]>();
const loading = ref(true); const loading = ref(true);
const showSearch = ref(true); const showSearch = ref(true);
const total = ref(0); const total = ref(0);
const dateRange = ref<[DateModelType, DateModelType]>(['', '']); const dateRange = ref<any>(['', '']);
const deptName = ref(''); const deptName = ref('');
const treeCollapsed = ref(false); const treeCollapsed = ref(false);
const deptOptions = ref<DeptTreeVO[]>([]); const deptOptions = ref<DeptTreeVO[]>([]);
@@ -269,7 +271,7 @@ const getTreeSelect = async () => {
const getList = async () => { const getList = async () => {
loading.value = true; loading.value = true;
queryParams.value.userIds = prop.userIds; queryParams.value.userIds = prop.userIds;
const res = await api.listUser(proxy?.addDateRange(queryParams.value, dateRange.value)); const res = await api.listUser(addDateRange(queryParams.value, dateRange.value));
loading.value = false; loading.value = false;
userList.value = res.data?.rows; userList.value = res.data?.rows;
total.value = res.data?.total; total.value = res.data?.total;
+1 -1
View File
@@ -2,7 +2,7 @@
* v-copyText * v-copyText
* Copyright (c) 2022 ruoyi * Copyright (c) 2022 ruoyi
*/ */
import { DirectiveBinding } from 'vue'; import type { DirectiveBinding } from 'vue';
export default { export default {
beforeMount(el: any, { value, arg }: DirectiveBinding) { beforeMount(el: any, { value, arg }: DirectiveBinding) {
+1 -1
View File
@@ -1,6 +1,6 @@
import type { App } from 'vue';
import copyText from './common/copyText'; import copyText from './common/copyText';
import { hasPermi, hasRoles } from './permission'; import { hasPermi, hasRoles } from './permission';
import { App } from 'vue';
export default (app: App) => { export default (app: App) => {
app.directive('copyText', copyText); app.directive('copyText', copyText);
+1 -1
View File
@@ -1,4 +1,4 @@
import { Directive, DirectiveBinding } from 'vue'; import type { Directive, DirectiveBinding } from 'vue';
import { useUserStore } from '@/store/modules/user'; import { useUserStore } from '@/store/modules/user';
/** /**
* *
+1 -1
View File
@@ -1,4 +1,4 @@
import { Ref } from 'vue'; import type { Ref } from 'vue';
interface Options { interface Options {
title?: string; title?: string;
+1 -2
View File
@@ -1,9 +1,8 @@
// 自定义国际化配置 // 自定义国际化配置
import { createI18n } from 'vue-i18n'; import { createI18n } from 'vue-i18n';
import { LanguageEnum } from '@/enums/LanguageEnum'; import { LanguageEnum } from '@/enums/LanguageEnum';
import zh_CN from '@/lang/zh_CN';
import en_US from '@/lang/en_US'; import en_US from '@/lang/en_US';
import zh_CN from '@/lang/zh_CN';
/** /**
* *
+4 -6
View File
@@ -12,11 +12,11 @@
</template> </template>
<script setup name="AppMain" lang="ts"> <script setup name="AppMain" lang="ts">
import animateConfig from '@/animate';
import { useSettingsStore } from '@/store/modules/settings'; import { useSettingsStore } from '@/store/modules/settings';
import { useTagsViewStore } from '@/store/modules/tagsView'; import { useTagsViewStore } from '@/store/modules/tagsView';
import IframeToggle from './IframeToggle/index.vue'; import IframeToggle from './IframeToggle/index.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute(); const route = useRoute();
const tagsViewStore = useTagsViewStore(); const tagsViewStore = useTagsViewStore();
@@ -26,11 +26,9 @@ watch(
() => useSettingsStore().animationEnable, () => useSettingsStore().animationEnable,
(val: boolean) => { (val: boolean) => {
if (val) { if (val) {
animate.value = proxy?.animate.animateList[ animate.value = animateConfig.animateList[Math.floor(Math.random() * animateConfig.animateList.length)] as string;
Math.floor(Math.random() * proxy?.animate.animateList.length)
] as string;
} else { } else {
animate.value = proxy?.animate.defaultAnimate as string; animate.value = animateConfig.defaultAnimate as string;
} }
}, },
{ immediate: true } { immediate: true }
+1 -2
View File
@@ -9,9 +9,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import InnerLink from '../InnerLink/index.vue';
import { useTagsViewStore } from '@/store/modules/tagsView'; import { useTagsViewStore } from '@/store/modules/tagsView';
import InnerLink from '../InnerLink/index.vue';
const route = useRoute(); const route = useRoute();
const tagsViewStore = useTagsViewStore(); const tagsViewStore = useTagsViewStore();
+19 -20
View File
@@ -31,7 +31,7 @@
</div> </div>
</el-tooltip> </el-tooltip>
<!-- 消息 --> <!-- 消息 -->
<el-tooltip :content="proxy.$t('navbar.message')" effect="dark" placement="bottom"> <el-tooltip :content="$t('navbar.message')" effect="dark" placement="bottom">
<div> <div>
<el-popover placement="bottom" trigger="click" transition="el-zoom-in-top" :width="300" :persistent="false"> <el-popover placement="bottom" trigger="click" transition="el-zoom-in-top" :width="300" :persistent="false">
<template #reference> <template #reference>
@@ -51,19 +51,19 @@
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" /> <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>
<el-tooltip :content="proxy.$t('navbar.document')" effect="dark" placement="bottom"> <el-tooltip :content="$t('navbar.document')" effect="dark" placement="bottom">
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" /> <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>
<el-tooltip :content="proxy.$t('navbar.full')" effect="dark" placement="bottom"> <el-tooltip :content="$t('navbar.full')" effect="dark" placement="bottom">
<screenfull id="screenfull" class="right-menu-item hover-effect" /> <screenfull id="screenfull" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>
<el-tooltip :content="proxy.$t('navbar.language')" effect="dark" placement="bottom"> <el-tooltip :content="$t('navbar.language')" effect="dark" placement="bottom">
<lang-select id="lang-select" class="right-menu-item hover-effect" /> <lang-select id="lang-select" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>
<el-tooltip :content="proxy.$t('navbar.layoutSize')" effect="dark" placement="bottom"> <el-tooltip :content="$t('navbar.layoutSize')" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" /> <size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>
</template> </template>
@@ -80,13 +80,13 @@
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<router-link to="/user/profile"> <router-link to="/user/profile">
<el-dropdown-item>{{ proxy.$t('navbar.personalCenter') }}</el-dropdown-item> <el-dropdown-item>{{ $t('navbar.personalCenter') }}</el-dropdown-item>
</router-link> </router-link>
<el-dropdown-item v-if="settingsStore.showSettings" command="setLayout"> <el-dropdown-item v-if="settingsStore.showSettings" command="setLayout">
<span>{{ proxy.$t('navbar.layoutSetting') }}</span> <span>{{ $t('navbar.layoutSetting') }}</span>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item divided command="logout"> <el-dropdown-item divided command="logout">
<span>{{ proxy.$t('navbar.logout') }}</span> <span>{{ $t('navbar.logout') }}</span>
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
@@ -97,26 +97,25 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import SearchMenu from './TopBar/search.vue';
import { useAppStore } from '@/store/modules/app';
import { useUserStore } from '@/store/modules/user';
import { useSettingsStore } from '@/store/modules/settings';
import { useNoticeStore } from '@/store/modules/notice';
import notice from './notice/index.vue';
import router from '@/router';
import type { ElMessageBoxOptions } from 'element-plus'; import type { ElMessageBoxOptions } from 'element-plus';
import { NavTypeEnum } from '@/enums/NavTypeEnum';
import TopBar from './TopBar/index.vue';
import { CaretBottom } from '@element-plus/icons-vue'; import { CaretBottom } from '@element-plus/icons-vue';
import appLogo from '@/assets/logo/logo.png'; import appLogo from '@/assets/logo/logo.png';
import { NavTypeEnum } from '@/enums/NavTypeEnum';
import tab from '@/plugins/tab';
import router from '@/router';
import { useAppStore } from '@/store/modules/app';
import { useNoticeStore } from '@/store/modules/notice';
import { useSettingsStore } from '@/store/modules/settings';
import { useUserStore } from '@/store/modules/user';
import notice from './notice/index.vue';
import TopBar from './TopBar/index.vue';
import SearchMenu from './TopBar/search.vue';
const appStore = useAppStore(); const appStore = useAppStore();
const userStore = useUserStore(); const userStore = useUserStore();
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore();
const noticeStore = storeToRefs(useNoticeStore()); const noticeStore = storeToRefs(useNoticeStore());
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const navType = computed(() => settingsStore.navType); const navType = computed(() => settingsStore.navType);
const showLogo = computed(() => settingsStore.sidebarLogo); const showLogo = computed(() => settingsStore.sidebarLogo);
const displayName = computed(() => userStore.nickname || '管理员'); const displayName = computed(() => userStore.nickname || '管理员');
@@ -145,7 +144,7 @@ const logout = async () => {
redirect: encodeURIComponent(router.currentRoute.value.fullPath || '/') redirect: encodeURIComponent(router.currentRoute.value.fullPath || '/')
} }
}); });
proxy?.$tab.closeAllPage(); tab.closeAllPage();
}); });
}; };
+10 -10
View File
@@ -162,16 +162,16 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useDynamicTitle } from '@/utils/dynamicTitle';
import { useAppStore } from '@/store/modules/app';
import { useSettingsStore } from '@/store/modules/settings';
import { usePermissionStore } from '@/store/modules/permission';
import { handleThemeStyle } from '@/utils/theme';
import { SideThemeEnum } from '@/enums/SideThemeEnum';
import { NavTypeEnum } from '@/enums/NavTypeEnum'; import { NavTypeEnum } from '@/enums/NavTypeEnum';
import { SideThemeEnum } from '@/enums/SideThemeEnum';
import modal from '@/plugins/modal';
import defaultSettings from '@/settings'; import defaultSettings from '@/settings';
import { useAppStore } from '@/store/modules/app';
import { usePermissionStore } from '@/store/modules/permission';
import { useSettingsStore } from '@/store/modules/settings';
import { useDynamicTitle } from '@/utils/dynamicTitle';
import { handleThemeStyle } from '@/utils/theme';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const appStore = useAppStore(); const appStore = useAppStore();
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore();
const permissionStore = usePermissionStore(); const permissionStore = usePermissionStore();
@@ -245,7 +245,7 @@ const handleTheme = (val: string) => {
settingsStore.sideTheme = val; settingsStore.sideTheme = val;
}; };
const saveSetting = () => { const saveSetting = () => {
proxy?.$modal.loading('正在保存到本地,请稍候...'); modal.loading('正在保存到本地,请稍候...');
const settings = useStorage<LayoutSetting>('layout-setting', defaultSettings); const settings = useStorage<LayoutSetting>('layout-setting', defaultSettings);
if (!storeSettings.value.tagsViewPersist) { if (!storeSettings.value.tagsViewPersist) {
localStorage.removeItem('tags-view-visited'); localStorage.removeItem('tags-view-visited');
@@ -261,11 +261,11 @@ const saveSetting = () => {
settings.value.navType = storeSettings.value.navType; settings.value.navType = storeSettings.value.navType;
settings.value.radiusBase = storeSettings.value.radiusBase; settings.value.radiusBase = storeSettings.value.radiusBase;
setTimeout(() => { setTimeout(() => {
proxy?.$modal.closeLoading(); modal.closeLoading();
}, 1000); }, 1000);
}; };
const resetSetting = () => { const resetSetting = () => {
proxy?.$modal.loading('正在清除设置缓存并刷新,请稍候...'); modal.loading('正在清除设置缓存并刷新,请稍候...');
localStorage.removeItem('tags-view-visited'); localStorage.removeItem('tags-view-visited');
useStorage<any>('layout-setting', null).value = null; useStorage<any>('layout-setting', null).value = null;
setTimeout('window.location.reload()', 1000); setTimeout('window.location.reload()', 1000);
+3 -3
View File
@@ -1,6 +1,6 @@
<template> <template>
<div class="sidebar-logo-container" :class="{ collapse: collapse }"> <div class="sidebar-logo-container" :class="{ collapse: collapse }">
<transition :enter-active-class="proxy?.animate.logoAnimate.enter" mode="out-in"> <transition :enter-active-class="animateConfig.logoAnimate.enter" mode="out-in">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/"> <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" /> <img v-if="logo" :src="logo" class="sidebar-logo" />
<h1 v-else class="sidebar-title"> <h1 v-else class="sidebar-title">
@@ -18,10 +18,10 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import animateConfig from '@/animate';
import logo from '@/assets/logo/logo.png'; import logo from '@/assets/logo/logo.png';
import { useSettingsStore } from '@/store/modules/settings';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { NavTypeEnum } from '@/enums/NavTypeEnum'; import { NavTypeEnum } from '@/enums/NavTypeEnum';
import { useSettingsStore } from '@/store/modules/settings';
defineProps({ defineProps({
collapse: { collapse: {
@@ -44,10 +44,10 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { RouteRecordRaw } from 'vue-router';
import { getNormalPath } from '@/utils/ruoyi';
import { isExternal } from '@/utils/validate'; import { isExternal } from '@/utils/validate';
import AppLink from './Link.vue'; import AppLink from './Link.vue';
import { getNormalPath } from '@/utils/ruoyi';
import { RouteRecordRaw } from 'vue-router';
const props = defineProps({ const props = defineProps({
item: { item: {
@@ -105,7 +105,10 @@ const resolvePath = (routePath: string, routeQuery?: string): any => {
} }
if (routeQuery) { if (routeQuery) {
const query = JSON.parse(routeQuery); const query = JSON.parse(routeQuery);
return { path: getNormalPath(props.basePath + '/' + routePath), query: query }; return {
path: getNormalPath(props.basePath + '/' + routePath),
query: query
};
} }
return getNormalPath(props.basePath + '/' + routePath); return getNormalPath(props.basePath + '/' + routePath);
}; };
+6 -7
View File
@@ -2,7 +2,7 @@
<div class="sidebar-shell" :class="{ 'has-logo': showLogo }" :style="{ backgroundColor: bgColor }"> <div class="sidebar-shell" :class="{ 'has-logo': showLogo }" :style="{ backgroundColor: bgColor }">
<logo v-if="showLogo" :collapse="isCollapse" /> <logo v-if="showLogo" :collapse="isCollapse" />
<el-scrollbar :class="sideTheme" wrap-class="scrollbar-wrapper"> <el-scrollbar :class="sideTheme" wrap-class="scrollbar-wrapper">
<transition :enter-active-class="proxy?.animate.menuSearchAnimate.enter" mode="out-in"> <transition :enter-active-class="animateConfig.menuSearchAnimate.enter" mode="out-in">
<el-menu <el-menu
:default-active="activeMenu" :default-active="activeMenu"
:collapse="isCollapse" :collapse="isCollapse"
@@ -22,14 +22,13 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { RouteRecordRaw } from 'vue-router';
import animateConfig from '@/animate';
import { useAppStore } from '@/store/modules/app';
import { usePermissionStore } from '@/store/modules/permission';
import { useSettingsStore } from '@/store/modules/settings';
import Logo from './Logo.vue'; import Logo from './Logo.vue';
import SidebarItem from './SidebarItem.vue'; import SidebarItem from './SidebarItem.vue';
import { useAppStore } from '@/store/modules/app';
import { useSettingsStore } from '@/store/modules/settings';
import { usePermissionStore } from '@/store/modules/permission';
import { RouteRecordRaw } from 'vue-router';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute(); const route = useRoute();
const appStore = useAppStore(); const appStore = useAppStore();
@@ -4,8 +4,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { login, callback } from '@/api/login'; import { login, callback } from '@/api/login';
import { setToken, getToken } from '@/utils/auth';
import { LoginData } from '@/api/types'; import { LoginData } from '@/api/types';
import { setToken, getToken } from '@/utils/auth';
const route = useRoute(); const route = useRoute();
const loading = ref(true); const loading = ref(true);
@@ -13,8 +13,7 @@ const emits = defineEmits(['scroll', 'updateArrows']);
const scrollContainerRef = ref<ElScrollbarInstance>(); const scrollContainerRef = ref<ElScrollbarInstance>();
const getScrollWrapper = (): HTMLElement | null => { const getScrollWrapper = (): HTMLElement | null => {
const scrollbar = scrollContainerRef.value as any; return scrollContainerRef.value?.wrapRef ?? null;
return scrollbar?.wrapRef || scrollbar?.$refs?.wrapRef || null;
}; };
const emitScroll = () => { const emitScroll = () => {
+11 -11
View File
@@ -88,6 +88,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type { RouteLocationNormalized, RouteRecordRaw } from 'vue-router';
import { import {
ArrowDown, ArrowDown,
ArrowLeft, ArrowLeft,
@@ -100,12 +101,12 @@ import {
RefreshRight, RefreshRight,
Right Right
} from '@element-plus/icons-vue'; } from '@element-plus/icons-vue';
import ScrollPane from './ScrollPane.vue'; import tab from '@/plugins/tab';
import { getNormalPath } from '@/utils/ruoyi';
import { useSettingsStore } from '@/store/modules/settings';
import { usePermissionStore } from '@/store/modules/permission'; import { usePermissionStore } from '@/store/modules/permission';
import { useSettingsStore } from '@/store/modules/settings';
import { useTagsViewStore } from '@/store/modules/tagsView'; import { useTagsViewStore } from '@/store/modules/tagsView';
import type { RouteLocationNormalized, RouteRecordRaw } from 'vue-router'; import { getNormalPath } from '@/utils/ruoyi';
import ScrollPane from './ScrollPane.vue';
const visible = ref(false); const visible = ref(false);
const top = ref(0); const top = ref(0);
@@ -118,7 +119,6 @@ const isFullscreen = ref(false);
const scrollPaneRef = ref<InstanceType<typeof ScrollPane>>(); const scrollPaneRef = ref<InstanceType<typeof ScrollPane>>();
const fullscreenModeClass = 'tags-fullscreen-mode'; const fullscreenModeClass = 'tags-fullscreen-mode';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore();
@@ -267,7 +267,7 @@ const refreshSelectedTag = (view?: RouteLocationNormalized) => {
if (!view) { if (!view) {
return; return;
} }
proxy?.$tab.refreshPage(view); tab.refreshPage(view);
if (route.meta.link) { if (route.meta.link) {
tagsViewStore.delIframeView(route as RouteLocationNormalized); tagsViewStore.delIframeView(route as RouteLocationNormalized);
} }
@@ -277,7 +277,7 @@ const closeSelectedTag = (view?: RouteLocationNormalized) => {
if (!view) { if (!view) {
return; return;
} }
proxy?.$tab.closePage(view).then(({ visitedViews }: { visitedViews: RouteLocationNormalized[] }) => { tab.closePage(view).then(({ visitedViews }: { visitedViews: RouteLocationNormalized[] }) => {
if (isActive(view)) { if (isActive(view)) {
toLastView(visitedViews, view); toLastView(visitedViews, view);
} }
@@ -289,7 +289,7 @@ const closeRightTags = () => {
if (!tag) { if (!tag) {
return; return;
} }
proxy?.$tab.closeRightPage(tag).then((views: RouteLocationNormalized[]) => { tab.closeRightPage(tag).then((views: RouteLocationNormalized[]) => {
if (!views.find(item => item.fullPath === route.fullPath)) { if (!views.find(item => item.fullPath === route.fullPath)) {
toLastView(views); toLastView(views);
} }
@@ -301,7 +301,7 @@ const closeLeftTags = () => {
if (!tag) { if (!tag) {
return; return;
} }
proxy?.$tab.closeLeftPage(tag).then((views: RouteLocationNormalized[]) => { tab.closeLeftPage(tag).then((views: RouteLocationNormalized[]) => {
if (!views.find(item => item.fullPath === route.fullPath)) { if (!views.find(item => item.fullPath === route.fullPath)) {
toLastView(views); toLastView(views);
} }
@@ -314,13 +314,13 @@ const closeOthersTags = () => {
return; return;
} }
router.push(tag.fullPath || tag.path || '/').catch(() => {}); router.push(tag.fullPath || tag.path || '/').catch(() => {});
proxy?.$tab.closeOtherPage(tag).then(() => { tab.closeOtherPage(tag).then(() => {
moveToCurrentTag(); moveToCurrentTag();
}); });
}; };
const closeAllTags = (view?: RouteLocationNormalized) => { const closeAllTags = (view?: RouteLocationNormalized) => {
proxy?.$tab.closeAllPage().then(({ visitedViews: views }: { visitedViews: RouteLocationNormalized[] }) => { tab.closeAllPage().then(({ visitedViews: views }: { visitedViews: RouteLocationNormalized[] }) => {
if (affixTags.value.some(tag => tag.path === route.path)) { if (affixTags.value.some(tag => tag.path === route.path)) {
return; return;
} }
+15 -14
View File
@@ -7,10 +7,10 @@
mode="horizontal" mode="horizontal"
> >
<sidebar-item <sidebar-item
:key="route.path + index" :key="menuRoute.path + index"
v-for="(route, index) in topMenus" v-for="(menuRoute, index) in topMenus"
:item="route" :item="menuRoute"
:base-path="route.path" :base-path="menuRoute.path"
popper-class="topbar-menu-popper" popper-class="topbar-menu-popper"
/> />
@@ -24,10 +24,10 @@
<span>更多菜单</span> <span>更多菜单</span>
</template> </template>
<sidebar-item <sidebar-item
:key="route.path + index" :key="menuRoute.path + index"
v-for="(route, index) in moreRoutes" v-for="(menuRoute, index) in moreRoutes"
:item="route" :item="menuRoute"
:base-path="route.path" :base-path="menuRoute.path"
popper-class="topbar-menu-popper" popper-class="topbar-menu-popper"
/> />
</el-sub-menu> </el-sub-menu>
@@ -35,9 +35,10 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import SidebarItem from '../Sidebar/SidebarItem'; import type { RouteRecordRaw } from 'vue-router';
import { useSettingsStore } from '@/store/modules/settings';
import { usePermissionStore } from '@/store/modules/permission'; import { usePermissionStore } from '@/store/modules/permission';
import { useSettingsStore } from '@/store/modules/settings';
import SidebarItem from '../Sidebar/SidebarItem.vue';
const route = useRoute(); const route = useRoute();
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore();
@@ -53,11 +54,11 @@ const activeMenu = computed(() => {
}); });
const visibleNumber = ref(5); const visibleNumber = ref(5);
const topMenus = computed(() => { const topMenus = computed((): RouteRecordRaw[] => {
return permissionStore.sidebarRouters.filter(f => !f.hidden).slice(0, visibleNumber.value); return permissionStore.sidebarRouters.filter(f => !f.hidden).slice(0, visibleNumber.value) as RouteRecordRaw[];
}); });
const moreRoutes = computed(() => { const moreRoutes = computed((): RouteRecordRaw[] => {
return permissionStore.sidebarRouters.filter(f => !f.hidden).slice(visibleNumber.value); return permissionStore.sidebarRouters.filter(f => !f.hidden).slice(visibleNumber.value) as RouteRecordRaw[];
}); });
function setVisibleNumber() { function setVisibleNumber() {
let width = document.body.getBoundingClientRect().width; let width = document.body.getBoundingClientRect().width;
+3 -3
View File
@@ -88,12 +88,12 @@
</template> </template>
<script setup lang="ts" name="layoutBreadcrumbSearch"> <script setup lang="ts" name="layoutBreadcrumbSearch">
import type { RouteRecordRaw } from 'vue-router';
import { Search } from '@element-plus/icons-vue'; import { Search } from '@element-plus/icons-vue';
import { getNormalPath } from '@/utils/ruoyi';
import { isHttp } from '@/utils/validate';
import { usePermissionStore } from '@/store/modules/permission'; import { usePermissionStore } from '@/store/modules/permission';
import { useSettingsStore } from '@/store/modules/settings'; import { useSettingsStore } from '@/store/modules/settings';
import type { RouteRecordRaw } from 'vue-router'; import { getNormalPath } from '@/utils/ruoyi';
import { isHttp } from '@/utils/validate';
type SearchMenuItem = { type SearchMenuItem = {
path: string; path: string;
+2 -2
View File
@@ -29,10 +29,10 @@
</template> </template>
<script setup lang="ts" name="layoutBreadcrumbUserNews"> <script setup lang="ts" name="layoutBreadcrumbUserNews">
import { useNoticeStore } from '@/store/modules/notice';
import router from '@/router'; import router from '@/router';
import { markMessageRead, markMessageReadBatch } from '@/utils/message-read'; import { useNoticeStore } from '@/store/modules/notice';
import { useUserStore } from '@/store/modules/user'; import { useUserStore } from '@/store/modules/user';
import { markMessageRead, markMessageReadBatch } from '@/utils/message-read';
import { NOTICE_GROUP } from '@/utils/push-message'; import { NOTICE_GROUP } from '@/utils/push-message';
const noticeStore = useNoticeStore(); const noticeStore = useNoticeStore();
+9 -5
View File
@@ -14,12 +14,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import SideBar from './components/Sidebar/index.vue'; import { NavTypeEnum } from '@/enums/NavTypeEnum';
import { AppMain, Navbar, Settings, TagsView } from './components';
import { useAppStore } from '@/store/modules/app'; import { useAppStore } from '@/store/modules/app';
import { useSettingsStore } from '@/store/modules/settings'; import { useSettingsStore } from '@/store/modules/settings';
import { NavTypeEnum } from '@/enums/NavTypeEnum';
import { initMessageBox, initPush } from '@/utils/push'; import { initMessageBox, initPush } from '@/utils/push';
import { AppMain, Navbar, Settings, TagsView } from './components';
import SideBar from './components/Sidebar/index.vue';
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore();
const theme = computed(() => settingsStore.theme); const theme = computed(() => settingsStore.theme);
@@ -45,14 +45,18 @@ const classObj = computed(() => ({
const { width } = useWindowSize(); const { width } = useWindowSize();
const WIDTH = 992; // refer to Bootstrap's responsive design const WIDTH = 992; // refer to Bootstrap's responsive design
watch(width, (w) => { watch(
width,
w => {
if (w - 1 < WIDTH) { if (w - 1 < WIDTH) {
useAppStore().toggleDevice('mobile'); useAppStore().toggleDevice('mobile');
useAppStore().closeSideBar({ withoutAnimation: true }); useAppStore().closeSideBar({ withoutAnimation: true });
} else { } else {
useAppStore().toggleDevice('desktop'); useAppStore().toggleDevice('desktop');
} }
}, { immediate: true }); },
{ immediate: true }
);
const settingRef = ref<InstanceType<typeof Settings>>(); const settingRef = ref<InstanceType<typeof Settings>>();
+12 -31
View File
@@ -1,45 +1,27 @@
import HighLight from '@highlightjs/vue-plugin';
import { ElDialog } from 'element-plus';
import { createApp } from 'vue'; import { createApp } from 'vue';
// global css import VXETable from 'vxe-table';
import 'virtual:uno.css'; import 'virtual:uno.css';
import 'element-plus/theme-chalk/dark/css-vars.css'; import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/assets/styles/index.scss'; import '@/assets/styles/index.scss';
// App、router、store
import App from './App.vue';
import store from './store';
import router from './router';
// 自定义指令
import directive from './directive';
// 注册插件
import plugins from './plugins/index'; // plugins
// 高亮组件
// import 'highlight.js/styles/a11y-light.css';
import 'highlight.js/styles/atom-one-dark.css'; import 'highlight.js/styles/atom-one-dark.css';
import 'highlight.js/lib/common'; import 'highlight.js/lib/common';
import HighLight from '@highlightjs/vue-plugin';
// svg图标
import 'virtual:svg-icons-register'; import 'virtual:svg-icons-register';
import ElementIcons from '@/plugins/svgicon';
// permission control
import './permission';
// 国际化
import i18n from '@/lang/index';
// vxeTable
import VXETable from 'vxe-table';
import 'vxe-table/lib/style.css'; import 'vxe-table/lib/style.css';
import i18n from '@/lang/index';
import ElementIcons from '@/plugins/svgicon';
import App from './App.vue';
import directive from './directive';
import plugins from './plugins/index';
import './permission';
import router from './router';
import store from './store';
VXETable.setConfig({ VXETable.setConfig({
zIndex: 999999 zIndex: 999999
}); });
// 修改 el-dialog 默认点击遮照为不关闭
import { ElDialog } from 'element-plus';
ElDialog.props.closeOnClickModal.default = false; ElDialog.props.closeOnClickModal.default = false;
const app = createApp(App); const app = createApp(App);
@@ -51,7 +33,6 @@ app.use(store);
app.use(i18n); app.use(i18n);
app.use(VXETable); app.use(VXETable);
app.use(plugins); app.use(plugins);
// 自定义指令
directive(app); directive(app);
app.mount('#app'); app.mount('#app');
+7 -7
View File
@@ -1,14 +1,14 @@
import { to as tos } from 'await-to-js'; import { to as tos } from 'await-to-js';
import router from './router'; import { ElMessage } from 'element-plus/es';
import * as NProgressModule from 'nprogress'; import * as NProgressModule from 'nprogress';
import 'nprogress/nprogress.css'; import 'nprogress/nprogress.css';
import { getToken } from '@/utils/auth';
import { isHttp, isPathMatch } from '@/utils/validate';
import { isRelogin } from '@/utils/request';
import { useUserStore } from '@/store/modules/user';
import { useSettingsStore } from '@/store/modules/settings';
import { usePermissionStore } from '@/store/modules/permission'; import { usePermissionStore } from '@/store/modules/permission';
import { ElMessage } from 'element-plus/es'; import { useSettingsStore } from '@/store/modules/settings';
import { useUserStore } from '@/store/modules/user';
import { getToken } from '@/utils/auth';
import { isRelogin } from '@/utils/request';
import { isHttp, isPathMatch } from '@/utils/validate';
import router from './router';
const NProgress = ('default' in NProgressModule ? NProgressModule.default : NProgressModule) as typeof NProgressModule; const NProgress = ('default' in NProgressModule ? NProgressModule.default : NProgressModule) as typeof NProgressModule;
+6 -5
View File
@@ -1,10 +1,11 @@
import axios from 'axios';
import errorCode from '@/utils/errorCode';
import { blobValidate } from '@/utils/ruoyi';
import { extractErrorMessage, globalHeaders } from '@/utils/request';
import { saveBlob } from '@/utils/save';
import type { LoadingInstance } from 'element-plus'; import type { LoadingInstance } from 'element-plus';
import axiosModule from 'axios';
import errorCode from '@/utils/errorCode';
import { extractErrorMessage, globalHeaders } from '@/utils/request';
import { blobValidate } from '@/utils/ruoyi';
import { saveBlob } from '@/utils/save';
const axios = axiosModule as any;
const baseURL = import.meta.env.VITE_APP_BASE_API; const baseURL = import.meta.env.VITE_APP_BASE_API;
let downloadLoadingInstance: LoadingInstance | undefined; let downloadLoadingInstance: LoadingInstance | undefined;
export default { export default {
+8 -33
View File
@@ -1,43 +1,18 @@
import type { App } from 'vue';
import auth from './auth';
import cache from './cache';
import download from './download';
import modal from './modal'; import modal from './modal';
import tab from './tab'; import tab from './tab';
import download from './download';
import cache from './cache';
import auth from './auth';
// 预设动画
import animate from '@/animate';
import { download as dl } from '@/utils/request';
import { useDict } from '@/utils/dict';
import { getConfigKey, updateConfigByKey } from '@/api/system/config';
import { parseTime, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi';
import { App } from 'vue';
/**
* import API
* setup @/utils@/api
*/
export default function installPlugin(app: App) { export default function installPlugin(app: App) {
// 页签操作
app.config.globalProperties.$tab = tab; app.config.globalProperties.$tab = tab;
// 模态框对象
app.config.globalProperties.$modal = modal; app.config.globalProperties.$modal = modal;
// 缓存对象
app.config.globalProperties.$cache = cache; app.config.globalProperties.$cache = cache;
// 下载文件
app.config.globalProperties.$download = download; app.config.globalProperties.$download = download;
// 认证对象
app.config.globalProperties.$auth = auth; app.config.globalProperties.$auth = auth;
// 全局方法挂载
app.config.globalProperties.useDict = useDict;
app.config.globalProperties.getConfigKey = getConfigKey;
app.config.globalProperties.updateConfigByKey = updateConfigByKey;
app.config.globalProperties.download = dl;
app.config.globalProperties.parseTime = parseTime;
app.config.globalProperties.handleTree = handleTree;
app.config.globalProperties.addDateRange = addDateRange;
app.config.globalProperties.selectDictLabel = selectDictLabel;
app.config.globalProperties.selectDictLabels = selectDictLabels;
app.config.globalProperties.animate = animate;
} }
+1 -1
View File
@@ -1,5 +1,5 @@
import type { App } from 'vue';
import * as ElementPlusIconsVue from '@element-plus/icons-vue'; import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import { App } from 'vue';
export default { export default {
install: (app: App) => { install: (app: App) => {
+4 -2
View File
@@ -1,5 +1,5 @@
import type { RouteLocationMatched, RouteLocationNormalized, RouteLocationRaw } from 'vue-router';
import router from '@/router'; import router from '@/router';
import { RouteLocationMatched, RouteLocationNormalized, RouteLocationRaw } from 'vue-router';
import { useTagsViewStore } from '@/store/modules/tagsView'; import { useTagsViewStore } from '@/store/modules/tagsView';
export default { export default {
@@ -57,7 +57,9 @@ export default {
): Promise<{ visitedViews: RouteLocationNormalized[]; cachedViews: string[] } | any> { ): Promise<{ visitedViews: RouteLocationNormalized[]; cachedViews: string[] } | any> {
if (obj === undefined) { if (obj === undefined) {
// prettier-ignore // prettier-ignore
const { visitedViews } = await useTagsViewStore().delView(router.currentRoute.value) const { visitedViews } = await useTagsViewStore().delView(
router.currentRoute.value,
);
const latestView = visitedViews.slice(-1)[0]; const latestView = visitedViews.slice(-1)[0];
if (latestView) { if (latestView) {
return router.push(latestView.fullPath); return router.push(latestView.fullPath);
+1 -1
View File
@@ -1,4 +1,4 @@
import { createWebHistory, createRouter, RouteRecordRaw } from 'vue-router'; import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router';
/* Layout */ /* Layout */
import Layout from '@/layout/index.vue'; import Layout from '@/layout/index.vue';
+4 -4
View File
@@ -1,8 +1,8 @@
import zhCN from 'element-plus/es/locale/lang/zh-cn';
import enUS from 'element-plus/es/locale/lang/en';
import { defineStore } from 'pinia';
import { useStorage } from '@vueuse/core'; import { useStorage } from '@vueuse/core';
import { ref, reactive, computed } from 'vue'; import enUS from 'element-plus/es/locale/lang/en';
import zhCN from 'element-plus/es/locale/lang/zh-cn';
import { defineStore } from 'pinia';
import { computed, reactive, ref } from 'vue';
export const useAppStore = defineStore('app', () => { export const useAppStore = defineStore('app', () => {
const sidebarStatus = useStorage('sidebarStatus', '1'); const sidebarStatus = useStorage('sidebarStatus', '1');
+6 -6
View File
@@ -1,13 +1,13 @@
import type { RouteRecordRaw } from 'vue-router';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import router, { constantRoutes, dynamicRoutes } from '@/router'; import { ref } from 'vue';
import store from '@/store';
import { getRouters } from '@/api/menu'; import { getRouters } from '@/api/menu';
import auth from '@/plugins/auth';
import { RouteRecordRaw } from 'vue-router';
import Layout from '@/layout/index.vue';
import ParentView from '@/components/ParentView/index.vue'; import ParentView from '@/components/ParentView/index.vue';
import InnerLink from '@/layout/components/InnerLink/index.vue'; import InnerLink from '@/layout/components/InnerLink/index.vue';
import { ref } from 'vue'; import Layout from '@/layout/index.vue';
import auth from '@/plugins/auth';
import router, { constantRoutes, dynamicRoutes } from '@/router';
import store from '@/store';
import { createCustomNameComponent } from '@/utils/createCustomNameComponent'; import { createCustomNameComponent } from '@/utils/createCustomNameComponent';
// 匹配views里面所有的.vue文件,预建查找表避免每次 O(n) 扫描 // 匹配views里面所有的.vue文件,预建查找表避免每次 O(n) 扫描
+3 -3
View File
@@ -1,9 +1,9 @@
import { defineStore } from 'pinia';
import defaultSettings from '@/settings';
import { useDynamicTitle } from '@/utils/dynamicTitle';
import { useStorage } from '@vueuse/core'; import { useStorage } from '@vueuse/core';
import { defineStore } from 'pinia';
import { ref } from 'vue'; import { ref } from 'vue';
import { NavTypeEnum } from '@/enums/NavTypeEnum'; import { NavTypeEnum } from '@/enums/NavTypeEnum';
import defaultSettings from '@/settings';
import { useDynamicTitle } from '@/utils/dynamicTitle';
export const useSettingsStore = defineStore('setting', () => { export const useSettingsStore = defineStore('setting', () => {
const storageSetting = useStorage<LayoutSetting>('layout-setting', { const storageSetting = useStorage<LayoutSetting>('layout-setting', {
+14 -6
View File
@@ -1,10 +1,12 @@
import { to } from 'await-to-js'; import { to } from 'await-to-js';
import { getToken, removeToken, setToken } from '@/utils/auth';
import { login as loginApi, logout as logoutApi, getInfo as getUserInfo } from '@/api/login';
import { LoginData } from '@/api/types';
import defAva from '@/assets/images/profile.jpg';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { ref } from 'vue'; import { ref } from 'vue';
import type { UserInfo } from '@/api/system/user/types';
import type { LoginData, LoginResult } from '@/api/types';
import type { RuoYiAjaxResult } from '@/utils/api-types';
import { getInfo as getUserInfo, login as loginApi, logout as logoutApi } from '@/api/login';
import defAva from '@/assets/images/profile.jpg';
import { getToken, removeToken, setToken } from '@/utils/auth';
export const useUserStore = defineStore('user', () => { export const useUserStore = defineStore('user', () => {
const token = ref(getToken()); const token = ref(getToken());
@@ -23,7 +25,10 @@ export const useUserStore = defineStore('user', () => {
const login = async (userInfo: LoginData): Promise<void> => { const login = async (userInfo: LoginData): Promise<void> => {
const [err, res] = await to(loginApi(userInfo)); const [err, res] = await to(loginApi(userInfo));
if (res) { if (res) {
const data = res.data; const data = (res as RuoYiAjaxResult<LoginResult>).data;
if (!data?.access_token) {
return Promise.reject(err);
}
setToken(data.access_token); setToken(data.access_token);
token.value = data.access_token; token.value = data.access_token;
return Promise.resolve(); return Promise.resolve();
@@ -35,7 +40,10 @@ export const useUserStore = defineStore('user', () => {
const getInfo = async (): Promise<void> => { const getInfo = async (): Promise<void> => {
const [err, res] = await to(getUserInfo()); const [err, res] = await to(getUserInfo());
if (res) { if (res) {
const data = res.data; const data = (res as RuoYiAjaxResult<UserInfo>).data;
if (!data?.user) {
return Promise.reject(err);
}
const user = data.user; const user = data.user;
const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar; const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar;
-1
View File
@@ -1,4 +1,3 @@
export {};
declare module 'axios' { declare module 'axios' {
interface AxiosResponse<T = any> { interface AxiosResponse<T = any> {
code: number; code: number;
+1 -2
View File
@@ -1,4 +1,4 @@
import type { PropType as VuePropType, ComponentInternalInstance as ComponentInstance } from 'vue'; import type { ComponentInternalInstance as ComponentInstance } from 'vue';
import { LanguageEnum } from '@/enums/LanguageEnum'; import { LanguageEnum } from '@/enums/LanguageEnum';
import { NavTypeEnum } from '@/enums/NavTypeEnum'; import { NavTypeEnum } from '@/enums/NavTypeEnum';
@@ -172,4 +172,3 @@ declare global {
dark: boolean; dark: boolean;
} }
} }
export {};
+4 -21
View File
@@ -1,39 +1,22 @@
import modal from '@/plugins/modal'; import type { LanguageType } from '@/lang';
import tab from '@/plugins/tab';
import download from '@/plugins/download';
import auth from '@/plugins/auth'; import auth from '@/plugins/auth';
import cache from '@/plugins/cache'; import cache from '@/plugins/cache';
import animate from '@/animate'; import download from '@/plugins/download';
import { useDict } from '@/utils/dict'; import modal from '@/plugins/modal';
import { handleTree, addDateRange, selectDictLabel, selectDictLabels, parseTime } from '@/utils/ruoyi'; import tab from '@/plugins/tab';
import { getConfigKey, updateConfigByKey } from '@/api/system/config';
import { download as rd } from '@/utils/request';
import type { LanguageType } from '@/lang';
declare module 'vue' { declare module 'vue' {
interface ComponentCustomProperties { interface ComponentCustomProperties {
// 全局方法声明
$modal: typeof modal; $modal: typeof modal;
$tab: typeof tab; $tab: typeof tab;
$download: typeof download; $download: typeof download;
$auth: typeof auth; $auth: typeof auth;
$cache: typeof cache; $cache: typeof cache;
animate: typeof animate;
/** /**
* i18n $t方法支持ts类型提示 * i18n $t方法支持ts类型提示
* @param key i18n key * @param key i18n key
*/ */
$t(key: ObjKeysToUnion<LanguageType>): string; $t(key: ObjKeysToUnion<LanguageType>): string;
useDict: typeof useDict;
addDateRange: typeof addDateRange;
download: typeof rd;
handleTree: typeof handleTree;
getConfigKey: typeof getConfigKey;
updateConfigByKey: typeof updateConfigByKey;
selectDictLabel: typeof selectDictLabel;
selectDictLabels: typeof selectDictLabels;
parseTime: typeof parseTime;
} }
} }
-2
View File
@@ -34,5 +34,3 @@ declare module 'vue-router' {
query?: LocationQuery; query?: LocationQuery;
} }
} }
export {};
+11
View File
@@ -0,0 +1,11 @@
/**
* `src/utils/request` resolve JSON `{ code, msg, data }`
* axios 1.13 + TS6 `axios` AxiosPromise
*/
export interface RuoYiAjaxResult<T = unknown> {
code?: number;
msg?: string;
data?: T;
}
export type AxiosPromise<T = unknown> = Promise<RuoYiAjaxResult<T>>;
+1
View File
@@ -1,4 +1,5 @@
import { JSEncrypt } from 'jsencrypt'; import { JSEncrypt } from 'jsencrypt';
// 密钥对生成 http://web.chacuo.net/netrsakeypair // 密钥对生成 http://web.chacuo.net/netrsakeypair
const publicKey = import.meta.env.VITE_APP_RSA_PUBLIC_KEY; const publicKey = import.meta.env.VITE_APP_RSA_PUBLIC_KEY;
+1 -1
View File
@@ -16,7 +16,7 @@ export async function resolveOssContent(html: string): Promise<string> {
const matches = [...html.matchAll(OSS_MARKER_RE)]; const matches = [...html.matchAll(OSS_MARKER_RE)];
if (matches.length === 0) return html; if (matches.length === 0) return html;
const ossIds = [...new Set(matches.map((m) => m[1]))]; const ossIds = [...new Set(matches.map(m => m[1]))];
try { try {
const res = await listByIds(ossIds.join(',')); const res = await listByIds(ossIds.join(','));
+2 -2
View File
@@ -1,5 +1,5 @@
import { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import VueTypes, { createTypes, toValidableType, VueTypeValidableDef, VueTypesInterface } from 'vue-types'; import VueTypes, { createTypes, toValidableType, type VueTypesInterface, type VueTypeValidableDef } from 'vue-types';
type PropTypes = VueTypesInterface & { type PropTypes = VueTypesInterface & {
readonly style: VueTypeValidableDef<CSSProperties>; readonly style: VueTypeValidableDef<CSSProperties>;
+3 -3
View File
@@ -1,9 +1,9 @@
import { getMessageBox } from '@/api/system/message'; import { ElNotification } from 'element-plus';
import type { MessageVO } from '@/api/system/message/types'; import type { MessageVO } from '@/api/system/message/types';
import { getMessageBox } from '@/api/system/message';
import { useNoticeStore } from '@/store/modules/notice';
import { useUserStore } from '@/store/modules/user'; import { useUserStore } from '@/store/modules/user';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { ElNotification } from 'element-plus';
import { useNoticeStore } from '@/store/modules/notice';
import { isMessageRead } from '@/utils/message-read'; import { isMessageRead } from '@/utils/message-read';
import { parsePushMessage, resolveNoticeGroup, resolveNoticeTitle, shouldAppendNotice } from '@/utils/push-message'; import { parsePushMessage, resolveNoticeGroup, resolveNoticeTitle, shouldAppendNotice } from '@/utils/push-message';
+46 -29
View File
@@ -1,16 +1,19 @@
import axios, { AxiosResponse, InternalAxiosRequestConfig } from 'axios'; import type { LoadingInstance } from 'element-plus';
import axiosModule from 'axios';
import { HttpStatus } from '@/enums/RespEnum';
import { getLanguage } from '@/lang';
import cache from '@/plugins/cache';
import router from '@/router';
import { useUserStore } from '@/store/modules/user'; import { useUserStore } from '@/store/modules/user';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { tansParams, blobValidate } from '@/utils/ruoyi'; import { decryptBase64, decryptWithAes, encryptBase64, encryptWithAes, generateAesKey } from '@/utils/crypto';
import cache from '@/plugins/cache';
import { HttpStatus } from '@/enums/RespEnum';
import { errorCode } from '@/utils/errorCode'; import { errorCode } from '@/utils/errorCode';
import { getLanguage } from '@/lang'; import { decrypt, encrypt } from '@/utils/jsencrypt';
import { encryptBase64, encryptWithAes, generateAesKey, decryptWithAes, decryptBase64 } from '@/utils/crypto'; import { blobValidate, tansParams } from '@/utils/ruoyi';
import { encrypt, decrypt } from '@/utils/jsencrypt';
import router from '@/router';
import { saveBlob } from '@/utils/save'; import { saveBlob } from '@/utils/save';
import type { LoadingInstance } from 'element-plus';
/** axios 1.13 + TS6:默认导出在类型上会被解析为不可调用的 export= 形态 */
const axios = axiosModule as any;
const encryptHeader = 'encrypt-key'; const encryptHeader = 'encrypt-key';
let downloadLoadingInstance: LoadingInstance | undefined; let downloadLoadingInstance: LoadingInstance | undefined;
@@ -95,7 +98,7 @@ const service = axios.create({
// 请求拦截器 // 请求拦截器
service.interceptors.request.use( service.interceptors.request.use(
(config: InternalAxiosRequestConfig) => { (config: any) => {
// 对应国际化资源文件后缀 // 对应国际化资源文件后缀
config.headers['Content-Language'] = getLanguage(); config.headers['Content-Language'] = getLanguage();
@@ -164,7 +167,7 @@ service.interceptors.request.use(
// 响应拦截器 // 响应拦截器
service.interceptors.response.use( service.interceptors.response.use(
(res: AxiosResponse) => { (res: any) => {
if (import.meta.env.VITE_APP_ENCRYPT === 'true') { if (import.meta.env.VITE_APP_ENCRYPT === 'true') {
// 加密后的 AES 秘钥 // 加密后的 AES 秘钥
const keyStr = res.headers[encryptHeader]; const keyStr = res.headers[encryptHeader];
@@ -193,21 +196,31 @@ service.interceptors.response.use(
// prettier-ignore // prettier-ignore
if (!isRelogin.show) { if (!isRelogin.show) {
isRelogin.show = true; isRelogin.show = true;
ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { ElMessageBox.confirm(
confirmButtonText: '重新登录', "登录状态已过期,您可以继续留在该页面,或者重新登录",
cancelButtonText: '取消', "系统提示",
type: 'warning' {
}).then(() => { confirmButtonText: "重新登录",
cancelButtonText: "取消",
type: "warning",
},
)
.then(() => {
isRelogin.show = false; isRelogin.show = false;
useUserStore().logout().then(() => { useUserStore()
.logout()
.then(() => {
router.replace({ router.replace({
path: '/login', path: "/login",
query: { query: {
redirect: encodeURIComponent(router.currentRoute.value.fullPath || '/') redirect: encodeURIComponent(
} router.currentRoute.value.fullPath || "/",
}) ),
},
}); });
}).catch(() => { });
})
.catch(() => {
isRelogin.show = false; isRelogin.show = false;
}); });
} }
@@ -238,15 +251,17 @@ export function download(url: string, params: any, fileName: string) {
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}); });
// prettier-ignore // prettier-ignore
return service.post(url, params, { return service
.post(url, params, {
transformRequest: [ transformRequest: [
(params: any) => { (params: any) => {
return tansParams(params); return tansParams(params);
} },
], ],
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, headers: { "Content-Type": "application/x-www-form-urlencoded" },
responseType: 'blob' responseType: "blob",
}).then(async (resp: any) => { })
.then(async (resp: any) => {
const isLogin = blobValidate(resp); const isLogin = blobValidate(resp);
if (isLogin) { if (isLogin) {
const blob = new Blob([resp]); const blob = new Blob([resp]);
@@ -255,11 +270,13 @@ export function download(url: string, params: any, fileName: string) {
const blob = new Blob([resp]); const blob = new Blob([resp]);
const resText = await blob.text(); const resText = await blob.text();
const rspObj = JSON.parse(resText); const rspObj = JSON.parse(resText);
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']; const errMsg =
errorCode[rspObj.code] || rspObj.msg || errorCode["default"];
ElMessage.error(errMsg); ElMessage.error(errMsg);
} }
downloadLoadingInstance?.close(); downloadLoadingInstance?.close();
}).catch((r: any) => { })
.catch((r: any) => {
console.error(r); console.error(r);
downloadLoadingInstance?.close(); downloadLoadingInstance?.close();
}); });
+4 -7
View File
@@ -8,16 +8,13 @@ const easeInOutQuad = (t: number, b: number, c: number, d: number) => {
}; };
// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts // requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
const requestAnimFrame = (function () { const requestAnimFrame = (() =>
return (
window.requestAnimationFrame || window.requestAnimationFrame ||
(window as any).webkitRequestAnimationFrame || (window as any).webkitRequestAnimationFrame ||
(window as any).mozRequestAnimationFrame || (window as any).mozRequestAnimationFrame ||
function (callback) { (callback => {
window.setTimeout(callback, 1000 / 60); window.setTimeout(callback, 1000 / 60);
} }))();
);
})();
/** /**
* Because it's so fucking difficult to detect the scrolling element, just move them all * Because it's so fucking difficult to detect the scrolling element, just move them all
@@ -46,7 +43,7 @@ export const scrollTo = (to: number, duration: number, callback?: any) => {
const increment = 20; const increment = 20;
let currentTime = 0; let currentTime = 0;
duration = typeof duration === 'undefined' ? 500 : duration; duration = typeof duration === 'undefined' ? 500 : duration;
const animateScroll = function () { const animateScroll = () => {
// increment the time // increment the time
currentTime += increment; currentTime += increment;
// find the value with the quadratic in-out easing function // find the value with the quadratic in-out easing function
+6 -8
View File
@@ -138,8 +138,8 @@
<script setup name="Demo" lang="ts"> <script setup name="Demo" lang="ts">
import { listDemo, getDemo, delDemo, addDemo, updateDemo } from '@/api/demo/demo'; import { listDemo, getDemo, delDemo, addDemo, updateDemo } from '@/api/demo/demo';
import { DemoVO, DemoQuery, DemoForm } from '@/api/demo/demo/types'; import { DemoVO, DemoQuery, DemoForm } from '@/api/demo/demo/types';
import modal from '@/plugins/modal';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; import { download as requestDownload } from '@/utils/request';
const demoList = ref<DemoVO[]>([]); const demoList = ref<DemoVO[]>([]);
const buttonLoading = ref(false); const buttonLoading = ref(false);
@@ -256,7 +256,7 @@ const submitForm = () => {
} else { } else {
await addDemo(form.value).finally(() => (buttonLoading.value = false)); await addDemo(form.value).finally(() => (buttonLoading.value = false));
} }
proxy?.$modal.msgSuccess('修改成功'); modal.msgSuccess('修改成功');
dialog.visible = false; dialog.visible = false;
await getList(); await getList();
} }
@@ -266,17 +266,15 @@ const submitForm = () => {
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (row?: DemoVO) => { const handleDelete = async (row?: DemoVO) => {
const _ids = row?.id || ids.value; const _ids = row?.id || ids.value;
await proxy?.$modal await modal.confirm('是否确认删除测试单编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
.confirm('是否确认删除测试单编号为"' + _ids + '"的数据项?')
.finally(() => (loading.value = false));
await delDemo(_ids); await delDemo(_ids);
proxy?.$modal.msgSuccess('删除成功'); modal.msgSuccess('删除成功');
await getList(); await getList();
}; };
/** 导出按钮操作 */ /** 导出按钮操作 */
const handleExport = () => { const handleExport = () => {
proxy?.download( requestDownload(
'demo/demo/export', 'demo/demo/export',
{ {
...queryParams.value ...queryParams.value
+7 -7
View File
@@ -116,6 +116,8 @@
<script setup name="Tree" lang="ts"> <script setup name="Tree" lang="ts">
import { listTree, getTree, delTree, addTree, updateTree } from '@/api/demo/tree'; import { listTree, getTree, delTree, addTree, updateTree } from '@/api/demo/tree';
import { TreeVO, TreeQuery, TreeForm } from '@/api/demo/tree/types'; import { TreeVO, TreeQuery, TreeForm } from '@/api/demo/tree/types';
import modal from '@/plugins/modal';
import { handleTree } from '@/utils/ruoyi';
type TreeOption = { type TreeOption = {
id: number; id: number;
@@ -123,8 +125,6 @@ type TreeOption = {
children?: TreeOption[]; children?: TreeOption[];
}; };
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const treeList = ref<TreeVO[]>([]); const treeList = ref<TreeVO[]>([]);
const treeOptions = ref<TreeOption[]>([]); const treeOptions = ref<TreeOption[]>([]);
const buttonLoading = ref(false); const buttonLoading = ref(false);
@@ -172,7 +172,7 @@ const { queryParams, form, rules } = toRefs(data);
const getList = async () => { const getList = async () => {
loading.value = true; loading.value = true;
const res = await listTree(queryParams.value); const res = await listTree(queryParams.value);
const data = proxy?.handleTree<TreeVO>(res.data, 'id', 'parentId'); const data = handleTree<TreeVO>(res.data, 'id', 'parentId');
if (data) { if (data) {
treeList.value = data; treeList.value = data;
loading.value = false; loading.value = false;
@@ -184,7 +184,7 @@ const getTreeselect = async () => {
const res = await listTree(); const res = await listTree();
treeOptions.value = []; treeOptions.value = [];
const data: TreeOption = { id: 0, treeName: '顶级节点', children: [] }; const data: TreeOption = { id: 0, treeName: '顶级节点', children: [] };
data.children = proxy?.handleTree<TreeOption>(res.data, 'id', 'parentId'); data.children = handleTree<TreeOption>(res.data, 'id', 'parentId');
treeOptions.value.push(data); treeOptions.value.push(data);
}; };
@@ -261,7 +261,7 @@ const submitForm = () => {
} else { } else {
await addTree(form.value).finally(() => (buttonLoading.value = false)); await addTree(form.value).finally(() => (buttonLoading.value = false));
} }
proxy?.$modal.msgSuccess('操作成功'); modal.msgSuccess('操作成功');
dialog.visible = false; dialog.visible = false;
await getList(); await getList();
} }
@@ -270,11 +270,11 @@ const submitForm = () => {
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (row: TreeVO) => { const handleDelete = async (row: TreeVO) => {
await proxy?.$modal.confirm('是否确认删除测试树编号为"' + row.id + '"的数据项?'); await modal.confirm('是否确认删除测试树编号为"' + row.id + '"的数据项?');
loading.value = true; loading.value = true;
await delTree(row.id).finally(() => (loading.value = false)); await delTree(row.id).finally(() => (loading.value = false));
await getList(); await getList();
proxy?.$modal.msgSuccess('删除成功'); modal.msgSuccess('删除成功');
}; };
onMounted(() => { onMounted(() => {
+6 -4
View File
@@ -20,17 +20,19 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useRoute, useRouter } from 'vue-router';
import errImage from '@/assets/401_images/401.gif'; import errImage from '@/assets/401_images/401.gif';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const route = useRoute();
const router = useRouter();
const errGif = ref(errImage + '?' + +new Date()); const errGif = ref(errImage + '?' + +new Date());
function back() { function back() {
if (proxy?.$route.query.noGoBack) { if (route.query.noGoBack) {
proxy.$router.push({ path: '/' }); router.push({ path: '/' });
} else { } else {
proxy?.$router.go(-1); router.go(-1);
} }
} }
</script> </script>
+2 -6
View File
@@ -129,9 +129,7 @@ const goTarget = (url: string) => {
grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr); grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
gap: 18px; gap: 18px;
padding: 30px; padding: 30px;
background: background: radial-gradient(circle at top left, rgba(53, 109, 255, 0.16), transparent 30%), var(--app-surface-bg);
radial-gradient(circle at top left, rgba(53, 109, 255, 0.16), transparent 30%),
var(--app-surface-bg);
} }
.hero-copy { .hero-copy {
@@ -366,9 +364,7 @@ const goTarget = (url: string) => {
:global(html.dark) { :global(html.dark) {
.hero-panel { .hero-panel {
background: background: radial-gradient(circle at top left, rgba(53, 109, 255, 0.18), transparent 30%), var(--app-surface-bg);
radial-gradient(circle at top left, rgba(53, 109, 255, 0.18), transparent 30%),
var(--app-surface-bg);
} }
} }
</style> </style>
+36 -21
View File
@@ -36,7 +36,7 @@
type="text" type="text"
size="large" size="large"
auto-complete="off" auto-complete="off"
:placeholder="proxy.$t('login.username')" :placeholder="$t('login.username')"
> >
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template> <template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
</el-input> </el-input>
@@ -48,7 +48,7 @@
type="password" type="password"
size="large" size="large"
auto-complete="off" auto-complete="off"
:placeholder="proxy.$t('login.password')" :placeholder="$t('login.password')"
@keyup.enter="handleLogin" @keyup.enter="handleLogin"
> >
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template> <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
@@ -60,7 +60,7 @@
v-model="loginForm.code" v-model="loginForm.code"
size="large" size="large"
auto-complete="off" auto-complete="off"
:placeholder="proxy.$t('login.code')" :placeholder="$t('login.code')"
@keyup.enter="handleLogin" @keyup.enter="handleLogin"
> >
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template> <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
@@ -71,28 +71,28 @@
</el-form-item> </el-form-item>
<div class="form-meta"> <div class="form-meta">
<el-checkbox v-model="loginForm.rememberMe">{{ proxy.$t('login.rememberPassword') }}</el-checkbox> <el-checkbox v-model="loginForm.rememberMe">{{ $t('login.rememberPassword') }}</el-checkbox>
<router-link v-if="register" class="link-type" :to="'/register'"> <router-link v-if="register" class="link-type" :to="'/register'">
{{ proxy.$t('login.switchRegisterPage') }} {{ $t('login.switchRegisterPage') }}
</router-link> </router-link>
</div> </div>
<div class="social-panel"> <div class="social-panel">
<span class="social-label">第三方登录</span> <span class="social-label">第三方登录</span>
<div class="social-actions"> <div class="social-actions">
<el-button circle :title="proxy.$t('login.social.wechat')" @click="doSocialLogin('wechat')"> <el-button circle :title="$t('login.social.wechat')" @click="doSocialLogin('wechat')">
<svg-icon icon-class="wechat" /> <svg-icon icon-class="wechat" />
</el-button> </el-button>
<el-button circle :title="proxy.$t('login.social.maxkey')" @click="doSocialLogin('maxkey')"> <el-button circle :title="$t('login.social.maxkey')" @click="doSocialLogin('maxkey')">
<svg-icon icon-class="maxkey" /> <svg-icon icon-class="maxkey" />
</el-button> </el-button>
<el-button circle :title="proxy.$t('login.social.topiam')" @click="doSocialLogin('topiam')"> <el-button circle :title="$t('login.social.topiam')" @click="doSocialLogin('topiam')">
<svg-icon icon-class="topiam" /> <svg-icon icon-class="topiam" />
</el-button> </el-button>
<el-button circle :title="proxy.$t('login.social.gitee')" @click="doSocialLogin('gitee')"> <el-button circle :title="$t('login.social.gitee')" @click="doSocialLogin('gitee')">
<svg-icon icon-class="gitee" /> <svg-icon icon-class="gitee" />
</el-button> </el-button>
<el-button circle :title="proxy.$t('login.social.github')" @click="doSocialLogin('github')"> <el-button circle :title="$t('login.social.github')" @click="doSocialLogin('github')">
<svg-icon icon-class="github" /> <svg-icon icon-class="github" />
</el-button> </el-button>
</div> </div>
@@ -100,8 +100,8 @@
<el-form-item class="submit-row"> <el-form-item class="submit-row">
<el-button :loading="loading" size="large" type="primary" class="submit-button" @click.prevent="handleLogin"> <el-button :loading="loading" size="large" type="primary" class="submit-button" @click.prevent="handleLogin">
<span v-if="!loading">{{ proxy.$t('login.login') }}</span> <span v-if="!loading">{{ $t('login.login') }}</span>
<span v-else>{{ proxy.$t('login.logging') }}</span> <span v-else>{{ $t('login.logging') }}</span>
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -114,15 +114,13 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { to } from 'await-to-js';
import { useI18n } from 'vue-i18n';
import { getCodeImg } from '@/api/login'; import { getCodeImg } from '@/api/login';
import { authRouterUrl } from '@/api/system/social/auth'; import { authRouterUrl } from '@/api/system/social/auth';
import { useUserStore } from '@/store/modules/user';
import { LoginData } from '@/api/types'; import { LoginData } from '@/api/types';
import { to } from 'await-to-js';
import { HttpStatus } from '@/enums/RespEnum'; import { HttpStatus } from '@/enums/RespEnum';
import { useI18n } from 'vue-i18n'; import { useUserStore } from '@/store/modules/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const title = import.meta.env.VITE_APP_TITLE; const title = import.meta.env.VITE_APP_TITLE;
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
@@ -145,9 +143,27 @@ const loginForm = ref<LoginData>({
} as LoginData); } as LoginData);
const loginRules: ElFormRules = { const loginRules: ElFormRules = {
username: [{ required: true, trigger: 'blur', message: t('login.rule.username.required') }], username: [
password: [{ required: true, trigger: 'blur', message: t('login.rule.password.required') }], {
code: [{ required: true, trigger: 'change', message: t('login.rule.code.required') }] required: true,
trigger: 'blur',
message: t('login.rule.username.required')
}
],
password: [
{
required: true,
trigger: 'blur',
message: t('login.rule.password.required')
}
],
code: [
{
required: true,
trigger: 'change',
message: t('login.rule.code.required')
}
]
}; };
const codeUrl = ref(''); const codeUrl = ref('');
@@ -561,5 +577,4 @@ onMounted(() => {
grid-template-columns: 1fr; grid-template-columns: 1fr;
} }
} }
</style> </style>

Some files were not shown because too many files have changed in this diff Show More