create-jnrs-template-vue 1.2.1 → 1.2.2
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/bin/create.mjs +3 -3
- package/jnrs-template-vue/auto-imports.d.ts +4 -0
- package/jnrs-template-vue/components.d.ts +0 -1
- package/jnrs-template-vue/package.json +2 -2
- package/jnrs-template-vue/public/system/menu.json +1 -1
- package/jnrs-template-vue/src/api/demos/index.ts +13 -12
- package/jnrs-template-vue/src/assets/styles/animation.scss +0 -0
- package/jnrs-template-vue/src/assets/styles/common.scss +4 -0
- package/jnrs-template-vue/src/assets/styles/fonts.scss +4 -1
- package/jnrs-template-vue/src/assets/styles/{main.scss → index.scss} +1 -0
- package/jnrs-template-vue/src/assets/styles/init.scss +4 -13
- package/jnrs-template-vue/src/assets/styles/root.scss +0 -3
- package/jnrs-template-vue/src/components/common/{JnDictTag.vue → DictTag.vue} +1 -1
- package/jnrs-template-vue/src/components/{base → common}/PdfView.vue +2 -2
- package/jnrs-template-vue/src/components/select/SelectManager.vue +20 -0
- package/jnrs-template-vue/src/composables/common/usePagination.ts +4 -4
- package/jnrs-template-vue/src/composables/common/useTable.ts +4 -4
- package/jnrs-template-vue/src/composables/tools/useMouseSelection.ts +150 -0
- package/jnrs-template-vue/src/layout/SideMenu.vue +1 -0
- package/jnrs-template-vue/src/layout/TopHeader.vue +1 -1
- package/jnrs-template-vue/src/locales/en.ts +1 -1
- package/jnrs-template-vue/src/main.ts +1 -1
- package/jnrs-template-vue/src/types/index.ts +45 -3
- package/jnrs-template-vue/src/views/demos/crud/index.vue +98 -35
- package/jnrs-template-vue/src/views/demos/unitTest/RequestPage.vue +1 -1
- package/jnrs-template-vue/src/views/login/index.vue +7 -2
- package/jnrs-template-vue/src/views/system/dict/index.vue +2 -2
- package/jnrs-template-vue/src/views/system/menu/index.vue +2 -2
- package/jnrs-template-vue/tsconfig.json +1 -9
- package/jnrs-template-vue/vite.config.ts +1 -2
- package/jnrs-template-vue/viteMockServe/file.ts +2 -3
- package/jnrs-template-vue/viteMockServe/json/tableRes.json +384 -342
- package/package.json +1 -1
- package/jnrs-template-vue/src/assets/images/fileIcon/iconArchive.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconAudio.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconCode.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconExcel.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconFile.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconFlash.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconGif.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconImage.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconMac.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconOfd.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconPdf.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconPpt.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconText.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconUnknown.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconVideo.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconWindows.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconWord.png +0 -0
- package/jnrs-template-vue/src/assets/images/fileIcon/iconWps.png +0 -0
- package/jnrs-template-vue/src/components/base/JnFileUpload.vue +0 -433
- package/jnrs-template-vue/src/components/common/JnDatetime.vue +0 -37
- package/jnrs-template-vue/src/components/common/JnEdit.vue +0 -68
- package/jnrs-template-vue/src/components/common/JnPagination.vue +0 -83
- package/jnrs-template-vue/src/components/common/JnTable.vue +0 -133
- package/jnrs-template-vue/src/composables/tools/useReactivityTableHeight.ts +0 -63
- /package/jnrs-template-vue/src/components/{base → common}/ImageView.vue +0 -0
- /package/jnrs-template-vue/viteMockServe/{fileSrc → file}/mock-pdf.pdf +0 -0
- /package/jnrs-template-vue/viteMockServe/{fileSrc → file}/mock-png-0.png +0 -0
- /package/jnrs-template-vue/viteMockServe/{fileSrc → file}/mock-png-1.png +0 -0
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@Author : TanRui
|
|
3
|
-
@WeChat : Tan578853789
|
|
4
|
-
@File : JnTable.vue
|
|
5
|
-
@Date : 2025/12/18
|
|
6
|
-
@Desc. : 表格组件
|
|
7
|
-
-->
|
|
8
|
-
|
|
9
|
-
<script setup lang="ts" generic="T extends Record<string, any>">
|
|
10
|
-
import { computed } from 'vue'
|
|
11
|
-
import type { UseReactivityTableHeightOptions } from '@/composables/tools/useReactivityTableHeight'
|
|
12
|
-
import { useReactivityTableHeight } from '@/composables/tools/useReactivityTableHeight'
|
|
13
|
-
|
|
14
|
-
type PaginationModelValue = {
|
|
15
|
-
currentPage: number
|
|
16
|
-
pageSize: number
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface Props {
|
|
20
|
-
/**
|
|
21
|
-
* 表数据
|
|
22
|
-
*/
|
|
23
|
-
data?: T[]
|
|
24
|
-
/**
|
|
25
|
-
* 行数据的 Key,在使用 reserve-selection 功能与显示树形数据时,该属性是必填的。
|
|
26
|
-
* 支持多层访问:user.info.id
|
|
27
|
-
*/
|
|
28
|
-
rowKey?: string
|
|
29
|
-
/**
|
|
30
|
-
* 总是显示横向滚动条
|
|
31
|
-
*/
|
|
32
|
-
scrollbar?: boolean
|
|
33
|
-
/**
|
|
34
|
-
* 表格高度,默认为 100%
|
|
35
|
-
* @default 100%
|
|
36
|
-
*/
|
|
37
|
-
height?: string | number
|
|
38
|
-
/**
|
|
39
|
-
* 表格高度是否自动计算,默认为 false
|
|
40
|
-
* @default false
|
|
41
|
-
*/
|
|
42
|
-
autoHeight?: boolean
|
|
43
|
-
/**
|
|
44
|
-
* 表格高度自动计算配置项
|
|
45
|
-
*/
|
|
46
|
-
autoHeightOptions?: UseReactivityTableHeightOptions
|
|
47
|
-
/**
|
|
48
|
-
* 是否显示序号列
|
|
49
|
-
*/
|
|
50
|
-
showIndexColumn?: boolean
|
|
51
|
-
/**
|
|
52
|
-
* 是否显示选择列
|
|
53
|
-
*/
|
|
54
|
-
showSelectionColumn?: boolean
|
|
55
|
-
/**
|
|
56
|
-
* 当前页码和每页大小(用于序号计算)
|
|
57
|
-
*/
|
|
58
|
-
pagination?: PaginationModelValue
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const {
|
|
62
|
-
rowKey = 'id',
|
|
63
|
-
scrollbar = true,
|
|
64
|
-
height = null,
|
|
65
|
-
autoHeight = true,
|
|
66
|
-
autoHeightOptions = {},
|
|
67
|
-
showIndexColumn = true,
|
|
68
|
-
showSelectionColumn = true,
|
|
69
|
-
pagination = { currentPage: 0, pageSize: 0 }
|
|
70
|
-
} = defineProps<Props>()
|
|
71
|
-
|
|
72
|
-
const { maxHeight: reactiveMaxHeight } = useReactivityTableHeight(autoHeightOptions ?? {})
|
|
73
|
-
|
|
74
|
-
// 表格最终高度
|
|
75
|
-
const finalHeight = computed(() => {
|
|
76
|
-
if (height != null) {
|
|
77
|
-
return height
|
|
78
|
-
}
|
|
79
|
-
if (autoHeight) {
|
|
80
|
-
return reactiveMaxHeight.value
|
|
81
|
-
}
|
|
82
|
-
return '100%'
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
// 索引列计算
|
|
86
|
-
const getIndex = (index: number) => {
|
|
87
|
-
return index + (pagination.currentPage - 1) * pagination.pageSize + 1
|
|
88
|
-
}
|
|
89
|
-
</script>
|
|
90
|
-
|
|
91
|
-
<template>
|
|
92
|
-
<el-table
|
|
93
|
-
class="jn_table"
|
|
94
|
-
header-cell-class-name="jn_table_header"
|
|
95
|
-
ref="jnTableRef"
|
|
96
|
-
:row-key="rowKey"
|
|
97
|
-
:data="data"
|
|
98
|
-
border
|
|
99
|
-
:scrollbar-always-on="scrollbar"
|
|
100
|
-
:height="finalHeight"
|
|
101
|
-
>
|
|
102
|
-
<el-table-column v-if="showIndexColumn" label="序号" type="index" align="center" width="60">
|
|
103
|
-
<template #default="{ $index }">
|
|
104
|
-
<span>{{ getIndex($index) }}</span>
|
|
105
|
-
</template>
|
|
106
|
-
</el-table-column>
|
|
107
|
-
<slot></slot>
|
|
108
|
-
<el-table-column
|
|
109
|
-
v-if="showSelectionColumn"
|
|
110
|
-
type="selection"
|
|
111
|
-
width="60"
|
|
112
|
-
align="center"
|
|
113
|
-
fixed="right"
|
|
114
|
-
:reserve-selection="true"
|
|
115
|
-
/>
|
|
116
|
-
</el-table>
|
|
117
|
-
</template>
|
|
118
|
-
|
|
119
|
-
<style lang="scss" scoped>
|
|
120
|
-
.jn_table {
|
|
121
|
-
width: 100%;
|
|
122
|
-
|
|
123
|
-
:deep(.jn_table_header) {
|
|
124
|
-
color: var(--jnrs-font-primary) !important;
|
|
125
|
-
background: var(--jnrs-background-head) !important;
|
|
126
|
-
|
|
127
|
-
.cell {
|
|
128
|
-
padding: 0 8px;
|
|
129
|
-
line-height: 1.2em;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
</style>
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @Author : TanRui
|
|
3
|
-
* @WeChat : Tan578853789
|
|
4
|
-
* @File : useReactivityTableHeight.ts
|
|
5
|
-
* @Date : 2025/12/10
|
|
6
|
-
* @Desc. : 响应式根据视口动态计算表格高度
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { ref, onActivated, onDeactivated } from 'vue'
|
|
10
|
-
import { debounce } from '@jnrs/shared/lodash'
|
|
11
|
-
|
|
12
|
-
// 总底部高度
|
|
13
|
-
const PADDING_HEIGHT = 40
|
|
14
|
-
|
|
15
|
-
// 总边距
|
|
16
|
-
const FOOT_HEIGHT = 40
|
|
17
|
-
|
|
18
|
-
export interface UseReactivityTableHeightOptions {
|
|
19
|
-
// 表格类名,默认值 el-table
|
|
20
|
-
className?: string
|
|
21
|
-
// 默认高度,默认值 300
|
|
22
|
-
bottomGap?: number
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @param className 表格类名,默认值 el-table,如果页面存在多个表格,则必须分别传入自定义类名
|
|
27
|
-
* @param bottomGap 底部间隔,默认值 77
|
|
28
|
-
* @return maxHeight 表格高度
|
|
29
|
-
*/
|
|
30
|
-
export function useReactivityTableHeight({
|
|
31
|
-
className = 'el-table',
|
|
32
|
-
bottomGap = PADDING_HEIGHT + FOOT_HEIGHT
|
|
33
|
-
}: UseReactivityTableHeightOptions = {}) {
|
|
34
|
-
const maxHeight = ref(500)
|
|
35
|
-
|
|
36
|
-
const calculateTableHeight = debounce(
|
|
37
|
-
() => {
|
|
38
|
-
const element = document.querySelector(`.${className}`)
|
|
39
|
-
if (element) {
|
|
40
|
-
const rect = element.getBoundingClientRect()
|
|
41
|
-
const innerHeight = window.innerHeight
|
|
42
|
-
const gap = rect.top + bottomGap
|
|
43
|
-
const mh = innerHeight - gap
|
|
44
|
-
maxHeight.value = mh > 100 ? mh : 100
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
300,
|
|
48
|
-
{ leading: false }
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
// 初始化高度计算
|
|
52
|
-
onActivated(() => {
|
|
53
|
-
calculateTableHeight()
|
|
54
|
-
window.addEventListener('resize', calculateTableHeight)
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
// 清理事件监听器
|
|
58
|
-
onDeactivated(() => {
|
|
59
|
-
window.removeEventListener('resize', calculateTableHeight)
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
return { maxHeight }
|
|
63
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|