Browse Source

[feat]生产管理:新增成品SOP详情按钮与详情页面。

dev
zhangsiqi 5 months ago
parent
commit
76d2a46319
  1. 14
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSopController.java
  2. 296
      ruoyi-admin/src/main/resources/templates/system/sop/detail.html
  3. 21
      ruoyi-admin/src/main/resources/templates/system/sop/edit.html
  4. 183
      ruoyi-admin/src/main/resources/templates/system/sop/sop.html

14
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSopController.java

@ -104,14 +104,22 @@ public class SysSopController extends BaseController
/**
* 修改SOP
*/
@GetMapping("/edit/{sopId}")
public String edit(@PathVariable("sopId") Long sopId, ModelMap mmap)
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
SysSop sysSop = sysSopService.selectSysSopById(sopId);
SysSop sysSop = sysSopService.selectSysSopById(id);
mmap.put("sysSop", sysSop);
return prefix + "/edit";
}
@GetMapping("/detail/{id}")
public String detail(@PathVariable("id") Long id, ModelMap mmap)
{
SysSop sysSop = sysSopService.selectSysSopById(id);
mmap.put("sysSop", sysSop);
return prefix + "/detail";
}
/**
* 修改保存SOP
*/

296
ruoyi-admin/src/main/resources/templates/system/sop/detail.html

