bri-components 1.2.53 → 1.2.55

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 (28) hide show
  1. package/package.json +2 -2
  2. package/src/components/controls/{BriControlInput.vue → DshControlInput.vue} +15 -12
  3. package/src/components/controls/base/DshCascader/DshCascader.vue +260 -341
  4. package/src/components/controls/base/DshCascader/cascaderMixin.js +176 -0
  5. package/src/components/controls/base/DshCascader/cascaderModal.vue +374 -0
  6. package/src/components/controls/base/DshCascader/cascaderPicker.vue +406 -0
  7. package/src/components/controls/base/DshCascader/cascaderPickerMixin.js +202 -0
  8. package/src/components/controls/base/DshCoordinates.vue +6 -10
  9. package/src/components/controls/base/DshDate/DshDaterange.vue +15 -12
  10. package/src/components/controls/base/DshEditor.vue +1 -1
  11. package/src/components/controls/controlMixin.js +14 -4
  12. package/src/components/controls/senior/BriLabels.vue +5 -10
  13. package/src/components/controls/senior/flatTable.vue +119 -3
  14. package/src/components/controls/senior/flatTableImportModal.vue +279 -0
  15. package/src/components/controls/senior/selectDepartments.vue +5 -19
  16. package/src/components/controls/senior/selectUsers/{DepartmentMenu.vue → departMenu.vue} +26 -16
  17. package/src/components/controls/senior/selectUsers/selectUsers.vue +10 -23
  18. package/src/components/form/DshDefaultSearch.vue +1 -1
  19. package/src/components/list/DshBox/DshCrossTable.vue +13 -1
  20. package/src/components/small/BriTooltip.vue +6 -0
  21. package/src/index.js +5 -5
  22. package/src/styles/components/index.less +0 -1
  23. package/src/styles/components/list/DshBox/DshCrossTable.less +32 -22
  24. package/src/styles/components/small/BriTooltip.less +0 -25
  25. package/src/styles/global/base.less +3 -3
  26. package/src/styles/global/control.less +3 -3
  27. package/src/styles/reset-iview-other.less +21 -0
  28. package/src/components/controls/base/DshCascader/InfoCascader.vue +0 -319
