bri-components 1.2.58 → 1.2.60

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.
@@ -1,111 +1,110 @@
1
1
  <template>
2
- <!-- 单选模式 -->
2
+ <!-- 单选模式 编辑 -->
3
3
  <div
4
- v-if="!multipleMode"
4
+ v-if="!multipleMode && canEdit"
5
5
  class="DshSelect"
6
6
  >
7
- <template v-if="canEdit">
8
- <!-- 有选项 -->
9
- <template v-if="listData.length">
10
- <!-- flat方式 -->
11
- <template v-if="['flat', 'button'].includes(showType)">
12
- <RadioGroup
13
- :class="{
7
+ <!-- 有选项 -->
8
+ <template v-if="listData.length">
9
+ <!-- flat方式 -->
10
+ <template v-if="['flat', 'button'].includes(showType)">
11
+ <RadioGroup
12
+ :class="{
14
13
  'DshSelect-flat': true,
15
14
  'DshSelect-flat-color': useColor,
16
- 'DshSelect-flat-scroll': selfPropsObj._span < 24 && !selfPropsObj._br
15
+ 'DshSelect-flat-scroll': !isHeightAuto
17
16
  }"
18
- v-model="value[controlKey]"
19
- :type="radioGroupType"
20
- @on-change="change"
17
+ v-model="curVal"
18
+ :type="radioGroupType"
19
+ >
20
+ <Radio
21
+ v-for="(item, index) in listData"
22
+ :key="item._key"
23
+ :class="getItemClass(item)"
24
+ :style="getItemColorStyle(item)"
25
+ :value="curVal === item._key"
26
+ :label="item._key"
27
+ :disabled="getRadioItemDisabled(item, index)"
28
+ :border="useColor"
29
+ @click.native.stop="cancelRadioItemSelect(item, index)"
21
30
  >
22
- <Radio
23
- v-for="(item, index) in listData"
24
- :key="index"
25
- :class="getItemColorClass(item)"
26
- :style="getItemStyle(item)"
27
- :label="item._key"
28
- :disabled="getItemDisabled(item)"
29
- :border="useColor"
30
- @click.native="cancelSelect(item)"
31
- >
32
- <span @click.stop="clickOpenTip(item)">
33
- {{ item.name || item._name }}
34
- </span>
35
- </Radio>
36
- </RadioGroup>
37
-
38
- <!-- tip项弹框提示 -->
39
- <dsh-render :render="tipModalRender"></dsh-render>
40
- </template>
31
+ <span @click.stop="0">{{ item.name || item._name }}</span>
32
+ </Radio>
33
+ </RadioGroup>
34
+ </template>
41
35
 
42
- <!-- dropdown模式 -->
43
- <template v-else>
44
- <Select
45
- v-model="curVal"
46
- :placeholder="selfPropsObj._placeholder"
47
- :multiple="false"
48
- :disabled="!finalCanEdit"
49
- :clearable="selfPropsObj._clearable"
50
- :filterable="selfPropsObj._filterable"
51
- :size="selfPropsObj._size"
52
- :transfer="selfPropsObj._transfer"
53
- :transfer-class-name="selfPropsObj._transferClassName"
54
- @on-change="change"
36
+ <!-- dropdown模式 -->
37
+ <template v-else>
38
+ <Select
39
+ class="DshSelect-dropdown"
40
+ v-model="curVal"
41
+ :placeholder="selfPropsObj._placeholder"
42
+ :multiple="false"
43
+ :disabled="!finalCanEdit"
44
+ :clearable="selfPropsObj._clearable"
45
+ :filterable="selfPropsObj._filterable"
46
+ :size="selfPropsObj._size"
47
+ :transfer="selfPropsObj._transfer"
48
+ :transfer-class-name="selfPropsObj._transferClassName"
49
+ >
50
+ <!-- </Option>必须和输出内容在一行,否则出现空格导致_filterable出bug -->
51
+ <Option
52
+ v-for="(item, index) in listData"
53
+ :key="item._key"
54
+ :value="item._key"
55
+ :label="item.name || item._name"
56
+ :disabled="getRadioItemDisabled(item, index)"
55
57
  >
