bri-components 1.2.57 → 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.
Files changed (42) hide show
  1. package/package.json +2 -2
  2. package/src/components/controls/base/BriUpload/BriUpload.vue +1 -1
  3. package/src/components/controls/base/DshCascader/DshCascader.vue +68 -231
  4. package/src/components/controls/base/DshCascader/{cascaderModal.vue → components/cascaderModal.vue} +22 -31
  5. package/src/components/controls/base/DshCascader/{cascaderPicker.vue → components/cascaderPicker.vue} +22 -18
  6. package/src/components/controls/base/DshCascader/components/cascaderSimple.vue +141 -0
  7. package/src/components/controls/base/DshCoordinates.vue +1 -1
  8. package/src/components/controls/base/DshDate/DshDate.vue +1 -1
  9. package/src/components/controls/base/DshDate/DshDaterange.vue +1 -1
  10. package/src/components/controls/base/DshDivider.vue +1 -1
  11. package/src/components/controls/base/DshEditor.vue +1 -1
  12. package/src/components/controls/base/DshInput/BriInputs.vue +1 -1
  13. package/src/components/controls/base/DshInput/DshInput.vue +1 -1
  14. package/src/components/controls/base/DshNumber/DshNumber.vue +1 -1
  15. package/src/components/controls/base/DshNumber/DshNumberange.vue +1 -1
  16. package/src/components/controls/base/DshSelect/DshCheckbox.vue +187 -185
  17. package/src/components/controls/base/DshSelect/DshSelect.vue +140 -137
  18. package/src/components/controls/base/DshSwitch/switchMixin.js +1 -1
  19. package/src/components/controls/extra/themeColor.vue +1 -1
  20. package/src/components/controls/extra/themeIcon.vue +1 -1
  21. package/src/components/controls/{base/DshCascader → mixins}/cascaderMixin.js +16 -33
  22. package/src/components/controls/{base/DshCascader → mixins}/cascaderPickerMixin.js +52 -44
  23. package/src/components/controls/{controlMixin.js → mixins/controlMixin.js} +25 -4
  24. package/src/components/controls/mixins/selectMixin.js +192 -0
  25. package/src/components/controls/senior/BriLabels.vue +1 -1
  26. package/src/components/controls/senior/DshPackage.vue +1 -1
  27. package/src/components/controls/senior/cascaderTable.vue +1 -1
  28. package/src/components/controls/senior/flatTable.vue +1 -1
  29. package/src/components/controls/senior/selectDepartments.vue +1 -1
  30. package/src/components/controls/senior/selectUsers/selectUsers.vue +1 -1
  31. package/src/components/controls/special/DshBack.vue +1 -1
  32. package/src/components/controls/special/DshUndeveloped.vue +1 -1
  33. package/src/components/form/DshAdvSearch.vue +1 -1
  34. package/src/components/list/DshBox/DshCard.vue +153 -38
  35. package/src/components/list/DshBox/DshPanel.vue +260 -93
  36. package/src/components/small/BriTooltip.vue +2 -3
  37. package/src/components/unit/DshFormUnit.vue +7 -19
  38. package/src/styles/components/index.less +0 -2
  39. package/src/components/controls/base/DshSelect/selectMixin.js +0 -239
  40. package/src/styles/components/list/DshBox/DshCard.less +0 -59
  41. package/src/styles/components/list/DshBox/DshPanel.less +0 -107
  42. package/src/styles/components/small/BriTooltip.less +0 -0
