bri-components 1.2.49 → 1.2.50

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 (47) hide show
  1. package/package.json +2 -2
  2. package/src/components/controls/BriControlInput.vue +4 -3
  3. package/src/components/controls/base/DshCascader/DshCascader.vue +40 -23
  4. package/src/components/controls/base/DshCascader/InfoCascader.vue +7 -15
  5. package/src/components/controls/base/DshDate/DshDate.vue +146 -0
  6. package/src/components/controls/base/{DshDaterange.vue → DshDate/DshDaterange.vue} +55 -1
  7. package/src/components/controls/base/{BriInputs.vue → DshInput/BriInputs.vue} +1 -1
  8. package/src/components/controls/base/{DshInput.vue → DshInput/DshInput.vue} +24 -5
  9. package/src/components/controls/base/DshNumber/DshNumber.vue +74 -2
  10. package/src/components/controls/base/{DshNumberange.vue → DshNumber/DshNumberange.vue} +37 -2
  11. package/src/components/controls/base/DshSelect/DshCheckbox.vue +280 -0
  12. package/src/components/controls/base/DshSelect/DshSelect.vue +319 -0
  13. package/src/components/controls/base/DshSelect/selectMixin.js +241 -0
  14. package/src/components/controls/base/DshSwitch/DshSwitch.vue +84 -0
  15. package/src/components/controls/base/DshSwitch/switchMixin.js +73 -0
  16. package/src/components/controls/controlMap.js +8 -11
  17. package/src/components/controls/controlMixin.js +33 -5
  18. package/src/components/controls/senior/BriLabels.vue +1 -1
  19. package/src/components/controls/senior/selectDepartments.vue +9 -13
  20. package/src/components/controls/senior/selectUsers/selectUsers.vue +23 -21
  21. package/src/components/form/DshAdvSearch.vue +155 -3
  22. package/src/components/form/DshDefaultSearch.vue +94 -12
  23. package/src/components/form/DshForm.vue +24 -0
  24. package/src/components/form/searchMixin.js +5 -18
  25. package/src/components/other/BriGantt.vue +2 -2
  26. package/src/components/unit/DshFormUnit.vue +108 -0
  27. package/src/components/unit/DshListUnit.vue +6 -0
  28. package/src/index.js +10 -10
  29. package/src/styles/components/index.less +0 -14
  30. package/src/styles/components/other/BriGantt.less +1 -12
  31. package/src/styles/reset-iview.less +47 -1
  32. package/src/components/controls/base/DshCheckbox.vue +0 -213
  33. package/src/components/controls/base/DshDate.vue +0 -122
  34. package/src/components/controls/base/DshSelect.vue +0 -242
  35. package/src/components/controls/base/DshSwitch.vue +0 -70
  36. package/src/components/controls/base/selectMixin.js +0 -110
  37. package/src/styles/components/controls/base/DshCheckbox.less +0 -115
  38. package/src/styles/components/controls/base/DshDate.less +0 -15
  39. package/src/styles/components/controls/base/DshDaterange.less +0 -49
  40. package/src/styles/components/controls/base/DshNumber.less +0 -55
  41. package/src/styles/components/controls/base/DshNumberange.less +0 -29
  42. package/src/styles/components/controls/base/DshSelect.less +0 -190
  43. package/src/styles/components/form/DshAdvSearch.less +0 -149
  44. package/src/styles/components/form/DshDefaultSearch.less +0 -82
  45. package/src/styles/components/form/DshForm.less +0 -18
  46. package/src/styles/components/unit/DshFormUnit.less +0 -105
  47. package/src/styles/components/unit/DshListUnit.less +0 -3
