n20-common-lib 2.4.16 → 2.4.17
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
|
@@ -26,7 +26,7 @@ vxeTable.formats.mixin({
|
|
|
26
26
|
formatRate({ cellValue }) {
|
|
27
27
|
return numerify(cellValue, '0.000000', Math.floor)
|
|
28
28
|
},
|
|
29
|
-
//
|
|
29
|
+
// 格式化时间,默认 yyyy-MM-dd HH:mm:ss
|
|
30
30
|
formatDatetime({ cellValue }) {
|
|
31
31
|
return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss')
|
|
32
32
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
ref="vxeTable"
|
|
5
5
|
:key="colsKey"
|
|
6
6
|
:align="'center'"
|
|
7
|
+
:header-align="'center'"
|
|
7
8
|
:data="data"
|
|
8
9
|
:height="height"
|
|
9
10
|
:class="{ 'cell-default-set--': cellDefault }"
|
|
@@ -25,7 +26,6 @@
|
|
|
25
26
|
@sort-change="(val) => customSortMethod(val)"
|
|
26
27
|
@filter-change="filterChange"
|
|
27
28
|
@checkbox-change="handleSelectionChange"
|
|
28
|
-
@checkbox-all="handleSelectionChange"
|
|
29
29
|
>
|
|
30
30
|
<template v-for="(item, i) in columns">
|
|
31
31
|
<slot v-if="item.slotName" :name="item.slotName" :column="item"></slot>
|
|
@@ -138,6 +138,28 @@ export default {
|
|
|
138
138
|
},
|
|
139
139
|
mounted() {},
|
|
140
140
|
methods: {
|
|
141
|
+
// 全选
|
|
142
|
+
toggleAllSelection() {
|
|
143
|
+
if (this.$refs.vxeTable) {
|
|
144
|
+
this.$refs.vxeTable.setAllCheckboxRow(true)
|
|
145
|
+
// 得手动触发
|
|
146
|
+
this.handleSelectionChange()
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
// 清空选择
|
|
150
|
+
clearSelection() {
|
|
151
|
+
if (this.$refs.vxeTable) {
|
|
152
|
+
this.$refs.vxeTable.setAllCheckboxRow(false)
|
|
153
|
+
// 得手动触发
|
|
154
|
+
this.handleSelectionChange()
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
// 选中某些行
|
|
158
|
+
toggleRowSelection(row, state = true) {
|
|
159
|
+
this.$refs.vxeTable.setCheckboxRow(row, state)
|
|
160
|
+
// 得手动触发
|
|
161
|
+
this.handleSelectionChange()
|
|
162
|
+
},
|
|
141
163
|
toggleAll($table, disabled) {
|
|
142
164
|
if (disabled) {
|
|
143
165
|
return false
|
|
@@ -165,8 +187,18 @@ export default {
|
|
|
165
187
|
},
|
|
166
188
|
filterChange({ filterList }) {
|
|
167
189
|
const obj = {}
|
|
190
|
+
// 复制默认筛选条件为空
|
|
191
|
+
this.columns.forEach((item) => {
|
|
192
|
+
if (item.filters) {
|
|
193
|
+
this.$set(obj, item.prop, undefined)
|
|
194
|
+
}
|
|
195
|
+
})
|
|
168
196
|
filterList.forEach((item) => {
|
|
169
|
-
|
|
197
|
+
if (item.column.filterMultiple) {
|
|
198
|
+
this.$set(obj, item.field, item.values)
|
|
199
|
+
} else {
|
|
200
|
+
this.$set(obj, item.field, item.values && item.values[0])
|
|
201
|
+
}
|
|
170
202
|
})
|
|
171
203
|
this.$emit('filter-change-method', obj)
|
|
172
204
|
},
|