56
- <!-- </Option>必须和输出内容在一行,否则出现空格导致_filterable出bug -->
57
- <Option
58
- v-for="(item, index) in listData"
59
- :key="index"
60
- :value="item._key"
61
- :label="item.name || item._name"
62
- :disabled="getItemDisabled(item)"
63
- >
64
- <Icon
65
- v-if="item.icon || item.customIcon"
66
- :type="item.icon"
67
- :custom="item.customIcon ? `bico-font ${item.customIcon}` : undefined"
68
- :color="item.color"
69
- :size="item.size || 20"
70
- />{{ item.name || item._name }}
71
- </Option>
72
- </Select>
73
- </template>
58
+ <Icon
59
+ v-if="item.icon || item.customIcon"
60
+ :type="item.icon"
61
+ :custom="item.customIcon ? `bico-font ${item.customIcon}` : undefined"
62
+ :color="item.color"
63
+ :size="item.size || 20"
64
+ />
65
+
66
+ <slot :item="item"></slot>
67
+
68
+ <span>{{ item.name || item._name }}</span>
69
+ </Option>
70
+ </Select>
74
71
  </template>
75
-
76
- <!-- 无选项 -->
77
- <div
78
- v-else
79
- class="dsh-subtip"
80
- >-- 无选择项 --</div>
81
72
  </template>
82
73
 
83
- <!-- 查看 -->
84
- <template v-else>
85
- <bri-tooltip
86
- :content="showVal"
87
- maxWidth="200"
88
- placement="top"
89
- :transfer="true"
90
- >
91
- <div :class="{
92
- ...commonClass,
93
- 'DshSelect-show': true
94
- }">
95
- <!-- 有值 -->
96
- <dsh-tags
97
- v-if="!$isEmptyData(curVal)"
98
- class="text"
99
- :list="[curValObj]"
100
- ></dsh-tags>
74
+ <!-- 无选项 -->
75
+ <div
76
+ v-else
77
+ class="dsh-subtip"
78
+ >-- 无选择项 --</div>
79
+ </div>
101
80
 
102
- <!-- 无值 -->
103
- <template v-else>
104
- {{ emptyShowVal }}
105
- </template>
106
- </div>
107
- </bri-tooltip>
108
- </template>
81
+ <!-- 单选模式 查看 -->
82
+ <div
83
+ v-else-if="!multipleMode && !canEdit"
84
+ class="DshSelect-show"
85
+ >
86
+ <!-- 有值 -->
87
+ <bri-tooltip
88
+ v-if="!$isEmptyData(curVal)"
89
+ :content="showVal"
90
+ :transfer="true"
91
+ >
92
+ <dsh-tags
93
+ :class="{
94
+ ...commonClass,
95
+ 'DshSelect-show-ellipsis': !(isDetailShow && isHeightAuto)
96
+ }"
97
+ :list="[curValObj]"
98
+ ></dsh-tags>
99
+ </bri-tooltip>
100
+
101
+ <!-- 无值 -->
102
+ <div
103
+ v-else
104
+ :class="commonClass"
105
+ >
106
+ {{ emptyShowVal }}
107
+ </div>
109
108
  </div>
110
109
 
111
110
  <!-- 多选模式 -->
@@ -138,7 +137,8 @@
138
137
  selfPropsObj () {
139
138
  return {
140
139
  _transfer: true,
141
- ...this.selectPropsObj
140
+
141
+ ...this.basePropsObj
142
142
  };
143
143
  },
144
144
  radioGroupType () {
@@ -146,115 +146,15 @@
146
146
  }
147
147
  },
148
148
  created () {},
149
- methods: {
150
- // 取消flat模式的选择项
151
- cancelSelect (item) {
152
- if (item._disabled !== true && this.selfPropsObj._clearable !== false) {
153
- if (item._key === this.curVal) {
154
- this.value[this.controlKey] = "";
155
- this.change();
156
- }
157
- }
158
-
159
- this.clickOpenTip(item);
160
- },
161
- change (...params) {
162
- // 修复clear后值为undefined,数据库不更新数据bug
163
- if (this.value[this.controlKey] == undefined) {
164
- this.value[this.controlKey] = "";
165
- }
166
-
167
- this.$emit("change", this.curVal);
168
- },
169
-
170
- getItemColorClass (item) {
171
- return this.colorMap[item.color] ? item.color : "color-1";
172
- },
173
- getItemStyle (item) {
174
- const color = this.colorMap[item.color] || this.colorMap["color-1"];
175
- return {
176
- backgroundColor: this.useColor ? this.$getColor(color, 0.1) : undefined,
177
- color: this.useColor ? color : undefined
178
- };
179
- }
180
- }
149
+ methods: {}
181
150
  };
182
151
  </script>
183
152
 
184
153
  <style lang="less">
185
- .DshSelect {
186
- width: 100%;
187
-
188
- &-flat {
189
- width: 100%;
190
-
191
- &-color {
192
- .ivu-radio-border {
193
- height: 32px;
194
- line-height: 32px;
195
- border-radius: 4px;
196
- border: none;
197
- color: #FFF;
198
- margin-right: 16px;
199
- }
200
-
201
- .ivu-radio {
202
- .ivu-radio-inner {
203
- border: 2px solid @themeColor;
204
- background-color: transparent;
205
- width: 14px;
206
- height: 14px;
207
-
208
- &::after {
209
- width: 6px;
210
- height: 6px;
211
- left: 2px;
212
- top: 2px;
213
- background-color: transparent;
214
- opacity: 1;
215
- transform: scale(1);
216
- }
217
- }
218
-
219
- .ivu-radio-focus {
220
- box-shadow: 0 0 0 0;
221
- }
222
- }
223
-
224
- .ivu-radio-checked {
225
- .ivu-radio-inner {
226
- &::after {
227
- background-color: @themeColor;
228
- }
229
- }
230
- }
154
+ @import url("../../control.less");
231
155
 
232
- each(@resourceColor, {
233
- .color-@{index} {
234
- .ivu-radio {
235
- .ivu-radio-inner {
236
- border-color: @value;
237
- }
238
- }
239
-
240
- .ivu-radio-checked {
241
- .ivu-radio-inner {
242
- &::after {
243
- background-color: @value;
244
- }
245
- }
246
- }
247
- }
248
- });
249
- }
250
-
251
- &-scroll {
252
- overflow: auto;
253
- white-space: nowrap;
254
-
255
- .bri-scrollbar3();
256
- }
257
- }
156
+ .DshSelect {
157
+ #control-select(radio);
258
158
 
259
159
  &-modal {
260
160
  .ivu-modal-wrap {
@@ -307,13 +207,5 @@
307
207
  }
308
208
  }
309
209
  }
310
-
311
- &-tip {
312
- cursor: pointer;
313
-
314
- .ivu-radio {
315
- display: none;
316
- }
317
- }
318
210
  }
319
211
  </style>
