This commit is contained in:
cun-nan 2024-07-11 10:16:14 +08:00
parent 36cb0cbc6c
commit aeda1c14ef
22 changed files with 522 additions and 156 deletions

View File

@ -11,6 +11,6 @@ VUE_APP_BASE_API = '/stage-api'
VUE_APP_PUBLIC_PATH = '/' VUE_APP_PUBLIC_PATH = '/'
# 后端接口地址 # 后端接口地址
VUE_APP_SERVER_URL = 'https://www.tuofeng.cc/oilAdmin/' VUE_APP_SERVER_URL = 'https://oilapi.youkerr.com/oilAdmin/'
# cp端地址 # cp端地址
VUE_PC_SERVER_URL = 'https://www.tuofeng.cc/oilAdmin/' VUE_PC_SERVER_URL = 'https://oilapi.youkerr.com/oilAdmin/'

View File

@ -1,34 +1,33 @@
<script> <script>
import {treeselect as menuTreeselect} from "@/api/system/menu"; import {treeselect as menuTreeselect} from "@/api/system/menu";
import {selectChildByDeptId} from "@/api/system/Site/site"; import {selectChildByDeptId} from "@/api/system/Site/site";
import {addRole, getRole, updateRole} from "@/api/system/role";
export default { export default {
data() { data() {
return { return {
merchantId:"2", merchantId: "2",
ruleForm: { ruleForm: {
name: '', roleName: '',
storeId: '', storeId: '',
date1: '',
date2: '',
status: 'A', status: 'A',
type: [],
resource: '', resource: '',
description: '' description: '',
dutyId: "",
checkedKeys: []
}, },
rules: { rules: {
name: [ roleName: [
{ required: true, message: '请输入角色名称', trigger: 'blur' }, {required: true, message: '请输入角色名称', trigger: 'blur'},
{ min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
], ],
storeId: [ storeId: [
{ required: true, message: '请选择机构信息', trigger: 'change' } {required: true, message: '请选择机构信息', trigger: 'change'}
], ],
}, },
tableData: [{ tableData: [{
id: 1, id: 1,
label: '系统首页', label: '系统首页',
list:[{show:true,name:'选中'},] list: [{show: true, name: '选中'},]
}, { }, {
id: 2, id: 2,
label: '机构管理', label: '机构管理',
@ -38,59 +37,72 @@ export default {
label: '组织架构', label: '组织架构',
name: '王小虎', name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄', address: '上海市普陀区金沙江路 1519 弄',
childrens: [{ childrens: [{
id: 31, id: 31,
label: '用户信息', label: '用户信息',
list:[{show:true,name:'新增'},{show:true,name:'修改'},{show:true,name:'重置密码'},]
list: [{show: true, name: '新增'}, {show: true, name: '修改'}, {show: true, name: '重置密码'},]
}, { }, {
id: 32, id: 32,
label: '机构信息', label: '机构信息',
list:[{show:true,name:'保存'},]
list: [{show: true, name: '保存'},]
}] }]
}, },
] ]
// list:[{show:true,name:''},{show:true,name:''},{show:true,name:''},]
}, {
}, {
id: 4, id: 4,
label: '财务报表', label: '财务报表',
childrens:[{ childrens: [{
id: 33, id: 33,
label: '交易对账', label: '交易对账',
list:[{show:true,name:'导出订单'}] list: [{show: true, name: '导出订单'}]
}, { }, {
id: 34, id: 34,
label: '流水分析', label: '流水分析',
list:[{show:true,name:'导出订单'},] list: [{show: true, name: '导出订单'},]
}], }],
}], }],
deptListSelect:[], deptListSelect: [],
}; };
}, },
created() { created() {
// this.merchantId = this.$route.query.merchantId // this.merchantId = this.$route.query.merchantId
// this.getMenuTreeselect() // this.getMenuTreeselect()
if (this.$route.query.dutyId) {
this.getRoleMune(this.$route.query.dutyId);
}
this.selectChildByDeptIdApi() this.selectChildByDeptIdApi()
}, },
methods: { methods: {
// //
getMenuTreeselect() { getMenuTreeselect() {
// merchantId deptType // merchantId deptType
menuTreeselect({merchantId:this.merchantId}).then(response => { menuTreeselect({merchantId: this.merchantId, roleId: this.ruleForm.dutyId}).then(response => {
this.tableData = response.data; this.tableData = response.data;
console.log(this.tableData)
}); });
}, },
submitForm(formName) { submitForm(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
alert('submit!'); if (this.ruleForm.dutyId) {
} else { updateRole(this.ruleForm).then(response => {
console.log('error submit!!'); this.$modal.msgSuccess("修改成功");
return false; this.$router.push("/Site/index")
});
} else {
addRole(this.ruleForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.$router.push("/Site/index")
});
}
} }
}); });
}, },
@ -99,131 +111,244 @@ export default {
}, },
// //
selectChildByDeptIdApi() { selectChildByDeptIdApi() {
selectChildByDeptId().then(res=>{ selectChildByDeptId().then(res => {
this.deptListSelect = res.data this.deptListSelect = res.data
this.ruleForm.storeId = res.data[0].deptId if (!this.$route.query.dutyId) {
this.merchantId = res.data[0].deptType this.ruleForm.storeId = res.data[0].deptId
this.getMenuTreeselect() this.merchantId = res.data[0].deptType
}) this.ruleForm.deptType = res.data[0].deptType
},
//
chooseRegion(deptId){
this.deptListSelect.forEach(item => {
if (item.deptId == deptId) {
this.merchantId = item.deptType
this.getMenuTreeselect() this.getMenuTreeselect()
} }
}) })
}, },
getRoleMune(roleId) {
getRole(roleId).then(response => {
this.ruleForm.roleName = response.data.roleInfo.name;
this.ruleForm.status = response.data.roleInfo.status;
this.ruleForm.dutyId = response.data.roleInfo.id;
this.ruleForm.roleType = response.data.roleInfo.type;
this.ruleForm.storeId = response.data.roleInfo.storeId;
this.ruleForm.description = response.data.roleInfo.description;
let checkedKeys = response.data.checkedKeys
this.ruleForm.checkedKeys = checkedKeys
this.ruleForm.menuIds = checkedKeys
this.merchantId = response.data.roleInfo.type
this.getMenuTreeselect()
// this.tableData = response.data.treeselect;
});
},
//
chooseRegion(deptId) {
this.deptListSelect.forEach(item => {
if (item.deptId == deptId) {
this.merchantId = item.deptType
this.ruleForm.deptType = item.deptType
this.getMenuTreeselect()
}
})
},
chooseImg(row, data) {
let ids = []
let show = false;
this.tableData.forEach(item => {
if (!row.show) show = true
// ID
if (item.id == row.id) {
item.show = show;
ids.push(item.id)
//
item.childrens.forEach(item1 => {
item1.show = show;
ids.push(item1.id)
item1.list.forEach(item2 => {
item2.show = show;
ids.push(item2.id)
});
});
item.list.forEach(item1 => {
ids.push(item1.id)
item1.show = show;
});
return; //
} else {
item.list.forEach(item1 => {
if (item1.id == row.id) {
ids.push(item1.id)
item1.show = show;
}
if (!show) {
if (item1.name == '选中' && item1.id == data.id) {
item1.show = show;
}
}
});
}
//
item.childrens.forEach(item1 => {
//
if (item1.id == row.id) {
ids.push(item1.id)
item1.show = show;
item1.list.forEach(item2 => {
ids.push(item2.id)
item2.show = show;
});
return; //
} else {
item1.list.forEach(item2 => {
if (item2.id == row.id) {
ids.push(item2.id)
item2.show = show;
}
if (!show) {
if (item2.name == '选中' && item2.id == data.id) {
item2.show = show;
}
}
});
}
});
});
let uniqueArr = ids.filter((item, index) => ids.indexOf(item) === index);
if (show) {
this.ruleForm.checkedKeys = [...uniqueArr, ...this.ruleForm.checkedKeys];
// this.ruleForm.checkedKeys = this.ruleForm.checkedKeys.filter((item, index) => this.ruleForm.checkedKeys.indexOf(item) === index);
} else {
this.ruleForm.checkedKeys = this.ruleForm.checkedKeys.filter(item => !uniqueArr.includes(item));
}
this.ruleForm.menuIds = this.ruleForm.checkedKeys;
console.log(ids, uniqueArr, this.ruleForm.checkedKeys, show);
// this.ruleForm.checkedKeys = this.ruleForm.checkedKeys.filter(item => item !== row.id);
}
} }
} }
</script> </script>
<template> <template>
<div class="container"> <div class="container">
<div class="top-box"> <div class="top-box">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm"> <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<div> <div>
<el-form-item label="角色名称" prop="name"> <el-form-item label="角色名称" prop="roleName">
<el-input v-model="ruleForm.name"></el-input> <el-input v-model="ruleForm.roleName"></el-input>
</el-form-item> </el-form-item>
</div>
<div>
<el-form-item label="所属机构" prop="storeId">
<el-select v-model="ruleForm.storeId" placeholder="请选择所属机构"
@change="chooseRegion(ruleForm.storeId)">
<el-option
v-for="item in deptListSelect"
:key="item.deptId"
:label="item.deptName"
:value="item.deptId"
></el-option>
</el-select>
</el-form-item>
</div>
<div>
<el-form-item label="角色状态" prop="status">
<el-switch v-model="ruleForm.status"
active-value="A"
inactive-value="N"></el-switch>
</el-form-item>
</div>
<div>
<el-form-item label="角色描述" prop="description">
<el-input v-model="ruleForm.description"></el-input>
</el-form-item>
</div>
</el-form>
</div>
<div class="center-box">
<el-table
:data="tableData"
style="width: 100%;margin-bottom: 20px;"
row-key="id"
border
default-expand-all
:tree-props="{children: 'childrens', hasChildren: 'hasChildren'}">
<el-table-column
prop="label"
label="菜单"
width="180">
</el-table-column>
<el-table-column
prop="address"
label="功能">
<template slot-scope="scope">
<div style="display: flex;align-items: center">
<div class="f-box" v-for="(item,index) in scope.row.list" :key="index" @click="chooseImg(item,scope.row)">
<img v-if="item.show == true" style="width: 15px;height: 15px;margin-right: 5px"
src="../../assets/images/xz.png">
<div v-else class="k_"></div>
{{ item.name }}
</div>
</div>
</template>
</el-table-column>
</el-table>
<div style="display: flex">
<el-button @click="resetForm('ruleForm')">取消</el-button>
<el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
</div> </div>
<div>
<el-form-item label="所属机构" prop="storeId">
<el-select v-model="ruleForm.storeId" placeholder="请选择所属机构"
@change="chooseRegion(ruleForm.storeId)">
<el-option
v-for="item in deptListSelect"
:key="item.deptId"
:label="item.deptName"
:value="item.deptId"
></el-option>
</el-select>
</el-form-item>
</div>
<div>
<el-form-item label="角色状态" prop="status">
<el-switch v-model="ruleForm.status"
active-value="A"
inactive-value="N"></el-switch>
</el-form-item>
</div>
<div>
<el-form-item label="角色描述" prop="description">
<el-input v-model="ruleForm.description"></el-input>
</el-form-item>
</div>
</el-form>
</div>
<div class="center-box">
<el-table
:data="tableData"
style="width: 100%;margin-bottom: 20px;"
row-key="id"
border
default-expand-all
:tree-props="{children: 'childrens', hasChildren: 'hasChildren'}">
<el-table-column
prop="label"
label="菜单"
width="180">
</el-table-column>
<el-table-column
prop="address"
label="功能">
<template slot-scope="scope">
<div style="display: flex;align-items: center">
<div class="f-box" v-for="(item,index) in scope.row.list" :key="index"> <img v-if="item.show == true" style="width: 15px;height: 15px;margin-right: 5px" src="../../assets/images/xz.png"> <div v-else class="k_" ></div> {{item.name}} </div>
</div>
</template>
</el-table-column>
</el-table>
<div style="display: flex">
<el-button @click="resetForm('ruleForm')">取消</el-button>
<el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
</div> </div>
</div> </div>
</div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.container{ .container {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: 20px; padding: 20px;
background: #f4f5f9; background: #f4f5f9;
} }
.top-box{
.top-box {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: 20px; padding: 20px;
display: flex; display: flex;
align-items: center; align-items: center;
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0px 3px 6px 1px rgba(255,255,255,0.4), inset 0px 3px 6px 1px rgba(255,255,255,0.5); box-shadow: 0px 3px 6px 1px rgba(255, 255, 255, 0.4), inset 0px 3px 6px 1px rgba(255, 255, 255, 0.5);
border-radius: 10px 10px 10px 10px; border-radius: 10px 10px 10px 10px;
} }
.demo-ruleForm{
.demo-ruleForm {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.center-box{
.center-box {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: 20px; padding: 20px;
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0px 3px 6px 1px rgba(255,255,255,0.4), inset 0px 3px 6px 1px rgba(255,255,255,0.5); box-shadow: 0px 3px 6px 1px rgba(255, 255, 255, 0.4), inset 0px 3px 6px 1px rgba(255, 255, 255, 0.5);
border-radius: 10px 10px 10px 10px; border-radius: 10px 10px 10px 10px;
margin-top: 20px; margin-top: 20px;
} }
.f-box{
.f-box {
display: flex; display: flex;
align-items: center; align-items: center;
margin-right: 10px; margin-right: 10px;
} }
.k_{
.k_ {
width: 15px; width: 15px;
border-radius: 4px; border-radius: 4px;
height: 15px; height: 15px;

View File

@ -675,6 +675,7 @@
type="warning" type="warning"
plain plain
size="mini" size="mini"
v-hasPermi="['role:add']"
@click="handleAdd1" @click="handleAdd1"
>新增角色 >新增角色
@ -717,6 +718,7 @@
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
v-hasPermi="['role:edit']"
@click="handleUpdate1(scope.row)" @click="handleUpdate1(scope.row)"
>修改</el-button> >修改</el-button>
<el-button <el-button
@ -1279,10 +1281,10 @@ export default {
submitForm1: function() { submitForm1: function() {
this.$refs["form1"].validate(valid => { this.$refs["form1"].validate(valid => {
if (valid) { if (valid) {
console.log(this.deptType)
this.form1.deptType = this.deptType this.form1.deptType = this.deptType
if (this.form1.dutyId) { if (this.form1.dutyId) {
this.form1.menuIds = this.getMenuAllCheckedKeys(); this.form1.menuIds = this.getMenuAllCheckedKeys();
console.log(this.form1.menuIds)
updateRole(this.form1).then(response => { updateRole(this.form1).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.openDuty = false; this.openDuty = false;
@ -1360,35 +1362,23 @@ export default {
}, },
handleUpdate1(data){ handleUpdate1(data){
this.reset1(); 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 const roleId = data.dutyId
this.form1.menuCheckStrictly = false // this.form1.menuCheckStrictly = false
getRole(roleId).then(response => { // getRole(roleId).then(response => {
this.form1.roleName = response.data.roleInfo.name; // this.form1.roleName = response.data.roleInfo.name;
this.form1.roleType = response.data.roleInfo.type; // this.form1.roleType = response.data.roleInfo.type;
this.form1.status = response.data.roleInfo.status; // this.form1.status = response.data.roleInfo.status;
this.form1.dutyId = response.data.roleInfo.id; // this.form1.dutyId = response.data.roleInfo.id;
this.form1.description = response.data.roleInfo.description; // this.form1.description = response.data.roleInfo.description;
this.openDuty = true; // this.openDuty = true;
this.title = "修改角色"; // this.title = "";
let checkedKeys = response.data.checkedKeys // let checkedKeys = response.data.checkedKeys
this.form1.checkedKeys = checkedKeys // this.form1.checkedKeys = checkedKeys
this.merchantId = response.data.roleInfo.type // this.merchantId = response.data.roleInfo.type
this.getMenuTreeselect(response.data.roleInfo.type) // this.getMenuTreeselect(response.data.roleInfo.type)
// });
// this.$nextTick(() => { this.$router.push({path:"/Site/add",query: { dutyId: roleId }})
// roleMenu.then(res => {
// checkedKeys.forEach((v) => {
// this.$nextTick(()=>{
// this.$refs.menu.setChecked(v, true ,false);
// })
// })
// });
// });
});
}, },
handleStatusChangeDuty(data){ handleStatusChangeDuty(data){
console.log(data) console.log(data)

View File

@ -254,8 +254,8 @@ export default {
code:this.loginForm.telcode code:this.loginForm.telcode
} }
this.$store.dispatch("codeLogin", data).then(() => { this.$store.dispatch("codeLogin", data).then(() => {
// this.$router.push({ path: this.redirect || "/" }).catch(()=>{}); this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
this.$router.push({ path: "/Service/index" }).catch(()=>{}); // this.$router.push({ path: "/Service/index" }).catch(()=>{});
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;

View File

@ -49,12 +49,12 @@ public class Const {
public static String NOTIFY_PUBLIC_KEYS="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCbBAl3xSB7YeUnze4yYZmnTeT7OtXZr0sP10TsDVRH2SY/VEjgS9KPmHMmVeKZT3+6xKsUvulgVyie46GGtZPrnoh+glF1gzsYAXJ7dvR/R5nYO5VvfwK/ChPFTiKhbTtO4OKtchgBZuqCbsemG+gFIiVJo37dY0Kg0zISmFHdOQIDAQAB"; public static String NOTIFY_PUBLIC_KEYS="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCbBAl3xSB7YeUnze4yYZmnTeT7OtXZr0sP10TsDVRH2SY/VEjgS9KPmHMmVeKZT3+6xKsUvulgVyie46GGtZPrnoh+glF1gzsYAXJ7dvR/R5nYO5VvfwK/ChPFTiKhbTtO4OKtchgBZuqCbsemG+gFIiVJo37dY0Kg0zISmFHdOQIDAQAB";
//小程序异步通知(回调地址) //小程序异步通知(回调地址)
public static String notify_url = "https://www.tuofeng.cc/oilAdmin/api/fyPay/notify"; public static String notify_url = "https://oilapi.youkerr.com/oilAdmin/api/fyPay/notify";
// public static String notify_url = "http://k40180f897.goho.co/api/fyPay/notify"; // public static String notify_url = "http://k40180f897.goho.co/api/fyPay/notify";
// public static String notify_url = "https://8q4f124343.yicp.fun/api/fyPay/notify"; // public static String notify_url = "https://8q4f124343.yicp.fun/api/fyPay/notify";
//主扫异步通知(回调地址) //主扫异步通知(回调地址)
public static String notify_url_scan = "https://www.tuofeng.cc/oilAdmin/api/fyPay/notifyScan"; public static String notify_url_scan = "https://oilapi.youkerr.com/oilAdmin/api/fyPay/notifyScan";
//public static String notify_url_scan = "https://8q4f124343.yicp.fun/api/fyPay/notifyScan"; //public static String notify_url_scan = "https://8q4f124343.yicp.fun/api/fyPay/notifyScan";
//主扫下单 //主扫下单

View File

@ -223,7 +223,7 @@ public class LJStaffServiceImpl extends ServiceImpl<LJStaffMapper, LJStaff> impl
LJStaff staff1 = this.selectStaffByMobile(staff.getMobile(),storeId); LJStaff staff1 = this.selectStaffByMobile(staff.getMobile(),storeId);
if (ObjectUtil.isNotEmpty(staff1)){ if (ObjectUtil.isNotEmpty(staff1)){
// 添加员工码 // 添加员工码
staff1.setStaffCode("https://www.tuofeng.cc/oilRefuel?storeId="+storeId+"&staffId="+staff1.getId()); staff1.setStaffCode("https://oilapi.youkerr.com/oilRefuel?storeId="+storeId+"&staffId="+staff1.getId());
this.updateStaff(staff1); this.updateStaff(staff1);
} }
@ -287,7 +287,7 @@ public class LJStaffServiceImpl extends ServiceImpl<LJStaffMapper, LJStaff> impl
} }
if (StringUtils.isEmpty(staff.getStaffCode())){ if (StringUtils.isEmpty(staff.getStaffCode())){
// 添加员工码 // 添加员工码
staff.setStaffCode("https://www.tuofeng.cc/oilRefuel?storeId="+staff.getStoreId()+"&staffId="+staff.getId()); staff.setStaffCode("https://oilapi.youkerr.com/oilRefuel?storeId="+staff.getStoreId()+"&staffId="+staff.getId());
} }
row = baseMapper.updateById(staff); row = baseMapper.updateById(staff);
if (StringUtils.isNotEmpty(staff.getPassword())){ if (StringUtils.isNotEmpty(staff.getPassword())){

View File

@ -189,9 +189,9 @@ public class QRCodeServiceImpl extends ServiceImpl<QRCodeMapper, QRCode> impleme
qrCode.setChainStoreId(store.getChainStoreId()); qrCode.setChainStoreId(store.getChainStoreId());
// 带有店铺id 跳转首页 // 带有店铺id 跳转首页
qrCode.setCollection("https://www.tuofeng.cc/oilStation?storeId="+store.getId()); qrCode.setCollection("https://oilapi.youkerr.com/oilStation?storeId="+store.getId());
// 带有店铺id 跳转一键加油页面 // 带有店铺id 跳转一键加油页面
qrCode.setPayment("https://www.tuofeng.cc/oilRefuel?storeId="+store.getId()); qrCode.setPayment("https://oilapi.youkerr.com/oilRefuel?storeId="+store.getId());
row = baseMapper.insert(qrCode); row = baseMapper.insert(qrCode);
IndexBanner indexBanner = new IndexBanner(); IndexBanner indexBanner = new IndexBanner();
indexBannerService.insertIndexBanner(indexBanner,storeId); indexBannerService.insertIndexBanner(indexBanner,storeId);

View File

@ -75,7 +75,7 @@ public class TagCodeServiceImpl extends ServiceImpl<TagCodeMapper, TagCode> impl
for (int i = 0; i < total; i++) { for (int i = 0; i < total; i++) {
Random random = new Random(); Random random = new Random();
int i1 = random.nextInt(90000000); int i1 = random.nextInt(90000000);
String url = "https://www.tuofeng.cc/oilRefuel?sn=byx"+i1; String url = "https://oilapi.youkerr.com/oilRefuel?sn=byx"+i1;
TagCode tagCode = new TagCode(); TagCode tagCode = new TagCode();

View File

@ -56,11 +56,29 @@ public class TreeNode {
*/ */
private String perms; private String perms;
/**
* 是否选中
*/
private Boolean show;
public Boolean getShow() {
return show;
}
public void setShow(Boolean show) {
this.show = show;
}
/** /**
* 子菜单 * 子菜单
*/ */
private List<TreeNode> childrens = new ArrayList<TreeNode>(); private List<TreeNode> childrens = new ArrayList<TreeNode>();
/**
* 子菜单
*/
private List<TreeNode> list = new ArrayList<TreeNode>();
/** /**
* 菜单级别 * 菜单级别
*/ */
@ -147,6 +165,14 @@ public class TreeNode {
this.childrens = childrens; this.childrens = childrens;
} }
public List<TreeNode> getList() {
return list;
}
public void setList(List<TreeNode> list) {
this.list = list;
}
public int getLevel() { public int getLevel() {
return level; return level;
} }

View File

@ -28,6 +28,28 @@ public class TreeSelect implements Serializable {
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> childrens; private List<TreeSelect> childrens;
// 按钮列表
private List<TreeNode> list;
// 是否选中
private Boolean show;
public Boolean getShow() {
return show;
}
public void setShow(Boolean show) {
this.show = show;
}
public List<TreeNode> getList() {
return list;
}
public void setList(List<TreeNode> list) {
this.list = list;
}
public TreeSelect() public TreeSelect()
{ {
@ -44,6 +66,8 @@ public class TreeSelect implements Serializable {
this.id = menu.getId(); this.id = menu.getId();
this.label = menu.getName(); this.label = menu.getName();
this.childrens = menu.getChildrens().stream().map(TreeSelect::new).collect(Collectors.toList()); this.childrens = menu.getChildrens().stream().map(TreeSelect::new).collect(Collectors.toList());
this.list = menu.getList();
this.show = menu.getShow();
} }
public Long getId() { public Long getId() {

View File

@ -15,6 +15,11 @@ public class RoleDto {
* */ * */
private Integer merchantId; private Integer merchantId;
/**
* 机构ID
* */
private Integer storeId;
/** /**
* 名称 * 名称
*/ */
@ -38,6 +43,13 @@ public class RoleDto {
*/ */
private String status; private String status;
public Integer getStoreId() {
return storeId;
}
public void setStoreId(Integer storeId) {
this.storeId = storeId;
}
public String getCode() { public String getCode() {
return code; return code;

View File

@ -37,6 +37,20 @@ public interface SourceService extends IService<TSource> {
*/ */
List<TreeNode> getSourceTree(Integer merchantId); List<TreeNode> getSourceTree(Integer merchantId);
/**
* 获取菜单的属性结构
*
* @return
*/
List<TreeNode> getSourceTree2(Integer merchantId,List<Long> checkedKeys);
/**
* 获取菜单的属性结构
*
* @return
*/
List<TreeNode> getSourceTree1(Integer merchantId);
/** /**
* 根据菜单ID集合查询菜单列表信息 * 根据菜单ID集合查询菜单列表信息
* *

View File

@ -332,7 +332,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
queryWrapper.eq("if_delete","0"); queryWrapper.eq("if_delete","0");
staff = ljStaffMapper.selectOne(queryWrapper); staff = ljStaffMapper.selectOne(queryWrapper);
if (ObjectUtil.isNotEmpty(staff)) { if (ObjectUtil.isNotEmpty(staff)) {
staff.setStaffCode("https://www.tuofeng.cc/oilRefuel?storeId="+storeId+"&staffId="+staff.getId()); staff.setStaffCode("https://oilapi.youkerr.com/oilRefuel?storeId="+storeId+"&staffId="+staff.getId());
ljStaffMapper.updateById(staff); ljStaffMapper.updateById(staff);
// LJStaff staff1 = ljStaffMapper.selectById(staff.getId()); // LJStaff staff1 = ljStaffMapper.selectById(staff.getId());

View File

@ -1,5 +1,6 @@
package com.fuint.common.service.impl; package com.fuint.common.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.common.domain.TreeSelect; import com.fuint.common.domain.TreeSelect;
import com.fuint.common.dto.AccountInfo; import com.fuint.common.dto.AccountInfo;
@ -24,7 +25,7 @@ import java.util.stream.Collectors;
/** /**
* 菜单管理接口实现类 * 菜单管理接口实现类
* * <p>
* Created by FSQ * Created by FSQ
* CopyRight https://www.fuint.cn * CopyRight https://www.fuint.cn
*/ */
@ -46,7 +47,16 @@ public class SourceServiceImpl extends ServiceImpl<TSourceMapper, TSource> imple
@Override @Override
public List<TSource> getAvailableSources1(Integer merchantId) { public List<TSource> getAvailableSources1(Integer merchantId) {
return tSourceMapper.findByStatus1(merchantId, StatusEnum.ENABLED.getKey()); List<TSource> byStatus1 = tSourceMapper.findByStatus1(merchantId, StatusEnum.ENABLED.getKey());
for (TSource tSource : byStatus1) {
List<TSource> byStatusButton = tSourceMapper.findByStatusButton(tSource.getSourceId(), StatusEnum.ENABLED.getKey());
TSource tSource1 = new TSource();
tSource1.setSourceName("选中");
tSource1.setSourceId(tSource.getSourceId());
byStatusButton.add(tSource1);
tSource.setList(byStatusButton);
}
return byStatus1;
} }
/** /**
@ -74,6 +84,147 @@ public class SourceServiceImpl extends ServiceImpl<TSourceMapper, TSource> imple
sourceTreeNode.setIsMenu(tSource.getIsMenu()); sourceTreeNode.setIsMenu(tSource.getIsMenu());
sourceTreeNode.setStatus(tSource.getStatus()); sourceTreeNode.setStatus(tSource.getStatus());
sourceTreeNode.setPerms(tSource.getPath().replaceAll("/", ":")); sourceTreeNode.setPerms(tSource.getPath().replaceAll("/", ":"));
List<TreeNode> treesChildrens = new ArrayList<>();
if (ObjectUtil.isNotEmpty(tSource.getList())){
TreeNode treeNode = null;
for (TSource children : tSource.getList()) {
treeNode = new TreeNode();
treeNode.setName(children.getSourceName());
if (ObjectUtil.isNotEmpty(children.getSourceId())) treeNode.setId(children.getSourceId());
if (ObjectUtil.isNotEmpty(children.getSourceLevel())) treeNode.setLevel(children.getSourceLevel());
if (ObjectUtil.isNotEmpty(children.getSourceStyle())) treeNode.setSort((children.getSourceStyle() == null || StringUtil.isEmpty(tSource.getSourceStyle())) ? 0 : Integer.parseInt(tSource.getSourceStyle()));
if (ObjectUtil.isNotEmpty(children.getPath())) treeNode.setPath(children.getPath());
if (ObjectUtil.isNotEmpty(children.getParentId())) treeNode.setpId(children.getParentId());
if (ObjectUtil.isNotEmpty(children.getNewIcon())) treeNode.setIcon(children.getNewIcon());
if (ObjectUtil.isNotEmpty(children.getIsMenu())) treeNode.setIsMenu(children.getIsMenu());
if (ObjectUtil.isNotEmpty(children.getStatus())) treeNode.setStatus(children.getStatus());
if (ObjectUtil.isNotEmpty(children.getPath())) treeNode.setPerms(children.getPath().replaceAll("/", ":"));
treesChildrens.add(treeNode);
}
}
sourceTreeNode.setList(treesChildrens);
if (tSource.getParentId() != null) {
sourceTreeNode.setpId(tSource.getParentId());
} else {
sourceTreeNode.setpId(0);
}
trees.add(sourceTreeNode);
}
}
return trees;
}
/**
* 获取菜单的属性结构
*
* @return
*/
@Override
public List<TreeNode> getSourceTree2(Integer merchantId,List<Long> checkedKeys) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// 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;
for (TSource tSource : tSources) {
sourceTreeNode = new TreeNode();
sourceTreeNode.setName(tSource.getSourceName());
sourceTreeNode.setId(tSource.getSourceId());
sourceTreeNode.setLevel(tSource.getSourceLevel());
sourceTreeNode.setSort((tSource.getSourceStyle() == null || StringUtil.isEmpty(tSource.getSourceStyle())) ? 0 : Integer.parseInt(tSource.getSourceStyle()));
sourceTreeNode.setPath(tSource.getPath());
sourceTreeNode.setIcon(tSource.getNewIcon());
sourceTreeNode.setIsMenu(tSource.getIsMenu());
sourceTreeNode.setStatus(tSource.getStatus());
sourceTreeNode.setPerms(tSource.getPath().replaceAll("/", ":"));
sourceTreeNode.setShow(false);
for (Long checkedKey : checkedKeys) {
if (checkedKey.compareTo(Long.valueOf(tSource.getSourceId()))==0){
sourceTreeNode.setShow(true);
}
}
List<TreeNode> treesChildrens = new ArrayList<>();
if (ObjectUtil.isNotEmpty(tSource.getList())){
TreeNode treeNode = null;
for (TSource children : tSource.getList()) {
treeNode = new TreeNode();
treeNode.setName(children.getSourceName());
if (ObjectUtil.isNotEmpty(children.getSourceId())) treeNode.setId(children.getSourceId());
if (ObjectUtil.isNotEmpty(children.getSourceLevel())) treeNode.setLevel(children.getSourceLevel());
if (ObjectUtil.isNotEmpty(children.getSourceStyle())) treeNode.setSort((children.getSourceStyle() == null || StringUtil.isEmpty(tSource.getSourceStyle())) ? 0 : Integer.parseInt(tSource.getSourceStyle()));
if (ObjectUtil.isNotEmpty(children.getPath())) treeNode.setPath(children.getPath());
if (ObjectUtil.isNotEmpty(children.getParentId())) treeNode.setpId(children.getParentId());
if (ObjectUtil.isNotEmpty(children.getNewIcon())) treeNode.setIcon(children.getNewIcon());
if (ObjectUtil.isNotEmpty(children.getIsMenu())) treeNode.setIsMenu(children.getIsMenu());
if (ObjectUtil.isNotEmpty(children.getStatus())) treeNode.setStatus(children.getStatus());
if (ObjectUtil.isNotEmpty(children.getPath())) treeNode.setPerms(children.getPath().replaceAll("/", ":"));
treeNode.setShow(false);
for (Long checkedKey : checkedKeys) {
if (ObjectUtil.isNotEmpty(children.getSourceId()) && checkedKey.compareTo(Long.valueOf(children.getSourceId()))==0){
treeNode.setShow(true);
}
}
treesChildrens.add(treeNode);
}
}
sourceTreeNode.setList(treesChildrens);
if (tSource.getParentId() != null) {
sourceTreeNode.setpId(tSource.getParentId());
} else {
sourceTreeNode.setpId(0);
}
trees.add(sourceTreeNode);
}
}
return trees;
}
/**
* 获取菜单的属性结构
*
* @return
*/
@Override
public List<TreeNode> getSourceTree1(Integer merchantId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// List<TSource> tSources = getAvailableSources(merchantId);
// if (nowAccountInfo.getRoleIds().equals("14")) tSources = getAvailableSources1(1);
List<TSource> tSources = getAvailableSources(merchantId);
List<TreeNode> trees = new ArrayList<>();
if (tSources != null && tSources.size() > 0) {
TreeNode sourceTreeNode = null;
for (TSource tSource : tSources) {
sourceTreeNode = new TreeNode();
sourceTreeNode.setName(tSource.getSourceName());
sourceTreeNode.setId(tSource.getSourceId());
sourceTreeNode.setLevel(tSource.getSourceLevel());
sourceTreeNode.setSort((tSource.getSourceStyle() == null || StringUtil.isEmpty(tSource.getSourceStyle())) ? 0 : Integer.parseInt(tSource.getSourceStyle()));
sourceTreeNode.setPath(tSource.getPath());
sourceTreeNode.setIcon(tSource.getNewIcon());
sourceTreeNode.setIsMenu(tSource.getIsMenu());
sourceTreeNode.setStatus(tSource.getStatus());
sourceTreeNode.setPerms(tSource.getPath().replaceAll("/", ":"));
List<TreeNode> treesChildrens = new ArrayList<>();
if (ObjectUtil.isNotEmpty(tSource.getList())){
TreeNode treeNode = null;
for (TSource children : tSource.getList()) {
treeNode = new TreeNode();
treeNode.setName(children.getSourceName());
treeNode.setId(children.getSourceId());
treeNode.setLevel(children.getSourceLevel());
treeNode.setSort((children.getSourceStyle() == null || StringUtil.isEmpty(tSource.getSourceStyle())) ? 0 : Integer.parseInt(tSource.getSourceStyle()));
treeNode.setPath(children.getPath());
treeNode.setpId(children.getParentId());
treeNode.setIcon(children.getNewIcon());
treeNode.setIsMenu(children.getIsMenu());
treeNode.setStatus(children.getStatus());
treeNode.setPerms(children.getPath().replaceAll("/", ":"));
treesChildrens.add(treeNode);
}
}
sourceTreeNode.setList(treesChildrens);
if (tSource.getParentId() != null) { if (tSource.getParentId() != null) {
sourceTreeNode.setpId(tSource.getParentId()); sourceTreeNode.setpId(tSource.getParentId());
} else { } else {
@ -95,7 +246,7 @@ public class SourceServiceImpl extends ServiceImpl<TSourceMapper, TSource> imple
public List<TSource> findDatasByIds(String[] ids) { public List<TSource> findDatasByIds(String[] ids) {
Long[] arrays = new Long[ids.length]; Long[] arrays = new Long[ids.length];
for (int i = 0; i < ids.length; i++) { for (int i = 0; i < ids.length; i++) {
arrays[i] = Long.parseLong(ids[i]); arrays[i] = Long.parseLong(ids[i]);
} }
return tSourceMapper.findByIdIn(ArrayUtil.toList(arrays)); return tSourceMapper.findByIdIn(ArrayUtil.toList(arrays));
} }
@ -103,8 +254,8 @@ public class SourceServiceImpl extends ServiceImpl<TSourceMapper, TSource> imple
/** /**
* 根据账号ID获取菜单列表 * 根据账号ID获取菜单列表
* *
* @param merchantId 商户ID * @param merchantId 商户ID
* @param accountId 账号ID * @param accountId 账号ID
* @throws BusinessCheckException * @throws BusinessCheckException
*/ */
@Override @Override
@ -179,7 +330,7 @@ public class SourceServiceImpl extends ServiceImpl<TSourceMapper, TSource> imple
for (TreeNode dept : menus) { for (TreeNode dept : menus) {
tempList.add(dept.getId()); tempList.add(dept.getId());
} }
for (Iterator<TreeNode> iterator = menus.iterator(); iterator.hasNext();) { for (Iterator<TreeNode> iterator = menus.iterator(); iterator.hasNext(); ) {
TreeNode menu = (TreeNode) iterator.next(); TreeNode menu = (TreeNode) iterator.next();
// 如果是顶级节点, 遍历该父节点的所有子节点 // 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(menu.getpId())) { if (!tempList.contains(menu.getpId())) {

View File

@ -64,7 +64,7 @@ public class BackendSourceController extends BaseController {
return getFailureResult(1001, "请先登录"); return getFailureResult(1001, "请先登录");
} }
List<TreeNode> sources = sSourceService.getSourceTree(accountInfo.getMerchantId()); List<TreeNode> sources = sSourceService.getSourceTree1(accountInfo.getMerchantId());
return getSuccessResult(sources); return getSuccessResult(sources);
} }
@ -273,7 +273,12 @@ public class BackendSourceController extends BaseController {
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(ObjectUtil.isNotEmpty(account.getMerchantId()) ? account.getMerchantId() : null);
if (ObjectUtil.isNotEmpty(account.getRoleId())){
List<Long> checkedKeys = tDutyService.getSourceIdsByDutyId(account.getRoleId());
sources = sSourceService.getSourceTree2(ObjectUtil.isNotEmpty(account.getMerchantId()) ? account.getMerchantId() : null,checkedKeys);
}
List<TreeSelect> data = sourceService.buildMenuTreeSelect(sources); List<TreeSelect> data = sourceService.buildMenuTreeSelect(sources);
return getSuccessResult(data); return getSuccessResult(data);

View File

@ -210,6 +210,7 @@ public class BackendDutyController extends BaseController {
roleInfo.setName(htDuty.getDutyName()); roleInfo.setName(htDuty.getDutyName());
roleInfo.setType(htDuty.getDutyType()); roleInfo.setType(htDuty.getDutyType());
roleInfo.setStatus(htDuty.getStatus()); roleInfo.setStatus(htDuty.getStatus());
roleInfo.setStoreId(htDuty.getStoreId());
roleInfo.setDescription(htDuty.getDescription()); roleInfo.setDescription(htDuty.getDescription());
result.put("roleInfo", roleInfo); result.put("roleInfo", roleInfo);

View File

@ -21,4 +21,6 @@ public interface TSourceMapper extends BaseMapper<TSource> {
List<TSource> findByStatus1(@Param("merchantId") Integer merchantId, @Param("status") String status); List<TSource> findByStatus1(@Param("merchantId") Integer merchantId, @Param("status") String status);
List<TSource> findByStatusButton(@Param("parentId") Integer parentId, @Param("status") String status);
} }

View File

@ -79,4 +79,7 @@ public class TAccount extends BaseEntity implements Serializable {
private String deptType; private String deptType;
// @TableField(exist = false) // @TableField(exist = false)
private String mobile; private String mobile;
@TableField(exist = false)
private Integer roleId;
} }

View File

@ -1,9 +1,12 @@
package com.fuint.repository.model; package com.fuint.repository.model;
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;
import java.util.List;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Getter; import lombok.Getter;
@ -70,5 +73,7 @@ public class TSource implements Serializable {
@ApiModelProperty("菜单图标") @ApiModelProperty("菜单图标")
private String icon; private String icon;
@TableField(exist = false)
private List<TSource> list;
} }

View File

@ -31,10 +31,18 @@
</select> </select>
<select id="findByStatus1" resultType="com.fuint.repository.model.TSource"> <select id="findByStatus1" resultType="com.fuint.repository.model.TSource">
select * from t_source s select * from t_source s
where s.status = #{status} where s.status = #{status} and s.is_menu = '1'
<if test="merchantId != null and merchantId > 0"> <if test="merchantId != null and merchantId > 0">
and s.merchant_id = #{merchantId} and s.merchant_id = #{merchantId}
</if> </if>
order by source_style asc order by source_style asc
</select> </select>
<select id="findByStatusButton" resultType="com.fuint.repository.model.TSource">
select * from t_source s
where s.status = #{status} and s.is_menu = '0'
<if test="parentId != null">
and s.parent_id = #{parentId}
</if>
order by source_style asc
</select>
</mapper> </mapper>

View File

@ -89,7 +89,7 @@
storeId: '', storeId: '',
show: false, show: false,
options: { options: {
code: 'https://www.tuofeng.cc/oily?storeId=' + uni.getStorageSync('storeId') + '&userId=' + uni code: 'https://oilapi.youkerr.com/oily?storeId=' + uni.getStorageSync('storeId') + '&userId=' + uni
.getStorageSync('userId') + '&type=yaoqingyouli', .getStorageSync('userId') + '&type=yaoqingyouli',
// code: 'https://www.tuofeng.cc/oily?storeId=' + uni.getStorageSync('storeId') + ' &userId=' + uni // code: 'https://www.tuofeng.cc/oily?storeId=' + uni.getStorageSync('storeId') + ' &userId=' + uni
// .getStorageSync('userId'), // // .getStorageSync('userId'), //
@ -99,7 +99,7 @@
} }
}, },
onLoad() { onLoad() {
let codes = 'https://www.tuofeng.cc/oily?storeId=' + uni.getStorageSync('storeId') + let codes = 'https://oilapi.youkerr.com/oily?storeId=' + uni.getStorageSync('storeId') +
'&userId=' + uni.getStorageSync('userId') + '&type=yaoqingyouli' '&userId=' + uni.getStorageSync('userId') + '&type=yaoqingyouli'
console.log(codes); console.log(codes);
this.query.storeId = uni.getStorageSync("storeId"); this.query.storeId = uni.getStorageSync("storeId");

View File

@ -29,7 +29,7 @@
pageSize: 10, pageSize: 10,
totalPage: '', totalPage: '',
options: { options: {
code: 'https://www.tuofeng.cc/oily?storeId=' + uni.getStorageSync('storeId') + '&userId=' + uni code: 'https://oilapi.youkerr.com/oily?storeId=' + uni.getStorageSync('storeId') + '&userId=' + uni
.getStorageSync('userId') + '&type=yaoqingyouli', .getStorageSync('userId') + '&type=yaoqingyouli',
// code: 'https://www.tuofeng.cc/oily?storeId=' + uni.getStorageSync('storeId') + ' &userId=' + uni // code: 'https://www.tuofeng.cc/oily?storeId=' + uni.getStorageSync('storeId') + ' &userId=' + uni
// .getStorageSync('userId'), // // .getStorageSync('userId'), //