vue2-client 1.12.96 → 1.12.98
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 +107 -107
- package/src/base-client/components/common/XCollapse/XCollapse.vue +5 -1
- package/src/base-client/components/common/XReportGrid/XReportTrGroup.vue +710 -709
- package/src/base-client/components/his/XCheckbox/XCheckbox.vue +105 -0
- package/src/base-client/components/his/XCheckbox/index.md +254 -0
- package/src/base-client/components/his/XList/XList.vue +1 -1
- package/src/pages/userInfoDetailManage/uploadFilesHistory/index.vue +1 -1
- package/src/pages/userInfoDetailManage/userInfoDetailQueryTabs.vue +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="x-checkbox-container">
|
|
3
|
+
<a-checkbox-group v-model="innerValue" @change="onChange" class="x-checkbox-group">
|
|
4
|
+
<div v-for="item in data" :key="item.value" class="x-checkbox-item-container">
|
|
5
|
+
<a-checkbox :value="item.value" class="x-checkbox-item">
|
|
6
|
+
{{ item.label }}
|
|
7
|
+
</a-checkbox>
|
|
8
|
+
</div>
|
|
9
|
+
</a-checkbox-group>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
15
|
+
import { Checkbox } from 'ant-design-vue'
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: 'XCheckbox',
|
|
19
|
+
components: {
|
|
20
|
+
ACheckboxGroup: Checkbox.Group,
|
|
21
|
+
ACheckbox: Checkbox
|
|
22
|
+
},
|
|
23
|
+
props: {
|
|
24
|
+
queryParamsName: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: null
|
|
27
|
+
},
|
|
28
|
+
value: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: () => []
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
data () {
|
|
34
|
+
return {
|
|
35
|
+
data: [],
|
|
36
|
+
innerValue: [],
|
|
37
|
+
config: null
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
created () {
|
|
41
|
+
this.getData(this.queryParamsName)
|
|
42
|
+
},
|
|
43
|
+
watch: {
|
|
44
|
+
value: {
|
|
45
|
+
handler (val) {
|
|
46
|
+
this.innerValue = val
|
|
47
|
+
},
|
|
48
|
+
deep: true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
emits: ['change', 'init'],
|
|
52
|
+
methods: {
|
|
53
|
+
async getData (data) {
|
|
54
|
+
getConfigByName(data, 'af-his', res => {
|
|
55
|
+
// 1. 加载选项
|
|
56
|
+
if (res.checkbox && Array.isArray(res.checkbox)) {
|
|
57
|
+
this.data = res.checkbox
|
|
58
|
+
// 2. 初始化默认值(优先级: 配置defaultValue > 空数组)
|
|
59
|
+
if (res.defaultValue !== undefined && Array.isArray(res.defaultValue)) {
|
|
60
|
+
this.innerValue = res.defaultValue
|
|
61
|
+
}
|
|
62
|
+
// 3. 触发初始化事件
|
|
63
|
+
this.$emit('init', {
|
|
64
|
+
config: res,
|
|
65
|
+
options: this.data,
|
|
66
|
+
value: this.innerValue
|
|
67
|
+
})
|
|
68
|
+
} else {
|
|
69
|
+
this.$message.error('配置错误,checkbox字段不是数组')
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
},
|
|
73
|
+
onChange (checkedValues) {
|
|
74
|
+
this.innerValue = checkedValues
|
|
75
|
+
this.$emit('change', checkedValues)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<style scoped>
|
|
82
|
+
.x-checkbox-container {
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.x-checkbox-group {
|
|
88
|
+
display: flex;
|
|
89
|
+
justify-content: space-around;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.x-checkbox-item-container {
|
|
93
|
+
flex: 1;
|
|
94
|
+
display: flex;
|
|
95
|
+
flex-direction: column;
|
|
96
|
+
align-items: center;
|
|
97
|
+
text-align: center;
|
|
98
|
+
padding: 0 8px;
|
|
99
|
+
box-sizing: border-box;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.x-checkbox-item {
|
|
103
|
+
margin-bottom: 8px;
|
|
104
|
+
}
|
|
105
|
+
</style>
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# XCheckbox
|
|
2
|
+
|
|
3
|
+
基于配置的多选框组件,支持从配置中动态加载选项和默认值。
|
|
4
|
+
|
|
5
|
+
## 何时使用
|
|
6
|
+
|
|
7
|
+
当需要一个通过配置动态加载的多选控件时使用,特别是选项需要从后端获取的场景。
|
|
8
|
+
|
|
9
|
+
## 引用方式
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
import XCheckbox from '@vue2-client/base-client/components/his/XCheckbox/XCheckbox'
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
components: {
|
|
16
|
+
XCheckbox
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 代码演示
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<x-checkbox
|
|
25
|
+
:queryParamsName="checkboxConfigName"
|
|
26
|
+
v-model="selectedValues"
|
|
27
|
+
@change="handleChange"
|
|
28
|
+
@init="handleInit">
|
|
29
|
+
</x-checkbox>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
35
|
+
|------|------|------|------|
|
|
36
|
+
| queryParamsName | 查询配置名称 | String/Object | null |
|
|
37
|
+
| value (v-model) | 当前选中值数组 | Array | [] |
|
|
38
|
+
|
|
39
|
+
### 事件
|
|
40
|
+
|
|
41
|
+
| 事件名 | 说明 | 回调参数 |
|
|
42
|
+
|------|------|------|
|
|
43
|
+
| change | 选项变化时的回调 | function(checkedValues: array) |
|
|
44
|
+
| init | 组件初始化完成时的回调 | function({config, options, value}) |
|
|
45
|
+
|
|
46
|
+
## 配置说明
|
|
47
|
+
|
|
48
|
+
组件通过 `queryParamsName` 从后端获取配置,配置格式如下:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"checkbox": [
|
|
53
|
+
{
|
|
54
|
+
"label": "选项A",
|
|
55
|
+
"value": 1
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"label": "选项B",
|
|
59
|
+
"value": 2
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"label": "选项C",
|
|
63
|
+
"value": 3
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"defaultValue": [1, 2]
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 配置示例
|
|
71
|
+
|
|
72
|
+
### 基本配置
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"checkbox": [
|
|
77
|
+
{
|
|
78
|
+
"label": "全部",
|
|
79
|
+
"value": "all"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"label": "已过期",
|
|
83
|
+
"value": "expired"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"label": "30天内",
|
|
87
|
+
"value": "30days"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"label": "90天内",
|
|
91
|
+
"value": "90days"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"defaultValue": ["all"]
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 带禁用选项的配置
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"checkbox": [
|
|
103
|
+
{
|
|
104
|
+
"label": "选项A",
|
|
105
|
+
"value": "a",
|
|
106
|
+
"disabled": false
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"label": "选项B",
|
|
110
|
+
"value": "b",
|
|
111
|
+
"disabled": true
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"label": "选项C",
|
|
115
|
+
"value": "c",
|
|
116
|
+
"disabled": false
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"defaultValue": ["a"]
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## 使用示例
|
|
124
|
+
|
|
125
|
+
### 1. 基础使用
|
|
126
|
+
|
|
127
|
+
```html
|
|
128
|
+
<template>
|
|
129
|
+
<x-checkbox
|
|
130
|
+
:queryParamsName="'MyCheckboxConfig'"
|
|
131
|
+
v-model="selectedValues"
|
|
132
|
+
@change="onChange"
|
|
133
|
+
/>
|
|
134
|
+
</template>
|
|
135
|
+
|
|
136
|
+
<script>
|
|
137
|
+
export default {
|
|
138
|
+
data() {
|
|
139
|
+
return {
|
|
140
|
+
selectedValues: []
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
methods: {
|
|
144
|
+
onChange(checkedValues) {
|
|
145
|
+
console.log('选中的值:', checkedValues)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
</script>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 2. 带初始值的使用
|
|
153
|
+
|
|
154
|
+
```html
|
|
155
|
+
<template>
|
|
156
|
+
<x-checkbox
|
|
157
|
+
:queryParamsName="checkboxConfig"
|
|
158
|
+
v-model="selectedValues"
|
|
159
|
+
@change="onChange"
|
|
160
|
+
@init="onInit"
|
|
161
|
+
/>
|
|
162
|
+
</template>
|
|
163
|
+
|
|
164
|
+
<script>
|
|
165
|
+
export default {
|
|
166
|
+
data() {
|
|
167
|
+
return {
|
|
168
|
+
selectedValues: ['a', 'b'],
|
|
169
|
+
checkboxConfig: {
|
|
170
|
+
checkbox: [
|
|
171
|
+
{ label: '选项A', value: 'a' },
|
|
172
|
+
{ label: '选项B', value: 'b' },
|
|
173
|
+
{ label: '选项C', value: 'c' }
|
|
174
|
+
],
|
|
175
|
+
defaultValue: ['a', 'b']
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
methods: {
|
|
180
|
+
onChange(checkedValues) {
|
|
181
|
+
console.log('选中的值:', checkedValues)
|
|
182
|
+
},
|
|
183
|
+
onInit({ config, options, value }) {
|
|
184
|
+
console.log('组件初始化完成', { config, options, value })
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
</script>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## 注意事项
|
|
192
|
+
|
|
193
|
+
1. 如果配置中有 `defaultValue`,组件将默认选中这些值
|
|
194
|
+
2. `defaultValue` 必须是数组类型
|
|
195
|
+
3. 选项的 `value` 值必须是唯一的
|
|
196
|
+
4. 可以通过 `v-model` 或 `value` 属性从外部控制选中值
|
|
197
|
+
5. 组件会自动处理选项的禁用状态
|
|
198
|
+
6. 所有的事件回调都会返回选中值的数组
|
|
199
|
+
|
|
200
|
+
## 常见问题解答(FAQ)
|
|
201
|
+
|
|
202
|
+
### 1. 如何设置默认选中的选项?
|
|
203
|
+
|
|
204
|
+
可以通过配置中的 `defaultValue` 字段设置:
|
|
205
|
+
```json
|
|
206
|
+
{
|
|
207
|
+
"defaultValue": ["value1", "value2"]
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
或者通过 v-model 绑定:
|
|
212
|
+
```html
|
|
213
|
+
<x-checkbox v-model="selectedValues"></x-checkbox>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
```javascript
|
|
217
|
+
export default {
|
|
218
|
+
data() {
|
|
219
|
+
return {
|
|
220
|
+
selectedValues: ["value1", "value2"]
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### 2. 如何禁用某些选项?
|
|
227
|
+
|
|
228
|
+
在选项配置中添加 `disabled` 属性:
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"checkbox": [
|
|
232
|
+
{
|
|
233
|
+
"label": "选项A",
|
|
234
|
+
"value": "a",
|
|
235
|
+
"disabled": true
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### 3. 如何获取选中的值?
|
|
242
|
+
|
|
243
|
+
可以通过 `change` 事件或 `v-model` 获取:
|
|
244
|
+
```html
|
|
245
|
+
<x-checkbox v-model="selectedValues" @change="onChange"></x-checkbox>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
```javascript
|
|
249
|
+
methods: {
|
|
250
|
+
onChange(checkedValues) {
|
|
251
|
+
console.log('当前选中的值:', checkedValues)
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
```
|
|
@@ -53,7 +53,7 @@ export default {
|
|
|
53
53
|
methods: {
|
|
54
54
|
async getfusetypes () {
|
|
55
55
|
this.fusetypes = [{ label: '全部', value: '' }]
|
|
56
|
-
const res = await post('
|
|
56
|
+
const res = await post('/api/af-revenue/singleTable_OrderBy', {
|
|
57
57
|
data: {
|
|
58
58
|
items: 'fusetype',
|
|
59
59
|
tablename: 't_files',
|
|
@@ -106,7 +106,7 @@ export default {
|
|
|
106
106
|
condition: () => this.userInfo?.f_meter_type === '物联网表'
|
|
107
107
|
},
|
|
108
108
|
{ key: '13', label: '流量计参数查看', permission: '流量计参数查看', component: 'MeterParamRecordQuery' },
|
|
109
|
-
{ key: '14', label: '异常报警', permission: '异常报警', component: '
|
|
109
|
+
{ key: '14', label: '异常报警', permission: '异常报警', component: 'UserException' },
|
|
110
110
|
{ key: '15', label: '价格调整', permission: '价格调整', component: 'PriceAdjustments' },
|
|
111
111
|
{ key: '16', label: '附件查看', permission: '附件查看', component: 'uploadFilesHistory' },
|
|
112
112
|
],
|