mirror of
https://gitee.com/fantastic-admin/basic.git
synced 2024-12-05 13:37:45 +08:00
移除 BatchActionBar
组件
This commit is contained in:
parent
97edf77ab7
commit
0ba65db768
@ -1,82 +0,0 @@
|
||||
<script lang="ts" setup name="BatchActionBar">
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
selectionData: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['checkAll', 'checkNull'])
|
||||
|
||||
const checkAll = computed({
|
||||
get() {
|
||||
let flag = false
|
||||
if (props.data.length !== 0 && props.data.length === props.selectionData.length) {
|
||||
flag = true
|
||||
}
|
||||
return flag
|
||||
},
|
||||
set(newVal) {
|
||||
newVal ? emit('checkAll') : emit('checkNull')
|
||||
},
|
||||
})
|
||||
|
||||
const isIndeterminate = computed(() => {
|
||||
let flag = false
|
||||
if (props.selectionData.length > 0 && props.selectionData.length < props.data.length) {
|
||||
flag = true
|
||||
}
|
||||
return flag
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="batch-action-bar">
|
||||
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" :disabled="!data.length">
|
||||
当页全选
|
||||
</el-checkbox>
|
||||
<div v-if="selectionData.length" class="tips">
|
||||
已选 {{ selectionData.length }} 项
|
||||
</div>
|
||||
<el-form :disabled="!selectionData.length">
|
||||
<slot />
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.batch-action-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 20px 0;
|
||||
padding: 0 10px;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.el-checkbox {
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.tips {
|
||||
margin-right: 20px;
|
||||
color: #909399;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
:deep(.el-form) {
|
||||
> .el-button {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
> .el-button-group {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -54,14 +54,6 @@ const routes: RouteRecordRaw = {
|
||||
title: '搜索面板',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'batchactionbar',
|
||||
name: 'componentExtendExampleBatchactionbar',
|
||||
component: () => import('@/views/component_extend_example/batchactionbar.demo.vue'),
|
||||
meta: {
|
||||
title: '批量操作栏',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'tableautoheight',
|
||||
name: 'componentExtendExampleTableautoheight',
|
||||
|
@ -1,79 +0,0 @@
|
||||
<route lang="yaml">
|
||||
meta:
|
||||
enabled: false
|
||||
</route>
|
||||
|
||||
<script lang="ts" setup name="ComponentExampleBatchactionbar">
|
||||
const tableRef = ref()
|
||||
|
||||
const dataList = ref([
|
||||
{
|
||||
date: '2016-05-02',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1518 弄',
|
||||
},
|
||||
{
|
||||
date: '2016-05-04',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1517 弄',
|
||||
},
|
||||
{
|
||||
date: '2016-05-01',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1519 弄',
|
||||
},
|
||||
{
|
||||
date: '2016-05-03',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1516 弄',
|
||||
},
|
||||
])
|
||||
const selectionDataList = ref([])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<page-header title="批量操作栏">
|
||||
<template #content>
|
||||
<p>BatchActionBar</p>
|
||||
<p style="margin-bottom: 0;">
|
||||
该组件需要和 ElTable 搭配使用
|
||||
</p>
|
||||
</template>
|
||||
</page-header>
|
||||
<page-main>
|
||||
<batch-action-bar :data="dataList" :selection-data="selectionDataList" @check-all="tableRef.toggleAllSelection()" @check-null="tableRef.clearSelection()">
|
||||
<el-button size="default">
|
||||
单个批量操作按钮
|
||||
</el-button>
|
||||
<el-button-group>
|
||||
<el-button size="default">
|
||||
批量操作按钮组1
|
||||
</el-button>
|
||||
<el-button size="default">
|
||||
批量操作按钮组2
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</batch-action-bar>
|
||||
<el-table ref="tableRef" :data="dataList" border stripe highlight-current-row @selection-change="selectionDataList = $event">
|
||||
<el-table-column type="selection" width="40" />
|
||||
<el-table-column prop="date" label="日期" width="180" />
|
||||
<el-table-column prop="name" label="姓名" width="180" />
|
||||
<el-table-column prop="address" label="地址" />
|
||||
</el-table>
|
||||
<batch-action-bar :data="dataList" :selection-data="selectionDataList" @check-all="tableRef.toggleAllSelection()" @check-null="tableRef.clearSelection()">
|
||||
<el-button size="default">
|
||||
单个批量操作按钮
|
||||
</el-button>
|
||||
<el-button-group>
|
||||
<el-button size="default">
|
||||
批量操作按钮组1
|
||||
</el-button>
|
||||
<el-button size="default">
|
||||
批量操作按钮组2
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</batch-action-bar>
|
||||
</page-main>
|
||||
</div>
|
||||
</template>
|
Loading…
Reference in New Issue
Block a user