@@ -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) {
@@ -0,0 +1,192 @@
1
+ import controlMixin from "./controlMixin.js";
2
+ import { resourceData } from "bri-datas";
3
+
4
+ export default {
5
+ mixins: [
6
+ controlMixin
7
+ ],
8
+ components: {},
9
+ props: {},
10
+ data () {
11
+ return {
12
+ initListData: []
13
+ };
14
+ },
15
+ computed: {
16
+ basePropsObj () {
17
+ return {
18
+ colorMap: resourceData.colorMap,
19
+ _optionKind: "dropdown", // "flat"、"dropdown"
20
+ _useColor: false,
21
+ _filterable: true,
22
+ _data: [],
23
+ _customData: [],
24
+
25
+ ...this.propsObj,
26
+ ...this.commonDealPropsObj
27
+ };
28
+ },
29
+ showType () {
30
+ return this.selfPropsObj._optionKind;
31
+ },
32
+ useColor () {
33
+ return this.selfPropsObj._useColor;
34
+ },
35
+ colorMap () {
36
+ return this.selfPropsObj.colorMap;
37
+ },
38
+ listData () {
39
+ const listData = this.selfPropsObj._data.concat(this.initListData);
40
+
41
+ return this.$dataType(this.selfPropsObj._filterFunc, "function")
42
+ ? this.selfPropsObj._filterFunc(listData, this.selfPropsObj, this.value)
43
+ : listData;
44
+ },
45
+
46
+ curValObj () {
47
+ return this.getItemObj(this.curVal);
48
+ },
49
+ valStr: {
50
+ get () {
51
+ return this.curValObj
52
+ ? this.curValObj.name || this.curValObj._name
53
+ : "";
54
+ },
55
+ set (val) {
56
+ if (!val) {
57
+ this.curVal = "";
58
+ }
59
+ }
60
+ },
61
+ showVal () {
62
+ return this.$isEmptyData(this.curVal)
63
+ ? this.emptyShowVal
64
+ : this.valStr;
65
+ },
66
+ // 已选择项的对象列表
67
+ curValObjList () {
68
+ return this.curValList.map(key => this.getItemObj(key));
69
+ },
70
+ valListStr () {
71
+ return this.curValObjList.map(item => item.name || item._name).join("、");
72
+ },
73
+ showMulVal () {
74
+ return this.$isEmptyData(this.curValList)
75
+ ? this.emptyShowVal
76
+ : this.valListStr;
77
+ }
78
+ },
79
+ created () {
80
+ this.init();
81
+ },
82
+ methods: {
83
+ init () {
84
+ this.getListData();
85
+ },
86
+
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
+ }
98
+ },
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) {
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) {
129
+ return {
130
+ ...this.getItemColorStyle(item),
131
+ display: "inline-block",
132
+ "max-width": "100%",
133
+ padding: "0px 6px",
134
+ "border-radius": "4px"
135
+ };
136
+ },
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
+ };
161
+
162
+ return this.$isEmptyData(key)
163
+ ? undefined
164
+ : {
165
+ ...obj,
166
+ style: this.getItemShowStyle(obj),
167
+ color: undefined
168
+ };
169
+ },
170
+
171
+ // TODO:待删除 接口 -获取自定义的接口数据
172
+ getListData () {
173
+ this.selfPropsObj._customData.forEach(item => {
174
+ this.$https({
175
+ url: item.url,
176
+ params: item.params,
177
+ callback: data => {
178
+ this.initListData = [
179
+ ...this.initListData,
180
+ ...data.list.map(dataItem =>
181
+ ({
182
+ _key: dataItem._key,
183
+ name: dataItem.name
184
+ })
185
+ )
186
+ ];
187
+ }
188
+ });
189
+ });
190
+ }
191
+ }
192
+ };
@@ -117,7 +117,7 @@
117
117
  </template>
118
118
 
119
119
  <script>
120
- import controlMixin from "../controlMixin.js";
120
+ import controlMixin from "../mixins/controlMixin.js";
121
121
 
