bri-components 1.2.1 → 1.2.2

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.
Files changed (33) hide show
  1. package/lib/0.bri-components.min.js +1 -1
  2. package/lib/1.bri-components.min.js +1 -1
  3. package/lib/5.bri-components.min.js +1 -1
  4. package/lib/bri-components.min.js +5 -5
  5. package/package.json +1 -1
  6. package/src/components/controls/base/BriUpload/BriUploadImage.vue +45 -32
  7. package/src/components/controls/base/BriUpload/uploadMixin.js +3 -2
  8. package/src/components/controls/base/DshCascader/DshCascader.vue +3 -6
  9. package/src/components/controls/base/DshCheckbox.vue +130 -137
  10. package/src/components/controls/base/DshCoordinates.vue +121 -147
  11. package/src/components/controls/base/DshDaterange.vue +1 -1
  12. package/src/components/controls/base/DshEditor.vue +2 -1
  13. package/src/components/controls/base/DshSelect.vue +3 -13
  14. package/src/components/controls/base/DshSwitch.vue +13 -20
  15. package/src/components/controls/controlMixin.js +10 -1
  16. package/src/components/controls/senior/BriLabels.vue +1 -0
  17. package/src/components/controls/senior/selectUsers/DepartmentMenu.vue +2 -2
  18. package/src/components/small/DshTags.vue +131 -8
  19. package/src/styles/common/control.less +4 -2
  20. package/src/styles/components/controls/.DS_Store +0 -0
  21. package/src/styles/components/controls/base/BriUpload/BriUpload.less +1 -1
  22. package/src/styles/components/controls/base/BriUpload/BriUploadImage.less +6 -0
  23. package/src/styles/components/controls/base/DshCascader/DshCascader.less +16 -11
  24. package/src/styles/components/controls/base/DshCheckbox.less +32 -59
  25. package/src/styles/components/controls/base/DshCoordinates.less +1 -35
  26. package/src/styles/components/controls/base/DshSelect.less +16 -1
  27. package/src/styles/components/controls/base/DshSwitch.less +1 -31
  28. package/src/styles/components/controls/senior/.DS_Store +0 -0
  29. package/src/styles/components/controls/senior/BriLabels.less +1 -1
  30. package/src/styles/components/list/BriFlatTable.less +1 -1
  31. package/src/styles/components/small/DshModal.less +20 -42
  32. package/src/styles/components/small/DshTags.less +32 -14
  33. package/src/styles/components/unit/DshFormItem.less +3 -25
@@ -1,161 +1,135 @@
1
1
  <template>
2
2
  <div class="DshCoordinates">
3
3
  <bri-tooltip
4
- :content="curValName"
4
+ :content="showText"
5
5
  placement="top"
6
6
  maxWidth="200"
7
7
  :transfer="true"
8
8
  >
9
- <!-- 编辑 -->
10
- <template v-if="canEdit">
11
- <div
12
- :class="{
13
- ...commonClass,
14
- 'DshCoordinates-edit': true
15
- }"
16
- @click="clickOpenModal"
9
+ <div
10
+ :class="{
11
+ ...commonClass,
12
+ 'DshCoordinates-edit': true
13
+ }"
14
+ @click.stop="clickOpenModal"
15
+ >
16
+ <div class="text">
17
+ {{ showText }}
18
+ </div>
19
+
20
+ <Icon
21
+ v-if="finalCanEdit && selfPropsObj._clearable"
22
+ class="icon-close"
23
+ type="md-close"
24
+ @click.stop="clickDelete"
25
+ />
26
+ </div>
27
+ </bri-tooltip>
28
+
29
+ <!-- 模态框 -->
30
+ <Modal
31
+ v-if="canEdit"
32
+ class="DshCoordinates-modal"
33
+ v-model="showModal"
34
+ title="选择位置"
35
+ :footer-hide="true"
36
+ :styles="modalStyles"
37
+ @on-cancel="clickCancel"
38
+ >
39
+ <div
40
+ slot="header"
41
+ class="DshCoordinates-modal-header"
42
+ >
43
+ <Row
44
+ v-if="finalCanEdit"
45
+ class="edit"
46
+ type="flex"
47
+ justify="center"
48
+ align="bottom"
17
49
  >
