gyyg-components 0.3.19 → 0.3.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gyyg-components",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "private": false,
5
5
  "main": "lib/gyyg-components.umd.js",
6
6
  "scripts": {
@@ -0,0 +1,5 @@
1
+ import MecDrawer from "./MecDrawer.vue";
2
+
3
+ MecDrawer.install = Vue => Vue.component(MecDrawer.name, MecDrawer); //注册组件
4
+
5
+ export default MecDrawer;
@@ -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
  }
@@ -113,6 +113,7 @@ export default {
113
113
  methods: {
114
114
  handleChange(val) {
115
115
  let info = this.option.filter(item => item[this.props.value] === val)
116
+ console.log(info, 'info')
116
117
  let name = this.getNameById(val, this.option)
117
118
  if(name.includes(this.checkText)) {
118
119
  this.inputDisabled = false
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <el-select
3
3
  v-model="selected"
4
- @clear="clear"
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
- handler: function (val) {
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;
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 == 'function') {
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
- deep: true,
97
- immediate: true,
98
- },
94
+ },
95
+ deep: true,
96
+ immediate: true,
97
+ },
99
98
  },
100
99
  methods: {
101
100
  handleChange(val) {
102
101
  this.selected = val;
103
- let info = this.option.filter(item => item[this.props.value] == val)
102
+ let info = this.option.filter((item) => item[this.props.value] == val);
104
103
  this.$emit("input", this.selected);
105
- this.$emit('update:value', val)
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('clear')
111
- }
108
+ this.selected = "";
109
+ this.$emit("clear");
110
+ },
112
111
  },
113
112
  };
114
113
  </script>
@@ -0,0 +1,5 @@
1
+ import MecSelectAndButton from "./MecSelectAndButton.vue";
2
+
3
+ MecSelectAndButton.install = Vue => Vue.component(MecSelectAndButton.name, MecSelectAndButton); //注册组件
4
+
5
+ export default MecSelectAndButton;
@@ -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>