Commit cc92aef1 by ningjihai

修改pageWrapperSearch.vue 自定义按钮

使用方法参考project/Project/QueryForm
parent d27e1f15
...@@ -9,8 +9,10 @@ import { ...@@ -9,8 +9,10 @@ import {
useSlots, useSlots,
withModifiers, withModifiers,
onMounted, onMounted,
onBeforeUnmount onBeforeUnmount,
PropType
} from 'vue' } from 'vue'
import type { Component } from 'vue'
import { import {
ElRow, ElRow,
...@@ -67,7 +69,18 @@ export default defineComponent({ ...@@ -67,7 +69,18 @@ export default defineComponent({
type: Number, type: Number,
default: 6 default: 6
}, },
labelWidth: [Number, String] labelWidth: [Number, String],
extraButtons: {
type: Array as PropType<Array<{
text: string
type?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text'
plain?: boolean
round?: boolean
icon?: Component
onClick: () => void
}>>,
default: () => []
}
}, },
setup(props, { emit, attrs, slots }) { setup(props, { emit, attrs, slots }) {
let observer let observer
...@@ -145,7 +158,19 @@ export default defineComponent({ ...@@ -145,7 +158,19 @@ export default defineComponent({
class: 'buttons-space' class: 'buttons-space'
}, },
() => [ () => [
...props.extraButtons.map(btn => h(
ElButton,
{
type: btn.type,
plain: btn.plain,
round: btn.round,
onClick: btn.onClick
},
() => [
btn.icon ? h(ElIcon, null, () => [h(btn.icon as Component)]) : null,
btn.text
]
)),
h( h(
ElButton, ElButton,
{ {
...@@ -155,7 +180,10 @@ export default defineComponent({ ...@@ -155,7 +180,10 @@ export default defineComponent({
emit('reset', ElFormRef.value) emit('reset', ElFormRef.value)
} }
}, },
() => '重置' () => [
h(ElIcon, null, () => h(Refresh)),
'重置'
]
), ),
h( h(
ElButton, ElButton,
...@@ -166,7 +194,10 @@ export default defineComponent({ ...@@ -166,7 +194,10 @@ export default defineComponent({
emit('search') emit('search')
} }
}, },
() => '查询' () => [
h(ElIcon, null, () => h(Search)),
'搜索'
]
), ),
cols.length > max.value ? h( cols.length > max.value ? h(
'div', 'div',
......
...@@ -2,6 +2,14 @@ ...@@ -2,6 +2,14 @@
import { computed,ref,watch } from 'vue' import { computed,ref,watch } from 'vue'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import PageWrapperSearch from '@/components/search/PageWrapperSearch.vue' import PageWrapperSearch from '@/components/search/PageWrapperSearch.vue'
import {
Check,
Delete,
Edit,
Message,
Search,
Star,
} from '@element-plus/icons-vue'
// import { useDict } from '@/utils/dict' // import { useDict } from '@/utils/dict'
// import { listDept } from '@/api/system/dept'// 部门 // import { listDept } from '@/api/system/dept'// 部门
...@@ -40,7 +48,6 @@ function onReset(formRef: FormInstance) { ...@@ -40,7 +48,6 @@ function onReset(formRef: FormInstance) {
emit('reset', formRef) emit('reset', formRef)
} }
</script> </script>
<template> <template>
...@@ -64,6 +71,41 @@ function onReset(formRef: FormInstance) { ...@@ -64,6 +71,41 @@ function onReset(formRef: FormInstance) {
/> />
</el-form-item> </el-form-item>
</page-wrapper-search> </page-wrapper-search>
<!-- <page-wrapper-search
:model="queryForm"
:extraButtons="[
{
text: '导出',
icon: Edit,
type: 'success',
onClick: handleExport
},
{
text: '打印',
type: 'warning',
onClick: handlePrint
}
]"
@search="onSearch"
@reset="onReset">
<el-form-item label="项目名称" prop="proName">
<el-input
v-model="queryForm.proName"
placeholder="请输入项目名称"
clearable
/>
</el-form-item>
<el-form-item label="备注" prop="note">
<el-input
v-model="queryForm.note"
placeholder="请输入备注"
clearable
/>
</el-form-item>
</page-wrapper-search> -->
</template> </template>
<style scoped> <style scoped>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论