bri-components 1.2.4 → 1.2.5

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,118 +1,104 @@
1
1
  <template>
2
2
  <div class="DshSelect">
3
- <!-- optionKind值 'flat'、'dropdown' -->
4
3
  <template v-if="canEdit">
5
4
  <!-- 平铺 -->
6
- <RadioGroup
7
- v-if="['flat', 'button'].includes(showType)"
8
- :class="{
9
- 'DshSelect-radioGroup': true,
10
- 'DshSelect-radioGroup-useColor': selfPropsObj._useColor,
11
- 'DshSelect-radioGroup-scroll': selfPropsObj._span < 24 && !selfPropsObj._br
12
- }"
13
- v-model="value[controlKey]"
14
- :type="radioGroupType"
15
- @on-change="change"
16
- >
17
- <template v-if="listData.length">
18
- <Radio
19
- v-for="(item, index) in listData"
20
- :key="index"
21
- :class="getColorClass(item.color)"
22
- :style="{
23
- backgroundColor: selfPropsObj._useColor ? getBgColor(item.color) : undefined,
24
- color:selfPropsObj._useColor ? getColor(item.color) : undefined,
25
- }"
26
- :label="item._key"
27
- :disabled="item._disabled || !finalCanEdit"
28
- :border="selfPropsObj._useColor"
29
- @click.native="cancelSelect(item)"
30
- >
31
- <span @click.stop="clickOpenTip(item)">
32
- {{ item.name || item._name }}
33
- </span>
34
- </Radio>
5
+ <template v-if="['flat', 'button'].includes(showType)">
6
+ <RadioGroup
7
+ :class="{
8
+ 'DshSelect-radioGroup': true,
9
+ 'DshSelect-radioGroup-useColor': selfPropsObj._useColor,
10
+ 'DshSelect-radioGroup-scroll': selfPropsObj._span < 24 && !selfPropsObj._br
11
+ }"
12
+ v-model="value[controlKey]"
13
+ :type="radioGroupType"
14
+ @on-change="change"
15
+ >
16
+ <template v-if="listData.length">
17
+ <Radio
18
+ v-for="(item, index) in listData"
19
+ :key="index"
20
+ :class="getItemColorClass(item)"
21
+ :style="getItemStyle(item)"
22
+ :label="item._key"
23
+ :disabled="getItemDisabled(item)"
24
+ :border="useColor"
25
+ @click.native="cancelSelect(item)"
26
+ >
27
+ <span @click.stop="clickOpenTip(item)">
28
+ {{ item.name || item._name }}
29
+ </span>
30
+ </Radio>
31
+
32
+ </template>
35
33
 
36
- </template>
34
+ <div
35
+ v-else
36
+ class="dsh-subtip"
37
+ style="backgroundColor: #f3f3f3;"
38
+ >-- 无选择项 --</div>
39
+ </RadioGroup>
37
40
 
38
- <div
39
- v-else
40
- class="dsh-subtip"
41
- style="backgroundColor: #f3f3f3;"
42
- >-- 无选择项 --</div>
43
- </RadioGroup>
41
+ <!-- tip项弹框提示 -->
42
+ <dsh-render :render="tipModalRender"></dsh-render>
43
+ </template>
44
44
 
45
45
  <!-- 下拉 -->
46
- <Select
47
- v-else
48
- v-model="value[controlKey]"
49
- :placeholder="selfPropsObj._placeholder"
50
- :multiple="selfPropsObj._multiple"
51
- :disabled="!finalCanEdit"
52
- :clearable="selfPropsObj._clearable"
53
- :filterable="selfPropsObj._filterable"
54
- :size="selfPropsObj._size"
55
- :transfer="selfPropsObj._transfer"
56
- :transfer-class-name="selfPropsObj._transferClassName"
57
- @on-change="change"
58
- >
59
- <!-- </Option>必须和输出内容在一行,否则出现空格导致_filterable出bug -->
60
- <Option
61
- v-for="(item, index) in listData"
62
- :key="index"
63
- :value="item._key"
64
- :disabled="item._disabled || !finalCanEdit"
46
+ <template v-else>
47
+ <Select
48
+ v-model="curVal"
49
+ :placeholder="selfPropsObj._placeholder"
50
+ :multiple="selfPropsObj._multiple"
51
+ :disabled="!finalCanEdit"
52
+ :clearable="selfPropsObj._clearable"
53
+ :filterable="selfPropsObj._filterable"
54
+ :size="selfPropsObj._size"
55
+ :transfer="selfPropsObj._transfer"
56
+ :transfer-class-name="selfPropsObj._transferClassName"
57
+ @on-change="change"
65
58
  >