@@ -0,0 +1,194 @@
1
+ #control-select(@control-type) {
2
+ &-flat {
3
+ width: 100%;
4
+
5
+ .ivu-@{control-type}-wrapper {
6
+ height: auto;
7
+ padding: 6px 0px;
8
+ margin-right: 12px;
9
+ margin-bottom: 4px;
10
+ white-space: normal;
11
+
12
+ .ivu-@{control-type} {
13
+ .ivu-@{control-type}-inner {
14
+
15
+ }
16
+
17
+ .ivu-@{control-type}-focus {
18
+ box-shadow: 0 0 0 0;
19
+ }
20
+
21
+ &-checked {
22
+ // 因为不一致,所以明确名字分开写
23
+ .ivu-radio-inner {
24
+ &::after {
25
+ background-color: @themeColor;
26
+ }
27
+ }
28
+
29
+ .ivu-checkbox-inner {
30
+ background-color: @themeColor;
31
+ }
32
+ }
33
+
34
+ & + span {
35
+
36
+ }
37
+ }
38
+
39
+ // 选项置灰时
40
+ &-disabled {
41
+ .ivu-@{control-type} {
42
+ .ivu-@{control-type}-inner {
43
+ border-color: #aaaaaa!important; // 为了useColor且disbaled时,压住下面each里的样式,这些还生效
44
+ }
45
+
46
+ &-checked {
47
+ .ivu-@{control-type}-inner {
48
+ background-color: #E5E5E5!important; // 为了useColor且disbaled时,压住下面each里的样式,这些还生效
49
+
50
+ &::after {
51
+ background-color: #aaaaaa!important; // 为了useColor且disbaled时,压住下面each里的样式,这些还生效
52
+ }
53
+ }
54
+ }
55
+
56
+
57
+ & + span {
58
+ color: #aaaaaa!important; // 为了useColor且disbaled时,压住下面each里的样式,这些还生效
59
+ }
60
+ }
61
+ }
62
+
63
+ &:last-child {
64
+ margin-right: 0px;
65
+ }
66
+ }
67
+
68
+ &-color {
69
+ .ivu-@{control-type}-wrapper {
70
+ padding: 6px 15px;
71
+ border-radius: 4px;
72
+ border-color: transparent;
73
+ line-height: 16px;
74
+
75
+ .ivu-@{control-type} {
76
+ .ivu-@{control-type}-inner {
77
+ border: 2px solid @themeColor;
78
+ background-color: transparent;
79
+ }
80
+
81
+ // 因为不一致,所以明确名字分开写
82
+ .ivu-radio-inner {
83
+ width: 14px;
84
+ height: 14px;
85
+
86
+ &::after {
87
+ width: 6px;
88
+ height: 6px;
89
+ left: 2px;
90
+ top: 2px;
91
+ }
92
+ }
93
+ .ivu-checkbox-inner {
94
+ &::after {
95
+ top: 2px;
96
+ left: 4px;
97
+ }
98
+ }
99
+ }
100
+ }
101
+
102
+ each(@resourceColor, {
103
+ .color-@{index}.ivu-@{control-type}-wrapper {
104
+ .ivu-@{control-type} {
105
+ .ivu-@{control-type}-inner {
106
+ border-color: @value;
107
+ }
108
+
109
+ &-checked {
110
+ // 因为不一致,所以明确名字分开写
111
+ .ivu-radio-inner {
112
+ &::after {
113
+ background-color: @value;
114
+ }
115
+ }
116
+ .ivu-checkbox-inner {
117
+ background-color: @value;
118
+ }
119
+ }
120
+ }
121
+
122
+ &-checked {
123
+ border-color: @value;
124
+ }
125
+
126
+ &-disabled {
127
+ border-color: #f3f3f3;
128
+ background-color: #f3f3f3!important; // 压住style里的background-color
129
+
130
+ &.ivu-@{control-type}-wrapper-checked {
131
+ border-color: #aaaaaa;
132
+ }
133
+ }
134
+ }
135
+ });
136
+ }
137
+
138
+ &-scroll {
139
+ .bri-scrollbar3();
140
+ white-space: nowrap;
141
+ overflow: auto;
142
+
143
+ .ivu-@{control-type}-wrapper {
144
+ height: 30px;
145
+ margin-bottom: 2px;
146
+ white-space: nowrap;
147
+ }
148
+ }
149
+ }
150
+
151
+ &-dropdown {
152
+ &.ivu-select-multiple {
153
+ .ivu-select-selection {
154
+ height: 32px;
155
+ .dsh-flex-row-between-center();
156
+
157
+ & > div {
158
+ .bri-scrollbar3();
159
+ width: 100%;
160
+ height: 100%;
161
+ word-break: keep-all;
162
+ white-space: nowrap;
163
+ overflow: auto;
164
+
165
+ .ivu-tag {
166
+ margin: 2px 4px 0px 0px;
167
+ background-color: @borderColor;
168
+ }
169
+ }
170
+ }
171
+
172
+ &.ivu-select-disabled {
173
+ .ivu-select-selection {
174
+ & > div {
175
+ .ivu-tag {
176
+ background-color: @border-disabled;
177
+ }
178
+ }
179
+ }
180
+ }
181
+
182
+ .ivu-select-item-selected:after {
183
+ content: none;
184
+ }
185
+ }
186
+ }
187
+
188
+ // 查看
189
+ &-show {
190
+ &-ellipsis {
191
+ .dsh-ellipsis();
192
+ }
193
+ }
194
+ }
@@ -47,7 +47,11 @@ export default {
47
47
  },
