|
|
@ -30,7 +30,7 @@ |
|
|
|
</head> |
|
|
|
<body class="white-bg"> |
|
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|
|
|
<form class="form-horizontal m" id="form-checkoutMaterial-edit" th:object="${qualityManufacturingCheckoutMaterial}"> |
|
|
|
<form class="form-horizontal m" id="form-checkoutReport-add" th:object="${qualityManufacturingCheckoutMaterial}"> |
|
|
|
<input name="manufacturingCheckoutMaterialId" th:field="*{manufacturingCheckoutMaterialId}" type="hidden"> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">料号:</label> |
|
|
@ -57,6 +57,10 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="form-group" hidden="hidden"> |
|
|
|
<input id="uniqueIdList" name="uniqueIdList" class="form-control" type="text"> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="container mt-5"> |
|
|
|
<div class="btn-group-sm"> |
|
|
|
<span>选择制程工序</span> |
|
|
@ -78,36 +82,20 @@ |
|
|
|
var manufacturingProcessNameDatas = [[${@dict.getType('manufacturing_process_name')}]]; |
|
|
|
var processBadClassificationDatas = [[${@dict.getType('process_bad_classification')}]]; |
|
|
|
var processBadGradeDatas = [[${@dict.getType('process_bad_grade')}]]; |
|
|
|
var prefix = ctx + "quality/checkoutMaterial"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#form-checkoutMaterial-edit").validate({focusCleanup: true}); |
|
|
|
var prefix = ctx + "quality/manufacturingCheckout"; |
|
|
|
var uniqueIdList = []; |
|
|
|
var manufacturingProcessList = []; |
|
|
|
var materialProcessList = []; |
|
|
|
|
|
|
|
$("#form-checkoutReport-add").validate({focusCleanup: true}); |
|
|
|
|
|
|
|
|
|
|
|
function submitHandler() { |
|
|
|
if ($.validate.form()) { |
|
|
|
$.operate.save(prefix + "/edit", $('#form-checkoutMaterial-edit').serialize()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$("input[name='checkoutTime']").datetimepicker({ |
|
|
|
format: "yyyy-mm-dd", |
|
|
|
minView: "month", |
|
|
|
autoclose: true |
|
|
|
}); |
|
|
|
|
|
|
|
$("input[name='checkoutCompletionTime']").datetimepicker({ |
|
|
|
format: "yyyy-mm-dd", |
|
|
|
minView: "month", |
|
|
|
autoclose: true |
|
|
|
}); |
|
|
|
|
|
|
|
function insertRow() { |
|
|
|
var currentTimeStamp = new Date().getTime(); // 获取当前时间的时间戳 |
|
|
|
var uniqueId = "ID_" + currentTimeStamp; // 为ID添加前缀并使用时间戳 |
|
|
|
console.log(uniqueId); |
|
|
|
uniqueIdList.push(uniqueId); |
|
|
|
$('#uniqueIdList').val(uniqueIdList); |
|
|
|
// console.log(uniqueId); |
|
|
|
var newItem = |
|
|
|
"<div class='container bordered-container'>" + |
|
|
|
"<div class='col-sm-12 my-3'>" + |
|
|
@ -121,11 +109,11 @@ |
|
|
|
'<form id="form-manfa-'+ uniqueId +'"> ' + |
|
|
|
"<div class='form-group'> "+ |
|
|
|
"<label for='okAcceptedNum'>OK允收数:</label>" + |
|
|
|
"<input type='text' class='form-control' id='okAcceptedNum'>"+ |
|
|
|
"<input type='text' class='form-control' id='okAcceptedNum' name='okAcceptedNum'>"+ |
|
|
|
"</div>"+ |
|
|
|
" <div class='form-group'> "+ |
|
|
|
"<label for='qualifiedNum'>特采/让步数:</label>" + |
|
|
|
"<input type='text' class='form-control' id='specialConcessionsNum' >"+ |
|
|
|
"<input type='text' class='form-control' id='specialConcessionsNum' name='specialConcessionsNum'>"+ |
|
|
|
"</div>"+ |
|
|
|
"</form>"+ |
|
|
|
"</div>" + |
|
|
@ -161,7 +149,7 @@ |
|
|
|
formatter: function (value, row, index) { |
|
|
|
var tableId = bootstarpId; |
|
|
|
var selectId = 'select-manufacturingProcess-' + uniqueId; |
|
|
|
var td = '<select onchange="handleManufacturingProcessChange(this, \'' + tableId + '\',\'' + selectId + '\',\'' + row + '\',\'' + index + '\')" name="manufacturingProcessCode" id="' + selectId + '"></select>'; |
|
|
|
var td = '<select class="form-control" onchange="handleManufacturingProcessChange(this, \'' + tableId + '\',\'' + selectId + '\',\'' + index + '\')" name="manufacturingProcessCode" id="' + selectId + '"></select>'; |
|
|
|
// 这里不需要直接调用selectProcess,而是在用户交互时由事件处理 |
|
|
|
return td; |
|
|
|
} |
|
|
@ -169,7 +157,9 @@ |
|
|
|
{ |
|
|
|
title: '制程工序名称', |
|
|
|
field: 'manufacturingProcessName', |
|
|
|
|
|
|
|
formatter:function (index,row,value){ |
|
|
|
return $.common.dictToSelect(manufacturingProcessNameDatas,value,'manufacturingProcessName'); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '设备名称', |
|
|
@ -191,7 +181,10 @@ |
|
|
|
title: '零件名称', |
|
|
|
field: 'modName', |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
title: '工序检验项目', |
|
|
|
field: 'processInspectionItem', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
align: 'center', |
|
|
@ -264,7 +257,7 @@ |
|
|
|
modName: '' |
|
|
|
} |
|
|
|
}); |
|
|
|
selectProcessCode(); |
|
|
|
selectProcessCode(bootstarpId); |
|
|
|
}; |
|
|
|
// 新增 insertUnqualifiedRow 函数 |
|
|
|
function insertUnqualifiedRow(tableId) { |
|
|
@ -282,18 +275,23 @@ |
|
|
|
|
|
|
|
} |
|
|
|
//查询所有的制程工序编号 |
|
|
|
function selectProcessCode(){ |
|
|
|
function selectProcessCode(tableId){ |
|
|
|
$.ajax({ |
|
|
|
url: ctx + 'quality/manufacturingCheckout/getProcessCodeList', |
|
|
|
type: "post", |
|
|
|
dataType: "json", |
|
|
|
success: function (res) { |
|
|
|
console.log(res); |
|
|
|
// console.log(res); |
|
|
|
var $select = $('#' + tableId).find('select[name="manufacturingProcessCode"]'); |
|
|
|
$select.empty(); |
|
|
|
$select.append( |
|
|
|
"<option value=''>" + '请选择' + "</option>"); |
|
|
|
if (res.rows.length > 0) { |
|
|
|
var usertData = res.rows; |
|
|
|
for (let i in usertData) { |
|
|
|
$("select[name='manufacturingProcessCode']").append( |
|
|
|
$select.append( |
|
|
|
"<option value='" + usertData[i].manufacturingProcessCode + "'>" + usertData[i].manufacturingProcessCode + "</option>"); |
|
|
|
manufacturingProcessList.push(usertData[i].manufacturingProcessCode); |
|
|
|
} |
|
|
|
}else { |
|
|
|
$.modal.error("数据为空"); |
|
|
@ -301,7 +299,17 @@ |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 重新初始化下拉框列表 |
|
|
|
function initSelector(tableId) { |
|
|
|
var $select = $('#' + tableId).find('select[name="manufacturingProcessCode"]'); |
|
|
|
console.log($select); |
|
|
|
$select.empty(); |
|
|
|
$select.append("<option value=''>" + '请选择' + "</option>"); |
|
|
|
for (let i in manufacturingProcessList) { |
|
|
|
$select.append( |
|
|
|
"<option value='" + manufacturingProcessList[i] + "'>" + manufacturingProcessList[i] + "</option>"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 新增一个处理制程工序编号下拉改变的函数 |
|
|
|
// function handleManufacturingProcessChange(selectElement, tableId,selectId,row) { |
|
|
@ -317,7 +325,7 @@ |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
function handleManufacturingProcessChange(selectElement, tableId, selectId, row,index) { |
|
|
|
function handleManufacturingProcessChange(selectElement, tableId, selectId, index) { |
|
|
|
var selectedValue = $(selectElement).val(); |
|
|
|
if (selectedValue) { |
|
|
|
$.ajax({ |
|
|
@ -334,15 +342,21 @@ |
|
|
|
deviceModelCode: newData.deviceModelCode || '', |
|
|
|
processSequence: newData.processSequence || '', |
|
|
|
workshopName: newData.workshopName || '', |
|
|
|
modName: newData.modName || '' |
|
|
|
modName: newData.modName || '', |
|
|
|
processInspectionItem: newData.processInspectionItem || '', |
|
|
|
}; |
|
|
|
|
|
|
|
var processName = newData.manufacturingProcessName; |
|
|
|
// 使用Bootstrap Table的updateRow方法更新表格数据,注意这里使用传入的索引 |
|
|
|
$('#' + tableId).bootstrapTable('updateRow', { |
|
|
|
index: index, // 使用传递进来的索引 |
|
|
|
row: newRowData |
|
|
|
}); |
|
|
|
// $('#' + tableId).find('select[name="manufacturingProcessCode"]').val(selectedValue); |
|
|
|
// 重新初始化下拉框 |
|
|
|
initSelector(tableId); |
|
|
|
// 下拉框赋值 |
|
|
|
$('#' + tableId).find('select[name="manufacturingProcessCode"]').val(selectedValue); |
|
|
|
$('#' + tableId).find('select[name="manufacturingProcessName"]').val(processName); |
|
|
|
|
|
|
|
} else { |
|
|
|
console.error('后端请求数据为空'); |
|
|
|
} |
|
|
@ -365,12 +379,63 @@ |
|
|
|
|
|
|
|
function removeUnqualifiedClassRow(id) { |
|
|
|
alert("实施删除不合格分类行操作,id: " + id); // 实现删除逻辑 |
|
|
|
|
|
|
|
} |
|
|
|
function selectProcess(tableId,selectId){ |
|
|
|
console.log(tableId); |
|
|
|
console.log(selectId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// function submitHandler() { |
|
|
|
// var materialNo = $('#form-checkoutReport-add').find('input[name="materialNo"]').val(); |
|
|
|
// var materialName = $('#form-checkoutReport-add').find('input[name="materialName"]').val(); |
|
|
|
// $('.container.bordered-container').each(function(index, tableElement) { |
|
|
|
// var tableId = uniqueIdList[index]; |
|
|
|
// var $processTable = $('#bootstrap-manufacturingProcess-table-'+tableId); |
|
|
|
// var rows = $processTable.bootstrapTable('getData'); |
|
|
|
// var manufacturingProcessCode = $processTable.find('select[name="manufacturingProcessCode"]').val(); |
|
|
|
// |
|
|
|
// var okAcceptedNum = $('#form-manfa-'+tableId).find('input[name="okAcceptedNum"]').val(); |
|
|
|
// var specialConcessionsNum = $('#form-manfa-'+tableId).find('input[name="specialConcessionsNum"]').val(); |
|
|
|
// var materialProcess = { |
|
|
|
// materialNo: materialNo, |
|
|
|
// materialName: materialName, |
|
|
|
// manufacturingProcessCode: manufacturingProcessCode, |
|
|
|
// manufacturingProcessName: rows[0].manufacturingProcessName, |
|
|
|
// deviceName: rows[0].deviceName, |
|
|
|
// deviceModelCode: rows[0].deviceModelCode, |
|
|
|
// processSequence: rows[0].processSequence, |
|
|
|
// workshopName: rows[0].workshopName, |
|
|
|
// modName: rows[0].modName, |
|
|
|
// okAcceptedNum: okAcceptedNum, |
|
|
|
// specialConcessionsNum: specialConcessionsNum, |
|
|
|
// unqualifiedClassList: [] |
|
|
|
// }; |
|
|
|
// // console.log("okAcceptedNum:"+okAcceptedNum+"specialConcessionsNum:"+specialConcessionsNum); |
|
|
|
// |
|
|
|
// var unqualifiedRows = $('#bootstrap-unqualifiedClass-table-'+tableId).bootstrapTable('getData'); |
|
|
|
// for (var i = 0; i < unqualifiedRows.length; i++) { |
|
|
|
// var row = unqualifiedRows[i]; |
|
|
|
// // 获取 '不良分类' 列的 <select> 元素的当前值 |
|
|
|
// var processBadClassificationValue = $('#bootstrap-unqualifiedClass-table-' + tableId + ' tbody tr:eq(' + i + ') select[name="processBadClassification"]').val(); |
|
|
|
// var processBadGradeValue = $('#bootstrap-unqualifiedClass-table-' + tableId + ' tbody tr:eq(' + i + ') select[name="processBadGrade"]').val(); |
|
|
|
// |
|
|
|
// // 更新原始数据对象 |
|
|
|
// row.processBadClassification = processBadClassificationValue; |
|
|
|
// row.processBadGrade = processBadGradeValue; |
|
|
|
// |
|
|
|
// var unquilifiedClass = { |
|
|
|
// processBadClassification: row.processBadClassification, |
|
|
|
// processBadGrade: row.processBadGrade, |
|
|
|
// processBadNum: row.processBadNum, |
|
|
|
// } |
|
|
|
// materialProcess.unqualifiedClassList.push(unquilifiedClass); |
|
|
|
// } |
|
|
|
// materialProcessList.push(materialProcess); |
|
|
|
// }); |
|
|
|
// localStorage.setItem('materialProcessList'+materialNo,JSON.stringify(materialProcessList)); |
|
|
|
// // $.operate.saveJson(prefix + '/checkoutReport',JSON.stringify(materialProcessList)); |
|
|
|
// } |
|
|
|
</script> |
|
|
|
</body> |
|
|
|
</html> |
|
|
|