18
- <!-- 有值 -->
19
- <div
20
- v-if="!$isEmptyData(curVal)"
21
- class="value"
22
- >
23
- <span class="value-name">
24
- {{ curValName }}
25
- </span>
26
- <Icon
27
- v-if="selfPropsObj._clearable"
28
- class="value-icon"
29
- type="md-close"
30
- @click.stop="clickDelete"
31
- />
50
+ <Col span="8">
51
+ <div>
52
+ <RadioGroup v-model="formData.kind">
53
+ <Radio label="keyword">按关键字搜索</Radio>
54
+ <Radio label="coordinate">按坐标搜索</Radio>
55
+ </RadioGroup>
32
56
  </div>
57
+ <Row class="dsh-margin-top5">
58
+ <Col span="16">
59
+ <Input
60
+ v-model="formData.searchText"
61
+ placeholder="请输入..."
62
+ :clearable="true"
63
+ @on-enter="clickSearch"
64
+ />
65
+ <span class="edit-message">{{ searchMessage }}</span>
66
+ </Col>
67
+ <Col span="8">&nbsp;
68
+ <Button
69
+ type="primary"
70
+ @click="clickSearch"
71
+ >搜索</Button>
72
+ </Col>
73
+ </Row>
74
+ </Col>
33
75
 
34
- <!-- 无值 -->
35
- <div
36
- v-else
37
- class="nodata"
38
- >
39
- 点击获取当前位置
40
- <i class="nodata-icon bico-font bico-zuobiao"></i>
41
- </div>
76
+ <Col span="8">
77
+ <div class="edit-text">坐标获取结果</div>
78
+ <Row class="dsh-margin-top5">
79
+ <Col span="16">
80
+ <Input
81
+ :value="curVal.name"
82
+ :readonly="true"
83
+ :clearable="true"
84
+ @on-clear="clickClear"
85
+ @click.native="clickMapFitView"
86
+ />
87
+ </Col>
88
+ <Col span="8">&nbsp;
89
+ <Button
90
+ type="primary"
91
+ @click="clickConfirm"
92
+ >确认</Button>
93
+ </Col>
94
+ </Row>
95
+ </Col>
96
+ </Row>
42
97
 
43
- <!-- 模态框 -->
44
- <Modal
45
- class="DshCoordinates-modal"
46
- v-model="showModal"
47
- title="选择位置"
48
- :footer-hide="true"
49
- :styles="modalStyles"
50
- @on-cancel="clickCancel"
98
+ <Row
99
+ v-else
100
+ class="show"
101
+ >
102
+ <Col
103
+ span="6"
104
+ class="show-name"
51
105
  >
