Explorar el Código

提交日报周报页面

newStyle
douzhuo hace 2 años
padre
commit
faf714dbe3
Se han modificado 1 ficheros con 303 adiciones y 209 borrados
  1. +303
    -209
      src/views/admin/role/index.vue

+ 303
- 209
src/views/admin/role/index.vue Ver fichero

@@ -8,76 +8,51 @@
<el-radio-button label="1">公司角色</el-radio-button>
<el-radio-button label="2">代理商角色</el-radio-button>
<el-radio-button label="3">系统角色</el-radio-button>
<!-- <el-radio-button label="4">运营角色</el-radio-button> -->
</el-radio-group>
</div>
<!-- <div style="margin-bottom:20px;">
<div v-if="tabselect==0||tabselect==1">
选择公司
<el-select v-model="orgId" placeholder="请选择">
<el-option
v-for="item in orgList"
:key="item.id"
:label="item.name"
:value="item.id"
:disabled="item.disabled">
</el-option>
</el-select>
</div>
<div v-if="tabselect==2">
选择代理商
<el-select v-model="agentId" placeholder="请选择">
<el-option
v-for="item in agentList"
:key="item.id"
:label="item.agentName"
:value="item.id"
:disabled="item.disabled">
</el-option>
</el-select>
</div>
<div v-if="tabselect==3">
请选择系统
<el-select v-model="value" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
</div> -->
<el-row :span="24" :gutter="26">
<el-col :xs="24" :sm="24" :md="5" class="user__tree">
<el-input placeholder="输入关键字进行过滤" v-model="filterText">
</el-input>
<div style="overflow: auto; height: 680px">
<el-tree class="filter-tree" :data="treeDataList" node-key="id" :default-select-keys="selectKeys"
:props="defaultProps1" :filter-node-method="filterNode" @node-click="nodeClick" ref="tree">
<el-tree
class="filter-tree"
:data="treeDataList"
node-key="id"
:default-select-keys="selectKeys"
:props="defaultProps1"
:filter-node-method="filterNode"
@node-click="nodeClick"
ref="tree"
>
</el-tree>
</div>
<!-- <avue-tree
:option="treeOption"
:data="treeDataList"
@node-click="nodeClick"
>
<span class="el-tree-node__label" slot-scope="{ node, data }">
<span>{{node.label}}</span>
</span>
</avue-tree> -->
</el-col>
<el-col :xs="24" :sm="24" :md="19" class="user__main">
<div style="margin: 0 0 10px 10px">
<el-button type="primary" :disabled="checkRole.length == 0" @click="delIds">批量删除</el-button>
<el-button
type="primary"
:disabled="checkRole.length == 0"
@click="delIds"
>批量删除</el-button
>
<el-button type="primary" @click="addRole">添加</el-button>
</div>

<div class="top" style="margin-left: 10px">
<el-form :inline="true" :model="searchMsg" class="demo-form-inline" ref="searchForm">
<el-form
:inline="true"
:model="searchMsg"
class="demo-form-inline"
ref="searchForm"
>
<el-form-item label="角色名" prop="roleName">
<el-input v-model="searchMsg.roleName" placeholder="请输入角色名" maxlength="10" clearable></el-input>
<el-input
v-model="searchMsg.roleName"
placeholder="请输入角色名"
maxlength="10"
clearable
></el-input>
</el-form-item>
<el-form-item label="状态" prop="lockFlag">
<el-select v-model="searchMsg.lockFlag" placeholder="请选择">
@@ -87,13 +62,28 @@
</el-form-item>
<el-form-item>
<el-button type="primary" @click="search">查询</el-button>
<el-button type="primary" @click="$refs.searchForm.resetFields()">重置</el-button>
<el-button
type="primary"
@click="$refs.searchForm.resetFields()"
>重置</el-button
>
</el-form-item>
</el-form>
</div>

