update Table
update Table
This commit is contained in:
parent
642299b9b8
commit
99f80db0be
4 changed files with 66 additions and 12 deletions
|
@ -14,14 +14,24 @@
|
||||||
<i class="ivu-icon ivu-icon-arrow-up-b" :class="{on: column._sortType === 'asc'}" @click="handleSort($index, 'asc')"></i>
|
<i class="ivu-icon ivu-icon-arrow-up-b" :class="{on: column._sortType === 'asc'}" @click="handleSort($index, 'asc')"></i>
|
||||||
<i class="ivu-icon ivu-icon-arrow-down-b" :class="{on: column._sortType === 'desc'}" @click="handleSort($index, 'desc')"></i>
|
<i class="ivu-icon ivu-icon-arrow-down-b" :class="{on: column._sortType === 'desc'}" @click="handleSort($index, 'desc')"></i>
|
||||||
</span>
|
</span>
|
||||||
<Poptip v-if="column.filters" placement="bottom-end">
|
<Poptip v-if="column.filters" :visible.sync="column._filterVisible" placement="bottom">
|
||||||
<span :class="[prefixCls + '-filter']">
|
<span :class="[prefixCls + '-filter']">
|
||||||
<i class="ivu-icon ivu-icon-chevron-down" @click="handleFilter($index)"></i>
|
<i class="ivu-icon ivu-icon-funnel" :class="{on: column._isFiltered}"></i>
|
||||||
</span>
|
</span>
|
||||||
<div slot="content">
|
<div slot="content" :class="[prefixCls + '-filter-list']">
|
||||||
|
<div :class="[prefixCls + '-filter-list-item']">
|
||||||
|
<checkbox-group :model.sync="column._filterChecked">
|
||||||
|
<checkbox v-for="item in column.filters" :value="item.value">{{ item.label }}</checkbox>
|
||||||
|
</checkbox-group>
|
||||||
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="item in column.filters"><Checkbox>{{ item.label }}</Checkbox></li>
|
<!--<li v-for="(filterIndex, item) in column.filters"><Checkbox :checked="column._filterChecked.indexOf(item.value) > -1" @on-change="handleFilterChecked(index, filterIndex)">{{ item.label }}</Checkbox></li>-->
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
<div :class="[prefixCls + '-filter-footer']">
|
||||||
|
<i-button type="text" size="small" @click="handleFilter($index)">筛选</i-button>
|
||||||
|
<i-button type="text" size="small" @click="handleReset($index)">重置</i-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Poptip>
|
</Poptip>
|
||||||
</template>
|
</template>
|
||||||
|
@ -32,14 +42,16 @@
|
||||||
</table>
|
</table>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import CheckboxGroup from '../checkbox/checkbox-group.vue';
|
||||||
import Checkbox from '../checkbox/checkbox.vue';
|
import Checkbox from '../checkbox/checkbox.vue';
|
||||||
import Poptip from '../poptip/poptip.vue';
|
import Poptip from '../poptip/poptip.vue';
|
||||||
|
import iButton from '../button/button.vue';
|
||||||
import Mixin from './mixin';
|
import Mixin from './mixin';
|
||||||
import { deepCopy } from '../../utils/assist';
|
import { deepCopy } from '../../utils/assist';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [ Mixin ],
|
mixins: [ Mixin ],
|
||||||
components: { Checkbox, Poptip },
|
components: { CheckboxGroup, Checkbox, Poptip, iButton },
|
||||||
props: {
|
props: {
|
||||||
prefixCls: String,
|
prefixCls: String,
|
||||||
style: Object,
|
style: Object,
|
||||||
|
@ -88,6 +100,12 @@
|
||||||
},
|
},
|
||||||
handleFilter (index) {
|
handleFilter (index) {
|
||||||
|
|
||||||
|
},
|
||||||
|
handleReset (index) {
|
||||||
|
|
||||||
|
},
|
||||||
|
handleFilterChecked (index, filterIndex) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,10 +291,14 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
hideColumnFilter () {
|
||||||
|
this.cloneColumns.forEach((col) => col._filterVisible = false);
|
||||||
|
},
|
||||||
handleBodyScroll (event) {
|
handleBodyScroll (event) {
|
||||||
if (this.showHeader) this.$els.header.scrollLeft = event.target.scrollLeft;
|
if (this.showHeader) this.$els.header.scrollLeft = event.target.scrollLeft;
|
||||||
if (this.leftFixedColumns.length) this.$els.fixedBody.scrollTop = event.target.scrollTop;
|
if (this.leftFixedColumns.length) this.$els.fixedBody.scrollTop = event.target.scrollTop;
|
||||||
if (this.rightFixedColumns.length) this.$els.fixedRightBody.scrollTop = event.target.scrollTop;
|
if (this.rightFixedColumns.length) this.$els.fixedRightBody.scrollTop = event.target.scrollTop;
|
||||||
|
this.hideColumnFilter();
|
||||||
},
|
},
|
||||||
handleMouseWheel (event) {
|
handleMouseWheel (event) {
|
||||||
const deltaX = event.deltaX;
|
const deltaX = event.deltaX;
|
||||||
|
@ -363,8 +367,11 @@
|
||||||
let center = [];
|
let center = [];
|
||||||
|
|
||||||
columns.forEach((column, index) => {
|
columns.forEach((column, index) => {
|
||||||
column._sortType = 'normal';
|
|
||||||
column._index = index;
|
column._index = index;
|
||||||
|
column._sortType = 'normal';
|
||||||
|
column._filterVisible = false;
|
||||||
|
column._isFiltered = false;
|
||||||
|
column._filterChecked = [];
|
||||||
|
|
||||||
if (column.fixed && column.fixed === 'left') {
|
if (column.fixed && column.fixed === 'left') {
|
||||||
left.push(column);
|
left.push(column);
|
||||||
|
|
|
@ -197,7 +197,7 @@
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
box-shadow: @shadow-right;
|
box-shadow: @shadow-right;
|
||||||
overflow-x: hidden;
|
//overflow-x: hidden;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: '';
|
content: '';
|
||||||
|
@ -241,10 +241,39 @@
|
||||||
&:hover{
|
&:hover{
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
&.on{
|
||||||
|
color: @primary-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-list{
|
||||||
|
padding: 8px 0 0;
|
||||||
|
&-item{
|
||||||
|
padding: 0 12px 8px;
|
||||||
|
|
||||||
|
.ivu-checkbox-wrapper + .ivu-checkbox-wrapper{
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
|
||||||
|
& > span{
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-footer{
|
||||||
|
padding: 4px;
|
||||||
|
border-top: 1px solid @border-color-split;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.ivu-poptip-popper{
|
.ivu-poptip-popper{
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
|
||||||
|
.ivu-poptip-body{
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -79,7 +79,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
render (row) {
|
render (row) {
|
||||||
const type = `${row.tag}` === 'home' ? 'green' : 'red';
|
const type = `${row.tag}` === '家' ? 'green' : 'red';
|
||||||
return `<tag color="${type}">${row.tag}</tag>`;
|
return `<tag color="${type}">${row.tag}</tag>`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -135,28 +135,28 @@
|
||||||
age: 25,
|
age: 25,
|
||||||
address: '北京市朝阳区',
|
address: '北京市朝阳区',
|
||||||
edit: false,
|
edit: false,
|
||||||
tag: 'home'
|
tag: '家'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '段模',
|
name: '段模',
|
||||||
age: 21,
|
age: 21,
|
||||||
address: '北京市海淀区',
|
address: '北京市海淀区',
|
||||||
edit: false,
|
edit: false,
|
||||||
tag: 'company'
|
tag: '公司'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '刘天娇',
|
name: '刘天娇',
|
||||||
age: 27,
|
age: 27,
|
||||||
address: '北京市东城区',
|
address: '北京市东城区',
|
||||||
edit: false,
|
edit: false,
|
||||||
tag: 'company'
|
tag: '公司'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '胡国伟',
|
name: '胡国伟',
|
||||||
age: 22,
|
age: 22,
|
||||||
address: '北京市西城区',
|
address: '北京市西城区',
|
||||||
edit: false,
|
edit: false,
|
||||||
tag: 'home'
|
tag: '家'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
height: 200
|
height: 200
|
||||||
|
|
Loading…
Add table
Reference in a new issue