wl-design-mobile 0.2.9 → 0.3.1

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # wl-design-mobile
2
-
3
- ## Setup
4
- ```
5
- npm i wl-design-mobile
6
- ```
1
+ # wl-design-mobile
2
+
3
+ ## Setup
4
+ ```
5
+ npm i wl-design-mobile
6
+ ```
@@ -1,3 +1,3 @@
1
- .img-upload-container {
2
- padding: 0px 14px 12px 14px;
3
- }
1
+ .img-upload-container {
2
+ padding: 0px 14px 12px 14px;
3
+ }
@@ -1,39 +1,39 @@
1
- .coll-div {
2
- margin-bottom: 8px;
3
- }
4
-
5
- .indicator-title {
6
- display: flex;
7
- align-items: center;
8
- color: var(--scl-blue);
9
- font-size: 14px;
10
- font-family: 微软雅黑, serif Regular;
11
- }
12
-
13
- .indicator-title .color-line {
14
- width: 3px;
15
- height: 14px;
16
- margin-right: 8px;
17
- }
18
-
19
- .coll-title-icon {
20
- justify-content: center;
21
- align-items: center;
22
- align-content: center;
23
- }
24
-
25
- /* 覆盖折叠面板的标题的padding */
26
- /deep/ .van-cell {
27
- padding: 12px 10px;
28
- }
29
-
30
- /* 覆盖去掉折叠面板的标题下面的线 */
31
- /deep/ .van-cell::after {
32
- border: none;
33
- }
34
-
35
- /* 覆盖折叠面板的内容的padding */
36
- /deep/ .van-collapse-item__content {
37
- padding: 0px 0px 0px 0px;
38
- }
39
-
1
+ .coll-div {
2
+ margin-bottom: 8px;
3
+ }
4
+
5
+ .indicator-title {
6
+ display: flex;
7
+ align-items: center;
8
+ color: var(--scl-blue);
9
+ font-size: 14px;
10
+ font-family: 微软雅黑, serif Regular;
11
+ }
12
+
13
+ .indicator-title .color-line {
14
+ width: 3px;
15
+ height: 14px;
16
+ margin-right: 8px;
17
+ }
18
+
19
+ .coll-title-icon {
20
+ justify-content: center;
21
+ align-items: center;
22
+ align-content: center;
23
+ }
24
+
25
+ /* 覆盖折叠面板的标题的padding */
26
+ /deep/ .van-cell {
27
+ padding: 12px 10px;
28
+ }
29
+
30
+ /* 覆盖去掉折叠面板的标题下面的线 */
31
+ /deep/ .van-cell::after {
32
+ border: none;
33
+ }
34
+
35
+ /* 覆盖折叠面板的内容的padding */
36
+ /deep/ .van-collapse-item__content {
37
+ padding: 0px 0px 0px 0px;
38
+ }
39
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wl-design-mobile",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "finch",
@@ -1,136 +1,136 @@
1
- .search-top-pop {
2
- min-height: 112px;
3
- max-height: 33%;
4
- background-color: var(--scl-white-1)
5
- }
6
-
7
- .search-body {
8
- border-top: none;
9
- overflow-y: auto;
10
- flex: 1
11
- }
12
-
13
- .search-bottom-btn {
14
- padding: 12px 14px 12px 14px;
15
- box-shadow: 0 -2px 10px rgba(125, 126, 128, .16);
16
- background-color: rgb(255, 255, 255, 1);
17
- }
18
-
19
- /*日期选择*/
20
- .search-row {
21
- display: flex;
22
- flex-direction: row;
23
- justify-content: flex-start;
24
- flex-wrap: nowrap;
25
- align-items: center;
26
- align-content: center;
27
- height: 50px;
28
- padding: 10px 0;
29
- margin: 0 14px;
30
- border-bottom: 1px solid var(--scl-white-2);
31
- border-top: none;
32
- }
33
-
34
- .search-input-title {
35
- height: 16px;
36
- font-size: 12px;
37
- color: var(--scl-gray-2);
38
- display: flex;
39
- justify-content: flex-start;
40
- align-items: center;
41
- margin-left: 12px;
42
- width: 76px;
43
- }
44
-
45
- .search-lambo-input {
46
- border: none;
47
- outline: none;
48
- background: none;
49
- height: 16px;
50
- font-size: 12px;
51
- color: var(--scl-gray-1);
52
- display: flex;
53
- justify-content: flex-start;
54
- align-items: center;
55
- margin-left: 8px;
56
- flex: 1;
57
- }
58
-
59
- /*输入框*/
60
- .search-lambo-input .van-cell {
61
- padding: 10px 0;
62
- }
63
-
64
- /*多选*/
65
- .search-top-div {
66
- display: flex;
67
- justify-content: space-between;
68
- height: 44px;
69
- line-height: 44px;
70
- width: 100%;
71
- position: fixed;
72
- z-index: 2;
73
- box-shadow: 0 2px 10px rgba(125, 126, 128, .16);
74
- background-color: rgb(255, 255, 255, 1);
75
- }
76
-
77
- .search-cancel-btn {
78
- border: none;
79
- color: var(--scl-gray-3);
80
- }
81
-
82
- .search-confirm-btn {
83
- border: none;
84
- color: var(--scl-blue);
85
- }
86
-
87
- .search-select-title {
88
- font-size: 16px;
89
- font-weight: bold;
90
- }
91
-
92
- /*修改单选多选的滚动条样式*/
93
- /deep/ .van-radio-group {
94
- position: relative;
95
- }
96
-
97
- /*修改单选多选的滚动条样式*/
98
- /deep/ .van-cell-group {
99
- padding-top: 44px;
100
- }
101
-
102
- /*修改单选多选的滚动条样式*/
103
- /deep/ .van-cell:first-child {
104
- padding-top: 10px;
105
- }
106
-
107
- /*滚动条样式*/
108
- /deep/ ::-webkit-scrollbar {
109
- width: 6px;
110
- }
111
-
112
- /*滚动条样式*/
113
- /deep/ ::-webkit-scrollbar-thumb {
114
- border-radius: var(--ind-border-radius-xl);
115
- background: rgba(45, 140, 240, 0.6);
116
- }
117
-
118
- /*滚动条样式*/
119
- /deep/ ::-webkit-scrollbar-track {
120
- -webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1);
121
- border-radius: var(--ind-border-radius-xl);
122
- background: rgba(231, 242, 250, 0.4);
123
- }
124
-
125
- .bottom-div {
126
- display: flex;
127
- flex-direction: column;
128
- }
129
-
130
- .cell-group-div {
131
- flex: 1;
132
- overflow-y: auto;
133
- margin-top: 44px;
134
- }
135
-
136
-
1
+ .search-top-pop {
2
+ min-height: 112px;
3
+ max-height: 33%;
4
+ background-color: var(--scl-white-1)
5
+ }
6
+
7
+ .search-body {
8
+ border-top: none;
9
+ overflow-y: auto;
10
+ flex: 1
11
+ }
12
+
13
+ .search-bottom-btn {
14
+ padding: 12px 14px 12px 14px;
15
+ box-shadow: 0 -2px 10px rgba(125, 126, 128, .16);
16
+ background-color: rgb(255, 255, 255, 1);
17
+ }
18
+
19
+ /*日期选择*/
20
+ .search-row {
21
+ display: flex;
22
+ flex-direction: row;
23
+ justify-content: flex-start;
24
+ flex-wrap: nowrap;
25
+ align-items: center;
26
+ align-content: center;
27
+ height: 50px;
28
+ padding: 10px 0;
29
+ margin: 0 14px;
30
+ border-bottom: 1px solid var(--scl-white-2);
31
+ border-top: none;
32
+ }
33
+
34
+ .search-input-title {
35
+ height: 16px;
36
+ font-size: 12px;
37
+ color: var(--scl-gray-2);
38
+ display: flex;
39
+ justify-content: flex-start;
40
+ align-items: center;
41
+ margin-left: 12px;
42
+ width: 76px;
43
+ }
44
+
45
+ .search-lambo-input {
46
+ border: none;
47
+ outline: none;
48
+ background: none;
49
+ height: 16px;
50
+ font-size: 12px;
51
+ color: var(--scl-gray-1);
52
+ display: flex;
53
+ justify-content: flex-start;
54
+ align-items: center;
55
+ margin-left: 8px;
56
+ flex: 1;
57
+ }
58
+
59
+ /*输入框*/
60
+ .search-lambo-input .van-cell {
61
+ padding: 10px 0;
62
+ }
63
+
64
+ /*多选*/
65
+ .search-top-div {
66
+ display: flex;
67
+ justify-content: space-between;
68
+ height: 44px;
69
+ line-height: 44px;
70
+ width: 100%;
71
+ position: fixed;
72
+ z-index: 2;
73
+ box-shadow: 0 2px 10px rgba(125, 126, 128, .16);
74
+ background-color: rgb(255, 255, 255, 1);
75
+ }
76
+
77
+ .search-cancel-btn {
78
+ border: none;
79
+ color: var(--scl-gray-3);
80
+ }
81
+
82
+ .search-confirm-btn {
83
+ border: none;
84
+ color: var(--scl-blue);
85
+ }
86
+
87
+ .search-select-title {
88
+ font-size: 16px;
89
+ font-weight: bold;
90
+ }
91
+
92
+ /*修改单选多选的滚动条样式*/
93
+ /deep/ .van-radio-group {
94
+ position: relative;
95
+ }
96
+
97
+ /*修改单选多选的滚动条样式*/
98
+ /deep/ .van-cell-group {
99
+ padding-top: 44px;
100
+ }
101
+
102
+ /*修改单选多选的滚动条样式*/
103
+ /deep/ .van-cell:first-child {
104
+ padding-top: 10px;
105
+ }
106
+
107
+ /*滚动条样式*/
108
+ /deep/ ::-webkit-scrollbar {
109
+ width: 6px;
110
+ }
111
+
112
+ /*滚动条样式*/
113
+ /deep/ ::-webkit-scrollbar-thumb {
114
+ border-radius: var(--ind-border-radius-xl);
115
+ background: rgba(45, 140, 240, 0.6);
116
+ }
117
+
118
+ /*滚动条样式*/
119
+ /deep/ ::-webkit-scrollbar-track {
120
+ -webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1);
121
+ border-radius: var(--ind-border-radius-xl);
122
+ background: rgba(231, 242, 250, 0.4);
123
+ }
124
+
125
+ .bottom-div {
126
+ display: flex;
127
+ flex-direction: column;
128
+ }
129
+
130
+ .cell-group-div {
131
+ flex: 1;
132
+ overflow-y: auto;
133
+ margin-top: 44px;
134
+ }
135
+
136
+
@@ -1,20 +1,39 @@
1
1
  <template>
