zhangsiqi
5 months ago
4 changed files with 441 additions and 223 deletions
@ -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> |
Loading…
Reference in new issue