bri-components 1.2.48 → 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 (66) 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/2.bri-components.min.js +1 -1
  4. package/lib/3.bri-components.min.js +1 -1
  5. package/lib/4.bri-components.min.js +1 -1
  6. package/lib/5.bri-components.min.js +1 -1
  7. package/lib/6.bri-components.min.js +1 -1
  8. package/lib/bri-components.min.js +16 -16
  9. package/package.json +2 -2
  10. package/src/components/controls/BriControlInput.vue +4 -3
  11. package/src/components/controls/base/DshCascader/DshCascader.vue +40 -23
  12. package/src/components/controls/base/DshCascader/InfoCascader.vue +7 -15
  13. package/src/components/controls/base/DshDate/DshDate.vue +146 -0
  14. package/src/components/controls/base/{DshDaterange.vue → DshDate/DshDaterange.vue} +55 -1
  15. package/src/components/controls/base/DshEditor.vue +79 -1
  16. package/src/components/controls/base/{BriInputs.vue → DshInput/BriInputs.vue} +1 -1
  17. package/src/components/controls/base/{DshInput.vue → DshInput/DshInput.vue} +24 -5
  18. package/src/components/controls/base/DshNumber/DshNumber.vue +74 -2
  19. package/src/components/controls/base/{DshNumberange.vue → DshNumber/DshNumberange.vue} +37 -2
  20. package/src/components/controls/base/DshSelect/DshCheckbox.vue +280 -0
  21. package/src/components/controls/base/DshSelect/DshSelect.vue +319 -0
  22. package/src/components/controls/base/DshSelect/selectMixin.js +241 -0
  23. package/src/components/controls/base/DshSwitch/DshSwitch.vue +84 -0
  24. package/src/components/controls/base/DshSwitch/switchMixin.js +73 -0
  25. package/src/components/controls/controlMap.js +8 -11
  26. package/src/components/controls/controlMixin.js +41 -14
  27. package/src/components/controls/senior/BriLabels.vue +2 -2
  28. package/src/components/controls/senior/selectDepartments.vue +9 -13
  29. package/src/components/controls/senior/selectUsers/selectUsers.vue +23 -21
  30. package/src/components/controls/special/DshBack.vue +6 -0
  31. package/src/components/controls/special/DshUndeveloped.vue +6 -0
  32. package/src/components/form/DshAdvSearch.vue +155 -3
  33. package/src/components/form/DshDefaultSearch.vue +94 -12
  34. package/src/components/form/DshForm.vue +24 -0
  35. package/src/components/form/searchMixin.js +5 -18
  36. package/src/components/other/BriGantt.vue +2 -2
  37. package/src/components/unit/DshFormUnit.vue +108 -0
  38. package/src/components/unit/DshListUnit.vue +6 -0
  39. package/src/index.js +10 -10
  40. package/src/styles/components/index.less +0 -19
  41. package/src/styles/components/other/BriGantt.less +1 -12
  42. package/src/styles/{control.less → global/control.less} +3 -2
  43. package/src/styles/global/global.less +2 -0
  44. package/src/styles/index.less +0 -1
  45. package/src/styles/reset-iview.less +47 -1
  46. package/src/utils/table.js +1 -0
  47. package/src/components/controls/base/DshCheckbox.vue +0 -213
  48. package/src/components/controls/base/DshDate.vue +0 -122
  49. package/src/components/controls/base/DshSelect.vue +0 -242
  50. package/src/components/controls/base/DshSwitch.vue +0 -60
  51. package/src/components/controls/base/selectMixin.js +0 -110
  52. package/src/styles/components/controls/base/DshCheckbox.less +0 -115
  53. package/src/styles/components/controls/base/DshDate.less +0 -15
  54. package/src/styles/components/controls/base/DshDaterange.less +0 -49
  55. package/src/styles/components/controls/base/DshEditor.less +0 -75
  56. package/src/styles/components/controls/base/DshNumber.less +0 -55
  57. package/src/styles/components/controls/base/DshNumberange.less +0 -29
  58. package/src/styles/components/controls/base/DshSelect.less +0 -190
  59. package/src/styles/components/controls/base/DshSwitch.less +0 -7
  60. package/src/styles/components/controls/special/DshBack.less +0 -3
  61. package/src/styles/components/controls/special/DshUndeveloped.less +0 -3
  62. package/src/styles/components/form/DshAdvSearch.less +0 -149
  63. package/src/styles/components/form/DshDefaultSearch.less +0 -82
  64. package/src/styles/components/form/DshForm.less +0 -18
  65. package/src/styles/components/unit/DshFormUnit.less +0 -105
  66. package/src/styles/components/unit/DshListUnit.less +0 -3
