Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
9a0922bdb1
|
|
@ -5,13 +5,17 @@ import com.bonus.imgTool.annotation.LogAnnotation;
|
|||
import com.bonus.imgTool.basic.service.ProcessService;
|
||||
import com.bonus.imgTool.basic.vo.ProcessVo;
|
||||
import com.bonus.imgTool.basic.vo.dto.ProcessDto;
|
||||
import com.bonus.imgTool.model.SysUser;
|
||||
import com.bonus.imgTool.system.vo.EncryptedReq;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -30,13 +34,29 @@ public class ProcessController {
|
|||
@LogAnnotation(operModul = "工序管理", operation = "查询列表", operDesc = "系统级事件",operType="查询")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:process:query')" )
|
||||
public ServerResponse getProcessList(EncryptedReq<ProcessDto> data) {
|
||||
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
|
||||
try {
|
||||
List<ProcessVo> list = service.getProcessList(data.getData());
|
||||
return ServerResponse.createSuccess(list);
|
||||
PageInfo<ProcessVo> pageInfo = new PageInfo<>(list);
|
||||
return ServerResponse.createSuccessPage(pageInfo,data.getData().getPage(),data.getData().getLimit());
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
return ServerResponse.createErrorPage(data.getData().getPage(),data.getData().getLimit());
|
||||
}
|
||||
|
||||
@GetMapping(value = "getProcessDetail")
|
||||
@DecryptAndVerify(decryptedClass = ProcessDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "工序管理", operation = "查询单个工序",operType="查询")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:process:query')" )
|
||||
public ServerResponse getProcessDetail(EncryptedReq<ProcessDto> data) {
|
||||
try {
|
||||
ProcessVo processVo = service.getProcessDetail(data.getData());
|
||||
return ServerResponse.createSuccess(processVo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("获取数据失败");
|
||||
}
|
||||
|
||||
@PostMapping(value = "insertProcess")
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface ProcessDao {
|
||||
List<ProcessVo> getProcessList(ProcessDto data);
|
||||
ProcessVo getProcessDetail(ProcessDto data);
|
||||
|
||||
int insertProcess(ProcessDto bean);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import java.util.List;
|
|||
public interface ProcessService {
|
||||
|
||||
List<ProcessVo> getProcessList(ProcessDto data);
|
||||
ProcessVo getProcessDetail(ProcessDto data);
|
||||
|
||||
int getProcessById(ProcessDto bean);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ public class ProcessServiceImpl implements ProcessService {
|
|||
return dao.getProcessList(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcessVo getProcessDetail(ProcessDto data) {
|
||||
return dao.getProcessDetail(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessById(ProcessDto bean) {
|
||||
return dao.getProcessById(bean);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.imgTool.basic.vo.dto;
|
||||
|
||||
import com.bonus.imgTool.base.entity.PageEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -10,7 +11,7 @@ import lombok.Data;
|
|||
* @description:下拉选-dto
|
||||
*/
|
||||
@Data
|
||||
public class ProcessDto {
|
||||
public class ProcessDto extends PageEntity {
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
</sql>
|
||||
|
||||
<insert id="insertProcess">
|
||||
insert into tb_gx(gx_id,gx_name,major_id,create_user_id,create_user_name)
|
||||
values(#{processId},#{processName},#{professionId},#{createUserId},#{createUserName})
|
||||
insert into tb_gx(gx_name,major_id,create_user_id,create_user_name)
|
||||
values(#{processName},#{professionId},#{createUserId},#{createUserName})
|
||||
</insert>
|
||||
|
||||
<update id="updateProcess">
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
tg.major_id as professionId,
|
||||
sd.dict_name as professionName,
|
||||
is_use as status,
|
||||
tg.create_time
|
||||
tg.create_time as createTime
|
||||
FROM
|
||||
tb_gx tg
|
||||
LEFT JOIN sys_distinct sd ON sd.p_id = 108
|
||||
|
|
@ -79,6 +79,23 @@
|
|||
and gx_id != #{processId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getProcessDetail" resultType="com.bonus.imgTool.basic.vo.ProcessVo">
|
||||
SELECT
|
||||
tg.gx_id as processId,
|
||||
tg.gx_name as processName,
|
||||
tg.major_id as professionId,
|
||||
sd.dict_name as professionName,
|
||||
is_use as status,
|
||||
tg.create_time as createTime
|
||||
FROM
|
||||
tb_gx tg
|
||||
LEFT JOIN sys_distinct sd ON sd.p_id = 108
|
||||
AND tg.major_id = sd.dict_value and del_flag = 0
|
||||
<where>
|
||||
tg.is_active = 1
|
||||
and tg.gx_id = #{processId}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ let majorList;
|
|||
|
||||
function setParams(params) {
|
||||
console.log(params)
|
||||
idParam = JSON.parse(params).id;
|
||||
idParam = JSON.parse(params).processId;
|
||||
layui.config({
|
||||
base: "../../../js/layui-v2.6.8/dtree/", //此处路径请自行处理, 可以使用绝对路径
|
||||
}).extend({
|
||||
|
|
@ -18,21 +18,21 @@ function setParams(params) {
|
|||
dtree = layui.dtree;
|
||||
var $ = layui.jquery;
|
||||
majorList = getMajorSelected();
|
||||
|
||||
if (idParam) {
|
||||
getProcessById();
|
||||
}
|
||||
// form.render();
|
||||
form.render("checkbox","select");//重新渲染页面checkbox控件
|
||||
form.render("checkbox", "select");//重新渲染页面checkbox控件
|
||||
form.on('submit(formData)', function (data) {
|
||||
data.field.id = $('#id').val();
|
||||
console.log( data.field.orgId_select_nodeId);
|
||||
|
||||
let major = $('#major').val();
|
||||
if (!major) {
|
||||
return layer.alert("请选择专业名", {icon: 2})
|
||||
}
|
||||
let processes = $('#processes').val();
|
||||
if (!processes) {
|
||||
return layer.alert("请输入工序名", {icon: 2})
|
||||
var str = $('#professionName').val();
|
||||
let professionId = str.split(",")[0];
|
||||
let professionName = str.split(",")[1];
|
||||
data.field.professionId = professionId;
|
||||
data.field.professionName = professionName;
|
||||
if (idParam) {
|
||||
data.field.processId = idParam;
|
||||
}
|
||||
data.field.status = 1;
|
||||
saveData(data);
|
||||
});
|
||||
|
||||
|
|
@ -45,14 +45,14 @@ function setParams(params) {
|
|||
*/
|
||||
function getMajorSelected() {
|
||||
let url = ctxPath + '/dicts/type';
|
||||
let obj = {"type":"profession"}
|
||||
let obj = {"type": "profession"}
|
||||
let params = {
|
||||
encryptedData: encryptCBC(JSON.stringify(obj))
|
||||
}
|
||||
ajaxRequest(url, "POST", params, true, function () {
|
||||
ajaxRequest(url, "POST", params, false, function () {
|
||||
}, function (result) {
|
||||
if (result.code === 200) {
|
||||
setSelectValue(result.data, 'major');
|
||||
setSelectValue(result.data, 'professionName');
|
||||
} else {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
|
|
@ -62,12 +62,13 @@ function getMajorSelected() {
|
|||
|
||||
}
|
||||
|
||||
function setSelectValue(data){
|
||||
function setSelectValue(data) {
|
||||
let html = '<option value="" selected>请选择</option>';
|
||||
$.each(data, function (index, item) {
|
||||
html += '<option value="' + item.id + '">' + item.dictName + '</option>';
|
||||
let optionValue = item.dictValue + ',' + item.dictName;
|
||||
html += '<option value="' + optionValue + '">' + item.dictName + '</option>';
|
||||
})
|
||||
$('#major').empty().append(html);
|
||||
$('#professionName').empty().append(html);
|
||||
layui.form.render();
|
||||
}
|
||||
|
||||
|
|
@ -78,16 +79,20 @@ function saveData2() {
|
|||
// 保存数据
|
||||
function saveData(data) {
|
||||
let loadingMsg = layer.msg('数据上传中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
||||
let url = dataUrl + "/users/addTemp";
|
||||
let url = dataUrl + "/basic/process/insertProcess";
|
||||
let params = data.field;
|
||||
var arr_box = [];//固定复选框
|
||||
$('#cbGuDing input[type=checkbox]:checked').each(function () {
|
||||
arr_box.push($(this).val());
|
||||
});
|
||||
console.log(arr_box)
|
||||
/* params={
|
||||
encryptedData:encryptCBC(JSON.stringify(params))
|
||||
}*/
|
||||
if (params.processId != null) {
|
||||
data.field.status = null;
|
||||
url = dataUrl + "/basic/process/updateProcess";
|
||||
}
|
||||
params = {
|
||||
encryptedData: encryptCBC(JSON.stringify(params))
|
||||
}
|
||||
ajaxRequest(url, "POST", params, true, function () {
|
||||
$('.save').addClass("layui-btn-disabled").attr("disabled", true);
|
||||
$('.cancel').addClass("layui-btn-disabled").attr("disabled", true);
|
||||
|
|
@ -108,6 +113,44 @@ function saveData(data) {
|
|||
error(xhr)
|
||||
});
|
||||
}
|
||||
|
||||
// 根据id获取用户信息
|
||||
function getProcessById() {
|
||||
let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
||||
let url = dataUrl + "/basic/process/getProcessDetail";
|
||||
let params = {
|
||||
processId: idParam
|
||||
}
|
||||
console.log(params)
|
||||
params = {
|
||||
encryptedData: encryptCBC(JSON.stringify(params))
|
||||
}
|
||||
ajaxRequest(url, "GET", params, true, function () {
|
||||
}, function (result) {
|
||||
layer.close(loadingMsg); // 关闭提示层
|
||||
if (result.code === 200) {
|
||||
console.log(result)
|
||||
setFormData(result.data);
|
||||
} else if (result.code === 500) {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
}, function (xhr) {
|
||||
layer.close(loadingMsg); // 关闭提示层
|
||||
error(xhr)
|
||||
});
|
||||
}
|
||||
|
||||
// 设置表单内容
|
||||
function setFormData(data) {
|
||||
console.log("data:", data)
|
||||
if (data) {
|
||||
$('#processName').val(data.processName)
|
||||
let optionValue = data.professionId + ',' + data.professionName;
|
||||
$('#professionName').val(optionValue); // 使用 jQuery 的 .val() 方法设置选中值
|
||||
form.render('select');
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭页面
|
||||
function closePage(type) {
|
||||
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
||||
|
|
|
|||
|
|
@ -14,22 +14,22 @@ layui.config({
|
|||
layui.form.render();
|
||||
pages(1, 10, 1);
|
||||
form.on('switch(is-state)', function (obj) {
|
||||
console.log(obj);
|
||||
let url = dataUrl + "/users/updateEnableState";
|
||||
console.log(JSON.stringify(obj) + "obj");
|
||||
let url = dataUrl + "/basic/process/updateProcessStatus";
|
||||
let params = {
|
||||
'id': this.value,
|
||||
'state': obj.elem.checked ? 1 : 0
|
||||
'processId': obj.value,
|
||||
'status': obj.elem.checked ? 1 : 0
|
||||
}
|
||||
params={
|
||||
encryptedData:encryptCBC(JSON.stringify(params))
|
||||
}
|
||||
// params={
|
||||
// encryptedData:encryptCBC(JSON.stringify(params))
|
||||
// }
|
||||
ajaxRequest(url, "POST", params, true, function () {}, function (result) {
|
||||
console.log(result)
|
||||
reloadData();
|
||||
if (result.status === 200) {
|
||||
parent.layer.msg(result.data, {icon: 1})
|
||||
parent.layer.msg("操作成功", {icon: 1})
|
||||
} else if (result.status === 204) {
|
||||
parent.layer.alert(result.msg, {icon: 2})
|
||||
parent.layer.alert("操作失败", {icon: 2})
|
||||
}
|
||||
}, function (xhr) {
|
||||
error(xhr)
|
||||
|
|
@ -39,8 +39,8 @@ layui.config({
|
|||
|
||||
function pages(pageNum, pageSize, typeNum) {
|
||||
let params = getReqParams(pageNum, pageSize, typeNum);
|
||||
let url = dataUrl + "/users/getList"
|
||||
ajaxRequest(url, "POST", params, true, function () {
|
||||
let url = dataUrl + "/basic/process/getProcessList"
|
||||
ajaxRequest(url, "GET", params, true, function () {
|
||||
}, function (result) {
|
||||
console.log(result);
|
||||
if (result.code === 200) {
|
||||
|
|
@ -94,17 +94,17 @@ function initTable(dataList, limit, page) {
|
|||
return (page - 1) * limit + d.LAY_INDEX;
|
||||
}
|
||||
},
|
||||
{field: "loginName", title: "专业", unresize: true, align: "center"},
|
||||
{field: "username", title: "工序", unresize: true, align: "center"},
|
||||
{field: "state", title: "状态", align: "center",templet: '#is-state'},
|
||||
{field: "professionName", title: "专业", unresize: true, align: "center"},
|
||||
{field: "processName", title: "工序", unresize: true, align: "center"},
|
||||
{field: "status", title: "状态", align: "center",templet: '#is-state'},
|
||||
{field: "createTime", title: "创建时间", align: "center",templet: 'center'},
|
||||
{title: "操作", unresize: true, width: 300, align: "center",
|
||||
templet: function (d) {
|
||||
|
||||
let html = '';
|
||||
// let updaetpwd="<a class=\"layui-icon layui-icon-password\" style='cursor:pointer;' title='修改密码' onclick=\"resetPwd('" + d.id + "')\"></a>";
|
||||
let del="<a class=\"layui-icon layui-icon-delete\" style='cursor:pointer;' title='删除' onclick=\"delData('" + d.id + "')\"></a>"
|
||||
let edit="<a class=\"layui-icon layui-icon-edit\" style='cursor:pointer;' title='修改' onclick=\"addProcesses('" + d.id + "')\"></a>";
|
||||
let del="<a class=\"layui-icon layui-icon-delete\" style='cursor:pointer;' title='删除' onclick=\"delData('" + d.processId + "')\"></a>"
|
||||
let edit="<a class=\"layui-icon layui-icon-edit\" style='cursor:pointer;' title='修改' onclick=\"addProcesses('" + d.processId + "')\"></a>";
|
||||
html=edit+del;
|
||||
if(d.delFlag==1){
|
||||
return '';
|
||||
|
|
@ -174,31 +174,35 @@ function reloadData() {
|
|||
openIframe2("addMajorTemp", title, "child/addMajorForm.html", '800px', '200px', param);
|
||||
}*/
|
||||
//新增/修改工序
|
||||
function addProcesses(id) {
|
||||
function addProcesses(processId) {
|
||||
let title = '新增工序'
|
||||
let param = {
|
||||
'id': id
|
||||
if (processId) {
|
||||
title = '修改工序';
|
||||
}
|
||||
let param = {
|
||||
'processId': processId
|
||||
}
|
||||
console.log(param+"param")
|
||||
openIframe2("addProcessesTemp", title, "child/addProcessesForm.html", '800px', '300px', param);
|
||||
}
|
||||
|
||||
/*删除工序*/
|
||||
function delData(id) {
|
||||
function delData(processId) {
|
||||
layer.confirm("确定删除吗?", {
|
||||
move: false
|
||||
}, function () {
|
||||
let loadingMsg = layer.msg('数据删除中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
||||
let url = dataUrl + "/users/delById";
|
||||
let url = dataUrl + "/basic/process/delProcessById";
|
||||
let params = {
|
||||
'id': id
|
||||
'processId': processId
|
||||
}
|
||||
/* params={
|
||||
params={
|
||||
encryptedData:encryptCBC(JSON.stringify(params))
|
||||
}*/
|
||||
ajaxRequest(url, "POST", params, true, function () {
|
||||
}
|
||||
ajaxRequest(url, "DELETE", params, true, function () {
|
||||
}, function (result) {
|
||||
layer.close(loadingMsg); // 关闭提示层
|
||||
if (result.code === 200) {
|
||||
layer.close(loadingMsg); // 关闭提示层
|
||||
parent.layer.msg(result.msg, {icon: 1})
|
||||
query()
|
||||
} else if (result.code === 500) {
|
||||
|
|
@ -210,14 +214,3 @@ function delData(id) {
|
|||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/*下拉选表单赋值*/
|
||||
function setSelectValue(list, selectName) {
|
||||
let html = '<option value="" selected>单位部门</option>';
|
||||
$.each(list, function (index, item) {
|
||||
html += '<option value="' + item.id + '">' + item.name + '</option>';
|
||||
})
|
||||
$('#' + selectName).empty().append(html);
|
||||
layui.form.render();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,11 @@
|
|||
<body>
|
||||
<div id="main-box">
|
||||
<form class="layui-form" onsubmit="return false;">
|
||||
<input hidden id="id">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>专业</label>
|
||||
<div class="layui-input-inline">
|
||||
<select id="major" lay-verify="required" name="major" class="form-control input-sm">
|
||||
<select id="professionName" lay-verify="required" name="professionName" class="form-control input-sm">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -31,7 +30,7 @@
|
|||
<div class="layui-form-item" style="margin-top: 2%;">
|
||||
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>工序</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" id="processes" name="processes" autocomplete="off"
|
||||
<input class="layui-input" id="processName" name="processName" autocomplete="off"
|
||||
lay-verify="required" maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -61,9 +61,9 @@
|
|||
</style>
|
||||
|
||||
<script type="text/html" id="is-state">
|
||||
<input type="checkbox" name="state" value="{{d.id}}" lay-skin="switch" lay-text="开|关"
|
||||
<input type="checkbox" name="state" value="{{d.processId}}" lay-skin="switch" lay-text="开|关"
|
||||
lay-filter="is-state"
|
||||
{{ d.state== 1 ? 'checked' : '' }}>
|
||||
{{ d.status== 1 ? 'checked' : '' }}>
|
||||
</script>
|
||||
|
||||
<script src="../../js/system/processes.js" charset="UTF-8" type="text/javascript"></script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue