gyyg-components 0.2.6 → 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.
Files changed (29) hide show
  1. package/lib/gyyg-components.common.js +955 -171
  2. package/lib/gyyg-components.umd.js +955 -171
  3. package/lib/gyyg-components.umd.min.js +955 -171
  4. package/package.json +2 -2
  5. package/src/App.vue +44 -51
  6. package/src/components/MECDefaultText/MECDefaultText.js +5 -0
  7. package/src/components/MECDefaultText/MECDefaultText.vue +9 -0
  8. package/src/components/MecCheckbox/MecCheckbox.js +5 -0
  9. package/src/components/MecCheckbox/MecCheckbox.vue +86 -0
  10. package/src/components/MecDatePicker/MecDatePicker.js +5 -0
  11. package/src/components/MecDatePicker/MecDatePicker.vue +94 -0
  12. package/src/components/MecDialog/MecDialog.js +5 -0
  13. package/src/components/MecDialog/MecDialog.vue +226 -0
  14. package/src/components/MecForm/MecForm.js +5 -0
  15. package/src/components/MecForm/MecForm.vue +77 -0
  16. package/src/components/MecInput/MecInput.vue +33 -6
  17. package/src/components/MecInputTable/MecInputTable.vue +4 -1
  18. package/src/components/MecPopoverButton/MecPopoverButton.vue +1 -0
  19. package/src/components/MecRadio/MecRadio.js +5 -0
  20. package/src/components/MecRadio/MecRadio.vue +62 -0
  21. package/src/components/MecSearchForm/MecSearchForm.js +5 -0
  22. package/src/components/MecSearchForm/MecSearchForm.vue +56 -0
  23. package/src/components/MecSelect/MecSelect.js +5 -0
  24. package/src/components/MecSelect/MecSelect.vue +114 -0
  25. package/src/components/MecTable/MecTable.vue +6 -2
  26. package/src/components/MecTabs/MecTabs.js +6 -0
  27. package/src/components/MecTabs/MecTabs.vue +66 -0
  28. package/src/directive/hasPermi.js +1 -4
  29. package/src/otherComponents/iconButton.vue +1 -0
@@ -15,13 +15,20 @@
15
15
  :autosize="autosize"
16
16
  @input="handleInput"
17
17
  @clear="clear"
18
- ></el-input>
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: 'MecInput',
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(newValue) {
123
- this.inputValue = newValue;
145
+ value: {
146
+ handler(newValue) {
147
+ this.inputValue = newValue;
148
+ },
149
+ immediate: true
150
+
124
151
  }
125
152
  }
126
153
  };
@@ -76,6 +76,9 @@ export default {
76
76
  toggleRow: {
77
77
  type: Boolean,
78
78
  default: true
79
+ },
80
+ value: {
81
+ default: ''
79
82
  }
80
83
  },
