提交 f2606fe7 authored 作者: pengxiaohui's avatar pengxiaohui

增加权限管控

上级 7906dee9
...@@ -34,19 +34,19 @@ export default { ...@@ -34,19 +34,19 @@ export default {
path: '/dashboard', path: '/dashboard',
icon: 'el-icon-data-board', icon: 'el-icon-data-board',
children: [ children: [
{ name: '数据总览', path: '/dashboard', tag: '' } { name: '数据总览', path: '/dashboard', tag: 'console-index' }
] ]
}, },
{ {
tag: 'menu_school', tag: '',
name: '教务管理', name: '教务管理',
path: '/school/class', path: '/school/class',
icon: 'el-icon-user', icon: 'el-icon-user',
children: [ children: [
{ name: '班级管理', path: '/school/class', tag: '' }, { name: '班级管理', path: '/school/class', tag: 'class-list' },
{ name: '课程管理', path: '/school/course', tag: '' }, { name: '课程管理', path: '/school/course', tag: 'course-list' },
{ name: '考试管理', path: '/school/exam', tag: '' }, { name: '考试管理', path: '/school/exam', tag: 'examination-list' },
{ name: '证书管理', path: '/school/cert', tag: '' }, { name: '证书管理', path: '/school/cert', tag: 'certificate-list' },
// { name: '教师管理', path: '/school/teacher', tag: '' }, // { name: '教师管理', path: '/school/teacher', tag: '' },
// { name: '学员管理', path: '/school/student', tag: '' } // { name: '学员管理', path: '/school/student', tag: '' }
] ]
...@@ -56,8 +56,8 @@ export default { ...@@ -56,8 +56,8 @@ export default {
path: '/personnel/teacher', path: '/personnel/teacher',
icon: 'el-icon-s-custom', icon: 'el-icon-s-custom',
children: [ children: [
{ name: '教工管理', path: '/personnel/teacher', tag: '' }, { name: '教工管理', path: '/personnel/teacher', tag: 'teacher-list' },
{ name: '人员管理', path: '/personnel/student', tag: '' } { name: '人员管理', path: '/personnel/student', tag: 'student-list' }
] ]
}, },
// { // {
...@@ -73,7 +73,7 @@ export default { ...@@ -73,7 +73,7 @@ export default {
icon: 'el-icon-s-check', icon: 'el-icon-s-check',
children: [ children: [
// { name: '事务类型', path: '/audit/type', tag: '' }, // { name: '事务类型', path: '/audit/type', tag: '' },
{ name: '我的审核', path: '/audit/my', tag: '' } { name: '我的审核', path: '/audit/my', tag: 'lobby-list' }
] ]
} }
] ]
......
...@@ -23,4 +23,4 @@ export function multiPass(data) { ...@@ -23,4 +23,4 @@ export function multiPass(data) {
*/ */
export function getAuditDetails(params) { export function getAuditDetails(params) {
return httpRequest.get('/api/lms-financial/school/lobby/view', { params }) return httpRequest.get('/api/lms-financial/school/lobby/view', { params })
} }
\ No newline at end of file
...@@ -88,4 +88,4 @@ export default { ...@@ -88,4 +88,4 @@ export default {
video{ video{
width:100%; width:100%;
} }
</style> </style>
\ No newline at end of file
...@@ -23,11 +23,11 @@ ...@@ -23,11 +23,11 @@
<img :src="row.url" width="120" height="70"> <img :src="row.url" width="120" height="70">
</template> </template>
<template v-slot:table-x="{ row }"> <template v-slot:table-x="{ row }">
<el-button v-if="tabActive !== '0'" type="primary" size="mini" plain @click="onDetails(row)">查看</el-button> <el-button v-if="btnView && tabActive !== '0'" type="primary" size="mini" plain @click="onDetails(row)">查看</el-button>
<el-button v-else type="primary" size="mini" plain @click="onAudit(row)">办理</el-button> <el-button v-if="btnAudit && tabActive === '0'" type="primary" size="mini" plain @click="onAudit(row)">办理</el-button>
</template> </template>
<template #footer> <template #footer>
<div v-if="tabActive === '0'"> <div v-if="tabActive === '0' && btnMultiPass">
已选中 {{multipleSelection.length}} 已选中 {{multipleSelection.length}}
<el-button style="margin-left:15px;" size="mini" :disabled="!multipleSelection.length" @click="fetchMultiPass">一键通过</el-button> <el-button style="margin-left:15px;" size="mini" :disabled="!multipleSelection.length" @click="fetchMultiPass">一键通过</el-button>
</div> </div>
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
</template> </template>
<script> <script>
import AppStudentSelect from '@/components/base/AppStudentSelect.vue'
import AppClassSelect from '@/components/base/AppClassSelect.vue' import AppClassSelect from '@/components/base/AppClassSelect.vue'
import DialogAudit from '../components/DialogAudit.vue' import DialogAudit from '../components/DialogAudit.vue'
import { getAuditList, multiPass } from '../api' import { getAuditList, multiPass } from '../api'
...@@ -53,11 +52,22 @@ export default { ...@@ -53,11 +52,22 @@ export default {
} }
}, },
components: { components: {
AppStudentSelect,
AppClassSelect, AppClassSelect,
DialogAudit DialogAudit
}, },
computed: { computed: {
permissions() {
return this.$store.state.permissions
},
btnMultiPass() {
return !!this.permissions.find(item => item.tag === 'lobby-multiPass')
},
btnAudit() {
return !!this.permissions.find(item => item.tag === 'lobby-update')
},
btnView() {
return !!this.permissions.find(item => item.tag === 'lobby-view')
},
// 列表配置 // 列表配置
tableOptions() { tableOptions() {
return { return {
...@@ -72,7 +82,7 @@ export default { ...@@ -72,7 +82,7 @@ export default {
{ placeholder: '所属班级', slots: 'filter-class' } { placeholder: '所属班级', slots: 'filter-class' }
], ],
columns: [ columns: [
{ type: 'selection', minWidth: '50px', fixed: 'left', visible: this.tabActive === '0'}, { type: 'selection', minWidth: '50px', fixed: 'left', visible: this.tabActive === '0' && this.btnMultiPass },
{ label: '事项', align: 'center', prop: 'type_label' }, { label: '事项', align: 'center', prop: 'type_label' },
{ label: '申请人', align: 'center', prop: 'personal_name' }, { label: '申请人', align: 'center', prop: 'personal_name' },
{ label: '所属班级', align: 'center', prop: 'class_name' }, { label: '所属班级', align: 'center', prop: 'class_name' },
......
<template>
<el-dialog :title="info.title" v-bind="$attrs" v-on="$listeners" width="800px" top="20vh">
<video :src="info.url" controls="controls" autoplay="autoplay"></video>
</el-dialog>
</template>
<script>
export default {
props: {
info: {
type: Object,
default() {
return {}
}
}
},
data() {
return {}
}
}
</script>
<style scoped>
video{
width:100%;
}
</style>
\ No newline at end of file
...@@ -7,11 +7,6 @@ const routes = [ ...@@ -7,11 +7,6 @@ const routes = [
path: '', path: '',
component: () => import('./views/List.vue'), component: () => import('./views/List.vue'),
meta: { title: '工作台' } meta: { title: '工作台' }
},
{
path: 'details',
component: () => import('./views/Details.vue'),
meta: { title: '证书信息' }
} }
] ]
} }
......
<template>
<div>
<app-card class="base-info" title="证书信息">
<p>还未取得证书</p>
<div style="margin:20px;">
<img src="https://d1icd6shlvmxi6.cloudfront.net/gsc/VZBEW1/80/94/0b/80940b325e974c2bbb1947333cef5a62/images/%E6%88%91%E7%9A%84%E8%AF%81%E4%B9%A6/u195.png?token=a74c08777a71a87475bc07e15ce324e9ba84b5f1ae0b3ee46443d323e17180df" />
</div>
<div style="margin:20px;">
<img src="https://d1icd6shlvmxi6.cloudfront.net/gsc/VZBEW1/80/94/0b/80940b325e974c2bbb1947333cef5a62/images/%E6%88%91%E7%9A%84%E8%AF%81%E4%B9%A6/u193.png?token=292d1b529d8cd3149295c1fd7226df2c2404d5ee5aec9a56467c9a13586806af" />
</div>
</app-card>
</div>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style scoped lang="scss">
.app-card{
padding:15px 0 20px;
::v-deep .app-card-hd{
padding:0 20px;
border-bottom:1px solid #ececec;
}
::v-deep .app-card-bd{
padding:20px;
}
}
.base-info{
::v-deep .app-card-bd{
.title{
margin-bottom:20px;
padding-bottom:14px;
border-bottom:1px solid #f0f0f0;
i{
font-size:24px;
color: #3276fc;
}
}
}
}
</style>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<app-card title="数据汇总"> <app-card title="数据汇总">
<app-list v-bind="tableOptions" ref="list"> <app-list v-bind="tableOptions" ref="list">
<template> <template>
<div style="border-top:1px solid #f3f3f3;padding:15px 0;"> <div v-if="btnExport" style="border-top:1px solid #f3f3f3;padding:15px 0;">
<el-button type="primary" icon="el-icon-plus" @click="exportAll">导出Excel</el-button> <el-button type="primary" icon="el-icon-plus" @click="exportAll">导出Excel</el-button>
<span style="color:#666;font-size:14px;margin-left:15px;">导出当前搜索结果</span> <span style="color:#666;font-size:14px;margin-left:15px;">导出当前搜索结果</span>
</div> </div>
...@@ -60,6 +60,12 @@ export default { ...@@ -60,6 +60,12 @@ export default {
} }
}, },
computed: { computed: {
permissions() {
return this.$store.state.permissions
},
btnExport() {
return !!this.permissions.find(item => item.tag === 'student-download')
},
// 列表配置 // 列表配置
tableOptions() { tableOptions() {
return { return {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<img :src="row.url" width="120" height="70"> <img :src="row.url" width="120" height="70">
</template> </template>
<template v-slot:table-x="{ row }"> <template v-slot:table-x="{ row }">
<router-link :to="{ path: '/school/cert/details', query: { id: row.student_id } }"> <router-link v-if="btnView" :to="{ path: '/school/cert/details', query: { id: row.student_id } }">
<el-button type="primary" size="mini" plain>查看</el-button> <el-button type="primary" size="mini" plain>查看</el-button>
</router-link> </router-link>
</template> </template>
...@@ -41,6 +41,12 @@ export default { ...@@ -41,6 +41,12 @@ export default {
AppClassSelect AppClassSelect
}, },
computed: { computed: {
permissions() {
return this.$store.state.permissions
},
btnView() {
return !!this.permissions.find(item => item.tag === 'certificate-view')
},
// 列表配置 // 列表配置
tableOptions() { tableOptions() {
return { return {
......
...@@ -34,10 +34,8 @@ ...@@ -34,10 +34,8 @@
</template> </template>
<script> <script>
import AppCourseSelect from '@/components/base/AppCourseSelect.vue'
import { getAddCourseList, addCourse, updateCourse } from '../api' import { getAddCourseList, addCourse, updateCourse } from '../api'
export default { export default {
components: { AppCourseSelect },
props: { props: {
info: { info: {
type: Object, type: Object,
...@@ -102,7 +100,6 @@ export default { ...@@ -102,7 +100,6 @@ export default {
} else { } else {
this.fetchCourseList() this.fetchCourseList()
} }
}, },
methods: { methods: {
handleChange(val) { handleChange(val) {
......
<template> <template>
<app-list v-bind="tableOptions" ref="list"> <app-list v-bind="tableOptions" ref="list">
<template #header-aside> <template #header-aside>
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">添加</el-button> <el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-if="btnAdd">添加</el-button>
</template> </template>
<template v-slot:table-img="{ row }"> <template v-slot:table-img="{ row }">
<img v-if="row.curriculum" :src="row.curriculum.course_picture" width="120" height="70"> <img v-if="row.curriculum" :src="row.curriculum.course_picture" width="120" height="70">
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
<router-link :to="{ path: '/school/course/details', query: { id: row.id } }"> <router-link :to="{ path: '/school/course/details', query: { id: row.id } }">
<el-button type="primary" size="mini" plain style="margin-right: 10px">查看</el-button> <el-button type="primary" size="mini" plain style="margin-right: 10px">查看</el-button>
</router-link> </router-link>
<el-button @click="onEdit(row)" type="primary" size="mini" plain>更新</el-button> <el-button @click="onEdit(row)" type="primary" size="mini" plain v-if="btnUpdate">更新</el-button>
<el-button @click="onRemove(row)" type="danger" size="mini" plain>删除</el-button> <el-button @click="onRemove(row)" type="danger" size="mini" plain v-if="btnAdd">删除</el-button>
</template> </template>
<AddCourse v-if="isShowDialog" :info="info" :title="info ? '更新课程':'添加课程'" :visible.sync="isShowDialog" @success="success" /> <AddCourse v-if="isShowDialog" :info="info" :title="info ? '更新课程':'添加课程'" :visible.sync="isShowDialog" @success="success" />
</app-list> </app-list>
...@@ -40,6 +40,15 @@ export default { ...@@ -40,6 +40,15 @@ export default {
} }
}, },
computed: { computed: {
permissions() {
return this.$store.state.permissions
},
btnAdd() {
return !!this.permissions.find(item => item.tag === 'class-addCourse')
},
btnUpdate() {
return !!this.permissions.find(item => item.tag === 'class-updateCourse')
},
// 列表配置 // 列表配置
tableOptions() { tableOptions() {
return { return {
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
<!-- 学员 --> <!-- 学员 -->
<app-list v-bind="tableOptions" ref="list"> <app-list v-bind="tableOptions" ref="list">
<template #header-aside> <template #header-aside>
<el-button type="primary" icon="el-icon-plus" @click="addStudent">添加</el-button> <el-button type="primary" icon="el-icon-plus" @click="addStudent" v-if="btnAdd">添加</el-button>
<el-button type="primary" icon="el-icon-upload2" style="margin-left: 20px" @click="importStudent">导入</el-button> <el-button type="primary" icon="el-icon-upload2" style="margin-left: 20px" @click="importStudent" v-if="btnImport">导入</el-button>
</template> </template>
<template v-slot:table-x="{ row }"> <template v-slot:table-x="{ row }">
<el-button @click="onRemove(row)" type="danger" size="mini" plain>删除</el-button> <el-button @click="onRemove(row)" type="danger" size="mini" plain v-if="btnAdd">删除</el-button>
</template> </template>
<AddStudent :visible.sync="isShowDialog" @success="success" /> <AddStudent :visible.sync="isShowDialog" @success="success" />
</app-list> </app-list>
...@@ -33,6 +33,15 @@ export default { ...@@ -33,6 +33,15 @@ export default {
} }
}, },
computed: { computed: {
permissions() {
return this.$store.state.permissions
},
btnAdd() {
return !!this.permissions.find(item => item.tag === 'class-addStudent')
},
btnImport() {
return !!this.permissions.find(item => item.tag === 'class-importStudent')
},
// 列表配置 // 列表配置
tableOptions() { tableOptions() {
return { return {
......
<template> <template>
<app-list v-bind="tableOptions" ref="list"> <app-list v-bind="tableOptions" ref="list">
<template #header-aside> <template #header-aside>
<el-button type="primary" icon="el-icon-plus" @click="addTeacher">添加</el-button> <el-button type="primary" icon="el-icon-plus" @click="addTeacher" v-if="btnAdd">添加</el-button>
</template> </template>
<template v-slot:table-x="{ row }"> <template v-slot:table-x="{ row }">
<el-button @click="onRemove(row)" type="danger" size="mini" plain>删除</el-button> <el-button @click="onRemove(row)" type="danger" size="mini" plain v-if="btnAdd">删除</el-button>
</template> </template>
<AddTeacher :visible.sync="isShowDialog" @success="success" /> <AddTeacher :visible.sync="isShowDialog" @success="success" />
</app-list> </app-list>
...@@ -32,6 +32,12 @@ export default { ...@@ -32,6 +32,12 @@ export default {
} }
}, },
computed: { computed: {
permissions() {
return this.$store.state.permissions
},
btnAdd() {
return !!this.permissions.find(item => item.tag === 'class-addTeacher')
},
// 列表配置 // 列表配置
tableOptions() { tableOptions() {
return { return {
......
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
<app-card> <app-card>
<app-list v-bind="tableOptions" ref="list"> <app-list v-bind="tableOptions" ref="list">
<template> <template>
<router-link :to="{ path: 'class/update' }"> <router-link :to="{ path: 'class/update' }" v-if="btnCreate">
<el-button type="primary" icon="el-icon-plus">新建</el-button> <el-button type="primary" icon="el-icon-plus">新建</el-button>
</router-link> </router-link>
</template> </template>
<template v-slot:table-x="{ row }"> <template v-slot:table-x="{ row }">
<router-link :to="{ path: 'class/view', query: { id: row.id } }"> <router-link v-if="btnManage" :to="{ path: 'class/view', query: { id: row.id } }">
<el-button type="primary" style="margin-left: 10px" size="mini" plain>管理</el-button> <el-button type="primary" style="margin-left: 10px" size="mini" plain>管理</el-button>
</router-link> </router-link>
<router-link :to="{ path: 'class/update', query: { id: row.id } }"> <router-link v-if="btnUpdate" :to="{ path: 'class/update', query: { id: row.id } }">
<el-button type="success" style="margin-left: 10px" size="mini" plain>更新</el-button> <el-button type="success" style="margin-left: 10px" size="mini" plain>更新</el-button>
</router-link> </router-link>
<el-button type="danger" @click="onRemove(row)" style="margin-left: 10px" size="mini" plain>删除</el-button> <el-button v-if="btnDelete" type="danger" @click="onRemove(row)" style="margin-left: 10px" size="mini" plain>删除</el-button>
</template> </template>
</app-list> </app-list>
</app-card> </app-card>
...@@ -30,6 +30,21 @@ export default { ...@@ -30,6 +30,21 @@ export default {
} }
}, },
computed: { computed: {
permissions() {
return this.$store.state.permissions
},
btnCreate() {
return !!this.permissions.find(item => item.tag === 'class-add')
},
btnManage() {
return !!this.permissions.find(item => item.tag === 'class-view')
},
btnUpdate() {
return !!this.permissions.find(item => item.tag === 'class-update')
},
btnDelete() {
return !!this.permissions.find(item => item.tag === 'class-delete')
},
// 列表配置 // 列表配置
tableOptions() { tableOptions() {
return { return {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<div class="course-title">{{item.name}}</div> <div class="course-title">{{item.name}}</div>
</template> </template>
<div class="item" v-for="(it, idx) in item.children" :key="idx"> <div class="item" v-for="(it, idx) in item.children" :key="idx">
<i v-if="it.type === 2" class="el-icon-video-play" @click="fetchVideoUrl(it)"></i> <i v-if="btnView && it.type === 2" class="el-icon-video-play" @click="fetchVideoUrl(it)"></i>
<p>{{it.name}}</p> <p>{{it.name}}</p>
<div class="time" v-if="it.type === 2"> <div class="time" v-if="it.type === 2">
<span class="text">时长</span> <span class="text">时长</span>
...@@ -64,15 +64,24 @@ export default { ...@@ -64,15 +64,24 @@ export default {
}, },
filters: { filters: {
formatSeconds(value) { formatSeconds(value) {
let result = parseInt(value) const result = parseInt(value)
let h = Math.floor(result / 3600) < 10 ? '0' + Math.floor(result / 3600) : Math.floor(result / 3600); const h = Math.floor(result / 3600) < 10 ? '0' + Math.floor(result / 3600) : Math.floor(result / 3600)
let m = Math.floor((result / 60 % 60)) < 10 ? '0' + Math.floor((result / 60 % 60)) : Math.floor((result / 60 % 60)); const m = Math.floor((result / 60 % 60)) < 10 ? '0' + Math.floor((result / 60 % 60)) : Math.floor((result / 60 % 60))
let s = Math.floor((result % 60)) < 10 ? '0' + Math.floor((result % 60)) : Math.floor((result % 60)); const s = Math.floor((result % 60)) < 10 ? '0' + Math.floor((result % 60)) : Math.floor((result % 60))
let res = ''; let res = ''
if(h !== '00') res += `${h}h:`; if(h !== '00') res += `${h}h:`
if(m !== '00') res += `${m}:`; res += `${m}:`
res += `${s}`; // if(m !== '00') res += `${m}:`
return res; res += `${s}`
return res
}
},
computed: {
permissions() {
return this.$store.state.permissions
},
btnView() {
return !!this.permissions.find(item => item.tag === 'course-video')
} }
}, },
created() { created() {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</el-popover> </el-popover>
</template> </template>
<template v-slot:table-x="{ row }"> <template v-slot:table-x="{ row }">
<router-link :to="{ path: '/school/course/details', query: { id: row.id } }"> <router-link v-if="btnView" :to="{ path: '/school/course/details', query: { id: row.id } }">
<el-button type="primary" size="mini" plain>查看</el-button> <el-button type="primary" size="mini" plain>查看</el-button>
</router-link> </router-link>
</template> </template>
...@@ -36,6 +36,12 @@ export default { ...@@ -36,6 +36,12 @@ export default {
AppCourseSelect AppCourseSelect
}, },
computed: { computed: {
permissions() {
return this.$store.state.permissions
},
btnView() {
return !!this.permissions.find(item => item.tag === 'course-view')
},
// 列表配置 // 列表配置
tableOptions() { tableOptions() {
return { return {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
{{row.start_time}} - {{row.end_time}} {{row.start_time}} - {{row.end_time}}
</template> </template>
<template v-slot:table-x="{ row }"> <template v-slot:table-x="{ row }">
<router-link :to="{ path: '/exam/details', query: { id: row.id, title: row.paper_title } }"> <router-link v-if="btnView" :to="{ path: '/exam/details', query: { id: row.id, title: row.paper_title } }">
<el-button type="primary" size="mini" plain>查看</el-button> <el-button type="primary" size="mini" plain>查看</el-button>
</router-link> </router-link>
</template> </template>
...@@ -23,6 +23,12 @@ export default { ...@@ -23,6 +23,12 @@ export default {
} }
}, },
computed: { computed: {
permissions() {
return this.$store.state.permissions
},
btnView() {
return !!this.permissions.find(item => item.tag === 'examination-sheetList')
},
// 列表配置 // 列表配置
tableOptions() { tableOptions() {
return { return {
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<app-list v-bind="tableOptions" ref="list"> <app-list v-bind="tableOptions" ref="list">
<template> <template>
<el-row style="margin-bottom: 20px"> <el-row style="margin-bottom: 20px">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="add">新建</el-button> <el-button v-if="btnAdd" type="primary" icon="el-icon-plus" size="mini" @click="add">新建</el-button>
<el-button type="primary" icon="el-icon-upload2" style="margin-left: 20px" @click="imports" size="mini" <el-button v-if="btnImport" type="primary" icon="el-icon-upload2" style="margin-left: 20px" @click="imports" size="mini"
>导入</el-button >导入</el-button
> >
<!-- <el-button type="primary" icon="el-icon-download" style="margin-left: 20px" @click="downLoad" size="mini">下载</el-button> --> <!-- <el-button type="primary" icon="el-icon-download" style="margin-left: 20px" @click="downLoad" size="mini">下载</el-button> -->
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
<!-- <router-link :to="{ path: 'student/process', query: { id: row.id } }"> <!-- <router-link :to="{ path: 'student/process', query: { id: row.id } }">
<el-button type="warning" size="mini" plain>学习进度</el-button> <el-button type="warning" size="mini" plain>学习进度</el-button>
</router-link> --> </router-link> -->
<router-link :to="{ path: 'student/view', query: { id: row.id } }"> <router-link v-if="btnView" :to="{ path: 'student/view', query: { id: row.id } }">
<el-button type="primary" style="margin-left: 10px" size="mini" plain>查看</el-button> <el-button type="primary" style="margin-left: 10px" size="mini" plain>查看</el-button>
</router-link> </router-link>
<router-link :to="{ path: 'student/update', query: { id: row.id } }"> <router-link v-if="btnUpdate" :to="{ path: 'student/update', query: { id: row.id } }">
<el-button type="success" style="margin-left: 10px" size="mini" plain>更新</el-button> <el-button type="success" style="margin-left: 10px" size="mini" plain>更新</el-button>
</router-link> </router-link>
<el-button type="danger" @click="onRemove(row)" style="margin-left: 10px" size="mini" plain>删除</el-button> <el-button v-if="btnDelete" type="danger" @click="onRemove(row)" style="margin-left: 10px" size="mini" plain>删除</el-button>
</template> </template>
</app-list> </app-list>
</app-card> </app-card>
...@@ -36,6 +36,24 @@ export default { ...@@ -36,6 +36,24 @@ export default {
return {} return {}
}, },
computed: { computed: {
permissions() {
return this.$store.state.permissions
},
btnAdd() {
return !!this.permissions.find(item => item.tag === 'student-add')
},
btnUpdate() {
return !!this.permissions.find(item => item.tag === 'student-update')
},
btnDelete() {
return !!this.permissions.find(item => item.tag === 'student-delete')
},
btnView() {
return !!this.permissions.find(item => item.tag === 'student-view')
},
btnImport() {
return !!this.permissions.find(item => item.tag === 'student-import')
},
// 列表配置 // 列表配置
tableOptions() { tableOptions() {
return { return {
......
...@@ -3,20 +3,20 @@ ...@@ -3,20 +3,20 @@
<app-list v-bind="tableOptions" ref="list"> <app-list v-bind="tableOptions" ref="list">
<template> <template>
<el-row style="margin-bottom: 20px"> <el-row style="margin-bottom: 20px">
<el-button type="primary" icon="el-icon-plus" @click="add" size="mini">新建</el-button> <el-button v-if="btnAdd" type="primary" icon="el-icon-plus" @click="add" size="mini">新建</el-button>
<el-button type="primary" icon="el-icon-upload2" style="margin-left: 20px" @click="imports" size="mini" <el-button v-if="btnImport" type="primary" icon="el-icon-upload2" style="margin-left: 20px" @click="imports" size="mini"
>导入</el-button >导入</el-button
> >
</el-row> </el-row>
</template> </template>
<template v-slot:table-x="{ row }"> <template v-slot:table-x="{ row }">
<router-link :to="{ path: 'teacher/view', query: { id: row.id } }"> <router-link v-if="btnView" :to="{ path: 'teacher/view', query: { id: row.id } }">
<el-button type="primary" size="mini" plain>查看</el-button> <el-button type="primary" size="mini" plain>查看</el-button>
</router-link> </router-link>
<router-link :to="{ path: 'teacher/update', query: { id: row.id } }"> <router-link v-if="btnUpdate" :to="{ path: 'teacher/update', query: { id: row.id } }">
<el-button type="success" style="margin-left: 10px" size="mini" plain>更新</el-button> <el-button type="success" style="margin-left: 10px" size="mini" plain>更新</el-button>
</router-link> </router-link>
<el-button type="danger" style="margin-left: 10px" size="mini" plain @click="onRemove(row)">删除</el-button> <el-button v-if="btnDelete" type="danger" style="margin-left: 10px" size="mini" plain @click="onRemove(row)">删除</el-button>
</template> </template>
</app-list> </app-list>
</app-card> </app-card>
...@@ -31,6 +31,24 @@ export default { ...@@ -31,6 +31,24 @@ export default {
return {} return {}
}, },
computed: { computed: {
permissions() {
return this.$store.state.permissions
},
btnAdd() {
return !!this.permissions.find(item => item.tag === 'teacher-add')
},
btnUpdate() {
return !!this.permissions.find(item => item.tag === 'teacher-update')
},
btnDelete() {
return !!this.permissions.find(item => item.tag === 'teacher-delete')
},
btnView() {
return !!this.permissions.find(item => item.tag === 'teacher-view')
},
btnImport() {
return !!this.permissions.find(item => item.tag === 'teacher-import')
},
// 列表配置 // 列表配置
tableOptions() { tableOptions() {
return { return {
......
...@@ -65,9 +65,9 @@ httpRequest.interceptors.response.use( ...@@ -65,9 +65,9 @@ httpRequest.interceptors.response.use(
function (error) { function (error) {
if (error.response) { if (error.response) {
const { status, message } = error.response.data const { status, message } = error.response.data
if (status === 401) { // if (status === 401) {
router.push('/401') // router.push('/401')
} // }
// 未登录 // 未登录
if (status === 403) { if (status === 403) {
window.location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(window.location.href)}` window.location.href = `${import.meta.env.VITE_LOGIN_URL}?rd=${encodeURIComponent(window.location.href)}`
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论