Vue3 重构:REVIEW 错误码

This commit is contained in:
YunaiV 2023-03-20 08:53:28 +08:00
parent 7534a08315
commit 812300cc04
2 changed files with 15 additions and 4 deletions

View File

@ -74,8 +74,6 @@ defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗
/** 提交表单 */ /** 提交表单 */
const emit = defineEmits(['success']) // success const emit = defineEmits(['success']) // success
/** 提交按钮 */
const submitForm = async () => { const submitForm = async () => {
// //
if (!formRef) return if (!formRef) return

View File

@ -1,7 +1,13 @@
<template> <template>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<content-wrap> <content-wrap>
<el-form :model="queryParams" ref="queryFormRef" class="-mb-15px" :inline="true"> <el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="90px"
>
<el-form-item label="错误码类型" prop="type"> <el-form-item label="错误码类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择错误码类型" clearable> <el-select v-model="queryParams.type" placeholder="请选择错误码类型" clearable>
<el-option <el-option
@ -9,6 +15,7 @@
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
class="!w-240px"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -18,6 +25,7 @@
placeholder="请输入应用名" placeholder="请输入应用名"
clearable clearable
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
class="!w-240px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="错误码编码" prop="code"> <el-form-item label="错误码编码" prop="code">
@ -34,6 +42,7 @@
placeholder="请输入错误码提示" placeholder="请输入错误码提示"
clearable clearable
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
class="!w-240px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="创建时间" prop="createTime"> <el-form-item label="创建时间" prop="createTime">
@ -44,6 +53,7 @@
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -68,6 +78,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</content-wrap> </content-wrap>
<!-- 列表 --> <!-- 列表 -->
<content-wrap> <content-wrap>
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
@ -118,6 +129,7 @@
@pagination="getList" @pagination="getList"
/> />
</content-wrap> </content-wrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<error-code-form ref="modalRef" @success="getList" /> <error-code-form ref="modalRef" @success="getList" />
</template> </template>
@ -194,6 +206,7 @@ const handleDelete = async (id: number) => {
await getList() await getList()
} catch {} } catch {}
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
const handleExport = async () => { const handleExport = async () => {
try { try {
@ -202,7 +215,7 @@ const handleExport = async () => {
// //
exportLoading.value = true exportLoading.value = true
const data = await ErrorCodeApi.excelErrorCodeApi(queryParams) const data = await ErrorCodeApi.excelErrorCodeApi(queryParams)
download.excel(data, '参数配置.xls') download.excel(data, '错误码.xls')
} catch { } catch {
} finally { } finally {
exportLoading.value = false exportLoading.value = false