bri-components 1.2.58 → 1.2.59

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,6 +1,6 @@
1
1
  {
2
2
  "name": "bri-components",
3
- "version": "1.2.58",
3
+ "version": "1.2.59",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -26,17 +26,18 @@
26
26
  <!-- 单选模式 查看 -->
27
27
  <div
28
28
  v-else-if="!multipleMode && !canEdit"
29
- class="DshCascader"
29
+ class="DshCascader-show"
30
30
  >
31
31
  <!-- 有值 -->
32
32
  <bri-tooltip
33
33
  v-if="!$isEmptyData(curValList)"
34
34
  :content="showVal"
35
- placement="top"
36
- maxWidth="200"
37
35
  :transfer="true"
38
36
  >
39
- <div :class="commonClass">
37
+ <div :class="{
38
+ commonClass,
39
+ 'DshCascader-show-ellipsis': true
40
+ }">
40
41
  {{ showVal }}
41
42
  </div>
42
43
  </bri-tooltip>
@@ -83,19 +84,15 @@
83
84
  <bri-tooltip
84
85
  v-if="!$isEmptyData(curValList)"
85
86
  :content="showMulVal"
86
- placement="top"
87
- maxWidth="200"
88
87
  :transfer="true"
89
88
  >
90
- <div :class="{
91
- ...commonClass,
92
- 'DshCascader-show-row': isFullRow && !isUnitShow
93
- }">
94
- <dsh-tags
95
- class="text"
96
- :list="curValNameList"
97
- ></dsh-tags>
98
- </div>
89
+ <dsh-tags
90
+ :class="{
91
+ ...commonClass,
92
+ 'DshCascaders-show-ellipsis': !(isDetailShow && isFullRow)
93
+ }"
94
+ :list="curValNameList"
95
+ ></dsh-tags>
99
96
  </bri-tooltip>
100
97
 
101
98
  <!-- 无值 -->
