Commit d2a4eb92547c26388d233d0a1cb3b0c9b902e85c
1 parent
d22620a7
perf: dict
Showing
6 changed files
with
161 additions
and
165 deletions
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts
| ... | ... | @@ -121,10 +121,10 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema[]): VxeFormItemProps[] => |
| 121 | 121 | props: { placeholder: t('common.selectText') } |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | - | |
| 125 | 124 | const searchSchemaItem = { |
| 126 | 125 | // 默认为 input |
| 127 | - span: 6, | |
| 126 | + span: 8, | |
| 127 | + folding: searchSchema.length > 2, | |
| 128 | 128 | itemRender: itemRender, |
| 129 | 129 | ...schemaItem.search, |
| 130 | 130 | field: schemaItem.field, |
| ... | ... | @@ -140,7 +140,7 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema[]): VxeFormItemProps[] => |
| 140 | 140 | const buttons: VxeFormItemProps = { |
| 141 | 141 | span: 24, |
| 142 | 142 | align: 'center', |
| 143 | - collapseNode: true, | |
| 143 | + collapseNode: searchSchema.length > 3, | |
| 144 | 144 | itemRender: { |
| 145 | 145 | name: '$buttons', |
| 146 | 146 | children: [ | ... | ... |
yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts
| ... | ... | @@ -38,7 +38,7 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => { |
| 38 | 38 | const gridOptions = reactive<VxeGridProps>({ |
| 39 | 39 | loading: true, |
| 40 | 40 | size: currentSize as any, |
| 41 | - height: 800, | |
| 41 | + height: 700, | |
| 42 | 42 | rowConfig: { |
| 43 | 43 | isCurrent: true, // 当鼠标点击行时,是否要高亮当前行 |
| 44 | 44 | isHover: true // 当鼠标移到行时,是否要高亮当前行 |
| ... | ... | @@ -97,9 +97,11 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => { |
| 97 | 97 | } |
| 98 | 98 | }) |
| 99 | 99 | const delList = (ids: string | number | string[] | number[]) => { |
| 100 | - message.delConfirm().then(() => { | |
| 101 | - config?.delListApi && config?.delListApi(ids) | |
| 102 | - message.success(t('common.delSuccess')) | |
| 100 | + return new Promise(async () => { | |
| 101 | + message.delConfirm().then(() => { | |
| 102 | + config?.delListApi && config?.delListApi(ids) | |
| 103 | + message.success(t('common.delSuccess')) | |
| 104 | + }) | |
| 103 | 105 | }) |
| 104 | 106 | } |
| 105 | 107 | return { | ... | ... |
yudao-ui-admin-vue3/src/plugins/vxeTable/index.ts
| ... | ... | @@ -7,7 +7,6 @@ import enUS from 'vxe-table/lib/locale/lang/en-US' |
| 7 | 7 | import { |
| 8 | 8 | // 全局对象 |
| 9 | 9 | VXETable, |
| 10 | - | |
| 11 | 10 | // 表格功能 |
| 12 | 11 | Filter, |
| 13 | 12 | Edit, |
| ... | ... | @@ -15,7 +14,6 @@ import { |
| 15 | 14 | Export, |
| 16 | 15 | Keyboard, |
| 17 | 16 | Validator, |
| 18 | - | |
| 19 | 17 | // 可选组件 |
| 20 | 18 | Icon, |
| 21 | 19 | Column, |
| ... | ... | @@ -42,7 +40,6 @@ import { |
| 42 | 40 | Modal, |
| 43 | 41 | List, |
| 44 | 42 | Pulldown, |
| 45 | - | |
| 46 | 43 | // 表格 |
| 47 | 44 | Table |
| 48 | 45 | } from 'vxe-table' | ... | ... |
yudao-ui-admin-vue3/src/views/system/dict/index.vue
| 1 | +<template> | |
| 2 | + <div class="flex"> | |
| 3 | + <el-card class="w-1/2 dict" :gutter="12" shadow="always"> | |
| 4 | + <template #header> | |
| 5 | + <div class="card-header"> | |
| 6 | + <span>字典分类</span> | |
| 7 | + </div> | |
| 8 | + </template> | |
| 9 | + <Search | |
| 10 | + :schema="DictTypeSchemas.allSchemas.searchSchema" | |
| 11 | + @search="setTypeSearchParams" | |
| 12 | + @reset="setTypeSearchParams" | |
| 13 | + /> | |
| 14 | + <!-- 操作工具栏 --> | |
| 15 | + <div class="mb-10px"> | |
| 16 | + <XButton | |
| 17 | + type="primary" | |
| 18 | + preIcon="ep:zoom-in" | |
| 19 | + :title="t('action.add')" | |
| 20 | + v-hasPermi="['system:dict:create']" | |
| 21 | + @click="handleTypeCreate()" | |
| 22 | + /> | |
| 23 | + </div> | |
| 24 | + <!-- 列表 --> | |
| 25 | + <Table | |
| 26 | + @row-click="onClickType" | |
| 27 | + :columns="DictTypeSchemas.allSchemas.tableColumns" | |
| 28 | + :selection="false" | |
| 29 | + :data="typeTableObject.tableList" | |
| 30 | + :loading="typeTableObject.loading" | |
| 31 | + :pagination="{ | |
| 32 | + total: typeTableObject.total | |
| 33 | + }" | |
| 34 | + :highlight-current-row="true" | |
| 35 | + v-model:pageSize="typeTableObject.pageSize" | |
| 36 | + v-model:currentPage="typeTableObject.currentPage" | |
| 37 | + @register="typeRegister" | |
| 38 | + > | |
| 39 | + <template #status="{ row }"> | |
| 40 | + <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> | |
| 41 | + </template> | |
| 42 | + <template #action="{ row }"> | |
| 43 | + <XTextButton | |
| 44 | + preIcon="ep:edit" | |
| 45 | + :title="t('action.edit')" | |
| 46 | + v-hasPermi="['system:dict:update']" | |
| 47 | + @click="handleTypeUpdate(row)" | |
| 48 | + /> | |
| 49 | + <XTextButton | |
| 50 | + preIcon="ep:delete" | |
| 51 | + :title="t('action.del')" | |
| 52 | + v-hasPermi="['system:dict:delete']" | |
| 53 | + @click="delTypeList(row.id, false)" | |
| 54 | + /> | |
| 55 | + </template> | |
| 56 | + </Table> | |
| 57 | + </el-card> | |
| 58 | + <el-card class="w-1/2 dict" style="margin-left: 10px" :gutter="12" shadow="hover"> | |
| 59 | + <template #header> | |
| 60 | + <div class="card-header"> | |
| 61 | + <span>字典数据</span> | |
| 62 | + </div> | |
| 63 | + </template> | |
| 64 | + <!-- 列表 --> | |
| 65 | + <div v-if="!tableTypeSelect"> | |
| 66 | + <span>请从左侧选择</span> | |
| 67 | + </div> | |
| 68 | + <div v-if="tableTypeSelect"> | |
| 69 | + <Search | |
| 70 | + :schema="DictDataSchemas.allSchemas.searchSchema" | |
| 71 | + @search="setDataSearchParams" | |
| 72 | + @reset="setDataSearchParams" | |
| 73 | + /> | |
| 74 | + <!-- 操作工具栏 --> | |
| 75 | + <div class="mb-10px"> | |
| 76 | + <XButton | |
| 77 | + type="primary" | |
| 78 | + preIcon="ep:zoom-in" | |
| 79 | + :title="t('action.add')" | |
| 80 | + v-hasPermi="['system:dict:create']" | |
| 81 | + @click="handleDataCreate()" | |
| 82 | + /> | |
| 83 | + </div> | |
| 84 | + <Table | |
| 85 | + :columns="DictDataSchemas.allSchemas.tableColumns" | |
| 86 | + :selection="false" | |
| 87 | + :data="dataTableObject.tableList" | |
| 88 | + :loading="dataTableObject.loading" | |
| 89 | + :pagination="{ | |
| 90 | + total: dataTableObject.total | |
| 91 | + }" | |
| 92 | + v-model:pageSize="dataTableObject.pageSize" | |
| 93 | + v-model:currentPage="dataTableObject.currentPage" | |
| 94 | + @register="dataRegister" | |
| 95 | + > | |
| 96 | + <template #status="{ row }"> | |
| 97 | + <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> | |
| 98 | + </template> | |
| 99 | + <template #action="{ row }"> | |
| 100 | + <XTextButton | |
| 101 | + v-hasPermi="['system:dict:update']" | |
| 102 | + preIcon="ep:edit" | |
| 103 | + :title="t('action.edit')" | |
| 104 | + @click="handleDataUpdate(row)" | |
| 105 | + /> | |
| 106 | + <XTextButton | |
| 107 | + v-hasPermi="['system:dict:delete']" | |
| 108 | + preIcon="ep:delete" | |
| 109 | + :title="t('action.del')" | |
| 110 | + @click="delDataList(row.id, false)" | |
| 111 | + /> | |
| 112 | + </template> | |
| 113 | + </Table> | |
| 114 | + </div> | |
| 115 | + </el-card> | |
| 116 | + <Dialog v-model="dialogVisible" :title="dialogTitle"> | |
| 117 | + <Form | |
| 118 | + v-if="['typeCreate', 'typeUpdate'].includes(actionType)" | |
| 119 | + :schema="DictTypeSchemas.allSchemas.formSchema" | |
| 120 | + :rules="DictTypeSchemas.dictTypeRules" | |
| 121 | + ref="typeFormRef" | |
| 122 | + /> | |
| 123 | + <Form | |
| 124 | + v-if="['dataCreate', 'dataUpdate'].includes(actionType)" | |
| 125 | + :schema="DictDataSchemas.allSchemas.formSchema" | |
| 126 | + :rules="DictDataSchemas.dictDataRules" | |
| 127 | + ref="dataFormRef" | |
| 128 | + /> | |
| 129 | + <!-- 操作按钮 --> | |
| 130 | + <template #footer> | |
| 131 | + <XButton | |
| 132 | + v-if="['typeCreate', 'typeUpdate'].includes(actionType)" | |
| 133 | + type="primary" | |
| 134 | + :title="t('action.save')" | |
| 135 | + :loading="actionLoading" | |
| 136 | + @click="submitTypeForm" | |
| 137 | + /> | |
| 138 | + <XButton | |
| 139 | + v-if="['dataCreate', 'dataUpdate'].includes(actionType)" | |
| 140 | + type="primary" | |
| 141 | + :title="t('action.save')" | |
| 142 | + :loading="actionLoading" | |
| 143 | + @click="submitDataForm" | |
| 144 | + /> | |
| 145 | + <XButton :title="t('dialog.close')" @click="dialogVisible = false" /> | |
| 146 | + </template> | |
| 147 | + </Dialog> | |
| 148 | + </div> | |
| 149 | +</template> | |
| 1 | 150 | <script setup lang="ts"> |
| 2 | 151 | import { ref, unref, onMounted } from 'vue' |
| 3 | 152 | import { DICT_TYPE } from '@/utils/dict' |
| ... | ... | @@ -148,155 +297,3 @@ onMounted(async () => { |
| 148 | 297 | typeTableObject.tableList[0] && onClickType(typeTableObject.tableList[0]) |
| 149 | 298 | }) |
| 150 | 299 | </script> |
| 151 | - | |
| 152 | -<template> | |
| 153 | - <div class="flex"> | |
| 154 | - <el-card class="w-1/2 dict" :gutter="12" shadow="always"> | |
| 155 | - <template #header> | |
| 156 | - <div class="card-header"> | |
| 157 | - <span>字典分类</span> | |
| 158 | - </div> | |
| 159 | - </template> | |
| 160 | - <Search | |
| 161 | - :schema="DictTypeSchemas.allSchemas.searchSchema" | |
| 162 | - @search="setTypeSearchParams" | |
| 163 | - @reset="setTypeSearchParams" | |
| 164 | - /> | |
| 165 | - <!-- 操作工具栏 --> | |
| 166 | - <div class="mb-10px"> | |
| 167 | - <el-button type="primary" v-hasPermi="['system:dict:create']" @click="handleTypeCreate"> | |
| 168 | - <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }} | |
| 169 | - </el-button> | |
| 170 | - </div> | |
| 171 | - <!-- 列表 --> | |
| 172 | - <Table | |
| 173 | - @row-click="onClickType" | |
| 174 | - :columns="DictTypeSchemas.allSchemas.tableColumns" | |
| 175 | - :selection="false" | |
| 176 | - :data="typeTableObject.tableList" | |
| 177 | - :loading="typeTableObject.loading" | |
| 178 | - :pagination="{ | |
| 179 | - total: typeTableObject.total | |
| 180 | - }" | |
| 181 | - :highlight-current-row="true" | |
| 182 | - v-model:pageSize="typeTableObject.pageSize" | |
| 183 | - v-model:currentPage="typeTableObject.currentPage" | |
| 184 | - @register="typeRegister" | |
| 185 | - > | |
| 186 | - <template #status="{ row }"> | |
| 187 | - <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> | |
| 188 | - </template> | |
| 189 | - <template #action="{ row }"> | |
| 190 | - <el-button | |
| 191 | - link | |
| 192 | - type="primary" | |
| 193 | - v-hasPermi="['system:dict:update']" | |
| 194 | - @click="handleTypeUpdate(row)" | |
| 195 | - > | |
| 196 | - <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }} | |
| 197 | - </el-button> | |
| 198 | - <el-button | |
| 199 | - link | |
| 200 | - type="primary" | |
| 201 | - v-hasPermi="['system:dict:delete']" | |
| 202 | - @click="delTypeList(row.id, false)" | |
| 203 | - > | |
| 204 | - <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} | |
| 205 | - </el-button> | |
| 206 | - </template> | |
| 207 | - </Table> | |
| 208 | - </el-card> | |
| 209 | - <el-card class="w-1/2 dict" style="margin-left: 10px" :gutter="12" shadow="hover"> | |
| 210 | - <template #header> | |
| 211 | - <div class="card-header"> | |
| 212 | - <span>字典数据</span> | |
| 213 | - </div> | |
| 214 | - </template> | |
| 215 | - <!-- 列表 --> | |
| 216 | - <div v-if="!tableTypeSelect"> | |
| 217 | - <span>请从左侧选择</span> | |
| 218 | - </div> | |
| 219 | - <div v-if="tableTypeSelect"> | |
| 220 | - <Search | |
| 221 | - :schema="DictDataSchemas.allSchemas.searchSchema" | |
| 222 | - @search="setDataSearchParams" | |
| 223 | - @reset="setDataSearchParams" | |
| 224 | - /> | |
| 225 | - <!-- 操作工具栏 --> | |
| 226 | - <div class="mb-10px"> | |
| 227 | - <el-button type="primary" v-hasPermi="['system:dict:create']" @click="handleDataCreate"> | |
| 228 | - <Icon icon="ep:zoom-in" class="mr-1px" /> {{ t('action.add') }} | |
| 229 | - </el-button> | |
| 230 | - </div> | |
| 231 | - <Table | |
| 232 | - :columns="DictDataSchemas.allSchemas.tableColumns" | |
| 233 | - :selection="false" | |
| 234 | - :data="dataTableObject.tableList" | |
| 235 | - :loading="dataTableObject.loading" | |
| 236 | - :pagination="{ | |
| 237 | - total: dataTableObject.total | |
| 238 | - }" | |
| 239 | - v-model:pageSize="dataTableObject.pageSize" | |
| 240 | - v-model:currentPage="dataTableObject.currentPage" | |
| 241 | - @register="dataRegister" | |
| 242 | - > | |
| 243 | - <template #status="{ row }"> | |
| 244 | - <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> | |
| 245 | - </template> | |
| 246 | - <template #action="{ row }"> | |
| 247 | - <el-button | |
| 248 | - link | |
| 249 | - type="primary" | |
| 250 | - v-hasPermi="['system:dict:update']" | |
| 251 | - @click="handleDataUpdate(row)" | |
| 252 | - > | |
| 253 | - <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }} | |
| 254 | - </el-button> | |
| 255 | - <el-button | |
| 256 | - link | |
| 257 | - type="primary" | |
| 258 | - v-hasPermi="['system:dict:delete']" | |
| 259 | - @click="delDataList(row.id, false)" | |
| 260 | - > | |
| 261 | - <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} | |
| 262 | - </el-button> | |
| 263 | - </template> | |
| 264 | - </Table> | |
| 265 | - </div> | |
| 266 | - </el-card> | |
| 267 | - <Dialog v-model="dialogVisible" :title="dialogTitle"> | |
| 268 | - <Form | |
| 269 | - v-if="['typeCreate', 'typeUpdate'].includes(actionType)" | |
| 270 | - :schema="DictTypeSchemas.allSchemas.formSchema" | |
| 271 | - :rules="DictTypeSchemas.dictTypeRules" | |
| 272 | - ref="typeFormRef" | |
| 273 | - /> | |
| 274 | - <Form | |
| 275 | - v-if="['dataCreate', 'dataUpdate'].includes(actionType)" | |
| 276 | - :schema="DictDataSchemas.allSchemas.formSchema" | |
| 277 | - :rules="DictDataSchemas.dictDataRules" | |
| 278 | - ref="dataFormRef" | |
| 279 | - /> | |
| 280 | - <!-- 操作按钮 --> | |
| 281 | - <template #footer> | |
| 282 | - <el-button | |
| 283 | - v-if="['typeCreate', 'typeUpdate'].includes(actionType)" | |
| 284 | - type="primary" | |
| 285 | - :loading="actionLoading" | |
| 286 | - @click="submitTypeForm" | |
| 287 | - > | |
| 288 | - {{ t('action.save') }} | |
| 289 | - </el-button> | |
| 290 | - <el-button | |
| 291 | - v-if="['dataCreate', 'dataUpdate'].includes(actionType)" | |
| 292 | - type="primary" | |
| 293 | - :loading="actionLoading" | |
| 294 | - @click="submitDataForm" | |
| 295 | - > | |
| 296 | - {{ t('action.save') }} | |
| 297 | - </el-button> | |
| 298 | - <el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> | |
| 299 | - </template> | |
| 300 | - </Dialog> | |
| 301 | - </div> | |
| 302 | -</template> | ... | ... |
yudao-ui-admin-vue3/src/views/system/post/index.vue
| ... | ... | @@ -60,9 +60,9 @@ |
| 60 | 60 | <template #footer> |
| 61 | 61 | <XButton |
| 62 | 62 | v-if="['create', 'update'].includes(actionType)" |
| 63 | - :loading="actionLoading" | |
| 64 | - :title="t('action.save')" | |
| 65 | 63 | type="primary" |
| 64 | + :title="t('action.save')" | |
| 65 | + :loading="actionLoading" | |
| 66 | 66 | @click="submitForm" |
| 67 | 67 | /> |
| 68 | 68 | <XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" /> | ... | ... |