create-jnrs-vue 1.2.22 → 1.2.24
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/README.md +1 -1
- package/bin/upgrade.mjs +69 -19
- package/jnrs-vue/package.json +4 -4
- package/jnrs-vue/src/api/demos/index.ts +1 -1
- package/jnrs-vue/src/views/demos/crud/index.vue +1 -2
- package/jnrs-vue/src/views/demos/unitTest/index.vue +3 -3
- package/jnrs-vue/src/views/login/index.vue +2 -2
- package/jnrs-vue/src/views/system/mine/securitySettings.vue +2 -2
- package/jnrs-vue/viteMockServe/json/loginRes_user.json +20 -0
- package/package.json +1 -1
- package/jnrs-vue/src/types/system.d.ts +0 -115
- package/jnrs-vue/src/types/system.js +0 -1
package/README.md
CHANGED
package/bin/upgrade.mjs
CHANGED
|
@@ -2,39 +2,89 @@
|
|
|
2
2
|
* @Author : TanRui
|
|
3
3
|
* @WeChat : Tan578853789
|
|
4
4
|
* @File : upgrade.mjs
|
|
5
|
-
* @Date : 2026/
|
|
6
|
-
* @Desc. :
|
|
5
|
+
* @Date : 2026/04/13
|
|
6
|
+
* @Desc. : 安全升级脚手架模板(保留用户自定义配置)
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { execSync } from 'child_process'
|
|
10
|
-
import { cpSync, readFileSync, writeFileSync } from 'fs'
|
|
10
|
+
import { cpSync, readFileSync, writeFileSync, rmSync, existsSync } from 'fs'
|
|
11
11
|
import { join } from 'path'
|
|
12
12
|
|
|
13
|
+
const TEMP_DIR = 'temp_new'
|
|
14
|
+
const TEMPLATE_FILES = [
|
|
15
|
+
'package.json',
|
|
16
|
+
'vite.config.ts',
|
|
17
|
+
'eslint.config.ts',
|
|
18
|
+
'.prettierrc.json',
|
|
19
|
+
'tsconfig.json',
|
|
20
|
+
'index.html'
|
|
21
|
+
]
|
|
22
|
+
|
|
13
23
|
console.log('🔄 正在拉取最新模板...')
|
|
14
24
|
|
|
15
|
-
// 1.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
25
|
+
// 1. 清理旧临时目录(避免冲突)
|
|
26
|
+
if (existsSync(TEMP_DIR)) {
|
|
27
|
+
rmSync(TEMP_DIR, { recursive: true, force: true })
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 2. 静默创建最新模板(跳过所有交互)
|
|
31
|
+
try {
|
|
32
|
+
execSync(`pnpm create jnrs-vue@latest ${TEMP_DIR} -- --silent --no-git --no-install`, {
|
|
33
|
+
stdio: 'inherit',
|
|
34
|
+
env: {
|
|
35
|
+
...process.env,
|
|
36
|
+
// 强制非交互模式(部分脚手架识别此变量)
|
|
37
|
+
CI: 'true'
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
} catch {
|
|
41
|
+
console.error('❌ 模板拉取失败,请检查网络或 jnrs-vue 是否发布')
|
|
42
|
+
process.exit(1)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// 3. 合并 package.json(保留用户 scripts/dependencies 等)
|
|
46
|
+
try {
|
|
47
|
+
const currentPkg = JSON.parse(readFileSync('package.json', 'utf8'))
|
|
48
|
+
const newPkg = JSON.parse(readFileSync(join(TEMP_DIR, 'package.json'), ' utf8'))
|
|
49
|
+
|
|
50
|
+
// 保留用户字段:name, version, description, author, private, scripts, dependencies, devDependencies
|
|
51
|
+
const mergedPkg = {
|
|
52
|
+
...newPkg,
|
|
53
|
+
name: currentPkg.name,
|
|
54
|
+
version: currentPkg.version,
|
|
55
|
+
description: currentPkg.description,
|
|
56
|
+
author: currentPkg.author,
|
|
57
|
+
private: currentPkg.private,
|
|
58
|
+
scripts: { ...newPkg.scripts, ...currentPkg.scripts }, // 新脚本优先,但保留用户自定义
|
|
59
|
+
dependencies: { ...newPkg.dependencies, ...currentPgk.dependencies },
|
|
60
|
+
devDependencies: { ...newPkg.devDependencies, ...currentPkg.devDependencies }
|
|
61
|
+
}
|
|
19
62
|
|
|
20
|
-
|
|
21
|
-
|
|
63
|
+
writeFileSync('package.json', JSON.stringify(mergedPkg, null, 2) + '\n')
|
|
64
|
+
console.log('✅ 合并: package.json')
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.warn('⚠️ package.json 合并失败,跳过', error)
|
|
67
|
+
}
|
|
22
68
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
69
|
+
// 4. 同步其他配置文件
|
|
70
|
+
for (const file of TEMPLATE_FILES) {
|
|
71
|
+
const src = join(TEMP_DIR, file)
|
|
72
|
+
const dest = file
|
|
73
|
+
if (existsSync(src)) {
|
|
74
|
+
cpSync(src, dest, { force: true })
|
|
26
75
|
console.log(`✅ 同步: ${file}`)
|
|
27
|
-
}
|
|
28
|
-
console.warn(`⚠️ 跳过: ${file} (
|
|
76
|
+
} else {
|
|
77
|
+
console.warn(`⚠️ 跳过: ${file} (模板中不存在)`)
|
|
29
78
|
}
|
|
30
79
|
}
|
|
31
80
|
|
|
32
|
-
//
|
|
81
|
+
// 5. 提示用户
|
|
33
82
|
console.log('\n🔧 请运行:')
|
|
34
83
|
console.log(' pnpm install')
|
|
35
84
|
console.log('\n📝 注意:')
|
|
36
|
-
console.log(' - 检查 package.json
|
|
37
|
-
console.log(' - src/
|
|
85
|
+
console.log(' - 检查 package.json 中的依赖版本是否冲突')
|
|
86
|
+
console.log(' - src/ 目录未更新,请手动参考 temp_new/src 合并新功能(如有)')
|
|
87
|
+
console.log(' - 如使用 auto-imports.d.ts,可能需重新生成')
|
|
38
88
|
|
|
39
|
-
//
|
|
40
|
-
|
|
89
|
+
// 6. 清理
|
|
90
|
+
rmSync(TEMP_DIR, { recursive: true, force: true })
|
package/jnrs-vue/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jnrs-vue",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.24",
|
|
4
4
|
"description": "JNRS 信息化管理系统",
|
|
5
5
|
"author": "talia_tan",
|
|
6
6
|
"private": true,
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@element-plus/icons-vue": "^2.3.2",
|
|
22
|
-
"@jnrs/shared": "1.1.
|
|
23
|
-
"@jnrs/vue-core": "1.2.
|
|
24
|
-
"@jnrs/lingshu-smart": "2.2.
|
|
22
|
+
"@jnrs/shared": "1.1.17",
|
|
23
|
+
"@jnrs/vue-core": "1.2.12",
|
|
24
|
+
"@jnrs/lingshu-smart": "2.2.5",
|
|
25
25
|
"@vueuse/core": "^14.1.0",
|
|
26
26
|
"element-plus": "^2.13.3",
|
|
27
27
|
"pinia": "^3.0.4",
|
|
@@ -6,9 +6,8 @@ import { ref, onActivated, nextTick } from 'vue'
|
|
|
6
6
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
7
7
|
import { Plus } from '@element-plus/icons-vue'
|
|
8
8
|
import { useRoute } from '@jnrs/vue-core/router'
|
|
9
|
-
import { objectMatchAssign, dateFormatsToObject } from '@jnrs/shared'
|
|
9
|
+
import { objectMatchAssign, dateFormatsToObject, isNumberGtZero } from '@jnrs/shared'
|
|
10
10
|
import { debounce } from '@jnrs/shared/lodash'
|
|
11
|
-
import { isNumberGtZero } from '@jnrs/shared/validator'
|
|
12
11
|
import { getDictList, downloadFile, extractFieldId } from '@/utils'
|
|
13
12
|
import { useI18n } from '@/locales'
|
|
14
13
|
import {
|
|
@@ -6,7 +6,7 @@ import type { IMenuItem } from '@jnrs/vue-core'
|
|
|
6
6
|
import { hasPermission } from '@/utils/permissions'
|
|
7
7
|
import { MenuApi } from '@/api/system'
|
|
8
8
|
import { formatDateTime, formatWeekday } from '@jnrs/shared'
|
|
9
|
-
import {
|
|
9
|
+
import { verifyFloatGtZero } from '@jnrs/shared'
|
|
10
10
|
import { testI18n } from '@jnrs/shared/request'
|
|
11
11
|
|
|
12
12
|
const routeOptions = ref<IMenuItem[]>([])
|
|
@@ -48,14 +48,14 @@ const handleRouterSystemMine = () => {
|
|
|
48
48
|
|
|
49
49
|
const changeI18n = () => {
|
|
50
50
|
datetime.value = formatDateTime() + ' ' + formatWeekday()
|
|
51
|
-
|
|
51
|
+
verifyFloatGtZero({}, '0', (msg) => {
|
|
52
52
|
validator.value = msg
|
|
53
53
|
})
|
|
54
54
|
testI18nInCore.value = testI18n()
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
onMounted(() => {
|
|
58
|
-
|
|
58
|
+
verifyFloatGtZero({}, '0', (msg) => {
|
|
59
59
|
validator.value = msg
|
|
60
60
|
})
|
|
61
61
|
testI18nInCore.value = testI18n()
|
|
@@ -4,7 +4,7 @@ import { ref } from 'vue'
|
|
|
4
4
|
import { RoleApi, LoginApi } from '@/api/system'
|
|
5
5
|
import { useAuthStore } from '@/stores'
|
|
6
6
|
import { handleRouter, useRoute } from '@jnrs/vue-core/router'
|
|
7
|
-
import {
|
|
7
|
+
import { verifyWeakPwd } from '@jnrs/shared'
|
|
8
8
|
import { formatDateTime, formatWeekday } from '@jnrs/shared'
|
|
9
9
|
import { GlobalSetting } from '@jnrs/vue-core/components'
|
|
10
10
|
|
|
@@ -30,7 +30,7 @@ const rules = ref<FormRules>({
|
|
|
30
30
|
account: [{ required: true, message: '请输入用户名', trigger: 'change' }],
|
|
31
31
|
password: [
|
|
32
32
|
{ required: true, message: '请输入密码', trigger: 'change' },
|
|
33
|
-
{ validator:
|
|
33
|
+
{ validator: verifyWeakPwd, trigger: 'change' }
|
|
34
34
|
]
|
|
35
35
|
})
|
|
36
36
|
|
|
@@ -3,7 +3,7 @@ import { reactive, ref } from 'vue'
|
|
|
3
3
|
import { PasswordChangeApi } from '@/api/system'
|
|
4
4
|
import { useAuthStore } from '@/stores'
|
|
5
5
|
import { handleRouter } from '@jnrs/vue-core/router'
|
|
6
|
-
import {
|
|
6
|
+
import { verifyWeakPwd } from '@jnrs/shared'
|
|
7
7
|
import type { FormInstance, FormItemRule } from 'element-plus'
|
|
8
8
|
import { ElMessage } from 'element-plus'
|
|
9
9
|
import { LogoutApi } from '@/api/system'
|
|
@@ -21,7 +21,7 @@ const rules = reactive({
|
|
|
21
21
|
password: [
|
|
22
22
|
{ required: true, message: '请输入', trigger: 'change' },
|
|
23
23
|
{
|
|
24
|
-
validator:
|
|
24
|
+
validator: verifyWeakPwd,
|
|
25
25
|
trigger: 'change'
|
|
26
26
|
}
|
|
27
27
|
],
|
|
@@ -11,6 +11,26 @@
|
|
|
11
11
|
"permissions": ["menu:view"],
|
|
12
12
|
"abilityCoefficient": 0.0,
|
|
13
13
|
"dict": {
|
|
14
|
+
"projectType": [
|
|
15
|
+
{
|
|
16
|
+
"label": "瀑布型",
|
|
17
|
+
"value": 0,
|
|
18
|
+
"displayColor": "#65DC79",
|
|
19
|
+
"sequence": 1
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"label": "敏捷型",
|
|
23
|
+
"value": 1,
|
|
24
|
+
"displayColor": "#409EFF",
|
|
25
|
+
"sequence": 2
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"label": "混合型",
|
|
29
|
+
"value": 2,
|
|
30
|
+
"displayColor": "#F9DD4A",
|
|
31
|
+
"sequence": 3
|
|
32
|
+
}
|
|
33
|
+
],
|
|
14
34
|
"defectiveWorkHourStatus": [
|
|
15
35
|
{
|
|
16
36
|
"label": "等待",
|
package/package.json
CHANGED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 文件信息
|
|
3
|
-
*/
|
|
4
|
-
export interface IAttachment {
|
|
5
|
-
/**
|
|
6
|
-
* 数据 id
|
|
7
|
-
*/
|
|
8
|
-
id: number;
|
|
9
|
-
/**
|
|
10
|
-
* 文件 id
|
|
11
|
-
*/
|
|
12
|
-
documentId: number;
|
|
13
|
-
/**
|
|
14
|
-
* 文件名
|
|
15
|
-
*/
|
|
16
|
-
fileName: string;
|
|
17
|
-
/**
|
|
18
|
-
* 文件名唯一标识(用于文件获取 API)
|
|
19
|
-
*/
|
|
20
|
-
uniqueFileName: string;
|
|
21
|
-
/**
|
|
22
|
-
* MIME 类型
|
|
23
|
-
*/
|
|
24
|
-
fileType: string;
|
|
25
|
-
/**
|
|
26
|
-
* 文件大小 单位:字节(Bytes)
|
|
27
|
-
*/
|
|
28
|
-
fileSize: number;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* 文件容器(用于图片或附件)
|
|
32
|
-
*/
|
|
33
|
-
export interface IDocument {
|
|
34
|
-
id: number;
|
|
35
|
-
description: string | null;
|
|
36
|
-
attachments: IAttachment[];
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* 图片 & 附件数据
|
|
40
|
-
*/
|
|
41
|
-
export interface IFile {
|
|
42
|
-
/**
|
|
43
|
-
* 图片
|
|
44
|
-
*/
|
|
45
|
-
imageDocument?: IDocument;
|
|
46
|
-
/**
|
|
47
|
-
* 附件
|
|
48
|
-
*/
|
|
49
|
-
attachmentDocument?: IDocument;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* 分页
|
|
53
|
-
*/
|
|
54
|
-
export interface IPagination {
|
|
55
|
-
/**
|
|
56
|
-
* 当前页码
|
|
57
|
-
*/
|
|
58
|
-
pageNo: number;
|
|
59
|
-
/**
|
|
60
|
-
* 每页大小
|
|
61
|
-
*/
|
|
62
|
-
pageSize: number;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* 分页列表数据
|
|
66
|
-
*/
|
|
67
|
-
export interface IPageTableData<T = Record<string, any>> extends IPagination {
|
|
68
|
-
/**
|
|
69
|
-
* 数据列表
|
|
70
|
-
*/
|
|
71
|
-
list: T[];
|
|
72
|
-
/**
|
|
73
|
-
* 数据总数
|
|
74
|
-
*/
|
|
75
|
-
count: number;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* 用户信息
|
|
79
|
-
*/
|
|
80
|
-
export interface IUser {
|
|
81
|
-
id: number;
|
|
82
|
-
name: string;
|
|
83
|
-
role: number;
|
|
84
|
-
permissions?: string[];
|
|
85
|
-
jobTitle?: number;
|
|
86
|
-
workNo?: string;
|
|
87
|
-
workgroup?: string;
|
|
88
|
-
avatarFileName?: string;
|
|
89
|
-
[key: string]: unknown;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* 字典
|
|
93
|
-
*/
|
|
94
|
-
export interface IDictItem {
|
|
95
|
-
label: string;
|
|
96
|
-
value: string | number;
|
|
97
|
-
sequence: number;
|
|
98
|
-
displayColor?: string;
|
|
99
|
-
[key: string]: unknown;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* 字典键值对
|
|
103
|
-
*/
|
|
104
|
-
export interface IDict {
|
|
105
|
-
[key: string]: IDictItem[];
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* 角色
|
|
109
|
-
*/
|
|
110
|
-
export interface IRole {
|
|
111
|
-
label: string;
|
|
112
|
-
value: string | number;
|
|
113
|
-
permissions?: string[];
|
|
114
|
-
[key: string]: unknown;
|
|
115
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|