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

增加按钮权限控制

上级 f9bcc5c8
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<h5> <h5>
{{ drawTitle }} {{ drawTitle }}
<el-button <el-button
v-if="drawFormOptions.type !== 'create'" v-if="drawFormOptions.type !== 'create' && hasDelete"
type="primary" type="primary"
@click="drawFormOptions.type = 'edit'" @click="drawFormOptions.type = 'edit'"
size="mini" size="mini"
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<h5> <h5>
{{ drawTitle }} {{ drawTitle }}
<el-button <el-button
v-if="drawFormOptions.type !== 'create'" v-if="drawFormOptions.type !== 'create' && hasDelete"
type="primary" type="primary"
@click="drawFormOptions.type = 'edit'" @click="drawFormOptions.type = 'edit'"
size="mini" size="mini"
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<h5> <h5>
{{ drawTitle }} {{ drawTitle }}
<el-button <el-button
v-if="drawFormOptions.type !== 'create'" v-if="drawFormOptions.type !== 'create' && hasDelete"
type="primary" type="primary"
@click="drawFormOptions.type = 'edit'" @click="drawFormOptions.type = 'edit'"
size="mini" size="mini"
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
active-text="启用" active-text="启用"
inactive-text="停用" inactive-text="停用"
@change="statusChange(row)" @change="statusChange(row)"
:disabled="!hasCreate"
></el-switch> ></el-switch>
</template> </template>
</table-list> </table-list>
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
<h5> <h5>
{{ drawerTitle }} {{ drawerTitle }}
<el-button <el-button
v-if="drawerType !== 'create'" v-if="drawerType !== 'create' && hasCreate"
type="primary" type="primary"
@click="drawerType = 'edit'" @click="drawerType = 'edit'"
size="mini" size="mini"
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</template> </template>
<!-- 发布状态 --> <!-- 发布状态 -->
<template v-slot:status="{ row }"> <template v-slot:status="{ row }">
<el-switch v-model="row.status" :active-value="0" :inactive-value="1" active-text="启用" inactive-text="停用" @change="statusChange(row)"></el-switch> <el-switch v-model="row.status" :active-value="0" :inactive-value="1" active-text="启用" inactive-text="停用" @change="statusChange(row)" :disabled="!hasCreate"></el-switch>
</template> </template>
<!-- 操作 --> <!-- 操作 -->
<template v-slot:tools="{ row }"> <template v-slot:tools="{ row }">
...@@ -240,12 +240,13 @@ export default { ...@@ -240,12 +240,13 @@ export default {
{ prop: 'create_user', label: '创建人', minWidth: '80px', slots: 'table-creator' }, { prop: 'create_user', label: '创建人', minWidth: '80px', slots: 'table-creator' },
{ prop: 'created_at', label: '创建时间', minWidth: '150px' }, { prop: 'created_at', label: '创建时间', minWidth: '150px' },
{ prop: 'status', label: '状态', slots: 'status', minWidth: '140px', fixed: 'right' }, { prop: 'status', label: '状态', slots: 'status', minWidth: '140px', fixed: 'right' },
{ prop: 'x', label: '操作', slots: 'tools', minWidth: '200px', fixed: 'right' } { prop: 'x', label: '操作', slots: 'tools', minWidth: '200px', fixed: 'right', visible: this.hasCreate }
] ]
} }
} }
}, },
created() { created() {
// console.log(this.hasCreate)
this.fetchProjectList() this.fetchProjectList()
this.fetchRoleList() this.fetchRoleList()
}, },
...@@ -334,14 +335,16 @@ export default { ...@@ -334,14 +335,16 @@ export default {
this.dialogType = 'phone' this.dialogType = 'phone'
}, },
handleDetails(val) { handleDetails(val) {
const form = this.form if (this.hasCreate) {
form.sso_id = val.sso_id const form = this.form
form.role_id = val.roles[0] ? val.roles[0].id : '' form.sso_id = val.sso_id
form.project_ids = val.projects.map(item => item.id) || [] form.role_id = val.roles[0] ? val.roles[0].id : ''
this.operateItem = val form.project_ids = val.projects.map(item => item.id) || []
console.log(val) this.operateItem = val
this.drawerVisible = true console.log(val)
this.drawerType = 'details' this.drawerVisible = true
this.drawerType = 'details'
}
}, },
statusChange(val) { statusChange(val) {
this.fetchUpdateStaff({ this.fetchUpdateStaff({
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
active-text="启用" active-text="启用"
inactive-text="停用" inactive-text="停用"
@change="statusChange(row)" @change="statusChange(row)"
:disabled="!hasCreate"
></el-switch> ></el-switch>
</template> </template>
<template #footer> <template #footer>
...@@ -55,6 +56,7 @@ ...@@ -55,6 +56,7 @@
active-text="启用" active-text="启用"
inactive-text="停用" inactive-text="停用"
@change="statusChange(row)" @change="statusChange(row)"
:disabled="!hasCreate"
></el-switch> ></el-switch>
</template> </template>
<template #footer> <template #footer>
...@@ -245,12 +247,14 @@ export default { ...@@ -245,12 +247,14 @@ export default {
this.dialogVisible = true this.dialogVisible = true
}, },
handleDetails(val) { handleDetails(val) {
this.dialogType = 'edit' if (this.hasCreate) {
this.dialogVisible = true this.dialogType = 'edit'
this.selectedId = val.id this.dialogVisible = true
this.form = { this.selectedId = val.id
name: val.name, this.form = {
category: val.category name: val.name,
category: val.category
}
} }
}, },
handleDialogClose() { handleDialogClose() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论