<el-table :data="list" border @selection-change="handleSelectionChange" style="width: 100%"
:header-cell-style="{ textAlign: 'center',background:'#F5F7FA',color:'#333333' }" :cell-style="{ textAlign: 'center' }" height="390">
<el-table
:data="list"
border
@selection-change="handleSelectionChange"
style="width: 100%"
:header-cell-style="{
textAlign: 'center',
background: '#F5F7FA',
color: '#333333',
}"
:cell-style="{ textAlign: 'center' }"
height="390"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column type="index" label="序号" width="50">
</el-table-column>
@@ -101,117 +91,118 @@
</el-table-column>
<el-table-column prop="lockFlag" label="状态" width="200">
<template slot-scope="scope">
<el-tag :type="scope.row.lockFlag === '0' ? 'success' : 'danger'" disable-transitions>{{
scope.row.lockFlag == 0 ? "启用" : "禁用"
}}</el-tag>
<el-tag
:type="scope.row.lockFlag === '0' ? 'success' : 'danger'"
disable-transitions
>{{ scope.row.lockFlag == 0 ? "启用" : "禁用" }}</el-tag
>
</template>
</el-table-column>
<el-table-column prop="roleDesc" label="角色描述" width="200">
</el-table-column>
<!-- <el-table-column
prop="dsScope"
label="数据权限"
width="200">
</el-table-column> -->
<el-table-column prop="address" label="操作">
<template slot-scope="scope">

<el-button v-if="roleManager_btn_edit" type="text" size="small" icon="el-icon-zoom-in"
@click="handleShow(scope.row, true)">查看
<el-button
v-if="roleManager_btn_edit"
type="text"
size="small"
icon="el-icon-zoom-in"
@click="handleShow(scope.row, true)"
>查看
</el-button>
<el-button v-if="roleManager_btn_edit" type="text" size="small" icon="el-icon-edit"
@click="handleShow(scope.row, false)">编辑
<el-button
v-if="roleManager_btn_edit"
type="text"
size="small"
icon="el-icon-edit"
@click="handleShow(scope.row, false)"
>编辑
</el-button>

<el-dropdown>
<el-button type="text" size="small" style="margin-left:10px;">更多</el-button>
<el-button type="text" size="small" style="margin-left: 10px"
>更多</el-button
>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>
<el-button v-if="roleManager_btn_del" type="text" size="small" icon="el-icon-delete"
@click="handleDelete(scope.row)">删除
<el-button
v-if="roleManager_btn_del"
type="text"
size="small"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除
</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button v-if="roleManager_btn_perm" type="text" size="small" icon="el-icon-plus"
@click="handlePermission(scope.row)">权限
<el-button
v-if="roleManager_btn_perm"
type="text"
size="small"
icon="el-icon-plus"
@click="handlePermission(scope.row)"
>权限
</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button v-if="roleManager_btn_perm" type="text" size="small" icon="el-icon-plus"
@click="geTmenu(scope.row)">小程序权限
</el-button>
<el-button
v-if="roleManager_btn_perm"
type="text"
size="small"
icon="el-icon-plus"
@click="geTmenu(scope.row)"
>小程序权限
</el-button>
</el-dropdown-item>

<el-dropdown-item>
<el-button
v-if="permissions['sys_role_push']"
type="text"
size="small"
icon="el-icon-plus"
@click="showPushMenu(scope.row, false)"
>推送权限
</el-button>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>



</template>
</el-table-column>
</el-table>
<el-pagination style="text-align: center" background @size-change="sizeChange" @current-change="currentChange"
:current-page.sync="page.pageNum" :page-size="page.pageSize" layout="total,prev, pager, next, jumper"
:total="page.total">
<el-pagination
style="text-align: center"
background
@size-change="sizeChange"
@current-change="currentChange"
:current-page.sync="page.pageNum"
:page-size="page.pageSize"
layout="total,prev, pager, next, jumper"
:total="page.total"
>
</el-pagination>
<!-- <avue-crud
ref="crud"
:option="tableOption"
:data="list"
:page.sync="page"
v-model="form"
:table-loading="listLoading"
:before-open="handleOpenBefore"
@on-load="getList"
@search-change="searchChange"
@refresh-change="refreshChange"
@size-change="sizeChange"
@current-change="currentChange"
@row-update="update"
@row-save="create">

