refactor: use XModel

This commit is contained in:
xingyu4j 2022-11-15 12:25:19 +08:00
parent 29f2f99401
commit c5075dad3b
37 changed files with 88 additions and 86 deletions

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { propTypes } from '@/utils/propTypes'
import { computed, useAttrs, useSlots } from 'vue'
import { ElScrollbar } from 'element-plus'
const slots = useSlots()
const props = defineProps({
@ -29,9 +29,11 @@ const getBindValue = computed(() => {
<template v-if="slots.header" #header>
<slot name="header"></slot>
</template>
<template v-if="slots.default" #default>
<slot name="default"></slot>
</template>
<ElScrollbar>
<template v-if="slots.default" #default>
<slot name="default"></slot>
</template>
</ElScrollbar>
<template v-if="slots.corner" #corner>
<slot name="corner"></slot>
</template>

View File

@ -136,7 +136,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -169,5 +169,5 @@ getList()
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -175,7 +175,7 @@ onMounted(async () => {
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -224,5 +224,5 @@ onMounted(async () => {
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -186,7 +186,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -216,5 +216,5 @@ getList()
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -103,7 +103,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="t('action.detail')">
<XModal v-model="dialogVisible" :title="t('action.detail')">
<!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef">
<template #status="{ row }">
@ -117,5 +117,5 @@ getList()
<template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -75,7 +75,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef">
<template #userType="{ row }">
@ -95,5 +95,5 @@ getList()
<template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -114,7 +114,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef">
<template #userType="{ row }">
@ -131,5 +131,5 @@ getList()
<template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -79,7 +79,7 @@ defineExpose({
</script>
<template>
<!-- 导入表 -->
<Dialog title="导入表" v-model="visible" maxHeight="500px" width="50%">
<XModal title="导入表" v-model="visible" maxHeight="500px" width="50%">
<el-form :model="queryParams" ref="queryRef" :inline="true">
<el-form-item label="数据源" prop="dataSourceConfigId">
<el-select v-model="queryParams.dataSourceConfigId" placeholder="请选择数据源" clearable>
@ -125,5 +125,5 @@ defineExpose({
<el-button @click="visible = false">{{ t('dialog.close') }}</el-button>
</div>
</template>
</Dialog>
</XModal>
</template>

View File

@ -114,7 +114,7 @@ defineExpose({
})
</script>
<template>
<Dialog title="预览" v-model="preview.open" top="5vh" maxHeight="800px" width="90%">
<XModal title="预览" v-model="preview.open" top="5vh" maxHeight="800px" width="90%">
<div class="flex">
<el-card class="w-1/4" :gutter="12" shadow="hover">
<el-tree
@ -144,5 +144,5 @@ defineExpose({
</el-tabs>
</el-card>
</div>
</Dialog>
</XModal>
</template>

View File

@ -158,7 +158,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -194,5 +194,5 @@ getList()
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -131,7 +131,7 @@ onMounted(async () => {
</template>
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -161,5 +161,5 @@ onMounted(async () => {
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -176,7 +176,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -212,5 +212,5 @@ getList()
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -148,7 +148,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef">
<template #url="{ row }">
@ -169,8 +169,8 @@ getList()
<template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
<Dialog v-model="uploadDialogVisible" :title="uploadDialogTitle" :destroy-on-close="true">
</XModal>
<XModal v-model="uploadDialogVisible" :title="uploadDialogTitle" :destroy-on-close="true">
<el-upload
ref="uploadRef"
:action="updateUrl + '?updateSupport=' + updateSupport"
@ -200,5 +200,5 @@ getList()
</el-button>
<el-button @click="uploadDialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -95,7 +95,7 @@ onMounted(() => {
</template>
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef">
<template #status="{ row }">
@ -112,5 +112,5 @@ onMounted(() => {
<template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -208,7 +208,7 @@ getList()
</template>
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -248,5 +248,5 @@ getList()
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -233,7 +233,7 @@ onBeforeMount(() => {
</el-col>
</el-row>
</el-scrollbar>
<Dialog v-model="dialogVisible" :title="keyTemplate + ' 模板'" width="60%" maxHeight="800px">
<XModal v-model="dialogVisible" :title="keyTemplate + ' 模板'" width="60%" maxHeight="800px">
<el-row>
<el-col :span="14" style="margin-top: 10px">
<el-card shadow="always">
@ -280,7 +280,7 @@ onBeforeMount(() => {
</el-card>
</el-col>
</el-row>
</Dialog>
</XModal>
</template>
<style scoped>
.redis {

View File

@ -155,7 +155,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -188,5 +188,5 @@ getList()
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -155,7 +155,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -188,5 +188,5 @@ getList()
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -140,7 +140,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -173,5 +173,5 @@ getList()
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -93,7 +93,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef">
<template #status="{ row }">
@ -107,5 +107,5 @@ getList()
<template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -113,7 +113,7 @@
</Table>
</div>
</el-card>
<Dialog id="dictModel" v-model="dialogVisible" :title="dialogTitle">
<XModal id="dictModel" v-model="dialogVisible" :title="dialogTitle">
<Form
v-if="['typeCreate', 'typeUpdate'].includes(actionType)"
:schema="DictTypeSchemas.allSchemas.formSchema"
@ -144,7 +144,7 @@
/>
<XButton :title="t('dialog.close')" @click="dialogVisible = false" />
</template>
</Dialog>
</XModal>
</div>
</template>
<script setup lang="ts">

View File

@ -38,7 +38,7 @@
</vxe-grid>
</ContentWrap>
<!-- 弹窗 -->
<Dialog id="errorCodeModel" v-model="dialogVisible" :title="dialogTitle">
<XModal id="errorCodeModel" v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -64,7 +64,7 @@
<!-- 按钮关闭 -->
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
</template>
</Dialog>
</XModal>
</template>
<script setup lang="ts">

View File

@ -17,14 +17,14 @@
</vxe-grid>
</ContentWrap>
<!-- 弹窗 -->
<Dialog id="postModel" v-model="dialogVisible" :title="dialogTitle">
<XModal id="postModel" v-model="dialogVisible" :title="dialogTitle">
<!-- 表单详情 -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef" />
<template #footer>
<!-- 按钮关闭 -->
<XButton :title="t('dialog.close')" @click="dialogVisible = false" />
</template>
</Dialog>
</XModal>
</template>
<script setup lang="ts">
// import

View File

@ -97,7 +97,7 @@
</vxe-table>
</ContentWrap>
<!-- 添加或修改菜单对话框 -->
<Dialog v-model="dialogVisible" id="menuModel" :title="dialogTitle">
<XModal v-model="dialogVisible" id="menuModel" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<el-form
ref="formRef"
@ -240,7 +240,7 @@
<!-- 按钮关闭 -->
<XButton :loading="actionLoading" @click="dialogVisible = false" :title="t('dialog.close')" />
</template>
</Dialog>
</XModal>
</template>
<script setup lang="ts">
// import

View File

@ -38,7 +38,7 @@
</vxe-grid>
</ContentWrap>
<!-- 弹窗 -->
<Dialog id="noticeModel" v-model="dialogVisible" :title="dialogTitle">
<XModal id="noticeModel" v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
ref="formRef"
@ -64,7 +64,7 @@
<!-- 按钮关闭 -->
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
</template>
</Dialog>
</XModal>
</template>
<script setup lang="ts">
// import

View File

@ -48,7 +48,7 @@
</vxe-grid>
</ContentWrap>
<!-- 弹窗 -->
<Dialog id="postModel" v-model="dialogVisible" :title="dialogTitle">
<XModal id="postModel" v-model="dialogVisible" :title="dialogTitle">
<!-- 表单添加/修改 -->
<Form
ref="formRef"
@ -74,7 +74,7 @@
<!-- 按钮关闭 -->
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
</template>
</Dialog>
</XModal>
</template>
<script setup lang="ts">
// import

View File

@ -15,14 +15,14 @@
</template>
</vxe-grid>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef" />
<!-- 操作按钮 -->
<template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>
<script setup lang="ts">

View File

@ -25,7 +25,7 @@
</vxe-grid>
</ContentWrap>
<!-- 弹窗 -->
<Dialog id="postModel" v-model="dialogVisible" :title="dialogTitle">
<XModal id="postModel" v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef">
<template #resultCode="{ row }">
@ -39,7 +39,7 @@
<!-- 按钮关闭 -->
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
</template>
</Dialog>
</XModal>
</template>
<script setup lang="ts">
// import

View File

@ -45,7 +45,7 @@
</vxe-grid>
</ContentWrap>
<!-- 弹窗 -->
<Dialog id="postModel" v-model="dialogVisible" :title="dialogTitle">
<XModal id="postModel" v-model="dialogVisible" :title="dialogTitle">
<!-- 表单添加/修改 -->
<Form
ref="formRef"
@ -71,7 +71,7 @@
<!-- 按钮关闭 -->
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
</template>
</Dialog>
</XModal>
</template>
<script setup lang="ts">
// import

View File

@ -263,7 +263,7 @@ onMounted(() => {
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -299,8 +299,8 @@ onMounted(() => {
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
<Dialog v-model="dialogScopeVisible" :title="dialogScopeTitle" max-height="600px">
</XModal>
<XModal v-model="dialogScopeVisible" :title="dialogScopeTitle" max-height="600px">
<el-form :model="dataScopeForm">
<el-form-item label="角色名称">
<el-input v-model="dataScopeForm.name" :disabled="true" />
@ -359,5 +359,5 @@ onMounted(() => {
</el-button>
<el-button @click="dialogScopeVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -174,7 +174,7 @@ onMounted(async () => {
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -213,5 +213,5 @@ onMounted(async () => {
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -149,7 +149,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -185,5 +185,5 @@ getList()
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -74,7 +74,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(详情) -->
<Descriptions
v-if="actionType === 'detail'"
@ -95,5 +95,5 @@ getList()
<template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -197,7 +197,7 @@ getList()
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -233,8 +233,8 @@ getList()
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
<Dialog v-model="sendVisible" title="测试">
</XModal>
<XModal v-model="sendVisible" title="测试">
<el-form :model="sendSmsForm" :rules="sendSmsRules" label-width="140px">
<el-form-item label="模板内容" prop="content">
<el-input
@ -266,5 +266,5 @@ getList()
</el-button>
<el-button @click="sendVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -193,7 +193,7 @@ onMounted(async () => {
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -244,5 +244,5 @@ onMounted(async () => {
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -150,7 +150,7 @@ onMounted(async () => {
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle" maxHeight="500px" width="50%">
<XModal v-model="dialogVisible" :title="dialogTitle" maxHeight="500px" width="50%">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -195,5 +195,5 @@ onMounted(async () => {
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>

View File

@ -413,7 +413,7 @@ onMounted(async () => {
</Table>
</el-card>
</div>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<XModal v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
@ -476,9 +476,9 @@ onMounted(async () => {
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
<!-- 分配用户角色 -->
<Dialog v-model="roleDialogVisible" title="分配角色" maxHeight="450px">
<XModal v-model="roleDialogVisible" title="分配角色" maxHeight="450px">
<el-form :model="userRole" label-width="80px">
<el-form-item label="用户名称">
<el-input v-model="userRole.username" :disabled="true" />
@ -505,9 +505,9 @@ onMounted(async () => {
</el-button>
<el-button @click="roleDialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
<!-- 导入 -->
<Dialog
<XModal
v-model="importDialogVisible"
:title="importDialogTitle"
:destroy-on-close="true"
@ -555,7 +555,7 @@ onMounted(async () => {
</el-button>
<el-button @click="importDialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</XModal>
</template>
<style scoped>