考核、项目列表权限控制,角色隐藏删除按钮等

dev_2022-05-11
jialong.yu 3 years ago
parent d6f052d4e2
commit bab1a5e1d1
  1. 18
      src/pages/account/login/index.vue
  2. 6
      src/pages/achievement/show/index.vue
  3. 4
      src/pages/assessment/add/index.vue
  4. 17
      src/pages/assessment/list/index.vue
  5. 28
      src/pages/project/list/index.vue
  6. 2
      src/pages/system/list/role.vue
  7. 4
      src/setting.js
  8. 6
      src/store/modules/user.js

@ -62,7 +62,7 @@
</template> </template>
<script> <script>
import { mapActions } from "vuex"; import { mapActions, mapMutations } from "vuex";
import vFooter from "@/layouts/footer"; import vFooter from "@/layouts/footer";
import util from "@/libs/util"; import util from "@/libs/util";
import Setting from "@/setting"; import Setting from "@/setting";
@ -108,6 +108,9 @@ export default {
}); });
}, },
methods: { methods: {
...mapMutations("user", [
"SET_ROLENAME"
]),
...mapActions("user", [ ...mapActions("user", [
"setCustomer", "setCustomerName" "setCustomer", "setCustomerName"
]), ]),
@ -131,15 +134,20 @@ export default {
this.getVerImg(); this.getVerImg();
this.loginForm.code = ""; this.loginForm.code = "";
util.local.set(Setting.tokenKey, res.data.token, Setting.tokenExpires); util.local.set(Setting.tokenKey, res.data.token, Setting.tokenExpires);
this.queryCustomer(); this.getRole()
}).catch(res => { this.queryCustomer()
}).catch(res => {})
});
} else { } else {
return util.errorMsg("请检查表单数据"); return util.errorMsg("请检查表单数据");
} }
}); });
}, },
//
getRole() {
this.$post(`${this.api.getUserAllRoleByToken}?platformId=${Setting.platformId}`).then(res => {
this.SET_ROLENAME(res)
}).catch(err => {})
},
queryCustomer() { // queryCustomer() { //
this.$get(this.api.isClient).then(res => { this.$get(this.api.isClient).then(res => {
util.successMsg("登录成功"); util.successMsg("登录成功");

@ -59,7 +59,7 @@
{{ scope.$index + 1 }} {{ scope.$index + 1 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="judgmentName" label="任务名称" align="center"> <el-table-column prop="judgmentName" label="任务名称" align="center" min-width="200">
</el-table-column> </el-table-column>
<el-table-column v-if='project' prop="userAnswer" label="考核点" align="center" > <el-table-column v-if='project' prop="userAnswer" label="考核点" align="center" >
<template slot-scope="scope"> <template slot-scope="scope">
@ -68,7 +68,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="answer" label="参考答案" align="center" width="400"> <el-table-column prop="answer" label="参考答案" align="center" min-width="400">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if=' scope.row.lcRuleRecords'> <div v-if=' scope.row.lcRuleRecords'>
<div v-for="(item, index) in scope.row.lcRuleRecords"> <div v-for="(item, index) in scope.row.lcRuleRecords">
@ -80,7 +80,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="userAnswer" label="学生答案" align="center" width="400"> <el-table-column prop="userAnswer" label="学生答案" align="center" min-width="400">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if=' scope.row.lcRuleRecords'> <div v-if=' scope.row.lcRuleRecords'>
<div v-for="(item, index) in scope.row.lcRuleRecords"> <div v-for="(item, index) in scope.row.lcRuleRecords">

@ -397,11 +397,13 @@ export default {
}); });
}, },
getProjectData() { getProjectData() {
const curItem = this.curriculumList.find(e => e.cid === this.form.curriculumId)
let data={ let data={
pageNum:this.page, pageNum:this.page,
pageSize:this.pageSize, pageSize:this.pageSize,
cid:this.form.curriculumId, cid:this.form.curriculumId,
projectName:this.keyword projectName:this.keyword,
systemId: curItem ? curItem.systemId : 1
} }
this.$post(this.api.projectListByCourseId,data).then(res => { this.$post(this.api.projectListByCourseId,data).then(res => {
let { status, data } = res; let { status, data } = res;

@ -96,19 +96,19 @@
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="170"> <el-table-column label="操作" width="170">
<template slot-scope="scope"> <template slot-scope="scope">
<template v-if="scope.row.status == 0"> <template v-if="scope.row.status == 0 && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))">
<el-button v-if="scope.row.type == 1" type="text" @click="start(scope.row)">启动</el-button> <el-button v-if="scope.row.type == 1" type="text" @click="start(scope.row)">启动</el-button>
<el-button v-if="auth('修改')" type="text" @click="edit(scope.row)">修改</el-button> <el-button v-if="auth('修改')" type="text" @click="edit(scope.row)">修改</el-button>
</template> </template>
<template v-else-if="scope.row.status == 1"> <template v-else-if="scope.row.status == 1 && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))">
<el-button v-if="auth('提前结束')" type="text" @click="finish(scope.row)">提前结束</el-button> <el-button v-if="auth('提前结束')" type="text" @click="finish(scope.row)">提前结束</el-button>
</template> </template>
<template v-else-if="scope.row.status == 2"> <template v-else-if="scope.row.status == 2">
<el-button v-if="auth('查看成绩')" type="text" @click="show(scope.row)">查看成绩</el-button> <el-button v-if="auth('查看成绩')" type="text" @click="show(scope.row)">查看成绩</el-button>
</template> </template>
<el-button v-if="(scope.row.status == 0 || scope.row.status == 2) && auth('删除')" type="text" @click="delData(scope.row)">删除</el-button> <el-button v-if="(scope.row.status == 0 || scope.row.status == 2) && auth('删除') && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))" type="text" @click="delData(scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -119,8 +119,8 @@
</template> </template>
<script> <script>
import { mapState } from "vuex";
import util from "@/libs/util"; import util from "@/libs/util";
export default { export default {
data() { data() {
return { return {
@ -188,9 +188,14 @@ export default {
listLoading:false,// listLoading:false,//
ticker: null, // ticker: null, //
sss:1, sss:1,
datassdata:0, datassdata:0
}; };
}, },
computed: {
...mapState("user", [
'roleName'
])
},
watch: { watch: {
"form.month": function(val) { "form.month": function(val) {
if (val) { if (val) {

@ -87,8 +87,8 @@
<el-table-column label="操作"> <el-table-column label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="edit(scope.row,'0',queryData.founder)">查看</el-button> <el-button type="text" @click="edit(scope.row,'0',queryData.founder)">查看</el-button>
<el-button v-if="scope.row.founder && (isSuper || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))" type="text" @click="edit(scope.row,'1',queryData.founder)">编辑</el-button> <el-button v-if="scope.row.founder && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))" type="text" @click="edit(scope.row,'1',queryData.founder)">编辑</el-button>
<el-button v-if="scope.row.founder && (isSuper || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))" type="text" @click="handleDelete(scope.row.projectId)">删除</el-button> <el-button v-if="scope.row.founder && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))" type="text" @click="handleDelete(scope.row.projectId)">删除</el-button>
<el-button v-if="auth('复制')" type="text" @click="copyData(scope.row.projectId)">复制</el-button> <el-button v-if="auth('复制')" type="text" @click="copyData(scope.row.projectId)">复制</el-button>
<el-switch <el-switch
v-if="auth('禁用')" v-if="auth('禁用')"
@ -123,10 +123,8 @@
</template> </template>
<script> <script>
import Setting from "@/setting";
import { mapState, mapActions, mapMutations } from "vuex"; import { mapState, mapActions, mapMutations } from "vuex";
import util from "@/libs/util"; import util from "@/libs/util";
export default { export default {
data() { data() {
return { return {
@ -202,15 +200,12 @@ export default {
copyVisible: false, copyVisible: false,
projectName: "", projectName: "",
currentRow: {}, // currentRow: {}, //
listDataAll: [], listDataAll: []
isSuper: false, //
isAdmin: false, //
roleName: '' //
}; };
}, },
computed: { computed: {
...mapState("user", [ ...mapState("user", [
"userId", "roleId" "userId", "roleId", 'roleName'
]), ]),
...mapState("project", [ ...mapState("project", [
"lastSystemId", "lastSystemId",
@ -232,11 +227,8 @@ export default {
deep: true deep: true
} }
}, },
// created() {
// this.queryData = this.queryDataStatus
// },
mounted() { mounted() {
this.getRole() this.getSystemData()
if(this.queryDataStatus.platformId) { if(this.queryDataStatus.platformId) {
this.queryData = this.queryDataStatus this.queryData = this.queryDataStatus
} }
@ -267,16 +259,6 @@ export default {
}); });
}, },
//
getRole() {
this.$post(`${this.api.getUserAllRoleByToken}?platformId=${Setting.platformId}`).then(res => {
this.isSuper = res.includes('超级管理员')
this.isAdmin = res === '管理员'
this.roleName = res
this.getSystemData();
}).catch(err => {
});
},
getData() { getData() {
this.setSystemId(this.systemId); this.setSystemId(this.systemId);
let data = { let data = {

@ -26,7 +26,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-if="auth('角色权限-查看')" type="text" @click="showRole(scope.row)">查看</el-button> <el-button v-if="auth('角色权限-查看')" type="text" @click="showRole(scope.row)">查看</el-button>
<el-button v-if="auth('角色权限-编辑') && scope.row.roleName !== '超级管理员'" type="text" @click="editRole(scope.row)">编辑</el-button> <el-button v-if="auth('角色权限-编辑') && scope.row.roleName !== '超级管理员'" type="text" @click="editRole(scope.row)">编辑</el-button>
<el-button v-if="auth('角色权限-删除') && scope.row.roleName !== '超级管理员'" type="text" @click="handleDelete(scope.row)">删除</el-button> <el-button v-if="auth('角色权限-删除') && scope.row.roleName !== '超级管理员' && scope.row.roleName !== '管理员'" type="text" @click="handleDelete(scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

@ -36,8 +36,8 @@ if (isHh) {
} else if (isDev) { } else if (isDev) {
jumpPath = "http://192.168.31.154:8087/"; jumpPath = "http://192.168.31.154:8087/";
// host = "http://www.occupationlab.com:9000/";//线上 // host = "http://www.occupationlab.com:9000/";//线上
host = "http://39.108.250.202:9000/"; // 中台测试服 // host = "http://39.108.250.202:9000/"; // 中台测试服
// host = "http://192.168.31.151:9000/"; // 榕 host = "http://192.168.31.151:9000/"; // 榕
// host = "http://192.168.31.125:9000/"; // 坤 // host = "http://192.168.31.125:9000/"; // 坤
// host = 'http://192.168.31.137:9000/'; // 赓 // host = 'http://192.168.31.137:9000/'; // 赓
title = "职站服务端管理系统"; title = "职站服务端管理系统";

@ -18,7 +18,8 @@ export default {
userId: 3, userId: 3,
userName: "", userName: "",
roleId: "", roleId: "",
dataTime: "" dataTime: "",
roleName: ''
}, },
mutations: { mutations: {
SET_INFO: (state, info) => { SET_INFO: (state, info) => {
@ -45,6 +46,9 @@ export default {
}, },
SET_USERNAME: (state, userName) => { SET_USERNAME: (state, userName) => {
state.userName = userName; state.userName = userName;
},
SET_ROLENAME: (state, roleName) => {
state.roleName = roleName
} }
}, },
actions: { actions: {

Loading…
Cancel
Save