<template slot="menuLeft">
<el-button
v-if="roleManager_btn_add"
class="filter-item"
type="primary"
icon="el-icon-edit"
@click="handleCreate">添加
</el-button>
</template>
<template
slot="deptIdForm"
slot-scope="scope">
<avue-input-tree
v-model="form.deptId"
:dic="treeDataList"
:props="defaultProps1"
placeholder="请选择所属部门"/>
</template>
<template slot="dsScopeForm" slot-scope="scope">
<div v-if="form.dsType == 1">
<el-tree
ref="scopeTree"
:data="dsScopeData"
:check-strictly="true"
:props="defaultProps"
:default-checked-keys="checkedDsScope"
class="filter-tree"
node-key="id"
highlight-current
show-checkbox/>
</div>
</template> -->

<!-- </avue-crud> -->
</el-col>
</el-row>
</basic-container>

<el-dialog :title="formTitle" :visible.sync="dialogFormVisible" @close="resetForm">
<el-form :model="form" label-width="120px" ref="form" :rules="rules" :disabled="editFlag">
<el-dialog
:title="formTitle"
:visible.sync="dialogFormVisible"
@close="resetForm"
>
<el-form
:model="form"
label-width="120px"
ref="form"
:rules="rules"
:disabled="editFlag"
>
<el-form-item label="状态:">
<el-switch v-model="form.lockFlag" active-value="0" inactive-value="1"></el-switch>
<el-switch
v-model="form.lockFlag"
active-value="0"
inactive-value="1"
></el-switch>
</el-form-item>
<el-form-item label="角色名称:" prop="roleName">
<el-input v-model="form.roleName"></el-input>
@@ -226,7 +217,12 @@
</el-select>
</el-form-item> -->
<el-form-item label="角色描述:" prop="roleDesc">
<el-input v-model="form.roleDesc" type="textarea" maxlength="50" show-word-limit></el-input>
<el-input
v-model="form.roleDesc"
type="textarea"
maxlength="50"
show-word-limit
></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@@ -235,34 +231,91 @@
</div>
</el-dialog>

<el-dialog :visible.sync="dialogPermissionVisible" :close-on-click-modal="false" title="分配权限">
<el-dialog :visible.sync="pushMessageShow" title="推送消息权限">
<div class="dialog-main">
<el-checkbox-group v-model="checkList">
<el-checkbox label="1">设备低电提醒</el-checkbox>
<el-checkbox label="2">未开启录音提醒</el-checkbox>
<el-checkbox label="3">接待延时提醒</el-checkbox>
<el-checkbox label="4">日报</el-checkbox>
<el-checkbox label="5">周报</el-checkbox>
<el-checkbox label="6">月报</el-checkbox>
<el-checkbox label="7">违禁提醒</el-checkbox>
</el-checkbox-group>
</div>

<div slot="footer" class="dialog-footer">
<el-button @click="addPush" type="primary" size="small"
>确 定
</el-button>
<el-button type="default" size="small" @click="cancelAddPush"
>取消</el-button
>
</div>
</el-dialog>

<el-dialog
:visible.sync="dialogPermissionVisible"
:close-on-click-modal="false"
title="分配权限"
>
<div class="dialog-main-tree">
<el-tree ref="menuTree" :data="treeData" :default-checked-keys="checkedKeys" :check-strictly="false"
:props="defaultProps" :filter-node-method="filterNode" class="filter-tree" node-key="id" highlight-current
show-checkbox />
<el-tree
ref="menuTree"
:data="treeData"
:default-checked-keys="checkedKeys"
:check-strictly="false"
:props="defaultProps"
:filter-node-method="filterNode"
class="filter-tree"
node-key="id"
highlight-current
show-checkbox
/>
<!-- default-expand-all -->
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" size="small" @click="updatePermession(roleId)">更 新
<el-button type="primary" size="small" @click="updatePermession(roleId)"
>更 新
</el-button>
<el-button type="default" size="small" @click="cancal()">取消</el-button>
<el-button type="default" size="small" @click="cancal()"
>取消</el-button
>
</div>
</el-dialog>