2
- <div class="ag-theme-balham" :style="{width: '100%', height: tableHeight}">
3
- <ag-grid-vue
4
- :columnDefs="columns"
5
- :rowData="rowData"
6
- :pinnedBottomRowData="sumData"
7
- :defaultColDef="defaultColDef"
8
- @grid-ready="onGridReady"
9
- class="ag-theme-balham"
10
- style="width: 100%; height: 100%;"
11
- ></ag-grid-vue>
2
+ <div class="table-container">
3
+ <div class="ag-theme-balham" :style="{width: '100%', height: tableHeight}">
4
+ <ag-grid-vue
5
+ :columnDefs="columns"
6
+ :rowData="rowData"
7
+ :pinnedBottomRowData="sumData"
8
+ :defaultColDef="defaultColDef"
9
+ @grid-ready="onGridReady"
10
+ @sortChanged="onSortChanged"
11
+ class="ag-theme-balham"
12
+ style="width: 100%; height: 100%;"
13
+ ></ag-grid-vue>
14
+ </div>
15
+ <van-pagination
16
+ v-if="isPage"
17
+ v-model="currentPage"
18
+ :total-items="total"
19
+ :items-per-page="limit"
20
+ @change="onPageChanged"
21
+ mode="simple"
22
+ class="vant-page-comp">
23
+ <template #prev-text>
24
+ <van-icon name="arrow-left"/>
25
+ </template>
26
+ <template #next-text>
27
+ <van-icon name="arrow"/>
28
+ </template>
29
+ </van-pagination>
12
30
  </div>