@ -0,0 +1,296 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改SOP')" />
<th:block th:include="include :: datetimepicker-css" />
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-sop-edit" th:object="${sysSop}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">sopId:</label>
<div class="col-sm-8">
<input name="sopId" th:field="*{sopId}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">设备型号:</label>
<div class="col-sm-8">
<input name="equipModel" th:field="*{equipModel}" class="form-control" type="text" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">SOP编号:</label>
<div class="col-sm-8">
<input name="sopNum" th:field="*{sopNum}" class="form-control" type="text" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">品名:</label>
<div class="col-sm-8">
<input name="productName" th:field="*{productName}" class="form-control" type="text" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">描述:</label>
<div class="col-sm-8">
<input name="describe" th:field="*{describe}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">成品代码:</label>
<div class="col-sm-8">
<select name="sopCode" th:field="*{sopCode}" class="form-control m-b" disabled required>
<option value="">所有</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">sop名称:</label>
<div class="col-sm-8">
<input name="sopName" th:field="*{sopName}" class="form-control" type="text" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">规格型号:</label>
<div class="col-sm-8">
<input name="sopModel" th:field="*{sopModel}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">机种:</label>
<div class="col-sm-8">
<input name="typeOfMachine" th:field="*{typeOfMachine}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">单位:</label>
<div class="col-sm-8">
<select name="sopUnit" class="form-control m-b" th:with="type=${@dict.getType('sys_unit_class')}" th:field="*{sopUnit}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">图纸文件:</label>
<div class="col-sm-8">
<input type="hidden" name="drawingFile" th:field="*{drawingFile}" readonly>
<div class="file-loading">
<input class="form-control file-upload" id="drawingFile" name="file" type="file" readonly>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">工时文件:</label>
<div class="col-sm-8">
<input type="hidden" name="workhourFile" th:field="*{workhourFile}" readonly>
<div class="file-loading">
<input class="form-control file-upload" id="workhourFile" name="file" type="file" readonly>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">SOP文件:</label>
<div class="col-sm-8">
<input type="hidden" name="sopFile" th:field="*{sopFile}" readonly>
<div class="file-loading">
<input class="form-control file-upload" id="sopFile" name="file" type="file" readonly>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">SIP文件:</label>
<div class="col-sm-8">
<input type="hidden" name="sipFile" th:field="*{sipFile}" readonly>
<div class="file-loading">
<input class="form-control file-upload" id="sipFile" name="file" type="file" readonly>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">SPP文件:</label>
<div class="col-sm-8">
<input type="hidden" name="sppFile" th:field="*{sppFile}" readonly>
<div class="file-loading">
<input class="form-control file-upload" id="sppFile" name="file" type="file" readonly>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">BOM文件:</label>
<div class="col-sm-8">
<input type="hidden" name="bomFile" th:field="*{bomFile}" readonly>
<div class="file-loading">
<input class="form-control file-upload" id="bomFile" name="file" type="file" readonly>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户文件:</label>
<div class="col-sm-8">
<input type="hidden" name="customerFile" th:field="*{customerFile}" readonly>
<div class="file-loading">
<input class="form-control file-upload" id="customerFile" name="file" type="file" readonly>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">其他文件:</label>
<div class="col-sm-8">
<input type="hidden" name="otherFile" th:field="*{otherFile}" readonly>
<div class="file-loading">
<input class="form-control file-upload" id="otherFile" name="file" type="file" readonly>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户编号:</label>
<div class="col-sm-8">
<select name="customerCode" th:field="*{customerCode}" class="form-control m-b" disabled>
<option value="-1">请选择客户代码</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户名称:</label>
<div class="col-sm-8">
<input name="customerName" id="enterpriseName" th:field="*{customerName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">登记日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="dateOfRegistration" th:field="*{dateOfRegistration}" class="form-control" placeholder="yyyy-MM-dd" type="text" readonly>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">登记人:</label>
<div class="col-sm-8">
<input name="sopRegistrant" th:field="*{sopRegistrant}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注说明:</label>
<div class="col-sm-8">
<input name="sopRemark" th:field="*{sopRemark}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否当前版本:</label>
<div class="col-sm-8">
<select name="currentVersion" class="form-control m-b" th:field="*{currentVersion}" th:with="type=${@dict.getType('sys_whether')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
var prefix = ctx + "system/sop";
var prefix1 = ctx + "system/finishproduct";
var getData = [[${sysSop}]];
console.log(getData)
$("#form-sop-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
console.log($('#form-sop-edit').serialize())
$.operate.save(prefix + "/edit", $('#form-sop-edit').serialize());
}
}
$("input[name='dateOfRegistration']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$(".file-upload").each(function (i) {
var val = $("input[name='" + this.id + "']").val()
$(this).fileinput({
'uploadUrl': prefix + '/upload',
initialPreviewAsData: true,
initialPreview: [val],
maxFileCount: 1,
autoReplace: true
}).on('fileuploaded', function (event, data, previewId, index) {
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
}).on('fileremoved', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('')
})
$(this).fileinput('_initFileActions');
});
$(function () {
getCustomerList();
getFinishProduct();
})
//获取用户资料列表
function getCustomerList() {
$.ajax({
method:"post",
url : ctx + "system/customer/getcode",
success:function(res){
console.log(res)
var customerData = res;
for(let i in customerData){
$("#form-sop-edit select[name='customerCode']").append("<option value='" + customerData[i].enterpriseCode + "'>" + customerData[i].enterpriseCode + "</option>");
}
$("#form-sop-edit select[name='customerCode']").val(getData.customerCode).trigger("change")
}
}
);
}
//成品信息
function getFinishProduct(){
$.ajax({
url: prefix1 + '/list',
type: 'post',
success: function (res) {
// console.log(res)
if (res.rows.length > 0) {
var finishProductData = res.rows;
//alert(JSON.stringify(data));
for (let i in finishProductData) {
// console.log(finishProductData[i].finishProductCode)
$("#form-sop-edit select[name='sopCode']").append("<option value='" + finishProductData[i].finishProductCode + "'>" + finishProductData[i].finishProductCode + "</option>");
}
$("#form-sop-edit select[name='sopCode']").val(getData.sopCode).trigger("change")
$("#form-sop-edit select[name='sopCode']").change(function () {
var code = $(this).val();
for (let i=0;i<finishProductData.length;i++) {
if (finishProductData[i].finishProductCode == code) {
$("#form-sop-edit input[name='sopName']").val(finishProductData[i].finishProductName);
$("#form-sop-edit input[name='sopModel']").val(finishProductData[i].specificationModel);
$("#form-sop-edit input[name='typeOfMachine']").val(finishProductData[i].typeMachine);
$("#form-sop-edit select[name='sopUnit']").val(finishProductData[i].inventoryUnit);
}
}
})
} else {
$.modal.msgError(res.msg);
}
}
})
}
</script>
</body>
</html>

