From 4bbdc1e87bc4df9e7d41b50388364155720c8723 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期日, 15 三月 2020 20:25:58 +0800
Subject: [PATCH] 修复TagsView组件中,鼠标滚轮按下的时候,可以关闭不可关闭的tag
---
ruoyi-ui/src/views/system/post/index.vue | 107 +++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 91 insertions(+), 16 deletions(-)
diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue
index b1f0c9f..ffd3f42 100644
--- a/ruoyi-ui/src/views/system/post/index.vue
+++ b/ruoyi-ui/src/views/system/post/index.vue
@@ -1,7 +1,7 @@
<template>
<div class="app-container">
- <el-form :inline="true" label-width="68px">
- <el-form-item label="宀椾綅缂栫爜">
+ <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
+ <el-form-item label="宀椾綅缂栫爜" prop="postCode">
<el-input
v-model="queryParams.postCode"
placeholder="璇疯緭鍏ュ矖浣嶇紪鐮�"
@@ -10,7 +10,7 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
- <el-form-item label="宀椾綅鍚嶇О">
+ <el-form-item label="宀椾綅鍚嶇О" prop="postName">
<el-input
v-model="queryParams.postName"
placeholder="璇疯緭鍏ュ矖浣嶅悕绉�"
@@ -19,7 +19,7 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
- <el-form-item label="鐘舵��">
+ <el-form-item label="鐘舵��" prop="status">
<el-select v-model="queryParams.status" placeholder="宀椾綅鐘舵��" clearable size="small">
<el-option
v-for="dict in statusOptions"
@@ -31,11 +31,53 @@
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
- <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:post:add']">鏂板</el-button>
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
</el-form-item>
</el-form>
- <el-table v-loading="loading" :data="postList">
+ <el-row :gutter="10" class="mb8">
+ <el-col :span="1.5">
+ <el-button
+ type="primary"
+ icon="el-icon-plus"
+ size="mini"
+ @click="handleAdd"
+ v-hasPermi="['system:post:add']"
+ >鏂板</el-button>
+ </el-col>
+ <el-col :span="1.5">
+ <el-button
+ type="success"
+ icon="el-icon-edit"
+ size="mini"
+ :disabled="single"
+ @click="handleUpdate"
+ v-hasPermi="['system:post:edit']"
+ >淇敼</el-button>
+ </el-col>
+ <el-col :span="1.5">
+ <el-button
+ type="danger"
+ icon="el-icon-delete"
+ size="mini"
+ :disabled="multiple"
+ @click="handleDelete"
+ v-hasPermi="['system:post:remove']"
+ >鍒犻櫎</el-button>
+ </el-col>
+ <el-col :span="1.5">
+ <el-button
+ type="warning"
+ icon="el-icon-download"
+ size="mini"
+ @click="handleExport"
+ v-hasPermi="['system:post:export']"
+ >瀵煎嚭</el-button>
+ </el-col>
+ </el-row>
+
+ <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
+ <el-table-column type="selection" width="55" align="center" />
<el-table-column label="宀椾綅缂栧彿" align="center" prop="postId" />
<el-table-column label="宀椾綅缂栫爜" align="center" prop="postCode" />
<el-table-column label="宀椾綅鍚嶇О" align="center" prop="postName" />
@@ -43,15 +85,15 @@
<el-table-column label="鐘舵��" align="center" prop="status" :formatter="statusFormat" />
<el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180">
<template slot-scope="scope">
- <span>{{ dateFormat(scope.row.createTime) }}</span>
+ <span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
+ <el-button
+ size="mini"
+ type="text"
+ icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:post:edit']"
>淇敼</el-button>
@@ -65,7 +107,7 @@
</template>
</el-table-column>
</el-table>
-
+
<pagination
v-show="total>0"
:total="total"
@@ -108,13 +150,20 @@
</template>
<script>
-import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post";
+import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/api/system/post";
export default {
+ name: "Post",
data() {
return {
// 閬僵灞�
loading: true,
+ // 閫変腑鏁扮粍
+ ids: [],
+ // 闈炲崟涓鐢�
+ single: true,
+ // 闈炲涓鐢�
+ multiple: true,
// 鎬绘潯鏁�
total: 0,
// 宀椾綅琛ㄦ牸鏁版嵁
@@ -191,6 +240,17 @@
this.queryParams.pageNum = 1;
this.getList();
},
+ /** 閲嶇疆鎸夐挳鎿嶄綔 */
+ resetQuery() {
+ this.resetForm("queryForm");
+ this.handleQuery();
+ },
+ // 澶氶�夋閫変腑鏁版嵁
+ handleSelectionChange(selection) {
+ this.ids = selection.map(item => item.postId)
+ this.single = selection.length!=1
+ this.multiple = !selection.length
+ },
/** 鏂板鎸夐挳鎿嶄綔 */
handleAdd() {
this.reset();
@@ -200,7 +260,8 @@
/** 淇敼鎸夐挳鎿嶄綔 */
handleUpdate(row) {
this.reset();
- getPost(row.postId).then(response => {
+ const postId = row.postId || this.ids
+ getPost(postId).then(response => {
this.form = response.data;
this.open = true;
this.title = "淇敼宀椾綅";
@@ -236,16 +297,30 @@
},
/** 鍒犻櫎鎸夐挳鎿嶄綔 */
handleDelete(row) {
- this.$confirm('鏄惁纭鍒犻櫎宀椾綅鍚嶇О涓�"' + row.postName + '"鐨勬暟鎹」?', "璀﹀憡", {
+ const postIds = row.postId || this.ids;
+ this.$confirm('鏄惁纭鍒犻櫎宀椾綅缂栧彿涓�"' + postIds + '"鐨勬暟鎹」?', "璀﹀憡", {
confirmButtonText: "纭畾",
cancelButtonText: "鍙栨秷",
type: "warning"
}).then(function() {
- return delPost(row.postId);
+ return delPost(postIds);
}).then(() => {
this.getList();
this.msgSuccess("鍒犻櫎鎴愬姛");
}).catch(function() {});
+ },
+ /** 瀵煎嚭鎸夐挳鎿嶄綔 */
+ handleExport() {
+ const queryParams = this.queryParams;
+ this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夊矖浣嶆暟鎹」?', "璀﹀憡", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ }).then(function() {
+ return exportPost(queryParams);
+ }).then(response => {
+ this.download(response.msg);
+ }).catch(function() {});
}
}
};
--
Gitblit v1.9.3