@@ -139,7 +136,7 @@
139
136
  computed: {
140
137
  selfPropsObj () {
141
138
  return {
142
- _showMode: "default", // 只有单选模式有效,值为"default", "custom", "simple"
139
+ _showMode: "default", // 值为"default", "custom", "simple"
143
140
  _transfer: true,
144
141
  _transferClassName: "",
145
142
 
@@ -165,23 +162,18 @@
165
162
 
166
163
  <style lang="less">
167
164
  .DshCascader {
168
-
165
+ &-show {
166
+ &-ellipsis {
167
+ .dsh-ellipsis();
168
+ }
169
+ }
169
170
  }
170
171
 
171
172
  // 多选
172
173
  .DshCascaders {
173
174
  &-show {
174
- height: auto;
175
-
176
- &-row {
177
- .text,
178
- .overflow {
179
- .bri-scrollbar3();
180
- width: 100%;
181
- height: 100%;
182
- white-space: normal;
183
- overflow: auto;
184
- }
175
+ &-ellipsis {
176
+ .dsh-ellipsis();
185
177
  }
186
178
  }
187
179
  }
@@ -1,111 +1,105 @@
1
1
  <template>
2
- <div class="DshCheckbox">
3
- <!-- 编辑 -->
4
- <template v-if="canEdit">
5
- <!-- 有选项 -->
6
- <template v-if="listData.length">
7
- <!-- flat方式 -->
8
- <template v-if="showType === 'flat'">
9
- <CheckboxGroup
10
- :class="{
2
+ <!-- 编辑 -->
3
+ <div
4
+ v-if="canEdit"
5
+ class="DshCheckbox"
6
+ >
7
+ <!-- 有选项 -->
8
+ <template v-if="listData.length">
9
+ <!-- flat方式 -->
10
+ <template v-if="showType === 'flat'">
11
+ <CheckboxGroup
12
+ :class="{
11
13
  'DshCheckbox-flat': true,
12
14
  'DshCheckbox-flat-color': useColor,
13
- 'DshCheckbox-flat-disabled': !canEdit,
14
- 'DshCheckbox-flat-scroll': selfPropsObj._span < 24 && !selfPropsObj._br,
15
+ 'DshCheckbox-flat-scroll': !isFullRow,
15
16
  }"
16
- v-model="curValList"
17
+ v-model="curValList"
18
+ >
19
+ <Checkbox
20
+ v-for="(item, index) in listData"
21
+ :key="item._key"
22
+ :class="getItemClass(item)"
23
+ :style="getItemColorStyle(item)"
24
+ :label="item._key"
25
+ :disabled="getCheckItemDisabled(item)"
26
+ :border="useColor"
27
+ @click.native="clickCheckItem(item, index)"
17
28
  >
18
- <Checkbox
19
- v-for="(item, index) in listData"
20
- :key="index"
21
- :class="[
22
- 'DshCheckbox-item',
23
- getItemColorClass(item),
24
- selfPropsObj.class,
25
- item.class
26
- ]"
27
- :style="getItemStyle(item)"
28
- :label="item._key"
29
- :disabled="getItemDisabled(item)"
30
- :border="useColor"
31
- @click.native="clickOpenTip(item)"
32
- >
33
- <slot :item="item"></slot>
29
+ <slot :item="item"></slot>
34
30
 
35
- <span>{{ item.name || item._name }}</span>
36
- </Checkbox>
37
-
38
- <!-- tip项弹框提示 -->
39
- <dsh-render :render="tipModalRender"></dsh-render>
40
- </CheckboxGroup>
41
- </template>
31
+ <span>{{ item.name || item._name }}</span>
32
+ </Checkbox>
33
+ </CheckboxGroup>
34
+ </template>
42
35
 
43
- <!-- dropdown模式 -->
44
- <template v-else>
45
- <Select
46
- v-model="value[controlKey]"
47
- :multiple="true"
48
- :placeholder="selfPropsObj._placeholder"
49
- :disabled="!finalCanEdit"
50
- :filterable="selfPropsObj._filterable"
51
- :transfer="selfPropsObj._transfer"
52
- :transfer-class-name="selfPropsObj._transferClassName"
53
- :max-tag-count="selfPropsObj._maxTagCount"
54
- @on-select="changeSelect"
36
+ <!-- dropdown模式 -->
37
+ <template v-else>
38
+ <Select
39
+ :class="{
40
+ 'DshCheckbox-dropdown': true,
41
+ }"
42
+ :value="curValList"
43
+ :multiple="true"
44
+ :placeholder="selfPropsObj._placeholder"
45
+ :disabled="selfPropsObj._disabled"
46
+ :filterable="selfPropsObj._filterable"
47
+ :transfer="selfPropsObj._transfer"
48
+ :transfer-class-name="selfPropsObj._transferClassName"
49
+ :max-tag-count="selfPropsObj._maxTagCount"
50
+ @on-select="changeCheckValue"
51
+ >
52
+ <Option
53
+ v-for="(item, index) in listData"
54
+ :key="item._key"
55
+ :value="item._key"
56
+ :label="item.name || item._name"
57
+ :disabled="getCheckItemDisabled(item, index)"
55
58
  >
56
- <Option
57
- v-for="(item, index) in listData"
58
- :key="index"
59
- :value="item._key"
60
- :label="item.name || item._name"
61
- :disabled="getItemDisabled(item)"
62
- >
63
- <Checkbox :value="getItemSelectStatus(item)"></Checkbox>
59
+ <Checkbox :value="getCheckItemStatus(item)"></Checkbox>
64
60
 
65
- <slot :item="item"></slot>
61
+ <slot :item="item"></slot>
66
62
 
67
- <span>{{ item.name || item._name }}</span>
68
- <span style="float:right; padding-right:20px">
69
- {{ item.rightName }}
70
- </span>
71
- </Option>
72
- </Select>
73
- </template>
63
+ <span>{{ item.name || item._name }}</span>
64
+ </Option>
65
+ </Select>
74
66
  </template>
75
-
76
- <!-- 无选项 -->
77
- <div
78
- v-else
79
- class="dsh-subtip"
80
- >-- 无选择项 --</div>
81
67
  </template>
82
68
 
83
- <!-- 查看 -->
84
- <template v-else>
85
- <bri-tooltip
86
- :content="showMulVal"
87
- placement="top"
88
- maxWidth="200"
89
- :transfer="true"
90
- >
91
- <div :class="{
69
+ <!-- 无选项 -->
70
+ <div
71
+ v-else
72
+ class="dsh-subtip"
73
+ >-- 无选择项 --</div>
74
+ </div>
75
+
76
+ <!-- 查看 -->
77
+ <div
78
+ v-else
79
+ class="DshCheckbox-show"
80
+ >
81
+ <!-- 有值 -->
82
+ <bri-tooltip
83
+ v-if="!$isEmptyData(curValList)"
84
+ :content="showMulVal"
85
+ :transfer="true"
86
+ >
87
+ <dsh-tags
88
+ :class="{
92
89
  ...commonClass,
93
- 'DshCheckbox-show': true
94
- }">
95
- <!-- 有值 -->
96
- <dsh-tags
97
- v-if="!$isEmptyData(curValList)"
98
- class="text"
99
- :list="curValObjList"
100
- ></dsh-tags>
90
+ 'DshCheckbox-show-ellipsis': !(isDetailShow && isFullRow)
91
+ }"
92
+ :list="curValObjList"
93
+ ></dsh-tags>
94
+ </bri-tooltip>
101
95
 
