-
Notifications
You must be signed in to change notification settings - Fork 656
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35879f8
commit 5142e6e
Showing
16 changed files
with
634 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<template> | ||
<el-dialog | ||
v-bind="getBindValue" | ||
destroy-on-close | ||
:close-on-click-modal="false" | ||
top="10vh" | ||
> | ||
<template v-if="slots.title" #title> | ||
<slot name="title" /> | ||
</template> | ||
|
||
<!-- 弹窗内容 --> | ||
<el-scrollbar class="com-dialog__content"> | ||
<slot /> | ||
</el-scrollbar> | ||
|
||
<template v-if="slots.footer" #footer> | ||
<slot name="footer" /> | ||
</template> | ||
</el-dialog> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, computed } from 'vue' | ||
export default defineComponent({ | ||
name: 'Dialog', | ||
setup(props, { slots, attrs }) { | ||
const getBindValue = computed((): any => { | ||
const bindValue = { ...attrs, ...props } | ||
return bindValue | ||
}) | ||
return { | ||
getBindValue, | ||
slots | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style lang="less" scoped> | ||
.com-dialog__content { | ||
height: 600px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import type { App } from 'vue' | ||
// import Button from '@/components/Button/index.vue'// Button组件 | ||
import Dialog from './Dialog/index.vue'// Dialog组件 | ||
|
||
export function setupGlobCom(app: App<Element>): void { | ||
// app.component('AButton', Button) | ||
app.component('ComDialog', Dialog) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,88 @@ | ||
// 常用的增删改查 hook | ||
import { reactive, ref } from 'vue' | ||
import { ElMessageBox } from 'element-plus' | ||
import { Message } from '_c/Message' | ||
|
||
interface DefalutParams { | ||
pageIndex: number | ||
pageSize: number | ||
pageIndex: number // 页码 | ||
pageSize: number // 页数 | ||
} | ||
|
||
interface DelsParmas { | ||
noDataText?: string // 没有选中数据时的提示 | ||
text?: string // 删除前的提示 | ||
hiddenVerify?: boolean // 是否隐藏前置判断 | ||
} | ||
|
||
export function useExample() { | ||
// 请求接口的基本参数 | ||
const defalutParams = reactive<DefalutParams>({ | ||
pageIndex: 1, | ||
pageSize: 10 | ||
}) | ||
|
||
|
||
// 多选数据 | ||
const selectionData = ref<any[]>([]) | ||
|
||
// 表格数据 | ||
const tableData = ref<any[]>([]) | ||
|
||
|
||
// 表格加载状态 | ||
const loading = ref<boolean>(true) | ||
|
||
// 表格总条数 | ||
const total = ref<number>(0) | ||
|
||
|
||
// 是否展示弹窗 | ||
const dialogVisible = ref<boolean>(false) | ||
|
||
// 弹窗标题 | ||
const title = ref<string>('') | ||
|
||
// 表格展示条目改变时候重置基本参数 | ||
function sizeChange(val: number) { | ||
loading.value = true | ||
defalutParams.pageIndex = 1 | ||
defalutParams.pageSize = val | ||
} | ||
|
||
|
||
// 表格分页改变时候重置基本参数 | ||
function currentChange(val: number) { | ||
loading.value = true | ||
defalutParams.pageIndex = val | ||
} | ||
|
||
// 删除多选 | ||
function delData(callBack: Function, config?: DelsParmas) { | ||
if (selectionData.value.length === 0 && !config?.hiddenVerify) { | ||
Message.warning(config?.noDataText || '请选择需要删除的数据!') | ||
return | ||
} | ||
ElMessageBox.confirm(config?.text || '此操作将永久删除选中数据, 是否继续?', '提示', { | ||
confirmButtonText: '确定', | ||
cancelButtonText: '取消', | ||
type: 'warning' | ||
}).then(async() => { | ||
await callBack() | ||
}) | ||
} | ||
|
||
// 多选变化的时候 | ||
function handleSelectionChange(selection: any[]) { | ||
selectionData.value = selection | ||
} | ||
|
||
return { | ||
defalutParams, | ||
tableData, | ||
selectionData, | ||
loading, | ||
total, | ||
dialogVisible, | ||
title, | ||
sizeChange, | ||
currentChange | ||
currentChange, | ||
delData, | ||
handleSelectionChange | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.