bri-components 1.2.62 → 1.2.64

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.62",
3
+ "version": "1.2.64",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -29,18 +29,31 @@
29
29
  class="DshCascader-show"
30
30
  >
31
31
  <!-- 有值 -->
32
- <bri-tooltip
33
- v-if="!$isEmptyData(curValList)"
34
- :content="showVal"
35
- :transfer="true"
36
- >
37
- <div :class="{
38
- commonClass,
39
- 'DshCascader-show-ellipsis': true
40
- }">
32
+ <template v-if="!$isEmptyData(curValList)">
33
+ <!-- 详情页查看 且单独占一行高度自由时 -->
34
+ <div
35
+ v-if="isHeightAuto"
36
+ :class="{
37
+ ...commonClass,
38
+ 'DshCascader-show-auto': true
39
+ }"
40
+ >
41
41
  {{ showVal }}
42
42
  </div>
43
- </bri-tooltip>
43
+
44
+ <bri-tooltip
45
+ v-else
46
+ :content="showVal"
47
+ :transfer="true"
48
+ >
49
+ <div :class="{
50
+ ...commonClass,
51
+ 'DshCascader-show-ellipsis': true
52
+ }">
53
+ {{ showVal }}
54
+ </div>
55
+ </bri-tooltip>
56
+ </template>
44
57
 
45
58
  <!-- 无值 -->
46
59
  <div
@@ -82,9 +95,9 @@
82
95
  >
83
96
  <!-- 有值 -->
84
97
  <template v-if="!$isEmptyData(curValList)">
85
- <!-- 详情查看页 且单独充满行的 -->
98
+ <!-- 详情页查看 且单独占一行高度自由时 -->
86
99
  <dsh-tags
87
- v-if="isDetailShow && isHeightAuto"
100
+ v-if="isHeightAuto"
88
101
  :class="{
89
102
  ...commonClass,
90
103
  'DshCascaders-show-auto': true
@@ -176,15 +189,18 @@
176
189
  @import url("../../control.less");
177
190
 
178
191
  .DshCascader {
192
+ #control-show();
193
+
179
194
  &-show {
195
+ &-auto,
180
196
  &-ellipsis {
181
- .dsh-ellipsis();
197
+ margin: 6px;
182
198
  }
183
199
  }
184
200
  }
185
201
 
186
202
  // 多选
187
203
  .DshCascaders {
188
- #control-select(cascader);
204
+ #control-show();
189
205
  }
190
206
  </style>
@@ -147,7 +147,6 @@
147
147
  props: {},
148
148
  data () {
149
149
  return {
150
- inputStr: "",
151
150
  description: ""
152
151
  };
153
152
  },
@@ -275,7 +275,7 @@
275
275
  &.ivu-select-dropdown {
276
276
  min-width: 400px;
277
277
  max-width: 400px;
278
- max-height: 600px; // 必须有
278
+ max-height: 500px; // 必须有,压住iview的300px
279
279
  border: 0.5px solid #e5e5e5;
280
280
  box-shadow: 0 3px 14px 2px rgba(0,0,0,0.05), 0 8px 10px 1px rgba(0,0,0,0.06), 0 5px 5px -3px rgba(0,0,0,0.1);
281
281
  }
@@ -353,8 +353,8 @@
353
353
 
354
354
  &-list {
355
355
  width: 100%;
356
- min-height: 360px;
357
- max-height: 360px;
356
+ min-height: 280px;
357
+ max-height: 340px;
358
358
  padding: 5px 10px 10px;
359
359
  overflow: auto;
360
360
 
@@ -51,7 +51,7 @@
51
51
  :label="item.name || item._name"
52
52
  :disabled="getCheckItemDisabled(item, index)"
53
53
  >
54
- <Checkbox :value="curValList.includes(item._key)"></Checkbox>
54
+ <Checkbox :value="getItemCheckStatus(item)"></Checkbox>
55
55
 
56
56
  <slot :item="item"></slot>
57
57
 
@@ -75,9 +75,9 @@
75
75
  >
76
76
  <!-- 有值 -->
77
77
  <template v-if="!$isEmptyData(curValList)">
78
- <!-- 详情查看页 且单独充满行的 -->
78
+ <!-- 详情页查看 且单独占一行高度自由时 -->
79
79
  <dsh-tags
80
- v-if="isDetailShow && isHeightAuto"
80
+ v-if="isHeightAuto"
81
81
  :class="{
82
82
  ...commonClass,
83
83
  'DshCheckbox-show-auto': true
@@ -93,11 +93,11 @@
93
93
  >
94
94
  <dsh-tags
95
95
  :class="{
96
- ...commonClass,
97
- 'DshCheckbox-show-ellipsis': true
98
- }"
96
+ ...commonClass,
97
+ 'DshCheckbox-show-ellipsis': true
98
+ }"
99
99
  :list="curValObjList"
100
- itemClass="DshCheckbox-show-tag"
100
+ itemClass="DshCheckbox-show-ellipsis-tag"
101
101
  ></dsh-tags>
102
102
  </bri-tooltip>
103
103
  </template>
@@ -153,6 +153,7 @@
153
153
  @import url("../../control.less");
154
154
 
155
155
  .DshCheckbox {
156
+ #control-show();
156
157
  #control-select(checkbox);
157
158
  }
158
159
  </style>
