|
|
@ -52,6 +52,12 @@ |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">型号:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="materialModel" th:field="*{materialModel}" class="form-control" type="text" disabled> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">品牌:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
@ -71,14 +77,6 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</form> |
|
|
|
<div class="btn-group-sm" id="toolbar" role="group"> |
|
|
|
<a class="btn btn-success" onclick="insertRow()" disabled> |
|
|
|
<i class="fa fa-plus"></i> 新增行 |
|
|
|
</a> |
|
|
|
<a class="btn btn-danger multiple disabled" onclick="removeRow()" disabled> |
|
|
|
<i class="fa fa-remove"></i> 删除选择行 |
|
|
|
</a> |
|
|
|
</div> |
|
|
|
<div class="row"> |
|
|
|
<div class="col-sm-12 select-table table-striped"> |
|
|
|
<table id="bootstrap-sub-table-1"></table> |
|
|
@ -191,6 +189,11 @@ |
|
|
|
align: 'center', |
|
|
|
title: '描述' |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialModel', |
|
|
|
align: 'center', |
|
|
|
title: '型号' |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'brand', |
|
|
|
align: 'center', |
|
|
@ -208,68 +211,11 @@ |
|
|
|
field: 'useNum', |
|
|
|
align: 'center', |
|
|
|
title: '用量', |
|
|
|
editable : { |
|
|
|
type : 'text', |
|
|
|
title : '用量', |
|
|
|
validate : function(value) { |
|
|
|
if (!value) { |
|
|
|
return '用量不能为空'; |
|
|
|
} |
|
|
|
if (isNaN(value)) { |
|
|
|
return '用量必须为数字'; |
|
|
|
} |
|
|
|
if(value < 0){ |
|
|
|
return "输入数值不能小于0"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'lossRate', |
|
|
|
align: 'center', |
|
|
|
title: '损耗率(%)', |
|
|
|
editable : { |
|
|
|
editor: { |
|
|
|
defaultValue: '%', |
|
|
|
title : '损耗率(%)', |
|
|
|
mode:'inline', |
|
|
|
type: 'text', |
|
|
|
// 编辑时同样附带百分比符号 |
|
|
|
formatter: function(value) { |
|
|
|
return value + '%'; |
|
|
|
}, |
|
|
|
// 编辑后去除百分比符号 |
|
|
|
custom_getter: function(value) { |
|
|
|
return value.replace('%', ''); |
|
|
|
} |
|
|
|
}, |
|
|
|
validate : function(value) { |
|
|
|
if (!value) { |
|
|
|
return '损耗率不能为空'; |
|
|
|
} |
|
|
|
const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配 |
|
|
|
const match = value.match(regex); // 使用match方法查找所有匹配 |
|
|
|
if (!match) { |
|
|
|
return '损耗率必须以百分比结尾'; |
|
|
|
} |
|
|
|
var num = value.replace('%', ''); |
|
|
|
if (num < 0 || num > 100) { |
|
|
|
return '损耗率必须大于等于0小于等于100'; |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
return "%"; |
|
|
|
} |
|
|
|
const regex = /(\d+(?:\.\d+)?)%/g; // 创建正则表达式,g标志表示全局匹配 |
|
|
|
const match = value.match(regex); // 使用match方法查找所有匹配 |
|
|
|
if (match) { |
|
|
|
return value; |
|
|
|
}else{ |
|
|
|
return value + "%"; |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'processMethod', |
|
|
@ -283,7 +229,6 @@ |
|
|
|
field: 'remark', |
|
|
|
align: 'center', |
|
|
|
title: '备注', |
|
|
|
editable: true |
|
|
|
} |
|
|
|
] |
|
|
|
}; |
|
|
@ -309,58 +254,6 @@ |
|
|
|
curParams.parentId = $("#id").val(); |
|
|
|
return curParams; |
|
|
|
} |
|
|
|
function doSubmit(index, layero,uniqueId){ |
|
|
|
console.log(uniqueId); |
|
|
|
var iframeWin = window[layero.find('iframe')[0]['name']]; |
|
|
|
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0]; |
|
|
|
console.log(rowData.materialName); |
|
|
|
var timestamp = new Date().getTime(); |
|
|
|
var totalNum = $("#bootstrap-sub-table-1").bootstrapTable('getData').length; |
|
|
|
$("#bootstrap-sub-table-1").bootstrapTable('insertRow', { |
|
|
|
index:totalNum, |
|
|
|
replace:true, |
|
|
|
row: { |
|
|
|
id:rowData.subId, |
|
|
|
materialNo: rowData.materialNo, |
|
|
|
bomNo: rowData.bomNo, |
|
|
|
level: "1", |
|
|
|
materialName: rowData.materialName, |
|
|
|
materialType: rowData.materialType, |
|
|
|
describe: rowData.describe, |
|
|
|
brand: rowData.brand, |
|
|
|
unit: rowData.unit, |
|
|
|
processMethod: rowData.processMethod, |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
layer.close(index); |
|
|
|
} |
|
|
|
|
|
|
|
/* 新增表格行 */ |
|
|
|
function insertRow(){ |
|
|
|
// var uuidStr = uuid(); |
|
|
|
var url = ctx + "erp/material/select"; |
|
|
|
var options = { |
|
|
|
title: '选择料号', |
|
|
|
url: url, |
|
|
|
callBack: doSubmit |
|
|
|
}; |
|
|
|
$.modal.openOptions(options); |
|
|
|
} |
|
|
|
|
|
|
|
/* 删除指定表格行 */ |
|
|
|
function removeRow(){ |
|
|
|
var ids = $.table.selectColumns("id"); |
|
|
|
if (ids.length == 0) { |
|
|
|
$.modal.alertWarning("请至少选择一条记录"); |
|
|
|
return; |
|
|
|
} |
|
|
|
$("#bootstrap-sub-table-1").bootstrapTable('remove', { |
|
|
|
field: 'id', |
|
|
|
values: ids |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
</script> |
|
|
|
</body> |
|
|
|