@@ -0,0 +1,280 @@
1
+ <template>
2
+ <div class="DshCheckbox">
3
+ <!-- 编辑 -->
4
+ <template v-if="canEdit">
5
+ <!-- 有选项 -->
6
+ <template v-if="listData.length">
7
+ <!-- flat方式 -->
8
+ <template v-if="showType === 'flat'">
9
+ <CheckboxGroup
10
+ :class="{
11
+ 'DshCheckbox-flat': true,
12
+ 'DshCheckbox-flat-color': useColor,
13
+ 'DshCheckbox-flat-disabled': !canEdit,
14
+ 'DshCheckbox-flat-scroll': selfPropsObj._span < 24 && !selfPropsObj._br,
15
+ }"
16
+ v-model="curValList"
17
+ >
18
+ <Checkbox
19
+ v-for="(item, index) in listData"
20
+ :key="index"
21
+ :class="[
22
+ 'DshCheckbox-item',
23
+ getItemColorClass(item),
24
+ selfPropsObj.class,
25
+ item.class
26
+ ]"
27
+ :style="getItemStyle(item)"
28
+ :label="item._key"
29
+ :disabled="getItemDisabled(item)"
30
+ :border="useColor"
31
+ @click.native="clickOpenTip(item)"
32
+ >
33
+ <slot :item="item"></slot>
34
+
35
+ <span>{{ item.name || item._name }}</span>
36
+ </Checkbox>
37
+
38
+ <!-- tip项弹框提示 -->
39
+ <dsh-render :render="tipModalRender"></dsh-render>
40
+ </CheckboxGroup>
41
+ </template>
42
+
43
+ <!-- dropdown模式 -->
44
+ <template v-else>
45
+ <Select
46
+ v-model="value[controlKey]"
47
+ :multiple="true"
48
+ :placeholder="selfPropsObj._placeholder"
49
+ :disabled="!finalCanEdit"
50
+ :filterable="selfPropsObj._filterable"
51
+ :transfer="selfPropsObj._transfer"
52
+ :transfer-class-name="selfPropsObj._transferClassName"
53
+ :max-tag-count="selfPropsObj._maxTagCount"
54
+ @on-select="changeSelect"
55
+ >
56
+ <Option
57
+ v-for="(item, index) in listData"
58
+ :key="index"
59
+ :value="item._key"
60
+ :label="item.name || item._name"
61
+ :disabled="getItemDisabled(item)"
62
+ >
63
+ <Checkbox :value="getItemSelectStatus(item)"></Checkbox>
64
+
65
+ <slot :item="item"></slot>
66
+
67
+ <span>{{ item.name || item._name }}</span>
68
+ <span style="float:right; padding-right:20px">
69
+ {{ item.rightName }}
70
+ </span>
71
+ </Option>
72
+ </Select>
73
+ </template>
74
+ </template>
75
+
76
+ <!-- 无选项 -->
77
+ <div
78
+ v-else
79
+ class="dsh-subtip"
80
+ >-- 无选择项 --</div>
81
+ </template>
82
+
83
+ <!-- 查看 -->
84
+ <template v-else>
85
+ <bri-tooltip
86
+ :content="showMulVal"
87
+ placement="top"
88
+ maxWidth="200"
89
+ :transfer="true"
90
+ >
91
+ <div :class="{
92
+ ...commonClass,
93
+ 'DshCheckbox-show': true
94
+ }">
95
+ <!-- 有值 -->
96
+ <dsh-tags
97
+ v-if="!$isEmptyData(curValList)"
98
+ class="text"
99
+ :list="curValObjList"
100
+ ></dsh-tags>
101
+
102
+ <!-- 无值 -->
103
+ <template v-else>
104
+ {{ emptyShowVal }}
105
+ </template>
106
+ </div>
107
+ </bri-tooltip>
108
+ </template>
109
+ </div>
110
+ </template>
111
+
112
+ <script>
113
+ import selectMixin from "./selectMixin.js";
114
+
115
+ export default {
116
+ name: "DshCheckbox",
117
+ mixins: [
118
+ selectMixin
119
+ ],
120
+ components: {},
121
+ props: {},
122
+ data () {
123
+ return {};
124
+ },
125
+ computed: {
126
+ selfPropsObj () {
127
+ return {
128
+ _transfer: true,
129
+ ...this.selectPropsObj
130
+ };
131
+ }
132
+ },
133
+ created () {},
134
+ methods: {
135
+ // 下拉框的change (下拉方式时用v-model触发change有问题,组件进来如果值不为空的,就会v-model返值一次)
136
+ changeSelect (item) {
137
+ if (this.curValList.includes(item.value)) {
138
+ let itemIndex = this.curValList.findIndex(valItem => valItem === item.value);
139
+ this.curValList.splice(itemIndex, 1);
140
+ } else {
141
+ this.curValList.push(item.value);
142
+ }
143
+
144
+ this.curValList = [...this.curValList];
145
+ },
146
+
147
+ getItemColorClass (item) {
148
+ return this.colorMap[item.color] ? item.color : "color-1";
149
+ },
150
+ getItemStyle (item) {
151
+ const color = this.colorMap[item.color] || this.colorMap["color-1"];
152
+ return {
153
+ background: this.useColor ? this.$getColor(color, 0.1) : undefined,
154
+ color: this.useColor ? color : undefined
155
+ };
156
+ },
157
+ // 获取某项的置灰状态
158
+ getItemDisabled (item) {
159
+ return !!(
160
+ !this.finalCanEdit ||
161
+ item._disabled ||
162
+ this.curValList.length >= this.selfPropsObj._max && !this.getItemSelectStatus(item)
163
+ );
164
+ },
165
+ // 获取某项的选中状态
166
+ getItemSelectStatus (item) {
167
+ return this.curValList.includes(item._key);
168
+ }
169
+ }
170
+ };
171
+ </script>
172
+
173
+ <style lang="less">
174
+ .DshCheckbox {
175
+ width: 100%;
176
+
177
+ &-flat {
178
+ width: 100%;
179
+
180
+ // 选中时背景为白色
181
+ .ivu-checkbox-checked .ivu-checkbox-inner {
182
+ background-color: @themeColor;
183
+ }
184
+
185
+ &-item {}
186
+
187
+ &-color {
188
+ .ivu-checkbox-border {
189
+ margin-right: 16px;
190
+ height: 32px;
191
+ border: none;
192
+ border-radius: 4px;
193
+ line-height: 32px;
194
+ color: #FFF;
195
+ }
196
+
197
+ .ivu-checkbox {
198
+ .ivu-checkbox-inner {
199
+ border: 2px solid @themeColor;
200
+ background-color: transparent;
201
+ }
202
+
203
+ .ivu-checkbox-focus {
204
+ box-shadow: 0 0 0 0;
205
+ }
206
+ }
207
+
208
+ .ivu-checkbox-disabled+span {
209
+ color: inherit;
210
+ }
211
+
212
+ each(@resourceColor, {
213
+ .color-@{index} {
214
+ .ivu-checkbox {
215
+ .ivu-checkbox-inner {
216
+ border-color: @value;
217
+ }
218
+ }
219
+
220
+ .ivu-checkbox-checked {
221
+ .ivu-checkbox-inner {
222
+ background-color: @value;
223
+ }
224
+ }
225
+ }
226
+ });
227
+ }
228
+
229
+ &-disabled {
230
+ .ivu-checkbox-disabled+span {
231
+ color: #515a6e;
232
+ }
233
+ }
234
+
235
+ &-scroll {
236
+ overflow: auto;
237
+ white-space: nowrap;
238
+
239
+ .bri-scrollbar3();
240
+ }
241
+ }
242
+
243
+ &-show {}
244
+
245
+ .ivu-select-multiple {
246
+ .ivu-select-selection {
247
+ height: 32px;
248
+ .dsh-flex-row-between-center();
249
+
250
+ & > div {
251
+ width: 100%;
252
+ height: 100%;
253
+ word-break: keep-all;
254
+ white-space: nowrap;
255
+ overflow: auto;
256
+ .bri-scrollbar3();
257
+
258
+ .ivu-tag {
259
+ margin: 2px 4px 0px 0px;
260
+ background-color: @borderColor;
261
+ }
262
+ }
263
+ }
264
+
265
+ &.ivu-select-disabled {
266
+ .ivu-select-selection {
267
+ & > div {
268
+ .ivu-tag {
269
+ background-color: @border-disabled;
270
+ }
271
+ }
272
+ }
273
+ }
274
+
275
+ .ivu-select-item-selected:after {
276
+ content: none;
277
+ }
278
+ }
279
+ }
280
+ </style>
@@ -0,0 +1,319 @@
1
+ <template>
2
+ <!-- 单选模式 -->
3
+ <div
4
+ v-if="!multipleMode"
5
+ class="DshSelect"
6
+ >
7
+ <template v-if="canEdit">
8
+ <!-- 有选项 -->
9
+ <template v-if="listData.length">
10
+ <!-- flat方式 -->
11
+ <template v-if="['flat', 'button'].includes(showType)">
12
+ <RadioGroup
13
+ :class="{
14
+ 'DshSelect-flat': true,
15
+ 'DshSelect-flat-color': useColor,
16
+ 'DshSelect-flat-scroll': selfPropsObj._span < 24 && !selfPropsObj._br
17
+ }"
18
+ v-model="value[controlKey]"
19
+ :type="radioGroupType"
20
+ @on-change="change"
21
+ >
22
+ <Radio
23
+ v-for="(item, index) in listData"
24
+ :key="index"
25
+ :class="getItemColorClass(item)"
26
+ :style="getItemStyle(item)"
27
+ :label="item._key"
28
+ :disabled="getItemDisabled(item)"
29
+ :border="useColor"
30
+ @click.native="cancelSelect(item)"
31
+ >
32
+ <span @click.stop="clickOpenTip(item)">
33
+ {{ item.name || item._name }}
34
+ </span>
35
+ </Radio>
36
+ </RadioGroup>
37
+
38
+ <!-- tip项弹框提示 -->
39
+ <dsh-render :render="tipModalRender"></dsh-render>
40
+ </template>
41
+
42
+ <!-- dropdown模式 -->
43
+ <template v-else>
44
+ <Select
45
+ v-model="curVal"
46
+ :placeholder="selfPropsObj._placeholder"
47
+ :multiple="false"
48
+ :disabled="!finalCanEdit"
49
+ :clearable="selfPropsObj._clearable"
50
+ :filterable="selfPropsObj._filterable"
51
+ :size="selfPropsObj._size"
52
+ :transfer="selfPropsObj._transfer"
53
+ :transfer-class-name="selfPropsObj._transferClassName"
54
+ @on-change="change"
55
+ >
56
+ <!-- </Option>必须和输出内容在一行,否则出现空格导致_filterable出bug -->
57
+ <Option
58
+ v-for="(item, index) in listData"
59
+ :key="index"
60
+ :value="item._key"
61
+ :label="item.name || item._name"
62
+ :disabled="getItemDisabled(item)"
63
+ >
64
+ <Icon
65
+ v-if="item.icon || item.customIcon"
66
+ :type="item.icon"
67
+ :custom="item.customIcon ? `bico-font ${item.customIcon}` : undefined"
68
+ :color="item.color"
69
+ :size="item.size || 20"
70
+ />{{ item.name || item._name }}
71
+ </Option>
72
+ </Select>
73
+ </template>
74
+ </template>
75
+
76
+ <!-- 无选项 -->
77
+ <div
78
+ v-else
79
+ class="dsh-subtip"
80
+ >-- 无选择项 --</div>
81
+ </template>
82
+
83
+ <!-- 查看 -->
84
+ <template v-else>
85
+ <bri-tooltip
86
+ :content="showVal"
87
+ maxWidth="200"
88
+ placement="top"
89
+ :transfer="true"
90
+ >
91
+ <div :class="{
92
+ ...commonClass,
93
+ 'DshSelect-show': true
94
+ }">
95
+ <!-- 有值 -->
96
+ <dsh-tags
97
+ v-if="!$isEmptyData(curVal)"
98
+ class="text"
99
+ :list="[curValObj]"
100
+ ></dsh-tags>
101
+
102
+ <!-- 无值 -->
103
+ <template v-else>
104
+ {{ emptyShowVal }}
105
+ </template>
106
+ </div>
107
+ </bri-tooltip>
108
+ </template>
109
+ </div>
110
+
111
+ <!-- 多选模式 -->
112
+ <dsh-checkbox
113
+ v-else
114
+ :canEdit="canEdit"
115
+ :value="value"
116
+ :propsObj="propsObj"
117
+ @change="change"
118
+ ></dsh-checkbox>
119
+ </template>
120
+
121
+ <script>
122
+ import selectMixin from "./selectMixin.js";
123
+ import DshCheckbox from "./DshCheckbox.vue";
124
+
125
+ export default {
126
+ name: "DshSelect",
127
+ mixins: [
128
+ selectMixin
129
+ ],
130
+ components: {
131
+ DshCheckbox
132
+ },
133
+ props: {},
134
+ data () {
135
+ return {};
136
+ },
137
+ computed: {
138
+ selfPropsObj () {
139
+ return {
140
+ _transfer: true,
141
+ ...this.selectPropsObj
142
+ };
143
+ },
144
+ radioGroupType () {
145
+ return this.showType === "button" ? "button" : undefined;
146
+ }
147
+ },
148
+ created () {},
149
+ methods: {
150
+ // 取消flat模式的选择项
151
+ cancelSelect (item) {
152
+ if (item._disabled !== true && this.selfPropsObj._clearable !== false) {
153
+ if (item._key === this.curVal) {
154
+ this.value[this.controlKey] = "";
155
+ this.change();
156
+ }
157
+ }
158
+
159
+ this.clickOpenTip(item);
160
+ },
161
+ change (...params) {
162
+ // 修复clear后值为undefined,数据库不更新数据bug
163
+ if (this.value[this.controlKey] == undefined) {
164
+ this.value[this.controlKey] = "";
165
+ }
166
+
167
+ this.$emit("change", this.curVal);
168
+ },
169
+
170
+ getItemColorClass (item) {
171
+ return this.colorMap[item.color] ? item.color : "color-1";
172
+ },
173
+ getItemStyle (item) {
174
+ const color = this.colorMap[item.color] || this.colorMap["color-1"];
175
+ return {
176
+ backgroundColor: this.useColor ? this.$getColor(color, 0.1) : undefined,
177
+ color: this.useColor ? color : undefined
178
+ };
179
+ }
180
+ }
181
+ };
182
+ </script>
183
+
184
+ <style lang="less">
185
+ .DshSelect {
186
+ width: 100%;
187
+
188
+ &-flat {
189
+ width: 100%;
190
+
191
+ &-color {
192
+ .ivu-radio-border {
193
+ height: 32px;
194
+ line-height: 32px;
195
+ border-radius: 4px;
196
+ border: none;
197
+ color: #FFF;
198
+ margin-right: 16px;
199
+ }
200
+
201
+ .ivu-radio {
202
+ .ivu-radio-inner {
203
+ border: 2px solid @themeColor;
204
+ background-color: transparent;
205
+ width: 14px;
206
+ height: 14px;
207
+
208
+ &::after {
209
+ width: 6px;
210
+ height: 6px;
211
+ left: 2px;
212
+ top: 2px;
213
+ background-color: transparent;
214
+ opacity: 1;
215
+ transform: scale(1);
216
+ }
217
+ }
218
+
219
+ .ivu-radio-focus {
220
+ box-shadow: 0 0 0 0;
221
+ }
222
+ }
223
+
224
+ .ivu-radio-checked {
225
+ .ivu-radio-inner {
226
+ &::after {
227
+ background-color: @themeColor;
228
+ }
229
+ }
230
+ }
231
+
232
+ each(@resourceColor, {
233
+ .color-@{index} {
234
+ .ivu-radio {
235
+ .ivu-radio-inner {
236
+ border-color: @value;
237
+ }
238
+ }
239
+
240
+ .ivu-radio-checked {
241
+ .ivu-radio-inner {
242
+ &::after {
243
+ background-color: @value;
244
+ }
245
+ }
246
+ }
247
+ }
248
+ });
249
+ }
250
+
251
+ &-scroll {
252
+ overflow: auto;
253
+ white-space: nowrap;
254
+
255
+ .bri-scrollbar3();
256
+ }
257
+ }
258
+
259
+ &-modal {
260
+ .ivu-modal-wrap {
261
+ display: flex;
262
+ align-items: center;
263
+ justify-content: center;
264
+ }
265
+
266
+ .ivu-modal {
267
+ width: 544px !important;
268
+ position: static;
269
+ }
270
+
271
+ .ivu-modal-content {
272
+ border-radius: 8px;
273
+ }
274
+
275
+ .ivu-modal-header {
276
+ border-bottom: none;
277
+ padding: 32px 32px 0;
278
+
279
+ .ivu-modal-header-inner {
280
+ font-size: 18px;
281
+ font-family: Microsoft YaHei-Semibold, Microsoft YaHei;
282
+ font-weight: 600;
283
+ color: #252F36;
284
+ }
285
+ }
286
+
287
+ .DshModal-close {
288
+ right: 30px !important;
289
+ top: 30px !important;
290
+ background: #F4F6F8;
291
+ border-radius: 4px 4px 4px 4px;
292
+ }
293
+
294
+ .ivu-modal-body {
295
+ padding: 24px 32px 32px;
296
+ }
297
+
298
+ &-footer {
299
+ margin-top: 24px;
300
+ text-align: right;
301
+
302
+ .ivu-btn {
303
+ font-size: 16px;
304
+ font-family: Microsoft YaHei-Semibold, Microsoft YaHei;
305
+ font-weight: 600;
306
+ border-radius: 4px;
307
+ }
308
+ }
309
+ }
310
+
311
+ &-tip {
312
+ cursor: pointer;
313
+
314
+ .ivu-radio {
315
+ display: none;
316
+ }
317
+ }
318
+ }
319
+ </style>