Commit ab6f8fbf authored by 徐一鸣's avatar 徐一鸣

菜单权限组件

parent b6c50c16
...@@ -535,40 +535,40 @@ width: 620px!important; ...@@ -535,40 +535,40 @@ width: 620px!important;
background-color: #e1e4fb; background-color: #e1e4fb;
border-color: #e1e4fb; border-color: #e1e4fb;
} }
.appas_table .el-table th > .cell { .apass_table .el-table th > .cell {
color: #1a2236; color: #1a2236;
} }
.appas_table .el-table td, .apass_table .el-table td,
.appas_table .el-table th.is-leaf { .apass_table .el-table th.is-leaf {
border: none !important; border: none !important;
line-height: 23px; line-height: 23px;
} }
.appas_table .el-table::before { .apass_table .el-table::before {
display: none; display: none;
} }
.appas_table .el-table { .apass_table .el-table {
width: 100%; width: 100%;
} }
.appas_table .el-table__row:nth-child(odd) td { .apass_table .el-table__row:nth-child(odd) td {
background-color: #f8f9fd; background-color: #f8f9fd;
} }
.appas_table .row_action { .apass_table .row_action {
user-select: none; user-select: none;
} }
.appas_table .row_action .btn { .apass_table .row_action .btn {
font-size: 14px; font-size: 14px;
font-weight: bold; font-weight: bold;
color: #0f2683; color: #0f2683;
cursor: pointer; cursor: pointer;
} }
.appas_table .row_action .btn.warn { .apass_table .row_action .btn.warn {
color: #830f53; color: #830f53;
} }
.appas_table .row_action .btn.disabled { .apass_table .row_action .btn.disabled {
color: #dde4ff; color: #dde4ff;
cursor: not-allowed; cursor: not-allowed;
} }
.appas_table .row_action .interval_line { .apass_table .row_action .interval_line {
font-size: 14px; font-size: 14px;
color: #dde4ff; color: #dde4ff;
margin: 0 20px; margin: 0 20px;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<span v-text="title || '提示'"></span> <span v-text="title || '提示'"></span>
</h3> </h3>
<div class="dialog_content appas_table" v-if="$slots.content"> <div class="dialog_content apass_table" v-if="$slots.content">
<slot name="content"></slot> <slot name="content"></slot>
</div> </div>
<p class="dialog_msg" v-html="msg" v-else></p> <p class="dialog_msg" v-html="msg" v-else></p>
......
...@@ -44,10 +44,10 @@ ...@@ -44,10 +44,10 @@
<div class="cross_line" v-if="!hideHeader"></div> <div class="cross_line" v-if="!hideHeader"></div>
<div class="list-container appas_table" v-if="$slots.list"> <div class="list-container" v-if="$slots.list">
<slot name="list"></slot> <slot name="list"></slot>
</div> </div>
<div class="list-container appas_table" v-else> <div class="list-container" v-else>
<list-table <list-table
:header="listHeader" :header="listHeader"
:data="listData" :data="listData"
......
<template> <template>
<div class="appas_table"> <div class="apass_table">
<el-table slot="list" :border="false" :data="data"> <el-table :data="data">
<el-table-column :width="paddingLeft - 10"></el-table-column> <el-table-column :width="paddingLeft - 10"></el-table-column>
<el-table-column <el-table-column
v-for="(item, index) in header" v-for="(item, index) in header"
......
<template>
<div class="menu_permission">
<el-table border :data="data">
<el-table-column label="名称" width="214">
<template slot-scope="scope">
<div class="permission_list">
<el-checkbox
:value="selectAllInfo[scope.row.prop]"
@change="selectAll(scope.row.prop)"
>
{{ scope.row.name }}
</el-checkbox>
</div>
</template>
</el-table-column>
<el-table-column label="选项">
<template slot-scope="scope">
<el-checkbox-group
v-model="permissions[scope.row.prop]"
class="permission_list"
@change="selectPermission"
>
<el-checkbox
v-for="(item, index) in scope.row.children"
:label="item.value"
:key="'permission_' + index"
>
{{ item.name }}
</el-checkbox>
</el-checkbox-group>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
export default {
model: {
prop: "permissions",
event: "change-permissions",
},
props: {
permissions: {
type: Object,
default: {},
},
data: {
type: Array,
default: () => [],
},
},
data: () => ({
selectAllInfo: {},
}),
watch: {
permissions: {
handler() {
this.upSelectAllInfo();
},
deep: true,
},
},
methods: {
selectPermission(values) {
this.$emit("change-permissions", this.permissions);
},
upSelectAllInfo() {
this.data.forEach((item) => {
let values = this.permissions[item.prop];
let datas = this.data.find((v) => v.prop === item.prop).children;
let selectAllFlag = true;
datas.forEach((v) => {
selectAllFlag = selectAllFlag && values.indexOf(v.value) > -1;
});
this.selectAllInfo[item.prop] = selectAllFlag;
});
},
selectAll(prop) {
let newValues = { ...this.permissions };
this.selectAllInfo[prop] = !this.selectAllInfo[prop];
if (this.selectAllInfo[prop]) {
newValues[prop] = this.data
.find((item) => item.prop === prop)
.children.map((item) => item.value);
} else {
newValues[prop] = [];
}
this.$emit("change-permissions", newValues);
},
},
mounted() {
this.upSelectAllInfo();
},
};
</script>
<style scoped>
.menu_permission {
margin-top: 20px;
}
</style>
<style>
.menu_permission .el-table__header-wrapper {
display: none;
}
.permission_list .el-checkbox {
color: #58617a;
line-height: 40px;
}
.permission_list .el-checkbox__input.is-checked .el-checkbox__inner,
.permission_list .el-checkbox__input.is-indeterminate .el-checkbox__inner {
background-color: #626de9;
border-color: #515fe7;
}
.permission_list .el-checkbox__input.is-checked + .el-checkbox__label {
color: #58617a;
}
.menu_permission .el-table .cell {
padding: 0 50px !important;
}
.menu_permission .el-table--border {
border: 1px solid #f4f7fc;
border-radius: 6px;
}
</style>
...@@ -17,63 +17,67 @@ ...@@ -17,63 +17,67 @@
权限审批 权限审批
</el-button> </el-button>
</template> </template>
<el-table slot="list" :border="false" :data="listData"> <div class="apass_table" slot="list">
<el-table-column label="" width="40"></el-table-column> <el-table :border="false" :data="listData">
<el-table-column label="账号" width="160"> <el-table-column label="" width="40"></el-table-column>
<template slot-scope="scope"> <el-table-column label="账号" width="160">
<span v-text="scope.row.account"></span> <template slot-scope="scope">
</template> <span v-text="scope.row.account"></span>
</el-table-column> </template>
<el-table-column label="业务系统名称"> </el-table-column>
<template slot-scope="scope"> <el-table-column label="业务系统名称">
<span v-text="scope.row.name"></span> <template slot-scope="scope">
</template> <span v-text="scope.row.name"></span>
</el-table-column> </template>
<el-table-column label="用户类型" align="center" width="160"> </el-table-column>
<template slot-scope="scope"> <el-table-column label="用户类型" align="center" width="160">
<span v-text="scope.row.role"></span> <template slot-scope="scope">
</template> <span v-text="scope.row.role"></span>
</el-table-column> </template>
<el-table-column label="所属组织"> </el-table-column>
<template slot-scope="scope"> <el-table-column label="所属组织">
<span v-text="scope.row.organization"></span> <template slot-scope="scope">
</template> <span v-text="scope.row.organization"></span>
</el-table-column> </template>
<el-table-column label="账号状态" align="center" width="240"> </el-table-column>
<template slot-scope="scope"> <el-table-column label="账号状态" align="center" width="240">
<span v-text="scope.row.state === 0 ? '禁用' : '启用'"></span> <template slot-scope="scope">
</template> <span v-text="scope.row.state === 0 ? '禁用' : '启用'"></span>
</el-table-column> </template>
<el-table-column label="上次操作修改时间" align="center" width="200"> </el-table-column>
<template slot-scope="scope"> <el-table-column label="上次操作修改时间" align="center" width="200">
<span v-text="scope.row.update_time"></span> <template slot-scope="scope">
</template> <span v-text="scope.row.update_time"></span>
</el-table-column> </template>
<el-table-column label="操作" align="center" width="300"> </el-table-column>
<template slot-scope="scope"> <el-table-column label="操作" align="center" width="300">
<div class="row_action"> <template slot-scope="scope">
<a <div class="row_action">
class="btn" <a
@click="$router.push(`/authority/users/detail/${scope.row.id}`)" class="btn"
> @click="
详情 $router.push(`/authority/users/detail/${scope.row.id}`)
</a> "
<span class="interval_line">|</span> >
<a class="btn" @click="setRole(scope.row)"> 详情
分配角色 </a>
</a> <span class="interval_line">|</span>
<span class="interval_line">|</span> <a class="btn" @click="setRole(scope.row)">
<a 分配角色
class="btn" </a>
:class="{ warn: scope.row.state === 1 }" <span class="interval_line">|</span>
@click="setState(scope.row)" <a
> class="btn"
{{ scope.row.state === 0 ? "启用" : "禁用" }} :class="{ warn: scope.row.state === 1 }"
</a> @click="setState(scope.row)"
</div> >
</template> {{ scope.row.state === 0 ? "启用" : "禁用" }}
</el-table-column> </a>
</el-table> </div>
</template>
</el-table-column>
</el-table>
</div>
</apass-list> </apass-list>
<apass-dialog <apass-dialog
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment