@ -21,13 +21,13 @@
<!-- </div> -->
<!-- </div> -->
< div class = "form-group" >
< label class = "col-sm-3 control-label is-required" > 申请部门:< / label >
< label class = "col-sm-4 control-label is-required" > 申请部门:< / label >
< div class = "col-sm-8" >
< select name = "applyDept" th:field = "*{applyDept}" class = "form-control" type = "text" required disabled > < / select >
< / div >
< / div >
< div class = "form-group" >
< label class = "col-sm-3 control-label" > 申请时间:< / label >
< label class = "col-sm-4 control-label" > 申请时间:< / label >
< div class = "col-sm-8" >
< div class = "input-group date" >
< input name = "applyTime" th:value = "${#dates.format(warehouseInventoryReportDamage.applyTime, 'yyyy-MM-dd')}" class = "form-control" placeholder = "yyyy-MM-dd" type = "text" >
@ -36,7 +36,7 @@
< / div >
< / div >
< div class = "form-group" >
< label class = "col-sm-3 control-label is-required" > 是否关联生产单号:< / label >
< label class = "col-sm-4 control-label is-required" > 是否关联生产单号:< / label >
< div class = "col-sm-8" >
<!-- <div class="radio - box" th:each="dict : ${@dict.getType('yes_or_no')}" required> -->
<!-- <input type="radio" th:id="${'whetherMakeNo_' + dict.dictCode}" name="whetherMakeNo" th:value="${dict.dictValue}" th:field="*{whetherMakeNo}"> -->
@ -51,9 +51,10 @@
< / div >
< / div >
< div class = "form-group" id = "makeNoInput" >
< label class = "col-sm-3 control-label is-required" > 关联生产单号:< / label >
< label class = "col-sm-4 control-label is-required" > 关联生产单号:< / label >
< div class = "col-sm-8" >
< input name = "makeNo" th:field = "*{makeNo}" class = "form-control" type = "text" required >
< input id = "selectMakeNo" name = "makeNo" th:field = "*{makeNo}" class = "form-control select2-multiple" type = "text" required >
< / input >
< / div >
< / div >
<!-- <div class="form - group"> -->
@ -69,25 +70,25 @@
<!-- </div> -->
<!-- </div> -->
< div class = "form-group" >
< label class = "col-sm-3 control-label is-required" > 仓库ID:< / label >
< label class = "col-sm-4 control-label is-required" > 仓库ID:< / label >
< div class = "col-sm-8" >
< input name = "warehouseCode" th:field = "*{warehouseCode}" class = "form-control" type = "text" required >
< / div >
< / div >
< div class = "form-group" >
< label class = "col-sm-3 control-label is-required" > 仓库名称:< / label >
< label class = "col-sm-4 control-label is-required" > 仓库名称:< / label >
< div class = "col-sm-8" >
< select id = "stockNameSelct" name = "warehouseName" th:field = "*{warehouseName}" class = "form-control" type = "text" required > < / select >
< / div >
< / div >
< div class = "form-group" >
< label class = "col-sm-3 control-label is-required" > 仓库存放地址:< / label >
< label class = "col-sm-4 control-label is-required" > 仓库存放地址:< / label >
< div class = "col-sm-8" >
< input name = "warehouseStoreAddress" th:field = "*{warehouseStoreAddress}" class = "form-control" type = "text" required >
< / div >
< / div >
< div class = "form-group " >
< label class = "col-sm-3 control-label " > 备注:< / label >
< label class = "col-sm-4 control-label " > 备注:< / label >
< div class = "col-sm-8" >
< textarea name = "remark" class = "form-control" > [[*{remark}]]< / textarea >
< / div >
@ -127,6 +128,7 @@
$("#form-inventoryReportDamage-edit").validate({focusCleanup: true});
var warehouseInventoryReportDamage = [[${warehouseInventoryReportDamage}]];
var stockData = [];
var makeNo = [[${warehouseInventoryReportDamage.makeNo}]]
function submitHandler() {
if ($.validate.form()) {
var warehouseInventoryReportDamage = {
@ -192,6 +194,10 @@
var options = {
id : 'bootstrap-table-reportDamage-child',
modalName: "仓库库存报损物料信息",
showColumns: false,
showSearch: false,
showRefresh:false,
showToggle:false,
data: [[${warehouseInventoryReportDamage.warehouseInventoryReportDamageChildList}]],
columns: [
{title: '库存报损id', field: 'reportDamageChildId', visible: false},
@ -273,6 +279,8 @@
var stockName = warehouseInventoryReportDamage.warehouseName;
loadWarehouseCodes(stockName);
// loadMakeNo();
$("#selectMakeNo").val(makeNo);
changeWhetherMakeNo();
getDeptName();
@ -330,7 +338,38 @@
}
});
}
function loadMakeNo() {
var options = [];
options.push({id: '',text: '',value: ''})
$.ajax({
url: ctx + 'system/makeorder/getAllMakeNos',
type: "GET",
dataType: "json",
success: function (result) {
if (result != null) {
result.forEach(function (re){
var option = {};
option.id = re.makeNo;
option.text = re.makeNo;
option.value = re.makeNo;
options.push(option);
});
$("#selectMakeNo").select2({
data: options,
}).on('select2:loaded', function(e) {
// 打印所有选项
var allOptions = $("#selectMakeNo").select2('data');
console.log("All Options from Select2:", allOptions);
allOptions.forEach(function(option) {
console.log("ID: " + option.id + ", Text: " + option.text);
});
});
} else {
$.modal.msgError("生产订单编号获取失败!");
}
}
});
}
function getDeptName(){
$.ajax({
url: prefix + "/getUserDeptName",
@ -378,44 +417,45 @@
}
}
function doSubmit(index, layero,uniqueId){
// console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-materialSelect-table').bootstrapTable('getSelections')[0];
var rows = $("#bootstrap-table-reportDamage-child").bootstrapTable('getData');
if(rows.length > 0){
for(var i=0;i< rows.length ; i + + ) {
var data = rows[i];
if(data.materialNo == rowData.materialNo){
$.modal.alertError("不能选择已添加过的相同物料");
return;
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections');
//判断是否重复
var data = $("#bootstrap-table-reportDamage-child").bootstrapTable('getData');
var rows = data.length;
if(rows > 0){
for(var i=0;i< rows ; i + + ) {
for(var j=0;j< rowData.length ; j + + ) {
if(data[i].materialNo===rowData[j].materialNo){
$.modal.alertError("不能选择已添加过的相同物料");
rowData.split(j,1);
break;
}
}
};
insertTable(rowData);
}else{
insertTable(rowData);
}
for(i=0;i< rowData.length ; i + + ) {
insertTable(rowData[i] );
}
layer.close(index);
}
function insertTable(rowData){
$("#bootstrap-table-reportDamage-child").bootstrapTable('insertRow', {
index:1,
row: {
materialNo:rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
materialBrand: rowData.materialBrand,
materialPhotourl: rowData.materialPhotourl,
materialDescribe: rowData.materialDescribe,
materialUnit: rowData.materialUnit,
actualScrapQuantity: "",
scrapType: "",
scrapDetail: "",
qualityAssessment: "",
estimatedValueRmb: "",
responsibleUnit: "",
remark : ""
}
})
var newRow = {
materialNo:rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
materialBrand: rowData.brand,
materialPhotourl: rowData.materialPhotourl,
materialDescribe: rowData.describe,
materialUnit: rowData.unit,
actualScrapQuantity: "",
scrapType: "",
scrapDetail: "",
qualityAssessment: "",
estimatedValueRmb: "",
responsibleUnit: "",
remark : ""
}
$("#bootstrap-table-reportDamage-child").bootstrapTable('append',newRow);
}
// 逻辑删除前端的一行数据