parent
92ab617a9f
commit
5420136712
@ -1,136 +1,142 @@
|
|||||||
import request from '@/utils/request'
|
import request from "@/utils/request";
|
||||||
import { parseStrEmpty } from "@/utils/ruoyi";
|
import { parseStrEmpty } from "@/utils/ruoyi";
|
||||||
|
|
||||||
// 查询用户列表
|
// 查询用户列表
|
||||||
export function listUser(query) {
|
export function listUser(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/list',
|
url: "/system/user/list",
|
||||||
method: 'get',
|
method: "get",
|
||||||
params: query
|
params: query,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询用户详细
|
// 查询用户详细
|
||||||
export function getUser(userId) {
|
export function getUser(userId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/' + parseStrEmpty(userId),
|
url: "/system/user/" + parseStrEmpty(userId),
|
||||||
method: 'get'
|
method: "get",
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增用户
|
// 新增用户
|
||||||
export function addUser(data) {
|
export function addUser(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user',
|
url: "/system/user",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: data
|
data: data,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改用户
|
// 修改用户
|
||||||
export function updateUser(data) {
|
export function updateUser(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user',
|
url: "/system/user",
|
||||||
method: 'put',
|
method: "put",
|
||||||
data: data
|
data: data,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除用户
|
// 删除用户
|
||||||
export function delUser(userId) {
|
export function delUser(userId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/' + userId,
|
url: "/system/user/" + userId,
|
||||||
method: 'delete'
|
method: "delete",
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户密码重置
|
// 用户密码重置
|
||||||
export function resetUserPwd(userId, password) {
|
export function resetUserPwd(userId, password) {
|
||||||
const data = {
|
const data = {
|
||||||
userId,
|
userId,
|
||||||
password
|
password,
|
||||||
}
|
};
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/resetPwd',
|
url: "/system/user/resetPwd",
|
||||||
method: 'put',
|
method: "put",
|
||||||
data: data
|
data: data,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户状态修改
|
// 用户状态修改
|
||||||
export function changeUserStatus(userId, status) {
|
export function changeUserStatus(userId, status) {
|
||||||
const data = {
|
const data = {
|
||||||
userId,
|
userId,
|
||||||
status
|
status,
|
||||||
}
|
};
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/changeStatus',
|
url: "/system/user/changeStatus",
|
||||||
method: 'put',
|
method: "put",
|
||||||
data: data
|
data: data,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询用户个人信息
|
// 查询用户个人信息
|
||||||
export function getUserProfile() {
|
export function getUserProfile() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/profile',
|
url: "/system/user/profile",
|
||||||
method: 'get'
|
method: "get",
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改用户个人信息
|
// 修改用户个人信息
|
||||||
export function updateUserProfile(data) {
|
export function updateUserProfile(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/profile',
|
url: "/system/user/profile",
|
||||||
method: 'put',
|
method: "put",
|
||||||
data: data
|
data: data,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户密码重置
|
// 用户密码重置
|
||||||
export function updateUserPwd(oldPassword, newPassword) {
|
export function updateUserPwd(oldPassword, newPassword) {
|
||||||
const data = {
|
const data = {
|
||||||
oldPassword,
|
oldPassword,
|
||||||
newPassword
|
newPassword,
|
||||||
}
|
};
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/profile/updatePwd',
|
url: "/system/user/profile/updatePwd",
|
||||||
method: 'put',
|
method: "put",
|
||||||
params: data
|
params: data,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户头像上传
|
// 用户头像上传
|
||||||
export function uploadAvatar(data) {
|
export function uploadAvatar(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/profile/avatar',
|
url: "/system/user/profile/avatar",
|
||||||
method: 'post',
|
method: "post",
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
||||||
data: data
|
data: data,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询授权角色
|
// 查询授权角色
|
||||||
export function getAuthRole(userId) {
|
export function getAuthRole(userId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/authRole/' + userId,
|
url: "/system/user/authRole/" + userId,
|
||||||
method: 'get'
|
method: "get",
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存授权角色
|
// 保存授权角色
|
||||||
export function updateAuthRole(data) {
|
export function updateAuthRole(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/authRole',
|
url: "/system/user/authRole",
|
||||||
method: 'put',
|
method: "put",
|
||||||
params: data
|
params: data,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询部门下拉树结构
|
// 查询部门下拉树结构
|
||||||
|
// export function deptTreeSelect() {
|
||||||
|
// return request({
|
||||||
|
// url: '/system/user/deptTree',
|
||||||
|
// method: 'get'
|
||||||
|
// })
|
||||||
|
// }
|
||||||
export function deptTreeSelect() {
|
export function deptTreeSelect() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/deptTree',
|
url: "/system/dept/treeselect",
|
||||||
method: 'get'
|
method: "get",
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 847 B |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* @Author: 许宏杰
|
||||||
|
* @Date: 2021-12-28 16:05:36
|
||||||
|
* @LastEditors: 许宏杰
|
||||||
|
* @LastEditTime: 2022-03-24 14:25:05
|
||||||
|
* @FilePath: \taicangpopulationpc\src\utils\regex\formRegex.js
|
||||||
|
*/
|
||||||
|
//以key:value方式一次性全部导出
|
||||||
|
export default {
|
||||||
|
// 邮箱
|
||||||
|
checkEmail: (rule, value, callback) => {
|
||||||
|
const mailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
|
||||||
|
if (!value) {
|
||||||
|
return callback(new Error("邮箱不能为空"));
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
if (mailReg.test(value)) {
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
callback(new Error("请输入正确的邮箱格式"));
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
},
|
||||||
|
//手机号
|
||||||
|
checkPhone: (rule, value, callback) => {
|
||||||
|
const phoneReg = /^1[3|4|5|7|8][0-9]{9}$/;
|
||||||
|
if (!value) {
|
||||||
|
return callback(new Error("电话号码不能为空"));
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
// Number.isInteger是es6验证数字是否为整数的方法,但是我实际用的时候输入的数字总是识别成字符串
|
||||||
|
// 所以我就在前面加了一个+实现隐式转换
|
||||||
|
if (!Number.isInteger(+value)) {
|
||||||
|
callback(new Error("请输入数字值"));
|
||||||
|
} else {
|
||||||
|
if (phoneReg.test(value)) {
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
callback(new Error("电话号码格式不正确"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
},
|
||||||
|
//正整数大于0
|
||||||
|
checkcontractLeaseArea: (rule, value, callback) => {
|
||||||
|
const contractLeaseArea = /^[1-9]\d*$/;
|
||||||
|
if (!value) {
|
||||||
|
return callback(new Error("数字不能小于且等于0"));
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
if (contractLeaseArea.test(value)) {
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
callback(new Error("请输入大于0的数字"));
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
},
|
||||||
|
//只接受中文汉字
|
||||||
|
ChineseCharacters(text) {
|
||||||
|
let personalName = (rule, value, callback) => {
|
||||||
|
const names = /^[\u4e00-\u9fa5]{2,15}$/;
|
||||||
|
if (!value) {
|
||||||
|
return callback(new Error(`${text}名称不能为空`));
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
if (names.test(value)) {
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
callback(new Error(`${text}只能为中文汉字`));
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
};
|
||||||
|
return personalName;
|
||||||
|
},
|
||||||
|
//身份证
|
||||||
|
idCard: (rule, value, callback) => {
|
||||||
|
let id =
|
||||||
|
/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
|
||||||
|
if (!value) {
|
||||||
|
return callback(new Error("身份证号码不能为空"));
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
if (id.test(value)) {
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
callback(new Error("请输入正确的身份证号码"));
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
},
|
||||||
|
};
|
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* @Author: 许宏杰
|
||||||
|
* @Date: 2021-12-28 10:21:48
|
||||||
|
* @LastEditors: 许宏杰
|
||||||
|
* @LastEditTime: 2021-12-28 16:22:32
|
||||||
|
* @FilePath: \hezhangzhipc\src\utils\regex\index.js
|
||||||
|
*/
|
||||||
|
import formRegex from './formRegex.js'//引入自己的正则文件目录
|
||||||
|
|
||||||
|
export default {
|
||||||
|
formRegex,//导出
|
||||||
|
}
|
||||||
|
|
||||||
|
//页面使用
|
||||||
|
// 引入 import 名字 from "@/utils/regex/index.js";
|
||||||
|
// 使用 名字.index导出名字.key
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue