gyyg-components 0.2.7 → 0.2.8
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 +671 -65
- package/lib/gyyg-components.umd.js +671 -65
- package/lib/gyyg-components.umd.min.js +671 -65
- package/package.json +2 -2
- package/src/App.vue +20 -94
- package/src/components/MECDefaultText/MECDefaultText.js +5 -0
- package/src/components/MECDefaultText/MECDefaultText.vue +9 -0
- package/src/components/MecCheckbox/MecCheckbox.js +5 -0
- package/src/components/MecCheckbox/MecCheckbox.vue +86 -0
- package/src/components/MecDatePicker/MecDatePicker.js +5 -0
- package/src/components/MecDatePicker/MecDatePicker.vue +94 -0
- package/src/components/MecDialog/MecDialog.js +5 -0
- package/src/components/MecDialog/MecDialog.vue +226 -0
- package/src/components/MecForm/MecForm.js +5 -0
- package/src/components/MecForm/MecForm.vue +77 -0
- package/src/components/MecInput/MecInput.vue +33 -6
- package/src/components/MecPopoverButton/MecPopoverButton.vue +1 -0
- package/src/components/MecRadio/MecRadio.js +5 -0
- package/src/components/MecRadio/MecRadio.vue +62 -0
- package/src/components/MecSearchForm/MecSearchForm.vue +36 -35
- package/src/components/MecSelect/MecSelect.vue +30 -8
- package/src/components/MecTable/MecTable.vue +6 -2
- package/src/components/MecTabs/MecTabs.js +6 -0
- package/src/components/MecTabs/MecTabs.vue +66 -0
- package/src/directive/hasPermi.js +1 -4
- package/src/otherComponents/iconButton.vue +1 -0
|
@@ -15,13 +15,20 @@
|
|
|
15
15
|
:autosize="autosize"
|
|
16
16
|
@input="handleInput"
|
|
17
17
|
@clear="clear"
|
|
18
|
-
|
|
18
|
+
>
|
|
19
|
+
<div slot="prepend" v-if="prependText" @click="btnClick" :style="disabled ? 'cursor: not-allowed' : 'cursor: pointer'">{{ prependText }}</div>
|
|
20
|
+
<div slot="append" v-if="appendText" @click="btnClick" :style="disabled ? 'cursor: not-allowed' : 'cursor: pointer'">{{ appendText }}</div>
|
|
21
|
+
<el-button slot="append" v-if="appendIcon" :icon="appendIcon" @click="btnClick" :style="disabled ? 'cursor: not-allowed' : 'cursor: pointer'"></el-button>
|
|
22
|
+
</el-input>
|
|
19
23
|
</template>
|
|
20
24
|
|
|
21
25
|
<script>
|
|
22
26
|
export default {
|
|
23
|
-
name: '
|
|
27
|
+
name: 'mec-input',
|
|
24
28
|
props: {
|
|
29
|
+
value: {
|
|
30
|
+
default: ''
|
|
31
|
+
},
|
|
25
32
|
// 输入框的占位符
|
|
26
33
|
placeholder: {
|
|
27
34
|
type: String,
|
|
@@ -85,6 +92,18 @@
|
|
|
85
92
|
autosize: {
|
|
86
93
|
default: false
|
|
87
94
|
},
|
|
95
|
+
prependText: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: ''
|
|
98
|
+
},
|
|
99
|
+
appendText: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: ''
|
|
102
|
+
},
|
|
103
|
+
appendIcon: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: ''
|
|
106
|
+
}
|
|
88
107
|
},
|
|
89
108
|
data() {
|
|
90
109
|
return {
|
|
@@ -108,19 +127,27 @@
|
|
|
108
127
|
value = value.replace(/[^\u4e00-\u9fa5]/g, '');
|
|
109
128
|
} else if (this.inputType === 'english') {
|
|
110
129
|
// 只允许输入英文
|
|
111
|
-
value = value.replace(/[^a-zA-Z]/g, '');
|
|
130
|
+
value = value.replace(/[^a-zA-Z\s]/g, '');
|
|
112
131
|
}
|
|
113
132
|
this.inputValue = value
|
|
114
|
-
|
|
133
|
+
console.log(this.inputType);
|
|
115
134
|
this.$emit('input', value);
|
|
116
135
|
},
|
|
117
136
|
clear() {
|
|
118
137
|
this.$emit('clear')
|
|
138
|
+
},
|
|
139
|
+
btnClick() {
|
|
140
|
+
console.log(123)
|
|
141
|
+
this.$emit('btnClick')
|
|
119
142
|
}
|
|
120
143
|
},
|
|
121
144
|
watch: {
|
|
122
|
-
value
|
|
123
|
-
|
|
145
|
+
value: {
|
|
146
|
+
handler(newValue) {
|
|
147
|
+
this.inputValue = newValue;
|
|
148
|
+
},
|
|
149
|
+
immediate: true
|
|
150
|
+
|
|
124
151
|
}
|
|
125
152
|
}
|
|
126
153
|
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-radio-group
|
|
3
|
+
v-model="radio"
|
|
4
|
+
:value="radio"
|
|
5
|
+
@change="handleChange"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
class="radio-group"
|
|
8
|
+
>
|
|
9
|
+
<el-radio
|
|
10
|
+
v-for="item in options"
|
|
11
|
+
:label="item[props.value]"
|
|
12
|
+
:key="item[props.value]"
|
|
13
|
+
:value="item[props.value]"
|
|
14
|
+
:border="border"
|
|
15
|
+
>{{ item[props.label] }}</el-radio>
|
|
16
|
+
</el-radio-group>
|
|
17
|
+
</template>
|
|
18
|
+
<script>
|
|
19
|
+
export default {
|
|
20
|
+
name: 'mec-radio',
|
|
21
|
+
props: {
|
|
22
|
+
value: {},
|
|
23
|
+
border: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false,
|
|
26
|
+
},
|
|
27
|
+
options: {},
|
|
28
|
+
props: {
|
|
29
|
+
default() {
|
|
30
|
+
return {
|
|
31
|
+
label: 'label',
|
|
32
|
+
value: 'value',
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
data() {
|
|
38
|
+
return {
|
|
39
|
+
radio: this.value,
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
watch: {
|
|
43
|
+
value: {
|
|
44
|
+
handler(val) {
|
|
45
|
+
this.radio = val
|
|
46
|
+
},
|
|
47
|
+
immediate: true
|
|
48
|
+
},
|
|
49
|
+
radio: {
|
|
50
|
+
handler(val) {
|
|
51
|
+
this.$emit('input', val)
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
handleChange(e) {
|
|
57
|
+
this.$emit('change', e)
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
@@ -1,55 +1,56 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<el-form ref="form" :model="
|
|
3
|
+
<el-form ref="form" :model="formGroups" :inline="true">
|
|
4
4
|
<template v-for="(item, index) in formGroups">
|
|
5
5
|
<el-form-item
|
|
6
|
-
|
|
7
|
-
:
|
|
8
|
-
:
|
|
9
|
-
:
|
|
10
|
-
:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
v-if="typeof item.displayWith !== 'function' || item.displayWith(formGroups, item)"
|
|
7
|
+
:key="index"
|
|
8
|
+
:rules="item.rules"
|
|
9
|
+
:prop="getProp(item, index)"
|
|
10
|
+
:style="'width:' + item.width + 'px'"
|
|
11
|
+
:label="item.label"
|
|
12
|
+
:class="item.class">
|
|
13
|
+
<component
|
|
14
|
+
:is="item['componentName']"
|
|
15
|
+
:ref="item.ref"
|
|
16
|
+
v-model="item.value"
|
|
17
|
+
v-bind="item"
|
|
18
|
+
v-on="item.componentListeners"></component>
|
|
17
19
|
</el-form-item>
|
|
18
|
-
|
|
19
20
|
</template>
|
|
20
|
-
<
|
|
21
|
+
<slot name="custom" :formGroups="formGroups"></slot>
|
|
22
|
+
<el-form-item>
|
|
23
|
+
<el-button type="primary" @click="search" style="margin-top: 5px">查询</el-button>
|
|
24
|
+
<el-button type="info" icon="el-icon-refresh" @click="refresh" style="margin-top: 5px"></el-button>
|
|
25
|
+
</el-form-item>
|
|
21
26
|
</el-form>
|
|
22
27
|
</div>
|
|
23
28
|
</template>
|
|
24
29
|
<script>
|
|
25
30
|
export default {
|
|
26
31
|
name: 'MecSearchForm',
|
|
27
|
-
props:
|
|
28
|
-
formGroups: {
|
|
29
|
-
type: Array,
|
|
30
|
-
default: () => []
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
data() {
|
|
34
|
-
return {
|
|
35
|
-
formModel: this.createFormModel(this.formGroups)
|
|
36
|
-
};
|
|
37
|
-
},
|
|
32
|
+
props: ['formGroups'],
|
|
38
33
|
methods: {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
formGroups.forEach(item => {
|
|
42
|
-
model[item.prop] = item.value;
|
|
43
|
-
});
|
|
44
|
-
return model;
|
|
45
|
-
},
|
|
46
|
-
getProp (item, index) {
|
|
34
|
+
|
|
35
|
+
getProp(item, index) {
|
|
47
36
|
let propName = item.prop ? item.prop : index + ".value";
|
|
48
37
|
return propName;
|
|
49
38
|
},
|
|
50
39
|
search() {
|
|
51
|
-
|
|
40
|
+
const result = {};
|
|
41
|
+
for(let key in this.formGroups) {
|
|
42
|
+
result[key] = this.formGroups[key].value;
|
|
43
|
+
}
|
|
44
|
+
this.$emit('search', result)
|
|
45
|
+
},
|
|
46
|
+
refresh() {
|
|
47
|
+
this.$emit('refresh')
|
|
52
48
|
}
|
|
53
49
|
}
|
|
54
50
|
}
|
|
55
|
-
</script>
|
|
51
|
+
</script>
|
|
52
|
+
<style lang="less" scoped>
|
|
53
|
+
/deep/ .el-form-item__content {
|
|
54
|
+
width: 100%;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
:size="size"
|
|
11
11
|
v-bind="$attrs"
|
|
12
12
|
:filterable="filterable"
|
|
13
|
+
:value="selected"
|
|
14
|
+
style="width: 100%;"
|
|
13
15
|
>
|
|
14
16
|
<el-option
|
|
15
|
-
v-for="item in
|
|
17
|
+
v-for="item in option"
|
|
16
18
|
:key="item[props.value]"
|
|
17
19
|
:label="item[props.label]"
|
|
18
20
|
:value="item[props.value]"
|
|
@@ -30,9 +32,7 @@ export default {
|
|
|
30
32
|
required: true,
|
|
31
33
|
},
|
|
32
34
|
options: {
|
|
33
|
-
type: Array,
|
|
34
35
|
required: true,
|
|
35
|
-
default: () => [],
|
|
36
36
|
},
|
|
37
37
|
multiple: {
|
|
38
38
|
default: false,
|
|
@@ -64,7 +64,8 @@ export default {
|
|
|
64
64
|
},
|
|
65
65
|
data() {
|
|
66
66
|
return {
|
|
67
|
-
selected:
|
|
67
|
+
selected: '',
|
|
68
|
+
option:[]
|
|
68
69
|
};
|
|
69
70
|
},
|
|
70
71
|
watch: {
|
|
@@ -74,16 +75,37 @@ export default {
|
|
|
74
75
|
},
|
|
75
76
|
immediate: true,
|
|
76
77
|
},
|
|
78
|
+
options: {
|
|
79
|
+
handler: function (val) {
|
|
80
|
+
//判断options是否为promise
|
|
81
|
+
if (typeof val !== 'function' && val && !val.then) {
|
|
82
|
+
this.option = this.options;
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
deep: true,
|
|
86
|
+
immediate: true,
|
|
87
|
+
},
|
|
77
88
|
},
|
|
78
89
|
methods: {
|
|
79
90
|
handleChange(val) {
|
|
91
|
+
this.selected = val;
|
|
92
|
+
this.$emit("input", this.selected);
|
|
80
93
|
this.$emit("change", val);
|
|
81
94
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
95
|
+
clear() {
|
|
96
|
+
this.selected = '';
|
|
97
|
+
this.$emit('clear')
|
|
98
|
+
}
|
|
86
99
|
},
|
|
100
|
+
mounted() {
|
|
101
|
+
if (!Array.isArray(this.options) && this.options) {
|
|
102
|
+
this.options().then(val => {
|
|
103
|
+
this.option = val.data || val;
|
|
104
|
+
});
|
|
105
|
+
} else {
|
|
106
|
+
this.option = this.options;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
87
109
|
};
|
|
88
110
|
</script>
|
|
89
111
|
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
:row-style="selectedRowStyle"
|
|
19
19
|
:default-expand-all="defaultExpandAll"
|
|
20
20
|
@row-click="rowClickHandel"
|
|
21
|
+
@row-dblclick="rowDblclickHandel"
|
|
21
22
|
>
|
|
22
23
|
<!-- 多选框 -->
|
|
23
24
|
<el-table-column
|
|
@@ -150,7 +151,6 @@ export default {
|
|
|
150
151
|
default: () => {
|
|
151
152
|
return {
|
|
152
153
|
backgroundColor: "#fff",
|
|
153
|
-
textAlign: "center",
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
},
|
|
@@ -231,7 +231,11 @@ export default {
|
|
|
231
231
|
this.$refs.table.toggleRowSelection(column)
|
|
232
232
|
}
|
|
233
233
|
this.$emit('row-click', column)
|
|
234
|
-
}
|
|
234
|
+
},
|
|
235
|
+
// 行双击事件
|
|
236
|
+
rowDblclickHandel(column) {
|
|
237
|
+
this.$emit('row-dblclick', column)
|
|
238
|
+
},
|
|
235
239
|
|
|
236
240
|
},
|
|
237
241
|
watch: {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-tabs v-model="activeName" v-bind="$attrs" @tab-click="handleClick">
|
|
4
|
+
<el-tab-pane
|
|
5
|
+
v-for="(item, index) in tabList"
|
|
6
|
+
:key="index+item.label"
|
|
7
|
+
:label="item[props.label]"
|
|
8
|
+
:name="item[props.value]"
|
|
9
|
+
v-bind="item">
|
|
10
|
+
<component
|
|
11
|
+
v-if="activeName == item.name"
|
|
12
|
+
:is="item.componentName"
|
|
13
|
+
v-bind="item"
|
|
14
|
+
v-on="$listeners"></component>
|
|
15
|
+
</el-tab-pane>
|
|
16
|
+
</el-tabs>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
<script>
|
|
20
|
+
export default {
|
|
21
|
+
name: 'mec-tabs',
|
|
22
|
+
props: {
|
|
23
|
+
value: {
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
tabList: {
|
|
27
|
+
type: Array,
|
|
28
|
+
default: () => {
|
|
29
|
+
return []
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
props: {
|
|
33
|
+
default() {
|
|
34
|
+
return {
|
|
35
|
+
label: 'label',
|
|
36
|
+
value: 'name',
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
data() {
|
|
42
|
+
return {
|
|
43
|
+
activeName: ''
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
watch: {
|
|
47
|
+
value: {
|
|
48
|
+
handler(val) {
|
|
49
|
+
this.activeName = val;
|
|
50
|
+
},
|
|
51
|
+
immediate: true,
|
|
52
|
+
},
|
|
53
|
+
activeName:{
|
|
54
|
+
handler(val) {
|
|
55
|
+
this.$emit('input', val);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
methods: {
|
|
60
|
+
handleClick(tab, event) {
|
|
61
|
+
this.$emit('change', tab.name);
|
|
62
|
+
this.$emit('changeTab', tab, event);
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
@@ -3,22 +3,19 @@
|
|
|
3
3
|
* Copyright (c) 2019 chuangshi
|
|
4
4
|
*/
|
|
5
5
|
import Vue from 'vue'
|
|
6
|
-
let authorities = localStorage.getItem('authorities') || 'aaa,bbb,ccc'
|
|
7
6
|
Vue.directive('hasPermi', {
|
|
8
7
|
inserted(el, binding, vnode) {
|
|
9
8
|
const { value } = binding
|
|
10
9
|
const all_permission = "*:*:*";
|
|
11
|
-
|
|
10
|
+
const permissions = localStorage.getItem('authorities').split(',')//用户拥有的权限
|
|
12
11
|
if (value && value instanceof Array && value.length > 0) {
|
|
13
12
|
const permissionFlag = value//
|
|
14
13
|
|
|
15
14
|
const hasPermissions = permissions.some(permission => {
|
|
16
15
|
return all_permission === permission || permissionFlag.includes(permission)
|
|
17
16
|
})
|
|
18
|
-
console.log(hasPermissions,'hasPermissions')
|
|
19
17
|
if (!hasPermissions) {
|
|
20
18
|
console.log(el.parentNode);
|
|
21
|
-
|
|
22
19
|
el.parentNode && el.parentNode.removeChild(el)
|
|
23
20
|
}
|
|
24
21
|
} else {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
@click="item.callback ? item.callback(scope.row) : null"
|
|
8
8
|
class="icon"
|
|
9
9
|
>
|
|
10
|
+
<div>{{ typeof item.showNumber !== 'function' ? item.showNumber : item.showNumber(scope.row) }}</div>
|
|
10
11
|
<el-tooltip class="item" effect="dark" :content="item.tooltipText" placement="top" v-if="item.isTooltip">
|
|
11
12
|
<el-icon :class="item.isHover ? item.class + ' view-btn' : item.class" :style="[item.style ? setStyle(item.style) : {}]"></el-icon>
|
|
12
13
|
</el-tooltip>
|