48
48
  set (val) {
49
49
  this.value[this.controlKey] = val;
50
- // this.change();
50
+ // 修复文本框clear后值为undefined,后端无法更新保存数据bug
51
+ if (["select"].includes(this.controlType) && this.value[this.controlKey] === undefined) {
52
+ this.value[this.controlKey] = "";
53
+ }
54
+ this.change();
51
55
  }
52
56
  },
53
57
  // 值为[]类型用的
@@ -119,9 +123,17 @@ export default {
119
123
  "bri-control-nodata": this.$isEmptyData(this.curVal)
120
124
  };
121
125
  },
126
+ // 单独一行
122
127
  isFullRow () {
123
128
  return this.propsObj._span === 24 || !this.propsObj._span;
124
129
  },
130
+ // 控件内容高度 自由
131
+ isHeightAuto () {
132
+ return this.isFullRow && !this.isInTable;
133
+ },
134
+ clearable () {
135
+ return this.commonDealPropsObj._clearable;
136
+ },
125
137
  // showAlign () {
126
138
  // return !this.isUnitShow
127
139
  // ? "flex-start"
@@ -133,12 +145,17 @@ export default {
133
145
  // },
134
146
 
135
147
  /* 部分条件下 才使用的属性 */
148
+ // isShare () {
149
+ // return !!this.propsObj.isShare;
150
+ // },
136
151
  isInTable () {
137
152
  return !!this.propsObj.isInTable;
138
153
  },
154
+ // 高级搜索状态
139
155
  isOnSearch () {
140
156
  return !!this.propsObj.onSearch;
141
157
  },
158
+ // 默认搜索状态
142
159
  isOnDftSearch () {
143
160
  return !!this.propsObj.onDftSearch;
144
161
  },
@@ -148,9 +165,12 @@ export default {
148
165
  isUnitShow () {
149
166
  return this.isInTable && !this.canEdit;
150
167
  },
151
- // isShare () {
152
- // return !!this.propsObj.isShare;
153
- // },
168
+ isDetailUpdate () {
169
+ return !this.isInTable && !!this.canEdit;
170
+ },
171
+ isDetailShow () {
172
+ return !this.isInTable && !this.canEdit;
173
+ },
154
174
 
155
175
  /* 部分控件下 才使用的属性 */
156
176
  compKey () {
@@ -188,6 +208,12 @@ export default {
188
208
  this.$emit("refChange", this.value[this.controlKey]);
189
209
  },
190
210
 
211
+ // 点击输入框
212
+ clickInput () {
213
+ if (!this.selfPropsObj._disabled) {
214
+ this.openModal();
215
+ }
216
+ },
191
217
  /* ----- 工具方法 ------- */
192
218
  // 切换弹框
193
219
  toggleModal (bool) {