af-mobile-client-vue3 1.3.42 → 1.3.44

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/package.json CHANGED
@@ -1,115 +1,115 @@
1
- {
2
- "name": "af-mobile-client-vue3",
3
- "type": "module",
4
- "version": "1.3.42",
5
- "packageManager": "pnpm@10.13.1",
6
- "description": "Vue + Vite component lib",
7
- "engines": {
8
- "node": ">=20.19.0"
9
- },
10
- "scripts": {
11
- "dev": "cross-env MOCK_SERVER_PORT=8086 vite",
12
- "compress": "node ./compress.js",
13
- "build:dev": "vue-tsc --noEmit && vite build --mode development && pnpm run compress",
14
- "build:pro": "vue-tsc --noEmit && vite build --mode production && pnpm run compress",
15
- "preview": "vite preview",
16
- "lint": "eslint .",
17
- "lint:fix": "eslint . --fix",
18
- "release": "bumpp --commit --push --tag",
19
- "typecheck": "vue-tsc --noEmit",
20
- "commitlint": "commitlint --edit",
21
- "prepare": "simple-git-hooks"
22
- },
23
- "dependencies": {
24
- "@iconify/vue": "4.3.0",
25
- "@micro-zoe/micro-app": "1.0.0-rc.26",
26
- "@unhead/vue": "2.0.12",
27
- "@vant/area-data": "^2.0.0",
28
- "@vant/touch-emulator": "^1.4.0",
29
- "@vant/use": "^1.6.0",
30
- "@vueuse/core": "^13.5.0",
31
- "axios": "^1.10.0",
32
- "crypto-js": "^4.2.0",
33
- "dayjs": "^1.11.13",
34
- "echarts": "^5.6.0",
35
- "lodash-es": "^4.17.21",
36
- "nprogress": "^0.2.0",
37
- "ol": "^10.5.0",
38
- "pinia": "^3.0.3",
39
- "pinia-plugin-persistedstate": "^4.4.1",
40
- "resize-detector": "^0.3.0",
41
- "vant": "^4.9.21",
42
- "vconsole": "^3.15.1",
43
- "vue": "^3.5.17",
44
- "vue-i18n": "^11.1.10",
45
- "vue-router": "^4.5.1",
46
- "vue3-hash-calendar": "^1.1.3",
47
- "weixin-js-sdk": "^1.6.5"
48
- },
49
- "devDependencies": {
50
- "@antfu/eslint-config": "4.17.0",
51
- "@commitlint/cli": "^19.8.1",
52
- "@commitlint/config-conventional": "^19.8.1",
53
- "@commitlint/types": "^19.8.1",
54
- "@iconify/json": "2.2.318",
55
- "@iconify/utils": "^2.3.0",
56
- "@intlify/unplugin-vue-i18n": "^6.0.8",
57
- "@types/crypto-js": "^4.2.2",
58
- "@types/lodash-es": "^4.17.12",
59
- "@types/node": "^24.0.14",
60
- "@types/nprogress": "^0.2.3",
61
- "@unocss/eslint-config": "66.3.3",
62
- "@vitejs/plugin-legacy": "^7.0.1",
63
- "@vitejs/plugin-vue": "^6.0.0",
64
- "autoprefixer": "^10.4.21",
65
- "bumpp": "^10.2.0",
66
- "consola": "^3.4.2",
67
- "cross-env": "^7.0.3",
68
- "eslint": "^9.31.0",
69
- "eslint-plugin-format": "^1.0.1",
70
- "less": "^4.4.0",
71
- "lint-staged": "^16.1.2",
72
- "mockjs": "^1.1.0",
73
- "postcss-mobile-forever": "^5.0.0",
74
- "rollup": "^4.45.1",
75
- "simple-git-hooks": "^2.13.0",
76
- "tar": "^7.4.3",
77
- "terser": "^5.43.1",
78
- "typescript": "^5.8.3",
79
- "unocss": "66.3.3",
80
- "vite": "^7.0.5",
81
- "vite-plugin-compression": "^0.5.1",
82
- "vite-plugin-mock-dev-server": "^1.9.1",
83
- "vite-plugin-pwa": "^1.0.1",
84
- "vite-plugin-sitemap": "^0.8.2",
85
- "vite-plugin-vconsole": "^2.1.1",
86
- "vite-plugin-vue-devtools": "^7.7.7",
87
- "vue-tsc": "^3.0.2"
88
- },
89
- "pnpm": {
90
- "allowedDeprecatedVersions": {
91
- "glob": "7.2.3",
92
- "inflight": "1.0.6",
93
- "sourcemap-codec": "1.4.8"
94
- },
95
- "peerDependencyRules": {
96
- "allowedVersions": {}
97
- },
98
- "onlyBuiltDependencies": [
99
- "core-js",
100
- "esbuild",
101
- "simple-git-hooks",
102
- "unrs-resolver"
103
- ]
104
- },
105
- "resolutions": {
106
- "vite": "^7.0.5"
107
- },
108
- "simple-git-hooks": {
109
- "pre-commit": "pnpm lint-staged",
110
- "commit-msg": "pnpm commitlint $1"
111
- },
112
- "lint-staged": {
113
- "*": "eslint --fix"
114
- }
115
- }
1
+ {
2
+ "name": "af-mobile-client-vue3",
3
+ "type": "module",
4
+ "version": "1.3.44",
5
+ "packageManager": "pnpm@10.13.1",
6
+ "description": "Vue + Vite component lib",
7
+ "engines": {
8
+ "node": ">=20.19.0"
9
+ },
10
+ "scripts": {
11
+ "dev": "cross-env MOCK_SERVER_PORT=8086 vite",
12
+ "compress": "node ./compress.js",
13
+ "build:dev": "vue-tsc --noEmit && vite build --mode development && pnpm run compress",
14
+ "build:pro": "vue-tsc --noEmit && vite build --mode production && pnpm run compress",
15
+ "preview": "vite preview",
16
+ "lint": "eslint .",
17
+ "lint:fix": "eslint . --fix",
18
+ "release": "bumpp --commit --push --tag",
19
+ "typecheck": "vue-tsc --noEmit",
20
+ "commitlint": "commitlint --edit",
21
+ "prepare": "simple-git-hooks"
22
+ },
23
+ "dependencies": {
24
+ "@iconify/vue": "4.3.0",
25
+ "@micro-zoe/micro-app": "1.0.0-rc.26",
26
+ "@unhead/vue": "2.0.12",
27
+ "@vant/area-data": "^2.0.0",
28
+ "@vant/touch-emulator": "^1.4.0",
29
+ "@vant/use": "^1.6.0",
30
+ "@vueuse/core": "^13.5.0",
31
+ "axios": "^1.10.0",
32
+ "crypto-js": "^4.2.0",
33
+ "dayjs": "^1.11.13",
34
+ "echarts": "^5.6.0",
35
+ "lodash-es": "^4.17.21",
36
+ "nprogress": "^0.2.0",
37
+ "ol": "^10.5.0",
38
+ "pinia": "^3.0.3",
39
+ "pinia-plugin-persistedstate": "^4.4.1",
40
+ "resize-detector": "^0.3.0",
41
+ "vant": "^4.9.21",
42
+ "vconsole": "^3.15.1",
43
+ "vue": "^3.5.17",
44
+ "vue-i18n": "^11.1.10",
45
+ "vue-router": "^4.5.1",
46
+ "vue3-hash-calendar": "^1.1.3",
47
+ "weixin-js-sdk": "^1.6.5"
48
+ },
49
+ "devDependencies": {
50
+ "@antfu/eslint-config": "4.17.0",
51
+ "@commitlint/cli": "^19.8.1",
52
+ "@commitlint/config-conventional": "^19.8.1",
53
+ "@commitlint/types": "^19.8.1",
54
+ "@iconify/json": "2.2.318",
55
+ "@iconify/utils": "^2.3.0",
56
+ "@intlify/unplugin-vue-i18n": "^6.0.8",
57
+ "@types/crypto-js": "^4.2.2",
58
+ "@types/lodash-es": "^4.17.12",
59
+ "@types/node": "^24.0.14",
60
+ "@types/nprogress": "^0.2.3",
61
+ "@unocss/eslint-config": "66.3.3",
62
+ "@vitejs/plugin-legacy": "^7.0.1",
63
+ "@vitejs/plugin-vue": "^6.0.0",
64
+ "autoprefixer": "^10.4.21",
65
+ "bumpp": "^10.2.0",
66
+ "consola": "^3.4.2",
67
+ "cross-env": "^7.0.3",
68
+ "eslint": "^9.31.0",
69
+ "eslint-plugin-format": "^1.0.1",
70
+ "less": "^4.4.0",
71
+ "lint-staged": "^16.1.2",
72
+ "mockjs": "^1.1.0",
73
+ "postcss-mobile-forever": "^5.0.0",
74
+ "rollup": "^4.45.1",
75
+ "simple-git-hooks": "^2.13.0",
76
+ "tar": "^7.4.3",
77
+ "terser": "^5.43.1",
78
+ "typescript": "^5.8.3",
79
+ "unocss": "66.3.3",
80
+ "vite": "^7.0.5",
81
+ "vite-plugin-compression": "^0.5.1",
82
+ "vite-plugin-mock-dev-server": "^1.9.1",
83
+ "vite-plugin-pwa": "^1.0.1",
84
+ "vite-plugin-sitemap": "^0.8.2",
85
+ "vite-plugin-vconsole": "^2.1.1",
86
+ "vite-plugin-vue-devtools": "^7.7.7",
87
+ "vue-tsc": "^3.0.2"
88
+ },
89
+ "pnpm": {
90
+ "allowedDeprecatedVersions": {
91
+ "glob": "7.2.3",
92
+ "inflight": "1.0.6",
93
+ "sourcemap-codec": "1.4.8"
94
+ },
95
+ "peerDependencyRules": {
96
+ "allowedVersions": {}
97
+ },
98
+ "onlyBuiltDependencies": [
99
+ "core-js",
100
+ "esbuild",
101
+ "simple-git-hooks",
102
+ "unrs-resolver"
103
+ ]
104
+ },
105
+ "resolutions": {
106
+ "vite": "^7.0.5"
107
+ },
108
+ "simple-git-hooks": {
109
+ "pre-commit": "pnpm lint-staged",
110
+ "commit-msg": "pnpm commitlint $1"
111
+ },
112
+ "lint-staged": {
113
+ "*": "eslint --fix"
114
+ }
115
+ }
@@ -39,6 +39,7 @@ interface GroupFormItems {
39
39
  tableName?: string
40
40
  paramLogicName?: string
41
41
  isGroupForm?: boolean
42
+ isKeyHandle?: boolean
42
43
  }