21
ruoyi-admin/src/main/resources/templates/system/sop/edit.html

@ -245,29 +245,18 @@
function getCustomerList() {
$.ajax({
method:"post",
url : ctx + "system/customer/list",
success:function(data){
// console.log(data)
var customerData = data.rows
// console.log(customerData)
for(i=0;i<data.rows.length;i++){
url : ctx + "system/customer/getcode",
success:function(res){
console.log(res)
var customerData = res;
for(let i in customerData){
$("#form-sop-edit select[name='customerCode']").append("<option value='" + customerData[i].enterpriseCode + "'>" + customerData[i].enterpriseCode + "</option>");
}
$("#form-sop-edit select[name='customerCode']").val(getData.customerCode).trigger("change")
$("#form-sop-edit select[name='customerCode']").change(function () {
var code = $(this).val();
for (let i=0;i<customerData.length;i++) {
if (customerData[i].enterpriseCode == code) {
$("#form-sop-edit input[name='customerName']").val(customerData[i].enterpriseName);
}
}
})
}
}
);
}
//成品信息
function getFinishProduct(){
$.ajax({

183
ruoyi-admin/src/main/resources/templates/system/sop/sop.html

@ -56,12 +56,12 @@
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:sop:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:sop:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:sop:remove">
<i class="fa fa-remove"></i> 删除
</a>
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:sop:edit">-->
<!-- <i class="fa fa-edit"></i> 修改-->
<!-- </a>-->
<!-- <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:sop:remove">-->
<!-- <i class="fa fa-remove"></i> 删除-->
<!-- </a>-->
<!-- <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:sop:export">-->
<!-- <i class="fa fa-download"></i> 导出-->
<!-- </a>-->
@ -86,62 +86,35 @@
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
detailUrl: prefix + "/detail/{id}",
sortName: "createTime",
sortOrder: "desc",
showExport: true,
clickToSelect: true,
modalName: "SOP",
columns: [{
checkbox: true
},
{
title: '主键ID',
field: 'id',
visible: false
},
{
field: 'sopId',
title: 'SOPID'
},
{
field: 'sopNum',
title: 'SOP编号'
},
{
field: 'productName',
title: '品名'
},
{
field: 'equipModel',
title: '设备型号'
},
{
field: 'describe',
title: '描述'
},
{
field: 'sopCode',
title: '成品代码'
},
{
field: 'sopName',
title: '成品名称'
},
{
field: 'sopModel',
title: '规格型号'
},
{
field: 'typeOfMachine',
title: '机种'
},
{
field: 'sopUnit',
title: '单位',
formatter: function(value, row, index) {
pageList: [10, 25, 50],
pageSize: 10,
showColumns: false,
fixedColumns: true, // 启用冻结列
fixedRightNumber: 1, // 冻结右列个数
height: $(window).height() - 100,
columns: [
{checkbox: true},
{title: '主键ID',field: 'id',visible: false},
{field: 'sopId',title: 'SOPID'},
{field: 'sopNum',title: 'SOP编号'},
{field: 'productName',title: '品名'},
{field: 'equipModel',title: '设备型号'},
{field: 'describe',title: '描述'},
{field: 'sopCode',title: '成品代码'},
{field: 'sopName',title: '成品名称'},
{field: 'sopModel',title: '规格型号'},
{field: 'typeOfMachine',title: '机种'},
{field: 'sopUnit',title: '单位',formatter: function(value, row, index) {
return $.table.selectDictLabel(sopUnitDatas, value);
}
},
{
field: 'drawingFile',
title: '图纸文件',
{field: 'drawingFile',title: '图纸文件',
formatter: function(value, row, index) {
var actions = [];
if (value !== null) {
@ -151,10 +124,7 @@
return actions.join('');
}
},
{
field: 'workhourFile',
title: '工时文件',
formatter: function(value, row, index) {
{field: 'workhourFile',title: '工时文件',formatter: function(value, row, index) {
var actions = [];
if (value !== null) {
var filepath = value.substring(value.lastIndexOf("/")+1)
@ -163,10 +133,7 @@
return actions.join('');
}
},
{
field: 'sopFile',
title: 'SOP文件',
formatter: function(value, row, index) {
{field: 'sopFile',title: 'SOP文件',formatter: function(value, row, index) {
var actions = [];
if (value !== null) {
var filepath = value.substring(value.lastIndexOf("/")+1)
@ -175,10 +142,7 @@
return actions.join('');
}
},
{
field: 'sipFile',
title: 'SIP文件',
formatter: function(value, row, index) {
{field: 'sipFile',title: 'SIP文件',formatter: function(value, row, index) {
var actions = [];
if (value !== null) {
var filepath = value.substring(value.lastIndexOf("/")+1)
@ -187,10 +151,7 @@
return actions.join('');
}
},
{
field: 'sppFile',
title: 'SPP文件',
formatter: function(value, row, index) {
{field: 'sppFile', title: 'SPP文件',formatter: function(value, row, index) {
var actions = [];
if (value !== null) {
var filepath = value.substring(value.lastIndexOf("/")+1)
@ -199,10 +160,7 @@
return actions.join('');
}
},
{
field: 'bomFile',
title: 'BOM文件',
formatter: function(value, row, index) {
{field: 'bomFile',title: 'BOM文件',formatter: function(value, row, index) {
var actions = [];
if (value !== null) {
var filepath = value.substring(value.lastIndexOf("/")+1)
@ -211,10 +169,7 @@
return actions.join('');
}
},
{
field: 'customerFile',
title: '客户文件',
formatter: function(value, row, index) {
{field: 'customerFile',title: '客户文件',formatter: function(value, row, index) {
var actions = [];
if (value !== null) {
var filepath = value.substring(value.lastIndexOf("/")+1)
@ -223,10 +178,7 @@
return actions.join('');
}
},
{
field: 'otherFile',
title: '其他文件',
formatter: function(value, row, index) {
{field: 'otherFile',title: '其他文件',formatter: function(value, row, index) {
var actions = [];
if (value !== null) {
var filepath = value.substring(value.lastIndexOf("/")+1)
@ -235,37 +187,16 @@
return actions.join('');
}
},
{
field: 'customerCode',
title: '客户编号'
},
{
field: 'customerName',
title: '客户名称'
},
{
field: 'dateOfRegistration',
title: '登记日期'
},
{
field: 'sopRegistrant',
title: '登记人'
},
{
field: 'sopRemark',
title: '备注说明'
},
{
field: 'currentVersion',
title: '是否当前版本',
formatter: function (value, row, index) {
{field: 'customerCode',title: '客户编号'},
{field: 'customerName',title: '客户名称'},
{field: 'dateOfRegistration',title: '登记日期'},
{field: 'sopRegistrant',title: '登记人'},
{field: 'sopRemark',title: '备注说明'},
{field: 'currentVersion',title: '是否当前版本',formatter: function (value, row, index) {
return $.table.selectDictLabel(currentVersionDatas, value);
}
},
{
field: 'createTime',
title: '录入时间',
formatter: function (value, row, index) {
{field: 'createTime',title: '录入时间',formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
@ -273,10 +204,7 @@
}
}
},
{
field: 'updateTime',
title: '上次修改时间',
formatter: function (value, row, index) {
{field: 'updateTime',title: '上次修改时间',formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
@ -284,24 +212,21 @@
return vArr[0];
}
}
}
},
{title: '操作',align: 'center',formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-primary btn-xs " href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-remove"></i>详情</a>');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
// {
// title: '操作',
// align: 'center',
// formatter: function(value, row, index) {
// var actions = [];
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.sopId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.sopId + '\')"><i class="fa fa-remove"></i>删除</a>');
// return actions.join('');
// }
// }
return actions.join('');
}
}
]
};
$.table.init(options);
});
$(function () {
getCustomerList();
});

Loading…
Cancel
Save