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.
287 lines
12 KiB
287 lines
12 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" />
|
|
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
|
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
|
|
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
|
|
<style type="text/css">
|
|
.other-container {
|
|
width: 100%;
|
|
height: 500px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="white-bg">
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
<form class="form-horizontal m" id="form-sop-add">
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">成品代码:</label>
|
|
<div class="col-sm-8">
|
|
<select name="sopCode" id="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">成品名称:</label>
|
|
<div class="col-sm-8">
|
|
<input name="sopName" id="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" id="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" id="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')}">
|
|
<option value=""></option>
|
|
<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">
|
|
<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">
|
|
<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">
|
|
<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">
|
|
<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">
|
|
<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">
|
|
<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">
|
|
<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">
|
|
<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" id="enterpriseCode" class="form-control m-b">
|
|
<option value="">所有</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" 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" 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" 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" 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: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 :: select2-js"/>
|
|
<th:block th:include="include :: datetimepicker-js" />
|
|
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
|
<script th:inline="javascript">
|
|
var prefix = ctx + "system/sop";
|
|
var prefix1 = ctx + "system/finishproduct";
|
|
var inventoryUnitDatas = [[${@dict.getType('sys_unit_class')}]];
|
|
var gpItemSelectionDatas = [[${@dict.getType('sys_gp_Item_selection')}]];
|
|
var whetherStopDatas = [[${@dict.getType('sys_whether')}]];
|
|
var materialCategoryDatas = [[${@dict.getType('sys_material_category')}]];
|
|
var productionCategoryDatas = [[${@dict.getType('sys_production_category')}]];
|
|
var finishProductCategoryDatas = [[${@dict.getType('sys_finish_product_category')}]];
|
|
|
|
|
|
$("#form-sop-add").validate({
|
|
focusCleanup: true
|
|
});
|
|
|
|
function submitHandler() {
|
|
if ($.validate.form()) {
|
|
console.log($('#form-sop-add').serialize())
|
|
$.operate.save(prefix + "/add", $('#form-sop-add').serialize());
|
|
}
|
|
}
|
|
|
|
$("input[name='dateOfRegistration']").datetimepicker({
|
|
format: "yyyy-mm-dd",
|
|
minView: "month",
|
|
autoclose: true
|
|
});
|
|
|
|
let userName = [[${@permission.getPrincipalProperty('userName')}]];
|
|
$("input[name='dateOfRegistration']").datetimepicker('setDate',new Date());
|
|
$("input[name='sopRegistrant']").val(userName)
|
|
|
|
$(".file-upload").fileinput({
|
|
uploadUrl: prefix + '/upload',
|
|
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('')
|
|
})
|
|
|
|
$(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-add select[name='customerCode']").append("<option value='" + customerData[i].enterpriseCode + "'>" + customerData[i].enterpriseCode + "</option>");
|
|
}
|
|
$("#form-sop-add select[name='customerCode']").change(function () {
|
|
var code = $(this).val();
|
|
for (let i=0;i<customerData.length;i++) {
|
|
if (customerData[i].enterpriseCode == code) {
|
|
$("#form-sop-add 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-add select[name='sopCode']").append("<option value='" + finishProductData[i].finishProductCode + "'>" + finishProductData[i].finishProductCode + "</option>");
|
|
}
|
|
$("#form-sop-add select[name='sopCode']").change(function () {
|
|
var code = $(this).val();
|
|
for (let i=0;i<finishProductData.length;i++) {
|
|
if (finishProductData[i].finishProductCode == code) {
|
|
$("#form-sop-add input[name='sopName']").val(finishProductData[i].finishProductName);
|
|
$("#form-sop-add input[name='sopModel']").val(finishProductData[i].specificationModel);
|
|
$("#form-sop-add input[name='typeOfMachine']").val(finishProductData[i].typeMachine);
|
|
$("#form-sop-add select[name='sopUnit']").val(finishProductData[i].inventoryUnit).trigger("change");
|
|
|
|
}
|
|
}
|
|
})
|
|
|
|
} else {
|
|
$.modal.msgError(res.msg);
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|