优化角色管理

This commit is contained in:
龙运模 2024-09-13 22:19:26 +08:00
parent 0abff1e576
commit 2812f1eef3
11 changed files with 433 additions and 82 deletions

View File

@ -70,6 +70,13 @@ export default {
return await http.post(this.url, params); return await http.post(this.url, params);
}, },
}, },
sort:{
url: `${config.API_URL}/roles.sort`,
name: "角色排序",
post: async function (params) {
return await http.post(this.url, params);
},
},
users:{ users:{
url: `${config.API_URL}/roles.users`, url: `${config.API_URL}/roles.users`,
name: "角色成员", name: "角色成员",
@ -336,6 +343,13 @@ export default {
return await http.post(this.url, params); return await http.post(this.url, params);
}, },
}, },
userType:{
url: `${config.API_URL}/user.type.list`,
name: "用户类型常量",
post: async function (params) {
return await http.post(this.url, params);
},
},
status:{ status:{
url: `${config.API_URL}/user.status.update`, url: `${config.API_URL}/user.status.update`,
name: "用户状态", name: "用户状态",
@ -343,6 +357,20 @@ export default {
return await http.post(this.url, params); return await http.post(this.url, params);
}, },
}, },
auditStatus:{
url: `${config.API_URL}/user.audit.status.list`,
name: "用户审核常量",
post: async function (params) {
return await http.post(this.url, params);
}
},
audit:{
url: `${config.API_URL}/user.audit`,
name: "用户审核",
post: async function (params) {
return await http.post(this.url, params);
}
},
allocatRole: { allocatRole: {
url: `${config.API_URL}/auth.user.role`, url: `${config.API_URL}/auth.user.role`,
name: "用户分配角色", name: "用户分配角色",

View File

@ -25,7 +25,7 @@
<el-switch v-model="item.sortable"></el-switch> <el-switch v-model="item.sortable"></el-switch>
</span> </span>
<span class="fixed_b"> <span class="fixed_b">
<el-switch v-model="item.fixed"></el-switch> <el-switch v-model="item.fix"></el-switch>
</span> </span>
</li> </li>
</ul> </ul>

View File

@ -13,8 +13,8 @@
<el-table v-bind="$attrs" :header-cell-style="{'background': '#F5F7FA','color':'#606266'}" :data="tableData" :row-key="rowKey" :key="toggleIndex" ref="scTable" :height="height=='auto'?null:'100%'" :size="config.size" :border="config.config.border" :stripe="config.config.stripe" :summary-method="remoteSummary?remoteSummaryMethod:summaryMethod" @sort-change="sortChange" @filter-change="filterChange"> <el-table v-bind="$attrs" :header-cell-style="{'background': '#F5F7FA','color':'#606266'}" :data="tableData" :row-key="rowKey" :key="toggleIndex" ref="scTable" :height="height=='auto'?null:'100%'" :size="config.size" :border="config.config.border" :stripe="config.config.stripe" :summary-method="remoteSummary?remoteSummaryMethod:summaryMethod" @sort-change="sortChange" @filter-change="filterChange">
<slot></slot> <slot></slot>
<template v-for="(item, index) in userColumn" :key="index"> <template v-for="(item, index) in userColumn" :key="index">
<!-- item.showOverflowTooltip--> <!--item.showOverflowTooltip-->
<el-table-column v-if="!item.hide" :column-key="item.prop" :label="item.label" :prop="item.prop" :width="item.width" :sortable="item.sortable" :fixed="item.fixed" :filters="item.filters" :filter-method="remoteFilter||!item.filters?null:filterHandler" :show-overflow-tooltip="true"> <el-table-column v-if="!item.hide" :column-key="item.prop" :label="item.label" :prop="item.prop" :width="item.width" :sortable="item.sortable" :fixed="item.fix" :filters="item.filters" :filter-method="remoteFilter||!item.filters?null:filterHandler" :show-overflow-tooltip="true">
<template #default="scope"> <template #default="scope">
<slot :name="item.prop" v-bind="scope"> <slot :name="item.prop" v-bind="scope">
{{scope.row[item.prop]}} {{scope.row[item.prop]}}
@ -28,6 +28,9 @@
</template> </template>
</el-table> </el-table>
</div> </div>
<div class="scTable-total" v-if="!hideTotal">
<slot name="total" :params="total_count_item"></slot>
</div>
<div class="scTable-page" v-if="!hidePagination || !hideDo"> <div class="scTable-page" v-if="!hidePagination || !hideDo">
<div class="scTable-pagination"> <div class="scTable-pagination">
<el-pagination v-if="!hidePagination && showPagination" background :small="true" :layout="paginationLayout" :total="total" :page-size="scPageSize" :page-sizes="pageSizes" v-model:currentPage="currentPage" @current-change="paginationChange" @update:page-size="pageSizeChange"></el-pagination> <el-pagination v-if="!hidePagination && showPagination" background :small="true" :layout="paginationLayout" :total="total" :page-size="scPageSize" :page-sizes="pageSizes" v-model:currentPage="currentPage" @current-change="paginationChange" @update:page-size="pageSizeChange"></el-pagination>
@ -92,6 +95,7 @@
hidePagination: { type: Boolean, default: false }, hidePagination: { type: Boolean, default: false },
showPagination: { type: Boolean, default: true }, showPagination: { type: Boolean, default: true },
hideDo: { type: Boolean, default: false }, hideDo: { type: Boolean, default: false },
hideTotal: { type: Boolean, default: true },
hideRefresh: { type: Boolean, default: false }, hideRefresh: { type: Boolean, default: false },
hideSetting: { type: Boolean, default: false }, hideSetting: { type: Boolean, default: false },
paginationLayout: { type: String, default: config.paginationLayout }, paginationLayout: { type: String, default: config.paginationLayout },
@ -117,7 +121,7 @@
return Number(this.height)?Number(this.height)+'px':this.height return Number(this.height)?Number(this.height)+'px':this.height
}, },
_table_height() { _table_height() {
return this.hidePagination && this.hideDo ? "100%" : "calc(100% - 51px)" return this.hidePagination && this.hideDo ? "100%" : this.hideTotal? "calc(100% - 51px)": "calc(100% - 83px)"
} }
}, },
data() { data() {
@ -127,6 +131,10 @@
emptyText: "暂无数据", emptyText: "暂无数据",
toggleIndex: 0, toggleIndex: 0,
tableData: [], tableData: [],
total_count_item:{
total_quantity:0,
total_cost:0
},
total: 0, total: 0,
currentPage: 1, currentPage: 1,
prop: null, prop: null,
@ -234,6 +242,9 @@
if(response.data.tableConfig && response.data.tableConfig.size){ if(response.data.tableConfig && response.data.tableConfig.size){
this.config = response.data.tableConfig; this.config = response.data.tableConfig;
} }
if(response.data.count_item){
this.total_count_item = response.data.count_item;
}
this.total = response.total || 0; this.total = response.total || 0;
this.summary = response.summary || {}; this.summary = response.summary || {};
this.loading = false; this.loading = false;
@ -453,6 +464,7 @@
.scTable {} .scTable {}
.scTable-table {height: calc(100% - 50px);} .scTable-table {height: calc(100% - 50px);}
.scTable-page {height:50px;display: flex;align-items: center;justify-content: space-between;padding:0 15px;} .scTable-page {height:50px;display: flex;align-items: center;justify-content: space-between;padding:0 15px;}
.scTable-total{background: var(--el-fill-color-light);height: 32px;display: flex;align-items: center;padding: 0 15px;border-bottom: var(--el-table-border);}
.scTable-do {white-space: nowrap;} .scTable-do {white-space: nowrap;}
.scTable ::v-deep .el-table__footer .cell {font-weight: bold;} .scTable ::v-deep .el-table__footer .cell {font-weight: bold;}
.scTable ::v-deep .el-table__body-wrapper .el-scrollbar__bar.is-horizontal {height: 12px;border-radius: 12px;} .scTable ::v-deep .el-table__body-wrapper .el-scrollbar__bar.is-horizontal {height: 12px;border-radius: 12px;}

View File

@ -31,6 +31,7 @@
--el-menu-item-height:50px; --el-menu-item-height:50px;
--el-component-size-small:28px; --el-component-size-small:28px;
--el-order-color-0:#909399;
--el-order-color-1:#E8641B; --el-order-color-1:#E8641B;
--el-order-color-2:#3072FF; --el-order-color-2:#3072FF;
--el-order-color-3:#0DA525; --el-order-color-3:#0DA525;
@ -68,7 +69,7 @@
--el-tabs-header-height:42px; --el-tabs-header-height:42px;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column-reverse;
.el-tabs__active-bar{ .el-tabs__active-bar{
bottom: 0; bottom: 0;
} }
@ -108,6 +109,9 @@
.el-main.treeMain{border-radius: 0;} .el-main.treeMain{border-radius: 0;}
.el-main.nopadding {padding:0;background: #fff;display: flex;flex-direction: column;} .el-main.nopadding {padding:0;background: #fff;display: flex;flex-direction: column;}
.el-main.nopadding .scTable{flex: 1;overflow: hidden;} .el-main.nopadding .scTable{flex: 1;overflow: hidden;}
.el-main.nopadding .scTable .scTable-total .totalView{display: flex;align-items: center;}
.el-main.nopadding .scTable .scTable-total .totalView .total-item{margin: 0 6px;}
.el-main.nopadding .scTable .scTable-total .totalView .total-item .text{margin-right: 4px;}
/** 列表上面的检索 */ /** 列表上面的检索 */
.el-main.nopadding .searchMain{display: flex;flex-wrap: wrap;align-items: self-end;padding-bottom: 10px;margin: 15px 0 0 0; border-bottom: 1px solid var(--el-border-color-light);} .el-main.nopadding .searchMain{display: flex;flex-wrap: wrap;align-items: self-end;padding-bottom: 10px;margin: 15px 0 0 0; border-bottom: 1px solid var(--el-border-color-light);}

View File

@ -29,7 +29,7 @@
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button> <el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
</div> </div>
</div> </div>
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" row-key="id" stripe :size="size" @selection-change="selectionChange"> <scTable ref="table" :apiObj="list.apiObj" :column="list.column" row-key="id" stripe :size="size" @selection-change="selectionChange" :hideTotal="false">
<el-table-column type="selection" align="center" width="40"></el-table-column> <el-table-column type="selection" align="center" width="40"></el-table-column>
<sc-table-column label="序号" align="center" type="index"></sc-table-column> <sc-table-column label="序号" align="center" type="index"></sc-table-column>
<template #logo="scope"> <template #logo="scope">
@ -62,6 +62,19 @@
</el-dropdown> </el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
<template #total="{params}">
<div class="totalView">
<span class="name">汇总合计</span>
<div class="total-item">
<span class="text">数量</span>
<span class="num">{{params.total_quantity}}</span>
</div>
<div class="total-item">
<span class="text">金额</span>
<span class="num">{{params.total_cost}}</span>
</div>
</div>
</template>
</scTable> </scTable>
</el-main> </el-main>
</el-container> </el-container>

View File

@ -108,7 +108,7 @@
}, },
methods: { methods: {
async getYzm() { async getYzm() {
const validate = await this.$refs.stepForm_0.validateField("mobile").catch(() => {}); const validate = await this.$refs.stepForm_1.validateField("mobile").catch(() => {});
if (!validate) { if (!validate) {
return false return false
} }

View File

@ -10,25 +10,14 @@
</div> </div>
</el-header> </el-header>
<el-container class="mainBox" style="border-radius: 0;"> <el-container class="mainBox" style="border-radius: 0;padding-left: 0;padding-right: 0;">
<el-aside width="200px" v-loading="showGroupLoading"> <el-aside width="200px" v-loading="showGroupLoading">
<el-container> <el-container>
<el-header> <!-- <el-header>-->
<el-input placeholder="输入关键字进行过滤" :size="size" v-model="groupFilterText" clearable></el-input> <!-- <el-input placeholder="输入关键字进行过滤" :size="size" v-model="groupFilterText" clearable></el-input>-->
</el-header> <!-- </el-header>-->
<el-main class="treeMain nopadding"> <el-main class="treeMain nopadding">
<!-- :default-checked-keys="roleCheckList" @check-change="groupChange"--> <role-sort ref="roleSort" :role_id="role_id" :column="group" @roleChange="groupChange" @roleClick="roleClick" @roleEdit="table_edit" @roleDelete="table_del"></role-sort>
<el-tree ref="group" class="menu" node-key="id" :data="group" :current-node-key="role_id" :highlight-current="true" :expand-on-click-node="false" :filter-node-method="groupFilterNode" @node-click="groupClick">
<template #default="{ node, data }">
<span class="custom-tree-node">
<span>{{ node.label }}</span>
<span class="btnBox">
<el-icon class="btn" v-auth="'disableRoles'" @click="table_edit(data)"><sc-icon-Edit/></el-icon>
<el-icon class="btn" v-auth="'delRoles'" @click="table_del(data)"><sc-icon-Delete/></el-icon>
</span>
</span>
</template>
</el-tree>
</el-main> </el-main>
</el-container> </el-container>
</el-aside> </el-aside>
@ -112,6 +101,7 @@
import dataPermissions from "./dataPermissions"; import dataPermissions from "./dataPermissions";
import members from "./members"; import members from "./members";
import treeUser from "./tree" import treeUser from "./tree"
import roleSort from "./roleSort";
export default { export default {
components: { components: {
@ -120,7 +110,8 @@
dataTree, dataTree,
dataPermissions, dataPermissions,
members, members,
treeUser treeUser,
roleSort
}, },
watch:{ watch:{
groupFilterText(val) { groupFilterText(val) {
@ -282,17 +273,21 @@
if (!value) return true; if (!value) return true;
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1;
}, },
// //
// groupChange(data,isCheck){ groupChange(data){
// let list = JSON.parse(JSON.stringify(this.roleCheckList)); let params = {
// if(isCheck){ sort_info:data.map((item,index)=>({
// this.roleCheckList.push(data.id); id:item.id,
// }else{ sort:index+1
// this.roleCheckList = list.filter(em=>em != data.id); }))
// } }
// }, const res = this.$API.system.role.sort.post(params);
if(res.code === 200){
this.$message.success('保存成功');
}
},
// //
groupClick(data){ roleClick(data){
this.role_id = data.id; this.role_id = data.id;
this.getMenu(); this.getMenu();
this.getRoleList(); this.getRoleList();

View File

@ -0,0 +1,107 @@
<template>
<div v-if="roleColumn.length>0" class="setting-column" v-loading="isSave">
<div class="setting-column__list" ref="list">
<ul>
<li v-for="item in roleColumn" :key="item.id" :class="item.id == id?'liCheck':''" @click="liClick(item)">
<span class="move_b">
<el-tag class="move" size="small" style="cursor: move;"><el-icon-d-caret style="width: 1em; height: 1em;"/></el-tag>
</span>
<span class="name_b">{{ item.role_name }}</span>
<span class="btnBox">
<el-icon class="btn edit" size="14px" v-auth="'disableRoles'" @click.stop="table_edit(item)"><sc-icon-Edit/></el-icon>
<el-icon class="btn del" size="14px" v-auth="'delRoles'" @click.stop="table_del(item)"><sc-icon-Delete/></el-icon>
</span>
</li>
</ul>
</div>
</div>
<el-empty v-else description="暂无可配置的列" :image-size="80"></el-empty>
</template>
<script>
import Sortable from 'sortablejs'
export default {
components: {
Sortable
},
props:{
column:{type:Array},
role_id:{type:Number}
},
watch:{
column: {
handler(val){
this.roleColumn = JSON.parse(JSON.stringify(val));
this.$nextTick(()=>{
this.roleColumn.length>0 && this.rowDrop();
})
},
},
role_id:{
handler(val){
this.id = val;
},
deep: true
},
roleColumn:{
handler(newVal,oldVal){
if(oldVal && oldVal.length>0){
this.$emit('roleChange', this.roleColumn)
}
},
deep: true
}
},
data(){
return{
isSave: false,
id:0,
roleColumn: JSON.parse(JSON.stringify(this.column || []))
}
},
mounted() {
},
methods:{
rowDrop(){
const tbody = this.$refs.list.querySelector('ul')
Sortable.create(tbody, {
handle: ".move",
animation: 300,
ghostClass: "ghost",
onEnd:({ newIndex, oldIndex })=> {
const tableData = this.roleColumn
const currRow = tableData.splice(oldIndex, 1)[0]
tableData.splice(newIndex, 0, currRow)
}
})
},
liClick(item){
this.$emit('roleClick',item);
},
table_edit(item){
this.$emit('roleEdit',item);
},
table_del(item){
this.$emit('roleDelete',item);
}
}
}
</script>
<style scoped lang="scss">
.setting-column__list {}
.setting-column__list li {list-style: none;margin:0;padding: 10px 0 10px 10px;display: flex;align-items: center;}
.setting-column__list li .name_b{margin-left: 10px;flex: 1;}
.setting-column__list li.liCheck{background: #E7F3FF;}
.setting-column__list li:hover{background: #E7F3FF;cursor: pointer;}
.setting-column__list li:hover .btnBox{display: flex;align-items: center;}
.btnBox{
display: none;
margin-right: 10px;
.btn{margin: 0 5px;}
.btn.edit{color: var(--el-color-primary)}
.btn.del{color: var(--el-color-danger)}
}
</style>

View File

@ -1,15 +1,15 @@
<template> <template>
<el-container class="mainBox"> <el-container class="mainBox">
<el-aside width="200px" v-loading="showGroupLoading"> <!-- <el-aside width="200px" v-loading="showGroupLoading">-->
<el-container> <!-- <el-container>-->
<el-header> <!-- <el-header>-->
<el-input placeholder="输入关键字进行过滤" :size="size" v-model="groupFilterText" clearable></el-input> <!-- <el-input placeholder="输入关键字进行过滤" :size="size" v-model="groupFilterText" clearable></el-input>-->
</el-header> <!-- </el-header>-->
<el-main class="treeMain nopadding"> <!-- <el-main class="treeMain nopadding">-->
<el-tree ref="group" class="menu" node-key="id" :data="group" :current-node-key="''" :highlight-current="true" :expand-on-click-node="false" :filter-node-method="groupFilterNode" @node-click="groupClick"></el-tree> <!-- <el-tree ref="group" class="menu" node-key="id" :data="group" :current-node-key="''" :highlight-current="true" :expand-on-click-node="false" :filter-node-method="groupFilterNode" @node-click="groupClick"></el-tree>-->
</el-main> <!-- </el-main>-->
</el-container> <!-- </el-container>-->
</el-aside> <!-- </el-aside>-->
<el-container class="mainHeaderNoBorderPadding"> <el-container class="mainHeaderNoBorderPadding">
<el-header style="padding-left: 10px;"> <el-header style="padding-left: 10px;">
<div class="left-panel"> <div class="left-panel">
@ -63,6 +63,20 @@
</span> </span>
</span> </span>
</template> </template>
<template #is_online="scope">
<span class="online" v-if="scope.row.online_info" :style="{color:`var(--el-order-color-2)`}"><span class="round" :style="{background:`var(--el-order-color-2)`}"></span> 在线</span>
<span class="online" v-else :style="{color:`var(--el-order-color-0)`}"><span class="round" :style="{background:`var(--el-order-color-0)`}"></span> 离线</span>
</template>
<template #user_type="scope">
<span v-for="(item,index) in userTypeList" :key="index">
<span v-if="item.value == scope.row.user_type">{{item.label}}</span>
</span>
</template>
<template #approve_status="scope">
<span v-for="(item,index) in auditStatusList" :key="index">
<span v-if="item.value == scope.row.approval_status" :style="{color: item.value==0?`var(--el-order-color-2)`: item.value==1?`var(--el-order-color-3)`:`var(--el-order-color-5)`}">{{item.label}}</span>
</span>
</template>
<template #active_status="scope"> <template #active_status="scope">
<el-switch :size="size" v-model="scope.row.active_status" @change="changeSwitch($event, scope.row)" :loading="scope.row.$switch_status" :active-value="true" :inactive-value="false"></el-switch> <el-switch :size="size" v-model="scope.row.active_status" @change="changeSwitch($event, scope.row)" :loading="scope.row.$switch_status" :active-value="true" :inactive-value="false"></el-switch>
</template> </template>
@ -76,6 +90,9 @@
<div v-auth="'updateMe'"> <div v-auth="'updateMe'">
<el-dropdown-item @click="table_edit(scope.row, 'edit')" icon="sc-icon-Edit">编辑用户</el-dropdown-item> <el-dropdown-item @click="table_edit(scope.row, 'edit')" icon="sc-icon-Edit">编辑用户</el-dropdown-item>
</div> </div>
<div v-auth="'userAudit'" v-if="scope.row.approval_status == 0">
<el-dropdown-item @click="table_review(scope.row)" icon="sc-icon-OrderReview">审核用户</el-dropdown-item>
</div>
<div v-auth="'viewUserPermissions'"> <div v-auth="'viewUserPermissions'">
<el-dropdown-item @click="table_empower(scope.row)" icon="sc-icon-AbilityAuthorization" divided>查看权限</el-dropdown-item> <el-dropdown-item @click="table_empower(scope.row)" icon="sc-icon-AbilityAuthorization" divided>查看权限</el-dropdown-item>
</div> </div>
@ -93,6 +110,7 @@
</el-container> </el-container>
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSuccess" @closed="dialog.save=false"></save-dialog> <save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSuccess" @closed="dialog.save=false"></save-dialog>
<review-dialog v-if="dialog.review" ref="reviewDialog" @success="handleSuccess" @closed="dialog.review=false"></review-dialog>
<re-pwd-dialog v-if="dialog.rePwdD" ref="rePwdDialog" @success="handleSuccess" @closed="dialog.rePwdD=false"></re-pwd-dialog> <re-pwd-dialog v-if="dialog.rePwdD" ref="rePwdDialog" @success="handleSuccess" @closed="dialog.rePwdD=false"></re-pwd-dialog>
<dis-role-dialog v-if="dialog.role" ref="diRoleDialog" @success="handleSuccess" @closed="dialog.role=false"></dis-role-dialog> <dis-role-dialog v-if="dialog.role" ref="diRoleDialog" @success="handleSuccess" @closed="dialog.role=false"></dis-role-dialog>
@ -100,24 +118,28 @@
<script> <script>
import saveDialog from './save' import saveDialog from './save'
import reviewDialog from './review'
import rePwdDialog from './rePwd' import rePwdDialog from './rePwd'
import disRoleDialog from './role' import disRoleDialog from './role'
export default { export default {
components: { components: {
saveDialog, rePwdDialog, disRoleDialog saveDialog, rePwdDialog, disRoleDialog, reviewDialog
}, },
data() { data() {
return { return {
size:'small', size:'small',
dialog: { dialog: {
save: false, save: false,
review: false,
rePwdD: false, rePwdD: false,
role: false role: false
}, },
showGroupLoading: false, showGroupLoading: false,
groupFilterText: '', groupFilterText: '',
group: [], group: [],
auditStatusList:[],
userTypeList:[],
list:{ list:{
apiObj: this.$API.system.user.list, apiObj: this.$API.system.user.list,
column:[] column:[]
@ -141,7 +163,9 @@
} }
}, },
mounted() { mounted() {
this.getGroup() // this.getGroup()
this.auditStatus();
this.userType();
}, },
methods: { methods: {
searchShowClick(){ searchShowClick(){
@ -273,6 +297,13 @@
}) })
}, },
//
table_review(row){
this.dialog.review = true
this.$nextTick(() => {
this.$refs.reviewDialog.open('show').setData(row)
})
},
// //
table_empower(row){ table_empower(row){
this.$router.push({ this.$router.push({
@ -287,17 +318,31 @@
selectionChange(selection){ selectionChange(selection){
this.selection = selection; this.selection = selection;
}, },
// //
async getGroup(){ async auditStatus() {
this.showGroupLoading = true; const res = await this.$API.system.user.auditStatus.post();
const res = await this.$API.system.dept.active.post();
if(res.code == 200){ if(res.code == 200){
const allNode = {id: '', label: '所有'}; this.auditStatusList = res.data;
res.data.unshift(allNode);
this.group = res.data;
} }
this.showGroupLoading = false;
}, },
//
async userType() {
const res = await this.$API.system.user.userType.post();
if (res.code == 200) {
this.userTypeList = res.data;
}
},
//
// async getGroup(){
// this.showGroupLoading = true;
// const res = await this.$API.system.dept.active.post();
// if(res.code == 200){
// const allNode = {id: '', label: ''};
// res.data.unshift(allNode);
// this.group = res.data;
// }
// this.showGroupLoading = false;
// },
// //
groupFilterNode(value, data){ groupFilterNode(value, data){
if (!value) return true; if (!value) return true;
@ -363,5 +408,9 @@
} }
</script> </script>
<style> <style lang="scss" scoped>
.online{
display: flex;align-items: center;
.round{width: 10px;height: 10px;display: inline-block;border-radius: 50%;margin-right: 4px;}
}
</style> </style>

View File

@ -0,0 +1,143 @@
<template>
<el-dialog :title="titleMap[mode]" v-model="visible" :width="500" draggable destroy-on-close @closed="$emit('closed')">
<el-form class="form" :model="form" :rules="rules" ref="dialogForm" label-width="100px" label-position="right">
<div class="cardBoxForm">
<div class="comBox">
<el-form-item label="用户头像" prop="avatar">
<ossImgUpload :url="form.avatar" disabled />
</el-form-item>
</div>
</div>
<div class="cardBoxForm">
<div class="title">用户信息</div>
<div class="comBox">
<el-form-item label="姓名/工号" required>
<el-row :gutter="24" justify="space-between">
<el-col :span="12">
<el-form-item prop="name">
<el-input v-model="form.name" placeholder="请填写真实姓名" disabled clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="emp_id">
<el-input v-model="form.emp_id" placeholder="请填写工号" disabled clearable></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="登录账号" prop="login_name">
<el-input v-model="form.login_name" placeholder="请填写登录账号" disabled clearable></el-input>
</el-form-item>
<el-form-item label="公司名称" prop="company_full_name">
<el-input v-model="form.company_full_name" placeholder="请填写公司名称" disabled clearable></el-input>
</el-form-item>
<el-form-item label="审核意见" prop="opinion">
<el-input v-model="form.opinion" type="textarea" :row="2" placeholder="请填写审核意见" clearable></el-input>
<p class="el-form-item-msg">如果审核拒绝请填写审核意见</p>
</el-form-item>
</div>
</div>
</el-form>
<template #footer>
<el-button @click="visible=false"> </el-button>
<el-button type="danger" :loading="passLoading" @click="approve_pass(2)"> </el-button>
<el-button type="primary" :loading="isSave" @click="approve_pass(1)"> </el-button>
</template>
</el-dialog>
</template>
<script>
export default {
emits: ['success', 'closed'],
data() {
return {
mode: "show",
titleMap: {
show: '用户审核',
},
visible: false,
passLoading:false,
isSave: false,
//
form: {
id:"",
avatar:"",
login_name: "",
name:"",
approval_status:"",
company_full_name:"",
opinion:"",
},
//
rules: {
avatar:[
{required: true, message: '请上传头像'}
],
login_name:[
{required: true, message: '账号不能为空'}
],
},
}
},
mounted() {
},
methods: {
//
open(mode='add'){
this.mode = mode;
this.visible = true;
return this
},
// num 1 2
approve_pass(num){
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
this.form.approval_status = num;
if(num == 2){
this.passLoading = true;
}else{
this.isSave = true;
}
const res = await this.$API.system.user.audit.post(this.form);
if(num == 2){
this.passLoading = false;
}else{
this.isSave = false;
}
if(res.code == 200){
this.$emit('success', this.form, this.mode)
this.visible = false;
this.$message.success("操作成功")
}
}else{
return false;
}
})
},
//
setData(data){
this.form.id = data.id
this.form.login_name = data.login_name;
this.form.name = data.name;
this.form.avatar = data.avatar && data.avatar!==""?data.avatar:'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png';
this.form.company_full_name = data.company_info?data.company_info.full_name:''
}
}
}
</script>
<style lang="scss" scoped>
.form{
.cardBoxForm{
border-bottom: 1px solid #f7f7f7;
.title{
padding: 15px 0 8px 18px;
font-weight: bold;
}
}
.cardBoxForm:last-child{
border-bottom: 0;
}
}
</style>

View File

@ -39,21 +39,21 @@
<el-form-item label="电子邮件" prop="email"> <el-form-item label="电子邮件" prop="email">
<el-input v-model="form.email" placeholder="请填写电子邮件" clearable></el-input> <el-input v-model="form.email" placeholder="请填写电子邮件" clearable></el-input>
</el-form-item> </el-form-item>
</div>
</div>
<div class="cardBoxForm">
<div class="title">角色和部门</div>
<div class="comBox">
<el-form-item label="分配角色" prop="role_ids"> <el-form-item label="分配角色" prop="role_ids">
<el-select v-model="form.role_ids" multiple filterable placeholder="请选择角色" style="width: 100%"> <el-select v-model="form.role_ids" multiple filterable placeholder="请选择角色" style="width: 100%">
<el-option v-for="item in groups" :key="item.id" :label="item.label" :value="item.id"/> <el-option v-for="item in groups" :key="item.id" :label="item.label" :value="item.id"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所属部门" prop="dept_id">
<el-cascader v-model="form.dept_id" :options="depts" :props="deptsProps" placeholder="请选择部门" clearable style="width: 100%;"></el-cascader>
</el-form-item>
</div> </div>
</div> </div>
<!-- <div class="cardBoxForm">-->
<!-- <div class="title">角色和部门</div>-->
<!-- <div class="comBox">-->
<!-- <el-form-item label="所属部门" prop="dept_id">-->
<!-- <el-cascader v-model="form.dept_id" :options="depts" :props="deptsProps" placeholder="请选择部门" clearable style="width: 100%;"></el-cascader>-->
<!-- </el-form-item>-->
<!-- </div>-->
<!-- </div>-->
</el-form> </el-form>
<template #footer> <template #footer>
<el-button @click="visible=false" > </el-button> <el-button @click="visible=false" > </el-button>
@ -85,7 +85,7 @@
email:"", email:"",
avatar: "", avatar: "",
password:"", password:"",
dept_id: "", // dept_id: "",
role_ids: [] role_ids: []
}, },
// //
@ -127,9 +127,9 @@
} }
}} }}
], ],
dept_id: [ // dept_id: [
{required: true, message: '请选择所属部门'} // {required: true, message: ''}
], // ],
role_ids: [ role_ids: [
{required: true, message: '请选择所属角色', trigger: 'change'} {required: true, message: '请选择所属角色', trigger: 'change'}
] ]
@ -141,17 +141,17 @@
multiple: true, multiple: true,
checkStrictly: true checkStrictly: true
}, },
depts: [], // depts: [],
deptsProps: { // deptsProps: {
value: "id", // value: "id",
checkStrictly: false, // checkStrictly: false,
emitPath:false // emitPath:false
} // }
} }
}, },
mounted() { mounted() {
this.getGroup() this.getGroup()
this.getDept() // this.getDept()
}, },
methods: { methods: {
// //
@ -167,12 +167,12 @@
this.groups = res.data.rows; this.groups = res.data.rows;
} }
}, },
async getDept(){ // async getDept(){
const res = await this.$API.system.dept.active.post(); // const res = await this.$API.system.dept.active.post();
if(res.code == 200){ // if(res.code == 200){
this.depts = res.data; // this.depts = res.data;
} // }
}, // },
parentParams(item){ parentParams(item){
this.form.avatar = item; this.form.avatar = item;
}, },
@ -202,7 +202,7 @@
this.form.mobile = data.mobile this.form.mobile = data.mobile
this.form.email = data.email this.form.email = data.email
this.form.avatar = data.avatar this.form.avatar = data.avatar
this.form.dept_id = data.dept_id // this.form.dept_id = data.dept_id
this.form.group = data.group this.form.group = data.group
this.form.role_ids = data.user_roles && data.user_roles.role_ids?data.user_roles.role_ids:[] this.form.role_ids = data.user_roles && data.user_roles.role_ids?data.user_roles.role_ids:[]