66
- <Icon
67
- v-if="item.icon || item.customIcon"
68
- :type="item.icon"
69
- :custom="item.customIcon ? `bico-font ${item.customIcon}` : undefined"
70
- :color="item.color"
71
- :size="item.size || 20"
72
- />{{ item.name || item._name }}
73
- </Option>
74
- </Select>
59
+ <!-- </Option>必须和输出内容在一行,否则出现空格导致_filterable出bug -->
60
+ <Option
61
+ v-for="(item, index) in listData"
62
+ :key="index"
63
+ :value="item._key"
64
+ :label="item.name || item._name"
65
+ :disabled="getItemDisabled(item)"
66
+ >
67
+ <Icon
68
+ v-if="item.icon || item.customIcon"
69
+ :type="item.icon"
70
+ :custom="item.customIcon ? `bico-font ${item.customIcon}` : undefined"
71
+ :color="item.color"
72
+ :size="item.size || 20"
73
+ />{{ item.name || item._name }}
74
+ </Option>
75
+ </Select>
76
+ </template>
75
77
  </template>
76
78
 
77
- <bri-tooltip
78
- v-else
79
- :content="showVal"
80
- maxWidth="200"
81
- placement="top"
82
- :transfer="true"
83
- >
84
- <div
85
- v-if="curSelectItem"
86
- class="DshSelect-value-wrapper"
87
- :style="{
88
- justifyContent: showAlign
89
- }"
79
+ <!-- 查看 -->
80
+ <template v-else>
81
+ <bri-tooltip
82
+ :content="showVal"
83
+ maxWidth="200"
84
+ placement="top"
85
+ :transfer="true"
90
86
  >
91
- <span
92
- class="DshSelect-value dsh-ellipsis"
93
- :style="{
94
- background: selfPropsObj._useColor ? getBgColor(curSelectItem.color, 0.1) : '',
95
- color: selfPropsObj._useColor ? getColor(curSelectItem.color) : ''
96
- }"
97
- >{{ showVal }}</span>
98
- </div>
99
- <div
100
- v-else
101
- class="bri-control-nodata dsh-ellipsis"
102
- >
103
- {{ emptyShowVal }}
104
- </div>
105
- </bri-tooltip>
106
-
107
- <!-- tip项弹框提示 -->
108
- <dsh-render :render="tipModalRender"></dsh-render>
87
+ <div :class="{
88
+ ...commonClass,
89
+ 'DshSelect-show': true
90
+ }">
91
+ {{ showVal }}
92
+ </div>
93
+ </bri-tooltip>
94
+ </template>
109
95
  </div>
110
96
  </template>
111
97
 
112
98
  <script>
113
- import { resourceData } from "bri-datas";
114
99
  import controlMixin from "../controlMixin.js";
115
100
  import selectMixin from "./selectMixin.js";
101
+ import { resourceData } from "bri-datas";
116
102
 
