gyyg-components 0.1.6

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 ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "gyyg-components",
3
+ "version": "0.1.6",
4
+ "private": false,
5
+ "main": "lib/gyyg-components.umd.js",
6
+ "scripts": {
7
+ "serve": "vue-cli-service serve",
8
+ "start": "vue-cli-service build --target lib --name gyyg-components --dest lib src/index.js --watch",
9
+ "build": "vue-cli-service build --target lib --name gyyg-components --dest lib src/index.js",
10
+ "lint": "vue-cli-service lint"
11
+ },
12
+ "dependencies": {
13
+ "babel-plugin-component": "^1.1.1",
14
+ "core-js": "^3.6.5",
15
+ "element-resize-detector": "^1.2.4",
16
+ "element-ui": "2.15.6",
17
+ "vue": "^2.6.11"
18
+ },
19
+ "devDependencies": {
20
+ "@vue/cli-plugin-babel": "~4.5.15",
21
+ "@vue/cli-plugin-eslint": "~4.5.15",
22
+ "@vue/cli-service": "~4.5.15",
23
+ "babel-eslint": "^10.1.0",
24
+ "eslint": "^6.7.2",
25
+ "eslint-plugin-vue": "^6.2.2",
26
+ "less": "^4.2.1",
27
+ "less-loader": "^7.3.0",
28
+ "svg-sprite-loader": "^4.1.3",
29
+ "vue-template-compiler": "^2.6.11"
30
+ },
31
+ "eslintConfig": {
32
+ "root": true,
33
+ "env": {
34
+ "node": true
35
+ },
36
+ "extends": [
37
+ "plugin:vue/essential",
38
+ "eslint:recommended"
39
+ ],
40
+ "parserOptions": {
41
+ "parser": "babel-eslint"
42
+ },
43
+ "rules": {}
44
+ },
45
+ "browserslist": [
46
+ "> 1%",
47
+ "last 2 versions",
48
+ "not dead"
49
+ ]
50
+ }
Binary file
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html lang="">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
+ <link rel="icon" href="<%= BASE_URL %>favicon.ico">
8
+ <title><%= htmlWebpackPlugin.options.title %></title>
9
+ </head>
10
+ <body>
11
+ <noscript>
12
+ <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13
+ </noscript>
14
+ <div id="app"></div>
15
+ <!-- built files will be auto injected -->
16
+ </body>
17
+ </html>
package/src/App.vue ADDED
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div id="app">
3
+ <!-- <gyyg-layout :showMoreBtns='true'></gyyg-layout>
4
+ <el-input v-number-input v-model='text'></el-input>
5
+ <svg-icon icon-class='up'></svg-icon> -->
6
+ <svg-icon icon-class='up'></svg-icon>
7
+ </div>
8
+ </template>
9
+
10
+ <script>
11
+ export default {
12
+ name: 'App',
13
+ data(){
14
+ return{
15
+ text:''
16
+ }
17
+ }
18
+ }
19
+ </script>
20
+
21
+ <style>
22
+ #app {
23
+ font-family: Avenir, Helvetica, Arial, sans-serif;
24
+ -webkit-font-smoothing: antialiased;
25
+ -moz-osx-font-smoothing: grayscale;
26
+ text-align: center;
27
+ color: #2c3e50;
28
+ margin-top: 60px;
29
+ }
30
+ </style>
Binary file
@@ -0,0 +1,5 @@
1
+ import GyygLayout from "./GyygLayout.vue";
2
+
3
+ GyygLayout.install = Vue => Vue.component(GyygLayout.name, GyygLayout); //注册组件
4
+
5
+ export default GyygLayout;
@@ -0,0 +1,396 @@
1
+ /** * 搜索框+Table+分页 组件 * @author lijiahao **
2
+ @searchTable 点击查询按钮,调用父组件查询方法 * @resetTable
3
+ 点击重置按钮,调用父组件重置方法 */
4
+ <template>
5
+ <div class="search-table" :class="[inDialog ? 'inDialog' : 'outDialog',noTitle ? 'no-title' : '']">
6
+ <div class="search-contain" v-if="showSearch">
7
+ <div class='btn-contains'>
8
+ <span style='display:inline-block;margin-bottom:15px'>
9
+ <slot name="search-btns" />
10
+ </span>
11
+ <span v-show='showMore' style='margin-bottom:15px' class='moreBtnView'>
12
+ <slot name='more-btns' />
13
+ </span>
14
+ <div style='display:inline-block;margin-bottom:15px;'>
15
+ <el-button class="search-btn" :disabled="disabled" type="primary" @click="searchTable">
16
+ 查询
17
+ </el-button>
18
+ <el-button
19
+ type="info"
20
+ icon="el-icon-refresh"
21
+ @click="resetTable"
22
+ style='border-color:#E4E4E4;background:#E4E4E4;color:#000;margin-left:5px;'
23
+ ></el-button>
24
+ <span v-if='showMoreBtns' @click='showMoreMethods' style='font-size:14px;margin-left:20px;color:#409EFF;cursor:pointer'>
25
+ <span v-if='!showMore'>
26
+ <svg-icon icon-class="down" /> 更多查询条件
27
+ </span>
28
+ <span v-else>
29
+ <svg-icon icon-class="up" /> 收起查询条件
30
+ </span>
31
+ </span>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ <div class="container">
36
+ <div class="table-contain">
37
+ <div class="operate-contain">
38
+ <slot name="operate-btn" />
39
+ </div>
40
+ <slot name="table" />
41
+ <div v-if="showPage" class="page-item">
42
+ <el-pagination
43
+ style='float:right'
44
+ :current-page="pageInfo.pageNumber"
45
+ :page-size="pageInfo.pageSize"
46
+ layout="total, sizes, prev, pager, next, jumper"
47
+ :total="pageInfo.total"
48
+ :page-sizes="pageSizes"
49
+ @size-change="handleSizeChange"
50
+ @current-change="handleCurrentChange"
51
+ />
52
+ <div v-if='multipleSelection' style='display:inline-block;font-size:14px;color:#ee0a24;float:right;margin-right:10px;height:32px;line-height:32px;'>
53
+ 当前选中<span style='font-size:15px;font-weight:bold;'> {{multipleSelection.length}} </span>条记录,支持跨页选择
54
+ </div>
55
+ </div>
56
+ </div>
57
+ <div class="shrink-view" v-if="showShrink">
58
+ <div class="pull-div" @mousedown="pullDown">
59
+ <img src="@/assets/images/down.png" alt="" class="pull-icon" />
60
+ </div>
61
+ <div class="bottom-contain">
62
+ <slot name="bottom" />
63
+ </div>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </template>
68
+
69
+ <script>
70
+ import { isEmpty } from "@/utils/common.js";
71
+ let elementResizeDetectorMaker = require("element-resize-detector")
72
+ export default {
73
+ name: "GyygLayout",
74
+ props: {
75
+ //列表主要参数:pageNumber/pageSize/total等
76
+ pageInfo: {
77
+ type: Object,
78
+ default() {
79
+ return {};
80
+ },
81
+ },
82
+ disabled: {
83
+ //搜索按钮是否禁用
84
+ type: Boolean,
85
+ default: false
86
+ },
87
+ showSearch: {
88
+ //显示搜索部分
89
+ type: Boolean,
90
+ default: true,
91
+ },
92
+ showShrink: {
93
+ //显示上下结构
94
+ type: Boolean,
95
+ default: false,
96
+ },
97
+ inDialog: {
98
+ //是否在弹框内
99
+ type: Boolean,
100
+ default: false,
101
+ },
102
+ noTitle:{
103
+ //是否具有面包屑高度,以调整组件高度
104
+ type: Boolean,
105
+ default: false,
106
+ },
107
+ showMoreBtns:{
108
+ //显示更多按钮
109
+ type: Boolean,
110
+ default: false,
111
+ },
112
+ pageSizes:{
113
+ //分页大小
114
+ type: Array,
115
+ default:()=>{
116
+ return [10, 20, 30, 40, 50, 100, 500]
117
+ },
118
+ },
119
+ multipleSelection:{
120
+ //列表勾选项
121
+ type: Array,
122
+ default:()=>{
123
+ []
124
+ },
125
+ },
126
+ layOutHeight:{
127
+ //高度
128
+ type: String,
129
+ default: 'calc(100vh - 155px)',
130
+ },
131
+ },
132
+ data() {
133
+ return {
134
+ showPage: false,
135
+ isMouseDown: false,
136
+ isMouseMove: false,
137
+ clientY: 0,
138
+ oldHeight: 0,
139
+ count: 0,
140
+ showMore:false,
141
+ orginHeight:0
142
+ };
143
+ },
144
+ watch: {
145
+ pageInfo: {
146
+ handler() {
147
+ this.showPage = !isEmpty(this.pageInfo);
148
+ },
149
+ immediate: true,
150
+ },
151
+ },
152
+ mounted() {
153
+ if(!this.inDialog){
154
+ document.getElementsByClassName('search-table')[0].style.height=this.layOutHeight
155
+ }
156
+ let erd=elementResizeDetectorMaker()
157
+ erd.listenTo(document.getElementsByClassName('btn-contains')[0], function(element) {
158
+ document.getElementsByClassName('search-contain')[0].style.height=element.scrollHeight+15+'px'
159
+ });
160
+ if (this.showShrink) {
161
+ window.addEventListener("mousemove", this.pullMove);
162
+ window.addEventListener("mouseup", this.pullUp);
163
+ document.getElementsByClassName("pull-icon")[0].style.transform =
164
+ "rotate(180deg)";
165
+ document.getElementsByClassName("shrink-view")[0].style.height = "16px";
166
+ }
167
+ },
168
+ destroyed() {
169
+ window.removeEventListener("mousemove", this.pullMove);
170
+ window.removeEventListener("mouseup", this.pullUp);
171
+ },
172
+ methods: {
173
+ showMoreMethods(){
174
+ this.showMore=!this.showMore
175
+ },
176
+ searchTable() {
177
+ this.$emit("searchTable");
178
+ },
179
+ resetTable() {
180
+ this.$emit("resetTable");
181
+ },
182
+ handleCurrentChange(val) {
183
+ this.$emit("handleCurrentChange", val);
184
+ },
185
+ handleSizeChange(val) {
186
+ this.$emit("handleSizeChange", val);
187
+ },
188
+ pullDown(e) {
189
+ document.getElementsByClassName("shrink-view")[0].style.transition = "";
190
+ this.count = 0;
191
+ this.isMouseDown = true;
192
+ this.isMouseMove = false;
193
+ this.clientY = e.clientY;
194
+ this.oldHeight =
195
+ document.getElementsByClassName("shrink-view")[0].clientHeight;
196
+ },
197
+ pullClick() {
198
+ if (
199
+ document.getElementsByClassName("shrink-view")[0].style.height === "" ||
200
+ document.getElementsByClassName("shrink-view")[0].style.height ===
201
+ "16px"
202
+ ) {
203
+ document.getElementsByClassName("shrink-view")[0].style.transition =
204
+ "1s all";
205
+ document.getElementsByClassName("shrink-view")[0].style.height =
206
+ "300px";
207
+ document.getElementsByClassName("pull-icon")[0].style.transform =
208
+ "rotate(0deg)";
209
+ } else {
210
+ document.getElementsByClassName("shrink-view")[0].style.transition =
211
+ "1s all";
212
+ document.getElementsByClassName("shrink-view")[0].style.height = "16px";
213
+ document.getElementsByClassName("pull-icon")[0].style.transform =
214
+ "rotate(180deg)";
215
+ }
216
+ },
217
+ pullMove(e) {
218
+ this.isMouseMove = true;
219
+ if (this.isMouseDown) {
220
+ if (
221
+ document.getElementsByClassName("shrink-view")[0].style.height ===
222
+ "16px"
223
+ ) {
224
+ document.getElementsByClassName("pull-icon")[0].style.transform =
225
+ "rotate(180deg)";
226
+ } else {
227
+ document.getElementsByClassName("pull-icon")[0].style.transform =
228
+ "rotate(0deg)";
229
+ }
230
+ if (this.oldHeight - (e.clientY - this.clientY) > 16) {
231
+ document.getElementsByClassName("shrink-view")[0].style.height =
232
+ this.oldHeight - (e.clientY - this.clientY) + "px";
233
+ } else {
234
+ document.getElementsByClassName("shrink-view")[0].style.height =
235
+ "16px";
236
+ }
237
+ }
238
+ },
239
+ pullUp() {
240
+ if (!this.isMouseMove) {
241
+ if (!this.count) {
242
+ this.pullClick();
243
+ } else {
244
+ this.count = 0;
245
+ }
246
+ }
247
+ this.isMouseDown = false;
248
+ },
249
+ },
250
+ };
251
+ </script>
252
+
253
+ <style lang="less" scoped>
254
+ .search-table {
255
+ display: flex;
256
+ flex-direction: column;
257
+ height: 100%;
258
+ .search-contain {
259
+ background: #fff;
260
+ padding: 0 15px;
261
+ border-radius: 5px;
262
+ transition: height .8s ease;
263
+ overflow: hidden;
264
+ div {
265
+ display: inline-block;
266
+ margin-right: 15px;
267
+ }
268
+ /deep/ .el-input-group--append,/deep/ .el-input-group--prepend{
269
+ display:inline-table;
270
+ }
271
+ .el-input {
272
+ width: 180px;
273
+ margin-right: 15px;
274
+ /deep/ .el-input__inner {
275
+ height: 40px;
276
+ }
277
+ }
278
+ .el-select {
279
+ margin-right: 15px;
280
+ width: 180px;
281
+ /deep/ .el-select__caret {
282
+ line-height: 40px;
283
+ }
284
+ }
285
+ /deep/ .el-input__inner {
286
+ margin-right: 15px;
287
+ height: 40px;
288
+ line-height: 40px;
289
+ }
290
+ /deep/ .el-range-editor.el-input__inner {
291
+ padding: 5px !important;
292
+ }
293
+ .reset-btn i {
294
+ line-height: 0;
295
+ }
296
+ }
297
+ .container {
298
+ flex: 1;
299
+ display: flex;
300
+ flex-direction: column;
301
+ overflow: auto;
302
+ }
303
+ .shrink-view {
304
+ background: #fff;
305
+ display: flex;
306
+ flex-direction: column;
307
+ .bottom-contain {
308
+ height: 100%;
309
+ width: 100%;
310
+ overflow: auto;
311
+ }
312
+ .pull-div {
313
+ cursor: pointer;
314
+ width: 100%;
315
+ height: 16px;
316
+ box-shadow: 0px -3px 5px #ccc;
317
+ border-top-right-radius: 10px;
318
+ border-top-left-radius: 10px;
319
+ text-align: center;
320
+ .pull-icon {
321
+ width: 16px;
322
+ height: 16px;
323
+ }
324
+ }
325
+ }
326
+ .table-contain {
327
+ border-radius: 5px;
328
+ padding: 15px;
329
+ background: #fff;
330
+ overflow: auto;
331
+ flex: 1;
332
+ display: flex;
333
+ flex-direction: column;
334
+ .el-table {
335
+ display: flex;
336
+ flex-direction: column;
337
+ padding-top: 0;
338
+ }
339
+ /deep/ .el-table__body-wrapper {
340
+ flex: 1;
341
+ overflow-y: auto;
342
+ }
343
+ }
344
+ .operate-contain {
345
+ display: flex;
346
+ flex-wrap: wrap;
347
+ margin-bottom: 10px;
348
+ .el-button {
349
+ margin: 0;
350
+ margin-right: 10px;
351
+ margin-bottom: 10px;
352
+ }
353
+ }
354
+ .page-item {
355
+ text-align: right;
356
+ padding:10px 0;
357
+ }
358
+ }
359
+
360
+ /deep/ .el-table__fixed-body-wrapper{
361
+ height:calc(100% - 44px);
362
+ }
363
+ .outDialog {
364
+ .search-contain {
365
+ padding: 15px;
366
+ padding-bottom:0;
367
+ margin-bottom: 10px;
368
+ }
369
+ // /deep/ .el-table {
370
+ // padding: 20px 0;
371
+ // }
372
+ /deep/ .moreBtnView{
373
+ .el-input{
374
+ margin-bottom:10px;
375
+ }
376
+ }
377
+ }
378
+
379
+ </style>
380
+ <style>
381
+ .inDialog .el-table{
382
+ flex:auto;
383
+ }
384
+ .inDialog{
385
+ height:auto !important;
386
+ }
387
+ .inDialog .table-contain{
388
+ padding-bottom:0 !important;
389
+ }
390
+ .inDialog .table-contain .el-table .el-table__body-wrapper {
391
+ flex: auto;
392
+ }
393
+ /* .no-title{
394
+ height: calc(100vh - 120px) !important;
395
+ } */
396
+ </style>
@@ -0,0 +1,5 @@
1
+ import GyygModal from "./GyygModal.vue";
2
+
3
+ GyygModal.install = Vue => Vue.component(GyygModal.name, GyygModal); //注册组件
4
+
5
+ export default GyygModal;