gyyg-components 0.3.19 → 0.3.21
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/lib/gyyg-components.common.js +312 -100
- package/lib/gyyg-components.umd.js +312 -100
- package/lib/gyyg-components.umd.min.js +312 -100
- package/package.json +1 -1
- package/src/components/MecButtonGroup/MecButtonGroup.vue +0 -1
- package/src/components/MecCheckbox/MecCheckbox.vue +207 -157
- package/src/components/MecDatePicker/MecDatePicker.vue +4 -1
- package/src/components/MecDrawer/MecDrawer.js +5 -0
- package/src/components/MecDrawer/MecDrawer.vue +94 -0
- package/src/components/MecForm/MecForm.vue +3 -1
- package/src/components/MecPopoverButton/MecPopoverButton.vue +4 -0
- package/src/components/MecRadio/MecRadio.vue +71 -57
- package/src/components/MecSelect/MecSelect.vue +20 -21
- package/src/components/MecSelectAndButton/MecSelectAndButton.js +5 -0
- package/src/components/MecSelectAndButton/MecSelectAndButton.vue +167 -0
- package/src/components/MecTable/MecTable.vue +0 -1
package/package.json
CHANGED
|
@@ -1,175 +1,225 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
2
|
+
<div class="checkbox-group">
|
|
3
|
+
<el-checkbox
|
|
4
|
+
:indeterminate="isIndeterminate"
|
|
5
|
+
v-if="isCheckAll"
|
|
6
|
+
v-model="checkAll"
|
|
7
|
+
@change="handleCheckAllChange"
|
|
8
|
+
>全选</el-checkbox
|
|
9
|
+
>
|
|
10
|
+
<div style="margin: 15px 0" v-if="isCheckAll"></div>
|
|
11
|
+
<el-checkbox-group
|
|
12
|
+
v-model="checkbox"
|
|
13
|
+
@change="handleCheckedCitiesChange"
|
|
14
|
+
:disabled="disabled"
|
|
15
|
+
>
|
|
16
|
+
<div v-if="isHover">
|
|
17
|
+
<el-tooltip
|
|
18
|
+
v-for="(item, index) in option"
|
|
19
|
+
:key="index"
|
|
20
|
+
class="item"
|
|
21
|
+
effect="dark"
|
|
22
|
+
:content="item[contentFileld]"
|
|
23
|
+
placement="top-start"
|
|
24
|
+
>
|
|
25
|
+
<el-checkbox
|
|
26
|
+
:label="item[props.value]"
|
|
27
|
+
:disabled="item.disabled"
|
|
28
|
+
@change="(val) => checkBoxChange(val, item)"
|
|
29
|
+
>{{ item[props.label] }}</el-checkbox
|
|
30
|
+
>
|
|
31
|
+
</el-tooltip>
|
|
32
|
+
</div>
|
|
33
|
+
<div v-else>
|
|
34
|
+
<el-checkbox
|
|
35
|
+
v-for="(item, index) in option"
|
|
36
|
+
:label="item[props.value]"
|
|
37
|
+
:disabled="item.disabled"
|
|
38
|
+
:key="index"
|
|
39
|
+
@change="(val) => checkBoxChange(val, item)"
|
|
40
|
+
>{{ item[props.label] }}</el-checkbox
|
|
41
|
+
>
|
|
42
|
+
</div>
|
|
43
|
+
<el-input
|
|
44
|
+
v-if="showOther"
|
|
45
|
+
v-model="inputValue"
|
|
46
|
+
:disabled="inputDisabled"
|
|
47
|
+
placeholder="请输入其他"
|
|
48
|
+
@input="inputChange"
|
|
49
|
+
style="display: inline-block; margin-left: 10px"
|
|
50
|
+
/>
|
|
51
|
+
</el-checkbox-group>
|
|
52
|
+
</div>
|
|
25
53
|
</template>
|
|
26
54
|
<script>
|
|
27
55
|
export default {
|
|
28
|
-
|
|
56
|
+
name: "mec-checkbox",
|
|
57
|
+
props: {
|
|
58
|
+
value: {},
|
|
59
|
+
options: {},
|
|
29
60
|
props: {
|
|
30
|
-
|
|
31
|
-
options: {},
|
|
32
|
-
props: {
|
|
33
|
-
default() {
|
|
34
|
-
return {
|
|
35
|
-
label: 'name',
|
|
36
|
-
value: 'id'
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
isCheckAll: {
|
|
41
|
-
default() {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
showOther: {
|
|
46
|
-
default() {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
otherValue: {
|
|
51
|
-
default() {
|
|
52
|
-
return '';
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
checkText: {
|
|
56
|
-
default() {
|
|
57
|
-
return '其他'
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
disabled: {
|
|
61
|
-
default() {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
data() {
|
|
61
|
+
default() {
|
|
67
62
|
return {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
isIndeterminate: true,
|
|
71
|
-
option: [],
|
|
72
|
-
inputValue: '',
|
|
73
|
-
inputDisabled: true
|
|
63
|
+
label: "name",
|
|
64
|
+
value: "id",
|
|
74
65
|
};
|
|
66
|
+
},
|
|
75
67
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
immediate: true
|
|
82
|
-
},
|
|
83
|
-
options: {
|
|
84
|
-
handler: function (val) {
|
|
85
|
-
//判断options是否为promise
|
|
86
|
-
if (typeof val !== 'function' && val && !val.then) {
|
|
87
|
-
this.option = this.options;
|
|
88
|
-
let nameList = this.getNameListByIds(this.value, this.option)
|
|
89
|
-
this.inputDisabled = nameList.filter(item => {
|
|
90
|
-
return item.includes(this.checkText)
|
|
91
|
-
}).length == 0
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
deep: true,
|
|
95
|
-
immediate: true,
|
|
96
|
-
},
|
|
97
|
-
otherValue: {
|
|
98
|
-
handler(val) {
|
|
99
|
-
this.inputValue = val;
|
|
100
|
-
console.log(val, 'otherValue')
|
|
101
|
-
},
|
|
102
|
-
immediate: true
|
|
103
|
-
}
|
|
68
|
+
isCheckAll: {
|
|
69
|
+
default() {
|
|
70
|
+
return false;
|
|
71
|
+
},
|
|
104
72
|
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
73
|
+
showOther: {
|
|
74
|
+
default() {
|
|
75
|
+
return false;
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
otherValue: {
|
|
79
|
+
default() {
|
|
80
|
+
return "";
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
checkText: {
|
|
84
|
+
default() {
|
|
85
|
+
return "其他";
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
disabled: {
|
|
89
|
+
default() {
|
|
90
|
+
return false;
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
isHover: {
|
|
94
|
+
default() {
|
|
95
|
+
return false;
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
contentFileld: {
|
|
99
|
+
default() {
|
|
100
|
+
return "content";
|
|
101
|
+
},
|
|
130
102
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
103
|
+
},
|
|
104
|
+
data() {
|
|
105
|
+
return {
|
|
106
|
+
checkAll: false,
|
|
107
|
+
checkbox: [],
|
|
108
|
+
isIndeterminate: true,
|
|
109
|
+
option: [],
|
|
110
|
+
inputValue: "",
|
|
111
|
+
inputDisabled: true,
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
watch: {
|
|
115
|
+
value: {
|
|
116
|
+
handler(val) {
|
|
117
|
+
this.checkbox = [].concat(val);
|
|
118
|
+
},
|
|
119
|
+
immediate: true,
|
|
120
|
+
},
|
|
121
|
+
options: {
|
|
122
|
+
handler: function (val) {
|
|
123
|
+
//判断options是否为promise
|
|
124
|
+
if (typeof val !== "function" && val && !val.then) {
|
|
125
|
+
this.option = this.options;
|
|
126
|
+
let nameList = this.getNameListByIds(this.value, this.option);
|
|
127
|
+
this.inputDisabled =
|
|
128
|
+
nameList.filter((item) => {
|
|
129
|
+
return item.includes(this.checkText);
|
|
130
|
+
}).length == 0;
|
|
136
131
|
}
|
|
132
|
+
},
|
|
133
|
+
deep: true,
|
|
134
|
+
immediate: true,
|
|
135
|
+
},
|
|
136
|
+
otherValue: {
|
|
137
|
+
handler(val) {
|
|
138
|
+
this.inputValue = val;
|
|
139
|
+
console.log(val, "otherValue");
|
|
140
|
+
},
|
|
141
|
+
immediate: true,
|
|
137
142
|
},
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
inputChange(val) {
|
|
164
|
-
this.$emit('update:otherValue', val)
|
|
165
|
-
},
|
|
143
|
+
},
|
|
144
|
+
mounted() {
|
|
145
|
+
if (!Array.isArray(this.options) && this.options) {
|
|
146
|
+
if (this.options instanceof Promise) {
|
|
147
|
+
this.options.then((val) => {
|
|
148
|
+
this.option = val.data || val;
|
|
149
|
+
let nameList = this.getNameListByIds(this.value, this.option);
|
|
150
|
+
this.inputDisabled =
|
|
151
|
+
nameList.filter((item) => {
|
|
152
|
+
return item.includes(this.checkText);
|
|
153
|
+
}).length == 0;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (typeof this.options == "function") {
|
|
157
|
+
this.options().then((val) => {
|
|
158
|
+
this.option = val.data || val;
|
|
159
|
+
let nameList = this.getNameListByIds(this.value, this.option);
|
|
160
|
+
this.inputDisabled =
|
|
161
|
+
nameList.filter((item) => {
|
|
162
|
+
return item.includes(this.checkText);
|
|
163
|
+
}).length == 0;
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
this.option = this.options;
|
|
166
168
|
}
|
|
169
|
+
},
|
|
170
|
+
computed: {
|
|
171
|
+
checkboxAll() {
|
|
172
|
+
return this.option.map((item) => {
|
|
173
|
+
return item[this.props.value];
|
|
174
|
+
});
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
methods: {
|
|
178
|
+
handleCheckAllChange(val) {
|
|
179
|
+
this.checkbox = val ? this.checkboxAll : [];
|
|
180
|
+
this.isIndeterminate = false;
|
|
181
|
+
},
|
|
182
|
+
handleCheckedCitiesChange(value) {
|
|
183
|
+
let checkedCount = value.length;
|
|
184
|
+
this.checkAll = checkedCount === this.checkboxAll.length;
|
|
185
|
+
this.isIndeterminate =
|
|
186
|
+
checkedCount > 0 && checkedCount < this.checkboxAll.length;
|
|
187
|
+
|
|
188
|
+
this.$emit("input", value);
|
|
189
|
+
this.$emit("update:value", value);
|
|
190
|
+
let nameList = this.getNameListByIds(value, this.option);
|
|
191
|
+
this.inputDisabled =
|
|
192
|
+
nameList.filter((item) => {
|
|
193
|
+
return item.includes(this.checkText);
|
|
194
|
+
}).length == 0;
|
|
195
|
+
},
|
|
196
|
+
// 根据 id 数组获取对应的 name 列表
|
|
197
|
+
getNameListByIds(ids, array) {
|
|
198
|
+
return ids
|
|
199
|
+
.map((id) => {
|
|
200
|
+
const reason = array.find((item) => item[this.props.value] === id);
|
|
201
|
+
return reason ? reason[this.props.label] : "";
|
|
202
|
+
})
|
|
203
|
+
.filter((name) => name); // 过滤掉空值
|
|
204
|
+
},
|
|
205
|
+
// 其他输入框输入
|
|
206
|
+
inputChange(val) {
|
|
207
|
+
this.$emit("update:otherValue", val);
|
|
208
|
+
},
|
|
209
|
+
checkBoxChange(val, item) {
|
|
210
|
+
if (val) {
|
|
211
|
+
this.$emit("checkBoxSelect", item);
|
|
212
|
+
} else {
|
|
213
|
+
this.$emit("checkBoxSelect", {});
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
},
|
|
167
217
|
};
|
|
168
218
|
</script>
|
|
169
219
|
<style lang="less" scoped>
|
|
170
220
|
.checkbox-group {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
221
|
+
/deep/ .el-checkbox__label {
|
|
222
|
+
font-weight: normal;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
175
225
|
</style>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-drawer :visible.sync="searchDrawerVisible" direction="rtl" :before-close="handleBeforeClose" :modal="true"
|
|
4
|
+
icon="el-icon-search" :size="width">
|
|
5
|
+
<!-- 标题区域 -->
|
|
6
|
+
<div slot="title" class="drawer-title">
|
|
7
|
+
<i class="el-icon-search" style="margin-right: 8px; color: #409EFF;font-size: 20px;"></i>
|
|
8
|
+
<span>{{title}}</span>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<!-- 内容区域:通过默认插槽自定义内容 -->
|
|
12
|
+
<div class="drawer-content">
|
|
13
|
+
<slot name="body"></slot>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<!-- 底部区域:通过具名插槽自定义内容(固定在底部) -->
|
|
17
|
+
<div class="searchBoxFooter">
|
|
18
|
+
<slot name="footer"></slot>
|
|
19
|
+
</div>
|
|
20
|
+
</el-drawer>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
name: 'SearchDrawer',
|
|
28
|
+
props: {
|
|
29
|
+
width: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: '20%'
|
|
32
|
+
},
|
|
33
|
+
title: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: '筛选'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
data() {
|
|
39
|
+
return {
|
|
40
|
+
searchDrawerVisible: false
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
methods: {
|
|
44
|
+
open() {
|
|
45
|
+
this.searchDrawerVisible = true;
|
|
46
|
+
},
|
|
47
|
+
close() {
|
|
48
|
+
this.searchDrawerVisible = false
|
|
49
|
+
},
|
|
50
|
+
handleBeforeClose(done) {
|
|
51
|
+
this.searchDrawerVisible = false;
|
|
52
|
+
done();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<style scoped>
|
|
59
|
+
::v-deep .el-drawer__header {
|
|
60
|
+
align-items: center;
|
|
61
|
+
color: #72767b;
|
|
62
|
+
display: flex;
|
|
63
|
+
margin-bottom: 32px;
|
|
64
|
+
padding: 10px 20px;
|
|
65
|
+
background-color: #efefef !important;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.drawer-title {
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: baseline;
|
|
71
|
+
font-size: 18px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.drawer-content {
|
|
75
|
+
height: calc(100% - 120px);
|
|
76
|
+
padding: 0 20px;
|
|
77
|
+
overflow-y: auto;
|
|
78
|
+
box-sizing: border-box;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.searchBoxFooter {
|
|
82
|
+
position: absolute;
|
|
83
|
+
bottom: 0;
|
|
84
|
+
right: 0;
|
|
85
|
+
width: 100%;
|
|
86
|
+
padding: 6px 15px;
|
|
87
|
+
background-color: #efefef;
|
|
88
|
+
border-top: 1px solid #e8e8e8;
|
|
89
|
+
display: flex;
|
|
90
|
+
justify-content: flex-end;
|
|
91
|
+
box-sizing: border-box;
|
|
92
|
+
z-index: 10;
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
@@ -40,10 +40,11 @@
|
|
|
40
40
|
:is="item['componentName']"
|
|
41
41
|
v-model="item.value"
|
|
42
42
|
:value.sync="item.value"
|
|
43
|
-
:otherValue.sync="item.otherValue"
|
|
43
|
+
:otherValue.sync="item.otherValue"
|
|
44
44
|
:delIdList.sync="item.delIdList"
|
|
45
45
|
v-bind="item"
|
|
46
46
|
v-on="item.componentListeners"
|
|
47
|
+
:ref="item.componentRef"
|
|
47
48
|
></component>
|
|
48
49
|
</el-form-item>
|
|
49
50
|
</el-col>
|
|
@@ -112,6 +113,7 @@ export default {
|
|
|
112
113
|
};
|
|
113
114
|
</script>
|
|
114
115
|
<style lang="less" scoped>
|
|
116
|
+
|
|
115
117
|
::v-deep.el-form::after {
|
|
116
118
|
content: "";
|
|
117
119
|
display: table;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
placement="bottom-end"
|
|
10
10
|
@click="clickEvent"
|
|
11
11
|
@command="changeItem"
|
|
12
|
+
@visible-change="visibleChange"
|
|
12
13
|
>
|
|
13
14
|
<span v-if="btnInfo.splitButton"><i :class="btnInfo.icon" style="margin-right: 5px;"></i>{{ btnInfo.text}}</span>
|
|
14
15
|
<el-button :type="btnInfo.type" v-else>
|
|
@@ -39,6 +40,9 @@ export default {
|
|
|
39
40
|
},
|
|
40
41
|
changeItem(value) {
|
|
41
42
|
this.btnInfo.callback(value)
|
|
43
|
+
},
|
|
44
|
+
visibleChange(value) {
|
|
45
|
+
this.$emit('visibleChange', value)
|
|
42
46
|
|
|
43
47
|
}
|
|
44
48
|
}
|