102
- <!-- 无值 -->
103
- <template v-else>
104
- {{ emptyShowVal }}
105
- </template>
106
- </div>
107
- </bri-tooltip>
108
- </template>
96
+ <!-- 无值 -->
97
+ <div
98
+ v-else
99
+ :class="commonClass"
100
+ >
101
+ {{ emptyShowVal }}
102
+ </div>
109
103
  </div>
110
104
  </template>
111
105
 
@@ -125,46 +119,22 @@
125
119
  computed: {
126
120
  selfPropsObj () {
127
121
  return {
122
+ _max: 100000000,
128
123
  _transfer: true,
129
- ...this.selectPropsObj
124
+ _transferClassName: "",
125
+
126
+ ...this.basePropsObj
130
127
  };
131
128
  }
132
129
  },
133
130
  created () {},
134
131
  methods: {
135
- // 下拉框的change (下拉方式时用v-model触发change有问题,组件进来如果值不为空的,就会v-model返值一次)
136
- changeSelect (item) {
137
- if (this.curValList.includes(item.value)) {
138
- let itemIndex = this.curValList.findIndex(valItem => valItem === item.value);
139
- this.curValList.splice(itemIndex, 1);
140
- } else {
141
- this.curValList.push(item.value);
142
- }
143
-
144
- this.curValList = [...this.curValList];
145
- },
146
-
147
- getItemColorClass (item) {
148
- return this.colorMap[item.color] ? item.color : "color-1";
149
- },
150
- getItemStyle (item) {
151
- const color = this.colorMap[item.color] || this.colorMap["color-1"];
152
- return {
153
- background: this.useColor ? this.$getColor(color, 0.1) : undefined,
154
- color: this.useColor ? color : undefined
155
- };
156
- },
157
- // 获取某项的置灰状态
158
- getItemDisabled (item) {
159
- return !!(
160
- !this.finalCanEdit ||
161
- item._disabled ||
162
- this.curValList.length >= this.selfPropsObj._max && !this.getItemSelectStatus(item)
163
- );
164
- },
165
- // 获取某项的选中状态
166
- getItemSelectStatus (item) {
167
- return this.curValList.includes(item._key);
132
+ // 多选模式 值改变 (pc端下拉方式时,用v-model触发change有问题,组件进来如果值不为空的,就会v-model返值一次)
133
+ changeCheckValue (item) {
134
+ this.clickCheckItem({
135
+ ...item,
136
+ _key: item.value
137
+ });
168
138
  }
169
139
  }
170
140
  };
@@ -172,108 +142,140 @@
172
142
 
173
143
  <style lang="less">
