gyyg-components 0.2.7 → 0.2.9
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 +753 -185
- package/lib/gyyg-components.umd.js +753 -185
- package/lib/gyyg-components.umd.min.js +753 -185
- package/package.json +2 -2
- package/src/App.vue +31 -95
- package/src/components/GyygModal/GyygModal.vue +1 -1
- package/src/components/MECDefaultText/MECDefaultText.js +5 -0
- package/src/components/MECDefaultText/MECDefaultText.vue +9 -0
- package/src/components/MecButtonGroup/MecButtonGroup.vue +8 -5
- 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 +225 -0
- package/src/components/MecForm/MecForm.js +5 -0
- package/src/components/MecForm/MecForm.vue +82 -0
- package/src/components/MecInput/MecInput.vue +35 -6
- package/src/components/MecPopoverButton/MecPopoverButton.vue +32 -2
- package/src/components/MecRadio/MecRadio.js +5 -0
- package/src/components/MecRadio/MecRadio.vue +62 -0
- package/src/components/MecSearchForm/MecSearchForm.vue +47 -32
- package/src/components/MecSelect/MecSelect.vue +30 -8
- package/src/components/MecTable/MecTable.vue +16 -3
- package/src/components/MecTabs/MecTabs.js +6 -0
- package/src/components/MecTabs/MecTabs.vue +66 -0
- package/src/directive/hasPermi.js +2 -4
- package/src/otherComponents/iconButton.vue +1 -1
- package/src/otherComponents/styleText.vue +6 -15
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-form
|
|
3
|
+
ref="formData"
|
|
4
|
+
:model="formData"
|
|
5
|
+
:label-width="labelWidth"
|
|
6
|
+
:label-position="labelPosition"
|
|
7
|
+
>
|
|
8
|
+
<template v-for="(item, index) in formData">
|
|
9
|
+
<el-col
|
|
10
|
+
v-if="typeof item.displayWith !== 'function' || item.displayWith(formData, item)"
|
|
11
|
+
:span="item.col"
|
|
12
|
+
:style="item.style"
|
|
13
|
+
:key="index"
|
|
14
|
+
>
|
|
15
|
+
<el-form-item v-bind="item" :prop="getProp(item, index)" :rules="item.rules" :class="item.class">
|
|
16
|
+
<template slot="label">
|
|
17
|
+
<span v-if="item.label">
|
|
18
|
+
{{ item.label }}
|
|
19
|
+
<el-tooltip v-if="item.tooltip" class="item" effect="dark" :content="item.tooltip" placement="top">
|
|
20
|
+
<i class="el-icon-question"></i>
|
|
21
|
+
</el-tooltip>
|
|
22
|
+
</span>
|
|
23
|
+
</template>
|
|
24
|
+
<component
|
|
25
|
+
:is="item['componentName']"
|
|
26
|
+
v-model="item.value"
|
|
27
|
+
v-bind="item"
|
|
28
|
+
v-on="item.componentListeners"
|
|
29
|
+
></component>
|
|
30
|
+
</el-form-item>
|
|
31
|
+
</el-col>
|
|
32
|
+
</template>
|
|
33
|
+
</el-form>
|
|
34
|
+
</template>
|
|
35
|
+
<script>
|
|
36
|
+
export default {
|
|
37
|
+
name: 'mec-form',
|
|
38
|
+
props: {
|
|
39
|
+
formData: {
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
labelWidth: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: '150px',
|
|
45
|
+
},
|
|
46
|
+
labelPosition: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: 'right',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
data() {
|
|
52
|
+
return {
|
|
53
|
+
loading: false,
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
computed: {},
|
|
57
|
+
methods: {
|
|
58
|
+
getProp(item, index) {
|
|
59
|
+
let propName = item.prop ? item.prop : index + ".value";
|
|
60
|
+
return propName;
|
|
61
|
+
},
|
|
62
|
+
validate() {
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
this.$refs.formData.validate(valid => {
|
|
65
|
+
if (valid) {
|
|
66
|
+
resolve(true);
|
|
67
|
+
} else {
|
|
68
|
+
resolve(false);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
</script>
|
|
76
|
+
<style lang="less" scoped>
|
|
77
|
+
::v-deep.el-form::after {
|
|
78
|
+
content: "";
|
|
79
|
+
display: table;
|
|
80
|
+
clear: both;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -15,13 +15,21 @@
|
|
|
15
15
|
:autosize="autosize"
|
|
16
16
|
@input="handleInput"
|
|
17
17
|
@clear="clear"
|
|
18
|
-
|
|
18
|
+
@keyup.enter.native="handleEnter"
|
|
19
|
+
>
|
|
20
|
+
<div slot="prepend" v-if="prependText" @click="btnClick" :style="disabled ? 'cursor: not-allowed' : 'cursor: pointer'">{{ prependText }}</div>
|
|
21
|
+
<div slot="append" v-if="appendText" @click="btnClick" :style="disabled ? 'cursor: not-allowed' : 'cursor: pointer'">{{ appendText }}</div>
|
|
22
|
+
<el-button slot="append" v-if="appendIcon" :icon="appendIcon" @click="btnClick" :style="disabled ? 'cursor: not-allowed' : 'cursor: pointer'"></el-button>
|
|
23
|
+
</el-input>
|
|
19
24
|
</template>
|
|
20
25
|
|
|
21
26
|
<script>
|
|
22
27
|
export default {
|
|
23
|
-
name: '
|
|
28
|
+
name: 'mec-input',
|
|
24
29
|
props: {
|
|
30
|
+
value: {
|
|
31
|
+
default: ''
|
|
32
|
+
},
|
|
25
33
|
// 输入框的占位符
|
|
26
34
|
placeholder: {
|
|
27
35
|
type: String,
|
|
@@ -85,6 +93,18 @@
|
|
|
85
93
|
autosize: {
|
|
86
94
|
default: false
|
|
87
95
|
},
|
|
96
|
+
prependText: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: ''
|
|
99
|
+
},
|
|
100
|
+
appendText: {
|
|
101
|
+
type: String,
|
|
102
|
+
default: ''
|
|
103
|
+
},
|
|
104
|
+
appendIcon: {
|
|
105
|
+
type: String,
|
|
106
|
+
default: ''
|
|
107
|
+
}
|
|
88
108
|
},
|
|
89
109
|
data() {
|
|
90
110
|
return {
|
|
@@ -108,19 +128,28 @@
|
|
|
108
128
|
value = value.replace(/[^\u4e00-\u9fa5]/g, '');
|
|
109
129
|
} else if (this.inputType === 'english') {
|
|
110
130
|
// 只允许输入英文
|
|
111
|
-
value = value.replace(/[^a-zA-Z]/g, '');
|
|
131
|
+
value = value.replace(/[^a-zA-Z\s]/g, '');
|
|
112
132
|
}
|
|
113
133
|
this.inputValue = value
|
|
114
|
-
|
|
115
134
|
this.$emit('input', value);
|
|
116
135
|
},
|
|
117
136
|
clear() {
|
|
118
137
|
this.$emit('clear')
|
|
138
|
+
},
|
|
139
|
+
btnClick() {
|
|
140
|
+
this.$emit('btnClick')
|
|
141
|
+
},
|
|
142
|
+
handleEnter() {
|
|
143
|
+
this.$emit('enter')
|
|
119
144
|
}
|
|
120
145
|
},
|
|
121
146
|
watch: {
|
|
122
|
-
value
|
|
123
|
-
|
|
147
|
+
value: {
|
|
148
|
+
handler(newValue) {
|
|
149
|
+
this.inputValue = newValue;
|
|
150
|
+
},
|
|
151
|
+
immediate: true
|
|
152
|
+
|
|
124
153
|
}
|
|
125
154
|
}
|
|
126
155
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="popover-button" v-has-permi="[btnInfo.hasPermi]">
|
|
2
|
+
<div class="popover-button" v-has-permi="btnInfo.hasPermi ? [btnInfo.hasPermi] : undefined">
|
|
3
3
|
<el-dropdown
|
|
4
|
-
:size="btnInfo.size"
|
|
4
|
+
:size="btnInfo.size || 'small'"
|
|
5
5
|
split-button
|
|
6
6
|
:type="btnInfo.type"
|
|
7
7
|
:disabled="btnInfo.disabled"
|
|
@@ -9,13 +9,16 @@
|
|
|
9
9
|
placement="bottom-end"
|
|
10
10
|
@click="clickEvent"
|
|
11
11
|
@command="changeItem"
|
|
12
|
+
:class="dropdownClass"
|
|
12
13
|
>
|
|
13
14
|
{{ btnInfo.text}}
|
|
14
15
|
<el-dropdown-menu slot="dropdown" class="right-arrow">
|
|
15
16
|
<el-dropdown-item
|
|
16
17
|
v-for="item in btnInfo.options"
|
|
17
18
|
:key="item.id"
|
|
19
|
+
:icon="item.icon || ''"
|
|
18
20
|
:command="item"
|
|
21
|
+
v-has-permi="item.hasPermi ? [item.hasPermi] : undefined"
|
|
19
22
|
>{{ item.label }}</el-dropdown-item>
|
|
20
23
|
</el-dropdown-menu>
|
|
21
24
|
</el-dropdown>
|
|
@@ -25,6 +28,14 @@
|
|
|
25
28
|
export default {
|
|
26
29
|
name: 'MecPopoverButton',
|
|
27
30
|
props: ['btnInfo'],
|
|
31
|
+
computed: {
|
|
32
|
+
dropdownClass() {
|
|
33
|
+
if (this.btnInfo.plain === undefined) {
|
|
34
|
+
return 'is-plain';
|
|
35
|
+
}
|
|
36
|
+
return this.btnInfo.plain ? 'is-plain' : '';
|
|
37
|
+
}
|
|
38
|
+
},
|
|
28
39
|
methods: {
|
|
29
40
|
clickEvent(){
|
|
30
41
|
if(this.btnInfo.trigger) {
|
|
@@ -44,4 +55,23 @@ export default {
|
|
|
44
55
|
left: 65% !important;
|
|
45
56
|
}
|
|
46
57
|
}
|
|
58
|
+
/deep/ .el-dropdown__icon {
|
|
59
|
+
font-size: 11px
|
|
60
|
+
}
|
|
61
|
+
// /deep/ .el-dropdown-menu__item {
|
|
62
|
+
// background-color: #ecf5ff;
|
|
63
|
+
// color: #66b1ff;
|
|
64
|
+
// margin-top: 4px;
|
|
65
|
+
// }
|
|
66
|
+
/deep/ .el-dropdown.is-plain {
|
|
67
|
+
.el-button {
|
|
68
|
+
color: #409EFF;
|
|
69
|
+
background: #ecf5ff;
|
|
70
|
+
border-color: #b3d8ff;
|
|
71
|
+
}
|
|
72
|
+
.el-dropdown__caret-button::before {
|
|
73
|
+
background: #b3d8ff;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
47
77
|
</style>
|
|
@@ -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,23 +1,29 @@
|
|
|
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" size="small" plain @click="search">查询</el-button>
|
|
24
|
+
<el-button type="primary" v-if="isSeniorBtn" size="small" plain @click="seniorSearch">高级搜索</el-button>
|
|
25
|
+
<el-button size="small" plain icon="el-icon-refresh" @click="refresh"></el-button>
|
|
26
|
+
</el-form-item>
|
|
21
27
|
</el-form>
|
|
22
28
|
</div>
|
|
23
29
|
</template>
|
|
@@ -25,31 +31,40 @@
|
|
|
25
31
|
export default {
|
|
26
32
|
name: 'MecSearchForm',
|
|
27
33
|
props: {
|
|
28
|
-
formGroups: {
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
formGroups: {},
|
|
35
|
+
isSeniorBtn: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
31
38
|
}
|
|
32
39
|
},
|
|
33
|
-
data() {
|
|
34
|
-
return {
|
|
35
|
-
formModel: this.createFormModel(this.formGroups)
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
40
|
methods: {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
formGroups.forEach(item => {
|
|
42
|
-
model[item.prop] = item.value;
|
|
43
|
-
});
|
|
44
|
-
return model;
|
|
45
|
-
},
|
|
46
|
-
getProp (item, index) {
|
|
41
|
+
|
|
42
|
+
getProp(item, index) {
|
|
47
43
|
let propName = item.prop ? item.prop : index + ".value";
|
|
48
44
|
return propName;
|
|
49
45
|
},
|
|
50
46
|
search() {
|
|
51
|
-
|
|
47
|
+
const result = {};
|
|
48
|
+
for(let key in this.formGroups) {
|
|
49
|
+
result[key] = this.formGroups[key].value;
|
|
50
|
+
}
|
|
51
|
+
this.$emit('search', result)
|
|
52
|
+
},
|
|
53
|
+
refresh() {
|
|
54
|
+
this.$emit('refresh')
|
|
55
|
+
},
|
|
56
|
+
seniorSearch() {
|
|
57
|
+
this.$emit('seniorSearch')
|
|
52
58
|
}
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
|
-
</script>
|
|
61
|
+
</script>
|
|
62
|
+
<style lang="less" scoped>
|
|
63
|
+
/deep/ .el-form-item__content {
|
|
64
|
+
width: 100%;
|
|
65
|
+
}
|
|
66
|
+
/deep/ .el-form--inline .el-form-item {
|
|
67
|
+
margin-bottom: 10px;
|
|
68
|
+
vertical-align: middle;
|
|
69
|
+
}
|
|
70
|
+
</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,8 @@
|
|
|
18
18
|
:row-style="selectedRowStyle"
|
|
19
19
|
:default-expand-all="defaultExpandAll"
|
|
20
20
|
@row-click="rowClickHandel"
|
|
21
|
+
@row-dblclick="rowDblclickHandel"
|
|
22
|
+
:border="border"
|
|
21
23
|
>
|
|
22
24
|
<!-- 多选框 -->
|
|
23
25
|
<el-table-column
|
|
@@ -149,8 +151,7 @@ export default {
|
|
|
149
151
|
required: false,
|
|
150
152
|
default: () => {
|
|
151
153
|
return {
|
|
152
|
-
backgroundColor: "#
|
|
153
|
-
textAlign: "center",
|
|
154
|
+
backgroundColor: "#EFF3F8",
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
157
|
},
|
|
@@ -183,7 +184,12 @@ export default {
|
|
|
183
184
|
// 是否只选中当前行
|
|
184
185
|
toggleRow: {
|
|
185
186
|
default: false
|
|
187
|
+
},
|
|
188
|
+
border: {
|
|
189
|
+
type: Boolean,
|
|
190
|
+
default: true
|
|
186
191
|
}
|
|
192
|
+
|
|
187
193
|
},
|
|
188
194
|
data() {
|
|
189
195
|
return {
|
|
@@ -231,7 +237,11 @@ export default {
|
|
|
231
237
|
this.$refs.table.toggleRowSelection(column)
|
|
232
238
|
}
|
|
233
239
|
this.$emit('row-click', column)
|
|
234
|
-
}
|
|
240
|
+
},
|
|
241
|
+
// 行双击事件
|
|
242
|
+
rowDblclickHandel(column) {
|
|
243
|
+
this.$emit('row-dblclick', column)
|
|
244
|
+
},
|
|
235
245
|
|
|
236
246
|
},
|
|
237
247
|
watch: {
|
|
@@ -254,4 +264,7 @@ export default {
|
|
|
254
264
|
text-align: right;
|
|
255
265
|
height: 35px;
|
|
256
266
|
}
|
|
267
|
+
/deep/ .el-table td.el-table__cell {
|
|
268
|
+
border-right: none;
|
|
269
|
+
}
|
|
257
270
|
</style>
|
|
@@ -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,20 @@
|
|
|
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
|
|
9
|
+
console.log('value',value)
|
|
10
10
|
const all_permission = "*:*:*";
|
|
11
|
-
|
|
11
|
+
const permissions = localStorage.getItem('authorities').split(',')//用户拥有的权限
|
|
12
12
|
if (value && value instanceof Array && value.length > 0) {
|
|
13
13
|
const permissionFlag = value//
|
|
14
14
|
|
|
15
15
|
const hasPermissions = permissions.some(permission => {
|
|
16
16
|
return all_permission === permission || permissionFlag.includes(permission)
|
|
17
17
|
})
|
|
18
|
-
console.log(hasPermissions,'hasPermissions')
|
|
19
18
|
if (!hasPermissions) {
|
|
20
19
|
console.log(el.parentNode);
|
|
21
|
-
|
|
22
20
|
el.parentNode && el.parentNode.removeChild(el)
|
|
23
21
|
}
|
|
24
22
|
} 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>
|
|
@@ -72,7 +73,6 @@ export default {
|
|
|
72
73
|
align-items: center;
|
|
73
74
|
user-select: none;
|
|
74
75
|
cursor: pointer;
|
|
75
|
-
padding: 5px;
|
|
76
76
|
}
|
|
77
77
|
.view-btn {
|
|
78
78
|
&:hover {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div>
|
|
3
3
|
<span class="default-text" :style="[statusStyle]"
|
|
4
4
|
:class="tableData.getClass ? tableData.getClass(scope.row) : ''">{{ getText(tableData.bind) }}</span>
|
|
5
5
|
</div>
|
|
@@ -27,25 +27,16 @@ export default {
|
|
|
27
27
|
}
|
|
28
28
|
</script>
|
|
29
29
|
<style lang="less" scoped>
|
|
30
|
-
.deathText {
|
|
31
|
-
color: #909399;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.normalText {
|
|
35
|
-
color: #67c23a;
|
|
36
|
-
}
|
|
37
30
|
|
|
38
|
-
.danger {
|
|
39
|
-
color: #f56c6c;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.warning {
|
|
43
|
-
color: #e6a23c;
|
|
44
|
-
}
|
|
45
31
|
|
|
46
32
|
.default-text {
|
|
47
33
|
overflow: hidden;
|
|
48
34
|
text-overflow: ellipsis;
|
|
49
35
|
white-space: nowrap;
|
|
36
|
+
background-color: #409EFF;
|
|
37
|
+
color: #fff;
|
|
38
|
+
padding: 5px 15px;
|
|
39
|
+
border-radius: 20px;
|
|
40
|
+
font-size: 14px;
|
|
50
41
|
}
|
|
51
42
|
</style>
|