Merge remote-tracking branch 'origin/master'

This commit is contained in:
齐天大圣 2024-03-22 09:55:38 +08:00
commit 762545d1ee
37 changed files with 2175 additions and 113 deletions

View 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
})
}

View File

@ -18,10 +18,11 @@ export function getMenu(menuId) {
}
// 查询菜单下拉树结构
export function treeselect() {
export function treeselect(params) {
return request({
url: 'backendApi/source/treeselect',
method: 'get'
method: 'get',
params: params
})
}

View 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>

View File

@ -60,11 +60,9 @@
<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 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">
<span v-if="scope.row.roleId=='12'">油站站长</span>
<span v-if="scope.row.roleId=='15'">加油员</span>
<span v-if="scope.row.roleId=='16'">收银员</span>
<span>{{scope.row.dutyName || "--"}}</span>
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="mobile" width="110"/>
@ -156,11 +154,6 @@
:label="item.dutyName"
:value="item.dutyId+''"
></el-option>
<el-option
v-if="form.roleId == 12"
label="油站站长"
:value="12+''"
></el-option>
</el-select>
</el-form-item>
@ -333,6 +326,7 @@ import {addStaff, createStaffQrCode, delStaff, getStaff, listStaff, queryStaff,
import {getDuty, listDuty} from "@/api/staff/duty";
import html2canvas from "html2canvas";
import {getDicts} from "@/api/order/data";
import {dutyList, dutyLists} from "@/api/duty/duty";
export default {
name: "StaffList",
@ -488,7 +482,7 @@ export default {
},
created() {
this.getList();
this.getDuty();
// this.getDuty();
// this.getStoreList();
},
methods: {
@ -649,9 +643,21 @@ export default {
async handleAdd() {
this.reset();
await this.getAuditPrem()
this.getRoleList1()
this.open = true;
this.title = "新增员工";
},
//
getRoleList1() {
let data = {
page:1,
pageSize:10000,
dutyType:3
}
dutyList(data).then(res => {
this.roleList = res.data.records
})
},
//
reset() {
this.posPrem = '';
@ -757,6 +763,7 @@ export default {
if (this.appletPrem != null && this.appletPrem != ""){
this.appletPrem = JSON.parse(this.form.appletPrem);
}
this.getRoleList1();
});
},
//

View File

@ -239,15 +239,12 @@
multiple
placeholder="请选择所属角色"
@change="getCheckbox">
<!-- <el-option-->
<!-- v-for="(item,index) in roleList"-->
<!-- :key="index"-->
<!-- :label="item.dutyName"-->
<!-- :value="item.dutyId"-->
<!-- ></el-option>-->
<el-option label="加油员" :value="15+''" ></el-option>
<el-option label="收银员" :value="16+''" ></el-option>
<!-- :value="item.dutyId"-->
<el-option
v-for="item in roleList"
:key="item.dutyId+''"
:label="item.dutyName"
:value="item.dutyId+''"
></el-option>
</el-select>
</el-form-item>
</el-col>
@ -430,6 +427,7 @@ import {
} from "@/api/staffCommission/staffcommission";
import {listDuty} from "@/api/staff/duty";
import {queryStaffs} from "@/api/order/staff";
import {dutyList} from "@/api/duty/duty";
export default {
dicts: ['source','role','zhzt','comissionType'],
@ -521,9 +519,20 @@ export default {
created() {
this.getList();
this.getStaffList();
this.getDuty();
// this.getDuty();
},
methods:{
//
getRoleList1() {
let data = {
page:1,
pageSize:10000,
dutyType:3
}
dutyList(data).then(res => {
this.roleList = res.data.records
})
},
getStaffCommissionList(){
this.loading = true
this.dateRange = []
@ -657,6 +666,7 @@ export default {
handleAdd() {
this.reset();
this.open = true;
this.getRoleList1()
this.title = "新增提成方案";
},
//
@ -673,6 +683,7 @@ export default {
if (response.data.staffRoleGroup){
this.staffRoleGroup = response.data.staffRoleGroup.split(",");
}
this.getRoleList1()
});
},

View File

@ -98,6 +98,13 @@
<el-radio :label="0">按钮</el-radio>
</el-radio-group>
</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 :span="24">
<el-form-item label="菜单图标" prop="icon">

View 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
})
}

View File

@ -18,10 +18,11 @@ export function getMenu(menuId) {
}
// 查询菜单下拉树结构
export function treeselect() {
export function treeselect(params) {
return request({
url: 'backendApi/source/treeselect',
method: 'get'
method: 'get',
params: params
})
}

View File

@ -158,7 +158,7 @@
</el-tab-pane>
<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-cascader :disabled="isTopDept" :options="Thetree" disabled style="width: 300px"
v-model="cascader" :props="defaultProps" @change="handleChanges" :placeholder="parentName" ></el-cascader>
@ -167,7 +167,7 @@
<!-- <el-form-item label="上级部门" prop="parentId">-->
<!-- <treeselect v-model="cascader" :options="Thetree" :normalizer="normalizer" @change="handleChanges" placeholder="啊" />-->
<!-- </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-form-item>
<el-form-item label="负责人名称" prop="leaderName">
@ -449,6 +449,102 @@
</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-card>
@ -512,7 +608,7 @@
</el-row>
<el-row>
<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-option
v-for="item in rolelist"
@ -521,6 +617,7 @@
:value="item.dutyId"
></el-option>
</el-select>
<div v-if="!rolelist || rolelist.length==0" style="color: red;font-size: 12px">请先为当前机构添加角色信息</div>
</el-form-item>
</el-col>
@ -533,6 +630,57 @@
</div>
</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-upload
@ -590,6 +738,9 @@ import {
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import BigNumber from 'bignumber.js';
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,
//
showSearch: true,
openDuty:false,
form1: { id: '', status: 'A', roleType: '4', description: '' },
//
roleList: [],
menuExpand: false,
menuNodeAll: false,
//
menuOptions: [],
defaultProps1: {
children: "childrens",
label: "label"
},
//
total: 0,
//
@ -663,7 +826,14 @@ export default {
Thetree:[],
//
deptOptions: undefined,
queryParams1:{
page:1,
pageSize:10,
// id使
storeId:"",
},
total1:0,
dutyList:[],
//
open: false,
@ -731,6 +901,15 @@ export default {
],
rolelist:'',
//
//
rules1: {
roleName: [
{ required: true, message: "角色名称不能为空", trigger: "blur" }
],
roleType: [
{ required: true, message: "角色类型不能为空", trigger: "blur" }
]
},
rules: {
leaderName: [
{ required: true, message: '姓名不能为空', trigger: 'blur' },
@ -746,7 +925,11 @@ export default {
],
deptName: [
{ required: true, message: '请输入节点名称', trigger: 'blur' },
{ required: true, message: '请输入机构名称', trigger: 'blur' },
],
roleIds: [
{ required: true, message: '请选择角色信息', trigger: 'blur' },
],
region: [
@ -826,6 +1009,165 @@ export default {
},
components: { Treeselect },
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) {
//
@ -930,12 +1272,14 @@ export default {
//
this.queryParams.deptId = data.id
this.queryParams1.storeId = data.id
this.deptType = data.deptType
//
this.appedit(data.id,data.label)
//
// this.getList();
this.onlyGetUser()
this.getDutyList()
},
//
@ -1036,7 +1380,13 @@ export default {
// // this.$refs[formName].resetFields();
// },
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) {
this.queryParams.deptId = this.Thetree[0].id
this.form.deptType = this.Thetree[0].deptType
this.queryParams1.storeId = this.Thetree[0].id
console.log("this.Thetree",this.Thetree[0])
}
@ -1408,6 +1759,12 @@ export default {
this.rolelist = res.data
})
},
//
getRoleList1(storeId) {
dutyLists({storeId:storeId}).then(res => {
this.rolelist = res.data
})
},
/** 新增按钮操作 */
handleAdd() {
@ -1420,7 +1777,8 @@ export default {
}else {
permissionType = 'system'
}
this.getRoleList(permissionType);
// this.getRoleList(permissionType);
this.getRoleList1(this.queryParams1.storeId);
},
@ -1452,7 +1810,8 @@ export default {
}else {
permissionType = 'system'
}
this.getRoleList(permissionType);
// this.getRoleList(permissionType);
this.getRoleList1(row.deptId);
},

View File

@ -59,11 +59,9 @@
<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="姓名" align="center" prop="realName" />
<el-table-column label="员工角色" align="center" prop="roleId" >
<el-table-column label="员工角色" align="center" prop="dutyName" >
<template slot-scope="scope">
<span v-if="scope.row.roleId=='12'">油站站长</span>
<span v-if="scope.row.roleId=='15'">加油员</span>
<span v-if="scope.row.roleId=='16'">收银员</span>
<span>{{scope.row.dutyName || "--"}}</span>
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="mobile" />
@ -143,9 +141,12 @@
<el-col :span="8">
<el-form-item label="角色组" prop="roleId">
<el-select v-model="form.roleId" placeholder="请选择角色" style="width: 270px">
<el-option label="油站站长" :value="12+''" ></el-option>
<el-option label="加油员" :value="15+''" ></el-option>
<el-option label="收银员" :value="16+''" ></el-option>
<el-option
v-for="item in roleList"
:key="item.dutyId+''"
:label="item.dutyName"
:value="item.dutyId+''"
></el-option>
</el-select>
</el-form-item>
</el-col>
@ -240,6 +241,7 @@
<script>
import {getName} from "../../../utils/fuint";
import {addStaff, delStaff, getStaff, listStaff, updateStaff} from "../../../api/staff/staff";
import {dutyList} from "@/api/duty/duty";
// import {getDuty, listDuty} from "@/api/staff/duty";
export default {
@ -295,6 +297,8 @@
dateRange: [],
//
defaultSort: {prop: 'createTime', order: 'descending'},
//
roleList:[],
//
form: {
id:'', category:'', userId:'', mobile:'', realName:'', wechat:'', merchantId:'', storeId:this.id, auditedStatus:'',
@ -465,6 +469,18 @@
this.reset();
this.open = true;
this.title = "新增员工";
this.getRoleList1()
},
//
getRoleList1() {
let data = {
page:1,
pageSize:10000,
dutyType:3
}
dutyList(data).then(res => {
this.roleList = res.data.records
})
},
//
reset() {
@ -521,6 +537,7 @@
this.specialPrem = this.form.specialPrem.split(",");
this.posPrem = JSON.parse(this.form.posPrem);
this.appletPrem = JSON.parse(this.form.appletPrem);
this.getRoleList1()
});
},
//

View File

@ -98,6 +98,13 @@
<el-radio :label="0">按钮</el-radio>
</el-radio-group>
</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 :span="24">
<el-form-item label="菜单图标" prop="icon">

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询码牌配置列表
export function listTag(query) {
return request({
url: '/system/tag/list',
method: 'get',
params: query
})
}
// 查询码牌配置详细
export function getTag(id) {
return request({
url: '/system/tag/' + id,
method: 'get'
})
}
// 新增码牌配置
export function addTag(data) {
return request({
url: '/system/tag',
method: 'post',
data: data
})
}
// 修改码牌配置
export function updateTag(data) {
return request({
url: '/system/tag',
method: 'put',
data: data
})
}
// 删除码牌配置
export function delTag(id) {
return request({
url: '/system/tag/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,297 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="厂家名字" prop="companyName">
<el-input
v-model="queryParams.companyName"
placeholder="请输入厂家名字"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="二维码id" prop="tagCodeId">
<el-input
v-model="queryParams.tagCodeId"
placeholder="请输入二维码id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="二维码SN号" prop="tagCodeSn">
<el-input
v-model="queryParams.tagCodeSn"
placeholder="请输入二维码SN号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="码牌SN号" prop="snCode">
<el-input
v-model="queryParams.snCode"
placeholder="请输入码牌SN号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</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="handleAdd"
v-hasPermi="['system:tag:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:tag:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:tag:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:tag:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tagList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键id" align="center" prop="id" />
<el-table-column label="厂家名字" align="center" prop="companyName" />
<el-table-column label="二维码id" align="center" prop="tagCodeId" />
<el-table-column label="二维码SN号" align="center" prop="tagCodeSn" />
<el-table-column label="码牌SN号" align="center" prop="snCode" />
<el-table-column label="是否已绑定油站 0未绑定 1已绑定" align="center" prop="status" />
<el-table-column label="是否已绑定员工 0未绑定 1已绑定" align="center" prop="mtStatus" />
<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="handleUpdate(scope.row)"
v-hasPermi="['system:tag:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:tag:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改码牌配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="厂家名字" prop="companyName">
<el-input v-model="form.companyName" placeholder="请输入厂家名字" />
</el-form-item>
<el-form-item label="二维码id" prop="tagCodeId">
<el-input v-model="form.tagCodeId" placeholder="请输入二维码id" />
</el-form-item>
<el-form-item label="二维码SN号" prop="tagCodeSn">
<el-input v-model="form.tagCodeSn" placeholder="请输入二维码SN号" />
</el-form-item>
<el-form-item label="码牌SN号" prop="snCode">
<el-input v-model="form.snCode" placeholder="请输入码牌SN号" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listTag, getTag, delTag, addTag, updateTag } from "@/api/system/tag";
export default {
name: "Tag",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
tagList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
companyName: null,
tagCodeId: null,
tagCodeSn: null,
snCode: null,
status: null,
mtStatus: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询码牌配置列表 */
getList() {
this.loading = true;
listTag(this.queryParams).then(response => {
this.tagList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
companyName: null,
tagCodeId: null,
tagCodeSn: null,
snCode: null,
status: null,
mtStatus: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加码牌配置";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getTag(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改码牌配置";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateTag(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addTag(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除码牌配置编号为"' + ids + '"的数据项?').then(function() {
return delTag(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/tag/export', {
...this.queryParams
}, `tag_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询码牌二维码列表
export function listCode(query) {
return request({
url: '/system/code/list',
method: 'get',
params: query
})
}
// 查询码牌二维码详细
export function getCode(id) {
return request({
url: '/system/code/' + id,
method: 'get'
})
}
// 新增码牌二维码
export function addCode(data) {
return request({
url: '/system/code',
method: 'post',
data: data
})
}
// 修改码牌二维码
export function updateCode(data) {
return request({
url: '/system/code',
method: 'put',
data: data
})
}
// 删除码牌二维码
export function delCode(id) {
return request({
url: '/system/code/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,277 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="码牌二维码:域名+字符串" prop="collection">
<el-input
v-model="queryParams.collection"
placeholder="请输入码牌二维码:域名+字符串"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="二维码SN号" prop="tagCodeSn">
<el-input
v-model="queryParams.tagCodeSn"
placeholder="请输入二维码SN号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="图片地址" prop="imageUrl">
<el-input
v-model="queryParams.imageUrl"
placeholder="请输入图片地址"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</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="handleAdd"
v-hasPermi="['system:code:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:code:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:code:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:code:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="codeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键id" align="center" prop="id" />
<el-table-column label="码牌二维码:域名+字符串" align="center" prop="collection" />
<el-table-column label="二维码SN号" align="center" prop="tagCodeSn" />
<el-table-column label="图片地址" align="center" prop="imageUrl" />
<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="handleUpdate(scope.row)"
v-hasPermi="['system:code:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:code:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改码牌二维码对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="码牌二维码:域名+字符串" prop="collection">
<el-input v-model="form.collection" placeholder="请输入码牌二维码:域名+字符串" />
</el-form-item>
<el-form-item label="二维码SN号" prop="tagCodeSn">
<el-input v-model="form.tagCodeSn" placeholder="请输入二维码SN号" />
</el-form-item>
<el-form-item label="图片地址" prop="imageUrl">
<el-input v-model="form.imageUrl" placeholder="请输入图片地址" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listCode, getCode, delCode, addCode, updateCode } from "@/api/system/code";
export default {
name: "Code",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
codeList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
collection: null,
tagCodeSn: null,
imageUrl: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询码牌二维码列表 */
getList() {
this.loading = true;
listCode(this.queryParams).then(response => {
this.codeList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
collection: null,
tagCodeSn: null,
imageUrl: null,
createTime: null,
updateTime: null,
createBy: null,
updateBy: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加码牌二维码";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getCode(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改码牌二维码";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateCode(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCode(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除码牌二维码编号为"' + ids + '"的数据项?').then(function() {
return delCode(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/code/export', {
...this.queryParams
}, `code_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询码牌绑定记录列表
export function listRecord(query) {
return request({
url: '/system/record/list',
method: 'get',
params: query
})
}
// 查询码牌绑定记录详细
export function getRecord(id) {
return request({
url: '/system/record/' + id,
method: 'get'
})
}
// 新增码牌绑定记录
export function addRecord(data) {
return request({
url: '/system/record',
method: 'post',
data: data
})
}
// 修改码牌绑定记录
export function updateRecord(data) {
return request({
url: '/system/record',
method: 'put',
data: data
})
}
// 删除码牌绑定记录
export function delRecord(id) {
return request({
url: '/system/record/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,319 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="所属连锁店id" prop="chainStorId">
<el-input
v-model="queryParams.chainStorId"
placeholder="请输入所属连锁店id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="店铺id" prop="storeId">
<el-input
v-model="queryParams.storeId"
placeholder="请输入店铺id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="油站名称" prop="storeName">
<el-input
v-model="queryParams.storeName"
placeholder="请输入油站名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="码牌id" prop="oilTagId">
<el-input
v-model="queryParams.oilTagId"
placeholder="请输入码牌id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="员工id" prop="staffId">
<el-input
v-model="queryParams.staffId"
placeholder="请输入员工id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="员工名字" prop="staffName">
<el-input
v-model="queryParams.staffName"
placeholder="请输入员工名字"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</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="handleAdd"
v-hasPermi="['system:record:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:record:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:record:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:record:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键id" align="center" prop="id" />
<el-table-column label="所属连锁店id" align="center" prop="chainStorId" />
<el-table-column label="店铺id" align="center" prop="storeId" />
<el-table-column label="油站名称" align="center" prop="storeName" />
<el-table-column label="码牌id" align="center" prop="oilTagId" />
<el-table-column label="员工id" align="center" prop="staffId" />
<el-table-column label="员工名字" align="center" prop="staffName" />
<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="handleUpdate(scope.row)"
v-hasPermi="['system:record:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:record:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改码牌绑定记录对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="所属连锁店id" prop="chainStorId">
<el-input v-model="form.chainStorId" placeholder="请输入所属连锁店id" />
</el-form-item>
<el-form-item label="店铺id" prop="storeId">
<el-input v-model="form.storeId" placeholder="请输入店铺id" />
</el-form-item>
<el-form-item label="油站名称" prop="storeName">
<el-input v-model="form.storeName" placeholder="请输入油站名称" />
</el-form-item>
<el-form-item label="码牌id" prop="oilTagId">
<el-input v-model="form.oilTagId" placeholder="请输入码牌id" />
</el-form-item>
<el-form-item label="员工id" prop="staffId">
<el-input v-model="form.staffId" placeholder="请输入员工id" />
</el-form-item>
<el-form-item label="员工名字" prop="staffName">
<el-input v-model="form.staffName" placeholder="请输入员工名字" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listRecord, getRecord, delRecord, addRecord, updateRecord } from "@/api/system/record";
export default {
name: "Record",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
recordList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
chainStorId: null,
storeId: null,
storeName: null,
oilTagId: null,
staffId: null,
staffName: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询码牌绑定记录列表 */
getList() {
this.loading = true;
listRecord(this.queryParams).then(response => {
this.recordList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
chainStorId: null,
storeId: null,
storeName: null,
oilTagId: null,
staffId: null,
staffName: null,
createTime: null,
updateTime: null,
createBy: null,
updateBy: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加码牌绑定记录";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getRecord(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改码牌绑定记录";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateRecord(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addRecord(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除码牌绑定记录编号为"' + ids + '"的数据项?').then(function() {
return delRecord(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/record/export', {
...this.queryParams
}, `record_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -38,15 +38,17 @@ public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper,
@Override
public MerchantConfig selectMeChByIdIsUse(int storeId) {
List<MerchantConfig> list = this.selectMeChByIsOpen(storeId);
if (list.size()>0){
oilConfigService.oilRule(storeId);
}
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("is_use","1");
queryWrapper.eq("store_id",storeId);
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

View File

@ -41,7 +41,7 @@ public class StaffCommissionServiceImpl extends ServiceImpl<StaffCommissionMappe
commission.setStoreId(storeId);
IPage<StaffCommissionVo> staffCommissionIPage = baseMapper.selectCommissionList(page, commission);
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 str = "";
for (String staffRole : staffRoleGroup) {

View File

@ -1,14 +1,12 @@
package com.fuint.business.member.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.member.service.ILJDutyService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import com.fuint.system.role.entity.TDuty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -31,6 +29,15 @@ public class LjDutyController extends BaseController {
return getSuccessResult(list);
}
/**
* 查询角色信息
* @return
*/
@GetMapping("/dutys")
public ResponseObject dutys(TDuty duty){
return getSuccessResult(dutyService.selectDutys(duty));
}
/**
* 根据id查询角色信息
* @param id
@ -41,4 +48,22 @@ public class LjDutyController extends BaseController {
TDuty duty = dutyService.selectDutyById(id);
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));
}
}

View File

@ -123,4 +123,9 @@ public class LJStaff extends BaseEntity implements Serializable {
private String staffCode;
private String ifDelete;
/**
* 角色名称
*/
@TableField(exist = false)
private String dutyName;
}

View File

@ -1,7 +1,16 @@
package com.fuint.business.member.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.system.role.entity.TDuty;
import org.apache.ibatis.annotations.Param;
public interface LJDutyMapper extends BaseMapper<TDuty> {
/**
* 分页查询角色信息
* @param page
* @param duty
* @return
*/
Page<TDuty> selectDutyPage(Page page, @Param("duty") TDuty duty);
}

View File

@ -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>

View File

@ -6,20 +6,21 @@
</sql>
<!--根据条件分页查询用户信息-->
<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>
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 != ''">
and real_name like concat('%', #{staff.realName}, '%')
and ms.real_name like concat('%', #{staff.realName}, '%')
</if>
<if test="staff.mobile != null and staff.mobile != ''">
and mobile like concat('%', #{staff.mobile}, '%')
and ms.mobile like concat('%', #{staff.mobile}, '%')
</if>
<if test="staff.status != null and staff.status != ''">
and status = #{staff.status}
and ms.status = #{staff.status}
</if>
<if test="staff.id != null and staff.id != ''">
and id = #{staff.id}
and ms.id = #{staff.id}
</if>
</where>
</select>

View File

@ -1,5 +1,6 @@
package com.fuint.business.member.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.system.role.entity.TDuty;
@ -15,10 +16,32 @@ public interface ILJDutyService extends IService<TDuty> {
*/
public List<TDuty> selectDutyList();
/**
* 根据机构信息查询角色信息
* @return
*/
public List<TDuty> selectDutys(TDuty duty);
/**
* 根据id查询角色信息
* @param id
* @return
*/
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);
}

View File

@ -1,16 +1,26 @@
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.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.member.mapper.LJDutyMapper;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class LJDutyServiceImpl extends ServiceImpl<LJDutyMapper, TDuty> implements ILJDutyService {
@Autowired
private ISysDeptService sysDeptService;
/**
* 查询角色信息
* @return
@ -22,6 +32,25 @@ public class LJDutyServiceImpl extends ServiceImpl<LJDutyMapper, TDuty> implemen
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查询角色信息
* @param id
@ -31,4 +60,27 @@ public class LJDutyServiceImpl extends ServiceImpl<LJDutyMapper, TDuty> implemen
public TDuty selectDutyById(int 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);
}
}

View File

@ -253,7 +253,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
LambdaQueryWrapper<MtStore> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(MtStore::getContractDeptId,deptId);
mtStore = mtStoreMapper.selectOne(lambdaQueryWrapper);
if (ObjectUtil.isNotEmpty(mtStore)) merchantId = String.valueOf(mtStore.getChainStoreId());
}
if ("2".equals(deptType)) {
// 查出storeId
@ -287,7 +287,6 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
tAccount.setLocked(0);
if (ObjectUtil.isEmpty(mtStore)) mtStore.setId(0);
tAccount.setStoreId(mtStore.getId());
merchantId = ObjectUtil.isNotEmpty(mtStore) ? String.valueOf(mtStore.getChainStoreId()) : merchantId;
tAccount.setMerchantId(Integer.parseInt(merchantId));
tAccount.setStaffId(Integer.parseInt(staffId));
tAccount.setDeptId(Long.parseLong(deptId));
@ -364,6 +363,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
TAccount tAccount = getAccountInfoById(id.intValue());
tAccount.setAcctId(id.intValue());
tAccount.setRealName(realName);
tAccount.setRoleIds(roleId);
if (StringUtil.isNotEmpty(accountName)) {
tAccount.setAccountName(accountName);
@ -432,38 +432,40 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
if(ObjectUtil.isNotEmpty(staffId)) {
LJStaff ljStaff = ljStaffMapper.selectById(staffId);
// 修改对应的员工账号
ljStaff.setRealName(realName);
ljStaff.setStoreId(Integer.parseInt(storeId));
if (ObjectUtil.isNotEmpty(ljStaff)){
// 修改对应的员工账号
ljStaff.setRealName(realName);
ljStaff.setStoreId(Integer.parseInt(storeId));
ljStaff.setRoleId(roleId);
ljStaff.setRoleId(roleId);
boolean flag = false;
if (ObjectUtil.isNotEmpty(param.get("mobile"))) {
if (param.get("mobile").toString().equals(ljStaff.getMobile())) {
flag = true;
} else {
ljStaff.setMobile(param.get("mobile").toString());
boolean flag = false;
if (ObjectUtil.isNotEmpty(param.get("mobile"))) {
if (param.get("mobile").toString().equals(ljStaff.getMobile())) {
flag = true;
} else {
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) {

View File

@ -57,8 +57,9 @@ public class SourceServiceImpl extends ServiceImpl<TSourceMapper, TSource> imple
@Override
public List<TreeNode> getSourceTree(Integer merchantId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<TSource> tSources = getAvailableSources(merchantId);
if (nowAccountInfo.getRoleIds().equals("14")) tSources = getAvailableSources1(1);
// List<TSource> tSources = getAvailableSources(merchantId);
// if (nowAccountInfo.getRoleIds().equals("14")) tSources = getAvailableSources1(1);
List<TSource> tSources = getAvailableSources1(merchantId);
List<TreeNode> trees = new ArrayList<>();
if (tSources != null && tSources.size() > 0) {
TreeNode sourceTreeNode = null;
@ -109,7 +110,7 @@ public class SourceServiceImpl extends ServiceImpl<TSourceMapper, TSource> imple
@Override
public List<TSource> getMenuListByUserId(Integer merchantId, Integer accountId) {
if (merchantId == null) {
merchantId = 1;
merchantId = 0;
}
List<TSource> sourceList = tSourceMapper.findSourcesByAccountId(merchantId, accountId);
return delRepeated(sourceList);

View File

@ -1,10 +1,13 @@
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.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.api.R;
import com.fuint.business.member.entity.LJStaff;
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.service.LJUserService;
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.module.backendApi.response.LoginResponse;
import com.fuint.repository.model.TAccount;
import com.fuint.repository.model.TDutySource;
import com.fuint.system.role.entity.TDuty;
import com.fuint.repository.model.TSource;
import com.fuint.system.role.service.DutyService;
@ -77,6 +81,8 @@ public class BackendLoginController extends BaseController {
private CaptchaService captchaService;
@Autowired
private LJUserService userService;
@Autowired
private ILJStoreService storeService;
@Autowired
public RedisTemplate redisTemplate;
@ -273,8 +279,23 @@ public class BackendLoginController extends BaseController {
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<>();
TreeNode treeNode;
for (TSource tSource : sources) {

View File

@ -1,5 +1,6 @@
package com.fuint.module.backendApi.controller;
import cn.hutool.core.util.ObjectUtil;
import com.fuint.common.domain.TreeNode;
import com.fuint.common.domain.TreeSelect;
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.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import com.fuint.repository.model.TAccount;
import com.fuint.repository.model.TSource;
import com.fuint.utils.StringUtil;
import io.swagger.annotations.Api;
@ -251,14 +253,13 @@ public class BackendSourceController extends BaseController {
* */
@ApiOperation(value = "获取菜单下拉树列表")
@RequestMapping(value = "/treeselect", method = RequestMethod.GET)
public ResponseObject treeselect(HttpServletRequest request) {
public ResponseObject treeselect(HttpServletRequest request, TAccount account) {
String token = request.getHeader("Access-Token");
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
if (accountInfo == null) {
return getFailureResult(1001, "请先登录");
}
List<TreeNode> sources = sSourceService.getSourceTree(accountInfo.getMerchantId());
List<TreeNode> sources = sSourceService.getSourceTree(ObjectUtil.isNotEmpty(account.getMerchantId()) ? account.getMerchantId() : null);
List<TreeSelect> data = sourceService.buildMenuTreeSelect(sources);
return getSuccessResult(data);

View File

@ -48,6 +48,13 @@ public interface ISysDeptService extends IService<SysDept>
*/
public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts);
/**
* 查询除蓝鲸总部的父级信息
* @param deptId
* @return
*/
SysDept selectParentId(Long deptId);
/**
* 根据部门ID查询信息

View File

@ -135,7 +135,19 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
List<SysDept> deptTrees = buildDeptTree(depts);
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查询信息

View File

@ -1,10 +1,13 @@
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.dto.AccountDto;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.dto.RoleDto;
import com.fuint.common.enums.AdminRoleEnum;
import com.fuint.repository.model.TAccount;
import com.fuint.system.role.service.DutyService;
import com.fuint.common.service.SourceService;
import com.fuint.common.util.TokenUtil;
@ -49,6 +52,9 @@ public class BackendDutyController extends BaseController {
@Autowired
private SourceService tSourceService;
@Autowired
private AccountService accountService;
/**
* 角色列表
*
@ -137,8 +143,15 @@ public class BackendDutyController extends BaseController {
String type = param.get("roleType").toString();
String status = param.get("status").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);
if (ObjectUtil.isNotEmpty(accountInfo) && param.get("storeId").equals("-1")){
storeId = Math.toIntExact(accountInfo.getDeptId());
}
if (accountInfo == null) {
return getFailureResult(1001, "请先登录");
}
@ -160,6 +173,7 @@ public class BackendDutyController extends BaseController {
tDuty.setDutyType(type);
tDuty.setStatus(status);
tDuty.setDescription(description);
tDuty.setStoreId(storeId);
// 添加角色信息
try {
@ -199,6 +213,7 @@ public class BackendDutyController extends BaseController {
roleInfo.setDescription(htDuty.getDescription());
result.put("roleInfo", roleInfo);
List<Long> checkedKeys = tDutyService.getSourceIdsByDutyId(roleId.intValue());
if (checkedKeys != null && checkedKeys.size() > 0) {
result.put("checkedKeys", checkedKeys);
@ -219,7 +234,7 @@ public class BackendDutyController extends BaseController {
public ResponseObject updateHandler(HttpServletRequest request, @RequestBody Map<String, Object> param) {
String token = request.getHeader("Access-Token");
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 type = param.get("roleType").toString();
String status = param.get("status").toString();
@ -235,7 +250,8 @@ public class BackendDutyController extends BaseController {
}
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, "抱歉,您没有修改权限");
}

View File

@ -1,6 +1,7 @@
package com.fuint.system.role.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
@ -48,6 +49,10 @@ public class TDuty extends BaseEntity implements Serializable {
@ApiModelProperty("角色编码")
private String code;
private String permissionType;
/**
* 机构名称
*/
@TableField(exist = false)
private String deptName;
}

View File

@ -14,7 +14,7 @@
select * from t_duty u
where u.DUTY_NAME = #{name}
<if test="merchantId != null and merchantId > 0">
and u.MERCHANT_ID = #{merchantId}
and u.store_id = #{merchantId}
</if>
</select>

View File

@ -97,8 +97,8 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
throw new BusinessRuntimeException("抱歉,您没有删除的权限");
}
try {
tDutySourceMapper.deleteSourcesByDutyId((int) dutyId);
tDutyMapper.deleteById(dutyId);
tDutySourceMapper.deleteSourcesByDutyId((int) dutyId);
tDutyMapper.deleteById(dutyId);
} catch (Exception e) {
throw new BusinessRuntimeException("该角色已存在关联用户,无法删除");
}
@ -154,20 +154,16 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
existsDuty.setDutyName(tduty.getDutyName());
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) {
tDutySourceMapper.deleteSourcesByDutyId(tduty.getDutyId());
for (TSource tSource : sources) {
TDutySource dutySource = new TDutySource();
dutySource.setDutyId(tduty.getDutyId());
dutySource.setSourceId(tSource.getSourceId());
dutySource.setChainStoreId(chainStoreId);
tDutySourceMapper.insert(dutySource);
}
}else {
tDutySourceMapper.deleteSourcesByDutyId(tduty.getDutyId());
}
tDutyMapper.updateById(existsDuty);
@ -210,16 +206,16 @@ public class DutyServiceImpl extends ServiceImpl<TDutyMapper, TDuty> implements
throw new BusinessCheckException("角色名称已经存在.");
}
this.tDutyMapper.insert(duty);
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
TAccount byId = accountService.getById(nowAccountInfo.getId());
Integer chainStoreId = null;
if (ObjectUtil.isNotEmpty(byId)) chainStoreId = byId.getMerchantId();
// 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) {
for (TSource tSource : sources) {
TDutySource dutySource = new TDutySource();
dutySource.setDutyId(duty.getDutyId());
dutySource.setSourceId(tSource.getSourceId());
dutySource.setChainStoreId(chainStoreId);
// dutySource.setChainStoreId(chainStoreId);
tDutySourceMapper.insert(dutySource);
}
}

View File

@ -35,10 +35,6 @@ public class TDutySource implements Serializable {
* 菜单id
*/
private Integer sourceId;
/**
* 连锁店id
*/
private Integer chainStoreId;
}