You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
1.8 KiB
Vue
93 lines
1.8 KiB
Vue
1 month ago
|
<!--
|
||
|
* @Author: chris
|
||
|
* @Date: 2025-08-08 16:17:48
|
||
|
* @LastEditors: chris
|
||
2 weeks ago
|
* @LastEditTime: 2025-09-17 17:14:23
|
||
1 month ago
|
-->
|
||
|
<template>
|
||
|
<common-action-toolbar
|
||
|
:buttons="buttons"
|
||
|
:selectedRows="props.selectedRows"
|
||
|
:columns="props.columns"
|
||
|
v-model:showSearch="showSearch"
|
||
|
@buttonClick="handleButtonClick"
|
||
|
@queryTable="handleQuery"
|
||
|
></common-action-toolbar>
|
||
|
</template>
|
||
|
|
||
|
<script setup>
|
||
|
import CommonActionToolbar from '@/components/CommonActionToolbar'
|
||
|
|
||
|
const props = defineProps({
|
||
|
selectedRows: { type: Array, required: true },
|
||
|
columns: { type: Array, required: true },
|
||
|
showSearch: { type: Boolean, required: true }
|
||
|
})
|
||
|
|
||
|
const emits = defineEmits(['add', 'update', 'delete', 'export', 'query', 'update:showSearch'])
|
||
|
const showSearch = computed({
|
||
|
get: () => props.showSearch,
|
||
|
set: (value) => emits('update:showSearch', value)
|
||
|
})
|
||
|
|
||
|
// 按钮配置
|
||
2 weeks ago
|
const buttons = reactive([
|
||
1 month ago
|
{
|
||
|
key: 'add',
|
||
|
text: '新增',
|
||
|
type: 'primary',
|
||
|
plain: true,
|
||
|
icon: 'Plus',
|
||
|
action: 'add'
|
||
|
},
|
||
|
{
|
||
|
key: 'update',
|
||
|
text: '修改',
|
||
|
type: 'success',
|
||
|
plain: true,
|
||
|
icon: 'Edit',
|
||
|
action: 'update',
|
||
2 weeks ago
|
disabled: computed(() => props.selectedRows.length !== 1)
|
||
1 month ago
|
},
|
||
|
{
|
||
|
key: 'delete',
|
||
|
text: '删除',
|
||
|
type: 'danger',
|
||
|
plain: true,
|
||
|
icon: 'Delete',
|
||
|
action: 'delete',
|
||
2 weeks ago
|
disabled: computed(() => props.selectedRows.length === 0)
|
||
1 month ago
|
},
|
||
|
{
|
||
|
key: 'export',
|
||
|
text: '导出',
|
||
|
type: 'warning',
|
||
|
plain: true,
|
||
|
icon: 'Download',
|
||
|
action: 'export'
|
||
|
}
|
||
2 weeks ago
|
])
|
||
1 month ago
|
|
||
|
// 按钮点击处理
|
||
|
function handleButtonClick(action) {
|
||
|
switch (action) {
|
||
|
case 'add':
|
||
|
emits('add')
|
||
|
break
|
||
|
case 'update':
|
||
|
emits('update')
|
||
|
break
|
||
|
case 'delete':
|
||
|
emits('delete')
|
||
|
break
|
||
|
case 'export':
|
||
|
emits('export')
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// 查询处理
|
||
|
function handleQuery() {
|
||
|
emits('query')
|
||
|
}
|
||
|
</script>
|