bri-components 1.2.58 → 1.2.60
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.
- package/package.json +1 -1
- package/src/components/controls/base/BriUpload/BriUpload.vue +1 -1
- package/src/components/controls/base/DshCascader/DshCascader.vue +20 -28
- package/src/components/controls/base/DshSelect/DshCheckbox.vue +97 -233
- package/src/components/controls/base/DshSelect/DshSelect.vue +99 -207
- package/src/components/controls/control.less +194 -0
- package/src/components/controls/mixins/controlMixin.js +30 -4
- package/src/components/controls/mixins/selectMixin.js +85 -127
- package/src/components/small/BriTooltip.vue +0 -1
- package/src/components/unit/DshFormUnit.vue +5 -5
- package/src/styles/components/small/BriTooltip.less +0 -0
|
@@ -9,14 +9,11 @@ export default {
|
|
|
9
9
|
props: {},
|
|
10
10
|
data () {
|
|
11
11
|
return {
|
|
12
|
-
initListData: []
|
|
13
|
-
showTipTpl: false,
|
|
14
|
-
showTipModal: false,
|
|
15
|
-
dynamicContent: ""
|
|
12
|
+
initListData: []
|
|
16
13
|
};
|
|
17
14
|
},
|
|
18
15
|
computed: {
|
|
19
|
-
|
|
16
|
+
basePropsObj () {
|
|
20
17
|
return {
|
|
21
18
|
colorMap: resourceData.colorMap,
|
|
22
19
|
_optionKind: "dropdown", // "flat"、"dropdown"
|
|
@@ -46,17 +43,8 @@ export default {
|
|
|
46
43
|
: listData;
|
|
47
44
|
},
|
|
48
45
|
|
|
49
|
-
openTip () {
|
|
50
|
-
return this.isOnSearch ? false : this.propsObj._openTip;
|
|
51
|
-
},
|
|
52
|
-
modalTipContent () {
|
|
53
|
-
return this.propsObj._tipContent || this.dynamicContent || "暂无信息";
|
|
54
|
-
},
|
|
55
|
-
|
|
56
46
|
curValObj () {
|
|
57
|
-
return this
|
|
58
|
-
? undefined
|
|
59
|
-
: this.getItemData(this.curVal);
|
|
47
|
+
return this.getItemObj(this.curVal);
|
|
60
48
|
},
|
|
61
49
|
valStr: {
|
|
62
50
|
get () {
|
|
@@ -77,7 +65,7 @@ export default {
|
|
|
77
65
|
},
|
|
78
66
|
// 已选择项的对象列表
|
|
79
67
|
curValObjList () {
|
|
80
|
-
return this.curValList.map(key => this.
|
|
68
|
+
return this.curValList.map(key => this.getItemObj(key));
|
|
81
69
|
},
|
|
82
70
|
valListStr () {
|
|
83
71
|
return this.curValObjList.map(item => item.name || item._name).join("、");
|
|
@@ -93,129 +81,99 @@ export default {
|
|
|
93
81
|
},
|
|
94
82
|
methods: {
|
|
95
83
|
init () {
|
|
96
|
-
this.getTipData();
|
|
97
84
|
this.getListData();
|
|
98
85
|
},
|
|
99
86
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
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
|
+
cancelRadioItemSelect (item, index) {
|
|
101
|
+
if (this.curVal === item._key) {
|
|
102
|
+
this.clickRadioItem(item, index);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
// 多选模式 点击选项
|
|
106
|
+
clickCheckItem (item, index) {
|
|
107
|
+
if (!this.getCheckItemDisabled(item)) {
|
|
108
|
+
if (this.curValList.includes(item._key)) {
|
|
109
|
+
this.curValList = this.curValList.filter(key => key !== item._key);
|
|
110
|
+
} else {
|
|
111
|
+
this.curValList = [...this.curValList, item._key];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
111
114
|
},
|
|
112
|
-
|
|
115
|
+
|
|
116
|
+
/* ------- 方法 ------- */
|
|
117
|
+
// 每项的class集合 --flat方式在用
|
|
118
|
+
getItemClass (item) {
|
|
119
|
+
return [
|
|
120
|
+
this.useColor
|
|
121
|
+
? this.colorMap[item.color] ? item.color : "color-1"
|
|
122
|
+
: undefined,
|
|
123
|
+
item.class
|
|
124
|
+
];
|
|
125
|
+
},
|
|
126
|
+
// 每项的颜色相关style --flat方式在用
|
|
127
|
+
getItemColorStyle (item) {
|
|
113
128
|
const color = this.colorMap[item.color] || this.colorMap["color-1"];
|
|
129
|
+
return this.useColor
|
|
130
|
+
? {
|
|
131
|
+
backgroundColor: this.$getColor(color, 0.1),
|
|
132
|
+
color: color
|
|
133
|
+
}
|
|
134
|
+
: {};
|
|
135
|
+
},
|
|
136
|
+
// 每项的具体样式 -查看状态时用
|
|
137
|
+
getItemShowStyle (item) {
|
|
114
138
|
return {
|
|
115
|
-
|
|
116
|
-
color: this.useColor ? color : "rgba(0, 0, 0, 0.9)",
|
|
139
|
+
...this.getItemColorStyle(item),
|
|
117
140
|
display: "inline-block",
|
|
118
141
|
"max-width": "100%",
|
|
119
142
|
padding: "0px 6px",
|
|
120
143
|
"border-radius": "4px"
|
|
121
144
|
};
|
|
122
145
|
},
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
return !!(
|
|
126
|
-
|
|
146
|
+
// 获取单选项的置灰状态
|
|
147
|
+
getRadioItemDisabled (item) {
|
|
148
|
+
return !!(
|
|
149
|
+
this.selfPropsObj._disabled ||
|
|
150
|
+
item._disabled
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
// 获取多选项的置灰状态
|
|
154
|
+
getCheckItemDisabled (item) {
|
|
155
|
+
return !!(
|
|
156
|
+
this.selfPropsObj._disabled ||
|
|
157
|
+
item._disabled ||
|
|
158
|
+
(this.curValList.length >= this.selfPropsObj._max && !this.curValList.includes(item._key))
|
|
159
|
+
);
|
|
160
|
+
},
|
|
161
|
+
getItemObj (key) {
|
|
162
|
+
const obj = this.listData.find(item => item._key === key) || {
|
|
163
|
+
_key: key,
|
|
164
|
+
name: `温馨提示:选项${key}已找不到`
|
|
165
|
+
};
|
|
127
166
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
this.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.showTipModal = true;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
getTipUrl () {
|
|
140
|
-
if (this.propsObj._tipUrl) {
|
|
141
|
-
this.$https({
|
|
142
|
-
url: {
|
|
143
|
-
module: "customPath",
|
|
144
|
-
name: this.propsObj._tipUrl
|
|
145
|
-
},
|
|
146
|
-
params: {
|
|
147
|
-
formData: this.value,
|
|
148
|
-
propsObj: this.propsObj
|
|
149
|
-
},
|
|
150
|
-
callback: res => {
|
|
151
|
-
this.dynamicContent = res;
|
|
152
|
-
this.showTipTpl = true;
|
|
153
|
-
this.showTipModal = true;
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
} else {
|
|
157
|
-
this.$Message.warning("请配置接口路径!");
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
tipModalRender (h) {
|
|
161
|
-
return this.showTipTpl
|
|
162
|
-
? h("dsh-modal", {
|
|
163
|
-
props: {
|
|
164
|
-
value: this.showTipModal,
|
|
165
|
-
mode: "custom",
|
|
166
|
-
propsObj: {
|
|
167
|
-
title: "温馨提示",
|
|
168
|
-
maskClosable: true,
|
|
169
|
-
class: "DshSelect-modal"
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
on: {
|
|
173
|
-
input: bool => {
|
|
174
|
-
this.showTipModal = bool;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}, [
|
|
178
|
-
h("div", {
|
|
179
|
-
class: "DshSelect-modal-content",
|
|
180
|
-
domProps: {
|
|
181
|
-
innerHTML: this.modalTipContent
|
|
182
|
-
}
|
|
183
|
-
}),
|
|
184
|
-
h("div", {
|
|
185
|
-
class: "DshSelect-modal-footer"
|
|
186
|
-
}, [
|
|
187
|
-
h("Button", {
|
|
188
|
-
props: {
|
|
189
|
-
type: "primary"
|
|
190
|
-
},
|
|
191
|
-
on: {
|
|
192
|
-
click: () => {
|
|
193
|
-
this.showTipModal = false;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}, "我知道了")
|
|
197
|
-
])
|
|
198
|
-
])
|
|
199
|
-
: undefined;
|
|
200
|
-
},
|
|
201
|
-
getTipData () {
|
|
202
|
-
if (
|
|
203
|
-
(this.propsObj._key !== "_default") &&
|
|
204
|
-
this.finalCanEdit &&
|
|
205
|
-
this.openTip
|
|
206
|
-
) {
|
|
207
|
-
let tipObj = {
|
|
208
|
-
_key: "openTip",
|
|
209
|
-
_name: this.propsObj._tipName || "其他",
|
|
210
|
-
__isTip__: true,
|
|
211
|
-
_disabled: true,
|
|
212
|
-
color: "#6991cc",
|
|
213
|
-
class: `Dsh${this.propsObj._type}-tip`
|
|
214
|
-
};
|
|
215
|
-
this.initListData.push(tipObj);
|
|
216
|
-
}
|
|
167
|
+
return this.$isEmptyData(key)
|
|
168
|
+
? undefined
|
|
169
|
+
: {
|
|
170
|
+
...obj,
|
|
171
|
+
style: this.getItemShowStyle(obj),
|
|
172
|
+
color: undefined
|
|
173
|
+
};
|
|
217
174
|
},
|
|
218
|
-
|
|
175
|
+
|
|
176
|
+
// TODO:待删除 接口 -获取自定义的接口数据
|
|
219
177
|
getListData () {
|
|
220
178
|
this.selfPropsObj._customData.forEach(item => {
|
|
221
179
|
this.$https({
|
|
@@ -226,8 +184,8 @@ export default {
|
|
|
226
184
|
...this.initListData,
|
|
227
185
|
...data.list.map(dataItem =>
|
|
228
186
|
({
|
|
229
|
-
_key: dataItem
|
|
230
|
-
name: dataItem
|
|
187
|
+
_key: dataItem._key,
|
|
188
|
+
name: dataItem.name
|
|
231
189
|
})
|
|
232
190
|
)
|
|
233
191
|
];
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
'DshFormUnit-line': formItem._line
|
|
8
8
|
},
|
|
9
9
|
formControlClass,
|
|
10
|
-
formItem.formControlClass
|
|
11
10
|
]"
|
|
12
11
|
:style="{
|
|
13
12
|
width: `calc(${(formItem._br ? (formItem._span || 24)/24 : 1) * 100}% - 12px)`,
|
|
@@ -46,7 +45,7 @@
|
|
|
46
45
|
<!-- label后可自定义内容 -->
|
|
47
46
|
<dsh-render
|
|
48
47
|
v-if="formItem._tipsRender"
|
|
49
|
-
:render="tipsRender(formItem,formData)"
|
|
48
|
+
:render="tipsRender(formItem, formData)"
|
|
50
49
|
></dsh-render>
|
|
51
50
|
</span>
|
|
52
51
|
</bri-tooltip>
|
|
@@ -211,6 +210,7 @@
|
|
|
211
210
|
|
|
212
211
|
&-control {
|
|
213
212
|
min-height: 32px;
|
|
213
|
+
overflow: hidden;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
&-line {
|
|
@@ -227,13 +227,13 @@
|
|
|
227
227
|
|
|
228
228
|
&-left {
|
|
229
229
|
flex: 1;
|
|
230
|
-
min-width:
|
|
230
|
+
min-width: 0px;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
&-right {
|
|
234
|
-
|
|
234
|
+
flex: none;
|
|
235
|
+
max-width: 80px;
|
|
235
236
|
min-width: 0px;
|
|
236
|
-
text-align: right;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
|
|
File without changes
|