|
|
@ -3,41 +3,30 @@ |
|
|
|
<head> |
|
|
|
<th:block th:include="include :: header('修改仓库库存报损')" /> |
|
|
|
<th:block th:include="include :: datetimepicker-css" /> |
|
|
|
<th:block th:include="include :: select2-css" /> |
|
|
|
<th:block th:include="include :: bootstrap-fileinput-css" /> |
|
|
|
<th:block th:include="include :: bootstrap-editable-css" /> |
|
|
|
</head> |
|
|
|
<body class="white-bg"> |
|
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|
|
|
<form class="form-horizontal m" id="form-inventoryReportDamage-edit" th:object="${warehouseInventoryReportDamage}"> |
|
|
|
<input name="reportDamageId" th:field="*{reportDamageId}" type="hidden"> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label is-required">报废类型:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<select name="warehousScrapType" class="form-control m-b" th:with="type=${@dict.getType('warehous_scrap_type')}" required> |
|
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehousScrapType}"></option> |
|
|
|
</select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 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}"> |
|
|
|
<label th:for="${'whetherMakeNo_' + dict.dictCode}" th:text="${dict.dictLabel}"></label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group" hidden="hidden"> |
|
|
|
<label class="col-sm-3 control-label is-required">关联生产单号:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="makeNo" th:field="*{makeNo}" class="form-control" type="text" required> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<input name="reportDamageCode" th:field="*{reportDamageCode}" type="hidden"> |
|
|
|
<!-- <div class="form-group"> --> |
|
|
|
<!-- <label class="col-sm-3 control-label is-required">报废类型:</label>--> |
|
|
|
<!-- <div class="col-sm-8">--> |
|
|
|
<!-- <select name="warehousScrapType" class="form-control m-b" th:with="type=${@dict.getType('warehous_scrap_type')}" required>--> |
|
|
|
<!-- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehousScrapType}"></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="applyDept" th:field="*{applyDept}" class="form-control" type="text" required> |
|
|
|
<select name="applyDept" th:field="*{applyDept}" class="form-control" type="text" required disabled></select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">申请时间:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<div class="input-group date"> |
|
|
@ -47,29 +36,38 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label is-required">料号:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="materialNo" th:field="*{materialNo}" class="form-control" type="text" required> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label is-required">物料名称:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="materialName" th:field="*{materialName}" 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-3 control-label is-required">是否关联生产单号:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="materialTotal" th:field="*{materialTotal}" class="form-control" type="text" required> |
|
|
|
<!-- <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}">--> |
|
|
|
<!-- <label th:for="${'whetherMakeNo_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>--> |
|
|
|
<!-- </div>--> |
|
|
|
<div class="radio-inline"> |
|
|
|
<label><input type="radio" name="whetherMakeNo" value="0" checked>否</label> |
|
|
|
</div> |
|
|
|
<div class="radio-inline"> |
|
|
|
<label><input type="radio" name="whetherMakeNo" value="1">是</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label is-required">数量合计:</label> |
|
|
|
<div class="form-group" id="makeNoInput"> |
|
|
|
<label class="col-sm-3 control-label is-required">关联生产单号:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="numTotal" th:field="*{numTotal}" class="form-control" type="text" required> |
|
|
|
<input name="makeNo" th:field="*{makeNo}" class="form-control" type="text" required> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- <div class="form-group"> --> |
|
|
|
<!-- <label class="col-sm-3 control-label is-required">物料数合计:</label>--> |
|
|
|
<!-- <div class="col-sm-8">--> |
|
|
|
<!-- <input name="materialTotal" th:field="*{materialTotal}" class="form-control" type="text" required>--> |
|
|
|
<!-- </div>--> |
|
|
|
<!-- </div>--> |
|
|
|
<!-- <div class="form-group"> --> |
|
|
|
<!-- <label class="col-sm-3 control-label is-required">数量合计:</label>--> |
|
|
|
<!-- <div class="col-sm-8">--> |
|
|
|
<!-- <input name="numTotal" th:field="*{numTotal}" class="form-control" type="text" required>--> |
|
|
|
<!-- </div>--> |
|
|
|
<!-- </div>--> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label is-required">仓库ID:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
@ -79,7 +77,7 @@ |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label is-required">仓库名称:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="warehouseName" th:field="*{warehouseName}" class="form-control" type="text" required> |
|
|
|
<select id="stockNameSelct" name="warehouseName" th:field="*{warehouseName}" class="form-control" type="text" required></select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
@ -114,6 +112,9 @@ |
|
|
|
</div> |
|
|
|
<th:block th:include="include :: footer" /> |
|
|
|
<th:block th:include="include :: datetimepicker-js" /> |
|
|
|
<th:block th:include="include :: select2-js" /> |
|
|
|
<th:block th:include="include :: bootstrap-fileinput-js" /> |
|
|
|
<th:block th:include="include :: bootstrap-table-editable-js" /> |
|
|
|
<script th:inline="javascript"> |
|
|
|
var prefix = ctx + "warehouse/inventoryReportDamage"; |
|
|
|
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; |
|
|
@ -124,61 +125,223 @@ |
|
|
|
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]]; |
|
|
|
var warehousScrapTypeDatas = [[${@dict.getType('warehous_scrap_type')}]]; |
|
|
|
$("#form-inventoryReportDamage-edit").validate({focusCleanup: true}); |
|
|
|
var warehouseInventoryReportDamage = [[${warehouseInventoryReportDamage}]]; |
|
|
|
var stockData = []; |
|
|
|
function submitHandler() { |
|
|
|
if ($.validate.form()) { |
|
|
|
$.operate.save(prefix + "/edit", $('#form-inventoryReportDamage-edit').serialize()); |
|
|
|
var warehouseInventoryReportDamage = { |
|
|
|
warehouseInventoryReportDamageChildList: [] |
|
|
|
}; |
|
|
|
warehouseInventoryReportDamage.reportDamageId = $("input[name='reportDamageId']").val(); |
|
|
|
warehouseInventoryReportDamage.reportDamageCode = $("input[name='reportDamageCode']").val(); |
|
|
|
$("select[name='applyDept']").removeAttr("disabled"); |
|
|
|
warehouseInventoryReportDamage.applyDept = $("select[name='applyDept']").val(); |
|
|
|
warehouseInventoryReportDamage.applyTime = $("input[name='applyTime']").val(); |
|
|
|
var whetherMakeNo = $("input[name='whetherMakeNo']:checked").val(); |
|
|
|
warehouseInventoryReportDamage.whetherMakeNo = whetherMakeNo; |
|
|
|
if(whetherMakeNo === "1"){ |
|
|
|
var makeNo = $("input[name='makeNo']").val(); |
|
|
|
warehouseInventoryReportDamage.makeNo = makeNo; |
|
|
|
} |
|
|
|
warehouseInventoryReportDamage.warehouseName = $("select[name='warehouseName']").val(); |
|
|
|
warehouseInventoryReportDamage.warehouseCode = $("input[name='warehouseCode']").val(); |
|
|
|
warehouseInventoryReportDamage.warehouseStoreAddress = $("input[name='warehouseStoreAddress']").val(); |
|
|
|
warehouseInventoryReportDamage.remark = $("area[name='remark']").val(); |
|
|
|
|
|
|
|
var rows = $('#bootstrap-table-reportDamage-child').bootstrapTable('getData'); |
|
|
|
// 检查表格数据是否为空 |
|
|
|
if (rows.length === 0) { |
|
|
|
$.modal.alertWarning("请至少添加一条物料信息再保存!"); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
warehouseInventoryReportDamage.materialTotal = rows.length; |
|
|
|
for (var i = 0; i < rows.length; i++) { |
|
|
|
var DamageChild = { |
|
|
|
materialNo: rows[i].materialNo, |
|
|
|
materialName: rows[i].materialName, |
|
|
|
materialType: rows[i].materialType, |
|
|
|
materialDescribe: rows[i].materialDescribe, |
|
|
|
materialBrand: rows[i].materialBrand, |
|
|
|
materialUnit: rows[i].materialUnit, |
|
|
|
materialPhotourl: rows[i].materialPhotourl, |
|
|
|
actualScrapQuantity: rows[i].actualScrapQuantity, |
|
|
|
scrapType: rows[i].scrapType, |
|
|
|
scrapDetail: rows[i].scrapDetail, |
|
|
|
qualityAssessment: rows[i].qualityAssessment, |
|
|
|
estimatedValueRmb: rows[i].estimatedValueRmb, |
|
|
|
responsibleUnit: rows[i].responsibleUnit, |
|
|
|
remark: rows[i].remark, |
|
|
|
}; |
|
|
|
// console.log(DamageChild); |
|
|
|
warehouseInventoryReportDamage.warehouseInventoryReportDamageChildList.push(DamageChild); |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(warehouseInventoryReportDamage); |
|
|
|
$.operate.saveJson(prefix + "/edit",JSON.stringify(warehouseInventoryReportDamage)); |
|
|
|
} |
|
|
|
} |
|
|
|
var options = { |
|
|
|
id : 'bootstrap-table-reportDamage-child', |
|
|
|
modalName: "仓库库存报损物料信息", |
|
|
|
columns: [ |
|
|
|
{checkbox: true}, |
|
|
|
{title: '库存报损id', field: 'reportDamageChildId', visible: false}, |
|
|
|
{title: '报损单号', field: 'reportDamageCode',visible: false}, |
|
|
|
{title: '料号', field: 'materialNo',}, |
|
|
|
{title: '图片', field: 'materialPhotourl',}, |
|
|
|
{title: '物料名称', field: 'materialName',}, |
|
|
|
{title: '物料类型', field: 'materialType',}, |
|
|
|
{title: '描述', field: 'materialDescribe',}, |
|
|
|
{title: '品牌', field: 'materialBrand',}, |
|
|
|
{title: '单位', field: 'materialUnit',}, |
|
|
|
{title: '实际报废数量', field: 'actualScrapQuantity', |
|
|
|
editable: { |
|
|
|
type: 'text', |
|
|
|
mode: 'inline', // 设定为行内编辑模式 |
|
|
|
events: { |
|
|
|
blur: function(e) { |
|
|
|
var value = $(this).val(); |
|
|
|
var errorMessage = validateActualScrapQuantity(value); |
|
|
|
if (errorMessage) {alert(errorMessage);} |
|
|
|
} |
|
|
|
$(function (){ |
|
|
|
// 单选按钮赋值 |
|
|
|
var whetherMakeNo = [[${warehouseInventoryReportDamage.whetherMakeNo}]]; |
|
|
|
if(whetherMakeNo === "1"){ |
|
|
|
$('input:radio[name="whetherMakeNo"][value="1"]').prop('checked', true); |
|
|
|
}else{ |
|
|
|
$('input:radio[name="whetherMakeNo"][value="0"]').prop('checked', true); |
|
|
|
} |
|
|
|
|
|
|
|
var options = { |
|
|
|
id : 'bootstrap-table-reportDamage-child', |
|
|
|
modalName: "仓库库存报损物料信息", |
|
|
|
data: [[${warehouseInventoryReportDamage.warehouseInventoryReportDamageChildList}]], |
|
|
|
columns: [ |
|
|
|
{title: '库存报损id', field: 'reportDamageChildId', visible: false}, |
|
|
|
{title: '报损单号', field: 'reportDamageCode',visible: false}, |
|
|
|
{title: '料号', field: 'materialNo',}, |
|
|
|
{title: '图片', field: 'materialPhotourl',}, |
|
|
|
{title: '物料名称', field: 'materialName',}, |
|
|
|
{title: '物料类型', field: 'materialType', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectCategoryLabel(materialTypeDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{title: '描述', field: 'materialDescribe',}, |
|
|
|
{title: '品牌', field: 'materialBrand',}, |
|
|
|
{title: '单位', field: 'materialUnit',}, |
|
|
|
{title: '实际报废数量', field: 'actualScrapQuantity', |
|
|
|
editable: { |
|
|
|
type: 'text', |
|
|
|
mode: 'inline', // 设定为行内编辑模式 |
|
|
|
events: { |
|
|
|
blur: function(e) { |
|
|
|
var value = $(this).val(); |
|
|
|
var errorMessage = validateActualScrapQuantity(value); |
|
|
|
if (errorMessage) {alert(errorMessage);} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{title: '报废类型', field: 'scrapType',}, |
|
|
|
{title: '报废明细', field: 'scrapDetail',}, |
|
|
|
{title: '品质判定', field: 'qualityAssessment',}, |
|
|
|
{title: '预估价值(RMB)', field: 'estimatedValueRmb',}, |
|
|
|
{title: '责任单位', field: 'responsibleUnit',}, |
|
|
|
{title: '备注', field: 'remark',}, |
|
|
|
{title: '关联生产单号', field: 'makeNo',}, |
|
|
|
{title: '仓库ID', field: 'warehouseCode',}, |
|
|
|
{title: '仓库名称', field: 'warehouseName',}, |
|
|
|
{title: '仓库存放地址', field: 'warehouseStoreAddress',}, |
|
|
|
{title: '申请部门ID', field: 'applyDeptId',}, |
|
|
|
{title: '申请部门', field: 'applyDept',}, |
|
|
|
{title: '操作', align: 'center', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
var actions = []; |
|
|
|
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialNo + '\')"><i class="fa fa-edit"></i>删除</a> '); |
|
|
|
return actions.join(''); |
|
|
|
{title: '报废类型', field: 'scrapType', |
|
|
|
editable:{ |
|
|
|
type: 'text', |
|
|
|
} |
|
|
|
}, |
|
|
|
{title: '报废明细', field: 'scrapDetail', |
|
|
|
editable:{ |
|
|
|
type: 'text', |
|
|
|
} |
|
|
|
}, |
|
|
|
{title: '品质判定', field: 'qualityAssessment', |
|
|
|
editable:{ |
|
|
|
type: 'text', |
|
|
|
} |
|
|
|
}, |
|
|
|
{title: '预估价值(RMB)', field: 'estimatedValueRmb', |
|
|
|
editable:{ |
|
|
|
type: 'text', |
|
|
|
} |
|
|
|
}, |
|
|
|
{title: '责任单位', field: 'responsibleUnit', |
|
|
|
editable:{ |
|
|
|
type: 'text', |
|
|
|
} |
|
|
|
}, |
|
|
|
{title: '备注', field: 'remark', |
|
|
|
editable:{ |
|
|
|
type: 'text', |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '报损报告', |
|
|
|
field: 'damageReportUrl', |
|
|
|
align: 'center', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
var actions = []; |
|
|
|
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" ><i class="fa fa-plus"></i>上传</a> '); |
|
|
|
return actions.join(''); |
|
|
|
} |
|
|
|
}, |
|
|
|
{title: '操作', align: 'center', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
var actions = []; |
|
|
|
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialNo + '\')"><i class="fa fa-edit"></i>删除</a> '); |
|
|
|
return actions.join(''); |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
}; |
|
|
|
$.table.init(options); |
|
|
|
|
|
|
|
var stockName = warehouseInventoryReportDamage.warehouseName; |
|
|
|
loadWarehouseCodes(stockName); |
|
|
|
changeWhetherMakeNo(); |
|
|
|
getDeptName(); |
|
|
|
|
|
|
|
//单选改变是否关联生产单号显示关联生产单号输入框 |
|
|
|
$("input[name='whetherMakeNo']").change(function () { |
|
|
|
changeWhetherMakeNo(); |
|
|
|
}); |
|
|
|
$('#stockNameSelct').on('change', function() { |
|
|
|
var selectedValue = $(this).val(); |
|
|
|
// console.log(selectedValue); |
|
|
|
$.each(stockData,function (i,stock){ |
|
|
|
if(stock.stockName === selectedValue){ |
|
|
|
$("input[name='warehouseCode']").val(stock.stockNo); |
|
|
|
$("input[name='warehouseStoreAddress']").val(stock.stockAddress); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}) |
|
|
|
//根据是否关联生产单号显示关联生产单号输入框 |
|
|
|
function changeWhetherMakeNo() { |
|
|
|
var whetherMakeNo = $("input[name='whetherMakeNo']:checked").val(); |
|
|
|
// console.log(whetherMakeNo); |
|
|
|
if (whetherMakeNo === "1") { |
|
|
|
$("#makeNoInput").show(); |
|
|
|
} else { |
|
|
|
$("#makeNoInput").hide(); |
|
|
|
} |
|
|
|
} |
|
|
|
function loadWarehouseCodes(defaultStockName) { |
|
|
|
var url = ctx + 'stock/stockInfo/getAllWarehouseCode'; |
|
|
|
$.ajax({ |
|
|
|
url: url, |
|
|
|
type: 'GET', |
|
|
|
dataType: 'json', |
|
|
|
success: function(data) { |
|
|
|
var select = $('#stockNameSelct'); |
|
|
|
$.each(data, function(i, option) { |
|
|
|
var stockValue = {}; |
|
|
|
stockValue.stockName = option.stockName; |
|
|
|
stockValue.stockNo = option.stockNO; |
|
|
|
stockValue.stockAddress = option.stockAddr; |
|
|
|
stockData.push(stockValue); |
|
|
|
var optionElement = $('<option>', { |
|
|
|
value: option.stockName, |
|
|
|
text : option.stockName |
|
|
|
}); |
|
|
|
select.append(optionElement); |
|
|
|
if (option.stockName === defaultStockName) { |
|
|
|
optionElement.prop('selected', true); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
error: function(error) { |
|
|
|
console.log('Error: ', error); |
|
|
|
} |
|
|
|
] |
|
|
|
}; |
|
|
|
$.table.init(options); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function getDeptName(){ |
|
|
|
$.ajax({ |
|
|
|
url: prefix + "/getUserDeptName", |
|
|
|
type: "get", |
|
|
|
dataType: "json", |
|
|
|
success: function (result) { |
|
|
|
console.log(result.data); |
|
|
|
$("select[name='applyDept']").append($('<option></option>').val(result.data).html(result.data)); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
function validateActualScrapQuantity(v) { |
|
|
|
if ($.common.isEmpty(v)) { |
|
|
|
return '实际报废数量不能为空'; |
|
|
@ -190,39 +353,74 @@ |
|
|
|
} |
|
|
|
|
|
|
|
function insertRow() { |
|
|
|
var url = ctx + 'warehouse/inventoryCheck/materialSelect'; |
|
|
|
var options = { |
|
|
|
title: '选择物料', |
|
|
|
url: url, |
|
|
|
callBack: doSubmit |
|
|
|
}; |
|
|
|
$.modal.openOptions(options); |
|
|
|
var ifMakeNo = $("input[name='whetherMakeNo']:checked").val(); |
|
|
|
if(ifMakeNo === "1"){ |
|
|
|
var makeNo = $("input[name='makeNo']").val(); |
|
|
|
if(!makeNo){ |
|
|
|
$.modal.alertWarning("请输入生产单号!") |
|
|
|
}else{ |
|
|
|
var url = prefix + '/materialInMakeOrderSelect/' + makeNo; |
|
|
|
var options = { |
|
|
|
title: '选择物料', |
|
|
|
url: url, |
|
|
|
callBack: doSubmit |
|
|
|
}; |
|
|
|
$.modal.openOptions(options); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
var url = ctx + 'warehouse/inventoryCheck/materialSelect'; |
|
|
|
var options = { |
|
|
|
title: '选择物料', |
|
|
|
url: url, |
|
|
|
callBack: doSubmit |
|
|
|
}; |
|
|
|
$.modal.openOptions(options); |
|
|
|
} |
|
|
|
} |
|
|
|
function doSubmit(index, layero,uniqueId){ |
|
|
|
console.log(uniqueId); |
|
|
|
// console.log(uniqueId); |
|
|
|
var iframeWin = window[layero.find('iframe')[0]['name']]; |
|
|
|
var rowData = iframeWin.$('#bootstrap-materialSelect-table').bootstrapTable('getSelections')[0]; |
|
|
|
console.log("rowData: "+rowData); |
|
|
|
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; |
|
|
|
} |
|
|
|
}; |
|
|
|
insertTable(rowData); |
|
|
|
}else{ |
|
|
|
insertTable(rowData); |
|
|
|
} |
|
|
|
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, |
|
|
|
inventoryCheckNum : "", |
|
|
|
inventoryAccountNum : "", |
|
|
|
warehouseStoreAddress : "", |
|
|
|
batchNumber : "", |
|
|
|
actualScrapQuantity: "", |
|
|
|
scrapType: "", |
|
|
|
scrapDetail: "", |
|
|
|
qualityAssessment: "", |
|
|
|
estimatedValueRmb: "", |
|
|
|
responsibleUnit: "", |
|
|
|
remark : "" |
|
|
|
} |
|
|
|
}) |
|
|
|
layer.close(index); |
|
|
|
} |
|
|
|
|
|
|
|
// 逻辑删除前端的一行数据 |
|
|
|
function removeRow(materialNo){ |
|
|
|
$("#bootstrap-table").bootstrapTable('remove', {field: 'materialNo', values: materialNo}) |
|
|
|
$("#bootstrap-table-reportDamage-child").bootstrapTable('remove', {field: 'materialNo', values: materialNo}) |
|
|
|
} |
|
|
|
$("input[name='applyTime']").datetimepicker({ |
|
|
|
format: "yyyy-mm-dd", |
|
|
|