diff --git a/src/main/java/com/bonus/imgTool/model/Role.java b/src/main/java/com/bonus/imgTool/model/Role.java
index 5f4399a..c36fb2e 100644
--- a/src/main/java/com/bonus/imgTool/model/Role.java
+++ b/src/main/java/com/bonus/imgTool/model/Role.java
@@ -54,4 +54,9 @@ public class Role extends PageEntity {
*/
private Integer state;
+ /**
+ * 角色级别
+ */
+ private Integer level;
+
}
diff --git a/src/main/java/com/bonus/imgTool/system/dao/RoleDao.java b/src/main/java/com/bonus/imgTool/system/dao/RoleDao.java
index c6fe376..4e8c7de 100644
--- a/src/main/java/com/bonus/imgTool/system/dao/RoleDao.java
+++ b/src/main/java/com/bonus/imgTool/system/dao/RoleDao.java
@@ -24,7 +24,7 @@ public interface RoleDao {
* @return
*/
@Options(useGeneratedKeys = true, keyProperty = "id")
- @Insert("insert into sys_role(role_name, role_code,remarks,org_id,state, create_time, update_time,del_flag) values(#{name},#{roleCode}, #{remarks},#{orgId},#{state}, now(),now(),0)")
+ @Insert("insert into sys_role(role_name, role_code,remarks,org_id,state, create_time, update_time,del_flag,level) values(#{name},#{roleCode}, #{remarks},#{orgId},#{state}, now(),now(),0,#{level})")
int save(Role role);
@@ -55,7 +55,7 @@ public interface RoleDao {
* @param role
* @return
*/
- @Update("update sys_role t set t.role_name = #{name},t.role_code = #{roleCode}, t.remarks = #{remarks},org_id=#{orgId},state=#{state}, update_time = now() where t.role_id = #{id}")
+ @Update("update sys_role t set t.role_name = #{name},t.role_code = #{roleCode}, t.remarks = #{remarks},org_id=#{orgId},state=#{state}, update_time = now(),level=#{level} where t.role_id = #{id}")
int update(Role role);
/**
diff --git a/src/main/java/com/bonus/imgTool/system/service/impl/RoleServiceImpl.java b/src/main/java/com/bonus/imgTool/system/service/impl/RoleServiceImpl.java
index d27b9d8..c4ebb02 100644
--- a/src/main/java/com/bonus/imgTool/system/service/impl/RoleServiceImpl.java
+++ b/src/main/java/com/bonus/imgTool/system/service/impl/RoleServiceImpl.java
@@ -51,12 +51,12 @@ public class RoleServiceImpl implements RoleService {
return ServerResponse.createErroe(role.getName() + "已存在");
}
//查询角色编码是否存在
- if (role.getRoleCode() != null) {
- Role r1 = roleDao.getRoleCode(role.getRoleCode());
- if (r1 != null) {
- return ServerResponse.createErroe(role.getRoleCode() + "已存在");
- }
- }
+// if (role.getRoleCode() != null) {
+// Role r1 = roleDao.getRoleCode(role.getRoleCode());
+// if (r1 != null) {
+// return ServerResponse.createErroe(role.getRoleCode() + "已存在");
+// }
+// }
roleDao.save(role);
if (!CollectionUtils.isEmpty(permissionIds)) {
roleDao.saveRolePermission(role.getId(), permissionIds);
@@ -72,12 +72,12 @@ public class RoleServiceImpl implements RoleService {
return ServerResponse.createErroe(role.getName() + "已存在");
}
//查询角色编码是否存在
- if (role.getRoleCode() != null) {
+ /*if (role.getRoleCode() != null) {
Role r1 = roleDao.getRoleCode(role.getRoleCode());
if (r1 != null && !Objects.equals(r1.getId(), role.getId())) {
return ServerResponse.createErroe(role.getRoleCode() + "已存在");
}
- }
+ }*/
roleDao.update(role);
roleDao.deleteRolePermission(role.getId());
if (!CollectionUtils.isEmpty(permissionIds)) {
diff --git a/src/main/resources/mappers/system/RoleMapper.xml b/src/main/resources/mappers/system/RoleMapper.xml
index 7099e8a..c1cae1a 100644
--- a/src/main/resources/mappers/system/RoleMapper.xml
+++ b/src/main/resources/mappers/system/RoleMapper.xml
@@ -30,7 +30,9 @@
t.remarks,
so.org_name as orgName,
t.state,
- t.create_time AS createTime
+ t.create_time AS createTime,
+ t.level ,
+ t.update_time AS updateTime
from sys_role t
LEFT JOIN sys_org so on so.org_id=t.org_id and so.del_flag='0'
@@ -49,7 +51,8 @@
t.role_code as roleCode,
t.remarks,
t.org_id as orgId,
- t.state
+ t.state,
+ t.level
from sys_role t where t.role_id = #{id}
diff --git a/src/main/resources/static/js/safetyViolations/child/safetyViolationsForm.js b/src/main/resources/static/js/safetyViolations/child/safetyViolationsForm.js
index 4895904..0cb6f1a 100644
--- a/src/main/resources/static/js/safetyViolations/child/safetyViolationsForm.js
+++ b/src/main/resources/static/js/safetyViolations/child/safetyViolationsForm.js
@@ -1,4 +1,4 @@
-let form, layer, util, idParam;
+let form, layer, util, idParam, laydate;
let arr = ['background', 'web', 'mobile', 'wx'];
let background, web, mobile, wx;
let data = [];
@@ -7,10 +7,204 @@ let data = [];
let proList;
let majorList;
let processList;
+
+
+// 模拟后台返回的数据结构
+const mockBackendResponse = (file) => {
+ const originalPath = `/uploads/original/${file.name}`;
+ const compressedPath = `/uploads/compressed/${file.name}`;
+ const watermarkedPath = `/uploads/watermarked/${file.name}`;
+ return {
+ code: 200,
+ msg: '上传成功',
+ data: {
+ originalPath,
+ compressedPath,
+ watermarkedPath
+ }
+ };
+};
+
+// 存储图片路径信息
+var imagePaths = [];
+
+layui.use(['laydate', 'upload'], function () {
+ var upload = layui.upload;
+ var layer = layui.layer;
+ var element = layui.element;
+ var $ = layui.$;
+
+
+ // 多图片上传
+ upload.render({
+ elem: '#ID-upload-demo-btn-2',
+ url: '/your/upload/endpoint',
+ // url: 'javascript:;', // 阻止真实请求
+ multiple: true,
+ auto: true,
+ // 文件选择后的回调
+ choose: function (obj) {
+ // 当前已有的图片数量
+ const currentImages = $('#upload-demo-preview div').length;
+ // 获取当前批次选择的文件列表
+ const newFiles = obj.pushFile();
+ const newFilesCount = Object.keys(newFiles).length;
+ // 总图片数量
+ const totalImages = currentImages + newFilesCount;
+ if (totalImages > 9) {
+ layer.alert(`最多只能上传9张图片,当前已选 ${currentImages} 张,此次选择了 ${newFilesCount} 张`, { icon: 2 });
+ return false; // 阻止上传
+ }
+ },
+ before: function (obj) {
+ obj.preview(function (index, file, result) {
+ const uniqueId = new Date().getTime() + '-' + index;
+ $('#upload-demo-preview').append(
+ '
' +
+ '

' +
+ '
' +
+ '
'
+ );
+ });
+ },
+ done: function (res, index, upload) {
+ // 获取当前上传的文件
+ const files = this.files;
+ const file = files[index];
+ const backendResponse = mockBackendResponse(file);
+ if (backendResponse.code === 200) {
+ const imageData = {
+ uniqueId: `${new Date().getTime()}-${index}`,
+ originalPath: backendResponse.data.originalPath,
+ compressedPath: backendResponse.data.compressedPath,
+ watermarkedPath: backendResponse.data.watermarkedPath
+ };
+ imagePaths.push(imageData);
+ $('#imagePaths').val(JSON.stringify(imagePaths));
+ } else {
+ layer.alert('上传失败: ' + res.msg, {icon: 2});
+ }
+ console.log("imagePaths",imagePaths)
+ }
+ });
+
+
+ upload.render({
+ elem: '#ID-upload-demo-btn-3',
+ url: '/your/upload/endpoint',
+ // url: 'javascript:;', // 阻止真实请求
+ multiple: true,
+ auto: true,
+ // 文件选择后的回调
+ choose: function (obj) {
+ // 当前已有的图片数量
+ const currentImages = $('#upload-demo-preview div').length;
+ // 获取当前批次选择的文件列表
+ const newFiles = obj.pushFile();
+ const newFilesCount = Object.keys(newFiles).length;
+ // 总图片数量
+ const totalImages = currentImages + newFilesCount;
+ if (totalImages > 9) {
+ layer.alert(`最多只能上传9张图片,当前已选 ${currentImages} 张,此次选择了 ${newFilesCount} 张`, { icon: 2 });
+ return false; // 阻止上传
+ }
+ },
+ before: function (obj) {
+ obj.preview(function (index, file, result) {
+ const uniqueId = new Date().getTime() + '-' + index;
+ $('#upload-demo-preview-3').append(
+ '' +
+ '

' +
+ '
' +
+ '
'
+ );
+ });
+ },
+ done: function (res, index, upload) {
+ // 获取当前上传的文件
+ const files = this.files;
+ const file = files[index];
+ const backendResponse = mockBackendResponse(file);
+ if (backendResponse.code === 200) {
+ const imageData = {
+ uniqueId: `${new Date().getTime()}-${index}`,
+ originalPath: backendResponse.data.originalPath,
+ compressedPath: backendResponse.data.compressedPath,
+ watermarkedPath: backendResponse.data.watermarkedPath
+ };
+ imagePaths.push(imageData);
+ $('#imagePaths').val(JSON.stringify(imagePaths));
+ } else {
+ layer.alert('上传失败: ' + res.msg, {icon: 2});
+ }
+ console.log("imagePaths",imagePaths)
+ }
+ });
+
+ $('#ID-upload-submit-btn').click(function() {
+ if (imagePaths.length === 0) {
+ layer.msg('请先选择图片', {icon: 2});
+ return;
+ }
+
+ layer.msg('模拟上传中...', {icon: 16, time: 2000});
+
+ // 模拟上传延迟
+ setTimeout(function() {
+ // 清空旧数据(仅保留成功上传的)
+ const successPaths = [];
+
+ // 遍历所有图片,模拟上传
+ imagePaths.forEach(item => {
+ const backendResponse = mockBackendResponse(item.file);
+ if (backendResponse.code === 200) {
+ successPaths.push({
+ uniqueId: item.uniqueId,
+ originalPath: backendResponse.data.originalPath,
+ compressedPath: backendResponse.data.compressedPath,
+ watermarkedPath: backendResponse.data.watermarkedPath
+ });
+ }
+ });
+
+ // 更新数据
+ imagePaths = successPaths;
+ $('#imagePaths').val(JSON.stringify(imagePaths));
+
+ layer.msg('上传成功!', {icon: 1});
+ console.log("当前图片数据:", imagePaths);
+ }, 1500);
+ });
+
+ window.removeImage = function (uniqueId) {
+ $('#img-' + uniqueId).remove();
+ const indexToRemove = imagePaths.findIndex(path => path.uniqueId === uniqueId);
+ if (indexToRemove !== -1) {
+ imagePaths.splice(indexToRemove, 1);
+ $('#imagePaths').val(JSON.stringify(imagePaths));
+ }
+ };
+
+ laydate = layui.laydate;
+ // Render date pickers
+ laydate.render({
+ elem: '#violationTime',
+ });
+ laydate.render({
+ elem: '#rectificationDeadline',
+ });
+ laydate.render({
+ elem: '#correctionTime',
+ });
+
+
+});
+
+
function setParams(params) {
console.log(params)
idParam = JSON.parse(params).id;
- layui.use(['form', 'layer', 'util'], function () {
+ layui.use(['form', 'layer', 'util'], function () {
layer = layui.layer;
form = layui.form;
util = layui.util;
@@ -21,21 +215,9 @@ function setParams(params) {
if (idParam) {
getUserById();
}
-
-
form.render();//重新渲染页面checkbox控件
form.on('submit(formData)', function (data) {
data.field.id = $('#id').val();
- console.log( data.field.orgId_select_nodeId);
- if(!data.field.orgId_select_nodeId){
- return layer.alert("请选择组织机构!", {icon: 2})
- }
- let phone = $('#phone').val();
- if(phone){
- if (!(/^1[3456789]\d{9}$/.test(phone))) {
- return layer.alert("请输入正确的手机号", {icon: 2})
- }
- }
saveData(data);
});
@@ -50,7 +232,7 @@ function getProSelected() {
ajaxRequest(url, "POST", null, true, function () {
}, function (result) {
if (result.code === 200) {
- setSelectValueName(result.data, 'projectName',"请选择项目(可搜索)");
+ setSelectValueName(result.data, 'projectName', "请选择项目(可搜索)");
} else {
layer.alert(result.msg, {icon: 2})
}
@@ -63,11 +245,11 @@ function getProSelected() {
* 获取专业数据
*/
function getMajorSelected() {
- let url = dataUrl + '/users/getRoleAll';
- ajaxRequest(url, "POST", null, true, function () {
+ let url = dataUrl + '/sys/select/getProfessionSelect';
+ ajaxRequest(url, "GET", null, true, function () {
}, function (result) {
if (result.code === 200) {
- setSelectValueName(result.data, 'specialty',"请选择专业");
+ setSelectValueName(result.data, 'specialty', "请选择专业");
} else {
layer.alert(result.msg, {icon: 2})
}
@@ -80,11 +262,11 @@ function getMajorSelected() {
* 获取工序数据
*/
function getProcessSelected() {
- let url = dataUrl + '/users/getRoleAll';
- ajaxRequest(url, "POST", null, true, function () {
+ let url = dataUrl + '/sys/select/getProcessSelect';
+ ajaxRequest(url, "GET", null, true, function () {
}, function (result) {
if (result.code === 200) {
- setSelectValueName(result.data, 'process','请选择工序');
+ setSelectValueName(result.data, 'process', '请选择工序');
} else {
layer.alert(result.msg, {icon: 2})
}
@@ -94,7 +276,6 @@ function getProcessSelected() {
}
-
// 根据id获取用户信息
function getUserById() {
let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
@@ -103,8 +284,8 @@ function getUserById() {
id: idParam
}
console.log(params)
- params={
- encryptedData:encryptCBC(JSON.stringify(params))
+ params = {
+ encryptedData: encryptCBC(JSON.stringify(params))
}
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
@@ -123,49 +304,14 @@ function getUserById() {
// 设置表单内容
function setFormData(data) {
- console.log("data:",data)
+ console.log("data:", data)
if (data) {
- $("#password").removeAttr("lay-verify");
- $("#pwd").css("display","none");
$('#id').val(data.id)
- // $('#userCode').val(data.userCode)
- $('#username').val(data.username)
+ $('#inspector').val("修改")
$('#loginName').val(data.loginName)
$('#phone').val(data.phone)
-
- // 设置选中状态
- if (data.sex === 1) {
- document.getElementById('sex_1').checked = true;
- } else if (data.sex === 0) {
- document.getElementById('sex_0').checked = true;
- }
-
- if (data.userType === '1') {
- document.getElementById('userType_1').checked = true;
- } else if (data.userType === '0') {
- document.getElementById('userType_0').checked = true;
- }
-
- if (data.state === 1) {
- document.getElementById('state_1').checked = true;
- } else if (data.state === 0) {
- document.getElementById('state_0').checked = true;
- }
- $('#type_'+data.type).attr('checked', true)
- $('#orgId').val(data.orgId)
- $('#roleId').val(data.roleId)
$('#roleId option[value=' + data.roleId + ']').attr('selected', true)
- $('#teamId').val(data.teamId)
- $('#teamId option[value=' + data.teamId + ']').attr('selected', true)
- var arrCB = data.loginTypes;
- for (var j = 0; j < arrCB.length; j++) {
- var cbthis = $("input[name='loginType']");
- for (var i = 0; i < cbthis.length; i++) {
- if (cbthis[i].value == arrCB[j]) {
- cbthis[i].checked = true;
- }
- }
- }
+
layui.form.render();
}
}
@@ -179,19 +325,12 @@ function saveData(data) {
let loadingMsg = layer.msg('数据上传中,请稍候...', {icon: 16, scrollbar: false, time: 0});
let url = dataUrl + "/users/addTemp";
let params = data.field;
- var arr_box = [];//固定复选框
- $('#cbGuDing input[type=checkbox]:checked').each(function () {
- arr_box.push($(this).val());
- });
- console.log(arr_box)
- params.loginType = arr_box.join()
- params.orgId = params.orgId_select_nodeId;
- if(params.id !=""){
+ if (params.id != "") {
url = dataUrl + "/users/update";
}
console.log(params)
- params={
- encryptedData:encryptCBC(JSON.stringify(params))
+ params = {
+ encryptedData: encryptCBC(JSON.stringify(params))
}
ajaxRequest(url, "POST", params, true, function () {
$('.save').addClass("layui-btn-disabled").attr("disabled", true);
@@ -214,40 +353,6 @@ function saveData(data) {
});
}
-// 手机号名称是否重复
-function isRepeat(paramName, phone) {
- let data = {};
- let url = dataUrl + "/sys/user/isRepeat";
- let params = {
- 'value': phone,
- 'paramName': paramName
- }
- ajaxRequest(url, "POST", params, false, function () {
- }, function (result) {
- if (result.code === 200) {
- data = result
- } else if (result.code === 500) {
- }
- }, function (xhr) {
- error(xhr)
- });
- return data;
-}
-
-function getPasswordConfig(callback) {
- let url = dataUrl + "/users/getPasswordConfig"
- ajaxRequest(url, "POST", null, true, function () {}, function (result) {
- // layer.close(loadingMsg); // 关闭提示层
- if (result.status === 200) {
- callback(result.data);
- } else if (result.status === 500) {
- layer.alert(result.msg, {icon: 2})
- }
- }, function (xhr) {
- error(xhr)
- });
-}
-
// 关闭页面
function closePage(type) {
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
diff --git a/src/main/resources/static/js/safetyViolations/safetyViolationsList.js b/src/main/resources/static/js/safetyViolations/safetyViolationsList.js
index 4030be0..aa386e8 100644
--- a/src/main/resources/static/js/safetyViolations/safetyViolationsList.js
+++ b/src/main/resources/static/js/safetyViolations/safetyViolationsList.js
@@ -116,7 +116,7 @@ function initTable(dataList, limit, page) {
templet: function (d) {
let html = '';
- let updaetpwd="";
+ let updaetpwd="";
let del=""
let edit="";
html=updaetpwd + edit+del;
@@ -192,20 +192,22 @@ function reloadData() {
pages(pageNum, limitSize);
}
-// 新增/修改平台用户
-function addData(id) {
- let title = '新增用户'
- if (id) {
- title = '修改用户';
- }
+//详情
+function detailsData(id) {
+ let title = '详情'
let param = {
'id': id
}
- openIframe2("addOrEditUser", title, "child/userForm.html", '1000px', '625px', param);
+ openIframe2("detailsSafetyViolations", title, "child/safetyViolationsForm.html", '1200px', '625px', param);
}
+
+// 新增/修改
function addData(id) {
let title = '新增'
+ if (id) {
+ title = '修改';
+ }
let param = {
'id': id
}
@@ -326,12 +328,11 @@ function getProTypeSelected() {
}
/**
- * 获取工序 http://127.0.0.1:11997/imgTool/sys/select/getProfessionSelect
- * http://127.0.0.1:11997/imgTool/sys/select/getProcessSelect
+ * 获取工序
*/
function getProcessIdSelected() {
let url = dataUrl + '/sys/select/getProcessSelect';
- ajaxRequest(url, "POST", null, true, function () {
+ ajaxRequest(url, "GET", null, true, function () {
}, function (result) {
if (result.code === 200) {
setSelectValue(result.data, 'processId','请选择工序类型');
diff --git a/src/main/resources/static/js/system/role.js b/src/main/resources/static/js/system/role.js
index c861647..a5b34f5 100644
--- a/src/main/resources/static/js/system/role.js
+++ b/src/main/resources/static/js/system/role.js
@@ -106,12 +106,18 @@ function initTable(dataList, limit, page) {
}
},
{
- field: "roleCode",
- title: "角色编码",
+ field: "",
+ title: "角色级别",
unresize: true,
align: "center",
templet: function(d) {
- return '' + d.roleCode + '
';
+ var name = "";
+ if(d.level == 0){
+ name = "项目部级"
+ }else{
+ name = "公司级"
+ }
+ return '' + name + '
';
}
},
{
@@ -124,6 +130,13 @@ function initTable(dataList, limit, page) {
}
},
{
+ field: "updateTime",
+ title: "更新时间",
+ unresize: true,
+ align: "center"
+ },
+ {field: "state", title: "状态", align: "center", templet: '#is-state'},
+ /*{
field: "orgName",
title: "上级组织",
unresize: true,
@@ -131,14 +144,14 @@ function initTable(dataList, limit, page) {
templet: function(d) {
return '' + d.orgName + '
';
}
- },
- {
+ },*/
+ /*{
field: "createTime",
title: "创建时间",
unresize: true,
align: "center"
- },
- {field: "state", title: "状态", align: "center", templet: '#is-state'},
+ },*/
+
{
title: "操作",
unresize: true,
diff --git a/src/main/resources/static/pages/imageUpload/safetyViolations/child/safetyViolationsForm.html b/src/main/resources/static/pages/imageUpload/safetyViolations/child/safetyViolationsForm.html
index 3032787..f79d410 100644
--- a/src/main/resources/static/pages/imageUpload/safetyViolations/child/safetyViolationsForm.html
+++ b/src/main/resources/static/pages/imageUpload/safetyViolations/child/safetyViolationsForm.html
@@ -56,13 +56,11 @@
-
-
-
-
@@ -52,6 +32,37 @@
+
+
+
+
+
+
+
+
+