81
84
  data() {
@@ -119,7 +122,7 @@ export default {
119
122
 
120
123
  },
121
124
  watch: {
122
- 'inputInfo.inputValue': {
125
+ value: {
123
126
  handler(val) {
124
127
  this.inputValue = val
125
128
  },
@@ -16,6 +16,7 @@
16
16
  v-for="item in btnInfo.options"
17
17
  :key="item.id"
18
18
  :command="item"
19
+ v-has-permi="[item.hasPermi]"
19
20
  >{{ item.label }}</el-dropdown-item>
20
21
  </el-dropdown-menu>
21
22
  </el-dropdown>
@@ -0,0 +1,5 @@
1
+ import MecRadio from "./MecRadio.vue";
2
+
3
+ MecRadio.install = Vue => Vue.component(MecRadio.name, MecRadio); //注册组件
4
+
5
+ export default MecRadio;
@@ -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>
@@ -0,0 +1,5 @@
1
+ import MecSearchForm from "./MecSearchForm.vue";
2
+
3
+ MecSearchForm.install = Vue => Vue.component(MecSearchForm.name, MecSearchForm); //注册组件
4
+
5
+ export default MecSearchForm;
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <div>
3
+ <el-form ref="form" :model="formGroups" :inline="true">
4
+ <template v-for="(item, index) in formGroups">
5
+ <el-form-item
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>
19
+ </el-form-item>
20
+ </template>
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>
26
+ </el-form>
27
+ </div>
28
+ </template>
29
+ <script>
30
+ export default {
31
+ name: 'MecSearchForm',
32
+ props: ['formGroups'],
33
+ methods: {
34
+
35
+ getProp(item, index) {
36
+ let propName = item.prop ? item.prop : index + ".value";
37
+ return propName;
38
+ },
39
+ search() {
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')
48
+ }
49
+ }
50
+ }
51
+ </script>
52
+ <style lang="less" scoped>
53
+ /deep/ .el-form-item__content {
54
+ width: 100%;
55
+ }
56
+ </style>
@@ -0,0 +1,5 @@
1
+ import MecSelect from "./MecSelect.vue";
2
+
3
+ MecSelect.install = Vue => Vue.component(MecSelect.name, MecSelect); //注册组件
4
+
5
+ export default MecSelect;
@@ -0,0 +1,114 @@
1
+ <template>
2
+ <el-select
3
+ v-model="selected"
4
+ @clear="clear"
5
+ @change="handleChange"
6
+ :placeholder="placeholder"
7
+ :multiple="multiple || false"
8
+ :clearable="clearable"
9
+ :disabled="disabled"
10
+ :size="size"
11
+ v-bind="$attrs"
12
+ :filterable="filterable"
13
+ :value="selected"
14
+ style="width: 100%;"
15
+ >
16
+ <el-option
17
+ v-for="item in option"
18
+ :key="item[props.value]"
19
+ :label="item[props.label]"
20
+ :value="item[props.value]"
21
+ :disabled="item.disabled"
22
+ ></el-option>
23
+ </el-select>
24
+ </template>
25
+
26
+ <script>
27
+ export default {
28
+ name: "MecSelect",
29
+ props: {
30
+ value: {
31
+ default: null,
32
+ required: true,
33
+ },
34
+ options: {
35
+ required: true,
36
+ },
37
+ multiple: {
38
+ default: false,
39
+ },
40
+ props: {
41
+ default() {
42
+ return {
43
+ label: "label",
44
+ value: "value",
45
+ };
46
+ },
47
+ },
48
+ placeholder: {
49
+ type: String,
50
+ default: "请选择",
51
+ },
52
+ clearable: {
53
+ type: Boolean,
54
+ },
55
+ disabled: {
56
+ type: Boolean,
57
+ defalut: false,
58
+ },
59
+ size: String,
60
+ filterable: {
61
+ type: Boolean,
62
+ defalut: false,
63
+ },
64
+ },
65
+ data() {
66
+ return {
67
+ selected: '',
68
+ option:[]
69
+ };
70
+ },
71
+ watch: {
72
+ value: {
73
+ handler(val) {
74
+ this.selected = val;
75
+ },
76
+ immediate: true,
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
+ },
88
+ },
89
+ methods: {
90
+ handleChange(val) {
91
+ this.selected = val;
92
+ this.$emit("input", this.selected);
93
+ this.$emit("change", val);
94
+ },
95
+ clear() {
96
+ this.selected = '';
97
+ this.$emit('clear')
98
+ }
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
+ }
109
+ };
110
+ </script>
111
+
112
+ <style scoped>
113
+ /* 你可以在这里添加自定义样式 */
114
+ </style>
@@ -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,6 @@
1
+
2
+ import MecTabs from "./MecTabs.vue";
3
+
4
+ MecTabs.install = Vue => Vue.component(MecTabs.name, MecTabs); //注册组件
5
+
6
+ export default MecTabs;
@@ -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
- const permissions = authorities.split(',')//用户拥有的权限
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>