|
@@ -33,15 +33,41 @@
|
|
|
<el-tag type="danger" v-if="scope.row.state == 1">停用</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="范围" align="center" prop="rangeNum" width="140">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag type="success" v-if="scope.row.rangeNum == 0">个人</el-tag>
|
|
|
+ <el-tag type="danger" v-if="scope.row.rangeNum == 1">科室</el-tag>
|
|
|
+ <el-tag type="danger" v-if="scope.row.rangeNum == 2">全院</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="创建人" align="center" prop="createBy" width="130" />
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="160" />
|
|
|
<el-table-column label="所属科室" align="center" prop="deptName" width="160" />
|
|
|
<el-table-column label="操作" align="center" width="200">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button size="mini" type="text" icon="el-icon-edit" @click="op('edit', scope.row)" v-hasPermi="['work:knowledge:edit']">修改</el-button>
|
|
|
- <el-button size="mini" type="text" icon="el-icon-delete" @click="del(scope.row)" v-hasPermi="['work:knowledge:remove']">删除</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.userId === currentUserId || isAdmin"
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="op('edit', scope.row)"
|
|
|
+ v-hasPermi="['work:knowledge:edit']"
|
|
|
+ >
|
|
|
+ 修改
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.userId === currentUserId || isAdmin"
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="del(scope.row)"
|
|
|
+ v-hasPermi="['work:knowledge:remove']"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+
|
|
|
<template slot="empty">
|
|
|
<el-empty></el-empty>
|
|
|
</template>
|
|
@@ -52,6 +78,7 @@
|
|
|
|
|
|
<script>
|
|
|
import edit from './edit';
|
|
|
+import {getInfo} from "@/api/login";
|
|
|
export default {
|
|
|
dicts: ['knowledge_type'],
|
|
|
name: 'Knowledge',
|
|
@@ -63,14 +90,29 @@ export default {
|
|
|
type: null,
|
|
|
title: null,
|
|
|
orderByColumn: 'id', //排序字段
|
|
|
- isAsc: 'desc' //排序方式
|
|
|
- }
|
|
|
+ isAsc: 'desc', //排序方式
|
|
|
+ },
|
|
|
+ isAdmin: false,
|
|
|
+ currentUserId:null
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.getList();
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ this.fetchCurrentUser(); // 获取当前用户信息
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ fetchCurrentUser() {
|
|
|
+ getInfo()
|
|
|
+ .then(response => {
|
|
|
+ this.currentUserId = response.user.userId;
|
|
|
+ this.isAdmin = response.user.admin;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('获取用户信息失败:', error);
|
|
|
+ });
|
|
|
+ },
|
|
|
getList() {
|
|
|
if (this.dateRange) {
|
|
|
this.queryParams.dateBegin = this.dateRange[0];
|