create-jnrs-template-vue 1.2.6 → 1.2.7
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/package.json +2 -2
- package/jnrs-template-vue/public/system/menu.json +18 -4
- package/jnrs-template-vue/src/api/demos/index.ts +1 -1
- package/jnrs-template-vue/src/layout/SideMenu.vue +1 -1
- package/jnrs-template-vue/src/layout/SideMenuItem.vue +1 -1
- package/jnrs-template-vue/src/router/index.ts +2 -2
- package/jnrs-template-vue/src/views/demos/crud/index.vue +3 -0
- package/jnrs-template-vue/src/views/demos/unitTest/index.vue +18 -1
- package/jnrs-template-vue/src/views/system/menu/index.vue +7 -17
- package/package.json +1 -1
- package/jnrs-template-vue/src/composables/common/useForm.ts +0 -9
- package/jnrs-template-vue/src/composables/common/useModal.ts +0 -9
- package/jnrs-template-vue/src/composables/common/usePagination.ts +0 -35
- package/jnrs-template-vue/src/composables/common/useTable.ts +0 -35
- package/jnrs-template-vue/src/composables/common/useUser.ts +0 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jnrs-template-vue",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "JNRS 信息化管理系统",
|
|
5
5
|
"author": "talia_tan",
|
|
6
6
|
"private": true,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@element-plus/icons-vue": "^2.3.2",
|
|
22
22
|
"@jnrs/shared": "1.1.11",
|
|
23
|
-
"@jnrs/vue-core": "1.2.
|
|
23
|
+
"@jnrs/vue-core": "1.2.9",
|
|
24
24
|
"@vueuse/core": "^14.1.0",
|
|
25
25
|
"element-plus": "^2.11.9",
|
|
26
26
|
"pinia": "^3.0.4",
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
"msg": "操作成功",
|
|
4
4
|
"data": [
|
|
5
5
|
{
|
|
6
|
-
"path": "/demos",
|
|
7
|
-
"name": "Demos",
|
|
8
6
|
"meta": {
|
|
9
7
|
"title": "功能演示",
|
|
10
8
|
"icon": "StarFilled",
|
|
@@ -37,6 +35,23 @@
|
|
|
37
35
|
"todoCount": 0
|
|
38
36
|
},
|
|
39
37
|
"component": "/demos/crud/index"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"path": "/testRedirect",
|
|
41
|
+
"name": "TestRedirect",
|
|
42
|
+
"meta": {
|
|
43
|
+
"title": "重定向测试"
|
|
44
|
+
},
|
|
45
|
+
"redirect": "/crud"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "/testAlias",
|
|
49
|
+
"name": "TestAlias",
|
|
50
|
+
"meta": {
|
|
51
|
+
"title": "相同component不同path",
|
|
52
|
+
"testId": 1
|
|
53
|
+
},
|
|
54
|
+
"component": "/demos/crud/index"
|
|
40
55
|
}
|
|
41
56
|
]
|
|
42
57
|
},
|
|
@@ -76,8 +91,7 @@
|
|
|
76
91
|
"todoCount": 0,
|
|
77
92
|
"permissions": ["user:view", "user:edit"]
|
|
78
93
|
},
|
|
79
|
-
"component": "/system/user/index"
|
|
80
|
-
"redirect": "/crud"
|
|
94
|
+
"component": "/system/user/index"
|
|
81
95
|
},
|
|
82
96
|
{
|
|
83
97
|
"path": "/system/role",
|
|
@@ -124,7 +124,7 @@ export const ImportTemplateApi = (): Promise<Blob> => {
|
|
|
124
124
|
/**
|
|
125
125
|
* 项目数据导入
|
|
126
126
|
*/
|
|
127
|
-
export const ImportDataApi = (data:
|
|
127
|
+
export const ImportDataApi = (data: FormData) => {
|
|
128
128
|
return axiosRequest({
|
|
129
129
|
url: '/mock/project/import',
|
|
130
130
|
method: 'post',
|
|
@@ -11,7 +11,7 @@ const { menuCollapse } = useSystemStore()
|
|
|
11
11
|
|
|
12
12
|
<template>
|
|
13
13
|
<!-- 一级路由 -->
|
|
14
|
-
<el-menu-item :index="listItem.path" v-if="!listItem.children">
|
|
14
|
+
<el-menu-item :index="listItem.name" :route="listItem.path" v-if="!listItem.children">
|
|
15
15
|
<el-icon v-if="listItem.meta.icon">
|
|
16
16
|
<component :is="listItem.meta.icon" />
|
|
17
17
|
</el-icon>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LAYOUT_NAME, GLOBAL_COMPONENT, routes } from './routes'
|
|
2
|
-
import { createVueRouter } from '@jnrs/vue-core/router'
|
|
3
1
|
import type { FileModules, RouteLocationNormalizedGeneric } from '@jnrs/vue-core/router'
|
|
4
2
|
import type { MenuItem } from '@jnrs/vue-core'
|
|
3
|
+
import { LAYOUT_NAME, GLOBAL_COMPONENT, routes } from './routes'
|
|
4
|
+
import { createVueRouter } from '@jnrs/vue-core/router'
|
|
5
5
|
import { useAuthStore, useMenuStore } from '@jnrs/vue-core/pinia'
|
|
6
6
|
import { MenuApi } from '@/api/system'
|
|
7
7
|
import { hasMenuViewPermission } from '@/utils/permissions'
|
|
@@ -5,6 +5,7 @@ import type { ProjectItem, AddProjectItem } from '@/api/demos/index'
|
|
|
5
5
|
import { ref, onActivated } from 'vue'
|
|
6
6
|
import { ElMessage } from 'element-plus'
|
|
7
7
|
import { Plus } from '@element-plus/icons-vue'
|
|
8
|
+
import { useRoute } from '@jnrs/vue-core/router'
|
|
8
9
|
import { objectMatchAssign, dateFormatsToObject } from '@jnrs/shared'
|
|
9
10
|
import { debounce } from '@jnrs/shared/lodash'
|
|
10
11
|
import { isNumberGtZero } from '@jnrs/shared/validator'
|
|
@@ -26,6 +27,7 @@ const loading = ref(false)
|
|
|
26
27
|
const tableData = ref<ProcessedProjectItem[]>([])
|
|
27
28
|
const total = ref(0)
|
|
28
29
|
const pagination = ref<Pagination>({ pageNo: 1, pageSize: 20 })
|
|
30
|
+
const route = useRoute()
|
|
29
31
|
|
|
30
32
|
// 编辑
|
|
31
33
|
const editDialogRef = ref()
|
|
@@ -128,6 +130,7 @@ const submitForm = () => {
|
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
onActivated(() => {
|
|
133
|
+
console.log(route.meta)
|
|
131
134
|
getTable()
|
|
132
135
|
})
|
|
133
136
|
</script>
|
|
@@ -31,6 +31,21 @@ const handleRouteChange = () => {
|
|
|
31
31
|
})
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
const handleRouterSystemMine = () => {
|
|
35
|
+
handleRouter({
|
|
36
|
+
name: 'SystemMine',
|
|
37
|
+
query: {
|
|
38
|
+
id: 1
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
// handleRouter({
|
|
42
|
+
// path: '/system/mine/index',
|
|
43
|
+
// query: {
|
|
44
|
+
// id: 1
|
|
45
|
+
// }
|
|
46
|
+
// })
|
|
47
|
+
}
|
|
48
|
+
|
|
34
49
|
const changeI18n = () => {
|
|
35
50
|
datetime.value = formatDateTime() + ' ' + formatWeekday()
|
|
36
51
|
isFloatGtZero({}, '0', (msg) => {
|
|
@@ -80,7 +95,8 @@ onMounted(() => {
|
|
|
80
95
|
</ul>
|
|
81
96
|
<RequestPage />
|
|
82
97
|
<p>完整路由测试(先点击按钮,获取完整菜单数据)</p>
|
|
83
|
-
<el-button type="success" plain @click="
|
|
98
|
+
<el-button type="success" plain size="small" @click="handleRouterSystemMine">跳转到个人中心</el-button>
|
|
99
|
+
<el-button type="success" plain size="small" @click="handleMenuApi">获取完整菜单数据</el-button>
|
|
84
100
|
<el-cascader
|
|
85
101
|
v-model="currentRoute"
|
|
86
102
|
:options="routeOptions"
|
|
@@ -89,6 +105,7 @@ onMounted(() => {
|
|
|
89
105
|
value: 'name',
|
|
90
106
|
label: 'name'
|
|
91
107
|
}"
|
|
108
|
+
size="small"
|
|
92
109
|
:show-all-levels="false"
|
|
93
110
|
@change="handleRouteChange"
|
|
94
111
|
>
|
|
@@ -21,13 +21,13 @@ const { menus } = useMenuStore()
|
|
|
21
21
|
<el-icon v-if="row.meta.icon"><component :is="row.meta.icon" /></el-icon>
|
|
22
22
|
</template>
|
|
23
23
|
</el-table-column>
|
|
24
|
-
<el-table-column prop="path" label="
|
|
25
|
-
<el-table-column prop="
|
|
24
|
+
<el-table-column prop="path" label="path" min-width="120" header-align="center" />
|
|
25
|
+
<el-table-column prop="name" label="name" min-width="120" header-align="center" />
|
|
26
|
+
<el-table-column prop="component" label="component" min-width="120" header-align="center" />
|
|
26
27
|
<el-table-column prop="redirect" label="redirect" min-width="120" header-align="center" />
|
|
27
|
-
<el-table-column prop="
|
|
28
|
+
<el-table-column prop="meta.permissions" label="permissions" min-width="120" header-align="center">
|
|
28
29
|
<template #default="{ row }">
|
|
29
|
-
<span
|
|
30
|
-
<span v-else>{{ row.meta.permissions }}</span>
|
|
30
|
+
<span>{{ row.meta.permissions }}</span>
|
|
31
31
|
</template>
|
|
32
32
|
</el-table-column>
|
|
33
33
|
<el-table-column prop="type" label="类型" width="80" align="center">
|
|
@@ -36,18 +36,8 @@ const { menus } = useMenuStore()
|
|
|
36
36
|
<el-tag type="success" v-else>目录</el-tag>
|
|
37
37
|
</template>
|
|
38
38
|
</el-table-column>
|
|
39
|
-
<el-table-column prop="
|
|
40
|
-
|
|
41
|
-
<el-tag type="danger" v-if="row.meta.noAuth">否</el-tag>
|
|
42
|
-
<el-tag type="success" v-else>是</el-tag>
|
|
43
|
-
</template>
|
|
44
|
-
</el-table-column>
|
|
45
|
-
<el-table-column prop="type" label="Global" width="80" align="center">
|
|
46
|
-
<template #default="{ row }">
|
|
47
|
-
<el-tag type="success" v-if="row.meta.global">是</el-tag>
|
|
48
|
-
<el-tag type="primary" v-else>否</el-tag>
|
|
49
|
-
</template>
|
|
50
|
-
</el-table-column>
|
|
39
|
+
<el-table-column prop="meta.noAuth" label="meta.noAuth" width="80" align="center" />
|
|
40
|
+
<el-table-column prop="meta.global" label="meta.global" width="80" align="center" />
|
|
51
41
|
</JnTable>
|
|
52
42
|
</el-card>
|
|
53
43
|
</template>
|
package/package.json
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @Author : TanRui
|
|
3
|
-
* @WeChat : Tan578853789
|
|
4
|
-
* @File : useTable.ts
|
|
5
|
-
* @Date : 2025/11/30
|
|
6
|
-
* @Desc. : 表格、分页、筛选等通用逻辑
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { ref, computed } from 'vue'
|
|
10
|
-
|
|
11
|
-
export function useTable<T>(initialData: T[] = []) {
|
|
12
|
-
const data = ref<T[]>(initialData)
|
|
13
|
-
const pageSize = ref(10)
|
|
14
|
-
const pageNo = ref(1)
|
|
15
|
-
|
|
16
|
-
// 分页数据
|
|
17
|
-
const paginatedData = computed(() => {
|
|
18
|
-
const start = (pageNo.value - 1) * pageSize.value
|
|
19
|
-
return data.value?.slice(start, start + pageSize.value)
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
// 设置新的数据
|
|
23
|
-
const setNewData = (newData: T[]) => {
|
|
24
|
-
data.value = newData
|
|
25
|
-
pageNo.value = 1
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
data,
|
|
30
|
-
pageSize,
|
|
31
|
-
pageNo,
|
|
32
|
-
paginatedData,
|
|
33
|
-
setNewData
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @Author : TanRui
|
|
3
|
-
* @WeChat : Tan578853789
|
|
4
|
-
* @File : useTable.ts
|
|
5
|
-
* @Date : 2025/11/30
|
|
6
|
-
* @Desc. : 表格
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { ref, computed } from 'vue'
|
|
10
|
-
|
|
11
|
-
export function useTable<T>(initialData: T[] = []) {
|
|
12
|
-
const data = ref<T[]>(initialData)
|
|
13
|
-
const pageSize = ref(10)
|
|
14
|
-
const pageNo = ref(1)
|
|
15
|
-
|
|
16
|
-
// 分页数据
|
|
17
|
-
const paginatedData = computed(() => {
|
|
18
|
-
const start = (pageNo.value - 1) * pageSize.value
|
|
19
|
-
return data.value?.slice(start, start + pageSize.value)
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
// 设置新的数据
|
|
23
|
-
const setNewData = (newData: T[]) => {
|
|
24
|
-
data.value = newData
|
|
25
|
-
pageNo.value = 1
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
data,
|
|
30
|
-
pageSize,
|
|
31
|
-
pageNo,
|
|
32
|
-
paginatedData,
|
|
33
|
-
setNewData
|
|
34
|
-
}
|
|
35
|
-
}
|