13
31
  </template>
14
32
  <script>
15
- import 'ag-grid-community/styles/ag-grid.css'
16
- import 'ag-grid-community/styles/ag-theme-balham.css'
17
- import {AgGridVue} from 'ag-grid-vue/lib/main.cjs'
33
+ // import 'ag-grid-community/styles/ag-grid.css'
34
+ // import 'ag-grid-community/styles/ag-theme-balham.css'
35
+ // import {AgGridVue} from 'ag-grid-vue/lib/main.cjs.js'
36
+ import {AgGridVue} from 'ag-grid-vue'
18
37
  import {axios} from "../util/axios/index"
19
38
  import {Toast} from "vant"
20
39
 
@@ -36,7 +55,11 @@ export default {
36
55
  },
37
56
  searchParams: {
38
57
  type: Object
39
- }
58
+ },
59
+ isPage: {
60
+ type: Boolean,
61
+ default: false
62
+ },
40
63
  },
41
64
  data() {
42
65
  return {
@@ -49,21 +72,70 @@ export default {
49
72
  resizable: false,
50
73
  filter: false,
51
74
  autoHeight: true
52
- }
75
+ },
76
+ currentPage: 1,
77
+ offset: 0,
78
+ limit: 10,
79
+ total: 0,
53
80
  }