@@ -0,0 +1,176 @@
1
+ import controlMixin from "../../controlMixin.js";
2
+ import { regionData, userIndustryData } from "bri-datas";
3
+
4
+ export default {
5
+ mixins: [
6
+ controlMixin
7
+ ],
8
+ components: {},
9
+ props: {},
10
+ data () {
11
+ return {};
12
+ },
13
+ computed: {
14
+ basePropsObj () {
15
+ const _joinSymbol = this.propsObj._joinSymbol || "/";
16
+ return {
17
+ _showMode: "default",
18
+ _filterable: true,
19
+ _cascaderFilterVals: [], // 过滤级联数据,只保留的数组
20
+ _changeOnSelect: false, // 每级菜单都可取值
21
+ _renderFormat: (labels) => labels.join(_joinSymbol),
22
+
23
+ ...this.propsObj,
24
+ ...this.commonDealPropsObj,
25
+
26
+ _saveKey: this.propsObj._saveKey || "_key",
27
+ _valueKey: this.propsObj._valueKey || "code",
28
+ _nameKey: this.propsObj._nameKey || "name",
29
+ _joinSymbol: _joinSymbol // 级联拼接符
30
+ };
31
+ },
32
+ showType () {
33
+ return this.selfPropsObj._showMode;
34
+ },
35
+ filterable () {
36
+ return this.selfPropsObj._filterable;
37
+ },
38
+ cascaderLevel () {
39
+ return this.selfPropsObj._cascaderLevel;
40
+ },
41
+ cascaderFilterVals () {
42
+ return this.selfPropsObj._cascaderFilterVals;
43
+ },
44
+ changeOnSelect () {
45
+ return this.isOnSearch ? true : this.selfPropsObj._changeOnSelect;
46
+ },
47
+ saveKey () {
48
+ return this.selfPropsObj._saveKey;
49
+ },
50
+ valueKey () {
51
+ return this.selfPropsObj._valueKey;
52
+ },
53
+ nameKey () {
54
+ return this.selfPropsObj._nameKey;
55
+ },
56
+ renderFormat () {
57
+ return this.selfPropsObj._renderFormat;
58
+ },
59
+
60
+ originData () {
61
+ return ["region", "regions"].includes(this.controlType)
62
+ ? regionData
63
+ : ["userIndustry"].includes(this.controlType)
64
+ ? userIndustryData
65
+ : this.selfPropsObj._data;
66
+ },
67
+ cascaderData () {
68
+ const loop = (data = [], level, parentKeys = [], filterVals = [], isMobile = false) => {
69
+ if (data && filterVals.length) {
70
+ data = data.filter(item => filterVals.includes(item[this.saveKey]));
71
+ }
72
+
73
+ return data
74
+ ? data.reduce((arr, item) => {
75
+ let newItem = {
76
+ keys: [...parentKeys, item[this.saveKey]], // !!此处就是用_key拼,不会用别的属性
77
+ code: [...parentKeys, item._key].join(""),
78
+ ...item
79
+ };
80
+ newItem = {
81
+ ...newItem,
82
+ value: newItem[this.valueKey],
83
+ label: newItem[this.nameKey]
84
+ };
85
+
86
+ if (
87
+ (!level || level > newItem.level) &&
88
+ (newItem.children && newItem.children.length)
89
+ ) {
90
+ newItem.loading = false; // 此代码pc端在用:为了所请求的级,出现继续加载的箭头图标
91
+ newItem.children = loop(newItem.children, level, newItem.keys, undefined, isMobile);
92
+ } else {
93
+ newItem.children = isMobile ? undefined : [];
94
+ newItem.isLeaf = true;
95
+ }
96
+ arr.push(newItem);
97
+
98
+ return arr;
99
+ }, [])
100
+ : [];
101
+ };
102
+
103
+ return loop(this.originData, this.cascaderLevel, undefined, this.cascaderFilterVals, this.isMobile);
104
+ },
105
+ curValKeyList () {
106
+ return this.$getTreeLinealDatas(this.curValList, this.cascaderData, this.valueKey, this.saveKey);
107
+ },
108
+ curValName: {
109
+ get () {
110
+ return this.transformFullName(this.curValList);
111
+ },
112
+ set (str) {
113
+ if (!str) {
114
+ this.clickClear();
115
+ }
116
+ }
117
+ },
118
+ showVal () {
119
+ return this.$isEmptyData(this.curValList)
120
+ ? this.emptyShowVal
121
+ : this.curValName;
122
+ },
123
+ curValNameList () {
124
+ return this.curValList.map(item => this.transformFullName(item));
125
+ },
126
+ showMulVal () {
127
+ return this.$isEmptyData(this.curValList)
128
+ ? this.emptyShowVal
129
+ : this.curValNameList.join(",");
130
+ }
131
+ },
132
+ created () { },
133
+ methods: {
134
+ // 点击选择框 进行选择
135
+ clickInput (e) {
136
+ if (!this.selfPropsObj._disabled) {
137
+ this.openModal();
138
+ } else {
139
+ e.stopPropagation();
140
+ }
141
+ },
142
+
143
+ // 点击清除
144
+ clickClear () {
145
+ this.curValList = [];
146
+ },
147
+ confirmCb (selectedValue, selectedOptions) {
148
+ this.curValList = selectedValue;
149
+
150
+ this.closeModal();
151
+ },
152
+ confirmMulCb (selectedValue, selectedOptions) {
153
+ if (this.curValList.some(item => JSON.stringify(item) === JSON.stringify(selectedValue))) {
154
+ this.$Message.error({
155
+ content: `"${this.transformFullName(selectedValue)}"已选择,请勿重复选择!`,
156
+ duration: 4
157
+ });
158
+ } else {
159
+ this.curValList = [...this.curValList, selectedValue];
160
+
161
+ this.closeModal();
162
+ }
163
+ },
164
+ // 删除
165
+ clickDeleteItem (nameItem, index) {
166
+ this.curValList.splice(index, 1);
167
+ this.curValList = [...this.curValList];
168
+ },
169
+
170
+ /* --------- 工具类 -------- */
171
+ // 转化出级联全名
172
+ transformFullName (value) {
173
+ return this.renderFormat(this.$getTreeLinealDatas(value, this.cascaderData, this.nameKey, this.saveKey));
174
+ }
175
+ }
176
+ };
@@ -0,0 +1,374 @@
1
+ <template>
2
+ <div class="cascaderModal">
3
+ <div @click.stop="clickInput">
4
+ <slot>
5
+ <Input
6
+ v-model="inputStr"
7
+ :placeholder="selfPropsObj._placeholder"
8
+ :disabled="selfPropsObj._disabled"
9
+ :readonly="true"
10
+ :clearable="selfPropsObj._clearable"
11
+ :size="selfPropsObj._size"
12
+ ></Input>
13
+ </slot>
14
+ </div>
15
+
16
+ <dsh-modal
17
+ class="cascaderModal-modal"
18
+ v-model="showModal"
19
+ mode="middle"
20
+ :propsObj="modalPropsObj"
21
+ >
22
+ <div class="wrap">
23
+ <div class="wrap-header">
24
+ <!-- 搜索 -->
25
+ <div class="wrap-header-left">
26
+ <template v-if="filterable">
27
+ <!-- 搜索框 -->
28
+ <Input
29
+ class="search"
30
+ v-model="searchName"
31
+ placeholder="请输入关键字或标识"
32
+ search
33
+ @on-enter="search"
34
+ @on-search="search"
35
+ @on-change="search"
36
+ />
37
+
38
+ <!-- 模式切换 -->
39
+ <template>
40
+ <div
41
+ v-if="useMode"
42
+ class="mode"
43
+ @click="showMode = showMode === 'default' ? 'flat' : 'default'"
44
+ >
45
+ <dsh-icons :list="[{ icon: 'md-swap' }]" />
46
+ <span class="mode-name">
47
+ {{ showMode === "default" ? "按层级" : "按平级" }}
48
+ </span>
49
+ </div>
50
+
51
+ <Tooltip
52
+ v-else
53
+ style="margin-left: 5px; cursor: pointer;"
54
+ :content="modeTip"
55
+ max-width="250"
56
+ transfer
57
+ >
58
+ <Icon
59
+ class="item-header-help"
60
+ type="md-help-circle"
61
+ size="16"
62
+ ></Icon>
63
+ </Tooltip>
64
+ </template>
65
+ </template>
66
+ </div>
67
+
68
+ <!-- 按钮 -->
69
+ <dsh-buttons
70
+ class="wrap-header-right"
71
+ :list="$getOperationList()"
72
+ @click="$dispatchEvent($event)"
73
+ ></dsh-buttons>
74
+ </div>
75
+
76
+ <div class="wrap-content">
77
+ <!-- 左 -->
78
+ <div class="wrap-content-left">
79
+ <template v-if="showTreeData.length">
80
+ <!-- 拍平方式 -->
81
+ <div v-if="useFlatMode">
82
+ <div
83
+ v-for="dataItem in showFlatData"
84
+ :key="dataItem[valueKey]"
85
+ :class="{
86
+ 'item': true,
87
+ 'item-active': selectedLastOption && dataItem[valueKey] === selectedLastOption[valueKey],
88
+ 'item-disabled': dataItem.disabled
89
+ }"
90
+ @click="clickItem(dataItem)"
91
+ >
92
+ <span class="item-name">
93
+ {{ dataItem[nameKey] }}
94
+ </span>
95
+
96
+ <span class="item-icon">
97
+ <dsh-icons :list="[{
98
+ icon: selectedLastOption && dataItem[valueKey] === selectedLastOption[valueKey]
99
+ ? 'md-checkmark'
100
+ : ''
101
+ }]" />
102
+ </span>
103
+ </div>
104
+ </div>
105
+
106
+ <!-- 层级方式 -->
107
+ <Tree
108
+ v-else
109
+ :data="showTreeData"
110
+ ></Tree>
111
+ </template>
112
+
113
+ <!-- 无数据 -->
114
+ <div
115
+ v-else
116
+ class="wrap-content-left-nodata"
117
+ >
118
+ 暂无可用的数据……
119
+ </div>
120
+ </div>
121
+
122
+ <!-- 右 描述 -->
123
+ <div class="wrap-content-right">
124
+ <div class="wrap-content-right-title">
125
+ {{ selectedName }}说明
126
+ </div>
127
+ <p
128
+ class="wrap-content-right-content"
129
+ v-html="description"
130
+ ></p>
131
+ </div>
132
+ </div>
133
+ </div>
134
+ </dsh-modal>
135
+ </div>
136
+ </template>
137
+
138
+ <script>
139
+ import cascaderPickerMixin from "./cascaderPickerMixin.js";
140
+
141
+ export default {
142
+ name: "cascaderModal",
143
+ mixins: [
144
+ cascaderPickerMixin
145
+ ],
146
+ components: {},
147
+ props: {},
148
+ data () {
149
+ return {
150
+ description: ""
151
+ };
152
+ },
153
+ computed: {
154
+ modalPropsObj () {
155
+ return {
156
+ title: this.selfPropsObj._name
157
+ };
158
+ },
159
+
160
+ initData () {
161
+ const loop = (data = [], newData = []) => {
162
+ return data.reduce((newData, item) => {
163
+ const newItem = {
164
+ ...item,
165
+ value: item[this.valueKey],
166
+ title: item[this.nameKey],
167
+ expand: false,
168
+ description: undefined,
169
+ render: (h, { root, node, data }) => {
170
+ return h("span", {
171
+ class: {
172
+ "ivu-tree-title-selected": JSON.stringify(data.keys) === JSON.stringify(this.selectedValue)
173
+ },
174
+ style: {
175
+ display: "inline-block",
176
+ width: "100%"
177
+ },
178
+ on: {
179
+ click: () => {
180
+ this.clickItem(data);
181
+ }
182
+ }
183
+ }, data.title);
184
+ },
185
+ children: loop(item.children)
186
+ };
187
+
188
+ return [...newData, newItem];
189
+ }, newData);
190
+ };
191
+
192
+ return loop(this.data);
193
+ }
194
+ },
195
+ created () {
196
+ this.init();
197
+ },
198
+ methods: {
199
+ init () {
200
+ this.selectedValue = this.activeValue;
201
+ this.selectedOptions.forEach(item => {
202
+ item.expand = true;
203
+ });
204
+ this.dealDescription();
205
+ },
206
+
207
+ search () {
208
+ this.selectedValue = [];
209
+ },
210
+ clickItemCb (node) {
211
+ this.dealDescription();
212
+ },
213
+ dealDescription () {
214
+ if (this.selectedValue.length && this.selectedLastOption.description == undefined) {
215
+ this.getDescription(this.selectedValue);
216
+ }
217
+ },
218
+ getDescription (nodeKeys) {
219
+ this.$https({
220
+ url: {
221
+ module: "sheet",
222
+ name: "getResourceDescription"
223
+ },
224
+ params: {
225
+ resourceKey: this.resourceKey,
226
+ nodeKeys
227
+ },
228
+ callback: data => {
229
+ this.description = data;
230
+ this.selectedLastOption.description = data;
231
+ }
232
+ });
233
+ }
234
+ }
235
+ };
236
+ </script>
237
+
238
+ <style lang="less">
239
+ .cascaderModal {
240
+ &-modal {
241
+ .wrap {
242
+ width: 100%;
243
+ height: 100%;
244
+ padding: 10px 24px;
245
+ display: flex;
246
+ flex-direction: column;
247
+
248
+ &-header {
249
+ width: 100%;
250
+ padding: 0px;
251
+ // border-bottom: 1px solid @borderColor;
252
+ display: flex;
253
+ justify-content: space-between;
254
+ align-items: center;
255
+
256
+ &-left {
257
+ width: 370px;
258
+ display: flex;
259
+ align-items: center;
260
+
261
+ .search {
262
+ width: 280px;
263
+ }
264
+
265
+ .mode {
266
+ width: 90px;
267
+ padding-top: 14px;
268
+ padding-left: 5px;
269
+ display: flex;
270
+ align-items: center;
271
+ cursor: pointer;
272
+
273
+ &-name {
274
+ font-size: 12px;
275
+ }
276
+ }
277
+ }
278
+
279
+ &-right {
280
+ padding-left: 10px;
281
+ display: flex;
282
+ justify-content: flex-end;
283
+ }
284
+ }
285
+
286
+ &-content {
287
+ flex: 1;
288
+ min-height: 0px;
289
+ margin: 10px 0px 24px;
290
+ border: 1px solid #E5E5E5;
291
+ display: flex;
292
+
293
+ &-left {
294
+ flex: 1;
295
+ min-width: 0px;
296
+ padding: 5px 10px;
297
+ border-right: 1px solid #E5E5E5;
298
+ overflow: auto;
299
+
300
+ .item {
301
+ padding: 8px 10px;
302
+ border-radius: @borderRadius;
303
+ line-height: 16px;
304
+ cursor: pointer;
305
+ display: flex;
306
+ flex-direction: row;
307
+ justify-content: space-between;
308
+ align-items: center;
309
+
310
+ &-name {
311
+ flex: 1;
312
+ min-width: 0px;
313
+ white-space: normal;
314
+ }
315
+
316
+ &-icon {
317
+ width: 40px;
318
+ padding-left: 10px;
319
+ text-align: right;
320
+ }
321
+
322
+ &:hover,
323
+ &-active {
324
+ background-color: @theme-focus;
325
+ color: @themeColor;
326
+ }
327
+
328
+ &-disabled {
329
+ background-color: @inputBg-disabled;
330
+ color: @textColor-disabled;
331
+
332
+ &:hover {
333
+ background-color: @inputBg-disabled;
334
+ color: @textColor-disabled;
335
+ }
336
+ }
337
+ }
338
+
339
+ &-nodata {
340
+ #dsh-nodata();
341
+ }
342
+ }
343
+
344
+ &-right {
345
+ flex: 1;
346
+ min-width: 0px;
347
+
348
+ &-title {
349
+ padding: 6px 16px;
350
+ border-bottom: 1px solid #E5E5E5;
351
+ font-weight: 700;
352
+ }
353
+
354
+ &-content {
355
+ height: calc(100% - 32px);
356
+ padding: 16px;
357
+ white-space: pre-line;
358
+ overflow: auto;
359
+ }
360
+ }
361
+
362
+ .ivu-tree-title-selected {
363
+ background-color: #eee;
364
+ color: #3D84EE;
365
+ }
366
+
367
+ .ivu-tree-empty {
368
+ text-align: center;
369
+ }
370
+ }
371
+ }
372
+ }
373
+ }
374
+ </style>