@@ -85,8 +85,9 @@
85
85
  >
86
86
  <!-- 有值 -->
87
87
  <template v-if="!$isEmptyData(curVal)">
88
+ <!-- 详情页查看 且单独占一行高度自由时 -->
88
89
  <dsh-tags
89
- v-if="isDetailShow && isHeightAuto"
90
+ v-if="isHeightAuto"
90
91
  :class="{
91
92
  ...commonClass,
92
93
  'DshSelect-show-auto': true
@@ -167,6 +168,7 @@
167
168
  @import url("../../control.less");
168
169
 
169
170
  .DshSelect {
171
+ #control-show();
170
172
  #control-select(radio);
171
173
  }
172
174
  </style>
@@ -13,7 +13,6 @@
13
13
  :false-color="selfPropsObj._closeColor"
14
14
  :true-value="selfPropsObj._openValue"
15
15
  :false-value="selfPropsObj._closeValue"
16
- @on-change="change"
17
16
  >
18
17
  <span slot="open">
19
18
  {{ selfPropsObj._openText }}
@@ -31,8 +30,9 @@
31
30
  >
32
31
  <!-- 有值 -->
33
32
  <template v-if="!$isEmptyData(curVal)">
33
+ <!-- 详情页查看 且单独占一行高度自由时 -->
34
34
  <dsh-tags
35
- v-if="isDetailShow && isHeightAuto"
35
+ v-if="isHeightAuto"
36
36
  :class="{
37
37
  ...commonClass,
38
38
  'DshSwitch-show-auto': true
@@ -107,6 +107,6 @@
107
107
  @import url("../../control.less");
108
108
 
109
109
  .DshSwitch {
110
- #control-select(switch);
110
+ #control-show();
111
111
  }
112
112
  </style>
@@ -1,3 +1,28 @@
1
+ // 控件查看状态的样式
2
+ #control-show () {
3
+ &-show {
4
+ &-auto {
5
+ white-space: normal!important;
6
+ word-break: normal!important;
7
+ text-overflow: auto!important;
8
+
9
+ &-tag {
10
+ height: auto!important;
11
+ }
12
+ }
13
+
14
+ &-ellipsis {
15
+ margin: 2px 0px;
16
+ .dsh-ellipsis();
17
+
18
+ &-tag {
19
+ .dsh-ellipsis();
20
+ }
21
+ }
22
+ }
23
+ }
24
+
25
+ // 单选多选控件样式
1
26
  #control-select (@control-type) {
2
27
  &-flat {
3
28
  width: 100%;
@@ -184,22 +209,5 @@
184
209
  }
185
210
  }
186
211
  }
212
+ }
187
213
 
188
- // 查看
189
- &-show {
190
- &-auto {
191
- &-tag {
192
- height: auto!important;
193
- }
194
- }
195
-
196
- &-ellipsis {
197
- margin: 2px 0px;
198
- .dsh-ellipsis();
199
-
200
- &-tag {
201
- .dsh-ellipsis();
202
- }
203
- }
204
- }
205
- }
@@ -1,5 +1,5 @@
1
1
  import controlMixin from "./controlMixin.js";
2
- import { regionData, userIndustryData } from "bri-datas";
2
+ import { resourceData, regionData, userIndustryData } from "bri-datas";
3
3
 
