|
|
@ -39,8 +39,8 @@ |
|
|
|
<h3>合格数</h3> |
|
|
|
<div class="row"> |
|
|
|
<div class="form-group col-sm-6"> |
|
|
|
<label class="control-label">ok允收数:</label> |
|
|
|
<input name="okAcceptedNum" th:field="*{okAcceptedNum}" class="form-control" type="text"> |
|
|
|
<label class="control-label is-required">ok允收数:</label> |
|
|
|
<input name="okAcceptedNum" th:field="*{okAcceptedNum}" class="form-control" type="text" required> |
|
|
|
</div> |
|
|
|
<div class="form-group col-sm-6"> |
|
|
|
<label class="control-label">ok报告图片:</label> |
|
|
@ -49,8 +49,8 @@ |
|
|
|
</div> |
|
|
|
<div class="row"> |
|
|
|
<div class="form-group col-sm-6"> |
|
|
|
<label class="control-label">特采/让步数:</label> |
|
|
|
<input name="specialConcessionsNum" th:field="*{specialConcessionsNum}" class="form-control" type="text"> |
|
|
|
<label class="control-label is-required">特采/让步数:</label> |
|
|
|
<input name="specialConcessionsNum" th:field="*{specialConcessionsNum}" class="form-control" type="text" required> |
|
|
|
</div> |
|
|
|
<div class="form-group col-sm-6"> |
|
|
|
<label class="control-label">特采报告图片:</label> |
|
|
@ -102,7 +102,7 @@ |
|
|
|
|
|
|
|
var processBadClassificationDatas = [[${@dict.getType('process_bad_classification')}]]; |
|
|
|
var processBadGradeDatas = [[${@dict.getType('process_bad_grade')}]]; |
|
|
|
|
|
|
|
var $table = $("#bootstrap-unqualified-table"); |
|
|
|
var prefix = ctx + "quality/qualityOrder"; |
|
|
|
$("#form-qualityOrderReport-edit").validate({ |
|
|
|
focusCleanup: true |
|
|
@ -188,22 +188,18 @@ |
|
|
|
field: 'qualityOrderReportId', |
|
|
|
visible: false |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '不良分类', |
|
|
|
field: 'processBadClassification', |
|
|
|
formatter: function(index, row, value) { |
|
|
|
return dictToSelectWithEvent(processBadClassificationDatas, value, "processBadClassification", "bootstrap-unqualified-table"); |
|
|
|
|
|
|
|
{title: '不良分类',field: 'processBadClassification', |
|
|
|
formatter:function (value, row, index) { |
|
|
|
return processBadClassificationFormatter(value,row,index); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '不良等级', |
|
|
|
field: 'processBadGrade', |
|
|
|
formatter: function(index, row, value) { |
|
|
|
return dictToSelectWithEvent(processBadGradeDatas, value, "processBadGrade", "bootstrap-unqualified-table"); |
|
|
|
} |
|
|
|
|
|
|
|
{title: '不良等级',field: 'processBadGrade', |
|
|
|
formatter:function (value, row, index) { |
|
|
|
return processBadGradeFormatter(value,row,index); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
title: '数量', |
|
|
|
field: 'processBadNum', |
|
|
@ -228,20 +224,7 @@ |
|
|
|
] |
|
|
|
}; |
|
|
|
$.table.init(options); |
|
|
|
|
|
|
|
// 添加全局事件处理器 |
|
|
|
window.updateTableRow = function(tableId, element) { |
|
|
|
var $table = $("#" + tableId); |
|
|
|
var rowIndex = $($element).closest('tr[data-index]').data('index'); |
|
|
|
var fieldName = $(element).attr('name'); |
|
|
|
var newValue = $(element).val(); |
|
|
|
|
|
|
|
// 直接更新Bootstrap Table的数据源 |
|
|
|
var data = $table.bootstrapTable('getData'); |
|
|
|
data[rowIndex][fieldName] = newValue; |
|
|
|
$table.bootstrapTable('load', data); |
|
|
|
}; |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 逻辑删除不合格数前端的一行数据 |
|
|
@ -255,22 +238,60 @@ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 数据字典转下拉框,并添加事件监听 |
|
|
|
function dictToSelectWithEvent(datas, value, name, tableId) { |
|
|
|
var selectHtml = $("<select>", { |
|
|
|
"class": "form-control", |
|
|
|
"name": name, |
|
|
|
"onchange": "updateTableRow('" + tableId + "', this);" |
|
|
|
// 列中获取不良分类的下拉改变数据 |
|
|
|
function onProcessBadClassification(selectElement, rowIndex) { |
|
|
|
var processBadClassificationValue = $(selectElement).val(); |
|
|
|
var tableData = $table.bootstrapTable('getData'); |
|
|
|
var newRow = tableData[rowIndex]; // 获取当前行数据 |
|
|
|
// 重新渲染成本小类的设备名称列 |
|
|
|
// 更新行数据 |
|
|
|
newRow.processBadClassification = processBadClassificationValue; |
|
|
|
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow}); |
|
|
|
} |
|
|
|
|
|
|
|
// 自定义不良分类的格式化函数 |
|
|
|
function processBadClassificationFormatter(value, row, index) { |
|
|
|
var selectHtml = '<select class="form-control" onchange="onProcessBadClassification(this, ' + index + ')">'; |
|
|
|
|
|
|
|
// 添加默认选项 |
|
|
|
selectHtml += '<option value=""' + (value === undefined || value === '' ? ' selected' : '') + '>所有</option>'; |
|
|
|
|
|
|
|
processBadClassificationDatas.forEach(function (child) { |
|
|
|
selectHtml += '<option value="' + child.dictValue + '"' + (value === child.dictValue ? ' selected' : '') + '>' + child.dictLabel + '</option>'; |
|
|
|
}); |
|
|
|
$.each(datas, function(index, dict) { |
|
|
|
$("<option>") |
|
|
|
.val(dict.dictValue) |
|
|
|
.text(dict.dictLabel) |
|
|
|
.attr("selected", dict.dictValue === value) |
|
|
|
.appendTo(selectHtml); |
|
|
|
|
|
|
|
selectHtml += '</select>'; |
|
|
|
return selectHtml; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 列中获取不良等级的下拉改变数据 |
|
|
|
function onProcessBadGrade(selectElement, rowIndex) { |
|
|
|
var processBadGradeValue = $(selectElement).val(); |
|
|
|
var tableData = $table.bootstrapTable('getData'); |
|
|
|
var newRow = tableData[rowIndex]; // 获取当前行数据 |
|
|
|
// 重新渲染成本小类的设备名称列 |
|
|
|
// 更新行数据 |
|
|
|
newRow.processBadGrade = processBadGradeValue; |
|
|
|
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow}); |
|
|
|
} |
|
|
|
|
|
|
|
// 自定义不良等级的格式化函数 |
|
|
|
function processBadGradeFormatter(value, row, index) { |
|
|
|
var selectHtml = '<select class="form-control" onchange="onProcessBadGrade(this, ' + index + ')">'; |
|
|
|
|
|
|
|
// 添加默认选项 |
|
|
|
selectHtml += '<option value=""' + (value === undefined || value === '' ? ' selected' : '') + '>所有</option>'; |
|
|
|
|
|
|
|
processBadGradeDatas.forEach(function (child) { |
|
|
|
selectHtml += '<option value="' + child.dictValue + '"' + (value === child.dictValue ? ' selected' : '') + '>' + child.dictLabel + '</option>'; |
|
|
|
}); |
|
|
|
return selectHtml.prop("outerHTML"); |
|
|
|
|
|
|
|
selectHtml += '</select>'; |
|
|
|
return selectHtml; |
|
|
|
} |
|
|
|
|
|
|
|
</script> |
|
|
|
</body> |
|
|
|
</html> |