From 36fae5c926e2c52c0e1c5d92adfc15352e242ee9 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期三, 18 八月 2021 19:14:26 +0800
Subject: [PATCH] update 优化 OSS 模块与上传组件 异常处理
---
ruoyi-ui/src/views/system/post/index.vue | 48 +++++++++++++++++++++---------------------------
1 files changed, 21 insertions(+), 27 deletions(-)
diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue
index bd2f071..f5b77c7 100644
--- a/ruoyi-ui/src/views/system/post/index.vue
+++ b/ruoyi-ui/src/views/system/post/index.vue
@@ -1,6 +1,6 @@
<template>
<div class="app-container">
- <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="宀椾綅缂栫爜" prop="postCode">
<el-input
v-model="queryParams.postCode"
@@ -39,6 +39,7 @@
<el-col :span="1.5">
<el-button
type="primary"
+ plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
@@ -48,6 +49,7 @@
<el-col :span="1.5">
<el-button
type="success"
+ plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@@ -58,6 +60,7 @@
<el-col :span="1.5">
<el-button
type="danger"
+ plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@@ -68,12 +71,15 @@
<el-col :span="1.5">
<el-button
type="warning"
+ plain
icon="el-icon-download"
size="mini"
+ :loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:post:export']"
>瀵煎嚭</el-button>
</el-col>
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
@@ -150,7 +156,8 @@
</template>
<script>
-import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/api/system/post";
+import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post";
+import { downLoadExcel } from "@/utils/download";
export default {
name: "Post",
@@ -158,12 +165,16 @@
return {
// 閬僵灞�
loading: true,
+ // 瀵煎嚭閬僵灞�
+ exportLoading: false,
// 閫変腑鏁扮粍
ids: [],
// 闈炲崟涓鐢�
single: true,
// 闈炲涓鐢�
multiple: true,
+ // 鏄剧ず鎼滅储鏉′欢
+ showSearch: true,
// 鎬绘潯鏁�
total: 0,
// 宀椾綅琛ㄦ牸鏁版嵁
@@ -273,23 +284,15 @@
if (valid) {
if (this.form.postId != undefined) {
updatePost(this.form).then(response => {
- if (response.code === 200) {
- this.msgSuccess("淇敼鎴愬姛");
- this.open = false;
- this.getList();
- } else {
- this.msgError(response.msg);
- }
+ this.msgSuccess("淇敼鎴愬姛");
+ this.open = false;
+ this.getList();
});
} else {
addPost(this.form).then(response => {
- if (response.code === 200) {
- this.msgSuccess("鏂板鎴愬姛");
- this.open = false;
- this.getList();
- } else {
- this.msgError(response.msg);
- }
+ this.msgSuccess("鏂板鎴愬姛");
+ this.open = false;
+ this.getList();
});
}
}
@@ -307,20 +310,11 @@
}).then(() => {
this.getList();
this.msgSuccess("鍒犻櫎鎴愬姛");
- }).catch(function() {});
+ }).catch(() => {});
},
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
handleExport() {
- const queryParams = this.queryParams;
- this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夊矖浣嶆暟鎹」?', "璀﹀憡", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning"
- }).then(function() {
- return exportPost(queryParams);
- }).then(response => {
- this.download(response.msg);
- }).catch(function() {});
+ downLoadExcel('/system/post/export', this.queryParams);
}
}
};
--
Gitblit v1.9.3