完成了账号管理功能

This commit is contained in:
JIAL 2023-11-28 23:49:50 +08:00
parent bcd991376a
commit a69a346804
14 changed files with 263 additions and 122 deletions

124
.idea/uiDesigner.xml Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@ -82,7 +82,6 @@ public class EmployeeController {
//设置初始密码123456需要进行md5加密处理
employee.setPassword(DigestUtils.md5DigestAsHex(employee.getPassword().getBytes()));
employee.setIdNumber("64222420001025301X");
//employee.setCreateTime(LocalDateTime.now());
//employee.setUpdateTime(LocalDateTime.now());
@ -101,12 +100,12 @@ public class EmployeeController {
* 员工信息分页查询
* @param page
* @param pageSize
* @param name
* @param username
* @return
*/
@GetMapping("/page")
public R<Page> page(int page,int pageSize,String name){
log.info("page = {},pageSize = {},name = {}" ,page,pageSize,name);
public R<Page> page(int page,int pageSize,String username){
log.info("page = {},pageSize = {},username = {}" ,page,pageSize,username);
//构造分页构造器
Page pageInfo = new Page(page,pageSize);
@ -114,7 +113,7 @@ public class EmployeeController {
//构造条件构造器
LambdaQueryWrapper<Employee> queryWrapper = new LambdaQueryWrapper();
//添加过滤条件
queryWrapper.like(StringUtils.isNotEmpty(name),Employee::getName,name);
queryWrapper.like(StringUtils.isNotEmpty(username),Employee::getUsername,username);
//添加排序条件
queryWrapper.orderByDesc(Employee::getUpdateTime);

View File

@ -24,9 +24,7 @@ public class Employee implements Serializable {
private String phone;
private String sex;
private String idNumber;//身份证号码
private String admin;
private Integer status;

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>瑞吉外卖管理端</title>
<title>法务管理系统</title>
<link rel="shortcut icon" href="favicon.ico">
<!-- 引入样式 -->
<link rel="stylesheet" href="plugins/element-ui/index.css" />
@ -117,46 +117,9 @@
defAct: '2',
menuActived: '2',
userInfo: {},
menuList: [
// {
// id: '1',
// name: '门店管理',
// children: [
{
id: '2',
name: '账号管理',
url: 'page/member/list.html',
icon: 'icon-member'
},
{
id: '3',
name: '全部案件',
url: 'page/category/list.html',
icon: 'icon-category'
},
{
id: '4',
name: '合同纠纷',
url: 'page/food/list.html',
icon: 'icon-food'
},
{
id: '5',
name: '出资纠纷',
url: 'page/combo/list.html',
icon: 'icon-combo'
},
{
id: '6',
name: '行政纠纷',
url: 'page/order/list.html',
icon: 'icon-order'
}
// ],
// },
],
menuList: [],
iframeUrl: 'page/member/list.html',
headTitle: '员工管理',
headTitle: '全部案件',
goBackFlag: false,
loading: true,
timer: null
@ -168,6 +131,8 @@
if (userInfo) {
this.userInfo = JSON.parse(userInfo)
}
this.menuList = this.generateMenuList();
this.menuHandle(this.menuList.find(item => item.id === this.defAct), false); // 手动调用一次 menuHandle
this.closeLoading()
},
beforeDestroy() {
@ -178,6 +143,48 @@
window.menuHandle = this.menuHandle
},
methods: {
generateMenuList() {
const userInfo = JSON.parse(window.localStorage.getItem('userInfo'));
const isAdmin = userInfo && userInfo.admin === "0";
const baseMenuList = [
{
id: '2',
name: '全部案件',
url: 'page/category/list.html',
icon: 'icon-category'
},
{
id: '3',
name: '合同纠纷',
url: 'page/food/list.html',
icon: 'icon-food'
},
{
id: '4',
name: '出资纠纷',
url: 'page/combo/list.html',
icon: 'icon-combo'
},
{
id: '5',
name: '行政纠纷',
url: 'page/order/list.html',
icon: 'icon-order'
},
];
// 添加账号管理菜单项仅当用户是管理员时
if (!isAdmin) {
baseMenuList.push({
id: '6',
name: '账号管理',
url: 'page/member/list.html',
icon: 'icon-member'
});
}
return baseMenuList;
},
logout() {
logoutApi().then((res)=>{
if(res.code === 1){

View File

@ -50,13 +50,13 @@ function checkPhone (rule, value, callback){
function checkPassword (rule,value,callback) {
// 身份证号码为15位或者18位15位时全为数字18位前17位为数字最后一位是校验位可能为数字或字符X
// 密码为1到32位的数字字母组合
let reg = /^[a-zA-Z0-9]{1,32}$/
if(value == '') {
callback(new Error('请输入身份证号码'))
callback(new Error('请输入码'))
} else if (reg.test(value)) {
callback()
} else {
callback(new Error('身份证号码不正确'))
callback(new Error('密码格式不正确请输入1-32位的数字密码组合'))
}
}

View File

@ -46,12 +46,12 @@
/>
</el-form-item>
<el-form-item
label="性别:"
prop="sex"
label="是否为管理员账号:"
prop="admin"
>
<el-radio-group v-model="ruleForm.sex">
<el-radio label=""></el-radio>
<el-radio label=""></el-radio>
<el-radio-group v-model="ruleForm.admin">
<el-radio label=""></el-radio>
<el-radio label=""></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
@ -108,7 +108,7 @@
ruleForm : {
'name': '',
'phone': '',
'sex': '男',
'admin': '是',
'password': '',
username: ''
}
@ -142,11 +142,10 @@
methods: {
async init () {
queryEmployeeById(this.id).then(res => {
console.log(res)
if (String(res.code) === '1') {
console.log(res.data)
this.ruleForm = res.data
this.ruleForm.sex = res.data.sex === '0' ? '女' : '男'
this.ruleForm.admin = res.data.admin === '0' ? '否' : '是'
// this.ruleForm.password = ''
} else {
this.$message.error(res.msg || '操作失败')
@ -159,10 +158,11 @@
if (this.actionType === 'add') {
const params = {
...this.ruleForm,
sex: this.ruleForm.sex === '女' ? '0' : '1'
admin: this.ruleForm.admin === '否' ? '0' : '1'
}
addEmployee(params).then(res => {
if (res.code === 1) {
console.log("添加成功")
this.$message.success('员工添加成功!')
if (!st) {
this.goBack()
@ -173,7 +173,7 @@
'phone': '',
// 'password': '',
// 'rePassword': '',/
'sex': '男',
'admin': '是',
'password': ''
}
}
@ -186,11 +186,14 @@
} else {
const params = {
...this.ruleForm,
sex: this.ruleForm.sex === '女' ? '0' : '1'
admin: this.ruleForm.admin === '否' ? '0' : '1'
}
editEmployee(params).then(res => {
console.log(res.toString());
if (res.code === 1) {
this.$message.success('员工信息修改成功!')
var vm = this;
Vue.prototype.$message.success('员工信息修改成功!')
console.log("修改成功");
this.goBack()
} else {
this.$message.error(res.msg || '操作失败')

View File

@ -22,7 +22,7 @@
<div class="tableBar">
<el-input
v-model="input"
placeholder="请输入账号姓名"
placeholder="请输入员工工号"
style="width: 250px"
clearable
@keyup.enter.native="handleQuery"
@ -139,7 +139,7 @@
const params = {
page: this.page,
pageSize: this.pageSize,
name: this.input ? this.input : undefined
username: this.input ? this.input : undefined
}
await getMemberList(params).then(res => {
if (String(res.code) === '1') {

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>瑞吉外卖管理端</title>
<title>法务管理系统</title>
<link rel="shortcut icon" href="favicon.ico">
<!-- 引入样式 -->
<link rel="stylesheet" href="plugins/element-ui/index.css" />
@ -117,46 +117,9 @@
defAct: '2',
menuActived: '2',
userInfo: {},
menuList: [
// {
// id: '1',
// name: '门店管理',
// children: [
{
id: '2',
name: '账号管理',
url: 'page/member/list.html',
icon: 'icon-member'
},
{
id: '3',
name: '全部案件',
url: 'page/category/list.html',
icon: 'icon-category'
},
{
id: '4',
name: '合同纠纷',
url: 'page/food/list.html',
icon: 'icon-food'
},
{
id: '5',
name: '出资纠纷',
url: 'page/combo/list.html',
icon: 'icon-combo'
},
{
id: '6',
name: '行政纠纷',
url: 'page/order/list.html',
icon: 'icon-order'
}
// ],
// },
],
menuList: [],
iframeUrl: 'page/member/list.html',
headTitle: '员工管理',
headTitle: '全部案件',
goBackFlag: false,
loading: true,
timer: null
@ -168,6 +131,8 @@
if (userInfo) {
this.userInfo = JSON.parse(userInfo)
}
this.menuList = this.generateMenuList();
this.menuHandle(this.menuList.find(item => item.id === this.defAct), false); // 手动调用一次 menuHandle
this.closeLoading()
},
beforeDestroy() {
@ -178,6 +143,48 @@
window.menuHandle = this.menuHandle
},
methods: {
generateMenuList() {
const userInfo = JSON.parse(window.localStorage.getItem('userInfo'));
const isAdmin = userInfo && userInfo.admin === "0";
const baseMenuList = [
{
id: '2',
name: '全部案件',
url: 'page/category/list.html',
icon: 'icon-category'
},
{
id: '3',
name: '合同纠纷',
url: 'page/food/list.html',
icon: 'icon-food'
},
{
id: '4',
name: '出资纠纷',
url: 'page/combo/list.html',
icon: 'icon-combo'
},
{
id: '5',
name: '行政纠纷',
url: 'page/order/list.html',
icon: 'icon-order'
},
];
// 添加账号管理菜单项仅当用户是管理员时
if (!isAdmin) {
baseMenuList.push({
id: '6',
name: '账号管理',
url: 'page/member/list.html',
icon: 'icon-member'
});
}
return baseMenuList;
},
logout() {
logoutApi().then((res)=>{
if(res.code === 1){

View File

@ -50,13 +50,13 @@ function checkPhone (rule, value, callback){
function checkPassword (rule,value,callback) {
// 身份证号码为15位或者18位15位时全为数字18位前17位为数字最后一位是校验位可能为数字或字符X
// 密码为1到32位的数字字母组合
let reg = /^[a-zA-Z0-9]{1,32}$/
if(value == '') {
callback(new Error('请输入身份证号码'))
callback(new Error('请输入码'))
} else if (reg.test(value)) {
callback()
} else {
callback(new Error('身份证号码不正确'))
callback(new Error('密码格式不正确请输入1-32位的数字密码组合'))
}
}

View File

@ -46,12 +46,12 @@
/>
</el-form-item>
<el-form-item
label="性别:"
prop="sex"
label="是否为管理员账号:"
prop="admin"
>
<el-radio-group v-model="ruleForm.sex">
<el-radio label=""></el-radio>
<el-radio label=""></el-radio>
<el-radio-group v-model="ruleForm.admin">
<el-radio label=""></el-radio>
<el-radio label=""></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
@ -108,7 +108,7 @@
ruleForm : {
'name': '',
'phone': '',
'sex': '男',
'admin': '是',
'password': '',
username: ''
}
@ -142,11 +142,10 @@
methods: {
async init () {
queryEmployeeById(this.id).then(res => {
console.log(res)
if (String(res.code) === '1') {
console.log(res.data)
this.ruleForm = res.data
this.ruleForm.sex = res.data.sex === '0' ? '女' : '男'
this.ruleForm.admin = res.data.admin === '0' ? '否' : '是'
// this.ruleForm.password = ''
} else {
this.$message.error(res.msg || '操作失败')
@ -159,10 +158,11 @@
if (this.actionType === 'add') {
const params = {
...this.ruleForm,
sex: this.ruleForm.sex === '女' ? '0' : '1'
admin: this.ruleForm.admin === '否' ? '0' : '1'
}
addEmployee(params).then(res => {
if (res.code === 1) {
console.log("添加成功")
this.$message.success('员工添加成功!')
if (!st) {
this.goBack()
@ -173,7 +173,7 @@
'phone': '',
// 'password': '',
// 'rePassword': '',/
'sex': '男',
'admin': '是',
'password': ''
}
}
@ -186,11 +186,14 @@
} else {
const params = {
...this.ruleForm,
sex: this.ruleForm.sex === '女' ? '0' : '1'
admin: this.ruleForm.admin === '否' ? '0' : '1'
}
editEmployee(params).then(res => {
console.log(res.toString());
if (res.code === 1) {
this.$message.success('员工信息修改成功!')
var vm = this;
Vue.prototype.$message.success('员工信息修改成功!')
console.log("修改成功");
this.goBack()
} else {
this.$message.error(res.msg || '操作失败')

View File

@ -22,7 +22,7 @@
<div class="tableBar">
<el-input
v-model="input"
placeholder="请输入账号姓名"
placeholder="请输入员工工号"
style="width: 250px"
clearable
@keyup.enter.native="handleQuery"
@ -139,7 +139,7 @@
const params = {
page: this.page,
pageSize: this.pageSize,
name: this.input ? this.input : undefined
username: this.input ? this.input : undefined
}
await getMemberList(params).then(res => {
if (String(res.code) === '1') {

Binary file not shown.