43
44
 
44
45
  interface InitParams {
@@ -85,6 +86,7 @@ const loaded = ref(false)
85
86
  const form = ref({})
86
87
  const rules = reactive({})
87
88
  const myGetDataParams = ref({})
89
+ const isKeyHandle = ref(false)
88
90
 
89
91
  // 配置相关状态
90
92
  const formConfig = ref<GroupFormItems | null>(null)
@@ -92,7 +94,7 @@ const formGroupName = ref<string>('default')
92
94
  const myServiceName = ref('')
93
95
  const tableName = ref('')
94
96
 
95
- // 计算属性
97
+ // 计算属性(获取全部表单项信息)
96
98
  const realJsonData = computed(() => {
97
99
  const sourceFormItems = formConfig.value?.formJson
98
100
  if (!sourceFormItems)
@@ -103,6 +105,13 @@ const realJsonData = computed(() => {
103
105
  })
104
106
  })
105
107
 
108
+ // 过滤出用于新增/修改/只读场景的表单项
109
+ const addOrEditJsonData = computed(() => {
110
+ return realJsonData.value.filter((item) => {
111
+ return item.addOrEdit === 'all' || item.addOrEdit === 'add' || item.addOrEdit === 'edit' || item.addOrEdit === 'readonly'
112
+ })
113
+ })
114
+
106
115
  // 过滤出用于静默新增场景的表单项
107
116
  const silenceAddJsonData = computed(() => {
108
117
  return realJsonData.value.filter((item) => {
@@ -208,6 +217,7 @@ async function initWithGroupFormItems() {
208
217
  function setupFormConfig(config: GroupFormItems) {
209
218
  loadParamLogicNameData(config.paramLogicName)
210
219
  formConfig.value = config
220
+ isKeyHandle.value = config.isKeyHandle
211
221
  myServiceName.value = props.serviceName || undefined
212
222
  formGroupName.value = config.groupName || 'default'
213
223
  form.value = props.formData || {}
@@ -388,9 +398,10 @@ function getRealKey(key: string, mustHandleKey = false) {
388
398
  async function asyncSubmit() {
389
399
  return new Promise((resolve, reject) => {
390
400
  validate().then(async () => {
391
- const cleanedForm = prepareForm()
392
- await appendSilenceAddFields(cleanedForm)
393
- const realForm = handleFormKeys(cleanedForm)
401
+ let realForm = prepareForm()
402
+ await appendSilenceAddFields(realForm)
403
+ if (isKeyHandle.value)
404
+ realForm = handleFormKeys(realForm)
394
405
  resolve({
395
406
  realForm,
396
407
  mode: props.mode,
@@ -545,11 +556,11 @@ function getFormData() {
545
556
  async function onSubmit() {
546
557
  await validate()
547
558
  // 清理表单数据
548
- const cleanedForm = prepareForm()
559
+ let realForm = prepareForm()
560
+ await appendSilenceAddFields(realForm)
549
561
  if (!props.configName && props.groupFormItems) {
550
562
  // 只有单表才可以成功,多表关联或者自定义sql不行
551
- await appendSilenceAddFields(cleanedForm)
552
- const realForm = handleFormKeys(cleanedForm)
563
+ realForm = handleFormKeys(realForm)
553
564
 
554
565
  try {
555
566
  addOrModifyEntity(realForm, tableName.value, props.serviceName || import.meta.env.VITE_APP_SYSTEM_NAME).then(() => {
@@ -566,8 +577,10 @@ async function onSubmit() {
566
577
  }
567
578
  }
568
579
  else {
580
+ if (isKeyHandle.value)
581
+ realForm = handleFormKeys(realForm)
569
582
  // 使用清理后的数据
570
- emits('onSubmit', cleanedForm)
583
+ emits('onSubmit', realForm)
571
584
  }
572
585
  }
573
586
  async function validate() {
@@ -586,7 +599,7 @@ defineExpose({ init, form, formGroupName, validate, asyncSubmit, setForm, getFor
586
599
  <div class="form-fields-scrollable">
587
600
  <VanCellGroup :title="groupTitle">
588
601
  <XFormItem
589
- v-for="(item, index) in realJsonData"
602
+ v-for="(item, index) in addOrEditJsonData"
590
603
  :key="index"
591
604
  v-model="form[item.model]"
592
605
  :mode="props.mode"
@@ -1,60 +1,60 @@
1
- /**
2
- * 外部用户路由配置(简化版示例)
3
- * 为外部用户提供基本的示例页面
4
- */
5
-
6
- import type { RouteRecordRaw } from 'vue-router'
7
-
8
- // 导入外部用户专用组件
9
- import ExternalHome from '@af-mobile-client-vue3/views/external/index.vue'
10
- import my from '@af-mobile-client-vue3/views/user/my/index.vue'
11
-
12
- /**
13
- * 外部用户路由元信息的默认配置
14
- */
15
- const externalUserMeta = {
16
- requiresAuth: true,
17
- allowExternalUser: true,
18
- }
19
-
20
- /**
21
- * 外部用户专用路由(简化版示例)
22
- */
23
- const externalUserRoutes: Array<RouteRecordRaw> = [
24
- // 外部用户首页
25
- {
26
- path: '/wechat',
27
- name: 'ExternalHome',
28
- component: ExternalHome,
29
- meta: {
30
- ...externalUserMeta,
31
- title: '外部用户首页',
32
- },
33
- },
34
- // 用户个人中心
35
- {
36
- path: '/wechat/my',
37
- name: 'ExternalUserProfile',
38
- component: my,
39
- meta: {
40
- ...externalUserMeta,
41
- title: '个人中心',
42
- },
43
- },
44
- ]
45
-
46
- /**
47
- * 获取外部用户可访问的路由列表
48
- */
49
- export function getExternalUserRoutes(): RouteRecordRaw[] {
50
- return externalUserRoutes
51
- }
52
-
53
- /**
54
- * 检查路由是否为外部用户路由
55
- */
56
- export function isExternalUserRoute(path: string): boolean {
57
- return path.startsWith('/ex')
58
- }
59
-
60
- export default externalUserRoutes
1
+ /**
2
+ * 外部用户路由配置(简化版示例)
3
+ * 为外部用户提供基本的示例页面
4
+ */
5
+
6
+ import type { RouteRecordRaw } from 'vue-router'
7
+
8
+ // 导入外部用户专用组件
9
+ import ExternalHome from '@af-mobile-client-vue3/views/external/index.vue'
10
+ import my from '@af-mobile-client-vue3/views/user/my/index.vue'
11
+
12
+ /**
13
+ * 外部用户路由元信息的默认配置
14
+ */
15
+ const externalUserMeta = {
16
+ requiresAuth: true,
17
+ allowExternalUser: true,
18
+ }
19
+
20
+ /**
21
+ * 外部用户专用路由(简化版示例)
22
+ */
23
+ const externalUserRoutes: Array<RouteRecordRaw> = [
24
+ // 外部用户首页
25
+ {
26
+ path: '/wechat',
27
+ name: 'ExternalHome',
28
+ component: ExternalHome,
29
+ meta: {
30
+ ...externalUserMeta,
31
+ title: '外部用户首页',
32
+ },
33
+ },
34
+ // 用户个人中心
35
+ {
36
+ path: '/wechat/my',
37
+ name: 'ExternalUserProfile',
38
+ component: my,
39
+ meta: {
40
+ ...externalUserMeta,
41
+ title: '个人中心',
42
+ },
43
+ },
44
+ ]
45
+
46
+ /**
47
+ * 获取外部用户可访问的路由列表
48
+ */
49
+ export function getExternalUserRoutes(): RouteRecordRaw[] {
50
+ return externalUserRoutes
51
+ }
52
+
53
+ /**
54
+ * 检查路由是否为外部用户路由
55
+ */
56
+ export function isExternalUserRoute(path: string): boolean {
57
+ return path.startsWith('/ex/')
58
+ }
59
+
60
+ export default externalUserRoutes