<el-dialog :visible.sync="geTmenuListisshow" :close-on-click-modal="false" title="小程序权限">
<el-dialog
:visible.sync="geTmenuListisshow"
:close-on-click-modal="false"
title="小程序权限"
>
<div class="dialog-main-tree">
<el-tree ref="menuTree" :data="geTmenuList" :default-checked-keys="checkedKeys2" :check-strictly="false"
:props="defaultProps9" :filter-node-method="filterNode" class="filter-tree" node-key="id" highlight-current
show-checkbox />
<el-tree
ref="menuTree"
:data="geTmenuList"
:default-checked-keys="checkedKeys2"
:check-strictly="false"
:props="defaultProps9"
:filter-node-method="filterNode"
class="filter-tree"
node-key="id"
highlight-current
show-checkbox
/>
<!-- default-expand-all -->
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" size="small" @click="updatePermession2(roleId2)">更 新
<el-button
type="primary"
size="small"
@click="updatePermession2(roleId2)"
>更 新
</el-button>
<el-button type="default" size="small" @click="cancal()">取消</el-button>
<el-button type="default" size="small" @click="cancal()"
>取消</el-button
>
</div>
</el-dialog>

</div>
</template>

@@ -340,6 +393,7 @@ export default {
roleDesc: "", //描述
orgCode: "", //公司
lockFlag: "0", //状态
messageType: "",
},
addFlag: true,
rules: {
@@ -360,7 +414,6 @@ export default {
roleManager_btn_del: false,
roleManager_btn_perm: false,


geTmenuList: [],
geTmenuListisshow: false,
checkedKeys2: [],
@@ -368,10 +421,12 @@ export default {
label: "name",
value: "id",
},
roleId2: '',
roleCode2: '',
menuIds2: ''
roleId2: "",
roleCode2: "",
menuIds2: "",

pushMessageShow: false, // 推送消息权限弹窗
checkList: [], // 选中权限的id数组
};
},
async created() {
@@ -391,24 +446,66 @@ export default {
...mapGetters(["elements", "permissions"]),
},
methods: {
geTmenu(row) {
fetchRoleTree2(row.roleId).then((response) => {
this.checkedKeys2 = response.data;
return fetchMenuTree2();
}).then((response) => {
this.geTmenuList = response.data;
console.log(this.geTmenuList, '55555555555')
// 解析出所有的太监节点
this.checkedKeys2 = this.resolveAllEunuchNodeId(
this.geTmenuList,
this.checkedKeys2,
[]
);
this.geTmenuListisshow = true;
this.roleId2 = row.roleId;
this.roleCode2 = row.roleCode;
// 编辑
// 展示推送权限复选框
showPushMenu(row, boolean) {
this.form = { ...this.form, ...row };
console.log(row);
this.pushMessageShow = !this.pushMessageShow;
this.addFlag = boolean;
if (row.messageType) {
console.log(row.messageType, "这里是messagetype");
this.checkList = row.messageType.split(',')
}
},

// 取消推送
cancelAddPush() {
this.pushMessageShow = false;
this.checkList = [];
},

// 确认添加
addPush() {
if (this.checkList.length == 0) {
this.$message.info("请选择需要推送的权限");
return;
}
if (this.checkList.length > 0) {
this.form.messageType = this.checkList.join(",");
}

putObj(this.form).then((res) => {
console.log(res);
this.cancelAddPush();
if (res.data) {
this.$message.success("编辑成功");
} else {
this.$message.error(res.msg);
}
});
},

geTmenu(row) {
fetchRoleTree2(row.roleId)
.then((response) => {
this.checkedKeys2 = response.data;
return fetchMenuTree2();
})
.then((response) => {
this.geTmenuList = response.data;
console.log(this.geTmenuList, "55555555555");
// 解析出所有的太监节点
this.checkedKeys2 = this.resolveAllEunuchNodeId(
this.geTmenuList,
this.checkedKeys2,
[]
);
this.geTmenuListisshow = true;
this.roleId2 = row.roleId;
this.roleCode2 = row.roleCode;
});
},
updatePermession2(roleId) {
this.menuIds2 = "";
this.menuIds2 = this.$refs.menuTree
@@ -424,7 +521,7 @@ export default {
// 单选框改变
radioChange(e) {
// console.log(e)
this.filterText = ''
this.filterText = "";
this.treeDataList = [];
if (e == 0 || e == 1) {
this.findMyOrg();
@@ -451,7 +548,6 @@ export default {
});
this.treeDataList = res.data;
this.orgCode = res.data[0].id;
// console.log(this.orgCode);
this.selectKeys = [res.data[0].id];
this.$nextTick(() => {
// this.selectKeys=[res.data[0].id]
@@ -479,23 +575,14 @@ export default {
});
},
getList() {
// fetchList(Object.assign({
// current: this.page.currentPage,
// size: this.page.pageSize,
// orgCode:this.orgCode
// }, params, this.searchForm)).then(response => {
// this.list = response.data.records
// this.page.total = response.data.total
// }).catch(() => {
// })
let obj = {
current: this.page.currentPage,
size: this.page.pageSize,
...this.searchMsg
...this.searchMsg,
};
if (this.tabselect == 0 || this.tabselect == 1) {
obj.orgCode = this.orgCode;
this.tabselect == 0 ? obj.orgType = 3 : obj.orgType = 2
this.tabselect == 0 ? (obj.orgType = 3) : (obj.orgType = 2);
}
if (this.tabselect == 2) {
obj.agentId = this.orgCode;
@@ -549,8 +636,8 @@ export default {
addRole() {
// console.log(1);
if (this.tabselect == 4) {
this.$message.warning('运营角色不能添加!')
return
this.$message.warning("运营角色不能添加!");
return;
}
this.dialogFormVisible = true;
this.addFlag = true;
@@ -572,19 +659,18 @@ export default {
return;
}
if (this.tabselect == 0 || this.tabselect == 1) {
this.tabselect == 0 ? this.form.orgType = 3 : this.form.orgType = 2
this.tabselect == 0 ? (this.form.orgType = 3) : (this.form.orgType = 2);
this.form.orgCode = this.orgCode;
this.form.agentId = null;
}
else if (this.tabselect == 2) {
} else if (this.tabselect == 2) {
this.form.orgCode = null;
this.form.agentId = this.orgCode;
}
else {
} else {
this.form.orgCode = null;
this.form.agentId = null;
}
console.log(this.form);

// return
if (this.addFlag) {
this.$refs.form.validate((valid) => {
@@ -653,21 +739,23 @@ export default {
this.geTmenuListisshow = false;
},
handlePermission(row) {
fetchRoleTree(row.roleId).then((response) => {
this.checkedKeys = response.data;
return fetchMenuTree();
}).then((response) => {
this.treeData = response.data;
// 解析出所有的太监节点
this.checkedKeys = this.resolveAllEunuchNodeId(
this.treeData,
this.checkedKeys,
[]
);
this.dialogPermissionVisible = true;
this.roleId = row.roleId;
this.roleCode = row.roleCode;
});
fetchRoleTree(row.roleId)
.then((response) => {
this.checkedKeys = response.data;
return fetchMenuTree();
})
.then((response) => {
this.treeData = response.data;
// 解析出所有的太监节点
this.checkedKeys = this.resolveAllEunuchNodeId(
this.treeData,
this.checkedKeys,
[]
);
this.dialogPermissionVisible = true;
this.roleId = row.roleId;
this.roleCode = row.roleCode;
});
},
/**
* 解析出所有的太监节点id
@@ -796,7 +884,13 @@ export default {
margin-left: 20% !important;
}
}
/deep/ .el-button--primary{
background: #2671E2 !important;
border: 1px solid #2671E2 !important;
/deep/ .el-button--primary {
background: #2671e2 !important;
border: 1px solid #2671e2 !important;
}

.dialog-main {
width: 800px;
height: 150px;
}
</style>

Cargando…
Cancelar
Guardar