万材erp项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

277 lines
13 KiB

<!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="sopId" th:field="*{sopId}" type="hidden">
<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" 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" 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">
</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">
</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}">
<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}">
<div class="file-loading">
<input class="form-control file-upload" id="drawingFile" name="file" type="file">
</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}">
<div class="file-loading">
<input class="form-control file-upload" id="workhourFile" name="file" type="file">
</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}">
<div class="file-loading">
<input class="form-control file-upload" id="sopFile" name="file" type="file">
</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}">
<div class="file-loading">
<input class="form-control file-upload" id="sipFile" name="file" type="file">
</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}">
<div class="file-loading">
<input class="form-control file-upload" id="sppFile" name="file" type="file">
</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}">
<div class="file-loading">
<input class="form-control file-upload" id="bomFile" name="file" type="file">
</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}">
<div class="file-loading">
<input class="form-control file-upload" id="customerFile" name="file" type="file">
</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}">
<div class="file-loading">
<input class="form-control file-upload" id="otherFile" name="file" type="file">
</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">
<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">
</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">
<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">
</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">
</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')}">
<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/list",
success:function(data){
// console.log(data)
var customerData = data.rows
// console.log(customerData)
for(i=0;i<data.rows.length;i++){
$("#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({
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>