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
@@ -1,213 +0,0 @@
1
- <template>
2
- <div class="DshCheckbox">
3
- <!-- 编辑 -->
4
- <template v-if="canEdit">
5
- <!-- 平铺方式 -->
6
- <template v-if="showType === 'flat'">
7
- <CheckboxGroup
8
- :class="{
9
- 'DshCheckbox-group': true,
10
- 'DshCheckbox-group-color': useColor,
11
- 'DshCheckbox-group-disabled': !canEdit,
12
- 'DshCheckbox-group-scroll': selfPropsObj._span < 24 && !selfPropsObj._br,
13
- }"
14
- v-model="curValList"
15
- >
16
- <!-- 有选项 -->
17
- <template v-if="listData.length">
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
- </template>
41
-
42
- <!-- 无选项 -->
43
- <div
44
- v-else
45
- class="dsh-subtip"
46
- >-- 无选择项 --</div>
47
- </CheckboxGroup>
48
- </template>
49
-
50
- <!-- 下拉方式 -->
51
- <template v-else>
52
- <Select
53
- v-model="value[controlKey]"
54
- :multiple="true"
55
- :placeholder="selfPropsObj._placeholder"
56
- :disabled="!finalCanEdit"
57
- :filterable="selfPropsObj._filterable"
58
- :transfer="selfPropsObj._transfer"
59
- :transfer-class-name="selfPropsObj._transferClassName"
60
- :max-tag-count="selfPropsObj._maxTagCount"
61
- @on-select="changeSelect"
62
- >
63
- <Option
64
- v-for="(item, index) in listData"
65
- :key="index"
66
- :value="item._key"
67
- :label="item.name || item._name"
68
- :disabled="getItemDisabled(item)"
69
- >
70
- <Checkbox :value="getItemSelectStatus(item)"></Checkbox>
71
-
72
- <slot :item="item"></slot>
73
-
74
- <span>{{ item.name || item._name }}</span>
75
- <span style="float:right; padding-right:20px">
76
- {{ item.rightName }}
77
- </span>
78
- </Option>
79
- </Select>
80
- </template>
81
- </template>
82
-
83
- <!-- 查看 -->
84
- <template v-else>
85
- <bri-tooltip
86
- :content="showMultipleVal"
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(curValObjList)"
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 controlMixin from "../controlMixin.js";
114
- import selectMixin from "./selectMixin.js";
115
- import { resourceData } from "bri-datas";
116
-
117
- // optionKind值 'flat'、'dropdown'
118
- export default {
119
- name: "DshCheckbox",
120
- mixins: [
121
- controlMixin,
122
- selectMixin
123
- ],
124
- props: {},
125
- data () {
126
- return {};
127
- },
128
- computed: {
129
- selfPropsObj () {
130
- return {
131
- _optionKind: "dropdown", // 'flat'、'dropdown'
132
- _useColor: false,
133
- colorMap: resourceData.colorMap,
134
- _filterable: true,
135
- _transfer: true,
136
- _data: [],
137
-
138
- ...this.propsObj,
139
- ...this.commonDealPropsObj
140
- };
141
- },
142
- showType () {
143
- return this.selfPropsObj._optionKind;
144
- },
145
- useColor () {
146
- return this.selfPropsObj._useColor;
147
- },
148
- colorMap () {
149
- return this.selfPropsObj.colorMap;
150
- },
151
-
152
- listData () {
153
- return this.selfPropsObj._data.concat(this.initListData);
154
- },
155
- // 已选择项的对象列表
156
- curValObjList () {
157
- return this.curValList.map(key => {
158
- const obj = this.listData.find(item => item._key === key) || {
159
- _key: key,
160
- name: `温馨提示:选项${key}已找不到`
161
- };
162
- return {
163
- ...obj,
164
- style: this.getItemStyle(obj),
165
- color: undefined
166
- };
167
- });
168
- },
169
- showMultipleVal () {
170
- return this.$isEmptyData(this.curValList)
171
- ? this.emptyShowVal
172
- : this.curValObjList.map(item => item.name || item._name).join("、");
173
- }
174
- },
175
- created () {},
176
- methods: {
177
- // 下拉框的change (下拉方式时用v-model触发change有问题,组件进来如果值不为空的,就会v-model返值一次)
178
- changeSelect (item) {
179
- if (this.curValList.includes(item.value)) {
180
- let itemIndex = this.curValList.findIndex(valItem => valItem === item.value);
181
- this.curValList.splice(itemIndex, 1);
182
- } else {
183
- this.curValList.push(item.value);
184
- }
185
-
186
- this.curValList = [...this.curValList];
187
- },
188
-
189
- getItemColorClass (item) {
190
- return this.colorMap[item.color] ? item.color : "color-1";
191
- },
192
- getItemStyle (item) {
193
- const color = this.colorMap[item.color] || this.colorMap["color-1"];
194
- return {
195
- background: this.useColor ? this.$getColor(color, 0.1) : undefined,
196
- color: this.useColor ? color : undefined
197
- };
198
- },
199
- // 获取某项的置灰状态
200
- getItemDisabled (item) {
201
- return !!(
202
- !this.finalCanEdit ||
203
- item._disabled ||
204
- this.curValList.length >= this.selfPropsObj._max && !this.getItemSelectStatus(item)
205
- );
206
- },
207
- // 获取某项的选中状态
208
- getItemSelectStatus (item) {
209
- return this.curValList.includes(item._key);
210
- }
211
- }
212
- };
213
- </script>
@@ -1,122 +0,0 @@
1
- <template>
2
- <div
3
- v-if="show"
4
- class="DshDate"
5
- >
6
- <!-- 编辑 -->
7
- <template v-if="canEdit">
8
- <!-- 时间子类型 -->
9
- <template v-if="['time'].includes(subType)">
10
- <TimePicker
11
- class="DshDate-edit"
12
- v-model="curValDate"
13
- :type="subType"
14
- :placeholder="selfPropsObj._placeholder"
15
- :disabled="!finalCanEdit"
16
- :clearable="selfPropsObj._clearable"
17
- :transfer="selfPropsObj._transfer"
18
- @on-change="change"
19
- ></TimePicker>
20
- </template>
21
-
22
- <!-- 日期、日期时间、年、月 -->
23
- <template v-else>
24
- <DatePicker
25
- class="DshDate-edit"
26
- v-model="curValDate"
27
- :type="subType"
28
- :placeholder="selfPropsObj._placeholder"
29
- :disabled="!finalCanEdit"
30
- :clearable="selfPropsObj._clearable"
31
- :options="options"
32
- :transfer="selfPropsObj._transfer"
33
- @on-change="change"
34
- ></DatePicker>
35
- </template>
36
- </template>
37
-
38
- <!-- 查看 -->
39
- <template v-else>
40
- <bri-tooltip
41
- :content="showVal"
42
- maxWidth="200"
43
- :transfer="true"
44
- >
45
- <div :class="{
46
- ...commonClass,
47
- 'DshDate-unit': isUnitShow,
48
- 'DshDate-show': !isUnitShow
49
- }">
50
- {{ showVal }}
51
- </div>
52
- </bri-tooltip>
53
- </template>
54
- </div>
55
- </template>
56
-
57
- <script>
58
- import controlMixin from "../controlMixin.js";
59
-
60
- export default {
61
- name: "DshDate",
62
- mixins: [
63
- controlMixin
64
- ],
65
- props: {},
66
- data () {
67
- return {
68
- show: true
69
- };
70
- },
71
- computed: {
72
- selfPropsObj () {
73
- return {
74
- _transfer: true,
75
-
76
- ...this.propsObj,
77
- ...this.commonDealPropsObj
78
- };
79
- },
80
-
81
- curValDate: {
82
- get () {
83
- const val = this.value[this.controlKey];
84
- return this.$transformDateCompatible(val, this.subType);
85
- },
86
- set (val) {
87
- this.value[this.controlKey] = this.$transformDate(val, "-", this.subType);
88
- }
89
- },
90
- subType () {
91
- return this.selfPropsObj._dateType;
92
- },
93
- options () {
94
- return {
95
- shortcuts: [],
96
- disabledDate: (date) => {
97
- const resultObj = this.$validateComparedRule(
98
- [this.selfPropsObj],
99
- {
100
- ...this.value,
101
- [this.controlKey]: this.$transformDate(date, "/", this.subType)
102
- },
103
- this.allFormList
104
- );
105
- return !resultObj.bool;
106
- }
107
- };
108
- }
109
- },
110
- created () {},
111
- methods: {},
112
- watch: {
113
- "propsObj._dateType" () {
114
- this.show = false;
115
- this.$nextTick(() => {
116
- this.value[this.controlKey] = this.selfPropsObj._default;
117
- this.show = true;
118
- });
119
- }
120
- }
121
- };
122
- </script>
@@ -1,242 +0,0 @@
1
- <template>
2
- <div class="DshSelect">
3
- <template v-if="canEdit">
4
- <!-- 平铺 -->
5
- <template v-if="['flat', 'button'].includes(showType)">
6
- <RadioGroup
7
- :class="{
8
- 'DshSelect-radioGroup': true,
9
- 'DshSelect-radioGroup-useColor': selfPropsObj._useColor,
10
- 'DshSelect-radioGroup-scroll': selfPropsObj._span < 24 && !selfPropsObj._br
11
- }"
12
- v-model="value[controlKey]"
13
- :type="radioGroupType"
14
- @on-change="change"
15
- >
16
- <template v-if="listData.length">
17
- <Radio
18
- v-for="(item, index) in listData"
19
- :key="index"
20
- :class="getItemColorClass(item)"
21
- :style="getItemStyle(item)"
22
- :label="item._key"
23
- :disabled="getItemDisabled(item)"
24
- :border="useColor"
25
- @click.native="cancelSelect(item)"
26
- >
27
- <span @click.stop="clickOpenTip(item)">
28
- {{ item.name || item._name }}
29
- </span>
30
- </Radio>
31
- </template>
32
-
33
- <div
34
- v-else
35
- class="dsh-subtip"
36
- >-- 无选择项 --</div>
37
- </RadioGroup>
38
-
39
- <!-- tip项弹框提示 -->
40
- <dsh-render :render="tipModalRender"></dsh-render>
41
- </template>
42
-
43
- <!-- 下拉 -->
44
- <template v-else>
45
- <Select
46
- v-model="curVal"
47
- :placeholder="selfPropsObj._placeholder"
48
- :multiple="selfPropsObj._multiple"
49
- :disabled="!finalCanEdit"
50
- :clearable="selfPropsObj._clearable"
51
- :filterable="selfPropsObj._filterable"
52
- :size="selfPropsObj._size"
53
- :transfer="selfPropsObj._transfer"
54
- :transfer-class-name="selfPropsObj._transferClassName"
55
- @on-change="change"
56
- >
57
- <!-- </Option>必须和输出内容在一行,否则出现空格导致_filterable出bug -->
58
- <Option
59
- v-for="(item, index) in listData"
60
- :key="index"
61
- :value="item._key"
62
- :label="item.name || item._name"
63
- :disabled="getItemDisabled(item)"
64
- >
65
- <Icon
66
- v-if="item.icon || item.customIcon"
67
- :type="item.icon"
68
- :custom="item.customIcon ? `bico-font ${item.customIcon}` : undefined"
69
- :color="item.color"
70
- :size="item.size || 20"
71
- />{{ item.name || item._name }}
72
- </Option>
73
- </Select>
74
- </template>
75
- </template>
76
-
77
- <!-- 查看 -->
78
- <template v-else>
79
- <bri-tooltip
80
- :content="showVal"
81
- maxWidth="200"
82
- placement="top"
83
- :transfer="true"
84
- >
85
- <div :class="{
86
- ...commonClass,
87
- 'DshSelect-show': true
88
- }">
89
- <!-- 有值 -->
90
- <dsh-tags
91
- v-if="!$isEmptyData(curVal)"
92
- class="text"
93
- :list="[curValObj]"
94
- ></dsh-tags>
95
-
96
- <!-- 无值 -->
97
- <template v-else>
98
- {{ emptyShowVal }}
99
- </template>
100
- </div>
101
- </bri-tooltip>
102
- </template>
103
- </div>
104
- </template>
105
-
106
- <script>
107
- import controlMixin from "../controlMixin.js";
108
- import selectMixin from "./selectMixin.js";
109
- import { resourceData } from "bri-datas";
110
-
111
- export default {
112
- name: "DshSelect",
113
- mixins: [
114
- controlMixin,
115
- selectMixin
116
- ],
117
- props: {},
118
- data () {
119
- return {
120
- flag: false
121
- };
122
- },
123
- computed: {
124
- selfPropsObj () {
125
- return {
126
- _optionKind: "dropdown", // 'flat'、'dropdown'
127
- _useColor: false,
128
- colorMap: resourceData.colorMap,
129
- _filterable: true,
130
- _transfer: true,
131
- _data: [],
132
- _customData: [],
133
-
134
- ...this.propsObj,
135
- ...this.commonDealPropsObj
136
- };
137
- },
138
- showType () {
139
- return this.selfPropsObj._optionKind;
140
- },
141
- radioGroupType () {
142
- return this.showType === "button" ? "button" : undefined;
143
- },
144
- useColor () {
145
- return this.selfPropsObj._useColor;
146
- },
147
- colorMap () {
148
- return this.selfPropsObj.colorMap;
149
- },
150
-
151
- listData () {
152
- const listData = this.selfPropsObj._data.concat(this.initListData);
153
-
154
- return this.$dataType(this.selfPropsObj._filterFunc, "function")
155
- ? this.selfPropsObj._filterFunc(listData, this.selfPropsObj, this.value)
156
- : listData;
157
- },
158
- curValObj () {
159
- const obj = this.listData.find(item => item._key === this.curVal) || {
160
- _key: this.curVal,
161
- name: `温馨提示:选项${this.curVal}已找不到`
162
- };
163
-
164
- return this.$isEmptyData(this.curVal)
165
- ? undefined
166
- : {
167
- ...obj,
168
- style: this.getItemStyle(obj),
169
- color: undefined
170
- };
171
- },
172
- showVal () {
173
- return this.$isEmptyData(this.curVal)
174
- ? this.emptyShowVal
175
- : this.curValObj.name || this.curValObj._name;
176
- }
177
- },
178
- created () {
179
- this.init();
180
- },
181
- methods: {
182
- init () {
183
- this.getListData();
184
- },
185
-
186
- // 取消flat模式的选择项
187
- cancelSelect (item) {
188
- if (item._disabled !== true && this.selfPropsObj._clearable !== false) {
189
- if (item._key === this.curVal) {
190
- this.value[this.controlKey] = "";
191
- this.change();
192
- }
193
- }
194
-
195
- this.clickOpenTip(item);
196
- },
197
- change (...params) {
198
- // 修复clear后值为undefined,数据库不更新数据bug
199
- if (this.value[this.controlKey] == undefined) {
200
- this.value[this.controlKey] = "";
201
- }
202
-
203
- this.$emit("change", this.curVal);
204
- },
205
-
206
- getItemColorClass (item) {
207
- return this.colorMap[item.color] ? item.color : "color-1";
208
- },
209
- getItemStyle (item) {
210
- const color = this.colorMap[item.color] || this.colorMap["color-1"];
211
- return {
212
- background: this.useColor ? this.$getColor(color, 0.1) : undefined,
213
- color: this.useColor ? color : undefined
214
- };
215
- },
216
- // 获取某项的置灰状态
217
- getItemDisabled (item) {
218
- return !!(!this.finalCanEdit || item._disabled);
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
- };
242
- </script>
@@ -1,70 +0,0 @@
1
- <template>
2
- <!-- 该组件无clearable -->
3
- <div class="DshSwitch">
4
- <!-- 编辑 -->
5
- <template v-if="canEdit">
6
- <i-switch
7
- v-model="curVal"
8
- :disabled="!finalCanEdit"
9
- :size="propsObj._size"
10
- false-color="#CCCCCC"
11
- @on-change="change"
12
- >
13
- <span slot="open">
14
- {{ propsObj._openText }}
15
- </span>
16
- <span slot="close">
17
- {{ propsObj._closeText }}
18
- </span>
19
- </i-switch>
20
- </template>
21
-
22
- <!-- 查看 -->
23
- <span
24
- v-else
25
- :class="{
26
- ...commonClass,
27
- 'DshSwitch-show': true
28
- }"
29
- :style="{
30
- background: curVal ? '#d3f3dcff' : '#FDEDED',
31
- color: curVal ? '#37C45E' : '#E83636'
32
- }"
33
- >
34
- {{ showVal }}
35
- </span>
36
- </div>
37
- </template>
38
-
39
- <script>
40
- import controlMixin from "../controlMixin.js";
41
-
42
- export default {
43
- name: "DshSwitch",
44
- mixins: [
45
- controlMixin
46
- ],
47
- data () {
48
- return {};
49
- },
50
- computed: {
51
- showVal () {
52
- return this.value[this.controlKey]
53
- ? this.propsObj._openText
54
- : this.propsObj._closeText;
55
- }
56
- },
57
- created () {},
58
- methods: {}
59
- };
60
- </script>
61
-
62
- <style lang="less" scoped>
63
- .DshSwitch {
64
- width: 100%;
65
-
66
- &-show {
67
- .bri-unit-show();
68
- }
69
- }
70
- </style>