4
4
  export default {
5
5
  mixins: [
@@ -15,6 +15,8 @@ export default {
15
15
  const _joinSymbol = this.propsObj._joinSymbol || "/";
16
16
  return {
17
17
  _showMode: "default",
18
+ colorMap: resourceData.colorMap,
19
+ _useColor: false,
18
20
  _saveKey: "_key",
19
21
  _valueKey: "code",
20
22
  _nameKey: "name",
@@ -34,6 +36,12 @@ export default {
34
36
  showType () {
35
37
  return this.selfPropsObj._showMode;
36
38
  },
39
+ colorMap () {
40
+ return this.selfPropsObj.colorMap;
41
+ },
42
+ useColor () {
43
+ return this.selfPropsObj._useColor;
44
+ },
37
45
  saveKey () {
38
46
  return this.selfPropsObj._saveKey;
39
47
  },
@@ -99,12 +107,17 @@ export default {
99
107
  return loop(this.originData, this.cascaderLevel, undefined, this.cascaderFilterVals, this.isMobile);
100
108
  },
101
109
 
110
+ curValObj () {
111
+ return this.getItemObj(this.curValList);
112
+ },
102
113
  curValName: {
103
114
  get () {
104
- return this.transformFullName(this.curValList);
115
+ return this.curValObj
116
+ ? this.curValObj[this.nameKey]
117
+ : "";
105
118
  },
106
- set (str) {
107
- if (!str) {
119
+ set (val) {
120
+ if (!val) {
108
121
  this.clickClear();
109
122
  }
110
123
  }
@@ -114,19 +127,12 @@ export default {
114
127
  ? this.emptyShowVal
115
128
  : this.curValName;
116
129
  },
130
+ // 已选择项的对象列表
117
131
  curValObjList () {
118
- return this.curValNameList.map((item, index) => {
119
- return {
120
- _key: index,
121
- name: item,
122
- style: {
123
- ...this.tagStyle
124
- }
125
- };
126
- });
132
+ return this.curValList.map(arrItem => this.getItemObj(arrItem));
127
133
  },
128
134
  curValNameList () {
129
- return this.curValList.map(item => this.transformFullName(item));
135
+ return this.curValObjList.map(item => item[this.nameKey]);
130
136
  },
131
137
  showMulVal () {
132
138
  return this.$isEmptyData(this.curValList)
@@ -164,9 +170,43 @@ export default {
164
170
  },
165
171
 
166
172
  /* --------- 工具类 -------- */
173
+ getItemObj (val) {
174
+ const objArr = this.$getTreeLinealDatas(val, this.cascaderData, undefined, this.saveKey);
175
+
176
+ return !this.$isEmptyData(val)
177
+ ? objArr.length
178
+ ? {
179
+ ...objArr.slice(-1)[0],
180
+ [this.nameKey]: this.transformFullName(val),
181
+ // 查看状态时tag用
182
+ style: {
183
+ ...this.tagStyle,
184
+ ...this.getItemColorStyle(objArr.slice(-1)[0])
185
+ },
186
+ color: undefined
187
+ }
188
+ : {
189
+ _key: val,
190
+ name: `提示:选项${val}已找不到`,
191
+ style: {
192
+ ...this.tagStyle
193
+ }
194
+ }
195
+ : undefined;
196
+ },
197
+ // 每项的颜色相关style --flat方式在用
198
+ getItemColorStyle (item) {
199
+ const color = this.colorMap[item.color] || this.colorMap["color-1"];
200
+ return this.useColor
201
+ ? {
202
+ backgroundColor: this.$getColor(color, 0.1),
203
+ color: color
204
+ }
205
+ : {};
206
+ },
167
207
  // 转化出级联全名
168
- transformFullName (value) {
169
- return this.renderFormat(this.$getTreeLinealDatas(value, this.cascaderData, this.nameKey, this.saveKey));
208
+ transformFullName (val) {
209
+ return this.renderFormat(this.$getTreeLinealDatas(val, this.cascaderData, this.nameKey, this.saveKey));
170
210
  }
171
211
  }
172
212
  };
@@ -188,6 +188,8 @@ export default {
188
188
  });
189
189
  }
190
190
  },
191
+
192
+ // 接口 -获得某个节点对应的描述内容
191
193
  getDescription (value = []) {
192
194
  if (value.length) {
193
195
  this.$https({
@@ -201,7 +203,7 @@ export default {
201
203
  },
202
204
  callback: data => {
203
205
  this.description = data;
204
- this.selectedObj.description = data;
206
+ // this.selectedObj.description = data;
205
207
  }
206
208
  });
207
209
  }
@@ -130,8 +130,8 @@ export default {
130
130
  return {
131
131
  "bri-control-edit": this.canEdit && this.finalCanEdit,
132
132
  "bri-control-disabled": this.canEdit && !this.finalCanEdit,
133
- "bri-control-unit": !this.canEdit && this.isInTable,
134
- "bri-control-show": !this.canEdit && !this.isInTable,
133
+ "bri-control-unit": this.isUnitShow,
134
+ "bri-control-show": this.isDetailShow,
135
135
 
136
136
  "dsh-ellipsis": this.isUnitShow,
137
137
  "bri-control-nodata": this.$isEmptyData(this.curVal)
@@ -143,7 +143,10 @@ export default {
143
143
  },
144
144
  // 控件内容高度 自由
145
145
  isHeightAuto () {
146
- return this.isFullRow && !this.isInTable;
146
+ return this.isInTable
147
+ ? false
148
+ // ? this.isUnitShow
149
+ : this.isFullRow;
147
150
  },
148
151
  clearable () {
149
152
  return this.commonDealPropsObj._clearable;
@@ -15,8 +15,8 @@ export default {
15
15
  computed: {
16
16
  basePropsObj () {
17
17
  return {
18
- colorMap: resourceData.colorMap,
19
18
  _optionKind: "dropdown", // "flat"、"dropdown"
19
+ colorMap: resourceData.colorMap,
20
20
  _useColor: false,
21
21
  _filterable: true,
22
22
  _data: [],
@@ -29,12 +29,12 @@ export default {
29
29
  showType () {
30
30
  return this.selfPropsObj._optionKind;
31
31
  },
32
- useColor () {
33
- return this.selfPropsObj._useColor;
34
- },
35
32
  colorMap () {
36
33
  return this.selfPropsObj.colorMap;
37
34
  },
35
+ useColor () {
36
+ return this.selfPropsObj._useColor;
37
+ },
38
38
  listData () {
39
39
  const listData = this.selfPropsObj._data.concat(this.initListData);
40
40
 
@@ -54,7 +54,7 @@ export default {
54
54
  },
55
55
  set (val) {
56
56
  if (!val) {
57
- this.curVal = "";
57
+ this.clickClear();
58
58
  }
59
59
  }
60
60
  },
@@ -84,6 +84,10 @@ export default {
84
84
  this.getListData();
85
85
  },
86
86
 
87
+ // 点击清除
88
+ clickClear () {
89
+ this.curVal = "";
90
+ },
87
91
  // 单选模式 点击选项
88
92
  clickRadioItem (item, index) {
89
93
  if (!this.getRadioItemDisabled(item)) {
@@ -105,16 +109,37 @@ export default {
105
109
  // 多选模式 点击选项
106
110
  clickCheckItem (item, index) {
107
111
  if (!this.getCheckItemDisabled(item)) {
108
- if (this.curValList.includes(item._key)) {
109
- this.curValList = this.curValList.filter(key => key !== item._key);
110
- } else {
111
- this.curValList = [...this.curValList, item._key];
112
- }
112
+ this.curValList = this.getItemCheckStatus(item)
113
+ ? this.curValList.filter(key => key !== item._key)
114
+ : [...this.curValList, item._key];
113
115
  }
114
116
  },
115
117
 
116
118
  /* ------- 方法 ------- */
117
- // 每项的class集合 --flat方式在用
119
+ // 获取某项的对象数据
120
+ getItemObj (val) {
121
+ const obj = this.listData.find(item => item._key === val) || {
122
+ _key: val,
123
+ name: `提示:选项${val}已找不到`
124
+ };
125
+
126
+ return !this.$isEmptyData(val)
127
+ ? {
128
+ ...obj,
129
+ // 查看状态时tag用
130
+ style: {
131
+ ...this.tagStyle,
132
+ ...this.getItemColorStyle(obj)
133
+ },
134
+ color: undefined
135
+ }
136
+ : undefined;
137
+ },
138
+ // 获取某项的选中状态
139
+ getItemCheckStatus (item) {
140
+ return this.curValList.includes(item._key);
141
+ },
142
+ // 获取某项的class集合 --flat方式在用
118
143
  getItemClass (item) {
119
144
  return [
120
145
  this.useColor
@@ -123,7 +148,7 @@ export default {
123
148
  item.class
124
149
  ];
125
150
  },
126
- // 每项的颜色相关style --flat方式在用
151
+ // 获取某项的颜色相关style --flat方式在用
127
152
  getItemColorStyle (item) {
128
153
  const color = this.colorMap[item.color] || this.colorMap["color-1"];
129
154
  return this.useColor
@@ -133,13 +158,6 @@ export default {
133
158
  }
134
159
  : {};
135
160
  },
136
- // 每项的具体样式 -查看状态时用
137
- getItemShowStyle (item) {
138
- return {
139
- ...this.tagStyle,
140
- ...this.getItemColorStyle(item)
141
- };
142
- },
143
161
  // 获取单选项的置灰状态
144
162
  getRadioItemDisabled (item) {
145
163
  return !!(
@@ -152,23 +170,9 @@ export default {
152
170
  return !!(
153
171
  this.selfPropsObj._disabled ||
154
172
  item._disabled ||
155
- (this.curValList.length >= this.selfPropsObj._max && !this.curValList.includes(item._key))
173
+ (this.curValList.length >= this.selfPropsObj._max && !this.getItemCheckStatus(item))
156
174
  );
157
175
  },
158
- getItemObj (key) {
159
- const obj = this.listData.find(item => item._key === key) || {
160
- _key: key,
161
- name: `温馨提示:选项${key}已找不到`
162
- };
163
-
164
- return this.$isEmptyData(key)
165
- ? undefined
166
- : {
167
- ...obj,
168
- style: this.getItemShowStyle(obj),
169
- color: undefined
170
- };
171
- },
172
176
 
173
177
  // TODO:待删除 接口 -获取自定义的接口数据
174
178
  getListData () {
@@ -179,12 +183,10 @@ export default {
179
183
  callback: data => {
180
184
  this.initListData = [
181
185
  ...this.initListData,
182
- ...data.list.map(dataItem =>
183
- ({
184
- _key: dataItem._key,
185
- name: dataItem.name
186
- })
187
- )
186
+ ...data.list.map(dataItem => ({
187
+ _key: dataItem._key,
188
+ name: dataItem.name
189
+ }))
188
190
  ];
189
191
  }
190
192
  });
@@ -47,22 +47,19 @@ export default {
47
47
  ...this.propsObj
48
48
  };
49
49
  },
50
- showStyle () {
50
+
51
+ curValObj () {
51
52
  return !this.$isEmptyData(this.curVal)
52
53
  ? {
53
- ...this.tagStyle,
54
- backgroundColor: this.curVal === true ? "#d3f3dc" : "#FDEDED",
55
- color: this.curVal === true ? "#37C45E" : "#E83636"
54
+ _key: "1",
55
+ name: this.showVal,
56
+ style: {
57
+ ...this.tagStyle,
58
+ backgroundColor: this.curVal === true ? "#d3f3dc" : "#FDEDED",
59
+ color: this.curVal === true ? "#37C45E" : "#E83636"
60
+ }
56
61
  }
57
- : {};
58
- },
59
-
60
- curValObj () {
61
- return {
62
- _key: "1",
63
- name: this.showVal,
64
- style: this.showStyle
65
- };
62
+ : undefined;
66
63
  },
67
64
  showVal () {
68
65
  return this.$isEmptyData(this.curVal)
@@ -72,7 +72,7 @@
72
72
  >
73
73
  <CheckboxGroup
74
74
  v-model="selectIds"
75
- @on-change="select"
75
+ @on-change="selectRow"
76
76
  >
77
77
  <Checkbox
78
78
  v-for="row in data"
@@ -161,7 +161,6 @@
161
161
  </template>
162
162
 
163
163
  <script>
164
-
165
164
  export default {
166
165
  name: "DshList",
167
166
  components: {},
@@ -256,8 +255,8 @@
256
255
  this.changeSelect();
257
256
  },
258
257
  // 切换选择
259
- select (ids) {
260
- this.$emit("select", this.selectIds, this.selections, this.curRow.bool, this.curRow);
258
+ selectRow (ids) {
259
+ this.$emit("selectRow", this.selectIds, this.selections, this.curRow.bool, this.curRow);
261
260
  this.changeSelect();
262
261
  },
263
262
  // 改变选择项
@@ -13,21 +13,28 @@
13
13
  color: '#ffffff'
14
14
  }"
15
15
  >
16
+ <!-- 左 -->
17
+ <Checkbox
18
+ class="header-checkbox"
19
+ v-model="groupItem.isSelectAll"
20
+ @on-change="selectGroupAll(groupItem, $event)"
21
+ ></Checkbox>
22
+
16
23
  <!-- 左 -->
17
24
  <bri-tooltip
18
- class="DshPanel-group-header-left"
25
+ class="header-left"
19
26
  :content="groupItem.name"
20
27
  placement="top"
21
28
  :transfer="true"
22
29
  >
23
- <span class="DshPanel-group-header-left-name">
30
+ <span class="header-left-name">
24
31
  {{ groupItem.name }}
25
32
  </span>
26
33
  </bri-tooltip>
27
34
 
28
35
  <!-- 右 -->
29
- <span>
30
- <span class="DshPanel-group-header-right">
36
+ <span class="header-right">
37
+ <span class="header-right-num">
31
38
  {{ groupItem.total }}
32
39
  </span>
33
40
  条(已加载{{ groupItem.list.length }}条)
@@ -43,98 +50,113 @@
43
50
  >
44
51
  <!-- 有数据 -->
45
52
  <template v-if="groupItem.list.length">
46
- <dsh-draggable
47
- v-model="groupItem.list"
48
- group="panel"
49
- animation="300"
53
+ <CheckboxGroup
50
54
  class="list-drag"
51
- :disabled="!dragOperationObj"
52
- @update="$dshEmit(dragOperationObj, $event, groupItem, data.find(item => item._key === $event.from.id), { [groupField]: groupItem._key })"
53
- @add="$dshEmit(dragOperationObj, $event, groupItem, data.find(item => item._key === $event.from.id), { [groupField]: groupItem._key })"
55
+ v-model="groupItem.selectIds"
56
+ @on-change="selectRow(groupItem, $event)"
54
57
  >
55
- <transition-group
56
- :id="groupItem._key"
57
- class="list-drag-transition"
58
- @scroll.native="groupScroll(groupItem, groupIndex, $event)"
58
+ <dsh-draggable
59
+ class="list-drag-draggable"
60
+ v-model="groupItem.list"
61
+ group="panel"
62
+ animation="300"
63
+ :disabled="!dragOperationObj"
64
+ @update="$dshEmit(dragOperationObj, $event, groupItem, data.find(item => item._key === $event.from.id), { [groupField]: groupItem._key })"
65
+ @add="$dshEmit(dragOperationObj, $event, groupItem, data.find(item => item._key === $event.from.id), { [groupField]: groupItem._key })"
59
66
  >
60
- <div
61
- v-for="(dataItem, dataIndex) in groupItem.list"
62
- :key="dataItem._id"
63
- :id="dataItem._id"
64
- class="row-item"
65
- @click="clickRow(dataItem, dataIndex)"
67
+ <transition-group
68
+ :id="groupItem._key"
69
+ class="list-drag-transition"
70
+ @scroll.native="groupScroll(groupItem, groupIndex, $event)"
66
71
  >
67
- <!-- 下拉操作 -->
68
- <dsh-dropdown
69
- v-if="operationList.length"
70
- class="row-item-dropdown"
71
- :dropdownObj="dropdownObj"
72
- :list="operationList"
73
- @click="$dshEmit($event, dataItem, dataIndex)"
74
- @click.native.stop="0"
75
- ></dsh-dropdown>
76
-
77
- <!-- 内容 -->
78
- <div class="row-item-info">
79
- <!-- 标题 -->
80
- <bri-tooltip
81
- class="title"
82
- :content="dataItem[propsObj.titleField]"
83
- placement="top"
84
- :transfer="true"
85
- >
86
- <div class="title-name">
87
- {{ dataItem[propsObj.titleField] }}
88
- </div>
89
- </bri-tooltip>
90
-
91
- <!-- 显示字段 -->
92
- <div
93
- v-for="colItem in selfColumns"
94
- :key="colItem._key"
95
- class="unit"
72
+ <div
73
+ v-for="(dataItem, dataIndex) in groupItem.list"
74
+ :key="dataItem._id"
75
+ :id="dataItem._id"
76
+ class="row-item"
77
+ @click="clickRow(dataItem, dataIndex)"
78
+ >
79
+ <!-- 复选框 -->
80
+ <Checkbox
81
+ class="row-item-checkbox"
82
+ :label="dataItem._id"
83
+ @click.native.stop="clickRowCheckbox(dataItem)"
96
84
  >
97
- <!-- label -->
85
+ {{ "" }}
86
+ </Checkbox>
87
+
88
+ <!-- 下拉操作 -->
89
+ <dsh-dropdown
90
+ v-if="operationList.length"
91
+ class="row-item-dropdown"
92
+ :dropdownObj="dropdownObj"
93
+ :list="operationList"
94
+ @click="$dshEmit($event, dataItem, dataIndex)"
95
+ @click.native.stop="0"
96
+ ></dsh-dropdown>
97
+
98
+ <!-- 内容 -->
99
+ <div class="row-item-info">
100
+ <!-- 标题 -->
98
101
  <bri-tooltip
99
- class="unit-label"
100
- :content="colItem._name"
102
+ class="title"
103
+ :content="dataItem[propsObj.titleField]"
104
+ placement="top"
101
105
  :transfer="true"
102
106
  >
103
- <span class="unit-label-name">
104
- {{ colItem._name }}
105
- </span>
106
- <span class="unit-label-colon">
107
-
108
- </span>
107
+ <div class="title-name">
108
+ {{ dataItem[propsObj.titleField] }}
109
+ </div>
109
110
  </bri-tooltip>
110
111
 
111
- <!-- val -->
112
- <div class="unit-control">
113
- <dsh-list-render
114
- v-if="colItem.renderBodyCell"
115
- :row="dataItem"
116
- :column="colItem"
117
- :index="0"
118
- :render="colItem.renderBodyCell"
119
- ></dsh-list-render>
120
-
121
- <div
122
- v-else-if="colItem.formatter"
123
- v-html="colItem.formatter(dataItem, 0)"
124
- ></div>
125
-
126
- <span
127
- v-else
128
- class="unit-control-text"
112
+ <!-- 显示字段 -->
113
+ <div
114
+ v-for="colItem in selfColumns"
115
+ :key="colItem._key"
116
+ class="unit"
117
+ >
118
+ <!-- 左 label -->
119
+ <bri-tooltip
120
+ class="unit-label"
121
+ :content="colItem._name"
122
+ :transfer="true"
129
123
  >
130
- {{ dataItem[colItem._key] }}
131
- </span>
124
+ <span class="unit-label-name">
125
+ {{ colItem._name }}
126
+ </span>
127
+ <span class="unit-label-colon">
128
+
129
+ </span>
130
+ </bri-tooltip>
131
+
132
+ <!-- 右 val -->
133
+ <div class="unit-control">
134
+ <dsh-list-render
135
+ v-if="colItem.renderBodyCell"
136
+ :row="dataItem"
137
+ :column="colItem"
138
+ :index="0"
139
+ :render="colItem.renderBodyCell"
140
+ ></dsh-list-render>
141
+
142
+ <div
143
+ v-else-if="colItem.formatter"
144
+ v-html="colItem.formatter(dataItem, 0)"
145
+ ></div>
146
+
147
+ <span
148
+ v-else
149
+ class="unit-control-text"
150
+ >
151
+ {{ dataItem[colItem._key] }}
152
+ </span>
153
+ </div>
132
154
  </div>
133
155
  </div>
134
156
  </div>
135
- </div>
136
- </transition-group>
137
- </dsh-draggable>
157
+ </transition-group>
158
+ </dsh-draggable>
159
+ </CheckboxGroup>
138
160
  </template>
139
161
 
140
162
  <!-- 无数据 -->
@@ -205,22 +227,30 @@
205
227
  },
206
228
  data () {
207
229
  return {
230
+ selections: [],
231
+ // curRow: null // 可以不声明
232
+
208
233
  // 下拉菜单的配置
209
234
  dropdownObj: {
210
235
  icon: "ios-more",
211
236
  size: 22,
212
237
  color: "#E9ECF4",
213
238
  showDropdownItemIcon: false
214
- },
215
-
216
- getBgColor (groupItem) {
217
- return this.groupFieldObj._useColor
218
- ? resourceData.colorMap[(this.groupFieldObj._data.find(item => item._key === groupItem._key) || { color: "color-default" }).color]
219
- : resourceData.colorMap["color-default"];
220
239
  }
221
240
  };
222
241
  },
223
242
  computed: {
243
+ selectIds: {
244
+ get () {
245
+ return this.selections.map(item => item._id);
246
+ },
247
+ set (val) {
248
+ this.selections = this.data
249
+ .reduce((arr, groupItem) => [...arr, ...groupItem.list], [])
250
+ .filter(item => val.includes(item._id));
251
+ }
252
+ },
253
+
224
254
  groupField () {
225
255
  return this.propsObj.groupField;
226
256
  },
@@ -284,6 +314,7 @@
284
314
  // 判断是否要滚动加载
285
315
  groupLoad (groupItem, groupElement) {
286
316
  if (
317
+ groupItem &&
287
318
  groupItem.loading !== true &&
288
319
  groupItem.finished !== true &&
289
320
  groupElement.children.length === groupItem.list.length &&
@@ -296,11 +327,56 @@
296
327
  // 点击某行
297
328
  clickRow (row) {
298
329
  this.$emit("clickRow", row);
330
+ },
331
+ // 点击某行的选择框
332
+ clickRowCheckbox (row) {
333
+ this.curRow = row;
334
+ this.curRow.bool = !this.selectIds.includes(row._id);
335
+ },
336
+
337
+ // 切换全选
338
+ selectGroupAll (groupItem, bool) {
339
+ const groupListIds = groupItem.list.map(item => item._id);
340
+ groupItem.selectIds = groupItem.isSelectAll === true
341
+ ? groupListIds
342
+ : [];
343
+ this.selectIds = groupItem.isSelectAll === true
344
+ ? [...new Set([...this.selectIds, ...groupListIds])]
345
+ : this.selectIds.filter(id => !groupListIds.includes(id));
346
+
347
+ this.$emit("selectAll", this.selectIds, this.selections, groupItem.isSelectAll);
348
+ this.changeSelect();
349
+ },
350
+ // 选择行
351
+ selectRow (groupItem, ids) {
352
+ const groupListIds = groupItem.list.map(item => item._id);
353
+ this.selectIds = [
354
+ ...this.selectIds.filter(id => !groupListIds.includes(id)),
355
+ ...groupItem.selectIds
356
+ ];
357
+ groupItem.isSelectAll = groupListIds.length > 0 && groupItem.selectIds.length === groupListIds.length;
358
+
359
+ this.$emit("selectRow", this.selectIds, this.selections, this.curRow.bool, this.curRow);
360
+ this.changeSelect();
361
+ },
362
+ // 改变选择项
363
+ changeSelect () {
364
+ this.$emit("changeSelect", this.selectIds, this.selections);
365
+ },
366
+
367
+ /* -------- 方法 -------- */
368
+ getBgColor (groupItem) {
369
+ return this.groupFieldObj._useColor
370
+ ? resourceData.colorMap[(this.groupFieldObj._data.find(item => item._key === groupItem._key) || { color: "color-default" }).color]
371
+ : resourceData.colorMap["color-default"];
299
372
  }
300
373
  },
301
374
  watch: {
302
375
  data () {
303
376
  this.initGroupScroll();
377
+ this.data.forEach(groupItem => {
378
+ groupItem.isSelectAll = groupItem.list.length > 0 && groupItem.selectIds.length === groupItem.list.length;
379
+ });
304
380
  }
305
381
  }
306
382
  };
@@ -332,18 +408,37 @@
332
408
  display: flex;
333
409
  justify-content: space-between;
334
410
 
335
- &-left {
336
- flex: 1;
337
- min-width: 0px;
411
+ .header {
412
+ &-checkbox {
413
+ .ivu-checkbox-inner {
414
+ border: 2px solid #ffffff;
415
+ background-color: transparent;
416
+ }
417
+
418
+ .ivu-checkbox-checked {
419
+ .ivu-checkbox-inner:after {
420
+ top: 1px;
421
+ left: 4px;
422
+ }
423
+ }
424
+ }
425
+
426
+ &-left {
427
+ flex: 1;
428
+ min-width: 0px;
338
429
 
339
- &-name {
340
- .dsh-ellipsis();
430
+ &-name {
431
+ .dsh-ellipsis();
432
+ }
341
433
  }
342
- }
343
434
 
344
- &-right {
345
- margin-left: 5px;
346
- font-weight: bold;
435
+ &-right {
436
+ margin-left: 5px;
437
+
438
+ &-num {
439
+ font-weight: bold;
440
+ }
441
+ }
347
442
  }
348
443
  }
349
444
 
@@ -362,6 +457,11 @@
362
457
  flex: 1;
363
458
  min-height: 0px;
364
459
 
460
+ &-draggable {
461
+ width: 100%;
462
+ height: 100%;
463
+ }
464
+
365
465
  &-transition {
366
466
  display: block;
367
467
  width: 100%;
@@ -372,12 +472,19 @@
372
472
  .row-item {
373
473
  min-height: 60px;
374
474
  margin-bottom: 10px;
475
+ padding: 8px 10px;
375
476
  border: 1px solid rgba(102, 110, 126, 0.1);
376
- border-radius: 4px;
477
+ // border-radius: 4px;
377
478
  background: #FFFFFF;
378
479
  cursor: pointer;
379
480
  position: relative;
380
481
 
482
+ &-checkbox {
483
+ position: absolute;
484
+ top: -3px;
485
+ left: -1px;
486
+ }
487
+
381
488
  &-dropdown {
382
489
  position: absolute;
383
490
  top: 5px;
@@ -385,13 +492,12 @@
385
492
  }
386
493
 
387
494
  &-info {
388
- padding: 8px 10px;
389
495
  background: #ffffff;
390
496
  overflow: hidden;
391
497
 
392
498
  .title {
393
499
  height: 24px;
394
- padding-right: 6px;
500
+ padding: 0px 16px 0px 10px;
395
501
  font-size: 14px;
396
502
  font-weight: 600;
397
503
 
@@ -39,7 +39,7 @@
39
39
  <div
40
40
  class="DshDropdown-list-data"
41
41
  :style="{
42
- maxHeight: useSearch ? '300px' : '340px'
42
+ maxHeight: useSearch ? '320px' : '360px'
43
43
  }"
44
44
  >
45
45
  <!-- 有数据 -->
@@ -66,16 +66,10 @@
66
66
  >
67
67
  <dsh-icons
68
68
  v-if="dropdownItem.icon || dropdownItem.customIcon"
69
- :class="{
70
- 'list-item-icon': true,
71
- 'list-item-disabled': dropdownItem.disabled
72
- }"
69
+ class="list-item-icon"
73
70
  :list="[dropdownItem]"
74
71
  />
75
- <span :class="{
76
- 'list-item-name': true,
77
- 'list-item-disabled': dropdownItem.disabled
78
- }">
72
+ <span class="list-item-name">
79
73
  {{ dropdownItem.name || dropdownItem._name }}
80
74
  </span>
81
75
  </slot>
@@ -158,3 +152,70 @@
158
152
  }
159
153
  };
160
154
  </script>
155
+
156
+ <style lang="less">
157
+ .DshDropdown {
158
+ &-rel {
159
+ color: @contentColor;
160
+ cursor: pointer;
161
+ }
162
+
163
+ &-list {
164
+ &-search {
165
+ width: 100%;
166
+ height: 40px;
167
+ padding: 0px 8px;
168
+ line-height: 40px;
169
+ }
170
+
171
+ &-data {
172
+ width: 100%;
173
+ // max-height: 300px;
174
+ padding: 0 8px;
175
+ overflow: auto;
176
+
177
+ .list {
178
+ &-item {
179
+ padding: 10px 8px;
180
+ border-radius: @borderRadius;
181
+ line-height: 16px;
182
+ display: flex;
183
+ flex-direction: row;
184
+ align-items: center;
185
+
186
+ &-icon {
187
+ margin-right: 8px;
188
+ }
189
+
190
+ &-name {
191
+
192
+ }
193
+
194
+ &:hover {
195
+ background-color: @theme-focus;
196
+ color: @themeColor;
197
+ }
198
+
199
+ &-disabled {
200
+ color: @textColor-disabled;
201
+ }
202
+ }
203
+
204
+ .ivu-dropdown-item-divided:before {
205
+ margin: 0px;
206
+ }
207
+ }
208
+
209
+ .nodata {
210
+ #dsh-nodata();
211
+ }
212
+ }
213
+ }
214
+
215
+ &.ivu-select-dropdown {
216
+ max-height: 500px;
217
+ border: 0.5px solid #e5e5e5;
218
+ box-shadow: 0 3px 14px 2px rgba(0,0,0,0.05), 0 8px 10px 1px rgba(0,0,0,0.06), 0 5px 5px -3px rgba(0,0,0,0.1);
219
+ }
220
+ }
221
+ </style>
@@ -288,8 +288,11 @@
288
288
  }
289
289
 
290
290
  &-control {
291
- min-height: 32px;
292
291
  overflow: hidden;
292
+
293
+ &-component {
294
+
295
+ }
293
296
  }
294
297
 
295
298
  &-line {
@@ -318,7 +321,11 @@
318
321
 
319
322
  .DshFormUnit-control {
320
323
  flex: 1;
321
- min-width: 100px;
324
+ min-width: 0px;
325
+
326
+ &-component {
327
+
328
+ }
322
329
  }
323
330
  }
324
331
 
@@ -28,7 +28,6 @@
28
28
  @import "./small/BriButton.less";
29
29
  @import "./small/BriDrawer.less";
30
30
  @import "./small/DshButtons.less";
31
- @import "./small/DshDropdown.less";
32
31
  @import "./small/DshIcons.less";
33
32
  @import "./small/DshModal.less";
34
33
  @import "./small/DshSteps.less";
@@ -1,4 +1,8 @@
1
1
  .ivu-tooltip {
2
+ &-rel {
3
+
4
+ }
5
+
2
6
  &-arrow {
3
7
  border-bottom-color: @textColor !important;
4
8
  }
@@ -14,10 +18,6 @@
14
18
  max-height: 350px;
15
19
  overflow: auto;
16
20
  }
17
-
18
- &-rel {
19
- width: 100%;
20
- }
21
21
  }
22
22
 
23
23
  .ivu-tag {
@@ -34,4 +34,10 @@
34
34
  &[disabled] {
35
35
  background-color: @border-disabled;
36
36
  }
37
+ }
38
+
39
+ // 下拉框
40
+ .ivu-select-dropdown {
41
+ max-width: 420px;
42
+ max-height: 300px;
37
43
  }
@@ -1,62 +0,0 @@
1
- .DshDropdown {
2
- &-rel {
3
- color: @contentColor;
4
- cursor: pointer;
5
- }
6
-
7
- &-list {
8
- &-search {
9
- width: 100%;
10
- height: 40px;
11
- padding: 0px 8px;
12
- line-height: 40px;
13
- }
14
-
15
- &-data {
16
- width: 100%;
17
- // max-height: 300px;
18
- overflow: auto;
19
-
20
- .list {
21
- .list-item {
22
- display: flex;
23
- flex-direction: row;
24
- align-items: center;
25
- border-radius: @borderRadius;
26
- padding: 9px 8px;
27
- margin: 0 8px;
28
- line-height: 22px;
29
- &:hover {
30
- background-color: @theme-focus;
31
- color: @themeColor;
32
- }
33
-
34
- &-disabled {
35
- color: @textColor-disabled
36
- }
37
- &-icon {
38
- margin-right: 8px;
39
- }
40
- &-name {
41
-
42
- }
43
- }
44
-
45
- .ivu-dropdown-item-divided:before {
46
- margin: 0px;
47
- }
48
- }
49
-
50
- .nodata {
51
- #dsh-nodata();
52
- }
53
- }
54
- }
55
- &.ivu-select-dropdown {
56
- border: 0.5px solid #e5e5e5;
57
- box-shadow: 0 3px 14px 2px rgba(0,0,0,0.05), 0 8px 10px 1px rgba(0,0,0,0.06), 0 5px 5px -3px rgba(0,0,0,0.1);
58
- max-height: 500px;
59
- }
60
- }
61
-
62
-