af-mobile-client-vue3 1.0.70 → 1.0.71
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/.cursorrules +61 -0
- package/package.json +1 -1
- package/src/components/core/XGridDropOption/index.vue +151 -132
- package/src/components/core/XMultiSelect/index.vue +183 -185
- package/src/components/core/XSelect/index.vue +122 -122
- package/src/components/data/XCellList/index.vue +116 -57
- package/src/components/data/XCellListFilter/index.vue +240 -230
- package/src/components/data/XForm/index.vue +27 -21
- package/src/components/data/XFormGroup/index.vue +96 -78
- package/src/components/data/XFormItem/index.vue +638 -595
- package/src/components/data/XReportForm/index.vue +19 -0
- package/src/components/data/XSignature/index.vue +285 -0
- package/src/router/routes.ts +12 -0
- package/src/utils/authority-utils.ts +0 -1
- package/src/utils/runEvalFunction.ts +13 -0
- package/src/views/component/XCellListView/index.vue +96 -57
- package/src/views/component/XFormGroupView/index.vue +54 -0
- package/src/views/component/XFormView/index.vue +170 -55
- package/src/views/component/XReportFormView/index.vue +2 -284
- package/src/views/component/XSignatureView/index.vue +50 -0
- package/src/views/component/index.vue +9 -1
- package/vite.config.ts +1 -1
package/.cursorrules
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# 你是一个编程TypeScript & Vue 3 & Vant4 高手 指导我写出高质量的代码
|
|
2
|
+
|
|
3
|
+
## 技术栈规范
|
|
4
|
+
- 首先基于 readme 文件了解项目内容
|
|
5
|
+
- 基于 Vue 3 + TypeScript + Vant 4 开发
|
|
6
|
+
- 使用 Composition API 和 `<script setup>` 语法
|
|
7
|
+
- 使用 Vite 作为构建工具
|
|
8
|
+
- 使用 Pinia 进行状态管理
|
|
9
|
+
|
|
10
|
+
## 代码风格
|
|
11
|
+
1. 组件编写
|
|
12
|
+
- 使用 Composition API 和 `<script setup>` 语法糖
|
|
13
|
+
- 组件名使用 PascalCase 命名
|
|
14
|
+
- 组件文件使用 .vue 扩展名
|
|
15
|
+
- 每个组件应该只包含一个根元素
|
|
16
|
+
|
|
17
|
+
2. TypeScript 规范
|
|
18
|
+
- 使用 TypeScript 类型标注
|
|
19
|
+
- 优先使用 interface 定义类型
|
|
20
|
+
- 使用 type 定义联合类型或交叉类型
|
|
21
|
+
- Props 必须指定类型
|
|
22
|
+
|
|
23
|
+
3. 命名规范
|
|
24
|
+
- 组件名: PascalCase (如 UserProfile)
|
|
25
|
+
- 变量名: camelCase (如 userName)
|
|
26
|
+
- 布尔值变量: 使用 is/has/should 前缀 (如 isLoading)
|
|
27
|
+
- 事件处理函数: 使用 handle 前缀 (如 handleSubmit)
|
|
28
|
+
- CSS 类名: 使用 kebab-case (如 user-profile)
|
|
29
|
+
|
|
30
|
+
4. 代码组织
|
|
31
|
+
- 按功能模块化组织代码
|
|
32
|
+
- 复用逻辑使用组合式函数 (composables)
|
|
33
|
+
- 保持单一职责原则
|
|
34
|
+
- 避免重复代码,提取共用逻辑
|
|
35
|
+
|
|
36
|
+
5. Vant 组件使用
|
|
37
|
+
- 按需引入 Vant 组件
|
|
38
|
+
- 使用 Vant 提供的类型定义
|
|
39
|
+
- 遵循 Vant 的设计规范
|
|
40
|
+
- 这是一个组件库项目 所以你不能使用自动导入 不能忽略 import,必须要显示声明import
|
|
41
|
+
|
|
42
|
+
6. 注释规范
|
|
43
|
+
- 组件顶部添加功能说明
|
|
44
|
+
- 复杂逻辑需要添加注释
|
|
45
|
+
- 类型定义需要添加注释
|
|
46
|
+
- API 接口需要添加注释
|
|
47
|
+
|
|
48
|
+
7. 性能优化
|
|
49
|
+
- 合理使用 computed 和 watch
|
|
50
|
+
- 避免不必要的组件渲染
|
|
51
|
+
- 使用 v-show 替代频繁切换的 v-if
|
|
52
|
+
- 大列表使用虚拟滚动
|
|
53
|
+
|
|
54
|
+
## 目录结构
|
|
55
|
+
遵循项目既定的目录结构:
|
|
56
|
+
- components/: 可复用组件
|
|
57
|
+
- views/: 页面组件
|
|
58
|
+
- composables/: 组合式函数
|
|
59
|
+
- stores/: Pinia 状态管理
|
|
60
|
+
- types/: TypeScript 类型定义
|
|
61
|
+
- utils/: 工具函数
|
package/package.json
CHANGED
|
@@ -1,132 +1,151 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
Checkbox as VanCheckbox,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from 'vant'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<
|
|
96
|
-
#
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { defineEmits, defineModel, defineProps } from 'vue'
|
|
3
|
+
import {
|
|
4
|
+
Button as VanButton,
|
|
5
|
+
Checkbox as VanCheckbox,
|
|
6
|
+
CheckboxGroup as VanCheckboxGroup,
|
|
7
|
+
Grid as VanGrid,
|
|
8
|
+
GridItem as VanGridItem,
|
|
9
|
+
Radio as VanRadio,
|
|
10
|
+
RadioGroup as VanRadioGroup,
|
|
11
|
+
} from 'vant'
|
|
12
|
+
|
|
13
|
+
interface ColumnItem {
|
|
14
|
+
[key: string]: string | number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ColumnsFieldNames {
|
|
18
|
+
text: string
|
|
19
|
+
value: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const props = defineProps({
|
|
23
|
+
columns: {
|
|
24
|
+
type: Array as () => ColumnItem[],
|
|
25
|
+
default: () => [] as ColumnItem[],
|
|
26
|
+
},
|
|
27
|
+
columnsFieldNames: {
|
|
28
|
+
type: Object as () => ColumnsFieldNames,
|
|
29
|
+
default: () => ({
|
|
30
|
+
text: 'label',
|
|
31
|
+
value: 'value',
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
gutter: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: 8,
|
|
37
|
+
},
|
|
38
|
+
columnNum: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: 4,
|
|
41
|
+
},
|
|
42
|
+
multiple: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false,
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const emit = defineEmits<{
|
|
49
|
+
change: [value: string | string[], list: ColumnItem[]]
|
|
50
|
+
}>()
|
|
51
|
+
|
|
52
|
+
const checked = defineModel<string | string[]>()
|
|
53
|
+
|
|
54
|
+
function classSel(colRow: ColumnItem): boolean {
|
|
55
|
+
if (typeof checked.value === 'string' || Array.isArray(checked.value))
|
|
56
|
+
return checked.value.includes(String(colRow[props.columnsFieldNames.value]))
|
|
57
|
+
else if (typeof checked.value === 'undefined')
|
|
58
|
+
return false
|
|
59
|
+
else
|
|
60
|
+
return checked.value === String(colRow[props.columnsFieldNames.value])
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function valueChange(value: string | string[]) {
|
|
64
|
+
const list = props.columns.filter((item) => {
|
|
65
|
+
if (props.multiple)
|
|
66
|
+
return value.includes(String(item[props.columnsFieldNames.value]))
|
|
67
|
+
|
|
68
|
+
else
|
|
69
|
+
return value === item[props.columnsFieldNames.value]
|
|
70
|
+
})
|
|
71
|
+
emit('change', value, list)
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<div id="XGridDropOption">
|
|
77
|
+
<template v-if="props.multiple">
|
|
78
|
+
<VanCheckboxGroup v-model="checked as string[]" direction="horizontal" @change="valueChange">
|
|
79
|
+
<VanGrid :gutter="props.gutter" :border="false" :column-num="props.columnNum">
|
|
80
|
+
<VanGridItem v-for="colRow in props.columns" :key="colRow[props.columnsFieldNames.text]">
|
|
81
|
+
<template #default>
|
|
82
|
+
<VanCheckbox :name="colRow[props.columnsFieldNames.value]">
|
|
83
|
+
<VanButton type="default" size="small" :class="{ 'select-text-col': classSel(colRow) }">
|
|
84
|
+
{{ colRow[props.columnsFieldNames.text] }}
|
|
85
|
+
</VanButton>
|
|
86
|
+
</VanCheckbox>
|
|
87
|
+
</template>
|
|
88
|
+
</VanGridItem>
|
|
89
|
+
</VanGrid>
|
|
90
|
+
</VanCheckboxGroup>
|
|
91
|
+
</template>
|
|
92
|
+
<template v-else>
|
|
93
|
+
<VanRadioGroup v-model="checked" direction="horizontal" @change="valueChange">
|
|
94
|
+
<VanGrid :gutter="props.gutter" :border="false" :column-num="props.columnNum">
|
|
95
|
+
<VanGridItem v-for="colRow in props.columns" :key="colRow[props.columnsFieldNames.text]">
|
|
96
|
+
<template #default>
|
|
97
|
+
<VanRadio :name="colRow[props.columnsFieldNames.value]">
|
|
98
|
+
<VanButton type="default" size="small" :class="{ 'select-text-col': classSel(colRow) }">
|
|
99
|
+
{{ colRow[props.columnsFieldNames.text] }}
|
|
100
|
+
</VanButton>
|
|
101
|
+
</VanRadio>
|
|
102
|
+
</template>
|
|
103
|
+
</VanGridItem>
|
|
104
|
+
</VanGrid>
|
|
105
|
+
</VanRadioGroup>
|
|
106
|
+
</template>
|
|
107
|
+
</div>
|
|
108
|
+
</template>
|
|
109
|
+
|
|
110
|
+
<style scoped lang="less">
|
|
111
|
+
#XGridDropOption {
|
|
112
|
+
width: 100%;
|
|
113
|
+
--van-grid-item-content-padding: 2px;
|
|
114
|
+
--van-padding-sm: 0px;
|
|
115
|
+
--van-checkbox-label-margin: 0px;
|
|
116
|
+
--van-radio-label-margin: 0px;
|
|
117
|
+
--van-button-default-border-color: 'rgb(247,248,250)';
|
|
118
|
+
|
|
119
|
+
.van-grid {
|
|
120
|
+
width: 100%;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.select-text-col {
|
|
124
|
+
color: blue;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
:deep(.van-checkbox__icon) {
|
|
128
|
+
display: none;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
:deep(.van-checkbox) {
|
|
132
|
+
width: 100%;
|
|
133
|
+
}
|
|
134
|
+
:deep(.van-radio__icon) {
|
|
135
|
+
display: none;
|
|
136
|
+
}
|
|
137
|
+
:deep(.van-radio) {
|
|
138
|
+
width: 100%;
|
|
139
|
+
}
|
|
140
|
+
:deep(.van-button) {
|
|
141
|
+
width: 100%;
|
|
142
|
+
background-color: rgb(247,248,250);
|
|
143
|
+
}
|
|
144
|
+
:deep(.van-checkbox__label) {
|
|
145
|
+
width: 100%;
|
|
146
|
+
}
|
|
147
|
+
:deep(.van-radio__label) {
|
|
148
|
+
width: 100%;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
</style>
|