vue2-client 1.16.86 → 1.16.88

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.
@@ -459,7 +459,6 @@ export default {
459
459
  letter-spacing: 0px;
460
460
  font-feature-settings: "kern" on;
461
461
  color: #313131;
462
- padding: 11px 0 2px 0;
463
462
  margin: 0 !important;
464
463
  width: auto;
465
464
  text-align: center;
@@ -1,181 +1,194 @@
1
- <template>
2
- <div class="x-checkbox-container" :class="wrapperClassObject()">
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
- wrapperClassObject () {
74
- const attrs = this.$attrs || {}
75
- const classes = {}
76
- const booleanStyleKeys = [
77
- 'compact', 'out-checkbox'
78
- ]
79
- booleanStyleKeys.forEach(key => {
80
- const val = attrs[key]
81
- const truthy = val === true || val === '' || val === 'true'
82
- if (truthy) classes[`x-checkbox-${key}`] = true
83
- })
84
- return classes
85
- },
86
- onChange (checkedValues) {
87
- this.innerValue = checkedValues
88
- this.$emit('change', checkedValues)
89
- }
90
- }
91
- }
92
- </script>
93
-
94
- <style scoped lang="less">
95
- .x-checkbox-container {
96
- display: flex;
97
- flex-direction: column;
98
- }
99
-
100
- .x-checkbox-group {
101
- display: flex;
102
- justify-content: space-around;
103
- }
104
-
105
- .x-checkbox-item-container {
106
- flex: 1;
107
- display: flex;
108
- flex-direction: column;
109
- align-items: center;
110
- text-align: center;
111
- padding: 0 8px;
112
- box-sizing: border-box;
113
- }
114
-
115
- .x-checkbox-item {
116
- margin-bottom: 8px;
117
- }
118
- .x-checkbox-compact {
119
- &.x-checkbox-container,
120
- .x-checkbox-container {
121
- :deep(.x-checkbox-item-container){
122
- padding: 0px !important;
123
- flex: auto !important;
124
- }
125
- :deep(.x-checkbox-item){
126
- margin: 0px;
127
- }
128
- :deep(.x-checkbox-item) > span:last-child {
129
- padding-right: 2px;
130
- padding-left: 2px;
131
- }
132
- }
133
- }
134
-
135
- /* out-checkbox:外排版紧凑风格,与表单风格配置保持一致的布尔开关用法 */
136
- .x-checkbox-container.x-checkbox-out-checkbox {
137
- margin-top: 9px;
138
-
139
- :deep(.x-checkbox-group) {
140
- justify-content: flex-start;
141
- flex-wrap: wrap;
142
- gap: 0 46px;
143
- }
144
-
145
- :deep(.x-checkbox-item-container) {
146
- flex: 0 0 auto;
147
- align-items: flex-start;
148
- text-align: left;
149
- padding: 0;
150
- }
151
-
152
- :deep(.x-checkbox-item) {
153
- margin: 0;
154
- display: flex;
155
- align-items: center;
156
-
157
- .ant-checkbox {
158
- width: 20px;
159
- height: 20px;
160
- margin-right: 10px;
161
-
162
- .ant-checkbox-inner {
163
- width: 20px;
164
- height: 20px;
165
- }
166
- }
167
-
168
- /* 文字标签样式 */
169
- span {
170
- height: 23px;
171
- opacity: 1;
172
- font-family: 'Source Han Sans', sans-serif;
173
- font-size: 16px;
174
- font-weight: normal;
175
- line-height: normal;
176
- letter-spacing: 0em;
177
- color: #313131;
178
- }
179
- }
180
- }
181
- </style>
1
+ <template>
2
+ <div class="x-checkbox-container" :class="wrapperClassObject()">
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
+ wrapperClassObject () {
74
+ const attrs = this.$attrs || {}
75
+ const classes = {}
76
+ const booleanStyleKeys = [
77
+ 'compact', 'out-checkbox', 'justify-content-start'
78
+ ]
79
+ booleanStyleKeys.forEach(key => {
80
+ const val = attrs[key]
81
+ const truthy = val === true || val === '' || val === 'true'
82
+ if (truthy) classes[`x-checkbox-${key}`] = true
83
+ })
84
+ return classes
85
+ },
86
+ onChange (checkedValues) {
87
+ this.innerValue = checkedValues
88
+ this.$emit('change', checkedValues)
89
+ }
90
+ }
91
+ }
92
+ </script>
93
+
94
+ <style scoped lang="less">
95
+ .x-checkbox-container {
96
+ display: flex;
97
+ flex-direction: column;
98
+ }
99
+
100
+ .x-checkbox-group {
101
+ display: flex;
102
+ justify-content: space-around;
103
+ }
104
+
105
+ .x-checkbox-item-container {
106
+ flex: 1;
107
+ display: flex;
108
+ flex-direction: column;
109
+ align-items: center;
110
+ text-align: center;
111
+ padding: 0 8px;
112
+ box-sizing: border-box;
113
+ }
114
+
115
+ .x-checkbox-item {
116
+ margin-bottom: 8px;
117
+ }
118
+ .x-checkbox-compact {
119
+ &.x-checkbox-container,
120
+ .x-checkbox-container {
121
+ :deep(.x-checkbox-item-container){
122
+ padding: 0px !important;
123
+ flex: auto !important;
124
+ }
125
+ :deep(.x-checkbox-item){
126
+ margin: 0px;
127
+ }
128
+ :deep(.x-checkbox-item) > span:last-child {
129
+ padding-right: 2px;
130
+ padding-left: 2px;
131
+ }
132
+ }
133
+ }
134
+
135
+ /* out-checkbox:外排版紧凑风格,与表单风格配置保持一致的布尔开关用法 */
136
+ .x-checkbox-container.x-checkbox-out-checkbox {
137
+ margin-top: 9px;
138
+
139
+ :deep(.x-checkbox-group) {
140
+ justify-content: flex-start;
141
+ flex-wrap: wrap;
142
+ gap: 0 46px;
143
+ }
144
+
145
+ :deep(.x-checkbox-item-container) {
146
+ flex: 0 0 auto;
147
+ align-items: flex-start;
148
+ text-align: left;
149
+ padding: 0;
150
+ }
151
+
152
+ :deep(.x-checkbox-item) {
153
+ margin: 0;
154
+ display: flex;
155
+ align-items: center;
156
+
157
+ .ant-checkbox {
158
+ width: 20px;
159
+ height: 20px;
160
+ margin-right: 10px;
161
+
162
+ .ant-checkbox-inner {
163
+ width: 20px;
164
+ height: 20px;
165
+ }
166
+ }
167
+
168
+ /* 文字标签样式 */
169
+ span {
170
+ height: 23px;
171
+ opacity: 1;
172
+ font-family: 'Source Han Sans', sans-serif;
173
+ font-size: 16px;
174
+ font-weight: normal;
175
+ line-height: normal;
176
+ letter-spacing: 0em;
177
+ color: #313131;
178
+ }
179
+ }
180
+ }
181
+ // 从左到右右排列
182
+ .x-checkbox-justify-content-start{
183
+ &.x-checkbox-container,
184
+ .x-checkbox-container {
185
+ :deep(.x-checkbox-group){
186
+ display: flex;
187
+ justify-content: start;
188
+ }
189
+ :deep(.x-checkbox-item-container){
190
+ flex-direction: row
191
+ }
192
+ }
193
+ }
194
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="import-button">
2
+ <div class="import-button" :class="wrapperClassObject">
3
3
  <a-button
