Files
fe-manage/src/components/drawers/PowerList.vue
2022-12-01 01:56:41 +08:00

681 lines
17 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<a-drawer
:visible="PLvisible"
class="drawerStyle powerList"
placement="right"
width="60%"
@after-visible-change="afterVisibleChange"
>
<div class="drawerMain">
<div class="header">
<div class="headerTitle">授权名单</div>
<img
style="width: 29px; height: 29px; cursor: pointer"
src="../../assets/images/basicinfo/close.png"
@click="closeDrawer"
/>
</div>
<div class="main">
<div class="search">
<div class="leftchoose">
<div class="namecon" style="margin-right: 30px">
<div class="name">姓名</div>
<a-input
v-model:value="name"
style="width: 270px; height: 40px; border-radius: 8px"
placeholder="请输入姓名"
/>
</div>
</div>
<div class="btns">
<div
class="btn btn1"
style="margin-right: 20px"
@click="searchAuth"
>
<div class="img1"></div>
<div class="wz">搜索</div>
</div>
<div class="btn btn2" @click="resetAuth">
<div class="img2"></div>
<div class="wz">重置</div>
</div>
</div>
</div>
<div class="tableBox" style="margin-top: 10px">
<a-table
style="border: 1px solid #f2f6fe"
:columns="tableDataFunc()"
:data-source="tableData"
:loading="tableDataTotal === -1 ? true : false"
expandRowByClick="true"
@expand="expandTable"
:scroll="{ x: 900 }"
:pagination="false"
/>
</div>
<div class="tableBox">
<div class="pa">
<a-pagination
v-if="tableDataTotal > 10"
showSizeChanger="true"
showQuickJumper="true"
hideOnSinglePage="true"
:pageSize="pageSize"
:current="currentPage"
:total="tableDataTotal"
class="pagination"
@change="changePagination"
/>
</div>
</div>
<!-- <div class="tab" style="margin-top: 20px; margin-bottom: 100px">
<a-table
style="border: 1px solid #f2f6fe"
:columns="tablecolumns"
:data-source="tabledata"
:loading="tableDataTotal === -1 ? true : false"
expandRowByClick="true"
:scroll="{ x: 900, y: 350 }"
@expand="expandTable"
:pagination="false"
:row-selection="{
columnWidth: 30,
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,
}"
/>
</div> -->
</div>
</div>
<!-- 取消授权弹窗 -->
<a-modal
v-model:visible="cancelModal"
:footer="null"
:closable="closeCancel"
wrapClassName="copyModal"
centered="true"
>
<div class="delete">
<div class="del_header"></div>
<div class="del_main">
<div class="header">
<div class="icon"></div>
<span>提示</span>
<div class="close_exit" @click="closeCancelModal"></div>
</div>
<div class="body">
<span>您确定要取消该用户的授权吗</span>
</div>
<div class="del_btnbox">
<div class="del_btn btn1">
<div class="btnText" @click="delete_exit">取消</div>
</div>
<div class="del_btn btn2">
<div class="btnText" @click="delete_exit">确定</div>
</div>
</div>
</div>
</div>
</a-modal>
<div class="botm"></div>
<div class="btnn">
<button class="btn1">取消</button>
<button class="btn2">确定</button>
</div>
</a-drawer>
</template>
<script>
import { toRefs, reactive } from "vue";
import * as api from "../../api/index1";
export default {
name: "PowerList",
props: {
PLvisible: {
type: Boolean,
default: false,
},
selectPathId: {
type: Number,
default: null,
},
},
setup(props, ctx) {
const state = reactive({
name: null,
showmodal: false, //勾选提示框
closable: false, //modal右上角的关闭按钮
pageSize: 10,
currentPage: 1,
tableDataTotal: -1,
selectedRowKeys: [],
cancelModal: false, //取消授权弹窗
closeCancel: false, //取消授权弹窗关闭图标
tableData: [
// {
// key: 1,
// name: "张三",
// com: "产研部",
// gang: "产品经理",
// number: "20201234",
// state: "管理权",
// },
],
});
const closeDrawer = () => {
ctx.emit("update:PLvisible", false);
};
const afterVisibleChange = (bool) => {
console.log("state", bool, props);
if (bool) {
optionAuthPerm();
}
};
const onSelectChange = (selectedRowKeys) => {
console.log("selectedRowKeys changed: ", selectedRowKeys);
state.selectedRowKeys = selectedRowKeys;
};
const showCancelModal = () => {
state.cancelModal = true;
};
const closeCancelModal = () => {
state.cancelModal = false;
};
const tableDataFunc = () => {
const columns = [
{
title: "姓名",
dataIndex: "name",
// width: "30%",
key: "name",
width: 70,
align: "left",
className: "classify",
scopedSlots: { customRender: "action" }, //引入的插槽
customRender: (text) => {
// console.log(text.record.checked1);
return (
<div class="racona">
<span> {text.record.name}</span>
</div>
);
},
},
{
title: "工号",
dataIndex: "number",
// width: "30%",
key: "number",
width: 100,
align: "center",
className: "h",
},
{
title: "归属组织",
dataIndex: "com",
// width: "30%",
key: "com",
width: 100,
align: "center",
className: "h",
},
{
title: "所在岗位",
dataIndex: "gang",
key: "gang",
width: 100,
align: "center",
className: "h",
},
{
title: "拥有权限",
dataIndex: "state",
key: "state",
width: 100,
align: "center",
className: "h",
},
{
title: "操作",
className: "h",
dataIndex: "opacation",
key: "opacation",
width: 100,
align: "center",
scopedSlots: { customRender: "action" }, //引入的插槽
customRender: () => {
return (
<div
class="opa"
onClick={() => {
showCancelModal();
}}
>
取消授权
</div>
);
},
},
];
return columns;
};
//‘获取权限名单
const optionAuthPerm = () => {
let obj = {
keyWord: state.name ? state.name : "",
type: 1,
tag: 1,
opt: 1,
refId: props.selectPathId,
pageNo: state.currentPage,
pageSize: state.pageSize,
};
console.log("获取权限名单obj", obj);
api
.optionAuthPerm(obj)
.then((res) => {
if (res.data.code === 200) {
console.log("获取权限名单成功", res.data.data.records);
let arr = res.data.data.records;
let array = [];
arr.map((value) => {
let obj = {
key: value.authRefId,
id: value.authRefId,
name: value.memberName ? value.memberName : "-",
com: value.orgName ? value.orgName : "-",
gang: "产品经理",
number: "20201234",
state: "管理权",
};
array.push(obj);
});
state.tableDataTotal = res.data.data.total;
}
})
.catch((err) => {
console.log("获取权限名单失败", err);
});
};
//分页
const changePagination = (page) => {
state.currentPage = page;
optionAuthPerm();
};
//查询
const searchAuth = () => {
state.currentPage = 1;
optionAuthPerm();
};
//重置
const resetAuth = () => {
state.currentPage = 1;
state.name = null;
optionAuthPerm();
};
return {
...toRefs(state),
closeDrawer,
afterVisibleChange,
onSelectChange,
tableDataFunc,
showCancelModal,
closeCancelModal,
changePagination,
searchAuth,
resetAuth,
};
},
};
</script>
<style lang="scss">
.copyModal {
.ant-modal {
width: 424px !important;
height: 258px !important;
.ant-modal-content {
width: 424px !important;
height: 258px !important;
.ant-modal-body {
width: 424px !important;
height: 258px !important;
padding: 0 !important;
.delete {
z-index: 999;
width: 424px;
height: 258px;
background: #ffffff;
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.21);
border-radius: 4px;
// position: absolute;
// left: 50%;
// top: 10%;
// transform: translate(-50%, -50%);
.del_header {
position: absolute;
width: calc(100%);
height: 68px;
background: linear-gradient(
rgba(78, 166, 255, 0.2) 0%,
rgba(78, 166, 255, 0) 100%
);
}
.del_main {
width: 100%;
position: relative;
.header {
display: flex;
align-items: center;
padding-top: 20px;
padding-left: 26px;
font-size: 16px;
.icon {
width: 16px;
height: 16px;
margin-right: 10px;
background-image: url(@/assets/images/coursewareManage/notice.png);
background-size: 100% 100%;
}
.close_exit {
position: absolute;
right: 42px;
cursor: pointer;
width: 20px;
height: 20px;
background-image: url(@/assets/images/coursewareManage/close.png);
background-size: 100% 100%;
}
}
.body {
width: 100%;
margin: 34px auto 56px auto;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
// background-color: red;
position: relative;
.back {
position: absolute;
top: 30px;
font-size: 12px;
font-weight: 400;
color: #666666;
}
}
.del_btnbox {
display: flex;
margin: 30px auto;
justify-content: center;
.del_btn {
width: 100px;
height: 40px;
background: rgba(64, 158, 255, 0);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
cursor: pointer;
.btnText {
font-size: 14px;
font-weight: 400;
line-height: 40px;
}
}
.btn1 {
border: 1px solid rgba(64, 158, 255, 1);
color: #4ea6ff;
margin-right: 14px;
}
.btn2 {
background-color: #4ea6ff;
color: #ffffff;
}
}
}
}
}
}
}
}
.powerList {
// width: 80%;
.ant-drawer-content-wrapper {
// max-width: 1000px;
.ant-drawer-header {
display: none !important;
}
.ant-drawer-body {
padding: 0;
}
}
.drawerMain {
// overflow: auto;
min-width: 500px;
margin: 0px 32px 0px 32px;
overflow-x: auto;
display: flex;
flex-direction: column;
.header {
height: 73px;
border-bottom: 1px solid #e8e8e8;
display: flex;
justify-content: space-between;
align-items: center;
flex-shrink: 0;
// background-color: red;
margin-bottom: 20px;
.headerTitle {
font-size: 18px;
font-weight: 600;
color: #333333;
line-height: 25px;
// margin-left: 24px;
}
}
.main {
width: 100%;
// height: 100%;
// background-color: #bfa;
overflow-y: auto;
margin-bottom: 80px;
.search {
width: 100%;
display: flex;
flex-wrap: wrap;
margin-top: 10px;
//justify-content: space-between;
.leftchoose {
display: flex;
margin-right: 20px;
.namecon {
display: flex;
flex-wrap: nowrap;
margin-bottom: 10px;
.name {
margin-top: 8px;
white-space: nowrap;
}
// .name {
// margin-top: 8px;
// color: rgba(0, 0, 0, 0.85);
// font-size: 14px;
// font-weight: 400;
// }
}
}
.btns {
display: flex;
flex-wrap: nowrap;
.btn {
cursor: pointer;
width: 100px;
height: 40px;
border-radius: 8px;
display: flex;
justify-content: center;
align-items: center;
.img1 {
width: 15px;
height: 17px;
background-image: url(../../assets/images/courseManage/search0.png);
background-size: 100% 100%;
margin-right: 7px;
}
.img2 {
width: 16px;
height: 18px;
background-image: url(../../assets/images/courseManage/reset1.png);
background-size: 100% 100%;
margin-right: 7px;
}
}
.btn1 {
background: #409eff;
color: #ffffff;
}
.btn2 {
background: #ffffff;
color: #409eff;
border: 1px solid #409eff;
}
}
}
.tableBox {
// margin-bottom: 80px;
.classify {
// margin-left: 11px !important;
// padding-left: 9px !important;
padding-left: 20px !important;
}
.ant-checkbox-wrapper {
align-items: center;
margin-top: -2px;
}
.ant-table-selection-column {
padding: 0px !important;
// padding-left: 45px !important;
}
.ant-table-thead > tr > th {
background-color: rgba(239, 244, 252, 1);
}
th.h {
background-color: #eff4fc !important;
}
.ant-table-tbody
> tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
> td {
background: #f6f9fd;
}
.opa {
// background-color: #bfa;
font-size: 14px;
font-weight: 400;
color: #388be1;
cursor: pointer;
}
}
.tableBox {
.pa {
// left: 0;
margin-top: 25px;
// margin-bottom: 70px;
width: 100%;
// height: 20px;
// background-color: red;
display: flex;
justify-content: center;
// position: absolute;
// bottom: 20px;
// margin-bottom: 20px;
.ant-pagination-prev,
.ant-pagination-next,
.ant-pagination-options {
margin-bottom: 10px;
}
.ant-pagination-item {
margin-bottom: 10px;
}
}
}
// .tab {
// .ant-table-thead > tr > th {
// background-color: rgba(239, 244, 252, 1) !important;
// }
// th.h {
// background-color: #eff4fc !important;
// }
// .ant-table-tbody
// > tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
// > td {
// background: #f6f9fd;
// }
// }
}
}
// .botm {
// width: 100%;
// height: 200px;
// background-color: red;
// }
.btnn {
height: 72px;
width: 100%;
position: absolute;
background-color: #fff;
bottom: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.16);
.btn1 {
width: 100px;
height: 40px;
border: 1px solid #4ea6ff;
border-radius: 8px;
color: #4ea6ff;
background-color: #fff;
cursor: pointer;
}
.btn2 {
cursor: pointer;
width: 100px;
height: 40px;
background: #409eff;
border-radius: 8px;
border: 0;
margin-left: 15px;
color: #fff;
}
}
}
</style>