52
- <div
53
- slot="header"
54
- class="DshCoordinates-modal-header"
55
- >
56
- <Row
57
- v-if="finalCanEdit"
58
- class="edit"
59
- type="flex"
60
- justify="center"
61
- align="bottom"
62
- >
63
- <Col span="8">
64
- <div>
65
- <RadioGroup v-model="formData.kind">
66
- <Radio label="keyword">按关键字搜索</Radio>
67
- <Radio label="coordinate">按坐标搜索</Radio>
68
- </RadioGroup>
69
- </div>
70
- <Row class="dsh-margin-top5">
71
- <Col span="16">
72
- <Input
73
- v-model="formData.searchText"
74
- placeholder="请输入..."
75
- :clearable="true"
76
- @on-enter="clickSearch"
77
- />
78
- <span class="edit-message">{{ searchMessage }}</span>
79
- </Col>
80
- <Col span="8">&nbsp;
81
- <Button
82
- type="primary"
83
- @click="clickSearch"
84
- >搜索</Button>
85
- </Col>
86
- </Row>
87
- </Col>
88
-
89
- <Col span="8">
90
- <div class="edit-text">坐标获取结果</div>
91
- <Row class="dsh-margin-top5">
92
- <Col span="16">
93
- <Input
94
- :value="curVal.name"
95
- :readonly="true"
96
- :clearable="true"
97
- @on-clear="clickClear"
98
- @click.native="clickMapFitView"
99
- />
100
- </Col>
101
- <Col span="8">&nbsp;
102
- <Button
103
- type="primary"
104
- @click="clickConfirm"
105
- >确认</Button>
106
- </Col>
107
- </Row>
108
- </Col>
109
- </Row>
110
-
111
- <Row
112
- v-else
113
- class="show"
114
- >
115
- <Col
116
- span="6"
117
- class="show-name"
118
- >
119
- 当前位置:
120
- </Col>
121
- <Col span="12">
122
- <Input
123
- :value="curVal.name"
124
- :readonly="true"
125
- @click.native="clickMapFitView"
126
- />
127
- </Col>
128
- <Col span="6">
129
- </Col>
130
- </Row>
131
- </div>
106
+ 当前位置:
107
+ </Col>
108
+ <Col span="12">
109
+ <Input
110
+ :value="curVal.name"
111
+ :readonly="true"
112
+ @click.native="clickMapFitView"
113
+ />
114
+ </Col>
115
+ <Col span="6">
116
+ </Col>
117
+ </Row>
118
+ </div>
132
119
 
133
- <transition>
134
- <div
135
- v-if="showModal"
136
- id="mapContain"
137
- class="DshCoordinates-modal-map"
138
- ></div>
139
- </transition>
140
-
141
- <div
142
- ref="divCoordinate"
143
- style="display: none; position:absolute;background:#fff;padding: 5px 10px"
144
- ></div>
145
- </Modal>
146
- </div>
147
- </template>
120
+ <transition>
121
+ <div
122
+ v-if="showModal"
123
+ id="mapContain"
124
+ class="DshCoordinates-modal-map"
125
+ ></div>
126
+ </transition>
148
127
 
149
- <!-- 查看 -->
150
- <template v-else>
151
- <span :class="{
152
- ...commonClass,
153
- 'DshCoordinates-show': true
154
- }">
155
- {{ curValName || emptyShowVal }}
156
- </span>
157
- </template>
158
- </bri-tooltip>
128
+ <div
129
+ ref="divCoordinate"
130
+ style="display: none; position:absolute;background:#fff;padding: 5px 10px"
131
+ ></div>
132
+ </Modal>
159
133
  </div>
160
134
  </template>
161
135
 
@@ -193,8 +167,8 @@
193
167
  this.value[this.controlKey] = val;
194
168
  }
195
169
  },
196
- curValName () {
197
- return this.curVal && this.curVal.name;
170
+ showText () {
171
+ return this.$isEmptyData(this.curVal) ? this.emptyShowVal : this.curVal.name;
198
172
  },
199
173
  curLnglat: {
200
174
  get () {
@@ -248,7 +222,7 @@
248
222
  methods: {
249
223
  // 打开窗体
250
224
  clickOpenModal () {
251
- if (this.canEdit) {
225
+ if (this.finalCanEdit) {
252
226
  this.showModal = true;
253
227
  this.cloneValue = this.$deepCopy(this.curVal);
254
228
  this.getMap();
@@ -169,7 +169,7 @@
169
169
  {
170
170
  _key: "dyn_month_start",
171
171
  name: "月初",
172
- numbers: [0],
172
+ numbers: [0, 1],
173
173
  dateTypes: ["month", "date", "datetime", "daterange", "datetimerange"]
174
174
  },
175
175
  {
@@ -41,6 +41,7 @@
41
41
  <div
42
42
  v-if="isUnitShow"
43
43
  :class="{
44
+ ...commonClass,
44
45
  'DshEditor-unit': !$isEmptyData(curVal)
45
46
  }"
46
47
  >
@@ -144,7 +145,7 @@
144
145
  });
145
146
  } else if (ossType === "local") {
146
147
  that.localUpload(fileItem, result.data, res => {
147
- insertImg(res.url);
148
+ insertImg(res.data.url);
148
149
  });
149
150
  } else {
150
151
  console.log(`请开发这种类型‘${ossType}’的上传模式`);
@@ -76,7 +76,7 @@
76
76
 
77
77
  <bri-tooltip
78
78
  v-else
79
- :content="valStr"
79
+ :content="showVal"
80
80
  maxWidth="200"
81
81
  placement="top"
82
82
  :transfer="true"
@@ -85,7 +85,7 @@
85
85
  v-if="curSelectItem"
86
86
  class="DshSelect-value-wrapper"
87
87
  :style="{
88
- justifyContent: flatShowAlign
88
+ justifyContent: showAlign
89
89
  }"
90
90
  >
91
91
  <span
@@ -169,20 +169,10 @@
169
169
  curSelectItem () {
170
170
  return this.listData.find(item => item._key === this.value[this.controlKey]);
171
171
  },
172
- valStr () {
172
+ showVal () {
173
173
  return this.curSelectItem
174
174
  ? this.curSelectItem.name || this.curSelectItem._name
175
175
  : "";
176
- },
177
- showVal () {
178
- return this.valStr;
179
- },
180
- flatShowAlign () {
181
- return !this.propsObj._align || this.propsObj._align === "left" || !this.isUnitShow
182
- ? "flex-start"
183
- : this.propsObj._align === "right"
184
- ? "flex-end"
185
- : "center";
186
176
  }
187
177
  },
188
178
  created () {
@@ -7,6 +7,7 @@
7
7
  v-model="curVal"
8
8
  :disabled="!finalCanEdit"
9
9
  :size="propsObj._size"
10
+ false-color="#CCCCCC"
10
11
  @on-change="change"
11
12
  >
12
13
  <span slot="open">
@@ -19,26 +20,18 @@
19
20
  </template>
20
21
 
21
22
  <!-- 查看 -->
22
- <template v-else>
23
- <bri-tooltip
24
- :content="showText"
25
- placement="top"
26
- :transfer="true"
27
- maxWidth="200"
28
- >
29
- <div class="DshSwitch-show">
30
- <span
31
- class="DshSwitch-show-name"
32
- :style="{
33
- background: curVal ? '#ECF3FD' : '#FEF6EB',
34
- color: curVal ? '#3D84EE' : '#F4A135'
35
- }"
36
- >
37
- {{ showText }}
38
- </span>
39
- </div>
40
- </bri-tooltip>
41
- </template>
23
+ <span v-else
24
+ :class="{
25
+ 'DshSwitch-show': true,
26
+ ...commonClass
27
+ }"
28
+ :style="{
29
+ background: curVal ? '#d3f3dcff' : '#FDEDED',
30
+ color: curVal ? '#37C45E' : '#E83636'
31
+ }"
32
+ >
33
+ {{ showText }}
34
+ </span>
42
35
  </div>
43
36
  </template>
44
37
 
@@ -97,9 +97,18 @@ export default {
97
97
  "bri-control-show": !this.canEdit && !this.isUnitShow,
98
98
 
99
99
  "dsh-ellipsis": true,
100
- "bri-control-nodata": !this.isUnitShow && this.$isEmptyData(this.curVal)
100
+ "bri-control-nodata": this.$isEmptyData(this.curVal)
101
101
  };
102
102
  },
103
+ showAlign () {
104
+ return !this.isUnitShow
105
+ ? "flex-start"
106
+ : this.propsObj._align === "right"
107
+ ? "flex-end"
108
+ : this.propsObj._align === "center"
109
+ ? "center"
110
+ : "flex-start";
111
+ },
103
112
 
104
113
  // 部分控件或部分条件下 才使用的属性
105
114
  inTable () {
@@ -26,6 +26,7 @@
26
26
  :propsObj="{
27
27
  disabled: !finalCanEdit
28
28
  }"
29
+ :autoEllipsis="true"
29
30
  @delete="clickDeleteItem"
30
31
  >
31
32
  <span slot-scope="{ tagItem }">
@@ -36,7 +36,7 @@
36
36
  <span>
37
37
  <Icon
38
38
  v-if="depart.children && depart.children.length"
39
- :type="iconType(depart)"
39
+ :type="getIcon(depart)"
40
40
  @click.stop="toggleChildren(depart)"
41
41
  />
42
42
  <span class="DepartmentMenu-item-name-text">
@@ -124,7 +124,7 @@
124
124
  };