@@ -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>
@@ -0,0 +1,241 @@
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
+ showTipTpl: false,
14
+ showTipModal: false,
15
+ dynamicContent: ""
16
+ };
17
+ },
18
+ computed: {
19
+ selectPropsObj () {
20
+ return {
21
+ colorMap: resourceData.colorMap,
22
+ _optionKind: "dropdown", // "flat"、"dropdown"
23
+ _useColor: false,
24
+ _filterable: true,
25
+ _data: [],
26
+ _customData: [],
27
+
28
+ ...this.propsObj,
29
+ ...this.commonDealPropsObj,
30
+
31
+ _disabled: this.propsObj._disabled || !this.finalCanEdit
32
+ };
33
+ },
34
+ showType () {
35
+ return this.selfPropsObj._optionKind;
36
+ },
37
+ useColor () {
38
+ return this.selfPropsObj._useColor;
39
+ },
40
+ colorMap () {
41
+ return this.selfPropsObj.colorMap;
42
+ },
43
+ listData () {
44
+ const listData = this.selfPropsObj._data.concat(this.initListData);
45
+
46
+ return this.$dataType(this.selfPropsObj._filterFunc, "function")
47
+ ? this.selfPropsObj._filterFunc(listData, this.selfPropsObj, this.value)
48
+ : listData;
49
+ },
50
+
51
+ openTip () {
52
+ return this.isOnSearch ? false : this.propsObj._openTip;
53
+ },
54
+ modalTipContent () {
55
+ return this.propsObj._tipContent || this.dynamicContent || "暂无信息";
56
+ },
57
+
58
+ curValObj () {
59
+ return this.$isEmptyData(this.curVal)
60
+ ? undefined
61
+ : this.getItemData(this.curVal);
62
+ },
63
+ valStr: {
64
+ get () {
65
+ return this.curValObj
66
+ ? this.curValObj.name || this.curValObj._name
67
+ : "";
68
+ },
69
+ set (val) {
70
+ if (!val) {
71
+ this.curVal = "";
72
+ }
73
+ }
74
+ },
75
+ showVal () {
76
+ return this.$isEmptyData(this.curVal)
77
+ ? this.emptyShowVal
78
+ : this.valStr;
79
+ },
80
+ // 已选择项的对象列表
81
+ curValObjList () {
82
+ return this.curValList.map(key => this.getItemData(key));
83
+ },
84
+ valListStr () {
85
+ return this.curValObjList.map(item => item.name || item._name).join("、");
86
+ },
87
+ showMulVal () {
88
+ return this.$isEmptyData(this.curValList)
89
+ ? this.emptyShowVal
90
+ : this.valListStr;
91
+ }
92
+ },
93
+ created () {
94
+ this.init();
95
+ },
96
+ methods: {
97
+ init () {
98
+ this.getTipData();
99
+ this.getListData();
100
+ },
101
+
102
+ getItemData (key) {
103
+ const obj = this.listData.find(item => item._key === key) || {
104
+ _key: key,
105
+ name: `温馨提示:选项${key}已找不到`
106
+ };
107
+
108
+ return {
109
+ ...obj,
110
+ style: this.getItemStyle(obj),
111
+ color: undefined
112
+ };
113
+ },
114
+ getItemStyle (item) {
115
+ const color = this.colorMap[item.color] || this.colorMap["color-1"];
116
+ return {
117
+ "background-color": this.useColor ? this.$getColor(color, 0.1) : "#E5E5E5",
118
+ color: this.useColor ? color : "rgba(0, 0, 0, 0.9)",
119
+ display: "inline-block",
120
+ "max-width": "100%",
121
+ padding: "0px 6px",
122
+ "border-radius": "4px"
123
+ };
124
+ },
125
+ // 获取某项的置灰状态
126
+ getItemDisabled (item) {
127
+ return !!(this.selfPropsObj._disabled || item._disabled);
128
+ },
129
+
130
+ // 是否打开tip弹窗
131
+ clickOpenTip (item) {
132
+ if (item.__isTip__) {
133
+ if (this.propsObj._tipKind === "dynamic" && !this.propsObj._tipContent) {
134
+ this.getTipUrl();
135
+ } else {
136
+ this.showTipTpl = true;
137
+ this.showTipModal = true;
138
+ }
139
+ }
140
+ },
141
+ getTipUrl () {
142
+ if (this.propsObj._tipUrl) {
143
+ this.$https({
144
+ url: {
145
+ module: "customPath",
146
+ name: this.propsObj._tipUrl
147
+ },
148
+ params: {
149
+ formData: this.value,
150
+ propsObj: this.propsObj
151
+ },
152
+ callback: res => {
153
+ this.dynamicContent = res;
154
+ this.showTipTpl = true;
155
+ this.showTipModal = true;
156
+ }
157
+ });
158
+ } else {
159
+ this.$Message.warning("请配置接口路径!");
160
+ }
161
+ },
162
+ tipModalRender (h) {
163
+ return this.showTipTpl
164
+ ? h("dsh-modal", {
165
+ props: {
166
+ value: this.showTipModal,
167
+ mode: "custom",
168
+ propsObj: {
169
+ title: "温馨提示",
170
+ maskClosable: true,
171
+ class: "DshSelect-modal"
172
+ }
173
+ },
174
+ on: {
175
+ input: bool => {
176
+ this.showTipModal = bool;
177
+ }
178
+ }
179
+ }, [
180
+ h("div", {
181
+ class: "DshSelect-modal-content",
182
+ domProps: {
183
+ innerHTML: this.modalTipContent
184
+ }
185
+ }),
186
+ h("div", {
187
+ class: "DshSelect-modal-footer"
188
+ }, [
189
+ h("Button", {
190
+ props: {
191
+ type: "primary"
192
+ },
193
+ on: {
194
+ click: () => {
195
+ this.showTipModal = false;
196
+ }
197
+ }
198
+ }, "我知道了")
199
+ ])
200
+ ])
201
+ : undefined;
202
+ },
203
+ getTipData () {
204
+ if (
205
+ (this.propsObj._key !== "_default") &&
206
+ this.finalCanEdit &&
207
+ this.openTip
208
+ ) {
209
+ let tipObj = {
210
+ _key: "openTip",
211
+ _name: this.propsObj._tipName || "其他",
212
+ __isTip__: true,
213
+ _disabled: true,
214
+ color: "#6991cc",
215
+ class: `Dsh${this.propsObj._type}-tip`
216
+ };
217
+ this.initListData.push(tipObj);
218
+ }
219
+ },
220
+ // 接口 -获取自定义的接口数据
221
+ getListData () {
222
+ this.selfPropsObj._customData.forEach(item => {
223
+ this.$https({
224
+ url: item.url,
225
+ params: item.params,
226
+ callback: data => {
227
+ this.initListData = [
228
+ ...this.initListData,
229
+ ...data.list.map(dataItem =>
230
+ ({
231
+ _key: dataItem[item._key || "_key"],
232
+ name: dataItem[item._name || "name"]
233
+ })
234
+ )
235
+ ];
236
+ }
237
+ });
238
+ });
239
+ }
240
+ }
241
+ };
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <!-- 单选模式 编辑 -->
3
+ <div
4
+ v-if="!multipleMode && canEdit"
5
+ class="DshSwitch"
6
+ >
7
+ <i-switch
8
+ v-model="curVal"
9
+ :disabled="selfPropsObj._disabled"
10
+ :loading="selfPropsObj.loading"
11
+ :size="selfPropsObj._size"
12
+ :true-color="selfPropsObj._openColor"
13
+ :false-color="selfPropsObj._closeColor"
14
+ :true-value="selfPropsObj._openValue"
15
+ :false-value="selfPropsObj._closeValue"
16
+ @on-change="change"
17
+ >
18
+ <span slot="open">
19
+ {{ selfPropsObj._openText }}
20
+ </span>
21
+ <span slot="close">
22
+ {{ selfPropsObj._closeText }}
23
+ </span>
24
+ </i-switch>
25
+ </div>
26
+
27
+ <!-- 单选模式 查看 -->
28
+ <span
29
+ v-else-if="!multipleMode && !canEdit"
30
+ :class="{
31
+ ...commonClass
32
+ }"
33
+ :style="showStyle"
34
+ >
35
+ {{ showVal }}
36
+ </span>
37
+
38
+ <!-- 多选模式 -->
39
+ <dsh-checkbox
40
+ v-else
41
+ :canEdit="canEdit"
42
+ :value="value"
43
+ :propsObj="mulPropsObj"
44
+ @change="change"
45
+ ></dsh-checkbox>
46
+ </template>
47
+
48
+ <script>
49
+ import switchMixin from "./switchMixin.js";
50
+
51
+ export default {
52
+ name: "DshSwitch",
53
+ mixins: [
54
+ switchMixin
55
+ ],
56
+ components: {},
57
+ props: {},
58
+ data () {
59
+ return {};
60
+ },
61
+ computed: {
62
+ selfPropsObj () {
63
+ return {
64
+ _size: "default", // "default", "small", "large"
65
+
66
+ ...this.switchPropsObj
67
+ };
68
+ }
69
+ },
70
+ created () {},
71
+ methods: {}
72
+ };
73
+ </script>
74
+
75
+ <style lang="less" scoped>
76
+ .DshSwitch {
77
+
78
+ }
79
+ </style>
80
+ <style lang="less">
81
+ .DshSwitch {
82
+
83
+ }
84
+ </style>