4
4
  type="type"
5
5
  ref="importExcelButton"
@@ -37,6 +37,23 @@ export default {
37
37
  components: {
38
38
  XFrontImportExcel
39
39
  },
40
+ computed: {
41
+ // 参考 HForm 的 wrapperClassObject 规则,支持通过组件属性动态控制样式
42
+ wrapperClassObject () {
43
+ const a = this.$attrs || {}
44
+ const classes = {}
45
+ // 多个布尔型样式开关(存在且为真则生效)
46
+ const booleanStyleKeys = [
47
+ 'fill-container'
48
+ ]
49
+ booleanStyleKeys.forEach(key => {
50
+ const val = a[key]
51
+ const truthy = val === true || val === '' || val === 'true'
52
+ if (truthy) classes[`x-import-button-${key}`] = true
53
+ })
54
+ return classes
55
+ }
56
+ },
40
57
  data () {
41
58
  return {
42
59
  // 图标样式
@@ -99,5 +116,32 @@ export default {
99
116
  },
100
117
  }
101
118
  </script>
102
- <style scoped>
119
+ <style scoped lang="less">
120
+ .import-button {
121
+ // 基础样式
122
+ :deep(.ant-btn) {
123
+ border-radius: 6px;
124
+ background-color: #FFFFFF;
125
+ //border: 1px solid #9499A0;
126
+ //color: #313131;
127
+ font-weight: normal;
128
+ letter-spacing: 0em;
129
+ width: 110px;
130
+ font-size: 16px;
131
+ font-family: "Source Han Sans";
132
+ line-height: normal;
133
+ margin-right: 25px;
134
+ height: 32px;
135
+ border: 1px solid #CDCDCD;
136
+ color: #5D5C5C;
137
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);
138
+ box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
139
+ }
140
+ }
141
+ .x-import-button-fill-container {
142
+ :deep(.ant-btn) {
143
+ width: 100%;
144
+ margin-right: 0px
145
+ }
146
+ }
103
147
  </style>