117
103
  export default {
118
104
  name: "DshSelect",
@@ -123,23 +109,15 @@
123
109
  props: {},
124
110
  data () {
125
111
  return {
126
- flag: false,
127
- initListData: [],
128
- getBgColor: color => {
129
- let curColor = this.colorMap[color] || this.colorMap["color-1"];
130
- return this.$getColor(curColor, 0.1);
131
- },
132
- getColor: color => {
133
- return this.colorMap[color] || this.colorMap["color-1"];
134
- },
135
- getColorClass: color => {
136
- return this.colorMap[color] ? color : "color-1";
137
- }
112
+ flag: false
138
113
  };
139
114
  },
140
115
  computed: {
141
116
  selfPropsObj () {
142
117
  return {
118
+ _optionKind: "dropdown", // 'flat'、'dropdown'
119
+ _useColor: false,
120
+ colorMap: resourceData.colorMap,
143
121
  _filterable: true,
144
122
  _transfer: true,
145
123
  _data: [],
@@ -154,25 +132,30 @@
154
132
  radioGroupType () {
155
133
  return this.showType === "button" ? "button" : undefined;
156
134
  },
135
+ useColor () {
136
+ return this.selfPropsObj._useColor;
137
+ },
157
138
  colorMap () {
158
- return this.selfPropsObj.colorMap || resourceData.colorMap;
139
+ return this.selfPropsObj.colorMap;
159
140
  },
160
141
 
161
142
  listData () {
162
- const listData = (this.selfPropsObj._data || []).concat(this.initListData);
163
- if (this.$dataType(this.selfPropsObj._filterFunc, "function")) {
164
- return this.selfPropsObj._filterFunc(listData, this.selfPropsObj, this.value);
165
- } else {
166
- return listData;
167
- }
143
+ const listData = this.selfPropsObj._data.concat(this.initListData);
144
+
145
+ return this.$dataType(this.selfPropsObj._filterFunc, "function")
146
+ ? this.selfPropsObj._filterFunc(listData, this.selfPropsObj, this.value)
147
+ : listData;
168
148
  },
169
- curSelectItem () {
170
- return this.listData.find(item => item._key === this.value[this.controlKey]);
149
+ curValObj () {
150
+ return this.listData.find(item => item._key === this.curVal) || {
151
+ _key: this.curVal,
152
+ name: `温馨提示:选项${this.curVal}已找不到`
153
+ };
171
154
  },
172
155
  showVal () {
173
- return this.curSelectItem
174
- ? this.curSelectItem.name || this.curSelectItem._name
175
- : "";
156
+ return this.$isEmptyData(this.curValList)
157
+ ? this.emptyShowVal
158
+ : this.curValObj.name || this.curValObj._name;
176
159
  }
177
160
  },
178
161
  created () {
@@ -207,7 +190,7 @@
207
190
  // 取消flat模式的选择项
208
191
  cancelSelect (item) {
209
192
  if (item._disabled !== true && this.selfPropsObj._clearable !== false) {
210
- if (item._key === this.value[this.controlKey]) {
193
+ if (item._key === this.curVal) {
211
194
  this.value[this.controlKey] = "";
212
195
 
213
196
  this.change();
@@ -222,7 +205,22 @@
222
205
  this.value[this.controlKey] = "";
223
206
  }
224
207
 
225
- this.$emit("change", this.value[this.controlKey]);
208
+ this.$emit("change", this.curVal);
209
+ },
210
+
211
+ getItemColorClass (item) {
212
+ return this.colorMap[item.color] ? item.color : "color-1";
213
+ },
214
+ getItemStyle (item) {
215
+ const color = this.colorMap[item.color] || this.colorMap["color-1"];
216
+ return {
217
+ background: this.useColor ? this.$getColor(color, 0.1) : undefined,
218
+ color: this.useColor ? color : undefined
219
+ };
220
+ },
221
+ // 获取某项的置灰状态
222
+ getItemDisabled (item) {
223
+ return !!(!this.finalCanEdit || item._disabled);
226
224
  }
227
225
  }
228
226
  };
@@ -20,17 +20,18 @@
20
20
  </template>
21
21
 
22
22
  <!-- 查看 -->
23
- <span v-else
23
+ <span
24
+ v-else
24
25
  :class="{
25
- 'DshSwitch-show': true,
26
- ...commonClass
26
+ ...commonClass,
27
+ 'DshSwitch-show': true
27
28
  }"
28
29
  :style="{
29
30
  background: curVal ? '#d3f3dcff' : '#FDEDED',
30
31
  color: curVal ? '#37C45E' : '#E83636'
31
32
  }"
32
33
  >
33
- {{ showText }}
34
+ {{ showVal }}
34
35
  </span>
35
36
  </div>
36
37
  </template>
@@ -47,7 +48,7 @@
47
48
  return {};
48
49
  },
49
50
  computed: {
50
- showText () {
51
+ showVal () {
51
52
  return this.value[this.controlKey]
52
53
  ? this.propsObj._openText
53
54
  : this.propsObj._closeText;
@@ -63,7 +63,7 @@ export default {
63
63
  ? "--"
64
64
  : "暂无内容";
65
65
  },
66
- showText () {
66
+ showVal () {
67
67
  return this.$isEmptyData(this.curVal) ? this.emptyShowVal : this.curVal;
68
68
  },
69
69
 
@@ -85,6 +85,9 @@ export default {
85
85
  isUnitShow () {
86
86
  return !this.canEdit && this.inTable;
87
87
  },
88
+ multipleMode () {
89
+ return !!this.propsObj._multiple;
90
+ },
88
91
  commonDealPropsObj () {
89
92
  const selectControlTypes = ["date", "switch", "select", "checkbox", "file", "region", "regions", "cascader", "cascaders", "coordinates", "users", "departments"];
90
93
  return {
@@ -6,67 +6,70 @@
6
6
  :transfer="true"
7
7
  maxWidth="200"
8
8
  >
9
- <!-- 编辑 -->
10
- <div
11
- v-if="canEdit"
12
- :class="{
13
- ...commonClass,
14
- 'selectUsers-edit': true
15
- }"
16
- @mouseenter="isHover = true"
17
- @mouseleave="isHover = false"
18
- @click="clickInput"
19
- >
20
- <!-- 有值 -->
21
- <template v-if="!$isEmptyData(curValList)">
22
- <dsh-tags
23
- class="text"
24
- :list="curValList"
25
- :propsObj="{
26
- disabled: !finalCanEdit,
27
- closable: true
9
+ <div @click.stop="clickInput">
10
+ <slot>
11
+ <!-- 编辑 -->
12
+ <div
13
+ v-if="canEdit"
14
+ :class="{
15
+ ...commonClass,
16
+ 'selectUsers-edit': true
28
17
  }"
29
- @delete="clickDeleteItem"
30
- ></dsh-tags>
31
- </template>
32
- <!-- 无值 -->
33
- <template v-else>
34
- {{ emptyShowVal }}
35
- </template>
18
+ @mouseenter="isHover = true"
19
+ @mouseleave="isHover = false"
20
+ >
21
+ <!-- 有值 -->
22
+ <template v-if="!$isEmptyData(curValList)">
23
+ <dsh-tags
24
+ class="text"
25
+ :list="curValList"
26
+ :propsObj="{
27
+ disabled: !finalCanEdit,
28
+ closable: true
29
+ }"
30
+ @delete="clickDeleteItem"
31
+ ></dsh-tags>
32
+ </template>
33
+ <!-- 无值 -->
34
+ <template v-else>
35
+ {{ emptyShowVal }}
36
+ </template>
36
37
 
37
- <!-- 图标 -->
38
- <template>
39
- <Icon
40
- v-if="!$isEmptyData(curValList) && selfPropsObj._clearable && isHover"
41
- class="icon-close"
42
- type="ios-close-circle"
43
- @click.stop="clickClear"
44
- />
45
- <Icon
46
- v-else
47
- class="icon-default"
48
- :type="inputIcon"
49
- />
50
- </template>
51
- </div>
38
+ <!-- 图标 -->
39
+ <template>
40
+ <Icon
41
+ v-if="!$isEmptyData(curValList) && selfPropsObj._clearable && isHover"
42
+ class="icon-close"
43
+ type="ios-close-circle"
44
+ @click.stop="clickClear"
45
+ />
46
+ <Icon
47
+ v-else
48
+ class="icon-default"
49
+ :type="inputIcon"
50
+ />
51
+ </template>
52
+ </div>
52
53
 
53
- <!-- 查看 -->
54
- <div
55
- v-else
56
- :class="{
57
- ...commonClass,
58
- 'selectUsers-show': true
59
- }"
60
- >
61
- <dsh-tags
62
- v-if="!$isEmptyData(curValList)"
63
- class="text"
64
- :list="curValList"
65
- ></dsh-tags>
54
+ <!-- 查看 -->
55
+ <div
56
+ v-else
57
+ :class="{
58
+ ...commonClass,
59
+ 'selectUsers-show': true
60
+ }"
61
+ >
62
+ <dsh-tags
63
+ v-if="!$isEmptyData(curValList)"
64
+ class="text"
65
+ :list="curValList"
66
+ ></dsh-tags>
66
67
 
67
- <template v-else>
68
- {{ emptyShowVal }}
69
- </template>
68
+ <template v-else>
69
+ {{ emptyShowVal }}
70
+ </template>
71
+ </div>
72
+ </slot>
70
73
  </div>
71
74
  </bri-tooltip>
72
75
 
@@ -213,9 +216,7 @@
213
216
  components: {
214
217
  departmentMenu
215
218
  },
216
- props: {
217
- showSelectUserModalOnly: Boolean
218
- },
219
+ props: {},
219
220
  data () {
220
221
  return {
221
222
  isHover: false,
@@ -392,6 +393,7 @@
392
393
  clickConfirm () {
393
394
  this.closeModal();
394
395
  this.curValList = this.newValList;
396
+ this.curDepartment = {};
395
397
  },
396
398
 
397
399
  /* ----------- 接口方法 ------------- */
@@ -456,12 +458,6 @@
456
458
  });
457
459
  }
458
460
  },
459
- watch: {
460
- showSelectUserModalOnly (nV, oV) {
461
- nV && this.init();
462
- nV && this.openModal();
463
- }
464
- },
465
461
  filters: {
466
462
  isActive (item, list) {
467
463
  return list.some(o => o._key === item._key) ? "selectUsers-list-item-active" : "";
@@ -36,7 +36,7 @@
36
36
  v-if="selfPropsObj.closable"
37
37
  slot="close"
38
38
  class="BriDrawer-close"
39
- type="ios-close-circle"
39
+ type="md-close"
40
40
  size="20"
41
41
  @click.stop="clickClose"
42
42
  />
@@ -41,7 +41,7 @@
41
41
  <Icon
42
42
  v-if="selfPropsObj.showSlotClose !== false"
43
43
  class="DshModal-close"
44
- type="ios-close-circle"
44
+ type="md-close"
45
45
  size="20"
46
46
  @click.native.stop="visibleChange(false)"
47
47
  />
package/src/index.js CHANGED
@@ -81,7 +81,11 @@ import BriUploadImage from "./components/controls/base/BriUpload/BriUploadImage.
81
81
  import DshCoordinates from "./components/controls/base/DshCoordinates.vue";
82
82
  import DshEditor from "./components/controls/base/DshEditor.vue";
83
83
  import DshDivider from "./components/controls/base/DshDivider.vue";
84
+
84
85
  import DshPackage from "./components/controls/senior/DshPackage.vue";
86
+ import selectUsers from "./components/controls/senior/selectUsers/selectUsers.vue";
87
+ import selectDepartments from "./components/controls/senior/selectDepartments.vue";
88
+
85
89
  import DshBack from "./components/controls/special/DshBack.vue";
86
90
  import DshUndeveloped from "./components/controls/special/DshUndeveloped.vue";
87
91
 
@@ -224,6 +228,8 @@ export {
224
228
  DshPackage,
225
229
  DshBack,
226
230
  DshUndeveloped,
231
+ selectUsers,
232
+ selectDepartments,
227
233
 
228
234
  // other
229
235
  BriCode,
@@ -10,14 +10,6 @@
10
10
  color: @textColor;
11
11
  }
12
12
  }
13
-
14
- &-unit {
15
-
16
- }
17
-
18
- &-show {
19
-
20
- }
21
13
  }
22
14
 
23
15
  .ivu-input-number {
@@ -135,25 +135,6 @@
135
135
  }
136
136
  }
137
137
 
138
- &-value {
139
- height: 24px;
140
- line-height: 20px;
141
- padding: 2px 8px;
142
- border-radius: 4px;
143
- margin-right: 8px;
144
- display: inline-flex;
145
-
146
- &:last-of-type {
147
- margin-right: 0px;
148
- }
149
-
150
- &-wrapper {
151
- min-height: 32px;
152
- padding: 4px 0;
153
- .dsh-ellipsis();
154
- }
155
- }
156
-
157
138
  &-tip {
158
139
  cursor: pointer;
159
140
 
@@ -35,7 +35,7 @@
35
35
  color: @textColor-disabled
36
36
  }
37
37
  &-icon {
38
- margin-right: 3px;
38
+ margin-right: 8px;
39
39
  }
40
40
  &-name {
41
41