bug
This commit is contained in:
parent
72de644618
commit
8b009c34d5
35
fuintAdmin/src/api/duty/duty.js
Normal file
35
fuintAdmin/src/api/duty/duty.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 分页查询角色信息
|
||||||
|
export function dutyList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/business/member/duty',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 分页查询角色信息
|
||||||
|
export function dutyLists(query) {
|
||||||
|
return request({
|
||||||
|
url: '/business/member/duty/dutys',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据id删除角色信息
|
||||||
|
export function dutyDelete(id) {
|
||||||
|
return request({
|
||||||
|
url: '/business/member/duty/'+id,
|
||||||
|
method: 'delete',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据id删除角色信息
|
||||||
|
export function dutyEdit(data) {
|
||||||
|
return request({
|
||||||
|
url: '/business/member/duty',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
@ -18,10 +18,11 @@ export function getMenu(menuId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询菜单下拉树结构
|
// 查询菜单下拉树结构
|
||||||
export function treeselect() {
|
export function treeselect(params) {
|
||||||
return request({
|
return request({
|
||||||
url: 'backendApi/source/treeselect',
|
url: 'backendApi/source/treeselect',
|
||||||
method: 'get'
|
method: 'get',
|
||||||
|
params: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
361
fuintAdmin/src/views/duty/index.vue
Normal file
361
fuintAdmin/src/views/duty/index.vue
Normal file
@ -0,0 +1,361 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-card>
|
||||||
|
<el-form :model="queryParams1" ref="queryForm" size="small" :inline="true" label-width="100px">
|
||||||
|
<el-form-item label="角色名称" prop="dutyName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams1.dutyName"
|
||||||
|
placeholder="请输入角色名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="角色状态" prop="status">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams1.status"
|
||||||
|
placeholder="全部"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option label="启用" value="A"></el-option>
|
||||||
|
<el-option label="禁用" value="D"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery1">查询</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card style="margin-top: 20px">
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
@click="handleAdd1"
|
||||||
|
|
||||||
|
>新增
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-table ref="tables"
|
||||||
|
v-loading="loading"
|
||||||
|
:data="dutyList">
|
||||||
|
<el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
|
||||||
|
<el-table-column label="角色名称" align="center" prop="dutyName" />
|
||||||
|
<!-- <el-table-column label="角色类型" align="center" prop="dutyType" >-->
|
||||||
|
<!-- <template slot-scope="scope">-->
|
||||||
|
<!-- <span v-if="scope.row.dutyType=='1'">超级管理员</span>-->
|
||||||
|
<!-- <span v-if="scope.row.dutyType=='2'">普通管理员</span>-->
|
||||||
|
<!-- <span v-if="scope.row.dutyType=='3'">用户角色</span>-->
|
||||||
|
<!-- <span v-if="scope.row.dutyType=='3'">员工角色</span>-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- </el-table-column>-->
|
||||||
|
<el-table-column label="所属机构" align="center" prop="deptName" />
|
||||||
|
<el-table-column label="角色状态" align="center" prop="status" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.status"
|
||||||
|
active-value="A"
|
||||||
|
inactive-value="N"
|
||||||
|
@change="handleStatusChangeDuty(scope.row)"
|
||||||
|
></el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="角色描述" align="center" prop="description" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{scope.row.description || "--"}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate1(scope.row)"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete1(scope.row)"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total1>0"
|
||||||
|
:total="total1"
|
||||||
|
:page.sync="queryParams1.page"
|
||||||
|
:limit.sync="queryParams1.pageSize"
|
||||||
|
@pagination="getDutyList"
|
||||||
|
/>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<!-- 添加或修改角色配置对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="openDuty" width="700px" append-to-body>
|
||||||
|
<el-form ref="form1" :model="form1" :rules="rules1" label-width="100px">
|
||||||
|
<el-form-item label="角色名称" prop="roleName">
|
||||||
|
<el-input v-model="form1.roleName" @input="$forceUpdate()" style="width: 300px" placeholder="请输入角色名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="角色类型" prop="roleType">-->
|
||||||
|
<!-- <el-select-->
|
||||||
|
<!-- v-model="form1.roleType"-->
|
||||||
|
<!-- placeholder="角色类型"-->
|
||||||
|
<!-- @change="changeMenu"-->
|
||||||
|
<!-- style="width: 300px"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- <el-option key="1" label="超级管理员" value="1"/>-->
|
||||||
|
<!-- <el-option key="2" label="普通管理员" value="2"/>-->
|
||||||
|
<!-- <el-option key="3" label="用户角色" value="3"/>-->
|
||||||
|
<!-- <el-option key="3" label="员工角色" value="3"/>-->
|
||||||
|
<!-- </el-select>-->
|
||||||
|
<!-- </el-form-item>-->
|
||||||
|
<el-form-item label="状态">
|
||||||
|
<el-radio-group v-model="form1.status">
|
||||||
|
<el-radio key="A" label="A" value="A">启用</el-radio>
|
||||||
|
<el-radio key="N" label="N" value="N">禁用</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="菜单权限">
|
||||||
|
<el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
|
||||||
|
<el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>
|
||||||
|
<el-checkbox v-model="form1.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')">父子联动</el-checkbox>
|
||||||
|
<el-tree
|
||||||
|
class="tree-border"
|
||||||
|
:data="menuOptions"
|
||||||
|
show-checkbox
|
||||||
|
ref="menu"
|
||||||
|
node-key="id"
|
||||||
|
:check-strictly="!form1.menuCheckStrictly"
|
||||||
|
empty-text="加载中,请稍候"
|
||||||
|
:props="defaultProps1"
|
||||||
|
></el-tree>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<el-input v-model="form1.description" type="textarea" placeholder="请输入备注信息"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm1">确 定</el-button>
|
||||||
|
<el-button @click="cancel1">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {dutyDelete, dutyEdit, dutyList} from "@/api/duty/duty";
|
||||||
|
import {addRole, getRole, updateRole} from "@/api/system/role";
|
||||||
|
import {treeselect} from "@/api/system/menu";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
queryParams1:{
|
||||||
|
page:1,
|
||||||
|
pageSize:10,
|
||||||
|
// 当做机构id使用
|
||||||
|
storeId:"",
|
||||||
|
},
|
||||||
|
title:"",
|
||||||
|
total1:0,
|
||||||
|
dutyList:[],
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
openDuty:false,
|
||||||
|
menuExpand: false,
|
||||||
|
menuNodeAll: false,
|
||||||
|
// 菜单列表
|
||||||
|
menuOptions: [],
|
||||||
|
defaultProps1: {
|
||||||
|
children: "childrens",
|
||||||
|
label: "label"
|
||||||
|
},
|
||||||
|
form1: { id: '', status: 'A', roleType: '4', description: '' },
|
||||||
|
rules1: {
|
||||||
|
roleName: [
|
||||||
|
{ required: true, message: "角色名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
// roleType: [
|
||||||
|
// { required: true, message: "角色类型不能为空", trigger: "blur" }
|
||||||
|
// ]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getDutyList()
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
|
||||||
|
// 修改角色类型
|
||||||
|
changeMenu(){
|
||||||
|
console.log(this.form1.roleType)
|
||||||
|
if (this.form1.roleType == '4'){
|
||||||
|
this.getMenuTreeselect(2);
|
||||||
|
}
|
||||||
|
if (this.form1.roleType == '3'){
|
||||||
|
this.getMenuTreeselect(1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset1() {
|
||||||
|
if (this.$refs.menu != undefined) {
|
||||||
|
this.$refs.menu.setCheckedKeys([]);
|
||||||
|
}
|
||||||
|
this.menuExpand = false,
|
||||||
|
this.menuNodeAll = false,
|
||||||
|
this.form1 = {
|
||||||
|
id: undefined,
|
||||||
|
roleName: '',
|
||||||
|
roleType: '3',
|
||||||
|
status: "A",
|
||||||
|
menuIds: [],
|
||||||
|
menuCheckStrictly: true,
|
||||||
|
description: ''
|
||||||
|
};
|
||||||
|
this.resetForm("form1");
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel1() {
|
||||||
|
this.openDuty = false;
|
||||||
|
this.reset1();
|
||||||
|
},
|
||||||
|
submitForm1: function() {
|
||||||
|
this.$refs["form1"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form1.dutyId) {
|
||||||
|
this.form1.menuIds = this.getMenuAllCheckedKeys();
|
||||||
|
updateRole(this.form1).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.openDuty = false;
|
||||||
|
this.getDutyList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.form1.storeId = '-1';
|
||||||
|
this.form1.menuIds = this.getMenuAllCheckedKeys();
|
||||||
|
addRole(this.form1).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.openDuty = false;
|
||||||
|
this.getDutyList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 所有菜单节点数据
|
||||||
|
getMenuAllCheckedKeys() {
|
||||||
|
// 目前被选中的菜单节点
|
||||||
|
let checkedKeys = this.$refs.menu.getCheckedKeys();
|
||||||
|
// 半选中的菜单节点
|
||||||
|
let halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys();
|
||||||
|
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
|
||||||
|
return checkedKeys;
|
||||||
|
},
|
||||||
|
// 树权限(展开/折叠)
|
||||||
|
handleCheckedTreeExpand(value, type) {
|
||||||
|
if (type == 'menu') {
|
||||||
|
let treeList = this.menuOptions;
|
||||||
|
for (let i = 0; i < treeList.length; i++) {
|
||||||
|
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 树权限(全选/全不选)
|
||||||
|
handleCheckedTreeNodeAll(value, type) {
|
||||||
|
if (type == 'menu') {
|
||||||
|
this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 树权限(父子联动)
|
||||||
|
handleCheckedTreeConnect(value, type) {
|
||||||
|
if (type == 'menu') {
|
||||||
|
this.form1.menuCheckStrictly = value ? true: false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleAdd1(){
|
||||||
|
this.reset1();
|
||||||
|
this.getMenuTreeselect(1);
|
||||||
|
this.openDuty = true;
|
||||||
|
this.title = "添加角色";
|
||||||
|
},
|
||||||
|
// 查询菜单树结构
|
||||||
|
getMenuTreeselect(merchantId) {
|
||||||
|
return treeselect({merchantId:merchantId}).then(response => {
|
||||||
|
this.menuOptions = response.data;
|
||||||
|
return response
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete1(row){
|
||||||
|
const roleIds = row.dutyName;
|
||||||
|
this.$modal.confirm('是否确认删除角色名为"' + roleIds + '"的信息?').then(function() {
|
||||||
|
return dutyDelete(row.dutyId);
|
||||||
|
}).then(() => {
|
||||||
|
this.getDutyList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
handleUpdate1(data){
|
||||||
|
this.reset1();
|
||||||
|
let val = null;
|
||||||
|
if (data.dutyType == '3') val = 1;
|
||||||
|
if (data.dutyType == '4') val = 2;
|
||||||
|
const roleMenu = this.getMenuTreeselect(val);
|
||||||
|
const roleId = data.dutyId
|
||||||
|
getRole(roleId).then(response => {
|
||||||
|
this.form1.roleName = response.data.roleInfo.name;
|
||||||
|
this.form1.roleType = response.data.roleInfo.type;
|
||||||
|
this.form1.status = response.data.roleInfo.status;
|
||||||
|
this.form1.dutyId = response.data.roleInfo.id;
|
||||||
|
this.form1.description = response.data.roleInfo.description;
|
||||||
|
this.openDuty = true;
|
||||||
|
this.title = "修改角色";
|
||||||
|
let checkedKeys = response.data.checkedKeys
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
roleMenu.then(res => {
|
||||||
|
checkedKeys.forEach((v) => {
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.menu.setChecked(v, true ,false);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleStatusChangeDuty(data){
|
||||||
|
console.log(data)
|
||||||
|
dutyEdit(data).then(res => {
|
||||||
|
this.$message.success("修改成功")
|
||||||
|
this.getDutyList();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 搜索角色信息
|
||||||
|
handleQuery1(){
|
||||||
|
this.queryParams1.page = 1;
|
||||||
|
this.getDutyList();
|
||||||
|
},
|
||||||
|
getDutyList(){
|
||||||
|
this.loading = true;
|
||||||
|
dutyList(this.queryParams1).then(res => {
|
||||||
|
this.dutyList = res.data.records;
|
||||||
|
this.total1 = res.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.app-container{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: #f6f8f9;
|
||||||
|
}
|
||||||
|
</style>
|
@ -60,11 +60,9 @@
|
|||||||
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
|
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
|
||||||
<el-table-column type="index" width="80" align="center" label="序号"/>
|
<el-table-column type="index" width="80" align="center" label="序号"/>
|
||||||
<el-table-column label="姓名" align="center" prop="realName" />
|
<el-table-column label="姓名" align="center" prop="realName" />
|
||||||
<el-table-column label="员工角色" align="center" prop="roleId" >
|
<el-table-column label="员工角色" align="center" prop="dutyName" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="scope.row.roleId=='12'">油站站长</span>
|
<span>{{scope.row.dutyName || "--"}}</span>
|
||||||
<span v-if="scope.row.roleId=='15'">加油员</span>
|
|
||||||
<span v-if="scope.row.roleId=='16'">收银员</span>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="手机号" align="center" prop="mobile" width="110"/>
|
<el-table-column label="手机号" align="center" prop="mobile" width="110"/>
|
||||||
@ -156,11 +154,6 @@
|
|||||||
:label="item.dutyName"
|
:label="item.dutyName"
|
||||||
:value="item.dutyId+''"
|
:value="item.dutyId+''"
|
||||||
></el-option>
|
></el-option>
|
||||||
<el-option
|
|
||||||
v-if="form.roleId == 12"
|
|
||||||
label="油站站长"
|
|
||||||
:value="12+''"
|
|
||||||
></el-option>
|
|
||||||
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -333,6 +326,7 @@ import {addStaff, createStaffQrCode, delStaff, getStaff, listStaff, queryStaff,
|
|||||||
import {getDuty, listDuty} from "@/api/staff/duty";
|
import {getDuty, listDuty} from "@/api/staff/duty";
|
||||||
import html2canvas from "html2canvas";
|
import html2canvas from "html2canvas";
|
||||||
import {getDicts} from "@/api/order/data";
|
import {getDicts} from "@/api/order/data";
|
||||||
|
import {dutyList, dutyLists} from "@/api/duty/duty";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "StaffList",
|
name: "StaffList",
|
||||||
@ -488,7 +482,7 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getDuty();
|
// this.getDuty();
|
||||||
// this.getStoreList();
|
// this.getStoreList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -649,9 +643,21 @@ export default {
|
|||||||
async handleAdd() {
|
async handleAdd() {
|
||||||
this.reset();
|
this.reset();
|
||||||
await this.getAuditPrem()
|
await this.getAuditPrem()
|
||||||
|
this.getRoleList1()
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "新增员工";
|
this.title = "新增员工";
|
||||||
},
|
},
|
||||||
|
// 获取角色信息
|
||||||
|
getRoleList1() {
|
||||||
|
let data = {
|
||||||
|
page:1,
|
||||||
|
pageSize:10000,
|
||||||
|
dutyType:3
|
||||||
|
}
|
||||||
|
dutyList(data).then(res => {
|
||||||
|
this.roleList = res.data.records
|
||||||
|
})
|
||||||
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
this.posPrem = '';
|
this.posPrem = '';
|
||||||
@ -757,6 +763,7 @@ export default {
|
|||||||
if (this.appletPrem != null && this.appletPrem != ""){
|
if (this.appletPrem != null && this.appletPrem != ""){
|
||||||
this.appletPrem = JSON.parse(this.form.appletPrem);
|
this.appletPrem = JSON.parse(this.form.appletPrem);
|
||||||
}
|
}
|
||||||
|
this.getRoleList1();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 删除按钮操作
|
// 删除按钮操作
|
||||||
|
@ -239,15 +239,12 @@
|
|||||||
multiple
|
multiple
|
||||||
placeholder="请选择所属角色"
|
placeholder="请选择所属角色"
|
||||||
@change="getCheckbox">
|
@change="getCheckbox">
|
||||||
<!-- <el-option-->
|
<el-option
|
||||||
<!-- v-for="(item,index) in roleList"-->
|
v-for="item in roleList"
|
||||||
<!-- :key="index"-->
|
:key="item.dutyId+''"
|
||||||
<!-- :label="item.dutyName"-->
|
:label="item.dutyName"
|
||||||
<!-- :value="item.dutyId"-->
|
:value="item.dutyId+''"
|
||||||
<!-- ></el-option>-->
|
></el-option>
|
||||||
<el-option label="加油员" :value="15+''" ></el-option>
|
|
||||||
<el-option label="收银员" :value="16+''" ></el-option>
|
|
||||||
<!-- :value="item.dutyId"-->
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -430,6 +427,7 @@ import {
|
|||||||
} from "@/api/staffCommission/staffcommission";
|
} from "@/api/staffCommission/staffcommission";
|
||||||
import {listDuty} from "@/api/staff/duty";
|
import {listDuty} from "@/api/staff/duty";
|
||||||
import {queryStaffs} from "@/api/order/staff";
|
import {queryStaffs} from "@/api/order/staff";
|
||||||
|
import {dutyList} from "@/api/duty/duty";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
dicts: ['source','role','zhzt','comissionType'],
|
dicts: ['source','role','zhzt','comissionType'],
|
||||||
@ -521,9 +519,20 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getStaffList();
|
this.getStaffList();
|
||||||
this.getDuty();
|
// this.getDuty();
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
// 获取角色信息
|
||||||
|
getRoleList1() {
|
||||||
|
let data = {
|
||||||
|
page:1,
|
||||||
|
pageSize:10000,
|
||||||
|
dutyType:3
|
||||||
|
}
|
||||||
|
dutyList(data).then(res => {
|
||||||
|
this.roleList = res.data.records
|
||||||
|
})
|
||||||
|
},
|
||||||
getStaffCommissionList(){
|
getStaffCommissionList(){
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.dateRange = []
|
this.dateRange = []
|
||||||
@ -657,6 +666,7 @@ export default {
|
|||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.open = true;
|
this.open = true;
|
||||||
|
this.getRoleList1()
|
||||||
this.title = "新增提成方案";
|
this.title = "新增提成方案";
|
||||||
},
|
},
|
||||||
// 修改按钮操作
|
// 修改按钮操作
|
||||||
@ -673,6 +683,7 @@ export default {
|
|||||||
if (response.data.staffRoleGroup){
|
if (response.data.staffRoleGroup){
|
||||||
this.staffRoleGroup = response.data.staffRoleGroup.split(",");
|
this.staffRoleGroup = response.data.staffRoleGroup.split(",");
|
||||||
}
|
}
|
||||||
|
this.getRoleList1()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -98,6 +98,13 @@
|
|||||||
<el-radio :label="0">按钮</el-radio>
|
<el-radio :label="0">按钮</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="菜单角色" prop="merchantId">
|
||||||
|
<el-radio-group v-model="form.merchantId">
|
||||||
|
<el-radio :label="0">暂未设置</el-radio>
|
||||||
|
<el-radio :label="1">油站端菜单</el-radio>
|
||||||
|
<el-radio :label="2">中台端菜单</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="菜单图标" prop="icon">
|
<el-form-item label="菜单图标" prop="icon">
|
||||||
|
35
fuintAdmin_zt/src/api/duty/duty.js
Normal file
35
fuintAdmin_zt/src/api/duty/duty.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 分页查询角色信息
|
||||||
|
export function dutyList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/business/member/duty',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 分页查询角色信息
|
||||||
|
export function dutyLists(query) {
|
||||||
|
return request({
|
||||||
|
url: '/business/member/duty/dutys',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据id删除角色信息
|
||||||
|
export function dutyDelete(id) {
|
||||||
|
return request({
|
||||||
|
url: '/business/member/duty/'+id,
|
||||||
|
method: 'delete',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据id删除角色信息
|
||||||
|
export function dutyEdit(data) {
|
||||||
|
return request({
|
||||||
|
url: '/business/member/duty',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
@ -18,10 +18,11 @@ export function getMenu(menuId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询菜单下拉树结构
|
// 查询菜单下拉树结构
|
||||||
export function treeselect() {
|
export function treeselect(params) {
|
||||||
return request({
|
return request({
|
||||||
url: 'backendApi/source/treeselect',
|
url: 'backendApi/source/treeselect',
|
||||||
method: 'get'
|
method: 'get',
|
||||||
|
params: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@
|
|||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="机构信息" name="info">
|
<el-tab-pane label="机构信息" name="info">
|
||||||
|
|
||||||
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="demo-ruleForm">
|
||||||
<el-form-item label="父级节点" prop="name" v-if="ruleForm.parentId != 0">
|
<el-form-item label="父级节点" prop="name" v-if="ruleForm.parentId != 0">
|
||||||
<el-cascader :disabled="isTopDept" :options="Thetree" disabled style="width: 300px"
|
<el-cascader :disabled="isTopDept" :options="Thetree" disabled style="width: 300px"
|
||||||
v-model="cascader" :props="defaultProps" @change="handleChanges" :placeholder="parentName" ></el-cascader>
|
v-model="cascader" :props="defaultProps" @change="handleChanges" :placeholder="parentName" ></el-cascader>
|
||||||
@ -167,7 +167,7 @@
|
|||||||
<!-- <el-form-item label="上级部门" prop="parentId">-->
|
<!-- <el-form-item label="上级部门" prop="parentId">-->
|
||||||
<!-- <treeselect v-model="cascader" :options="Thetree" :normalizer="normalizer" @change="handleChanges" placeholder="啊" />-->
|
<!-- <treeselect v-model="cascader" :options="Thetree" :normalizer="normalizer" @change="handleChanges" placeholder="啊" />-->
|
||||||
<!-- </el-form-item>-->
|
<!-- </el-form-item>-->
|
||||||
<el-form-item label="节点名称" prop="deptName">
|
<el-form-item label="连锁店/油站名称" prop="deptName">
|
||||||
<el-input :disabled="isTopDept" v-model="ruleForm.deptName"></el-input>
|
<el-input :disabled="isTopDept" v-model="ruleForm.deptName"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="负责人名称" prop="leaderName">
|
<el-form-item label="负责人名称" prop="leaderName">
|
||||||
@ -449,6 +449,102 @@
|
|||||||
|
|
||||||
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="角色信息" name="duty">
|
||||||
|
<el-form :model="queryParams1" ref="queryForm" size="small" :inline="true" label-width="100px">
|
||||||
|
<el-form-item label="角色名称" prop="dutyName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams1.dutyName"
|
||||||
|
placeholder="请输入角色名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="角色状态" prop="status">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams1.status"
|
||||||
|
placeholder="全部"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option label="启用" value="A"></el-option>
|
||||||
|
<el-option label="禁用" value="D"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery1">查询</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd1"
|
||||||
|
|
||||||
|
>新增
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table ref="tables"
|
||||||
|
v-loading="loading"
|
||||||
|
:data="dutyList">
|
||||||
|
<el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
|
||||||
|
<el-table-column label="角色名称" align="center" prop="dutyName" />
|
||||||
|
<el-table-column label="角色类型" align="center" prop="dutyType" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span v-if="scope.row.dutyType=='1'">超级管理员</span>
|
||||||
|
<span v-if="scope.row.dutyType=='2'">普通管理员</span>
|
||||||
|
<span v-if="scope.row.dutyType=='3'">油站角色</span>
|
||||||
|
<span v-if="scope.row.dutyType=='4'">公司角色</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="所属机构" align="center" prop="deptName" />
|
||||||
|
<el-table-column label="角色状态" align="center" prop="status" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.status"
|
||||||
|
active-value="A"
|
||||||
|
inactive-value="N"
|
||||||
|
@change="handleStatusChangeDuty(scope.row)"
|
||||||
|
></el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="角色描述" align="center" prop="description" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{scope.row.description || "--"}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate1(scope.row)"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete1(scope.row)"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total1>0"
|
||||||
|
:total="total1"
|
||||||
|
:page.sync="queryParams1.page"
|
||||||
|
:limit.sync="queryParams1.pageSize"
|
||||||
|
@pagination="getDutyList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-card>
|
</el-card>
|
||||||
@ -512,7 +608,7 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="分配角色">
|
<el-form-item label="分配角色" prop="roleIds">
|
||||||
<el-select v-model="form.roleIds" @change="$forceUpdate(),getCodeByRole($event)" placeholder="请选择角色">
|
<el-select v-model="form.roleIds" @change="$forceUpdate(),getCodeByRole($event)" placeholder="请选择角色">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in rolelist"
|
v-for="item in rolelist"
|
||||||
@ -521,6 +617,7 @@
|
|||||||
:value="item.dutyId"
|
:value="item.dutyId"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<div v-if="!rolelist || rolelist.length==0" style="color: red;font-size: 12px">请先为当前机构添加角色信息</div>
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -533,6 +630,57 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 添加或修改角色配置对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="openDuty" width="700px" append-to-body>
|
||||||
|
<el-form ref="form1" :model="form1" :rules="rules1" label-width="100px">
|
||||||
|
<el-form-item label="角色名称" prop="roleName">
|
||||||
|
<el-input v-model="form1.roleName" @input="$forceUpdate()" style="width: 300px" placeholder="请输入角色名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="角色类型" prop="roleType">
|
||||||
|
<el-select
|
||||||
|
v-model="form1.roleType"
|
||||||
|
placeholder="角色类型"
|
||||||
|
@change="changeMenu"
|
||||||
|
style="width: 300px"
|
||||||
|
>
|
||||||
|
<!-- <el-option key="1" label="超级管理员" value="1"/>-->
|
||||||
|
<!-- <el-option key="2" label="普通管理员" value="2"/>-->
|
||||||
|
<el-option key="3" label="油站角色" value="3"/>
|
||||||
|
<el-option key="4" label="公司角色" value="4"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态">
|
||||||
|
<el-radio-group v-model="form1.status">
|
||||||
|
<el-radio key="A" label="A" value="A">启用</el-radio>
|
||||||
|
<el-radio key="N" label="N" value="N">禁用</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="菜单权限">
|
||||||
|
<el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
|
||||||
|
<el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>
|
||||||
|
<el-checkbox v-model="form1.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')">父子联动</el-checkbox>
|
||||||
|
<el-tree
|
||||||
|
class="tree-border"
|
||||||
|
:data="menuOptions"
|
||||||
|
show-checkbox
|
||||||
|
ref="menu"
|
||||||
|
node-key="id"
|
||||||
|
:check-strictly="!form1.menuCheckStrictly"
|
||||||
|
empty-text="加载中,请稍候"
|
||||||
|
:props="defaultProps1"
|
||||||
|
></el-tree>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<el-input v-model="form1.description" type="textarea" placeholder="请输入备注信息"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm1">确 定</el-button>
|
||||||
|
<el-button @click="cancel1">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 用户导入对话框 -->
|
<!-- 用户导入对话框 -->
|
||||||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body :close-on-click-modal="false">
|
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body :close-on-click-modal="false">
|
||||||
<el-upload
|
<el-upload
|
||||||
@ -590,6 +738,9 @@ import {
|
|||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import node from "../../../../gasStation-uni/uni_modules/uview-ui/components/u-parse/node/node.vue";
|
import node from "../../../../gasStation-uni/uni_modules/uview-ui/components/u-parse/node/node.vue";
|
||||||
|
import {dutyDelete, dutyEdit, dutyList, dutyLists} from "@/api/duty/duty";
|
||||||
|
import {addRole, delRole, getRole, updateRole} from "@/api/system/role";
|
||||||
|
import {treeselect as menuTreeselect} from "@/api/system/menu";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -653,6 +804,18 @@ export default {
|
|||||||
multiple: true,
|
multiple: true,
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
|
openDuty:false,
|
||||||
|
form1: { id: '', status: 'A', roleType: '4', description: '' },
|
||||||
|
// 角色表格数据
|
||||||
|
roleList: [],
|
||||||
|
menuExpand: false,
|
||||||
|
menuNodeAll: false,
|
||||||
|
// 菜单列表
|
||||||
|
menuOptions: [],
|
||||||
|
defaultProps1: {
|
||||||
|
children: "childrens",
|
||||||
|
label: "label"
|
||||||
|
},
|
||||||
// 总条数
|
// 总条数
|
||||||
total: 0,
|
total: 0,
|
||||||
// 用户表格数据
|
// 用户表格数据
|
||||||
@ -663,7 +826,14 @@ export default {
|
|||||||
Thetree:[],
|
Thetree:[],
|
||||||
// 节点树选项
|
// 节点树选项
|
||||||
deptOptions: undefined,
|
deptOptions: undefined,
|
||||||
|
queryParams1:{
|
||||||
|
page:1,
|
||||||
|
pageSize:10,
|
||||||
|
// 当做机构id使用
|
||||||
|
storeId:"",
|
||||||
|
},
|
||||||
|
total1:0,
|
||||||
|
dutyList:[],
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
|
|
||||||
open: false,
|
open: false,
|
||||||
@ -731,6 +901,15 @@ export default {
|
|||||||
],
|
],
|
||||||
rolelist:'',
|
rolelist:'',
|
||||||
// 表单校验
|
// 表单校验
|
||||||
|
// 表单校验
|
||||||
|
rules1: {
|
||||||
|
roleName: [
|
||||||
|
{ required: true, message: "角色名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
roleType: [
|
||||||
|
{ required: true, message: "角色类型不能为空", trigger: "blur" }
|
||||||
|
]
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
leaderName: [
|
leaderName: [
|
||||||
{ required: true, message: '姓名不能为空', trigger: 'blur' },
|
{ required: true, message: '姓名不能为空', trigger: 'blur' },
|
||||||
@ -746,7 +925,11 @@ export default {
|
|||||||
],
|
],
|
||||||
|
|
||||||
deptName: [
|
deptName: [
|
||||||
{ required: true, message: '请输入节点名称', trigger: 'blur' },
|
{ required: true, message: '请输入机构名称', trigger: 'blur' },
|
||||||
|
|
||||||
|
],
|
||||||
|
roleIds: [
|
||||||
|
{ required: true, message: '请选择角色信息', trigger: 'blur' },
|
||||||
|
|
||||||
],
|
],
|
||||||
region: [
|
region: [
|
||||||
@ -826,6 +1009,165 @@ export default {
|
|||||||
},
|
},
|
||||||
components: { Treeselect },
|
components: { Treeselect },
|
||||||
methods: {
|
methods: {
|
||||||
|
// 修改角色类型
|
||||||
|
async changeMenu() {
|
||||||
|
console.log(this.form1.roleType)
|
||||||
|
if (this.form1.roleType == '4') {
|
||||||
|
this.getMenuTreeselect(2);
|
||||||
|
}
|
||||||
|
if (this.form1.roleType == '3') {
|
||||||
|
await this.getMenuTreeselect(1);
|
||||||
|
await this.handleCheckedTreeNodeAll(true, 'menu')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset1() {
|
||||||
|
if (this.$refs.menu != undefined) {
|
||||||
|
this.$refs.menu.setCheckedKeys([]);
|
||||||
|
}
|
||||||
|
this.menuExpand = false,
|
||||||
|
this.menuNodeAll = false,
|
||||||
|
this.form1 = {
|
||||||
|
id: undefined,
|
||||||
|
roleName: '',
|
||||||
|
roleType: '4',
|
||||||
|
status: "A",
|
||||||
|
menuIds: [],
|
||||||
|
menuCheckStrictly: true,
|
||||||
|
description: ''
|
||||||
|
};
|
||||||
|
this.resetForm("form1");
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel1() {
|
||||||
|
this.openDuty = false;
|
||||||
|
this.reset1();
|
||||||
|
},
|
||||||
|
submitForm1: function() {
|
||||||
|
this.$refs["form1"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form1.dutyId) {
|
||||||
|
this.form1.menuIds = this.getMenuAllCheckedKeys();
|
||||||
|
updateRole(this.form1).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.openDuty = false;
|
||||||
|
this.getDutyList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.form1.storeId = this.queryParams1.storeId
|
||||||
|
this.form1.menuIds = this.getMenuAllCheckedKeys();
|
||||||
|
addRole(this.form1).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.openDuty = false;
|
||||||
|
this.getDutyList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 所有菜单节点数据
|
||||||
|
getMenuAllCheckedKeys() {
|
||||||
|
// 目前被选中的菜单节点
|
||||||
|
let checkedKeys = this.$refs.menu.getCheckedKeys();
|
||||||
|
// 半选中的菜单节点
|
||||||
|
let halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys();
|
||||||
|
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
|
||||||
|
return checkedKeys;
|
||||||
|
},
|
||||||
|
// 树权限(展开/折叠)
|
||||||
|
handleCheckedTreeExpand(value, type) {
|
||||||
|
if (type == 'menu') {
|
||||||
|
let treeList = this.menuOptions;
|
||||||
|
for (let i = 0; i < treeList.length; i++) {
|
||||||
|
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 树权限(全选/全不选)
|
||||||
|
handleCheckedTreeNodeAll(value, type) {
|
||||||
|
console.log(this.menuOptions)
|
||||||
|
if (type == 'menu') {
|
||||||
|
this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 树权限(父子联动)
|
||||||
|
handleCheckedTreeConnect(value, type) {
|
||||||
|
if (type == 'menu') {
|
||||||
|
this.form1.menuCheckStrictly = value ? true: false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleAdd1(){
|
||||||
|
this.reset1();
|
||||||
|
this.getMenuTreeselect(2);
|
||||||
|
this.form1.storeId = this.Thetree[0].id
|
||||||
|
this.openDuty = true;
|
||||||
|
this.title = "添加角色";
|
||||||
|
console.log(this.form1)
|
||||||
|
},
|
||||||
|
// 查询菜单树结构
|
||||||
|
getMenuTreeselect(merchantId) {
|
||||||
|
return menuTreeselect({merchantId:merchantId}).then(response => {
|
||||||
|
this.menuOptions = response.data;
|
||||||
|
return response
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete1(row){
|
||||||
|
const roleIds = row.dutyName;
|
||||||
|
this.$modal.confirm('是否确认删除角色名为"' + roleIds + '"的信息?').then(function() {
|
||||||
|
return dutyDelete(row.dutyId);
|
||||||
|
}).then(() => {
|
||||||
|
this.getDutyList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
handleUpdate1(data){
|
||||||
|
this.reset1();
|
||||||
|
let val = null;
|
||||||
|
if (data.dutyType == '3') val = 1;
|
||||||
|
if (data.dutyType == '4') val = 2;
|
||||||
|
const roleMenu = this.getMenuTreeselect(val);
|
||||||
|
const roleId = data.dutyId
|
||||||
|
getRole(roleId).then(response => {
|
||||||
|
this.form1.roleName = response.data.roleInfo.name;
|
||||||
|
this.form1.roleType = response.data.roleInfo.type;
|
||||||
|
this.form1.status = response.data.roleInfo.status;
|
||||||
|
this.form1.dutyId = response.data.roleInfo.id;
|
||||||
|
this.form1.description = response.data.roleInfo.description;
|
||||||
|
this.openDuty = true;
|
||||||
|
this.title = "修改角色";
|
||||||
|
let checkedKeys = response.data.checkedKeys
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
roleMenu.then(res => {
|
||||||
|
checkedKeys.forEach((v) => {
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.menu.setChecked(v, true ,false);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleStatusChangeDuty(data){
|
||||||
|
console.log(data)
|
||||||
|
dutyEdit(data).then(res => {
|
||||||
|
this.$message.success("修改成功")
|
||||||
|
this.getDutyList();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 搜索角色信息
|
||||||
|
handleQuery1(){
|
||||||
|
this.queryParams1.page = 1;
|
||||||
|
this.getDutyList();
|
||||||
|
},
|
||||||
|
getDutyList(){
|
||||||
|
this.loading = true;
|
||||||
|
dutyList(this.queryParams1).then(res => {
|
||||||
|
this.dutyList = res.data.records;
|
||||||
|
this.total1 = res.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
// 更改计费规则
|
// 更改计费规则
|
||||||
async changeTheBillingRule(event) {
|
async changeTheBillingRule(event) {
|
||||||
// 如果为修改时则进行提示
|
// 如果为修改时则进行提示
|
||||||
@ -930,12 +1272,14 @@ export default {
|
|||||||
|
|
||||||
// 点击树之后
|
// 点击树之后
|
||||||
this.queryParams.deptId = data.id
|
this.queryParams.deptId = data.id
|
||||||
|
this.queryParams1.storeId = data.id
|
||||||
this.deptType = data.deptType
|
this.deptType = data.deptType
|
||||||
// 新增节点
|
// 新增节点
|
||||||
this.appedit(data.id,data.label)
|
this.appedit(data.id,data.label)
|
||||||
// 用户请求
|
// 用户请求
|
||||||
// this.getList();
|
// this.getList();
|
||||||
this.onlyGetUser()
|
this.onlyGetUser()
|
||||||
|
this.getDutyList()
|
||||||
},
|
},
|
||||||
|
|
||||||
// 清除信息
|
// 清除信息
|
||||||
@ -1036,7 +1380,13 @@ export default {
|
|||||||
// // this.$refs[formName].resetFields();
|
// // this.$refs[formName].resetFields();
|
||||||
// },
|
// },
|
||||||
handleClick(tab, event) {
|
handleClick(tab, event) {
|
||||||
|
console.log(this.activeName)
|
||||||
|
if (this.activeName=="list"){
|
||||||
|
this.onlyGetUser()
|
||||||
|
}
|
||||||
|
if (this.activeName=="duty"){
|
||||||
|
this.getDutyList()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
//树形页操作
|
//树形页操作
|
||||||
//新增树
|
//新增树
|
||||||
@ -1235,6 +1585,7 @@ export default {
|
|||||||
if(this.Thetree.length>0 && !this.queryParams.deptId) {
|
if(this.Thetree.length>0 && !this.queryParams.deptId) {
|
||||||
this.queryParams.deptId = this.Thetree[0].id
|
this.queryParams.deptId = this.Thetree[0].id
|
||||||
this.form.deptType = this.Thetree[0].deptType
|
this.form.deptType = this.Thetree[0].deptType
|
||||||
|
this.queryParams1.storeId = this.Thetree[0].id
|
||||||
console.log("this.Thetree",this.Thetree[0])
|
console.log("this.Thetree",this.Thetree[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1408,6 +1759,12 @@ export default {
|
|||||||
this.rolelist = res.data
|
this.rolelist = res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 获取角色信息
|
||||||
|
getRoleList1(storeId) {
|
||||||
|
dutyLists({storeId:storeId}).then(res => {
|
||||||
|
this.rolelist = res.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
@ -1420,7 +1777,8 @@ export default {
|
|||||||
}else {
|
}else {
|
||||||
permissionType = 'system'
|
permissionType = 'system'
|
||||||
}
|
}
|
||||||
this.getRoleList(permissionType);
|
// this.getRoleList(permissionType);
|
||||||
|
this.getRoleList1(this.queryParams1.storeId);
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -1452,7 +1810,8 @@ export default {
|
|||||||
}else {
|
}else {
|
||||||
permissionType = 'system'
|
permissionType = 'system'
|
||||||
}
|
}
|
||||||
this.getRoleList(permissionType);
|
// this.getRoleList(permissionType);
|
||||||
|
this.getRoleList1(row.deptId);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -59,11 +59,9 @@
|
|||||||
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
|
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
|
||||||
<el-table-column label="ID" align="center" prop="id" width="80" />
|
<el-table-column label="ID" align="center" prop="id" width="80" />
|
||||||
<el-table-column label="姓名" align="center" prop="realName" />
|
<el-table-column label="姓名" align="center" prop="realName" />
|
||||||
<el-table-column label="员工角色" align="center" prop="roleId" >
|
<el-table-column label="员工角色" align="center" prop="dutyName" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="scope.row.roleId=='12'">油站站长</span>
|
<span>{{scope.row.dutyName || "--"}}</span>
|
||||||
<span v-if="scope.row.roleId=='15'">加油员</span>
|
|
||||||
<span v-if="scope.row.roleId=='16'">收银员</span>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="手机号" align="center" prop="mobile" />
|
<el-table-column label="手机号" align="center" prop="mobile" />
|
||||||
@ -143,9 +141,12 @@
|
|||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="角色组" prop="roleId">
|
<el-form-item label="角色组" prop="roleId">
|
||||||
<el-select v-model="form.roleId" placeholder="请选择角色" style="width: 270px">
|
<el-select v-model="form.roleId" placeholder="请选择角色" style="width: 270px">
|
||||||
<el-option label="油站站长" :value="12+''" ></el-option>
|
<el-option
|
||||||
<el-option label="加油员" :value="15+''" ></el-option>
|
v-for="item in roleList"
|
||||||
<el-option label="收银员" :value="16+''" ></el-option>
|
:key="item.dutyId+''"
|
||||||
|
:label="item.dutyName"
|
||||||
|
:value="item.dutyId+''"
|
||||||
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -240,6 +241,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import {getName} from "../../../utils/fuint";
|
import {getName} from "../../../utils/fuint";
|
||||||
import {addStaff, delStaff, getStaff, listStaff, updateStaff} from "../../../api/staff/staff";
|
import {addStaff, delStaff, getStaff, listStaff, updateStaff} from "../../../api/staff/staff";
|
||||||
|
import {dutyList} from "@/api/duty/duty";
|
||||||
// import {getDuty, listDuty} from "@/api/staff/duty";
|
// import {getDuty, listDuty} from "@/api/staff/duty";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -295,6 +297,8 @@
|
|||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 默认排序
|
// 默认排序
|
||||||
defaultSort: {prop: 'createTime', order: 'descending'},
|
defaultSort: {prop: 'createTime', order: 'descending'},
|
||||||
|
// 角色列表
|
||||||
|
roleList:[],
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {
|
form: {
|
||||||
id:'', category:'', userId:'', mobile:'', realName:'', wechat:'', merchantId:'', storeId:this.id, auditedStatus:'',
|
id:'', category:'', userId:'', mobile:'', realName:'', wechat:'', merchantId:'', storeId:this.id, auditedStatus:'',
|
||||||
@ -465,6 +469,18 @@
|
|||||||
this.reset();
|
this.reset();
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "新增员工";
|
this.title = "新增员工";
|
||||||
|
this.getRoleList1()
|
||||||
|
},
|
||||||
|
// 获取角色信息
|
||||||
|
getRoleList1() {
|
||||||
|
let data = {
|
||||||
|
page:1,
|
||||||
|
pageSize:10000,
|
||||||
|
dutyType:3
|
||||||
|
}
|
||||||
|
dutyList(data).then(res => {
|
||||||
|
this.roleList = res.data.records
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
@ -521,6 +537,7 @@
|
|||||||
this.specialPrem = this.form.specialPrem.split(",");
|
this.specialPrem = this.form.specialPrem.split(",");
|
||||||
this.posPrem = JSON.parse(this.form.posPrem);
|
this.posPrem = JSON.parse(this.form.posPrem);
|
||||||
this.appletPrem = JSON.parse(this.form.appletPrem);
|
this.appletPrem = JSON.parse(this.form.appletPrem);
|
||||||
|
this.getRoleList1()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 删除按钮操作
|
// 删除按钮操作
|
||||||
|
@ -98,6 +98,13 @@
|
|||||||
<el-radio :label="0">按钮</el-radio>
|
<el-radio :label="0">按钮</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="菜单角色" prop="merchantId">
|
||||||
|
<el-radio-group v-model="form.merchantId">
|
||||||
|
<el-radio :label="0">暂未设置</el-radio>
|
||||||
|
<el-radio :label="1">油站端菜单</el-radio>
|
||||||
|
<el-radio :label="2">中台端菜单</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="菜单图标" prop="icon">
|
<el-form-item label="菜单图标" prop="icon">
|
||||||
|
@ -38,15 +38,17 @@ public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MerchantConfig selectMeChByIdIsUse(int storeId) {
|
public MerchantConfig selectMeChByIdIsUse(int storeId) {
|
||||||
List<MerchantConfig> list = this.selectMeChByIsOpen(storeId);
|
|
||||||
if (list.size()>0){
|
|
||||||
oilConfigService.oilRule(storeId);
|
|
||||||
}
|
|
||||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("is_use","1");
|
queryWrapper.eq("is_use","1");
|
||||||
queryWrapper.eq("store_id",storeId);
|
queryWrapper.eq("store_id",storeId);
|
||||||
MerchantConfig merchantConfig = baseMapper.selectOne(queryWrapper);
|
MerchantConfig merchantConfig = baseMapper.selectOne(queryWrapper);
|
||||||
return merchantConfig;
|
if (ObjectUtil.isNotEmpty(merchantConfig) && merchantConfig.getIsOpenRule().equals("1")){
|
||||||
|
List<MerchantConfig> list = this.selectMeChByIsOpen(storeId);
|
||||||
|
if (list.size()>0){
|
||||||
|
oilConfigService.oilRule(storeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return baseMapper.selectOne(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,7 +41,7 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
|
|||||||
commission.setStoreId(storeId);
|
commission.setStoreId(storeId);
|
||||||
IPage<StaffCommissionVo> staffCommissionIPage = baseMapper.selectCommissionList(page, commission);
|
IPage<StaffCommissionVo> staffCommissionIPage = baseMapper.selectCommissionList(page, commission);
|
||||||
for (StaffCommissionVo record : staffCommissionIPage.getRecords()) {
|
for (StaffCommissionVo record : staffCommissionIPage.getRecords()) {
|
||||||
List<TDuty> tDuties = dutyService.selectDutyList();
|
List<TDuty> tDuties = dutyService.selectDutyPage(new Page<>(1,10000),new TDuty()).getRecords();
|
||||||
String[] staffRoleGroup = record.getStaffRoleGroup().split(",");
|
String[] staffRoleGroup = record.getStaffRoleGroup().split(",");
|
||||||
String str = "";
|
String str = "";
|
||||||
for (String staffRole : staffRoleGroup) {
|
for (String staffRole : staffRoleGroup) {
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
package com.fuint.business.member.controller;
|
package com.fuint.business.member.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fuint.business.member.service.ILJDutyService;
|
import com.fuint.business.member.service.ILJDutyService;
|
||||||
import com.fuint.framework.web.BaseController;
|
import com.fuint.framework.web.BaseController;
|
||||||
import com.fuint.framework.web.ResponseObject;
|
import com.fuint.framework.web.ResponseObject;
|
||||||
import com.fuint.system.role.entity.TDuty;
|
import com.fuint.system.role.entity.TDuty;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -31,6 +29,15 @@ public class LjDutyController extends BaseController {
|
|||||||
return getSuccessResult(list);
|
return getSuccessResult(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询角色信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/dutys")
|
||||||
|
public ResponseObject dutys(TDuty duty){
|
||||||
|
return getSuccessResult(dutyService.selectDutys(duty));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id查询角色信息
|
* 根据id查询角色信息
|
||||||
* @param id
|
* @param id
|
||||||
@ -41,4 +48,22 @@ public class LjDutyController extends BaseController {
|
|||||||
TDuty duty = dutyService.selectDutyById(id);
|
TDuty duty = dutyService.selectDutyById(id);
|
||||||
return getSuccessResult(duty);
|
return getSuccessResult(duty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public ResponseObject listPage(TDuty duty,
|
||||||
|
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
|
||||||
|
Page page =new Page(pageNo,pageSize);
|
||||||
|
return getSuccessResult(dutyService.selectDutyPage(page,duty));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{dutyId}")
|
||||||
|
public ResponseObject delete(@PathVariable Integer dutyId){
|
||||||
|
return getSuccessResult(dutyService.deleteDuty(dutyId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping()
|
||||||
|
public ResponseObject edit(@RequestBody TDuty duty){
|
||||||
|
return getSuccessResult(dutyService.updateDuty(duty));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,4 +123,9 @@ public class LJStaff extends BaseEntity implements Serializable {
|
|||||||
private String staffCode;
|
private String staffCode;
|
||||||
|
|
||||||
private String ifDelete;
|
private String ifDelete;
|
||||||
|
/**
|
||||||
|
* 角色名称
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String dutyName;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
package com.fuint.business.member.mapper;
|
package com.fuint.business.member.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fuint.system.role.entity.TDuty;
|
import com.fuint.system.role.entity.TDuty;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
public interface LJDutyMapper extends BaseMapper<TDuty> {
|
public interface LJDutyMapper extends BaseMapper<TDuty> {
|
||||||
|
/**
|
||||||
|
* 分页查询角色信息
|
||||||
|
* @param page
|
||||||
|
* @param duty
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Page<TDuty> selectDutyPage(Page page, @Param("duty") TDuty duty);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.fuint.business.member.mapper.LJDutyMapper">
|
||||||
|
<select id="selectDutyPage" resultType="com.fuint.system.role.entity.TDuty">
|
||||||
|
SELECT td.*,sd.dept_name FROM t_duty td
|
||||||
|
left join sys_dept sd on sd.dept_id = td.store_id
|
||||||
|
<where>
|
||||||
|
<if test="duty.dutyName != null and duty.dutyName != ''">
|
||||||
|
and td.duty_name like concat('%', #{duty.dutyName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="duty.status != null and duty.status != ''">
|
||||||
|
and td.status = #{duty.status}
|
||||||
|
</if>
|
||||||
|
<if test="duty.dutyType != null and duty.dutyType != ''">
|
||||||
|
and td.duty_type = #{duty.dutyType}
|
||||||
|
</if>
|
||||||
|
<if test="duty.storeId != null">
|
||||||
|
and (td.store_id = #{duty.storeId} or FIND_IN_SET(#{duty.storeId}, sd.ancestors))
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -6,20 +6,21 @@
|
|||||||
</sql>
|
</sql>
|
||||||
<!--根据条件分页查询用户信息-->
|
<!--根据条件分页查询用户信息-->
|
||||||
<select id="selectLJStaffList" resultType="com.fuint.business.member.entity.LJStaff">
|
<select id="selectLJStaffList" resultType="com.fuint.business.member.entity.LJStaff">
|
||||||
<include refid="selectMtStaff"></include>
|
SELECT ms.*,td.duty_name FROM mt_staff ms
|
||||||
|
left join t_duty td on ms.role_id = td.duty_id
|
||||||
<where>
|
<where>
|
||||||
store_id = #{staff.storeId} and if_delete = 0
|
ms.store_id = #{staff.storeId} and ms.if_delete = 0
|
||||||
<if test="staff.realName != null and staff.realName != ''">
|
<if test="staff.realName != null and staff.realName != ''">
|
||||||
and real_name like concat('%', #{staff.realName}, '%')
|
and ms.real_name like concat('%', #{staff.realName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="staff.mobile != null and staff.mobile != ''">
|
<if test="staff.mobile != null and staff.mobile != ''">
|
||||||
and mobile like concat('%', #{staff.mobile}, '%')
|
and ms.mobile like concat('%', #{staff.mobile}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="staff.status != null and staff.status != ''">
|
<if test="staff.status != null and staff.status != ''">
|
||||||
and status = #{staff.status}
|
and ms.status = #{staff.status}
|
||||||
</if>
|
</if>
|
||||||
<if test="staff.id != null and staff.id != ''">
|
<if test="staff.id != null and staff.id != ''">
|
||||||
and id = #{staff.id}
|
and ms.id = #{staff.id}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.fuint.business.member.service;
|
package com.fuint.business.member.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.fuint.system.role.entity.TDuty;
|
import com.fuint.system.role.entity.TDuty;
|
||||||
|
|
||||||
@ -15,10 +16,32 @@ public interface ILJDutyService extends IService<TDuty> {
|
|||||||
*/
|
*/
|
||||||
public List<TDuty> selectDutyList();
|
public List<TDuty> selectDutyList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据机构信息查询角色信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<TDuty> selectDutys(TDuty duty);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id查询角色信息
|
* 根据id查询角色信息
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public TDuty selectDutyById(int id);
|
public TDuty selectDutyById(int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询角色信息
|
||||||
|
* @param page
|
||||||
|
* @param duty
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Page<TDuty> selectDutyPage(Page page,TDuty duty);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id删除角色信息
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
int deleteDuty(Integer id);
|
||||||
|
|
||||||
|
int updateDuty(TDuty duty);
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,26 @@
|
|||||||
package com.fuint.business.member.service.impl;
|
package com.fuint.business.member.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.fuint.business.member.mapper.LJDutyMapper;
|
import com.fuint.business.member.mapper.LJDutyMapper;
|
||||||
import com.fuint.business.member.service.ILJDutyService;
|
import com.fuint.business.member.service.ILJDutyService;
|
||||||
|
import com.fuint.common.dto.AccountInfo;
|
||||||
|
import com.fuint.common.util.TokenUtil;
|
||||||
|
import com.fuint.system.dept.entity.SysDept;
|
||||||
|
import com.fuint.system.dept.service.ISysDeptService;
|
||||||
import com.fuint.system.role.entity.TDuty;
|
import com.fuint.system.role.entity.TDuty;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class LJDutyServiceImpl extends ServiceImpl<LJDutyMapper, TDuty> implements ILJDutyService {
|
public class LJDutyServiceImpl extends ServiceImpl<LJDutyMapper, TDuty> implements ILJDutyService {
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService sysDeptService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询角色信息
|
* 查询角色信息
|
||||||
* @return
|
* @return
|
||||||
@ -22,6 +32,25 @@ public class LJDutyServiceImpl extends ServiceImpl<LJDutyMapper, TDuty> implemen
|
|||||||
return baseMapper.selectList(queryWrapper);
|
return baseMapper.selectList(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据机构id查询角色信息
|
||||||
|
* @param duty
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TDuty> selectDutys(TDuty duty) {
|
||||||
|
QueryWrapper<TDuty> queryWrapper = new QueryWrapper<>();
|
||||||
|
if (ObjectUtil.isNotEmpty(duty.getStoreId())) {
|
||||||
|
SysDept sysDept = sysDeptService.selectParentId(Long.valueOf(duty.getStoreId()));
|
||||||
|
queryWrapper.eq("store_id", sysDept.getDeptId());
|
||||||
|
}else {
|
||||||
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
|
SysDept sysDept = sysDeptService.selectParentId(nowAccountInfo.getDeptId());
|
||||||
|
queryWrapper.eq("store_id", sysDept.getDeptId());
|
||||||
|
}
|
||||||
|
return baseMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id查询角色信息
|
* 根据id查询角色信息
|
||||||
* @param id
|
* @param id
|
||||||
@ -31,4 +60,27 @@ public class LJDutyServiceImpl extends ServiceImpl<LJDutyMapper, TDuty> implemen
|
|||||||
public TDuty selectDutyById(int id) {
|
public TDuty selectDutyById(int id) {
|
||||||
return baseMapper.selectById(id);
|
return baseMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<TDuty> selectDutyPage(Page page, TDuty duty) {
|
||||||
|
if (ObjectUtil.isNotEmpty(duty.getStoreId())){
|
||||||
|
SysDept sysDept = sysDeptService.selectParentId(Long.valueOf(duty.getStoreId()));
|
||||||
|
duty.setStoreId(Math.toIntExact(sysDept.getDeptId()));
|
||||||
|
}else {
|
||||||
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
|
SysDept sysDept = sysDeptService.selectParentId(nowAccountInfo.getDeptId());
|
||||||
|
duty.setStoreId(Math.toIntExact(sysDept.getDeptId()));
|
||||||
|
}
|
||||||
|
return baseMapper.selectDutyPage(page,duty);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteDuty(Integer id) {
|
||||||
|
return baseMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateDuty(TDuty duty) {
|
||||||
|
return baseMapper.updateById(duty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
|
|||||||
LambdaQueryWrapper<MtStore> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<MtStore> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
lambdaQueryWrapper.eq(MtStore::getContractDeptId,deptId);
|
lambdaQueryWrapper.eq(MtStore::getContractDeptId,deptId);
|
||||||
mtStore = mtStoreMapper.selectOne(lambdaQueryWrapper);
|
mtStore = mtStoreMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
if (ObjectUtil.isNotEmpty(mtStore)) merchantId = String.valueOf(mtStore.getChainStoreId());
|
||||||
}
|
}
|
||||||
if ("2".equals(deptType)) {
|
if ("2".equals(deptType)) {
|
||||||
// 查出storeId
|
// 查出storeId
|
||||||
@ -287,7 +287,6 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
|
|||||||
tAccount.setLocked(0);
|
tAccount.setLocked(0);
|
||||||
if (ObjectUtil.isEmpty(mtStore)) mtStore.setId(0);
|
if (ObjectUtil.isEmpty(mtStore)) mtStore.setId(0);
|
||||||
tAccount.setStoreId(mtStore.getId());
|
tAccount.setStoreId(mtStore.getId());
|
||||||
merchantId = ObjectUtil.isNotEmpty(mtStore) ? String.valueOf(mtStore.getChainStoreId()) : merchantId;
|
|
||||||
tAccount.setMerchantId(Integer.parseInt(merchantId));
|
tAccount.setMerchantId(Integer.parseInt(merchantId));
|
||||||
tAccount.setStaffId(Integer.parseInt(staffId));
|
tAccount.setStaffId(Integer.parseInt(staffId));
|
||||||
tAccount.setDeptId(Long.parseLong(deptId));
|
tAccount.setDeptId(Long.parseLong(deptId));
|
||||||
@ -364,6 +363,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
|
|||||||
TAccount tAccount = getAccountInfoById(id.intValue());
|
TAccount tAccount = getAccountInfoById(id.intValue());
|
||||||
tAccount.setAcctId(id.intValue());
|
tAccount.setAcctId(id.intValue());
|
||||||
tAccount.setRealName(realName);
|
tAccount.setRealName(realName);
|
||||||
|
tAccount.setRoleIds(roleId);
|
||||||
|
|
||||||
if (StringUtil.isNotEmpty(accountName)) {
|
if (StringUtil.isNotEmpty(accountName)) {
|
||||||
tAccount.setAccountName(accountName);
|
tAccount.setAccountName(accountName);
|
||||||
@ -432,38 +432,40 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
|
|||||||
if(ObjectUtil.isNotEmpty(staffId)) {
|
if(ObjectUtil.isNotEmpty(staffId)) {
|
||||||
LJStaff ljStaff = ljStaffMapper.selectById(staffId);
|
LJStaff ljStaff = ljStaffMapper.selectById(staffId);
|
||||||
|
|
||||||
// 修改对应的员工账号
|
if (ObjectUtil.isNotEmpty(ljStaff)){
|
||||||
ljStaff.setRealName(realName);
|
// 修改对应的员工账号
|
||||||
ljStaff.setStoreId(Integer.parseInt(storeId));
|
ljStaff.setRealName(realName);
|
||||||
|
ljStaff.setStoreId(Integer.parseInt(storeId));
|
||||||
|
|
||||||
ljStaff.setRoleId(roleId);
|
ljStaff.setRoleId(roleId);
|
||||||
|
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
if (ObjectUtil.isNotEmpty(param.get("mobile"))) {
|
if (ObjectUtil.isNotEmpty(param.get("mobile"))) {
|
||||||
if (param.get("mobile").toString().equals(ljStaff.getMobile())) {
|
if (param.get("mobile").toString().equals(ljStaff.getMobile())) {
|
||||||
flag = true;
|
flag = true;
|
||||||
} else {
|
} else {
|
||||||
ljStaff.setMobile(param.get("mobile").toString());
|
ljStaff.setMobile(param.get("mobile").toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
throw new RuntimeException("请输入手机号!");
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<LJStaff> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
if (!flag) {
|
||||||
|
// 查询手机号是否存在
|
||||||
|
lambdaQueryWrapper.eq(LJStaff::getMobile,param.get("mobile").toString());
|
||||||
|
lambdaQueryWrapper.eq(LJStaff::getIfDelete,0);
|
||||||
|
|
||||||
|
List list = ljStaffMapper.selectList(lambdaQueryWrapper);
|
||||||
|
if (list.size()>0) {
|
||||||
|
throw new RuntimeException("手机号重复!");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
|
||||||
throw new RuntimeException("请输入手机号!");
|
ljStaffMapper.updateById(ljStaff);
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<LJStaff> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
|
||||||
if (!flag) {
|
|
||||||
// 查询手机号是否存在
|
|
||||||
lambdaQueryWrapper.eq(LJStaff::getMobile,param.get("mobile").toString());
|
|
||||||
lambdaQueryWrapper.eq(LJStaff::getIfDelete,0);
|
|
||||||
|
|
||||||
List list = ljStaffMapper.selectList(lambdaQueryWrapper);
|
|
||||||
if (list.size()>0) {
|
|
||||||
throw new RuntimeException("手机号重复!");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ljStaffMapper.updateById(ljStaff);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (BusinessCheckException e) {
|
} catch (BusinessCheckException e) {
|
||||||
|
@ -57,8 +57,9 @@ public class SourceServiceImpl extends ServiceImpl<TSourceMapper, TSource> imple
|
|||||||
@Override
|
@Override
|
||||||
public List<TreeNode> getSourceTree(Integer merchantId) {
|
public List<TreeNode> getSourceTree(Integer merchantId) {
|
||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
List<TSource> tSources = getAvailableSources(merchantId);
|
// List<TSource> tSources = getAvailableSources(merchantId);
|
||||||
if (nowAccountInfo.getRoleIds().equals("14")) tSources = getAvailableSources1(1);
|
// if (nowAccountInfo.getRoleIds().equals("14")) tSources = getAvailableSources1(1);
|
||||||
|
List<TSource> tSources = getAvailableSources1(merchantId);
|
||||||
List<TreeNode> trees = new ArrayList<>();
|
List<TreeNode> trees = new ArrayList<>();
|
||||||
if (tSources != null && tSources.size() > 0) {
|
if (tSources != null && tSources.size() > 0) {
|
||||||
TreeNode sourceTreeNode = null;
|
TreeNode sourceTreeNode = null;
|
||||||
@ -109,7 +110,7 @@ public class SourceServiceImpl extends ServiceImpl<TSourceMapper, TSource> imple
|
|||||||
@Override
|
@Override
|
||||||
public List<TSource> getMenuListByUserId(Integer merchantId, Integer accountId) {
|
public List<TSource> getMenuListByUserId(Integer merchantId, Integer accountId) {
|
||||||
if (merchantId == null) {
|
if (merchantId == null) {
|
||||||
merchantId = 1;
|
merchantId = 0;
|
||||||
}
|
}
|
||||||
List<TSource> sourceList = tSourceMapper.findSourcesByAccountId(merchantId, accountId);
|
List<TSource> sourceList = tSourceMapper.findSourcesByAccountId(merchantId, accountId);
|
||||||
return delRepeated(sourceList);
|
return delRepeated(sourceList);
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package com.fuint.module.backendApi.controller;
|
package com.fuint.module.backendApi.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.baomidou.mybatisplus.extension.api.R;
|
import com.baomidou.mybatisplus.extension.api.R;
|
||||||
import com.fuint.business.member.entity.LJStaff;
|
import com.fuint.business.member.entity.LJStaff;
|
||||||
import com.fuint.business.member.service.ILJStaffService;
|
import com.fuint.business.member.service.ILJStaffService;
|
||||||
|
import com.fuint.business.storeInformation.entity.LJStore;
|
||||||
|
import com.fuint.business.storeInformation.service.ILJStoreService;
|
||||||
import com.fuint.business.userManager.entity.LJUser;
|
import com.fuint.business.userManager.entity.LJUser;
|
||||||
import com.fuint.business.userManager.service.LJUserService;
|
import com.fuint.business.userManager.service.LJUserService;
|
||||||
import com.fuint.common.dto.AccountInfo;
|
import com.fuint.common.dto.AccountInfo;
|
||||||
@ -20,6 +23,7 @@ import com.fuint.framework.web.BaseController;
|
|||||||
import com.fuint.framework.web.ResponseObject;
|
import com.fuint.framework.web.ResponseObject;
|
||||||
import com.fuint.module.backendApi.response.LoginResponse;
|
import com.fuint.module.backendApi.response.LoginResponse;
|
||||||
import com.fuint.repository.model.TAccount;
|
import com.fuint.repository.model.TAccount;
|
||||||
|
import com.fuint.repository.model.TDutySource;
|
||||||
import com.fuint.system.role.entity.TDuty;
|
import com.fuint.system.role.entity.TDuty;
|
||||||
import com.fuint.repository.model.TSource;
|
import com.fuint.repository.model.TSource;
|
||||||
import com.fuint.system.role.service.DutyService;
|
import com.fuint.system.role.service.DutyService;
|
||||||
@ -77,6 +81,8 @@ public class BackendLoginController extends BaseController {
|
|||||||
private CaptchaService captchaService;
|
private CaptchaService captchaService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private LJUserService userService;
|
private LJUserService userService;
|
||||||
|
@Autowired
|
||||||
|
private ILJStoreService storeService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public RedisTemplate redisTemplate;
|
public RedisTemplate redisTemplate;
|
||||||
@ -273,8 +279,23 @@ public class BackendLoginController extends BaseController {
|
|||||||
return getFailureResult(401, "登录信息已失效,请重新登录");
|
return getFailureResult(401, "登录信息已失效,请重新登录");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TSource> sources = sourceService.getMenuListByUserId(accountInfo.getMerchantId(), accountInfo.getId());
|
TDuty roleById = dutyService.getRoleById(Long.valueOf(accountInfo.getRoleIds()));
|
||||||
|
Integer merchantId = null;
|
||||||
|
if (ObjectUtil.isNotEmpty(roleById) && roleById.getDutyType().equals("3")) merchantId = 1;
|
||||||
|
if (ObjectUtil.isNotEmpty(roleById) && roleById.getDutyType().equals("4")) merchantId = 2;
|
||||||
|
|
||||||
|
List<TSource> sources = sourceService.getMenuListByUserId(merchantId, accountInfo.getId());
|
||||||
|
// List<TSource> sources = new ArrayList<>();
|
||||||
|
// if (!accountInfo.getRoleIds().equals("12") && !accountInfo.getRoleIds().equals("15") && !accountInfo.getRoleIds().equals("16")) {
|
||||||
|
// sources = sources1;
|
||||||
|
// }else {
|
||||||
|
// List<TDutySource> tDutySources = dutySourceService.selectListByChainStoreId(Integer.valueOf(accountInfo.getRoleIds()),chainStoreId);
|
||||||
|
// for (TDutySource tDutySource : tDutySources) {
|
||||||
|
// for (TSource tSource : sources1) {
|
||||||
|
// if (tDutySource.getSourceId().equals(tSource.getSourceId())) sources.add(tSource);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
List<TreeNode> trees = new ArrayList<>();
|
List<TreeNode> trees = new ArrayList<>();
|
||||||
TreeNode treeNode;
|
TreeNode treeNode;
|
||||||
for (TSource tSource : sources) {
|
for (TSource tSource : sources) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.fuint.module.backendApi.controller;
|
package com.fuint.module.backendApi.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.fuint.common.domain.TreeNode;
|
import com.fuint.common.domain.TreeNode;
|
||||||
import com.fuint.common.domain.TreeSelect;
|
import com.fuint.common.domain.TreeSelect;
|
||||||
import com.fuint.common.dto.AccountInfo;
|
import com.fuint.common.dto.AccountInfo;
|
||||||
@ -11,6 +12,7 @@ import com.fuint.common.util.TokenUtil;
|
|||||||
import com.fuint.framework.exception.BusinessCheckException;
|
import com.fuint.framework.exception.BusinessCheckException;
|
||||||
import com.fuint.framework.web.BaseController;
|
import com.fuint.framework.web.BaseController;
|
||||||
import com.fuint.framework.web.ResponseObject;
|
import com.fuint.framework.web.ResponseObject;
|
||||||
|
import com.fuint.repository.model.TAccount;
|
||||||
import com.fuint.repository.model.TSource;
|
import com.fuint.repository.model.TSource;
|
||||||
import com.fuint.utils.StringUtil;
|
import com.fuint.utils.StringUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -251,14 +253,13 @@ public class BackendSourceController extends BaseController {
|
|||||||
* */
|
* */
|
||||||
@ApiOperation(value = "获取菜单下拉树列表")
|
@ApiOperation(value = "获取菜单下拉树列表")
|
||||||
@RequestMapping(value = "/treeselect", method = RequestMethod.GET)
|
@RequestMapping(value = "/treeselect", method = RequestMethod.GET)
|
||||||
public ResponseObject treeselect(HttpServletRequest request) {
|
public ResponseObject treeselect(HttpServletRequest request, TAccount account) {
|
||||||
String token = request.getHeader("Access-Token");
|
String token = request.getHeader("Access-Token");
|
||||||
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
||||||
if (accountInfo == null) {
|
if (accountInfo == null) {
|
||||||
return getFailureResult(1001, "请先登录");
|
return getFailureResult(1001, "请先登录");
|
||||||
}
|
}
|
||||||
|
List<TreeNode> sources = sSourceService.getSourceTree(ObjectUtil.isNotEmpty(account.getMerchantId()) ? account.getMerchantId() : null);
|
||||||
List<TreeNode> sources = sSourceService.getSourceTree(accountInfo.getMerchantId());
|
|
||||||
List<TreeSelect> data = sourceService.buildMenuTreeSelect(sources);
|
List<TreeSelect> data = sourceService.buildMenuTreeSelect(sources);
|
||||||
|
|
||||||
return getSuccessResult(data);
|
return getSuccessResult(data);
|
||||||
|
@ -48,6 +48,13 @@ public interface ISysDeptService extends IService<SysDept>
|
|||||||
*/
|
*/
|
||||||
public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts);
|
public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询除蓝鲸总部的父级信息
|
||||||
|
* @param deptId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SysDept selectParentId(Long deptId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门ID查询信息
|
* 根据部门ID查询信息
|
||||||
|
@ -135,7 +135,19 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
|
|||||||
List<SysDept> deptTrees = buildDeptTree(depts);
|
List<SysDept> deptTrees = buildDeptTree(depts);
|
||||||
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
|
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysDept selectParentId(Long deptId) {
|
||||||
|
// SysDept sysDept = this.selectDeptById(deptId);
|
||||||
|
SysDept dept = this.selectDeptById(deptId);
|
||||||
|
Long parentId = dept.getParentId();
|
||||||
|
while (parentId > 100){
|
||||||
|
dept = this.selectDeptById(parentId);
|
||||||
|
parentId = dept.getParentId();
|
||||||
|
}
|
||||||
|
return dept;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门ID查询信息
|
* 根据部门ID查询信息
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package com.fuint.system.role.controller;
|
package com.fuint.system.role.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.fuint.common.service.AccountService;
|
||||||
import com.fuint.common.util.Constants;
|
import com.fuint.common.util.Constants;
|
||||||
import com.fuint.common.dto.AccountDto;
|
import com.fuint.common.dto.AccountDto;
|
||||||
import com.fuint.common.dto.AccountInfo;
|
import com.fuint.common.dto.AccountInfo;
|
||||||
import com.fuint.common.dto.RoleDto;
|
import com.fuint.common.dto.RoleDto;
|
||||||
import com.fuint.common.enums.AdminRoleEnum;
|
import com.fuint.common.enums.AdminRoleEnum;
|
||||||
|
import com.fuint.repository.model.TAccount;
|
||||||
import com.fuint.system.role.service.DutyService;
|
import com.fuint.system.role.service.DutyService;
|
||||||
import com.fuint.common.service.SourceService;
|
import com.fuint.common.service.SourceService;
|
||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
@ -49,6 +52,9 @@ public class BackendDutyController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SourceService tSourceService;
|
private SourceService tSourceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AccountService accountService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色列表
|
* 角色列表
|
||||||
*
|
*
|
||||||
@ -137,8 +143,15 @@ public class BackendDutyController extends BaseController {
|
|||||||
String type = param.get("roleType").toString();
|
String type = param.get("roleType").toString();
|
||||||
String status = param.get("status").toString();
|
String status = param.get("status").toString();
|
||||||
String description = param.get("description").toString();
|
String description = param.get("description").toString();
|
||||||
|
if (ObjectUtil.isEmpty(param.get("storeId"))){
|
||||||
|
return getFailureResult(1001, "请先选择机构");
|
||||||
|
}
|
||||||
|
Integer storeId = Integer.valueOf(param.get("storeId").toString());
|
||||||
|
|
||||||
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
||||||
|
if (ObjectUtil.isNotEmpty(accountInfo) && param.get("storeId").equals("-1")){
|
||||||
|
storeId = Math.toIntExact(accountInfo.getDeptId());
|
||||||
|
}
|
||||||
if (accountInfo == null) {
|
if (accountInfo == null) {
|
||||||
return getFailureResult(1001, "请先登录");
|
return getFailureResult(1001, "请先登录");
|
||||||
}
|
}
|
||||||
@ -160,6 +173,7 @@ public class BackendDutyController extends BaseController {
|
|||||||
tDuty.setDutyType(type);
|
tDuty.setDutyType(type);
|
||||||
tDuty.setStatus(status);
|
tDuty.setStatus(status);
|
||||||
tDuty.setDescription(description);
|
tDuty.setDescription(description);
|
||||||
|
tDuty.setStoreId(storeId);
|
||||||
|
|
||||||
// 添加角色信息
|
// 添加角色信息
|
||||||
try {
|
try {
|
||||||
@ -199,6 +213,7 @@ public class BackendDutyController extends BaseController {
|
|||||||
roleInfo.setDescription(htDuty.getDescription());
|
roleInfo.setDescription(htDuty.getDescription());
|
||||||
|
|
||||||
result.put("roleInfo", roleInfo);
|
result.put("roleInfo", roleInfo);
|
||||||
|
|
||||||
List<Long> checkedKeys = tDutyService.getSourceIdsByDutyId(roleId.intValue());
|
List<Long> checkedKeys = tDutyService.getSourceIdsByDutyId(roleId.intValue());
|
||||||
if (checkedKeys != null && checkedKeys.size() > 0) {
|
if (checkedKeys != null && checkedKeys.size() > 0) {
|
||||||
result.put("checkedKeys", checkedKeys);
|
result.put("checkedKeys", checkedKeys);
|
||||||
@ -219,7 +234,7 @@ public class BackendDutyController extends BaseController {
|
|||||||
public ResponseObject updateHandler(HttpServletRequest request, @RequestBody Map<String, Object> param) {
|
public ResponseObject updateHandler(HttpServletRequest request, @RequestBody Map<String, Object> param) {
|
||||||
String token = request.getHeader("Access-Token");
|
String token = request.getHeader("Access-Token");
|
||||||
List<Integer> menuIds = (List) param.get("menuIds");
|
List<Integer> menuIds = (List) param.get("menuIds");
|
||||||
String id = param.get("id").toString();
|
String id = param.get("dutyId").toString();
|
||||||
String name = param.get("roleName").toString();
|
String name = param.get("roleName").toString();
|
||||||
String type = param.get("roleType").toString();
|
String type = param.get("roleType").toString();
|
||||||
String status = param.get("status").toString();
|
String status = param.get("status").toString();
|
||||||
@ -235,7 +250,8 @@ public class BackendDutyController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TDuty duty = tDutyService.getRoleById(Long.parseLong(id));
|
TDuty duty = tDutyService.getRoleById(Long.parseLong(id));
|
||||||
if (!duty.getStoreId().equals(accountInfo.getMerchantId()) && accountInfo.getMerchantId() > 0) {
|
if (!accountInfo.getDeptId().equals(Long.valueOf(duty.getStoreId())) && accountInfo.getStoreId()>0
|
||||||
|
&& !accountInfo.getRoleIds().equals("14")) {
|
||||||
return getFailureResult(201, "抱歉,您没有修改权限");
|
return getFailureResult(201, "抱歉,您没有修改权限");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.fuint.system.role.entity;
|
package com.fuint.system.role.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -48,6 +49,10 @@ public class TDuty extends BaseEntity implements Serializable {
|
|||||||
@ApiModelProperty("角色编码")
|
@ApiModelProperty("角色编码")
|
||||||
private String code;
|
private String code;
|
||||||
private String permissionType;
|
private String permissionType;
|
||||||
|
/**
|
||||||
|
* 机构名称
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
select * from t_duty u
|
select * from t_duty u
|
||||||
where u.DUTY_NAME = #{name}
|
where u.DUTY_NAME = #{name}
|
||||||
<if test="merchantId != null and merchantId > 0">
|
<if test="merchantId != null and merchantId > 0">
|
||||||
and u.MERCHANT_ID = #{merchantId}
|
and u.store_id = #{merchantId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -97,8 +97,8 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
|
|||||||
throw new BusinessRuntimeException("抱歉,您没有删除的权限");
|
throw new BusinessRuntimeException("抱歉,您没有删除的权限");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
tDutySourceMapper.deleteSourcesByDutyId((int) dutyId);
|
tDutySourceMapper.deleteSourcesByDutyId((int) dutyId);
|
||||||
tDutyMapper.deleteById(dutyId);
|
tDutyMapper.deleteById(dutyId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BusinessRuntimeException("该角色已存在关联用户,无法删除");
|
throw new BusinessRuntimeException("该角色已存在关联用户,无法删除");
|
||||||
}
|
}
|
||||||
@ -154,20 +154,16 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
|
|||||||
existsDuty.setDutyName(tduty.getDutyName());
|
existsDuty.setDutyName(tduty.getDutyName());
|
||||||
existsDuty.setStatus(tduty.getStatus());
|
existsDuty.setStatus(tduty.getStatus());
|
||||||
|
|
||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
|
||||||
TAccount byId = accountService.getById(nowAccountInfo.getId());
|
|
||||||
Integer chainStoreId = null;
|
|
||||||
if (ObjectUtil.isNotEmpty(byId)) chainStoreId = byId.getMerchantId();
|
|
||||||
|
|
||||||
if (sources != null && sources.size() > 0) {
|
if (sources != null && sources.size() > 0) {
|
||||||
tDutySourceMapper.deleteSourcesByDutyId(tduty.getDutyId());
|
tDutySourceMapper.deleteSourcesByDutyId(tduty.getDutyId());
|
||||||
for (TSource tSource : sources) {
|
for (TSource tSource : sources) {
|
||||||
TDutySource dutySource = new TDutySource();
|
TDutySource dutySource = new TDutySource();
|
||||||
dutySource.setDutyId(tduty.getDutyId());
|
dutySource.setDutyId(tduty.getDutyId());
|
||||||
dutySource.setSourceId(tSource.getSourceId());
|
dutySource.setSourceId(tSource.getSourceId());
|
||||||
dutySource.setChainStoreId(chainStoreId);
|
|
||||||
tDutySourceMapper.insert(dutySource);
|
tDutySourceMapper.insert(dutySource);
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
tDutySourceMapper.deleteSourcesByDutyId(tduty.getDutyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
tDutyMapper.updateById(existsDuty);
|
tDutyMapper.updateById(existsDuty);
|
||||||
@ -210,16 +206,16 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
|
|||||||
throw new BusinessCheckException("角色名称已经存在.");
|
throw new BusinessCheckException("角色名称已经存在.");
|
||||||
}
|
}
|
||||||
this.tDutyMapper.insert(duty);
|
this.tDutyMapper.insert(duty);
|
||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
TAccount byId = accountService.getById(nowAccountInfo.getId());
|
// TAccount byId = accountService.getById(nowAccountInfo.getId());
|
||||||
Integer chainStoreId = null;
|
// Integer chainStoreId = null;
|
||||||
if (ObjectUtil.isNotEmpty(byId)) chainStoreId = byId.getMerchantId();
|
// if (ObjectUtil.isNotEmpty(byId)) chainStoreId = byId.getMerchantId();
|
||||||
if (sources != null && sources.size() > 0) {
|
if (sources != null && sources.size() > 0) {
|
||||||
for (TSource tSource : sources) {
|
for (TSource tSource : sources) {
|
||||||
TDutySource dutySource = new TDutySource();
|
TDutySource dutySource = new TDutySource();
|
||||||
dutySource.setDutyId(duty.getDutyId());
|
dutySource.setDutyId(duty.getDutyId());
|
||||||
dutySource.setSourceId(tSource.getSourceId());
|
dutySource.setSourceId(tSource.getSourceId());
|
||||||
dutySource.setChainStoreId(chainStoreId);
|
// dutySource.setChainStoreId(chainStoreId);
|
||||||
tDutySourceMapper.insert(dutySource);
|
tDutySourceMapper.insert(dutySource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,6 @@ public class TDutySource implements Serializable {
|
|||||||
* 菜单id
|
* 菜单id
|
||||||
*/
|
*/
|
||||||
private Integer sourceId;
|
private Integer sourceId;
|
||||||
/**
|
|
||||||
* 连锁店id
|
|
||||||
*/
|
|
||||||
private Integer chainStoreId;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user