create-jnrs-template-vue 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jnrs-template-vue/.env.development +1 -1
- package/jnrs-template-vue/index.html +1 -1
- package/jnrs-template-vue/package.json +3 -4
- package/jnrs-template-vue/public/system/menu.json +11 -2
- package/jnrs-template-vue/src/App.vue +1 -3
- package/jnrs-template-vue/src/api/common/index.ts +2 -2
- package/jnrs-template-vue/src/api/demos/index.ts +85 -43
- package/jnrs-template-vue/src/api/system/index.ts +20 -10
- package/jnrs-template-vue/src/api/user/index.ts +2 -2
- package/jnrs-template-vue/src/assets/styles/index.scss +0 -24
- package/jnrs-template-vue/src/assets/styles/init.scss +24 -0
- package/jnrs-template-vue/src/assets/styles/root.scss +4 -0
- package/jnrs-template-vue/src/components/common/CardTable.vue +89 -0
- package/jnrs-template-vue/src/components/common/DictTag.vue +8 -4
- package/jnrs-template-vue/src/components/common/ImageView.vue +16 -7
- package/jnrs-template-vue/src/components/common/PdfView.vue +14 -5
- package/jnrs-template-vue/src/components/select/SelectManager.vue +2 -2
- package/jnrs-template-vue/src/layout/SideMenu.vue +0 -1
- package/jnrs-template-vue/src/layout/TopHeader.vue +7 -14
- package/jnrs-template-vue/src/locales/index.ts +1 -1
- package/jnrs-template-vue/src/types/webSocket.ts +19 -0
- package/jnrs-template-vue/src/utils/file.ts +36 -1
- package/jnrs-template-vue/src/views/demos/crud/index.vue +57 -32
- package/jnrs-template-vue/src/views/demos/simpleTable/index.vue +41 -0
- package/jnrs-template-vue/src/views/demos/unitTest/RequestPage.vue +2 -2
- package/jnrs-template-vue/src/views/demos/unitTest/index.vue +26 -2
- package/jnrs-template-vue/src/views/login/index.vue +18 -15
- package/jnrs-template-vue/src/views/system/dict/index.vue +63 -76
- package/jnrs-template-vue/src/views/system/menu/index.vue +42 -54
- package/jnrs-template-vue/src/views/system/mine/baseInfo.vue +26 -59
- package/jnrs-template-vue/src/views/system/role/index.vue +20 -29
- package/jnrs-template-vue/src/views/visual/index.vue +130 -15
- package/jnrs-template-vue/vite.config.ts +0 -1
- package/jnrs-template-vue/viteMockServe/fail.ts +12 -0
- package/package.json +1 -1
- package/jnrs-template-vue/src/composables/base/useAvatar.ts +0 -36
- package/jnrs-template-vue/src/composables/tools/useMouseSelection.ts +0 -150
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jnrs-template-vue",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "JNRS 信息化管理系统模板",
|
|
5
5
|
"author": "Talia-Tan",
|
|
6
6
|
"private": true,
|
|
@@ -19,9 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@element-plus/icons-vue": "^2.3.2",
|
|
22
|
-
"@jnrs/
|
|
23
|
-
"@jnrs/
|
|
24
|
-
"@jnrs/vue-core": "1.2.2",
|
|
22
|
+
"@jnrs/shared": "1.1.9",
|
|
23
|
+
"@jnrs/vue-core": "1.2.4",
|
|
25
24
|
"@vueuse/core": "^14.1.0",
|
|
26
25
|
"element-plus": "^2.11.9",
|
|
27
26
|
"pinia": "^3.0.4",
|
|
@@ -15,16 +15,25 @@
|
|
|
15
15
|
"path": "/unitTest",
|
|
16
16
|
"name": "UnitTest",
|
|
17
17
|
"meta": {
|
|
18
|
-
"title": "
|
|
18
|
+
"title": "基础功能测试",
|
|
19
19
|
"todoCount": 8
|
|
20
20
|
},
|
|
21
21
|
"component": "/demos/unitTest/index"
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
"path": "/simpleTable",
|
|
25
|
+
"name": "SimpleTable",
|
|
26
|
+
"meta": {
|
|
27
|
+
"title": "简单数据表格模板",
|
|
28
|
+
"todoCount": 0
|
|
29
|
+
},
|
|
30
|
+
"component": "/demos/simpleTable/index"
|
|
31
|
+
},
|
|
23
32
|
{
|
|
24
33
|
"path": "/crud",
|
|
25
34
|
"name": "Crud",
|
|
26
35
|
"meta": {
|
|
27
|
-
"title": "
|
|
36
|
+
"title": "完整增删改查模板",
|
|
28
37
|
"todoCount": 0
|
|
29
38
|
},
|
|
30
39
|
"component": "/demos/crud/index"
|
|
@@ -6,7 +6,6 @@ import zhCn from 'element-plus/es/locale/lang/zh-CN'
|
|
|
6
6
|
import en from 'element-plus/es/locale/lang/en'
|
|
7
7
|
import { useI18n } from 'vue-i18n'
|
|
8
8
|
import { changeLocales as changeLocalesForShared } from '@jnrs/shared/locales'
|
|
9
|
-
import { changeLocales as changeLocalesForCore } from '@jnrs/core/locales'
|
|
10
9
|
|
|
11
10
|
const { locale } = useI18n()
|
|
12
11
|
|
|
@@ -16,7 +15,6 @@ watch(
|
|
|
16
15
|
(newValue) => {
|
|
17
16
|
locale.value = newValue
|
|
18
17
|
changeLocalesForShared(newValue)
|
|
19
|
-
changeLocalesForCore(newValue)
|
|
20
18
|
},
|
|
21
19
|
{
|
|
22
20
|
immediate: true
|
|
@@ -30,7 +28,7 @@ const localeMap = {
|
|
|
30
28
|
|
|
31
29
|
onMounted(() => {
|
|
32
30
|
console.log(
|
|
33
|
-
'%
|
|
31
|
+
'%cPOWERED BY 🅹🅽🆁🆂 TECH',
|
|
34
32
|
`background: #f2f2c1;
|
|
35
33
|
color: #d15f2c;
|
|
36
34
|
font-weight: bold;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { axiosRequest } from '@jnrs/vue-core/request'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* axios 方式下载文件
|
|
@@ -6,7 +6,7 @@ import { request } from '@jnrs/vue-core'
|
|
|
6
6
|
* @returns Blob
|
|
7
7
|
*/
|
|
8
8
|
export const FileApi = (uniqueFileName: string): Promise<Blob> => {
|
|
9
|
-
return
|
|
9
|
+
return axiosRequest({
|
|
10
10
|
url: '/api/files/' + uniqueFileName,
|
|
11
11
|
method: 'get',
|
|
12
12
|
responseType: 'blob',
|
|
@@ -1,40 +1,10 @@
|
|
|
1
1
|
import type { Pagination, PageTableData, FileContainer } from '@/types'
|
|
2
|
-
import {
|
|
2
|
+
import { axiosRequest } from '@jnrs/vue-core/request'
|
|
3
|
+
import { extractFieldId } from '@/utils/file'
|
|
4
|
+
import { objectToFormData } from '@/utils/packages'
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export const NotFoundApi = () => {
|
|
8
|
-
return request({
|
|
9
|
-
url: '/notFound',
|
|
10
|
-
method: 'get'
|
|
11
|
-
})
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 无权限
|
|
16
|
-
* @param showErrorMsg 是否显示错误信息
|
|
17
|
-
*/
|
|
18
|
-
export const NoAuth = (showErrorMsg: boolean) => {
|
|
19
|
-
return request({
|
|
20
|
-
url: '/auth/no',
|
|
21
|
-
method: 'post',
|
|
22
|
-
showErrorMsg
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 数据详情
|
|
28
|
-
*/
|
|
29
|
-
export const DetailsApi = (): Promise<FileContainer> => {
|
|
30
|
-
return request({
|
|
31
|
-
url: '/details',
|
|
32
|
-
method: 'get'
|
|
33
|
-
})
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* 项目项
|
|
7
|
+
* 项目
|
|
38
8
|
*/
|
|
39
9
|
export interface ProjectItem extends FileContainer {
|
|
40
10
|
id: string
|
|
@@ -53,11 +23,12 @@ export interface ProjectItem extends FileContainer {
|
|
|
53
23
|
}
|
|
54
24
|
|
|
55
25
|
/**
|
|
56
|
-
*
|
|
26
|
+
* 新增
|
|
57
27
|
*/
|
|
58
28
|
type AddProjectOmitKeys =
|
|
59
29
|
| 'id'
|
|
60
30
|
| 'programCode'
|
|
31
|
+
| 'program'
|
|
61
32
|
| 'code'
|
|
62
33
|
| 'manager'
|
|
63
34
|
| 'plannedFinishDate'
|
|
@@ -68,11 +39,14 @@ type AddProjectOmitKeys =
|
|
|
68
39
|
|
|
69
40
|
export type AddProjectItem = Omit<ProjectItem, AddProjectOmitKeys> & {
|
|
70
41
|
id?: string
|
|
71
|
-
managerId?: Record<string, unknown>
|
|
42
|
+
managerId?: Record<string, unknown> | unknown
|
|
72
43
|
newAttachmentFile: []
|
|
73
44
|
newImageFiles: []
|
|
74
45
|
}
|
|
75
46
|
|
|
47
|
+
/**
|
|
48
|
+
* 查询
|
|
49
|
+
*/
|
|
76
50
|
export interface ProjectQuery extends Pagination {
|
|
77
51
|
code?: string
|
|
78
52
|
projectType?: '敏捷型' | '瀑布型' | '混合型'
|
|
@@ -80,23 +54,91 @@ export interface ProjectQuery extends Pagination {
|
|
|
80
54
|
}
|
|
81
55
|
|
|
82
56
|
/**
|
|
83
|
-
*
|
|
57
|
+
* 测试 404 错误
|
|
58
|
+
*/
|
|
59
|
+
export const NotFoundApi = () => {
|
|
60
|
+
return axiosRequest({
|
|
61
|
+
url: '/mock/notFound',
|
|
62
|
+
method: 'get'
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 测试 无权限
|
|
68
|
+
* @param showErrorMsg 是否显示错误信息
|
|
69
|
+
*/
|
|
70
|
+
export const NoAuthApi = (showErrorMsg: boolean) => {
|
|
71
|
+
return axiosRequest({
|
|
72
|
+
url: '/mock/auth/no',
|
|
73
|
+
method: 'post',
|
|
74
|
+
showErrorMsg
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 数据详情
|
|
80
|
+
*/
|
|
81
|
+
export const DetailsApi = (): Promise<FileContainer> => {
|
|
82
|
+
return axiosRequest({
|
|
83
|
+
url: '/mock/details',
|
|
84
|
+
method: 'get'
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 表单新增(包含文件上传类需使用 formData 类型)
|
|
84
90
|
*/
|
|
85
|
-
export const
|
|
86
|
-
|
|
91
|
+
export const EditApi = (data: AddProjectItem) => {
|
|
92
|
+
const formData = objectToFormData({
|
|
93
|
+
...data,
|
|
94
|
+
managerId: extractFieldId(data.managerId, 'managerId')
|
|
95
|
+
})
|
|
96
|
+
return axiosRequest({
|
|
87
97
|
url: '/mock/demos/save',
|
|
88
98
|
method: 'post',
|
|
89
|
-
data
|
|
99
|
+
data: formData
|
|
90
100
|
})
|
|
91
101
|
}
|
|
92
102
|
|
|
93
103
|
/**
|
|
94
104
|
* 数据详情
|
|
95
105
|
*/
|
|
96
|
-
export const
|
|
97
|
-
return
|
|
106
|
+
export const TableApi = (data?: ProjectQuery): Promise<PageTableData<ProjectItem>> => {
|
|
107
|
+
return axiosRequest({
|
|
98
108
|
url: '/mock/demos/table',
|
|
99
109
|
method: 'get',
|
|
100
|
-
data
|
|
110
|
+
data
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 下载数据导入模板
|
|
116
|
+
*/
|
|
117
|
+
export const ImportTemplateApi = (): Promise<Blob> => {
|
|
118
|
+
return axiosRequest({
|
|
119
|
+
url: '/mock/project/template',
|
|
120
|
+
method: 'post'
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 项目数据导入
|
|
126
|
+
*/
|
|
127
|
+
export const ImportDataApi = (data: { file: File }) => {
|
|
128
|
+
return axiosRequest({
|
|
129
|
+
url: '/mock/project/import',
|
|
130
|
+
method: 'post',
|
|
131
|
+
data
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 项目数据导出
|
|
137
|
+
*/
|
|
138
|
+
export const ExportApi = (data: Record<string, unknown>): Promise<Blob> => {
|
|
139
|
+
return axiosRequest({
|
|
140
|
+
url: '/mock/project/export',
|
|
141
|
+
method: 'post',
|
|
142
|
+
data
|
|
101
143
|
})
|
|
102
144
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { request } from '@jnrs/vue-core'
|
|
2
1
|
import type { Dict, DictItem, User, Role } from '@jnrs/shared'
|
|
3
2
|
import type { MenuItem } from '@jnrs/vue-core'
|
|
3
|
+
import { axiosRequest } from '@jnrs/vue-core/request'
|
|
4
|
+
import { objectToFormData } from '@/utils/packages'
|
|
4
5
|
|
|
5
6
|
// 菜单
|
|
6
7
|
export const MenuApi = (): Promise<MenuItem[]> => {
|
|
7
|
-
return
|
|
8
|
+
return axiosRequest({
|
|
8
9
|
url: '/system/menu.json', // /public 文件夹下
|
|
9
10
|
mockUrl: '/mock/menu',
|
|
10
11
|
method: 'get'
|
|
@@ -23,7 +24,7 @@ export interface LoginResult extends User {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export const LoginApi = (data: LoginParams): Promise<LoginResult> => {
|
|
26
|
-
return
|
|
27
|
+
return axiosRequest({
|
|
27
28
|
url: '/api/auth/login',
|
|
28
29
|
method: 'post',
|
|
29
30
|
data,
|
|
@@ -33,7 +34,7 @@ export const LoginApi = (data: LoginParams): Promise<LoginResult> => {
|
|
|
33
34
|
|
|
34
35
|
// 退出登录
|
|
35
36
|
export const LogoutApi = () => {
|
|
36
|
-
return
|
|
37
|
+
return axiosRequest({
|
|
37
38
|
url: '/api/auth/logout',
|
|
38
39
|
method: 'get'
|
|
39
40
|
})
|
|
@@ -41,12 +42,21 @@ export const LogoutApi = () => {
|
|
|
41
42
|
|
|
42
43
|
// 获取用户信息
|
|
43
44
|
export const UserInfoApi = (): Promise<User> => {
|
|
44
|
-
return
|
|
45
|
+
return axiosRequest({
|
|
45
46
|
url: '/api/auth/user-info',
|
|
46
47
|
method: 'get'
|
|
47
48
|
})
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
// 修改头像
|
|
52
|
+
export const AvatarChangeApi = (data: File) => {
|
|
53
|
+
return axiosRequest({
|
|
54
|
+
url: '/api/user/avatar',
|
|
55
|
+
method: 'post',
|
|
56
|
+
data: objectToFormData({ file: data })
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
50
60
|
// 修改密码
|
|
51
61
|
interface PasswordChange {
|
|
52
62
|
userId: number
|
|
@@ -54,7 +64,7 @@ interface PasswordChange {
|
|
|
54
64
|
}
|
|
55
65
|
|
|
56
66
|
export const PasswordChangeApi = (data: PasswordChange) => {
|
|
57
|
-
return
|
|
67
|
+
return axiosRequest({
|
|
58
68
|
url: '/api/auth/change-password',
|
|
59
69
|
method: 'post',
|
|
60
70
|
data
|
|
@@ -63,7 +73,7 @@ export const PasswordChangeApi = (data: PasswordChange) => {
|
|
|
63
73
|
|
|
64
74
|
// 获取字典列表
|
|
65
75
|
export const DictApi = (): Promise<DictItem[]> => {
|
|
66
|
-
return
|
|
76
|
+
return axiosRequest({
|
|
67
77
|
url: '/api/dict-manager',
|
|
68
78
|
method: 'get'
|
|
69
79
|
})
|
|
@@ -71,7 +81,7 @@ export const DictApi = (): Promise<DictItem[]> => {
|
|
|
71
81
|
|
|
72
82
|
// 获取单个字典
|
|
73
83
|
export const DictDetailApi = (id: string) => {
|
|
74
|
-
return
|
|
84
|
+
return axiosRequest({
|
|
75
85
|
url: `/api/dict-manager/detail/${id}`,
|
|
76
86
|
method: 'get'
|
|
77
87
|
})
|
|
@@ -79,7 +89,7 @@ export const DictDetailApi = (id: string) => {
|
|
|
79
89
|
|
|
80
90
|
// 修改单个字典
|
|
81
91
|
export const DictChangeApi = (data: DictItem) => {
|
|
82
|
-
return
|
|
92
|
+
return axiosRequest({
|
|
83
93
|
url: '/api/dict-manager/detail',
|
|
84
94
|
method: 'post',
|
|
85
95
|
data
|
|
@@ -88,7 +98,7 @@ export const DictChangeApi = (data: DictItem) => {
|
|
|
88
98
|
|
|
89
99
|
// 获取角色列表
|
|
90
100
|
export const RoleApi = (): Promise<Role[]> => {
|
|
91
|
-
return
|
|
101
|
+
return axiosRequest({
|
|
92
102
|
url: '/api/role-manager',
|
|
93
103
|
method: 'get',
|
|
94
104
|
noAuth: true
|
|
@@ -3,27 +3,3 @@
|
|
|
3
3
|
@use './root.scss';
|
|
4
4
|
@use './common.scss';
|
|
5
5
|
@use './animation.scss';
|
|
6
|
-
|
|
7
|
-
body {
|
|
8
|
-
width: 100vw;
|
|
9
|
-
height: 100vh;
|
|
10
|
-
color: var(--jnrs-font-primary);
|
|
11
|
-
background: var(--jnrs-background-primary);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
#app {
|
|
15
|
-
min-width: 1280px;
|
|
16
|
-
height: 100%;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/*
|
|
20
|
-
* 禁止用户选中页面元素
|
|
21
|
-
*/
|
|
22
|
-
.no-select {
|
|
23
|
-
-khtml-user-drag: none;
|
|
24
|
-
-webkit-user-drag: none;
|
|
25
|
-
-webkit-user-select: none;
|
|
26
|
-
-moz-user-select: none;
|
|
27
|
-
-ms-user-select: none;
|
|
28
|
-
user-select: none;
|
|
29
|
-
}
|
|
@@ -27,3 +27,27 @@ img {
|
|
|
27
27
|
object-fit: cover;
|
|
28
28
|
object-position: center center;
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
body {
|
|
32
|
+
width: 100vw;
|
|
33
|
+
height: 100vh;
|
|
34
|
+
color: var(--jnrs-font-primary);
|
|
35
|
+
background: var(--jnrs-background-primary);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#app {
|
|
39
|
+
min-width: 1280px;
|
|
40
|
+
height: 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* 禁止用户选中页面元素
|
|
45
|
+
*/
|
|
46
|
+
.no-select {
|
|
47
|
+
-khtml-user-drag: none;
|
|
48
|
+
-webkit-user-drag: none;
|
|
49
|
+
-webkit-user-select: none;
|
|
50
|
+
-moz-user-select: none;
|
|
51
|
+
-ms-user-select: none;
|
|
52
|
+
user-select: none;
|
|
53
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@Author : TanRui
|
|
3
|
+
@WeChat : Tan578853789
|
|
4
|
+
@File : CardTable.vue
|
|
5
|
+
@Date : 2026/01/06
|
|
6
|
+
@Desc. : 卡片数据表格组件
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import type { PageTableData, Pagination } from '@/types'
|
|
11
|
+
import { ref, onActivated } from 'vue'
|
|
12
|
+
import { JnPagination, JnTable } from '@jnrs/vue-core/components'
|
|
13
|
+
import { debounce } from '@jnrs/shared/lodash'
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
/**
|
|
17
|
+
* 获取数据表格 api 函数
|
|
18
|
+
*/
|
|
19
|
+
getTableDataApi?: (...args: any[]) => Promise<PageTableData<any>>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const { getTableDataApi } = defineProps<Props>()
|
|
23
|
+
|
|
24
|
+
const loading = ref(false)
|
|
25
|
+
const tableData = ref()
|
|
26
|
+
const total = ref(0)
|
|
27
|
+
const pagination = ref<Pagination>({ pageNo: 1, pageSize: 10 })
|
|
28
|
+
|
|
29
|
+
const getTable = debounce(async () => {
|
|
30
|
+
if (!getTableDataApi) {
|
|
31
|
+
return false
|
|
32
|
+
}
|
|
33
|
+
loading.value = true
|
|
34
|
+
try {
|
|
35
|
+
const res = await getTableDataApi({
|
|
36
|
+
...pagination.value
|
|
37
|
+
})
|
|
38
|
+
tableData.value = res.list.map((item) => ({
|
|
39
|
+
...item,
|
|
40
|
+
newImageFiles: item.imageDocument?.attachments ?? undefined,
|
|
41
|
+
newAttachmentFile: item.attachmentDocument?.attachments ?? undefined
|
|
42
|
+
}))
|
|
43
|
+
console.log(456)
|
|
44
|
+
total.value = res.count
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error(error)
|
|
47
|
+
} finally {
|
|
48
|
+
loading.value = false
|
|
49
|
+
}
|
|
50
|
+
}, 300)
|
|
51
|
+
|
|
52
|
+
onActivated(() => {
|
|
53
|
+
console.log(123)
|
|
54
|
+
|
|
55
|
+
getTable()
|
|
56
|
+
})
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<el-card class="cardTable" v-loading="loading">
|
|
61
|
+
<template #header>
|
|
62
|
+
<div class="cardTable_header">
|
|
63
|
+
<slot name="header"></slot>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<JnTable
|
|
68
|
+
:data="tableData"
|
|
69
|
+
:pagination="pagination"
|
|
70
|
+
:autoHeight="true"
|
|
71
|
+
:showScrollbar="true"
|
|
72
|
+
:showIndexColumn="true"
|
|
73
|
+
>
|
|
74
|
+
<slot name="table"></slot>
|
|
75
|
+
</JnTable>
|
|
76
|
+
|
|
77
|
+
<JnPagination :total="total" v-model="pagination" @change="getTable" />
|
|
78
|
+
</el-card>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<style lang="scss" scoped>
|
|
82
|
+
.cardTable {
|
|
83
|
+
.cardTable_header {
|
|
84
|
+
display: flex;
|
|
85
|
+
justify-content: space-between;
|
|
86
|
+
align-items: center;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
</style>
|
|
@@ -58,13 +58,17 @@ const computedColor = computed(() => {
|
|
|
58
58
|
|
|
59
59
|
<style lang="scss" scoped>
|
|
60
60
|
.dictTag {
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
display: inline-flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
padding: 1px 8px;
|
|
65
|
+
border-radius: 4px;
|
|
63
66
|
white-space: nowrap;
|
|
67
|
+
transform: scale(0.8);
|
|
64
68
|
|
|
65
69
|
.dictTag_label_showColor {
|
|
66
|
-
font-size:
|
|
67
|
-
filter: invert(0.
|
|
70
|
+
font-size: 1.1em;
|
|
71
|
+
filter: invert(0.5) brightness(0.5);
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
</style>
|
|
@@ -13,9 +13,14 @@ interface Props {
|
|
|
13
13
|
* 要加载的文件列表 | 文件名唯一标识 uniqueFileName
|
|
14
14
|
*/
|
|
15
15
|
loadKeys: Attachment[] | string | undefined
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 是否清理文件副作用
|
|
19
|
+
*/
|
|
20
|
+
clearSideEffects: boolean
|
|
16
21
|
}
|
|
17
22
|
|
|
18
|
-
const { loadKeys } = defineProps<Props>()
|
|
23
|
+
const { loadKeys, clearSideEffects = false } = defineProps<Props>()
|
|
19
24
|
|
|
20
25
|
// 第一张显示的图片
|
|
21
26
|
const posterUrl = ref('')
|
|
@@ -28,10 +33,12 @@ const revokeFns = ref<(() => void)[]>([])
|
|
|
28
33
|
|
|
29
34
|
// 清理当前所有 Object URL
|
|
30
35
|
const clearUrls = () => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
if (clearSideEffects) {
|
|
37
|
+
revokeFns.value.forEach((revoke) => revoke())
|
|
38
|
+
revokeFns.value = []
|
|
39
|
+
fileList.value = []
|
|
40
|
+
posterUrl.value = ''
|
|
41
|
+
}
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
// 加载文件
|
|
@@ -105,7 +112,7 @@ const loadFilesRaw = async (keys: Props['loadKeys']) => {
|
|
|
105
112
|
}
|
|
106
113
|
}
|
|
107
114
|
|
|
108
|
-
const loadFiles = debounce(loadFilesRaw,
|
|
115
|
+
const loadFiles = debounce(loadFilesRaw, 500)
|
|
109
116
|
|
|
110
117
|
watch(
|
|
111
118
|
() => loadKeys,
|
|
@@ -116,7 +123,9 @@ watch(
|
|
|
116
123
|
)
|
|
117
124
|
|
|
118
125
|
onActivated(() => {
|
|
119
|
-
|
|
126
|
+
if (clearSideEffects) {
|
|
127
|
+
loadFiles(loadKeys)
|
|
128
|
+
}
|
|
120
129
|
})
|
|
121
130
|
|
|
122
131
|
// 副作用清理
|
|
@@ -12,9 +12,14 @@ interface Props {
|
|
|
12
12
|
* 要加载的文件列表 | 文件名唯一标识 uniqueFileName
|
|
13
13
|
*/
|
|
14
14
|
loadKeys: Attachment[] | string | undefined
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 是否清理文件副作用
|
|
18
|
+
*/
|
|
19
|
+
clearSideEffects: boolean
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
const { loadKeys } = defineProps<Props>()
|
|
22
|
+
const { loadKeys, clearSideEffects = false } = defineProps<Props>()
|
|
18
23
|
|
|
19
24
|
// 存储每个 URL 对应的 URL 对象
|
|
20
25
|
const fileList = ref<FileItem[]>([])
|
|
@@ -24,9 +29,11 @@ const revokeFns = ref<(() => void)[]>([])
|
|
|
24
29
|
|
|
25
30
|
// 清理当前所有 Object URL
|
|
26
31
|
const clearUrls = () => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
if (clearSideEffects) {
|
|
33
|
+
revokeFns.value.forEach((revoke) => revoke())
|
|
34
|
+
revokeFns.value = []
|
|
35
|
+
fileList.value = []
|
|
36
|
+
}
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
const loadFiles = async (keys: Props['loadKeys']) => {
|
|
@@ -87,7 +94,9 @@ watch(
|
|
|
87
94
|
)
|
|
88
95
|
|
|
89
96
|
onActivated(() => {
|
|
90
|
-
|
|
97
|
+
if (clearSideEffects) {
|
|
98
|
+
loadFiles(loadKeys)
|
|
99
|
+
}
|
|
91
100
|
})
|
|
92
101
|
|
|
93
102
|
// 副作用清理
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
<script setup lang="ts">
|
|
10
|
-
import {
|
|
10
|
+
import { TableApi } from '@/api/demos/index'
|
|
11
11
|
import { JnSelectTemplate } from '@jnrs/vue-core/components'
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<template>
|
|
15
|
-
<JnSelectTemplate tableName="项目经理" :keyValue="{ label: 'manager', value: 'managerId' }" :listApi="
|
|
15
|
+
<JnSelectTemplate tableName="项目经理" :keyValue="{ label: 'manager', value: 'managerId' }" :listApi="TableApi">
|
|
16
16
|
<template #table>
|
|
17
17
|
<el-table-column prop="manager" label="项目经理" align="center" sortable />
|
|
18
18
|
</template>
|