174
144
  .DshCheckbox {
175
- width: 100%;
176
-
177
145
  &-flat {
178
146
  width: 100%;
179
147
 
180
- // 选中时背景为白色
181
- .ivu-checkbox-checked .ivu-checkbox-inner {
182
- background-color: @themeColor;
183
- }
148
+ .ivu-checkbox-wrapper {
149
+ margin-bottom: 4px;
150
+ margin-right: 16px;
184
151
 
185
- &-item {}
152
+ .ivu-checkbox {
153
+ &.ivu-checkbox-checked {
154
+ .ivu-checkbox-inner {
155
+ background-color: @themeColor;
156
+ }
157
+ }
158
+ }
159
+ }
186
160
 
187
161
  &-color {
188
- .ivu-checkbox-border {
189
- margin-right: 16px;
162
+ .ivu-checkbox-wrapper {
190
163
  height: 32px;
191
164
  border: none;
192
165
  border-radius: 4px;
193
166
  line-height: 32px;
194
- color: #FFF;
195
- }
196
167
 
197
- .ivu-checkbox {
198
- .ivu-checkbox-inner {
199
- border: 2px solid @themeColor;
200
- background-color: transparent;
201
- }
168
+ .ivu-checkbox {
169
+ .ivu-checkbox-inner {
170
+ border: 2px solid @themeColor;
171
+ background-color: transparent;
172
+ }
173
+ .ivu-checkbox-focus {
174
+ box-shadow: 0 0 0 0;
175
+ }
202
176
 
203
- .ivu-checkbox-focus {
204
- box-shadow: 0 0 0 0;
177
+ &.ivu-checkbox-checked {
178
+ .ivu-checkbox-inner {
179
+ &:after {
180
+ top: 2px;
181
+ left: 4px;
182
+ }
183
+ }
184
+ }
205
185
  }
206
- }
207
186
 
208
- .ivu-checkbox-disabled+span {
209
- color: inherit;
187
+ &-disabled {
188
+ background-color: #f3f3f3!important;
189
+ color: #E5E5E5!important;
190
+
191
+ .ivu-checkbox.ivu-checkbox-disabled {
192
+ .ivu-checkbox-inner {
193
+ border-color: #E5E5E5;
194
+ }
195
+
196
+ &.ivu-checkbox-checked {
197
+ .ivu-checkbox-inner {
198
+ background-color: #E5E5E5;
199
+ }
200
+ }
201
+
202
+ & + span {
203
+ color: #E5E5E5;
204
+ }
205
+ }
206
+ }
210
207
  }
211
208
 
209
+ // ivu-checkbox-wrapper 和 color-1 在一个div上
212
210
  each(@resourceColor, {
213
211
  .color-@{index} {
214
212
  .ivu-checkbox {
215
213
  .ivu-checkbox-inner {
216
214
  border-color: @value;
217
215
  }
218
- }
219
216
 
220
- .ivu-checkbox-checked {
221
- .ivu-checkbox-inner {
222
- background-color: @value;
217
+ &.ivu-checkbox-checked {
218
+ .ivu-checkbox-inner {
219
+ background-color: @value;
220
+ }
223
221
  }
224
222
  }
225
223
  }
226
224
  });
227
225
  }
228
226
 
229
- &-disabled {
230
- .ivu-checkbox-disabled+span {
231
- color: #515a6e;
232
- }
233
- }
234
-
235
227
  &-scroll {
236
- overflow: auto;
228
+ .bri-scrollbar3();
237
229
  white-space: nowrap;
230
+ overflow: auto;
238
231
 
239
- .bri-scrollbar3();
232
+ .ivu-checkbox-wrapper {
233
+ margin-bottom: 4px;
234
+ }
240
235
  }
241
236
  }
242
237
 
243
- &-show {}
244
-
245
- .ivu-select-multiple {
246
- .ivu-select-selection {
247
- height: 32px;
248
- .dsh-flex-row-between-center();
238
+ &-dropdown {
239
+ .ivu-select-multiple {
240
+ .ivu-select-selection {
241
+ height: 32px;
242
+ .dsh-flex-row-between-center();
249
243
 
250
- & > div {
251
- width: 100%;
252
- height: 100%;
253
- word-break: keep-all;
254
- white-space: nowrap;
255
- overflow: auto;
256
- .bri-scrollbar3();
244
+ & > div {
245
+ width: 100%;
246
+ height: 100%;
247
+ word-break: keep-all;
248
+ white-space: nowrap;
249
+ overflow: auto;
250
+ .bri-scrollbar3();
257
251
 
258
- .ivu-tag {
259
- margin: 2px 4px 0px 0px;
260
- background-color: @borderColor;
252
+ .ivu-tag {
253
+ margin: 2px 4px 0px 0px;
254
+ background-color: @borderColor;
255
+ }
261
256
  }
262
257
  }
263
- }
264
258
 
265
- &.ivu-select-disabled {
266
- .ivu-select-selection {
267
- & > div {
268
- .ivu-tag {
269
- background-color: @border-disabled;
259
+ &.ivu-select-disabled {
260
+ .ivu-select-selection {
261
+ & > div {
262
+ .ivu-tag {
263
+ background-color: @border-disabled;
264
+ }
270
265
  }
271
266
  }
272
267
  }
268
+
269
+ .ivu-select-item-selected:after {
270
+ content: none;
271
+ }
273
272
  }
273
+ }
274
274
 
275
- .ivu-select-item-selected:after {
276
- content: none;
275
+ // 查看
276
+ &-show {
277
+ &-ellipsis {
278
+ .dsh-ellipsis();
277
279
  }
278
280
  }
279
281
  }
@@ -1,111 +1,111 @@
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': !isFullRow
17
16
  }"
18
- v-model="value[controlKey]"
19
- :type="radioGroupType"
20
- @on-change="change"
17
+ :value="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
+ :label="item._key"
26
+ :disabled="getRadioItemDisabled(item)"
27
+ :border="useColor"
28
+ @click.native="clickRadioItem(item, index)"
21
29
  >
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>
41
-
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"
55
- >
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>
30
+ <span>
31
+ {{ item.name || item._name }}
32
+ </span>
33
+ </Radio>
34
+ </RadioGroup>
74
35
  </template>
75
36
 
76
- <!-- 无选项 -->
77
- <div
78
- v-else
79
- class="dsh-subtip"
80
- >-- 无选择项 --</div>
37
+ <!-- dropdown模式 -->
38
+ <template v-else>
39
+ <Select
40
+ class="DshSelect-dropdown"
41
+ v-model="curVal"
42
+ :placeholder="selfPropsObj._placeholder"
43
+ :multiple="false"
44
+ :disabled="!finalCanEdit"
45
+ :clearable="selfPropsObj._clearable"
46
+ :filterable="selfPropsObj._filterable"
47
+ :size="selfPropsObj._size"
48
+ :transfer="selfPropsObj._transfer"
49
+ :transfer-class-name="selfPropsObj._transferClassName"
50
+ >
51
+ <!-- </Option>必须和输出内容在一行,否则出现空格导致_filterable出bug -->
52
+ <Option
53
+ v-for="(item, index) in listData"
54
+ :key="item._key"
55
+ :value="item._key"
56
+ :label="item.name || item._name"
57
+ :disabled="getRadioItemDisabled(item, index)"
58
+ >
59
+ <Icon
60
+ v-if="item.icon || item.customIcon"
61
+ :type="item.icon"
62
+ :custom="item.customIcon ? `bico-font ${item.customIcon}` : undefined"
63
+ :color="item.color"
64
+ :size="item.size || 20"
65
+ />
66
+
67
+ <slot :item="item"></slot>
68
+
69
+ <span>{{ item.name || item._name }}</span>
70
+ </Option>
71
+ </Select>
72
+ </template>
81
73
  </template>
82
74
 
83
- <!-- 查看 -->
84
- <template v-else>
85
- <bri-tooltip
86
- :content="showVal"
87
- maxWidth="200"
88
- placement="top"
89
- :transfer="true"
90
- >
91
- <div :class="{
75
+ <!-- 无选项 -->
76
+ <div
77
+ v-else
78
+ class="dsh-subtip"
79
+ >-- 无选择项 --</div>
80
+ </div>
81
+
82
+ <!-- 单选模式 查看 -->
83
+ <div
84
+ v-else-if="!multipleMode && !canEdit"
85
+ class="DshSelect-show"
86
+ >
87
+ <!-- 有值 -->
88
+ <bri-tooltip
89
+ v-if="!$isEmptyData(curVal)"
90
+ :content="showVal"
91
+ :transfer="true"
92
+ >
93
+ <dsh-tags
94
+ :class="{
92
95
  ...commonClass,
93
- 'DshSelect-show': true
94
- }">
95
- <!-- 有值 -->
96
- <dsh-tags
97
- v-if="!$isEmptyData(curVal)"
98
- class="text"
99
- :list="[curValObj]"
100
- ></dsh-tags>
101
-
102
- <!-- 无值 -->
103
- <template v-else>
104
- {{ emptyShowVal }}
105
- </template>
106
- </div>
107
- </bri-tooltip>
108
- </template>
96
+ 'DshSelect-show-ellipsis': !(isDetailShow && isFullRow)
97
+ }"
98
+ :list="[curValObj]"
99
+ ></dsh-tags>
100
+ </bri-tooltip>
101
+
102
+ <!-- 无值 -->
103
+ <div
104
+ v-else
105
+ :class="commonClass"
106
+ >
107
+ {{ emptyShowVal }}
108
+ </div>
109
109
  </div>
110
110
 
111
111
  <!-- 多选模式 -->
@@ -138,7 +138,8 @@
138
138
  selfPropsObj () {
139
139
  return {
140
140
  _transfer: true,
141
- ...this.selectPropsObj
141
+
142
+ ...this.basePropsObj
142
143
  };
143
144
  },
144
145
  radioGroupType () {
@@ -146,45 +147,12 @@
146
147
  }
147
148
  },
148
149
  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
- }
150
+ methods: {}
181
151
  };
182
152
  </script>
183
153
 
184
154
  <style lang="less">
185
155
  .DshSelect {
186
- width: 100%;
187
-
188
156
  &-flat {
189
157
  width: 100%;
190
158
 
@@ -249,10 +217,46 @@
249
217
  }
250
218
 
251
219
  &-scroll {
220
+ .bri-scrollbar3();
252
221
  overflow: auto;
253
222
  white-space: nowrap;
223
+ }
224
+ }
254
225
 
255
- .bri-scrollbar3();
226
+ &-dropdown {
227
+ .ivu-select-multiple {
228
+ .ivu-select-selection {
229
+ height: 32px;
230
+ .dsh-flex-row-between-center();
231
+
232
+ & > div {
233
+ width: 100%;
234
+ height: 100%;
235
+ word-break: keep-all;
236
+ white-space: nowrap;
237
+ overflow: auto;
238
+ .bri-scrollbar3();
239
+
240
+ .ivu-tag {
241
+ margin: 2px 4px 0px 0px;
242
+ background-color: @borderColor;
243
+ }
244
+ }
245
+ }
246
+
247
+ &.ivu-select-disabled {
248
+ .ivu-select-selection {
249
+ & > div {
250
+ .ivu-tag {
251
+ background-color: @border-disabled;
252
+ }
253
+ }
254
+ }
255
+ }
256
+
257
+ .ivu-select-item-selected:after {
258
+ content: none;
259
+ }
256
260
  }
257
261
  }
258
262
 
@@ -308,11 +312,10 @@
308
312
  }
309
313
  }
310
314
 
311
- &-tip {
312
- cursor: pointer;
313
-
314
- .ivu-radio {
315
- display: none;
315
+ // 查看
316
+ &-show {
317
+ &-ellipsis {
318
+ .dsh-ellipsis();
316
319
  }
317
320
  }
318
321
  }
@@ -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
  // 值为[]类型用的
@@ -122,6 +126,9 @@ export default {
122
126
  isFullRow () {
123
127
  return this.propsObj._span === 24 || !this.propsObj._span;
124
128
  },
129
+ clearable () {
130
+ return this.commonDealPropsObj._clearable;
131
+ },
125
132
  // showAlign () {
126
133
  // return !this.isUnitShow
127
134
  // ? "flex-start"
@@ -133,12 +140,17 @@ export default {
133
140
  // },
134
141
 
135
142
  /* 部分条件下 才使用的属性 */
143
+ // isShare () {
144
+ // return !!this.propsObj.isShare;
145
+ // },
136
146
  isInTable () {
137
147
  return !!this.propsObj.isInTable;
138
148
  },
149
+ // 高级搜索状态
139
150
  isOnSearch () {
140
151
  return !!this.propsObj.onSearch;
141
152
  },
153
+ // 默认搜索状态
142
154
  isOnDftSearch () {
143
155
  return !!this.propsObj.onDftSearch;
144
156
  },
@@ -148,9 +160,12 @@ export default {
148
160
  isUnitShow () {
149
161
  return this.isInTable && !this.canEdit;
150
162
  },
151
- // isShare () {
152
- // return !!this.propsObj.isShare;
153
- // },
163
+ isDetailUpdate () {
164
+ return !this.isInTable && !!this.canEdit;
165
+ },
166
+ isDetailShow () {
167
+ return !this.isInTable && !this.canEdit;
168
+ },
154
169
 
155
170
  /* 部分控件下 才使用的属性 */
156
171
  compKey () {
@@ -188,6 +203,12 @@ export default {
188
203
  this.$emit("refChange", this.value[this.controlKey]);
189
204
  },
190
205
 
206
+ // 点击输入框
207
+ clickInput () {
208
+ if (!this.selfPropsObj._disabled) {
209
+ this.openModal();
210
+ }
211
+ },
191
212
  /* ----- 工具方法 ------- */
192
213
  // 切换弹框
193
214
  toggleModal (bool) {
@@ -9,14 +9,11 @@ export default {
9
9
  props: {},
10
10
  data () {
11
11
  return {
12
- initListData: [],
13
- showTipTpl: false,
14
- showTipModal: false,
15
- dynamicContent: ""
12
+ initListData: []
16
13
  };
17
14
  },
18
15
  computed: {
19
- selectPropsObj () {
16
+ basePropsObj () {
20
17
  return {
21
18
  colorMap: resourceData.colorMap,
22
19
  _optionKind: "dropdown", // "flat"、"dropdown"
@@ -46,17 +43,8 @@ export default {
46
43
  : listData;
47
44
  },
48
45
 
49
- openTip () {
50
- return this.isOnSearch ? false : this.propsObj._openTip;
51
- },
52
- modalTipContent () {
53
- return this.propsObj._tipContent || this.dynamicContent || "暂无信息";
54
- },
55
-
56
46
  curValObj () {
57
- return this.$isEmptyData(this.curVal)
58
- ? undefined
59
- : this.getItemData(this.curVal);
47
+ return this.getItemObj(this.curVal);
60
48
  },
61
49
  valStr: {
62
50
  get () {
@@ -77,7 +65,7 @@ export default {
77
65
  },
78
66
  // 已选择项的对象列表
79
67
  curValObjList () {
80
- return this.curValList.map(key => this.getItemData(key));
68
+ return this.curValList.map(key => this.getItemObj(key));
81
69
  },
82
70
  valListStr () {
83
71
  return this.curValObjList.map(item => item.name || item._name).join("、");
@@ -93,129 +81,94 @@ export default {
93
81
  },
94
82
  methods: {
95
83
  init () {
96
- this.getTipData();
97
84
  this.getListData();
98
85
  },
99
86
 
100
- getItemData (key) {
101
- const obj = this.listData.find(item => item._key === key) || {
102
- _key: key,
103
- name: `温馨提示:选项${key}已找不到`
104
- };
105
-
106
- return {
107
- ...obj,
108
- style: this.getItemStyle(obj),
109
- color: undefined
110
- };
87
+ // 单选模式 点击选项
88
+ clickRadioItem (item, index) {
89
+ if (!this.getRadioItemDisabled(item)) {
90
+ if (this.curVal === item._key) {
91
+ if (this.clearable) {
92
+ this.curVal = "";
93
+ }
94
+ } else {
95
+ this.curVal = item._key;
96
+ }
97
+ }
111
98
  },
112
- getItemStyle (item) {
99
+ // 多选模式 点击选项
100
+ clickCheckItem (item, index) {
101
+ if (!this.getCheckItemDisabled(item)) {
102
+ if (this.curValList.includes(item._key)) {
103
+ this.curValList = this.curValList.filter(key => key !== item._key);
104
+ } else {
105
+ this.curValList = [...this.curValList, item._key];
106
+ }
107
+ }
108
+ },
109
+
110
+ /* ------- 方法 ------- */
111
+ getItemClass (item) {
112
+ return [
113
+ this.useColor
114
+ ? this.colorMap[item.color] ? item.color : "color-1"
115
+ : undefined,
116
+ item.class
117
+ ];
118
+ },
119
+ getItemColorStyle (item) {
113
120
  const color = this.colorMap[item.color] || this.colorMap["color-1"];
121
+ return this.useColor
122
+ ? {
123
+ backgroundColor: this.$getColor(color, 0.1),
124
+ color: color
125
+ }
126
+ : {};
127
+ },
128
+ getItemShowStyle (item) {
114
129
  return {
115
- "background-color": this.useColor ? this.$getColor(color, 0.1) : "#E5E5E5",
116
- color: this.useColor ? color : "rgba(0, 0, 0, 0.9)",
130
+ ...this.getItemColorStyle(item),
117
131
  display: "inline-block",
118
132
  "max-width": "100%",
119
133
  padding: "0px 6px",
120
134
  "border-radius": "4px"
121
135
  };
122
136
  },
123
- // 获取某项的置灰状态
124
- getItemDisabled (item) {
125
- return !!(this.selfPropsObj._disabled || item._disabled);
126
- },
137
+ // 获取单选项的置灰状态
138
+ getRadioItemDisabled (item) {
139
+ return !!(
140
+ this.selfPropsObj._disabled ||
141
+ item._disabled
142
+ );
143
+ },
144
+ // 获取多选项的置灰状态
145
+ getCheckItemDisabled (item) {
146
+ return !!(
147
+ this.selfPropsObj._disabled ||
148
+ item._disabled ||
149
+ (this.curValList.length >= this.selfPropsObj._max && !this.getCheckItemStatus(item))
150
+ );
151
+ },
152
+ // 获取多选项的选中状态
153
+ getCheckItemStatus (item) {
154
+ return this.curValList.includes(item._key);
155
+ },
156
+ getItemObj (key) {
157
+ const obj = this.listData.find(item => item._key === key) || {
158
+ _key: key,
159
+ name: `温馨提示:选项${key}已找不到`
160
+ };
127
161
 
128
- // 是否打开tip弹窗
129
- clickOpenTip (item) {
130
- if (item.__isTip__) {
131
- if (this.propsObj._tipKind === "dynamic" && !this.propsObj._tipContent) {
132
- this.getTipUrl();
133
- } else {
134
- this.showTipTpl = true;
135
- this.showTipModal = true;
136
- }
137
- }
138
- },
139
- getTipUrl () {
140
- if (this.propsObj._tipUrl) {
141
- this.$https({
142
- url: {
143
- module: "customPath",
144
- name: this.propsObj._tipUrl
145
- },
146
- params: {
147
- formData: this.value,
148
- propsObj: this.propsObj
149
- },
150
- callback: res => {
151
- this.dynamicContent = res;
152
- this.showTipTpl = true;
153
- this.showTipModal = true;
154
- }
155
- });
156
- } else {
157
- this.$Message.warning("请配置接口路径!");
158
- }
159
- },
160
- tipModalRender (h) {
161
- return this.showTipTpl
162
- ? h("dsh-modal", {
163
- props: {
164
- value: this.showTipModal,
165
- mode: "custom",
166
- propsObj: {
167
- title: "温馨提示",
168
- maskClosable: true,
169
- class: "DshSelect-modal"
170
- }
171
- },
172
- on: {
173
- input: bool => {
174
- this.showTipModal = bool;
175
- }
176
- }
177
- }, [
178
- h("div", {
179
- class: "DshSelect-modal-content",
180
- domProps: {
181
- innerHTML: this.modalTipContent
182
- }
183
- }),
184
- h("div", {
185
- class: "DshSelect-modal-footer"
186
- }, [
187
- h("Button", {
188
- props: {
189
- type: "primary"
190
- },
191
- on: {
192
- click: () => {
193
- this.showTipModal = false;
194
- }
195
- }
196
- }, "我知道了")
197
- ])
198
- ])
199
- : undefined;
200
- },
201
- getTipData () {
202
- if (
203
- (this.propsObj._key !== "_default") &&
204
- this.finalCanEdit &&
205
- this.openTip
206
- ) {
207
- let tipObj = {
208
- _key: "openTip",
209
- _name: this.propsObj._tipName || "其他",
210
- __isTip__: true,
211
- _disabled: true,
212
- color: "#6991cc",
213
- class: `Dsh${this.propsObj._type}-tip`
214
- };
215
- this.initListData.push(tipObj);
216
- }
162
+ return this.$isEmptyData(key)
163
+ ? undefined
164
+ : {
165
+ ...obj,
166
+ style: this.getItemShowStyle(obj),
167
+ color: undefined
168
+ };
217
169
  },
218
- // 接口 -获取自定义的接口数据
170
+
171
+ // TODO:待删除 接口 -获取自定义的接口数据
219
172
  getListData () {
220
173
  this.selfPropsObj._customData.forEach(item => {
221
174
  this.$https({
@@ -226,8 +179,8 @@ export default {
226
179
  ...this.initListData,
227
180
  ...data.list.map(dataItem =>
228
181
  ({
229
- _key: dataItem[item._key || "_key"],
230
- name: dataItem[item._name || "name"]
182
+ _key: dataItem._key,
183
+ name: dataItem.name
231
184
  })
232
185
  )
233
186
  ];
@@ -82,6 +82,5 @@
82
82
  <style lang="less" scoped>
83
83
  .BriTooltip {
84
84
  width: 100%;
85
- display: flex;
86
85
  }
87
86
  </style>
@@ -46,7 +46,7 @@
46
46
  <!-- label后可自定义内容 -->
47
47
  <dsh-render
48
48
  v-if="formItem._tipsRender"
49
- :render="tipsRender(formItem,formData)"
49
+ :render="tipsRender(formItem, formData)"
50
50
  ></dsh-render>
51
51
  </span>
52
52
  </bri-tooltip>
@@ -227,13 +227,13 @@
227
227
 
228
228
  &-left {
229
229
  flex: 1;
230
- min-width: 100px;
230
+ min-width: 0px;
231
231
  }
232
232
 
233
233
  &-right {
234
- max-width: 120px;
234
+ flex: none;
235
+ max-width: 80px;
235
236
  min-width: 0px;
236
- text-align: right;
237
237
  }
238
238
  }
239
239
 
File without changes