54
81
  },
55
82
  methods: {
56
83
  onGridReady(params) {
57
84
  params.api.sizeColumnsToFit();
58
85
  },
86
+ columnsFilterSort() {
87
+ if (this.columns && this.columns.length > 0) {
88
+ for (const item of this.columns) {
89
+ if (item && item.hasOwnProperty("field")) {
90
+ item['comparator'] = this.preventComparator
91
+ }
92
+ }
93
+ }
94
+ },
95
+ preventComparator(v1, v2) {
96
+ return 0;
97
+ },
98
+ onSortChanged(event) {
99
+ console.log("lambo-ag-table -- onSortChanged -- event:", event)
100
+ if (event && event.hasOwnProperty("columns") && event.columns) {
101
+ let sortColumns = event.columns
102
+ if (sortColumns && sortColumns.length > 0) {
103
+ let sortCol = sortColumns[sortColumns.length - 1]
104
+ if (sortCol && sortCol.hasOwnProperty("colId") && sortCol.hasOwnProperty("sort")) {
105
+ let sortField = sortCol.colId
106
+ let sortType = sortCol.sort
107
+ console.log("lambo-ag-table -- onSortChanged -- sortField:" + sortField + ",sortType:" + sortType)
108
+ if (sortField && (sortType === 'desc' || sortType === 'asc')) {
109
+ this.searchParams.sort = sortField
110
+ this.searchParams.order = sortType
111
+ this.dataRefresh()
112
+ }
113
+ }
114
+ }
115
+ }
116
+ },
117
+ onPageChanged() {
118
+ this.offset = (this.currentPage - 1) * this.limit
119
+ this.dataRefresh()
120
+ },
59
121
  dataRefresh() {
60
- axios.get(this.url, this.searchParams).then(res => {
122
+ let params = {}
123
+ if (this.isPage === true) {
124
+ params = {offset: this.offset, limit: this.limit, ...this.searchParams}
125
+ } else {
126
+ params = {...this.searchParams}
127
+ }
128
+ console.log("lambo-ag-table -- onLoad -- params:", params)
129
+ axios.get(this.url, {params}).then(res => {
61
130
  console.log("lambo-ag-table -- onLoad -- dataRefresh:", res)
62
131
  if (res && res.code === 1) {
63
- this.rowData = []
64
- this.sumData = []
65
- this.rowData = res.data.data || []
66
- this.sumData = res.data.sumData || []
132
+ let dataObj = res.data
133
+ this.rowData = dataObj.rows || []
134
+ this.sumData = dataObj.sum || []
135
+
136
+ if (this.isPage === true) {
137
+ this.total = dataObj.total || 0
138
+ }
67
139
  } else {
68
140
  console.error("lambo-ag-table -- onLoad -- 查询[" + this.url + "]数据失败", res)
69
141
  Toast.fail("查询[" + this.url + "]数据失败:" + res.data || '')
@@ -85,9 +157,14 @@ export default {
85
157
  },
86
158
  deep: true
87
159
  }
160
+ },
161
+ created() {
162
+ this.columnsFilterSort()
88
163
  }
89
164
  }
90
165
  </script>
91
166
  <style scoped>
92
-
167
+ /deep/ .vant-page-comp .van-pagination__item {
168
+ color: #0070D2
169
+ }
93
170
  </style>
@@ -13,6 +13,11 @@
13
13
  </div>
14
14
  </div>
15
15
  </div>
16
+ <div class="title1-sub-text" v-if="titleSub">
17
+ <span>
18
+ {{titleSub}}
19
+ </span>
20
+ </div>
16
21
  <div class="title1-border-line" v-if="border"></div>
17
22
  </div>
18
23
  </template>
@@ -30,6 +35,9 @@ export default {
30
35
  title: {
31
36
  type: String,
32
37
  },
38
+ titleSub: {
39
+ type: String,
40
+ },
33
41
  marginBottom: {
34
42
  type: Boolean,
35
43
  default: true,
@@ -61,7 +69,7 @@ export default {
61
69
  }
62
70
 
63
71
  .title1-main {
64
- height: 47px;
72
+ min-height: 47px;
65
73
  display: flex;
66
74
  flex-direction: row;
67
75
  flex-wrap: wrap;
@@ -69,12 +77,12 @@ export default {
69
77
  align-items: center;
70
78
  align-content: center;
71
79
  background-color: var(--scl-white-1);
72
- padding: 0px 14px;
80
+ padding: 5px 14px;
73
81
  }
74
82
 
75
83
  .title1-border-line {
76
84
  height: 1px;
77
- margin: 0px 14px 0px 14px;
85
+ margin: 0 14px 0 14px;
78
86
  background-color: var(--scl-white-2);
79
87
  }
80
88
 
@@ -91,7 +99,6 @@ export default {
91
99
  }
92
100
 
93
101
  .title1-val {
94
- height: 23px;
95
102
  padding: 0;
96
103
  font-size: 16px;
97
104
  border: none;
@@ -107,6 +114,7 @@ export default {
107
114
  justify-content: flex-start;
108
115
  align-items: center;
109
116
  align-content: flex-start;
117
+ margin-left: auto;
110
118
  background-color: var(--scl-white-1);
111
119
  }
112
120
 
@@ -130,4 +138,9 @@ export default {
130
138
  .opt-btn-div > *:last-child {
131
139
  margin-right: 0px;
132
140
  }
141
+
142
+ .title1-sub-text{
143
+ margin: 0 14px 5px 14px;
144
+ color:var(--scl-gray-3);
145
+ }
133
146
  </style>