create-jnrs-vue 1.2.20 → 1.2.22

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.
Files changed (58) hide show
  1. package/jnrs-vue/.env.development +1 -1
  2. package/jnrs-vue/README.md +1 -1
  3. package/jnrs-vue/components.d.ts +3 -1
  4. package/jnrs-vue/package.json +3 -3
  5. package/jnrs-vue/src/App.vue +1 -1
  6. package/jnrs-vue/src/api/common/index.ts +2 -2
  7. package/jnrs-vue/src/api/demos/index.ts +81 -31
  8. package/jnrs-vue/src/api/request.ts +10 -11
  9. package/jnrs-vue/src/api/system/index.ts +30 -26
  10. package/jnrs-vue/src/assets/styles/animation.scss +15 -0
  11. package/jnrs-vue/src/components/common/CardTable.vue +4 -4
  12. package/jnrs-vue/src/components/common/DictTag.vue +9 -7
  13. package/jnrs-vue/src/components/common/ImageView.vue +5 -5
  14. package/jnrs-vue/src/components/common/PdfView.vue +5 -5
  15. package/jnrs-vue/src/components/select/SelectManager.vue +2 -2
  16. package/jnrs-vue/src/composables/useCrud.ts +150 -0
  17. package/jnrs-vue/src/layout/RouterTabs.vue +155 -7
  18. package/jnrs-vue/src/layout/SideMenu.vue +212 -139
  19. package/jnrs-vue/src/layout/SideMenuItem.vue +2 -2
  20. package/jnrs-vue/src/layout/TopHeader.vue +46 -23
  21. package/jnrs-vue/src/layout/index.vue +2 -1
  22. package/jnrs-vue/src/locales/en.ts +40 -1
  23. package/jnrs-vue/src/locales/index.ts +2 -2
  24. package/jnrs-vue/src/locales/zhCn.ts +40 -1
  25. package/jnrs-vue/src/main.ts +4 -9
  26. package/jnrs-vue/src/router/index.ts +5 -4
  27. package/jnrs-vue/src/router/routes.ts +1 -1
  28. package/jnrs-vue/src/stores/index.ts +8 -0
  29. package/jnrs-vue/src/stores/system/auth.ts +67 -0
  30. package/jnrs-vue/src/types/index.ts +2 -81
  31. package/jnrs-vue/src/types/system.d.ts +115 -0
  32. package/jnrs-vue/src/types/system.js +1 -0
  33. package/jnrs-vue/src/types/system.ts +124 -0
  34. package/jnrs-vue/src/types/webSocket.ts +4 -4
  35. package/jnrs-vue/src/utils/dict.ts +59 -0
  36. package/jnrs-vue/src/utils/file.ts +1 -1
  37. package/jnrs-vue/src/utils/index.ts +4 -0
  38. package/jnrs-vue/src/utils/packages.ts +6 -65
  39. package/jnrs-vue/src/utils/permissions.ts +1 -1
  40. package/jnrs-vue/src/views/demos/crud/index.vue +71 -21
  41. package/jnrs-vue/src/views/demos/simpleTable/index.vue +2 -2
  42. package/jnrs-vue/src/views/demos/unitTest/RequestPage.vue +30 -7
  43. package/jnrs-vue/src/views/demos/unitTest/index.vue +2 -2
  44. package/jnrs-vue/src/views/home/index.vue +312 -3
  45. package/jnrs-vue/src/views/login/index.vue +4 -4
  46. package/jnrs-vue/src/views/system/dict/index.vue +4 -4
  47. package/jnrs-vue/src/views/system/mine/baseInfo.vue +2 -2
  48. package/jnrs-vue/src/views/system/mine/securitySettings.vue +1 -1
  49. package/jnrs-vue/src/views/visual/index.vue +3 -4
  50. package/jnrs-vue/vite.config.ts +4 -3
  51. package/jnrs-vue/viteMockServe/fail.ts +6 -6
  52. package/jnrs-vue/viteMockServe/file.ts +5 -5
  53. package/jnrs-vue/viteMockServe/index.ts +7 -16
  54. package/jnrs-vue/viteMockServe/json/loginRes_user.json +1 -1
  55. package/jnrs-vue/viteMockServe/success.ts +13 -5
  56. package/package.json +1 -1
  57. package/jnrs-vue/src/api/user/index.ts +0 -12
  58. package/jnrs-vue/src/layout/RouterTabs /344/277/256/345/244/215/350/267/257/347/224/261/350/267/263/350/275/254/346/220/272/345/270/246/345/217/202/346/225/260/351/227/256/351/242/230.vue" +0 -150
