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
|
@@ -12,20 +12,21 @@
|
|
|
12
12
|
:key="item[props.value]"
|
|
13
13
|
:value="item[props.value]"
|
|
14
14
|
:border="border"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
>{{ item[props.label] }}
|
|
16
|
+
</el-radio>
|
|
17
|
+
<el-input
|
|
18
18
|
v-if="showOther"
|
|
19
|
-
v-model="inputValue"
|
|
20
|
-
:disabled="inputDisabled"
|
|
21
|
-
placeholder="请输入"
|
|
22
|
-
style="display: inline-block; margin-top: 10px
|
|
23
|
-
|
|
19
|
+
v-model="inputValue"
|
|
20
|
+
:disabled="inputDisabled"
|
|
21
|
+
placeholder="请输入"
|
|
22
|
+
style="display: inline-block; margin-top: 10px"
|
|
23
|
+
/>
|
|
24
|
+
<!-- @input="inputChange" -->
|
|
24
25
|
</el-radio-group>
|
|
25
26
|
</template>
|
|
26
27
|
<script>
|
|
27
28
|
export default {
|
|
28
|
-
name:
|
|
29
|
+
name: "mec-radio",
|
|
29
30
|
props: {
|
|
30
31
|
value: {},
|
|
31
32
|
border: {
|
|
@@ -36,99 +37,112 @@ export default {
|
|
|
36
37
|
props: {
|
|
37
38
|
default() {
|
|
38
39
|
return {
|
|
39
|
-
label:
|
|
40
|
-
value:
|
|
41
|
-
}
|
|
40
|
+
label: "label",
|
|
41
|
+
value: "value",
|
|
42
|
+
};
|
|
42
43
|
},
|
|
43
44
|
},
|
|
44
45
|
showOther: {
|
|
45
46
|
type: Boolean,
|
|
46
|
-
default: false
|
|
47
|
+
default: false,
|
|
47
48
|
},
|
|
48
49
|
checkText: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
default() {
|
|
51
|
+
return "其他";
|
|
52
|
+
},
|
|
52
53
|
},
|
|
53
54
|
otherValue: {
|
|
54
|
-
default: ""
|
|
55
|
-
}
|
|
55
|
+
default: "",
|
|
56
|
+
},
|
|
56
57
|
},
|
|
57
58
|
data() {
|
|
58
59
|
return {
|
|
59
60
|
radio: this.value,
|
|
60
61
|
option: [],
|
|
61
|
-
inputValue:
|
|
62
|
-
inputDisabled: true
|
|
63
|
-
}
|
|
62
|
+
inputValue: "",
|
|
63
|
+
inputDisabled: true,
|
|
64
|
+
};
|
|
64
65
|
},
|
|
65
66
|
watch: {
|
|
66
67
|
value: {
|
|
67
68
|
handler(val) {
|
|
68
|
-
this.radio = val
|
|
69
|
+
this.radio = val;
|
|
69
70
|
},
|
|
70
|
-
immediate: true
|
|
71
|
+
immediate: true,
|
|
71
72
|
},
|
|
72
73
|
radio: {
|
|
73
74
|
handler(val) {
|
|
74
|
-
this.$emit(
|
|
75
|
-
this.$emit(
|
|
75
|
+
this.$emit("input", val);
|
|
76
|
+
this.$emit("update:value", val);
|
|
76
77
|
},
|
|
77
78
|
},
|
|
78
79
|
options: {
|
|
79
80
|
handler: function (val) {
|
|
80
81
|
if (!Array.isArray(this.options) && this.options) {
|
|
81
82
|
if (this.options instanceof Promise) {
|
|
82
|
-
this.options.then(val => {
|
|
83
|
+
this.options.then((val) => {
|
|
83
84
|
this.option = val.data || val;
|
|
85
|
+
let name = this.getNameById(this.value, this.option);
|
|
86
|
+
if (name.includes(this.checkText)) {
|
|
87
|
+
this.inputDisabled = false;
|
|
88
|
+
} else {
|
|
89
|
+
this.inputDisabled = true;
|
|
90
|
+
}
|
|
84
91
|
});
|
|
85
92
|
}
|
|
86
|
-
if (typeof this.options ==
|
|
87
|
-
this.options().then(val => {
|
|
93
|
+
if (typeof this.options == "function") {
|
|
94
|
+
this.options().then((val) => {
|
|
88
95
|
this.option = val.data || val;
|
|
96
|
+
let name = this.getNameById(this.value, this.option);
|
|
97
|
+
if (name.includes(this.checkText)) {
|
|
98
|
+
this.inputDisabled = false;
|
|
99
|
+
} else {
|
|
100
|
+
this.inputDisabled = true;
|
|
101
|
+
}
|
|
89
102
|
});
|
|
90
103
|
}
|
|
91
|
-
|
|
92
104
|
} else {
|
|
93
105
|
this.option = val;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
106
|
+
let name = this.getNameById(this.value, this.option);
|
|
107
|
+
if (name.includes(this.checkText)) {
|
|
108
|
+
this.inputDisabled = false;
|
|
109
|
+
} else {
|
|
110
|
+
this.inputDisabled = true;
|
|
111
|
+
}
|
|
100
112
|
}
|
|
101
113
|
},
|
|
102
114
|
deep: true,
|
|
103
115
|
immediate: true,
|
|
104
116
|
},
|
|
105
117
|
otherValue: {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
118
|
+
handler(val) {
|
|
119
|
+
this.inputValue = val;
|
|
120
|
+
console.log(val, "otherValue");
|
|
121
|
+
},
|
|
122
|
+
immediate: true,
|
|
123
|
+
},
|
|
112
124
|
},
|
|
113
125
|
methods: {
|
|
114
126
|
handleChange(val) {
|
|
115
|
-
let info = this.option.filter(item => item[this.props.value] === val)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
let info = this.option.filter((item) => item[this.props.value] === val);
|
|
128
|
+
console.log(info, "info");
|
|
129
|
+
let name = this.getNameById(val, this.option);
|
|
130
|
+
if (name.includes(this.checkText)) {
|
|
131
|
+
this.inputDisabled = false;
|
|
119
132
|
} else {
|
|
120
|
-
this.inputDisabled = true
|
|
121
|
-
this.inputValue =
|
|
133
|
+
this.inputDisabled = true;
|
|
134
|
+
this.inputValue = "";
|
|
122
135
|
}
|
|
123
|
-
this.$emit(
|
|
136
|
+
this.$emit("change", val, info.length > 0 ? info[0] : {});
|
|
124
137
|
},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
138
|
+
// 根据 id 数组获取对应的 name 列表
|
|
139
|
+
getNameById(id, array) {
|
|
140
|
+
console.log(id, array);
|
|
141
|
+
if (!id) return "";
|
|
142
|
+
return array[array.findIndex((item) => item[this.props.value] === id)][
|
|
143
|
+
this.props.label
|
|
144
|
+
];
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
};
|
|
134
148
|
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-select
|
|
3
3
|
v-model="selected"
|
|
4
|
-
|
|
4
|
+
@clear="clear"
|
|
5
5
|
@change="handleChange"
|
|
6
6
|
:placeholder="placeholder"
|
|
7
7
|
:multiple="multiple || false"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
v-bind="$attrs"
|
|
12
12
|
:filterable="filterable"
|
|
13
13
|
:value="selected"
|
|
14
|
-
style="width: 100
|
|
14
|
+
style="width: 100%"
|
|
15
15
|
>
|
|
16
16
|
<el-option
|
|
17
17
|
v-for="item in option"
|
|
@@ -64,8 +64,8 @@ export default {
|
|
|
64
64
|
},
|
|
65
65
|
data() {
|
|
66
66
|
return {
|
|
67
|
-
selected:
|
|
68
|
-
option:[]
|
|
67
|
+
selected: "",
|
|
68
|
+
option: [],
|
|
69
69
|
};
|
|
70
70
|
},
|
|
71
71
|
watch: {
|
|
@@ -76,39 +76,38 @@ export default {
|
|
|
76
76
|
immediate: true,
|
|
77
77
|
},
|
|
78
78
|
options: {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if(this.options instanceof
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
handler: function () {
|
|
80
|
+
if (!Array.isArray(this.options) && this.options) {
|
|
81
|
+
if (this.options instanceof Promise) {
|
|
82
|
+
this.options.then((val) => {
|
|
83
|
+
this.option = val.data || val;
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
if(typeof this.options ==
|
|
87
|
-
this.options().then(val => {
|
|
86
|
+
if (typeof this.options == "function") {
|
|
87
|
+
this.options().then((val) => {
|
|
88
88
|
this.option = val.data || val;
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
|
|
92
91
|
} else {
|
|
93
92
|
this.option = this.options;
|
|
94
93
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
},
|
|
95
|
+
deep: true,
|
|
96
|
+
immediate: true,
|
|
97
|
+
},
|
|
99
98
|
},
|
|
100
99
|
methods: {
|
|
101
100
|
handleChange(val) {
|
|
102
101
|
this.selected = val;
|
|
103
|
-
|
|
102
|
+
let info = this.option.filter((item) => item[this.props.value] == val);
|
|
104
103
|
this.$emit("input", this.selected);
|
|
105
|
-
this.$emit(
|
|
104
|
+
this.$emit("update:value", val);
|
|
106
105
|
this.$emit("change", val, info.length > 0 ? info[0] : {});
|
|
107
106
|
},
|
|
108
107
|
clear() {
|
|
109
|
-
this.selected =
|
|
110
|
-
this.$emit(
|
|
111
|
-
}
|
|
108
|
+
this.selected = "";
|
|
109
|
+
this.$emit("clear");
|
|
110
|
+
},
|
|
112
111
|
},
|
|
113
112
|
};
|
|
114
113
|
</script>
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="select-button-box">
|
|
3
|
+
<el-select
|
|
4
|
+
v-model="selected"
|
|
5
|
+
@clear="clear"
|
|
6
|
+
@change="handleChange"
|
|
7
|
+
:placeholder="placeholder"
|
|
8
|
+
:multiple="multiple || false"
|
|
9
|
+
:clearable="clearable"
|
|
10
|
+
:disabled="disabled"
|
|
11
|
+
:size="size"
|
|
12
|
+
v-bind="$attrs"
|
|
13
|
+
:filterable="filterable"
|
|
14
|
+
:value="selected"
|
|
15
|
+
style="width: 100%"
|
|
16
|
+
@visible-change="visibleChange"
|
|
17
|
+
>
|
|
18
|
+
<el-option
|
|
19
|
+
v-for="item in option"
|
|
20
|
+
:key="item[props.value]"
|
|
21
|
+
:label="item[props.label]"
|
|
22
|
+
:value="item[props.value]"
|
|
23
|
+
:disabled="item.disabled"
|
|
24
|
+
></el-option>
|
|
25
|
+
</el-select>
|
|
26
|
+
<el-button :icon="buttonIcon" :type="buttonType" @click="btnClick">{{
|
|
27
|
+
buttonText
|
|
28
|
+
}}</el-button>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
export default {
|
|
34
|
+
name: "MecSelectAndButton",
|
|
35
|
+
props: {
|
|
36
|
+
value: {
|
|
37
|
+
default: null,
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
options: {
|
|
41
|
+
required: true,
|
|
42
|
+
},
|
|
43
|
+
multiple: {
|
|
44
|
+
default: false,
|
|
45
|
+
},
|
|
46
|
+
props: {
|
|
47
|
+
default() {
|
|
48
|
+
return {
|
|
49
|
+
label: "name",
|
|
50
|
+
value: "id",
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
placeholder: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: "请选择",
|
|
57
|
+
},
|
|
58
|
+
clearable: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
},
|
|
61
|
+
disabled: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
defalut: false,
|
|
64
|
+
},
|
|
65
|
+
size: String,
|
|
66
|
+
filterable: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
defalut: false,
|
|
69
|
+
},
|
|
70
|
+
buttonIcon: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: "el-icon-plus",
|
|
73
|
+
},
|
|
74
|
+
buttonText: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: "新增",
|
|
77
|
+
},
|
|
78
|
+
buttonType: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: "",
|
|
81
|
+
},
|
|
82
|
+
isVisible: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
data() {
|
|
88
|
+
return {
|
|
89
|
+
selected: "",
|
|
90
|
+
option: [],
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
watch: {
|
|
94
|
+
value: {
|
|
95
|
+
handler(val) {
|
|
96
|
+
this.selected = val;
|
|
97
|
+
},
|
|
98
|
+
immediate: true,
|
|
99
|
+
},
|
|
100
|
+
options: {
|
|
101
|
+
handler: function () {
|
|
102
|
+
if (!Array.isArray(this.options) && this.options) {
|
|
103
|
+
if (this.options instanceof Promise) {
|
|
104
|
+
this.options.then((val) => {
|
|
105
|
+
this.option = val.data || val;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (typeof this.options == "function") {
|
|
109
|
+
this.options().then((val) => {
|
|
110
|
+
this.option = val.data || val;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
this.option = this.options;
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
deep: true,
|
|
118
|
+
immediate: true,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
methods: {
|
|
122
|
+
handleChange(val) {
|
|
123
|
+
this.selected = val;
|
|
124
|
+
let info = this.option.filter((item) => item[this.props.value] == val);
|
|
125
|
+
this.$emit("input", this.selected);
|
|
126
|
+
this.$emit("update:value", val);
|
|
127
|
+
this.$emit("change", val, info.length > 0 ? info[0] : {});
|
|
128
|
+
},
|
|
129
|
+
clear() {
|
|
130
|
+
this.selected = "";
|
|
131
|
+
this.$emit("clear");
|
|
132
|
+
},
|
|
133
|
+
visibleChange(val) {
|
|
134
|
+
if (val && this.isVisible) {
|
|
135
|
+
if (!Array.isArray(this.options) && this.options) {
|
|
136
|
+
if (this.options instanceof Promise) {
|
|
137
|
+
this.options.then((val) => {
|
|
138
|
+
this.option = val.data || val;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (typeof this.options == "function") {
|
|
142
|
+
this.options().then((val) => {
|
|
143
|
+
this.option = val.data || val;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
this.option = this.options;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
btnClick(btn) {
|
|
152
|
+
this.$emit("btnClick", btn);
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
</script>
|
|
157
|
+
|
|
158
|
+
<style lang="less" scoped>
|
|
159
|
+
.select-button-box {
|
|
160
|
+
display: flex;
|
|
161
|
+
align-items: center;
|
|
162
|
+
}
|
|
163
|
+
/deep/ .el-button {
|
|
164
|
+
height: 40px;
|
|
165
|
+
margin-left: 10px;
|
|
166
|
+
}
|
|
167
|
+
</style>
|