From a3616cdbf3c28e471f254459e017cb21840b2e78 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 29 Jan 2024 11:17:06 +0800
Subject: [PATCH] 组织机构中删除按钮的处理
---
src/views/system/dept.vue | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/views/system/dept.vue b/src/views/system/dept.vue
index fa2e2ae..b5b89c8 100644
--- a/src/views/system/dept.vue
+++ b/src/views/system/dept.vue
@@ -6,15 +6,21 @@
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
@refresh-change="refreshChange" @on-load="onLoad" @tree-load="treeLoad">
<template slot="menuLeft">
- <el-button type="danger" size="small" icon="el-icon-delete" v-if="permission.dept_delete" plain
+ <el-button type="danger" size="small" icon="el-icon-delete" v-if="permission.dept_delete_all" plain
@click="handleDelete">删 除
</el-button>
</template>
- <template slot-scope="scope" slot="menu">
- <el-button type="text" icon="el-icon-circle-plus-outline" size="small"
- @click.stop="handleAdd(scope.row, scope.index)" v-if="permission.add_children">新增子项
+
+ <template slot-scope="{row, size, index}" slot="menu">
+ <el-button type="text" icon="el-icon-delete" :size="size" @click.stop="$refs.crud.rowDel(row, index)"
+ v-if="permission.dept_delete && showCurRowDelete(row)">删除
+ </el-button>
+
+ <el-button type="text" icon="el-icon-circle-plus-outline" :size="size" @click.stop="handleAdd(row, index)"
+ v-if="permission.add_children">新增子项
</el-button>
</template>
+
<template slot-scope="{row}" slot="deptCategory">
<el-tag>{{ row.deptCategoryName }}</el-tag>
</template>
@@ -187,7 +193,7 @@
return {
addBtn: this.vaildData(this.permission.dept_add, false),
viewBtn: this.vaildData(this.permission.dept_view, false),
- delBtn: this.vaildData(this.permission.dept_delete, false),
+ delBtn: this.vaildData(false, true),
editBtn: this.vaildData(this.permission.dept_edit, false)
}
},
@@ -197,6 +203,12 @@
ids.push(ele.id)
})
return ids.join(",")
+ },
+
+ showCurRowDelete () {
+ return (row) => {
+ return !(row.id == this.userInfo.dept_id)
+ }
}
},
methods: {
--
Gitblit v1.9.3