mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
perf: dict
This commit is contained in:
parent
d22620a7ce
commit
d2a4eb9254
@ -121,10 +121,10 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema[]): VxeFormItemProps[] =>
|
||||
props: { placeholder: t('common.selectText') }
|
||||
}
|
||||
}
|
||||
|
||||
const searchSchemaItem = {
|
||||
// 默认为 input
|
||||
span: 6,
|
||||
span: 8,
|
||||
folding: searchSchema.length > 2,
|
||||
itemRender: itemRender,
|
||||
...schemaItem.search,
|
||||
field: schemaItem.field,
|
||||
@ -140,7 +140,7 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema[]): VxeFormItemProps[] =>
|
||||
const buttons: VxeFormItemProps = {
|
||||
span: 24,
|
||||
align: 'center',
|
||||
collapseNode: true,
|
||||
collapseNode: searchSchema.length > 3,
|
||||
itemRender: {
|
||||
name: '$buttons',
|
||||
children: [
|
||||
|
@ -38,7 +38,7 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => {
|
||||
const gridOptions = reactive<VxeGridProps>({
|
||||
loading: true,
|
||||
size: currentSize as any,
|
||||
height: 800,
|
||||
height: 700,
|
||||
rowConfig: {
|
||||
isCurrent: true, // 当鼠标点击行时,是否要高亮当前行
|
||||
isHover: true // 当鼠标移到行时,是否要高亮当前行
|
||||
@ -97,9 +97,11 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => {
|
||||
}
|
||||
})
|
||||
const delList = (ids: string | number | string[] | number[]) => {
|
||||
message.delConfirm().then(() => {
|
||||
config?.delListApi && config?.delListApi(ids)
|
||||
message.success(t('common.delSuccess'))
|
||||
return new Promise(async () => {
|
||||
message.delConfirm().then(() => {
|
||||
config?.delListApi && config?.delListApi(ids)
|
||||
message.success(t('common.delSuccess'))
|
||||
})
|
||||
})
|
||||
}
|
||||
return {
|
||||
|
@ -7,7 +7,6 @@ import enUS from 'vxe-table/lib/locale/lang/en-US'
|
||||
import {
|
||||
// 全局对象
|
||||
VXETable,
|
||||
|
||||
// 表格功能
|
||||
Filter,
|
||||
Edit,
|
||||
@ -15,7 +14,6 @@ import {
|
||||
Export,
|
||||
Keyboard,
|
||||
Validator,
|
||||
|
||||
// 可选组件
|
||||
Icon,
|
||||
Column,
|
||||
@ -42,7 +40,6 @@ import {
|
||||
Modal,
|
||||
List,
|
||||
Pulldown,
|
||||
|
||||
// 表格
|
||||
Table
|
||||
} from 'vxe-table'
|
||||
|
@ -1,3 +1,152 @@
|
||||
<template>
|
||||
<div class="flex">
|
||||
<el-card class="w-1/2 dict" :gutter="12" shadow="always">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>字典分类</span>
|
||||
</div>
|
||||
</template>
|
||||
<Search
|
||||
:schema="DictTypeSchemas.allSchemas.searchSchema"
|
||||
@search="setTypeSearchParams"
|
||||
@reset="setTypeSearchParams"
|
||||
/>
|
||||
<!-- 操作工具栏 -->
|
||||
<div class="mb-10px">
|
||||
<XButton
|
||||
type="primary"
|
||||
preIcon="ep:zoom-in"
|
||||
:title="t('action.add')"
|
||||
v-hasPermi="['system:dict:create']"
|
||||
@click="handleTypeCreate()"
|
||||
/>
|
||||
</div>
|
||||
<!-- 列表 -->
|
||||
<Table
|
||||
@row-click="onClickType"
|
||||
:columns="DictTypeSchemas.allSchemas.tableColumns"
|
||||
:selection="false"
|
||||
:data="typeTableObject.tableList"
|
||||
:loading="typeTableObject.loading"
|
||||
:pagination="{
|
||||
total: typeTableObject.total
|
||||
}"
|
||||
:highlight-current-row="true"
|
||||
v-model:pageSize="typeTableObject.pageSize"
|
||||
v-model:currentPage="typeTableObject.currentPage"
|
||||
@register="typeRegister"
|
||||
>
|
||||
<template #status="{ row }">
|
||||
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<XTextButton
|
||||
preIcon="ep:edit"
|
||||
:title="t('action.edit')"
|
||||
v-hasPermi="['system:dict:update']"
|
||||
@click="handleTypeUpdate(row)"
|
||||
/>
|
||||
<XTextButton
|
||||
preIcon="ep:delete"
|
||||
:title="t('action.del')"
|
||||
v-hasPermi="['system:dict:delete']"
|
||||
@click="delTypeList(row.id, false)"
|
||||
/>
|
||||
</template>
|
||||
</Table>
|
||||
</el-card>
|
||||
<el-card class="w-1/2 dict" style="margin-left: 10px" :gutter="12" shadow="hover">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>字典数据</span>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 列表 -->
|
||||
<div v-if="!tableTypeSelect">
|
||||
<span>请从左侧选择</span>
|
||||
</div>
|
||||
<div v-if="tableTypeSelect">
|
||||
<Search
|
||||
:schema="DictDataSchemas.allSchemas.searchSchema"
|
||||
@search="setDataSearchParams"
|
||||
@reset="setDataSearchParams"
|
||||
/>
|
||||
<!-- 操作工具栏 -->
|
||||
<div class="mb-10px">
|
||||
<XButton
|
||||
type="primary"
|
||||
preIcon="ep:zoom-in"
|
||||
:title="t('action.add')"
|
||||
v-hasPermi="['system:dict:create']"
|
||||
@click="handleDataCreate()"
|
||||
/>
|
||||
</div>
|
||||
<Table
|
||||
:columns="DictDataSchemas.allSchemas.tableColumns"
|
||||
:selection="false"
|
||||
:data="dataTableObject.tableList"
|
||||
:loading="dataTableObject.loading"
|
||||
:pagination="{
|
||||
total: dataTableObject.total
|
||||
}"
|
||||
v-model:pageSize="dataTableObject.pageSize"
|
||||
v-model:currentPage="dataTableObject.currentPage"
|
||||
@register="dataRegister"
|
||||
>
|
||||
<template #status="{ row }">
|
||||
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<XTextButton
|
||||
v-hasPermi="['system:dict:update']"
|
||||
preIcon="ep:edit"
|
||||
:title="t('action.edit')"
|
||||
@click="handleDataUpdate(row)"
|
||||
/>
|
||||
<XTextButton
|
||||
v-hasPermi="['system:dict:delete']"
|
||||
preIcon="ep:delete"
|
||||
:title="t('action.del')"
|
||||
@click="delDataList(row.id, false)"
|
||||
/>
|
||||
</template>
|
||||
</Table>
|
||||
</div>
|
||||
</el-card>
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle">
|
||||
<Form
|
||||
v-if="['typeCreate', 'typeUpdate'].includes(actionType)"
|
||||
:schema="DictTypeSchemas.allSchemas.formSchema"
|
||||
:rules="DictTypeSchemas.dictTypeRules"
|
||||
ref="typeFormRef"
|
||||
/>
|
||||
<Form
|
||||
v-if="['dataCreate', 'dataUpdate'].includes(actionType)"
|
||||
:schema="DictDataSchemas.allSchemas.formSchema"
|
||||
:rules="DictDataSchemas.dictDataRules"
|
||||
ref="dataFormRef"
|
||||
/>
|
||||
<!-- 操作按钮 -->
|
||||
<template #footer>
|
||||
<XButton
|
||||
v-if="['typeCreate', 'typeUpdate'].includes(actionType)"
|
||||
type="primary"
|
||||
:title="t('action.save')"
|
||||
:loading="actionLoading"
|
||||
@click="submitTypeForm"
|
||||
/>
|
||||
<XButton
|
||||
v-if="['dataCreate', 'dataUpdate'].includes(actionType)"
|
||||
type="primary"
|
||||
:title="t('action.save')"
|
||||
:loading="actionLoading"
|
||||
@click="submitDataForm"
|
||||
/>
|
||||
<XButton :title="t('dialog.close')" @click="dialogVisible = false" />
|
||||
</template>
|
||||
</Dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, unref, onMounted } from 'vue'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
@ -148,155 +297,3 @@ onMounted(async () => {
|
||||
typeTableObject.tableList[0] && onClickType(typeTableObject.tableList[0])
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex">
|
||||
<el-card class="w-1/2 dict" :gutter="12" shadow="always">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>字典分类</span>
|
||||
</div>
|
||||
</template>
|
||||
<Search
|
||||
:schema="DictTypeSchemas.allSchemas.searchSchema"
|
||||
@search="setTypeSearchParams"
|
||||
@reset="setTypeSearchParams"
|
||||
/>
|
||||
<!-- 操作工具栏 -->
|
||||
<div class="mb-10px">
|
||||
<el-button type="primary" v-hasPermi="['system:dict:create']" @click="handleTypeCreate">
|
||||
<Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<!-- 列表 -->
|
||||
<Table
|
||||
@row-click="onClickType"
|
||||
:columns="DictTypeSchemas.allSchemas.tableColumns"
|
||||
:selection="false"
|
||||
:data="typeTableObject.tableList"
|
||||
:loading="typeTableObject.loading"
|
||||
:pagination="{
|
||||
total: typeTableObject.total
|
||||
}"
|
||||
:highlight-current-row="true"
|
||||
v-model:pageSize="typeTableObject.pageSize"
|
||||
v-model:currentPage="typeTableObject.currentPage"
|
||||
@register="typeRegister"
|
||||
>
|
||||
<template #status="{ row }">
|
||||
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
v-hasPermi="['system:dict:update']"
|
||||
@click="handleTypeUpdate(row)"
|
||||
>
|
||||
<Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
v-hasPermi="['system:dict:delete']"
|
||||
@click="delTypeList(row.id, false)"
|
||||
>
|
||||
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</Table>
|
||||
</el-card>
|
||||
<el-card class="w-1/2 dict" style="margin-left: 10px" :gutter="12" shadow="hover">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>字典数据</span>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 列表 -->
|
||||
<div v-if="!tableTypeSelect">
|
||||
<span>请从左侧选择</span>
|
||||
</div>
|
||||
<div v-if="tableTypeSelect">
|
||||
<Search
|
||||
:schema="DictDataSchemas.allSchemas.searchSchema"
|
||||
@search="setDataSearchParams"
|
||||
@reset="setDataSearchParams"
|
||||
/>
|
||||
<!-- 操作工具栏 -->
|
||||
<div class="mb-10px">
|
||||
<el-button type="primary" v-hasPermi="['system:dict:create']" @click="handleDataCreate">
|
||||
<Icon icon="ep:zoom-in" class="mr-1px" /> {{ t('action.add') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<Table
|
||||
:columns="DictDataSchemas.allSchemas.tableColumns"
|
||||
:selection="false"
|
||||
:data="dataTableObject.tableList"
|
||||
:loading="dataTableObject.loading"
|
||||
:pagination="{
|
||||
total: dataTableObject.total
|
||||
}"
|
||||
v-model:pageSize="dataTableObject.pageSize"
|
||||
v-model:currentPage="dataTableObject.currentPage"
|
||||
@register="dataRegister"
|
||||
>
|
||||
<template #status="{ row }">
|
||||
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
v-hasPermi="['system:dict:update']"
|
||||
@click="handleDataUpdate(row)"
|
||||
>
|
||||
<Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
v-hasPermi="['system:dict:delete']"
|
||||
@click="delDataList(row.id, false)"
|
||||
>
|
||||
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</Table>
|
||||
</div>
|
||||
</el-card>
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle">
|
||||
<Form
|
||||
v-if="['typeCreate', 'typeUpdate'].includes(actionType)"
|
||||
:schema="DictTypeSchemas.allSchemas.formSchema"
|
||||
:rules="DictTypeSchemas.dictTypeRules"
|
||||
ref="typeFormRef"
|
||||
/>
|
||||
<Form
|
||||
v-if="['dataCreate', 'dataUpdate'].includes(actionType)"
|
||||
:schema="DictDataSchemas.allSchemas.formSchema"
|
||||
:rules="DictDataSchemas.dictDataRules"
|
||||
ref="dataFormRef"
|
||||
/>
|
||||
<!-- 操作按钮 -->
|
||||
<template #footer>
|
||||
<el-button
|
||||
v-if="['typeCreate', 'typeUpdate'].includes(actionType)"
|
||||
type="primary"
|
||||
:loading="actionLoading"
|
||||
@click="submitTypeForm"
|
||||
>
|
||||
{{ t('action.save') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="['dataCreate', 'dataUpdate'].includes(actionType)"
|
||||
type="primary"
|
||||
:loading="actionLoading"
|
||||
@click="submitDataForm"
|
||||
>
|
||||
{{ t('action.save') }}
|
||||
</el-button>
|
||||
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -60,9 +60,9 @@
|
||||
<template #footer>
|
||||
<XButton
|
||||
v-if="['create', 'update'].includes(actionType)"
|
||||
:loading="actionLoading"
|
||||
:title="t('action.save')"
|
||||
type="primary"
|
||||
:title="t('action.save')"
|
||||
:loading="actionLoading"
|
||||
@click="submitForm"
|
||||
/>
|
||||
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
|
||||
|
@ -17,7 +17,7 @@ const crudSchemas = reactive<VxeCrudSchema[]>([
|
||||
{
|
||||
title: t('common.index'),
|
||||
field: 'id',
|
||||
type: 'index',
|
||||
type: 'seq',
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user