@@ -5,7 +5,7 @@ VITE_USE_MOCK = true
5
5
 
6
6
  # 后端接口基地址 - 开发环境
7
7
  # VITE_BASE_URL = '192.168.1.120:6001'
8
- VITE_BASE_URL = '192.168.1.112:5010'
8
+ VITE_BASE_URL = '192.168.1.50:5001'
9
9
 
10
10
  # 应用运行主机(置空默认为 localhost)
11
11
  VITE_APP_HOST = ''
@@ -26,7 +26,7 @@ jnrs-vue/
26
26
  │ ├── router/ # 路由配置
27
27
  │ ├── api/ # 接口定义(已含 request 实例)
28
28
  │ ├── types/ # 类型定义
29
- │ ├── store/ # 状态管理
29
+ │ ├── stores/ # 状态管理
30
30
  │ ├── utils/ # 工具函数
31
31
  │ ├── locales/ # 国际化
32
32
  │ └── main.ts # 应用入口
@@ -18,6 +18,7 @@ declare module 'vue' {
18
18
  ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
19
19
  ElCard: typeof import('element-plus/es')['ElCard']
20
20
  ElCascader: typeof import('element-plus/es')['ElCascader']
21
+ ElCol: typeof import('element-plus/es')['ElCol']
21
22
  ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
22
23
  ElContainer: typeof import('element-plus/es')['ElContainer']
23
24
  ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
@@ -34,6 +35,8 @@ declare module 'vue' {
34
35
  ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
35
36
  ElOption: typeof import('element-plus/es')['ElOption']
36
37
  ElPopover: typeof import('element-plus/es')['ElPopover']
38
+ ElRow: typeof import('element-plus/es')['ElRow']
39
+ ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
37
40
  ElSelect: typeof import('element-plus/es')['ElSelect']
38
41
  ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
39
42
  ElSwitch: typeof import('element-plus/es')['ElSwitch']
@@ -42,7 +45,6 @@ declare module 'vue' {
42
45
  ElTabPane: typeof import('element-plus/es')['ElTabPane']
43
46
  ElTabs: typeof import('element-plus/es')['ElTabs']
44
47
  ElTag: typeof import('element-plus/es')['ElTag']
45
- ElUpload: typeof import('element-plus/es')['ElUpload']
46
48
  ElWatermark: typeof import('element-plus/es')['ElWatermark']
47
49
  }
48
50
  export interface GlobalDirectives {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jnrs-vue",
3
- "version": "1.2.20",
3
+ "version": "1.2.22",
4
4
  "description": "JNRS 信息化管理系统",
5
5
  "author": "talia_tan",
6
6
  "private": true,
@@ -19,8 +19,8 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@element-plus/icons-vue": "^2.3.2",
22
- "@jnrs/shared": "1.1.14",
23
- "@jnrs/vue-core": "1.2.9",
22
+ "@jnrs/shared": "1.1.16",
23
+ "@jnrs/vue-core": "1.2.11",
24
24
  "@jnrs/lingshu-smart": "2.2.4",
25
25
  "@vueuse/core": "^14.1.0",
26
26
  "element-plus": "^2.13.3",
@@ -4,7 +4,7 @@ import { useSystemStore } from '@jnrs/vue-core/pinia'
4
4
  import { ElConfigProvider } from 'element-plus'
5
5
  import zhCn from 'element-plus/es/locale/lang/zh-CN'
6
6
  import en from 'element-plus/es/locale/lang/en'
7
- import { useI18n } from 'vue-i18n'
7
+ import { useI18n } from '@/locales'
8
8
  import { changeLocales as changeLocalesForShared } from '@jnrs/shared/locales'
9
9
 
10
10
  const { locale } = useI18n()
@@ -7,7 +7,7 @@ import { axiosRequest } from '../request'
7
7
  */
8
8
  export const FileApi = (uniqueFileName: string): Promise<Blob> => {
9
9
  return axiosRequest({
10
- url: '/api/files/' + uniqueFileName,
10
+ url: '/files/' + uniqueFileName,
11
11
  method: 'get',
12
12
  responseType: 'blob',
13
13
  showErrorMsg: false
@@ -19,7 +19,7 @@ export const FileApi = (uniqueFileName: string): Promise<Blob> => {
19
19
  */
20
20
  // import { useFetch } from '@vueuse/core'
21
21
  // export const FileApi = (uniqueFileName: string) => {
22
- // return useFetch(`/api/files/${uniqueFileName}`, {
22
+ // return useFetch(`/files/${uniqueFileName}`, {
23
23
  // method: 'get',
24
24
  // headers: {
25
25
  // responseType: 'blob'
@@ -1,12 +1,20 @@
1
- import type { Pagination, PageTableData, FileContainer } from '@/types'
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : demos/index.ts
5
+ * @Date : 2026/03/01
6
+ * @Desc. : 示例模块接口文档(可作为 AI Agent 上下文来源)
7
+ */
8
+
9
+ import type { IBusinessResponse } from '@jnrs/shared'
10
+ import type { IPagination, IPageTableData, IFile, IUser } from '@/types'
2
11
  import { axiosRequest } from '../request'
3
- import { extractFieldId } from '@/utils/file'
4
- import { objectToFormData } from '@/utils/packages'
12
+ import { objectToFormData } from '@/utils'
5
13
 
6
14
  /**
7
- * 项目
15
+ * 项目 - 详情
8
16
  */
9
- export interface ProjectItem extends FileContainer {
17
+ export interface Project extends IFile {
10
18
  id: string
11
19
  programCode: string
12
20
  program: string
@@ -23,9 +31,9 @@ export interface ProjectItem extends FileContainer {
23
31
  }
24
32
 
25
33
  /**
26
- * 新增
34
+ * 新增项目 - 忽略字段
27
35
  */
28
- type AddProjectOmitKeys =
36
+ type CreateProjectOmit =
29
37
  | 'id'
30
38
  | 'programCode'
31
39
  | 'program'
@@ -37,28 +45,54 @@ type AddProjectOmitKeys =
37
45
  | 'imageDocument'
38
46
  | 'attachmentDocument'
39
47
 
40
- export type AddProjectItem = Omit<ProjectItem, AddProjectOmitKeys> & {
48
+ /**
49
+ * 项目 - 创建
50
+ */
51
+ export type EditProject = Omit<Project, CreateProjectOmit> & {
41
52
  id?: string
42
- managerId?: Record<string, unknown> | unknown
53
+ managerId?: Record<string, unknown> | number
43
54
  newAttachmentFile: []
44
55
  newImageFiles: []
45
56
  }
46
57
 
47
58
  /**
48
- * 查询
59
+ * 项目 - 查询
49
60
  */
50
- export interface ProjectQuery extends Pagination {
61
+ export interface ProjectQuery extends IPagination {
51
62
  code?: string
52
63
  projectType?: '敏捷型' | '瀑布型' | '混合型'
53
64
  manager?: string
54
65
  }
55
66
 
67
+ // 测试 获取数据
68
+ export const DataApiTest = (id: string): Promise<IUser> => {
69
+ return axiosRequest({
70
+ url: '/auth/user-info',
71
+ method: 'get',
72
+ params: {
73
+ id
74
+ }
75
+ })
76
+ }
77
+
78
+ // 测试 获取全量数据
79
+ export const FullDataApiTest = (id: string): Promise<IBusinessResponse<IUser>> => {
80
+ return axiosRequest({
81
+ url: '/auth/user-info',
82
+ method: 'get',
83
+ params: {
84
+ id
85
+ },
86
+ returnFullResponse: true // 返回完整响应数据
87
+ })
88
+ }
89
+
56
90
  /**
57
91
  * 测试 404 错误
58
92
  */
59
93
  export const NotFoundApi = () => {
60
94
  return axiosRequest({
61
- url: '/mock/notFound',
95
+ url: '/notFound',
62
96
  method: 'get'
63
97
  })
64
98
  }
@@ -68,7 +102,7 @@ export const NotFoundApi = () => {
68
102
  */
69
103
  export const NoNeedAuthApi = () => {
70
104
  return axiosRequest({
71
- url: '/mock/auth/no',
105
+ url: '/auth/no',
72
106
  method: 'post',
73
107
  noAuth: true
74
108
  })
@@ -80,7 +114,7 @@ export const NoNeedAuthApi = () => {
80
114
  */
81
115
  export const NoAuthApi = (showErrorMsg: boolean) => {
82
116
  return axiosRequest({
83
- url: '/mock/auth/no',
117
+ url: '/auth/no',
84
118
  method: 'post',
85
119
  showErrorMsg
86
120
  })
@@ -89,34 +123,50 @@ export const NoAuthApi = (showErrorMsg: boolean) => {
89
123
  /**
90
124
  * 数据详情
91
125
  */
92
- export const DetailsApi = (): Promise<FileContainer> => {
126
+ export const DetailsApi = (): Promise<IFile> => {
93
127
  return axiosRequest({
94
- url: '/mock/details',
128
+ url: '/details',
95
129
  method: 'get'
96
130
  })
97
131
  }
98
132
 
99
133
  /**
100
- * 表单新增(包含文件上传类需使用 formData 类型)
134
+ * 项目 - 编辑
101
135
  */
102
- export const EditApi = (data: AddProjectItem) => {
103
- const formData = objectToFormData({
104
- ...data,
105
- managerId: extractFieldId(data.managerId, 'managerId')
106
- })
136
+ export const EditProjectApi = (data: EditProject) => {
107
137
  return axiosRequest({
108
- url: '/mock/demos/save',
138
+ url: '/demos/save',
109
139
  method: 'post',
110
- data: formData
140
+ data: objectToFormData(data) // 包含文件上传类需使用 formData 类型
111
141
  })
112
142
  }
113
143
 
114
144
  /**
115
- * 数据详情
145
+ * 项目 - 更新
146
+ */
147
+ export const UpdateProjectApi = (data: Project) => {
148
+ return axiosRequest({
149
+ url: '/demos/update',
150
+ method: 'put',
151
+ data
152
+ })
153
+ }
154
+
155
+ /**
156
+ * 删除数据
157
+ */
158
+ export const DeleteProjectApi = (id: string) => {
159
+ return axiosRequest({
160
+ url: `/demos/delete/${id}`,
161
+ method: 'delete'
162
+ })
163
+ }
164
+ /**
165
+ * 列表数据
116
166
  */
117
- export const TableApi = (data?: ProjectQuery): Promise<PageTableData<ProjectItem>> => {
167
+ export const ProjectListApi = (data?: ProjectQuery): Promise<IPageTableData<Project>> => {
118
168
  return axiosRequest({
119
- url: '/mock/demos/table',
169
+ url: '/demos/table',
120
170
  method: 'get',
121
171
  data
122
172
  })
@@ -125,9 +175,9 @@ export const TableApi = (data?: ProjectQuery): Promise<PageTableData<ProjectItem
125
175
  /**
126
176
  * 下载数据导入模板
127
177
  */
128
- export const ImportTemplateApi = (): Promise<Blob> => {
178
+ export const DownloadTemplateApi = (): Promise<Blob> => {
129
179
  return axiosRequest({
130
- url: '/mock/project/template',
180
+ url: '/project/template',
131
181
  method: 'post'
132
182
  })
133
183
  }
@@ -137,7 +187,7 @@ export const ImportTemplateApi = (): Promise<Blob> => {
137
187
  */
138
188
  export const ImportDataApi = (data: FormData) => {
139
189
  return axiosRequest({
140
- url: '/mock/project/import',
190
+ url: '/project/import',
141
191
  method: 'post',
142
192
  data
143
193
  })
@@ -148,7 +198,7 @@ export const ImportDataApi = (data: FormData) => {
148
198
  */
149
199
  export const ExportApi = (data: Record<string, unknown>): Promise<Blob> => {
150
200
  return axiosRequest({
151
- url: '/mock/project/export',
201
+ url: '/project/export',
152
202
  method: 'post',
153
203
  data
154
204
  })
@@ -6,9 +6,10 @@
6
6
  * @Desc. : axios 网络请求实例
7
7
  */
8
8
 
9
- import type { BusinessRequest, BusinessResponse } from '@jnrs/shared/request'
9
+ import type { IBusinessRequest, IBusinessResponse } from '@jnrs/shared'
10
10
  import { createAxiosInstance } from '@jnrs/shared/request'
11
- import { useMockStore, useAuthStore } from '@jnrs/vue-core/pinia'
11
+ import { useMockStore } from '@jnrs/vue-core/pinia'
12
+ import { useAuthStore } from '@/stores'
12
13
  import { handleRouter } from '@jnrs/vue-core/router'
13
14
  import { ElMessage } from 'element-plus'
14
15
 
@@ -31,20 +32,18 @@ const axiosInstance = createAxiosInstance({
31
32
  * @param options 请求配置项
32
33
  * @returns Promise<T> 响应数据
33
34
  */
34
- const axiosRequest = <T = BusinessResponse>(options: BusinessRequest): Promise<T> => {
35
+ const axiosRequest = <T = IBusinessResponse>(options: IBusinessRequest): Promise<T> => {
35
36
  if (!axiosInstance) {
36
37
  throw new Error('请先调用 createRequest 初始化 axios 实例')
37
38
  }
38
39
 
39
- // 如果是模拟请求,则将请求地址改为模拟地址
40
- const { isMock } = useMockStore()
40
+ const { useMockServe } = useMockStore()
41
41
 
42
- if (isMock) {
43
- options.url = options.mockUrl
44
- ? options.mockUrl
45
- : options.url.startsWith('/mock')
46
- ? options.url
47
- : '/mock' + options.url
42
+ // 如果开启 mock 模式,则将请求地址改为 mock 地址,否则使用 api 地址
43
+ if (useMockServe) {
44
+ options.url = '/api/mock' + options.url
45
+ } else {
46
+ options.url = '/api' + options.url
48
47
  }
49
48
 
50
49
  return axiosInstance(options)
@@ -1,16 +1,17 @@
1
- import type { Dict, DictItem, User, Role } from '@jnrs/shared'
2
- import type { MenuItem } from '@jnrs/vue-core'
1
+ import type { IDict, IDictItem, IRole } from '@/types'
2
+ import type { IMenuItem } from '@jnrs/vue-core'
3
+ import type { IUser } from '@/types'
3
4
  import { axiosRequest } from '../request'
4
- import { objectToFormData } from '@/utils/packages'
5
+ import { objectToFormData } from '@/utils'
5
6
 
6
7
  // 菜单
7
- export const MenuApi = (): Promise<MenuItem[]> => {
8
- return axiosRequest({
9
- url: '/system/menu.json', // /public 文件夹下
10
- mockUrl: '/mock/menu',
11
- method: 'get',
12
- noAuth: true // 本地数据忽略 token 验证
13
- })
8
+ export const MenuApi = async (): Promise<IMenuItem[]> => {
9
+ const response = await fetch('/system/menu.json')
10
+ if (!response.ok) {
11
+ throw new Error(`Failed to load menu.json: ${response.status} ${response.statusText}`)
12
+ }
13
+ const data = await response.json()
14
+ return data.data
14
15
  }
15
16
 
16
17
  // 登录
@@ -19,16 +20,19 @@ interface LoginParams {
19
20
  password: string
20
21
  }
21
22
 
22
- export interface LoginResult extends User {
23
+ /**
24
+ * 登录结果
25
+ */
26
+ export interface LoginResult extends IUser {
23
27
  token: string
24
- dict: Dict
28
+ dict: IDict
25
29
  }
26
30
 
27
31
  export const LoginApi = (data: LoginParams): Promise<LoginResult> => {
28
32
  return axiosRequest({
29
- url: '/api/auth/login',
33
+ url: '/auth/login',
30
34
  method: 'post',
31
- data,
35
+ data: objectToFormData(data),
32
36
  noAuth: true
33
37
  })
34
38
  }
@@ -36,15 +40,15 @@ export const LoginApi = (data: LoginParams): Promise<LoginResult> => {
36
40
  // 退出登录
37
41
  export const LogoutApi = () => {
38
42
  return axiosRequest({
39
- url: '/api/auth/logout',
43
+ url: '/auth/logout',
40
44
  method: 'get'
41
45
  })
42
46
  }
43
47
 
44
48
  // 获取用户信息
45
- export const UserInfoApi = (): Promise<User> => {
49
+ export const UserInfoApi = (): Promise<IUser> => {
46
50
  return axiosRequest({
47
- url: '/api/auth/user-info',
51
+ url: '/auth/user-info',
48
52
  method: 'get'
49
53
  })
50
54
  }
@@ -52,7 +56,7 @@ export const UserInfoApi = (): Promise<User> => {
52
56
  // 修改头像
53
57
  export const AvatarChangeApi = (data: File) => {
54
58
  return axiosRequest({
55
- url: '/api/user/avatar',
59
+ url: '/user/avatar',
56
60
  method: 'post',
57
61
  data: objectToFormData({ file: data })
58
62
  })
@@ -66,16 +70,16 @@ interface PasswordChange {
66
70
 
67
71
  export const PasswordChangeApi = (data: PasswordChange) => {
68
72
  return axiosRequest({
69
- url: '/api/auth/change-password',
73
+ url: '/auth/change-password',
70
74
  method: 'post',
71
75
  data
72
76
  })
73
77
  }
74
78
 
75
79
  // 获取字典列表
76
- export const DictApi = (): Promise<DictItem[]> => {
80
+ export const DictApi = (): Promise<IDictItem[]> => {
77
81
  return axiosRequest({
78
- url: '/api/dict-manager',
82
+ url: '/dict-manager',
79
83
  method: 'get'
80
84
  })
81
85
  }
@@ -83,24 +87,24 @@ export const DictApi = (): Promise<DictItem[]> => {
83
87
  // 获取单个字典
84
88
  export const DictDetailApi = (id: string) => {
85
89
  return axiosRequest({
86
- url: `/api/dict-manager/detail/${id}`,
90
+ url: `/dict-manager/detail/${id}`,
87
91
  method: 'get'
88
92
  })
89
93
  }
90
94
 
91
95
  // 修改单个字典
92
- export const DictChangeApi = (data: DictItem) => {
96
+ export const DictChangeApi = (data: IDictItem) => {
93
97
  return axiosRequest({
94
- url: '/api/dict-manager/detail',
98
+ url: '/dict-manager/detail',
95
99
  method: 'post',
96
100
  data
97
101
  })
98
102
  }
99
103
 
100
104
  // 获取角色列表
101
- export const RoleApi = (): Promise<Role[]> => {
105
+ export const RoleApi = (): Promise<IRole[]> => {
102
106
  return axiosRequest({
103
- url: '/api/role-manager',
107
+ url: '/role-manager',
104
108
  method: 'get',
105
109
  noAuth: true
106
110
  })
@@ -0,0 +1,15 @@
1
+ /* fade-transform transition */
2
+ .fade-transform-leave-active,
3
+ .fade-transform-enter-active {
4
+ transition: all 0.3s cubic-bezier(0.55, 0, 0.1, 1);
5
+ }
6
+
7
+ .fade-transform-enter-from {
8
+ opacity: 0;
9
+ transform: translateX(-20px);
10
+ }
11
+
12
+ .fade-transform-leave-to {
13
+ opacity: 0;
14
+ transform: translateX(20px);
15
+ }
@@ -7,17 +7,17 @@
7
7
  -->
8
8
 
9
9
  <script setup lang="ts">
10
- import type { Pagination, PageTableData } from '@/types'
10
+ import type { IPagination, IPageTableData } from '@/types'
11
11
  import { ref, onActivated } from 'vue'
12
12
  import { JnPagination, JnTable } from '@jnrs/vue-core/components'
13
13
  import { debounce } from '@jnrs/shared/lodash'
14
14
 
15
- interface Props {
15
+ export interface Props {
16
16
  /**
17
17
  * 获取数据表格 api 函数
18
18
  */
19
19
  // eslint-disable-next-line
20
- getTableDataApi?: (data?: Pagination) => Promise<PageTableData<any>>
20
+ getTableDataApi?: (data?: IPagination) => Promise<IPageTableData<any>>
21
21
  }
22
22
 
23
23
  const { getTableDataApi } = defineProps<Props>()
@@ -25,7 +25,7 @@ const { getTableDataApi } = defineProps<Props>()
25
25
  const loading = ref(false)
26
26
  const tableData = ref()
27
27
  const total = ref(0)
28
- const pagination = ref<Pagination>({ pageNo: 1, pageSize: 20 })
28
+ const pagination = ref<IPagination>({ pageNo: 1, pageSize: 20 })
29
29
 
30
30
  const getTable = debounce(async () => {
31
31
  if (!getTableDataApi) {
@@ -8,9 +8,9 @@
8
8
 
9
9
  <script setup lang="ts">
10
10
  import { computed } from 'vue'
11
- import { getDictLabel, getDictColor } from '@/utils/packages'
11
+ import { getDictLabel, getDictColor } from '@/utils'
12
12
 
13
- interface Props {
13
+ export interface Props {
14
14
  dictName: string
15
15
  value: string | number
16
16
  /**
@@ -30,7 +30,7 @@ interface Props {
30
30
  const { dictName = '', value = '', showColor = true, popover = '' } = defineProps<Props>()
31
31
 
32
32
  const computedColor = computed(() => {
33
- return showColor ? getDictColor(dictName, value) : 'unset'
33
+ return showColor ? getDictColor(dictName, value) : 'inherit'
34
34
  })
35
35
  </script>
36
36
 
@@ -39,12 +39,13 @@ const computedColor = computed(() => {
39
39
  <template #reference>
40
40
  <span
41
41
  class="dictTag"
42
+ :class="{ dictTag_showColor: showColor }"
42
43
  :style="{
43
44
  backgroundColor: computedColor
44
45
  }"
45
46
  >
46
47
  <span
47
- :class="{ dictTag_label_showColor: showColor }"
48
+ class="dictLabel"
48
49
  :style="{
49
50
  color: computedColor
50
51
  }"
@@ -64,10 +65,11 @@ const computedColor = computed(() => {
64
65
  padding: 1px 8px;
65
66
  border-radius: 4px;
66
67
  white-space: nowrap;
67
- transform: scale(0.8);
68
+ }
68
69
 
69
- .dictTag_label_showColor {
70
- font-size: 1.1em;
70
+ .dictTag_showColor {
71
+ transform: scale(0.9);
72
+ .dictLabel {
71
73
  filter: invert(0.5) brightness(0.5);
72
74
  }
73
75
  }
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import type { FileItem } from '@jnrs/shared'
3
- import type { Attachment } from '@/types'
2
+ import type { IFileItem } from '@jnrs/shared'
3
+ import type { IAttachment } from '@/types'
4
4
  import { ref, watch, onActivated, onDeactivated, onBeforeUnmount } from 'vue'
5
5
  import { blobToUrl } from '@jnrs/shared'
6
6
  import { debounce } from '@jnrs/shared/lodash'
@@ -8,11 +8,11 @@ import { FileApi } from '@/api/common'
8
8
 
9
9
  import { JnImageView } from '@jnrs/vue-core/components'
10
10
 
11
- interface Props {
11
+ export interface Props {
12
12
  /**
13
13
  * 要加载的文件列表 | 文件名唯一标识 uniqueFileName
14
14
  */
15
- loadKeys: Attachment[] | string | undefined
15
+ loadKeys: IAttachment[] | string | undefined
16
16
 
17
17
  /**
18
18
  * 是否清理文件副作用
@@ -26,7 +26,7 @@ const { loadKeys, clearSideEffects = false } = defineProps<Props>()
26
26
  const posterUrl = ref('')
27
27
 
28
28
  // 存储每个 URL 对应的 URL 对象
29
- const fileList = ref<FileItem[]>([])
29
+ const fileList = ref<IFileItem[]>([])
30
30
 
31
31
  // 存储每个 URL 对应的 revoke 函数用于副作用清理
32
32
  const revokeFns = ref<(() => void)[]>([])
@@ -1,17 +1,17 @@
1
1
  <script lang="ts" setup>
2
- import type { FileItem } from '@jnrs/shared'
3
- import type { Attachment } from '@/types'
2
+ import type { IFileItem } from '@jnrs/shared'
3
+ import type { IAttachment } from '@/types'
4
4
  import { ref, watch, onActivated, onDeactivated, onBeforeUnmount } from 'vue'
5
5
  import { blobToUrl } from '@jnrs/shared'
6
6
  import { FileApi } from '@/api/common'
7
7
 
8
8
  import { JnPdfView } from '@jnrs/vue-core/components'
9
9
 
10
- interface Props {
10
+ export interface Props {
11
11
  /**
12
12
  * 要加载的文件列表 | 文件名唯一标识 uniqueFileName
13
13
  */
14
- loadKeys: Attachment[] | string | undefined
14
+ loadKeys: IAttachment[] | string | undefined
15
15
 
16
16
  /**
17
17
  * 是否清理文件副作用
@@ -22,7 +22,7 @@ interface Props {
22
22
  const { loadKeys, clearSideEffects = false } = defineProps<Props>()
23
23
 
24
24
  // 存储每个 URL 对应的 URL 对象
25
- const fileList = ref<FileItem[]>([])
25
+ const fileList = ref<IFileItem[]>([])
26
26
 
27
27
  // 存储每个 URL 对应的 revoke 函数用于副作用清理
28
28
  const revokeFns = ref<(() => void)[]>([])
@@ -7,7 +7,7 @@
7
7
  -->
8
8
 
9
9
  <script setup lang="ts">
10
- import { TableApi } from '@/api/demos/index'
10
+ import { ProjectListApi } from '@/api/demos/index'
11
11
  import { JnSelectTemplate } from '@jnrs/vue-core/components'
12
12
  </script>
13
13
 
@@ -15,8 +15,8 @@ import { JnSelectTemplate } from '@jnrs/vue-core/components'
15
15
  <JnSelectTemplate
16
16
  tableName="项目经理"
17
17
  :keyValue="{ name: 'manager', id: 'managerId', code: 'code' }"
18
+ :listApi="ProjectListApi"
18
19
  optionSecondaryField="code"
19
- :listApi="TableApi"
20
20
  >
21
21
  <template #table>
22
22
  <el-table-column prop="manager" label="项目经理" align="center" sortable />