122
122
  export default {
123
123
  name: "BriLabels",
@@ -19,7 +19,7 @@
19
19
  </template>
20
20
 
21
21
  <script>
22
- import controlMixin from "../controlMixin.js";
22
+ import controlMixin from "../mixins/controlMixin.js";
23
23
 
24
24
  export default {
25
25
  name: "DshPackage",
@@ -68,7 +68,7 @@
68
68
  </template>
69
69
 
70
70
  <script>
71
- import controlMixin from "../controlMixin.js";
71
+ import controlMixin from "../mixins/controlMixin.js";
72
72
  import DshBtnModal from "../../small/DshBtnModal.vue";
73
73
  import DshCascaderTable from "../../list/DshCascaderTable.vue";
74
74
 
@@ -88,7 +88,7 @@
88
88
  </template>
89
89
 
90
90
  <script>
91
- import controlMixin from "../controlMixin.js";
91
+ import controlMixin from "../mixins/controlMixin.js";
92
92
  import DshBtnModal from "../../small/DshBtnModal.vue";
93
93
  import BriFlatTable from "../../list/BriFlatTable.vue";
94
94
  import flatTableImportModal from "./flatTableImportModal.vue";
@@ -121,7 +121,7 @@
121
121
  </template>
122
122
 
123
123
  <script>
124
- import controlMixin from "../controlMixin.js";
124
+ import controlMixin from "../mixins/controlMixin.js";
125
125
  import BriTreeItem from "../../list/BriTreeItem.vue";
126
126
  import BriCard from "../../list/BriCard.vue";
127
127
 
@@ -200,7 +200,7 @@
200
200
  </template>
201
201
 
202
202
  <script>
203
- import controlMixin from "../../controlMixin.js";
203
+ import controlMixin from "../../mixins/controlMixin.js";
204
204
  import departMenu from "./departMenu.vue";
205
205
 
206
206
  export default {
@@ -9,7 +9,7 @@
9
9
  </template>
10
10
 
11
11
  <script>
12
- import controlMixin from "../controlMixin.js";
12
+ import controlMixin from "../mixins/controlMixin.js";
13
13
 
14
14
  export default {
15
15
  name: "DshBack",
@@ -5,7 +5,7 @@
5
5
  </template>
6
6
 
7
7
  <script>
8
- import controlMixin from "../controlMixin.js";
8
+ import controlMixin from "../mixins/controlMixin.js";
9
9
 
10
10
  export default {
11
11
  name: "DshUndeveloped",
@@ -422,7 +422,7 @@
422
422
  }
423
423
 
424
424
  &-control {
425
- .dsh-margin-bottom5();
425
+ margin-bottom: 5px;
426
426
  }
427
427
 
428
428
  &-blank {
@@ -1,21 +1,16 @@
1
1
  <template>
2
2
  <div class="DshCard">
3
- <!-- 无数据 -->
4
- <div
5
- v-if="!data.length"
6
- class="dsh-tip"
7
- >{{noDataText}}</div>
8
-
9
3
  <!-- 有数据 -->
10
- <template v-else>
4
+ <template v-if="data.length">
11
5
  <div
12
- class="DshCard-item"
13
6
  v-for="(dataItem, dataIndex) in data"
14
7
  :key="dataIndex"
8
+ class="DshCard-item"
15
9
  @click="clickRow(dataItem)"
16
10
  >
17
11
  <!-- 下拉操作(定位css) -->
18
12
  <dsh-dropdown
13
+ v-if="operationList.length"
19
14
  class="DshCard-item-dropdown"
20
15
  :dropdownObj="dropdownObj"
21
16
  :list="operationList"
@@ -34,36 +29,41 @@
34
29
  <!-- 内容 -->
35
30
  <div class="DshCard-item-info">
36
31
  <!-- 标题 -->
37
- <div class="DshCard-item-info-title dsh-ellipsis">
38
- <bri-tooltip
39
- placement="top"
40
- :transfer="true"
41
- :content="dataItem[propsObj.titleField]"
42
- >
43
- <div class="dsh-ellipsis">{{ dataItem[propsObj.titleField] }}</div>
44
- </bri-tooltip>
45
- </div>
32
+ <bri-tooltip
33
+ class="title"
34
+ :content="dataItem[propsObj.titleField]"
35
+ placement="top"
36
+ :transfer="true"
37
+ >
38
+ <div class="title-name">
39
+ {{ dataItem[propsObj.titleField] }}
40
+ </div>
41
+ </bri-tooltip>
46
42
 
47
43
  <!-- 显示字段 -->
48
44
  <div
49
- class="DshCard-item-info-col unit"
50
45
  v-for="colItem in selfColumns"
51
46
  :key="colItem._key"
47
+ class="unit"
52
48
  >
53
49
  <!-- 左 label -->
54
- <bri-tooltip
55
- class="unit-label"
56
- placement="top"
57
- :transfer="true"
58
- maxWidth="200"
59
- :content="colItem._name"
60
- >
61
- <span class="dsh-ellipsis">{{ colItem._name }}</span>
62
- </bri-tooltip>
63
- <span class="unit-colon">:</span>
50
+ <div class="unit-label">
51
+ <bri-tooltip
52
+ class="unit-label-tooltip"
53
+ :content="colItem._name"
54
+ :transfer="true"
55
+ >
56
+ <span class="unit-label-name">
57
+ {{ colItem._name }}
58
+ </span>
59
+ <span class="unit-label-colon">
60
+
61
+ </span>
62
+ </bri-tooltip>
63
+ </div>
64
64
 
65
65
  <!-- 右 val -->
66
- <div class="unit-value dsh-ellipsis">
66
+ <div class="unit-control">
67
67
  <dsh-list-render
68
68
  v-if="colItem.renderBodyCell"
69
69
  :row="dataItem"
@@ -79,13 +79,23 @@
79
79
 
80
80
  <span
81
81
  v-else
82
- class="unit-value-text"
83
- >{{ dataItem[colItem._key] }}</span>
82
+ class="unit-control-text"
83
+ >
84
+ {{ dataItem[colItem._key] }}
85
+ </span>
84
86
  </div>
85
87
  </div>
86
88
  </div>
87
89
  </div>
88
90
  </template>
91
+
92
+ <!-- 无数据 -->
93
+ <div
94
+ v-else
95
+ class="dsh-tip"
96
+ >
97
+ {{ noDataText }}
98
+ </div>
89
99
  </div>
90
100
  </template>
91
101
 
@@ -132,24 +142,41 @@
132
142
  color: "#E9ECF4",
133
143
  showDropdownItemIcon: false
134
144
  },
135
- defaultImgObj: {
136
- url: this.$imageSrcMap.app.projectCard
137
- },
138
145
 
139
146
  getCardBgImgSrc (dataItem) {
140
147
  const fileList = dataItem[this.propsObj.imageField] || [];
141
- const imgObj = fileList.find(fileItem => fileItem.mimetype.includes("image")) || this.defaultImgObj;
148
+ const imgObj = fileList.find(fileItem => fileItem.mimetype.includes("image")) || {
149
+ url: this.$imageSrcMap.app.projectCard
150
+ };
142
151
  return imgObj.url;
143
152
  }
144
153
  };
145
154
  },
146
155
  computed: {
156
+ imageField () {
157
+ return this.propsObj.imageField;
158
+ },
159
+ // imageFieldObj () {
160
+ // return this.columns.find(colItem => colItem._key === this.imageField) || {};
161
+ // },
162
+ titleField () {
163
+ return this.propsObj.titleField;
164
+ },
165
+ // titleFieldObj () {
166
+ // return this.columns.find(colItem => colItem._key === this.titleField) || {};
167
+ // },
147
168
  selfColumns () {
148
- return this.columns.slice(0, 2);
169
+ return this.columns
170
+ .filter(colItem => ![this.imageField, this.titleField].includes(colItem._key))
171
+ .map(colItem => ({
172
+ ...colItem,
173
+ titleAlign: "left",
174
+ columnAlign: "left"
175
+ }))
176
+ .slice(0, 2);
149
177
  }
150
178
  },
151
- created () {
152
- },
179
+ created () {},
153
180
  methods: {
154
181
  // 点击某行
155
182
  clickRow (row) {
@@ -158,3 +185,91 @@
158
185
  }
159
186
  };
160
187
  </script>
188
+
189
+ <style lang="less">
190
+ .DshCard {
191
+ padding: 0 40px;
192
+ background-color: #ffffff;
193
+ display: flex;
194
+ flex-wrap: wrap;
195
+
196
+ &-item {
197
+ box-sizing: border-box;
198
+ width: 250px;
199
+ height: 210px;
200
+ margin: 10px 16px 30px;
201
+ border-radius: 6px;
202
+ box-shadow: 0px 4px 8px 0px rgba(222, 222, 222, 0.75);
203
+ cursor: pointer;
204
+ overflow: hidden;
205
+ position: relative;
206
+
207
+ display: flex;
208
+ flex-direction: column;
209
+
210
+ &-dropdown {
211
+ position: absolute;
212
+ top: 5px;
213
+ right: 5px;
214
+ }
215
+
216
+ &-image {
217
+ height: 122px;
218
+ padding-top: 20px;
219
+
220
+ img {
221
+ width: 100%;
222
+ }
223
+ }
224
+
225
+ &-info {
226
+ padding: 8px 15px;
227
+ background: #F7FBFF;
228
+ overflow: hidden;
229
+
230
+ .title {
231
+ height: 24px;
232
+ padding-right: 6px;
233
+ font-size: 14px;
234
+ font-weight: 600;
235
+
236
+ &-name {
237
+ .dsh-ellipsis();
238
+ }
239
+ }
240
+
241
+ .unit {
242
+ height: 24px;
243
+ display: flex;
244
+ flex-direction: row;
245
+
246
+ &-label {
247
+ font-weight: 400;
248
+ color: #515A6E;
249
+
250
+ &-name {
251
+ min-width: 70px;
252
+ max-width: 70px;
253
+ .dsh-ellipsis();
254
+ display: inline-block;
255
+ }
256
+
257
+ &-colon {
258
+
259
+ }
260
+ }
261
+
262
+ &-control {
263
+ flex: 1;
264
+ min-width: 0px;
265
+ overflow: hidden;
266
+
267
+ &-text {
268
+
269
+ }
270
+ }
271
+ }
272
+ }
273
+ }
274
+ }
275
+ </style>