|
@ -1,21 +1,53 @@ |
|
|
<template> |
|
|
<template> |
|
|
|
|
|
<div v-for="(item, index) in Butttondata" :key="index"> |
|
|
<el-button |
|
|
<el-button |
|
|
v-for="(item, index) in Butttondata" :key="index" |
|
|
|
|
|
v-show="!item.hide" |
|
|
v-show="!item.hide" |
|
|
:type="item.type" |
|
|
:type="item.type" |
|
|
:color="item.color" |
|
|
:color="item.color" |
|
|
:link="item.link ? item.link : false" |
|
|
:link="item.link ? item.link : false" |
|
|
v-hasPermi="[item.hasPermi] || []" |
|
|
v-hasPermi="[item.hasPermi] || []" |
|
|
|
|
|
v-if="item.name != 'set'" |
|
|
@click="buttonBaseClick(item.name, item, $event)" |
|
|
@click="buttonBaseClick(item.name, item, $event)" |
|
|
> |
|
|
> |
|
|
<Icon v-if="item.icon" :icon="item.icon" class="mr-1px" /> |
|
|
<Icon v-if="item.icon" :icon="item.icon" class="mr-1px" /> |
|
|
{{ item.label }} |
|
|
{{ item.label }} |
|
|
</el-button> |
|
|
</el-button> |
|
|
|
|
|
<!-- 设置按钮 --> |
|
|
|
|
|
<el-popover |
|
|
|
|
|
:visible="popoverVisible" |
|
|
|
|
|
placement="bottom" |
|
|
|
|
|
:width="300" |
|
|
|
|
|
trigger="click" |
|
|
|
|
|
v-if="item.name == 'set'&&!item.hide" |
|
|
|
|
|
> |
|
|
|
|
|
<rowDrop |
|
|
|
|
|
ref="rowDropRef" |
|
|
|
|
|
@updata-table-columns="updataTableColumns" |
|
|
|
|
|
:allSchemas="allSchemas" |
|
|
|
|
|
@closeRowDrop="closeRowDrop" |
|
|
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
|
|
/> |
|
|
|
|
|
<template #reference> |
|
|
|
|
|
<el-button |
|
|
|
|
|
v-show="!item.hide" |
|
|
|
|
|
:type="item.type" |
|
|
|
|
|
:color="item.color" |
|
|
|
|
|
:link="item.link ? item.link : false" |
|
|
|
|
|
v-hasPermi="[item.hasPermi] || []" |
|
|
|
|
|
@click="buttonBaseClick(item.name, item, $event)" |
|
|
|
|
|
> |
|
|
|
|
|
<Icon v-if="item.icon" :icon="item.icon" class="mr-1px" /> |
|
|
|
|
|
{{ item.label }} |
|
|
|
|
|
</el-button> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-popover> |
|
|
|
|
|
</div> |
|
|
<slot></slot> |
|
|
<slot></slot> |
|
|
</template> |
|
|
</template> |
|
|
<script setup> |
|
|
<script setup> |
|
|
import { Plus } from '@element-plus/icons-vue' |
|
|
import { Plus } from '@element-plus/icons-vue' |
|
|
import { clearButtonBlurHandle } from '@/utils/index' |
|
|
import { clearButtonBlurHandle } from '@/utils/index' |
|
|
|
|
|
import rowDrop from '@/components/rowDrop/index.vue' |
|
|
const props = defineProps({ |
|
|
const props = defineProps({ |
|
|
Butttondata: { |
|
|
Butttondata: { |
|
|
type: Array, |
|
|
type: Array, |
|
@ -23,16 +55,30 @@ |
|
|
return [] |
|
|
return [] |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
allSchemas: { |
|
|
|
|
|
type: Object, |
|
|
|
|
|
default: null |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
console.log('buttonsRight', props.Butttondata) |
|
|
// 传递给父类 |
|
|
// 传递给父类 |
|
|
const emit = defineEmits([ |
|
|
const emit = defineEmits(['buttonBaseClick', 'updataTableColumns']) |
|
|
'buttonBaseClick', |
|
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
|
|
const buttonBaseClick = (val, item, $event) => { |
|
|
const buttonBaseClick = (val, item, $event) => { |
|
|
clearButtonBlurHandle($event) //解决el-button点击后颜色不恢复问题 |
|
|
clearButtonBlurHandle($event) //解决el-button点击后颜色不恢复问题 |
|
|
emit('buttonBaseClick', val, item, $event) |
|
|
emit('buttonBaseClick', val, item, $event) |
|
|
} |
|
|
} |
|
|
|
|
|
const popoverVisible = ref(false) |
|
|
|
|
|
// 关闭页面 |
|
|
|
|
|
const closeRowDrop = () => { |
|
|
|
|
|
popoverVisible.value = false |
|
|
|
|
|
} |
|
|
|
|
|
defineExpose({ |
|
|
|
|
|
popoverVisible |
|
|
|
|
|
}) |
|
|
|
|
|
// 更新主列表字段 |
|
|
|
|
|
const updataTableColumns = (val) => { |
|
|
|
|
|
emit('updataTableColumns', val) |
|
|
|
|
|
} |
|
|
</script> |
|
|
</script> |