125
125
  },
126
126
  computed: {
127
- iconType () {
127
+ getIcon () {
128
128
  return function (depart) {
129
129
  return depart.isShowChildren ? "ios-arrow-down" : "ios-arrow-forward";
130
130
  };
@@ -1,15 +1,23 @@
1
1
  <template>
2
- <div class="DshTags">
2
+ <div
3
+ ref="DshTags"
4
+ :class="{
5
+ 'DshTags': true,
6
+ 'DshTags-autoEllipsis': autoEllipsis
7
+ }"
8
+ >
3
9
  <Tag
4
- v-for="(tagItem, tagIndex) in list"
10
+ v-for="(tagItem, tagIndex) in computedList"
5
11
  :key="tagIndex"
6
- :disabled="propsObj.disabled || tagItem.disabled"
12
+ ref="tagItem"
13
+ :style="tagItem.style"
14
+ :disabled="getItemDisabled(tagItem)"
7
15
  :name="tagIndex"
8
16
  :type="propsObj.type"
9
- :closable="closable(tagItem)"
17
+ :closable="getItemClosable(tagItem)"
10
18
  :checkable="propsObj.checkable"
11
19
  :checked="propsObj.checked"
12
- :color="propsObj.color || 'default'"
20
+ :color="propsObj.color || tagItem.color || 'primary'"
13
21
  :fade="propsObj.fade || false"
14
22
  :size="propsObj.size || 'medium'"
15
23
  @on-close="deleteTag($event, tagItem, tagIndex)"
@@ -19,6 +27,52 @@
19
27
  {{ $dataType(tagItem) === "object" ? tagItem.realname || tagItem.full_name || tagItem.name : tagItem }}
20
28
  </slot>
21
29
  </Tag>
30
+
31
+ <!-- 更多 -->
32
+ <Tag
33
+ v-if="subList.length"
34
+ :type="propsObj.type"
35
+ :checkable="propsObj.checkable"
36
+ :checked="propsObj.checked"
37
+ :color="propsObj.color || 'default'"
38
+ :fade="propsObj.fade || false"
39
+ :size="propsObj.size || 'medium'"
40
+ :disabled="propsObj.disabled"
41
+ >
42
+ <Poptip
43
+ :transfer="true"
44
+ :width="200"
45
+ trigger="hover"
46
+ word-wrap
47
+ placement="bottom"
48
+ popper-class="DshTags-poptip"
49
+ >
50
+ <dsh-icons :list="[moreOperation]" />
51
+ {{ subList.length }}项
52
+ <div slot="content">
53
+ <Tag
54
+ v-for="(tagItem, tagIndex) in subList"
55
+ :key="tagIndex"
56
+ :disabled="getItemDisabled(tagItem)"
57
+ :name="tagIndex"
58
+ :type="propsObj.type"
59
+ :closable="getItemClosable(tagItem)"
60
+ :checkable="propsObj.checkable"
61
+ :checked="propsObj.checked"
62
+ :color="propsObj.color || 'default'"
63
+ :fade="propsObj.fade || false"
64
+ :size="propsObj.size || 'medium'"
65
+ class="DshTags-poptip-tag"
66
+ @on-close="deleteTag($event, tagItem, tagIndex)"
67
+ @on-change="changeChecked"
68
+ >
69
+ <slot :tagItem="tagItem">
70
+ {{ $dataType(tagItem) === "object" ? tagItem.realname || tagItem.full_name || tagItem.name : tagItem }}
71
+ </slot>
72
+ </Tag>
73
+ </div>
74
+ </Poptip>
75
+ </Tag>
22
76
  </div>
23
77
  </template>
24
78
 
@@ -37,27 +91,96 @@
37
91
  default () {
38
92
  return {};
39
93
  }
94
+ },
95
+ autoEllipsis: {
96
+ type: Boolean,
97
+ default: false
40
98
  }
41
99
  },
42
100
  data () {
43
101
  return {
44
- closable (tagItem) {
45
- return this.propsObj.disabled || tagItem.disabled ? false : (this.propsObj.closable !== false);
102
+ maxTagCount: undefined,
103
+
104
+ getItemDisabled (item) {
105
+ return this.propsObj.disabled || item._disabled || item.disabled;
106
+ },
107
+ getItemClosable (item) {
108
+ return this.getItemDisabled(item) ? false : (this.propsObj.closable !== false);
46
109
  }
47
110
  };
48
111
  },
49
- computed: {},
112
+ computed: {
113
+ moreOperation () {
114
+ return {
115
+ customIcon: "bico-gengduo"
116
+ };
117
+ },
118
+ computedList () {
119
+ return this.list.slice(0, this.maxTagCount);
120
+ },
121
+ subList () {
122
+ if (this.autoEllipsis && this.maxTagCount) {
123
+ return this.list.slice(this.maxTagCount);
124
+ } else {
125
+ return [];
126
+ }
127
+ }
128
+ },
50
129
  created () {},
130
+ mounted () {
131
+ this.callEliipsis();
132
+
133
+ window.addEventListener("resize", this.callEliipsis, true);
134
+ },
51
135
  methods: {
52
136
  // 删除标签
53
137
  deleteTag (event, item, index) {
54
138
  this.list.splice(index, 1);
139
+ this.getAutoEllipsis();
55
140
  this.$emit("delete", item, index);
56
141
  },
57
142
  // 改变标签状态
58
143
  changeChecked (checked, name) {
59
144
 
145
+ },
146
+
147
+ getAutoEllipsis () {
148
+ let parWidth = this.$refs.DshTags.clientWidth;
149
+ let tags = this.$refs.tagItem;
150
+
151
+ for (let idx in tags) {
152
+ let el = tags[idx]["$el"];
153
+ let showEllipsis = el.clientWidth + el.offsetLeft > parWidth;
154
+
155
+ if (showEllipsis) {
156
+ // 判断加上... 是否被隐藏
157
+ if (el.clientWidth + el.offsetLeft + 40 < parWidth) {
158
+ this.maxTagCount = idx;
159
+ } else {
160
+ this.maxTagCount = idx - 1;
161
+ }
162
+ break;
163
+ } else {
164
+ this.maxTagCount = undefined;
165
+ }
166
+ }
167
+ },
168
+ callEliipsis () {
169
+ if (this.autoEllipsis) {
170
+ this.maxTagCount = undefined;
171
+ this.$nextTick(() => {
172
+ this.getAutoEllipsis();
173
+ });
174
+ }
60
175
  }
176
+ },
177
+ watch: {
178
+ list: function () {
179
+ this.callEliipsis();
180
+ }
181
+ },
182
+ destroyed () {
183
+ window.removeEventListener("resize", this.callEliipsis, true);
61
184
  }
62
185
  };
63
186
  </script>
@@ -3,7 +3,7 @@
3
3
  background-color: @theme-focus;
4
4
  color: @themeColor;
5
5
  border-radius: @borderRadius;
6
- padding: 3px 8px;
6
+ padding: 2px 8px;
7
7
  line-height: 24px;
8
8
  display: inline;
9
9
  }
@@ -52,7 +52,7 @@
52
52
 
53
53
  // unit 模式下不用特殊处理颜色
54
54
  &.bri-control-nodata {
55
- color: @text-color;
55
+ .bri-control-nodata();
56
56
  }
57
57
  }
58
58
  // 无数据
@@ -83,11 +83,13 @@
83
83
  .icon {
84
84
  &-default {
85
85
  padding: 5px;
86
+ color: @placeholderColor;
86
87
  }
87
88
 
88
89
  &-close {
89
90
  padding: 5px;
90
91
  display: none;
92
+ color: @placeholderColor;
91
93
  }
92
94
  }
93
95