You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
689 lines
28 KiB
689 lines
28 KiB
<!DOCTYPE html>
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
|
<head>
|
|
<th:block th:include="include :: header('新增委外加工单')"/>
|
|
<th:block th:include="include :: datetimepicker-css"/>
|
|
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
|
|
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
|
|
</head>
|
|
<body class="white-bg">
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
<form class="form-horizontal m" id="form-outSourceOrderHead-add">
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">委外加工单号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="outsourceOrderNo" class="form-control" type="text" required readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">委外加工批号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="batchNumber" class="form-control" type="text" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">厂商编号:</label>
|
|
<div class="col-sm-8">
|
|
<select name="appointNo" class="form-control m-b" required disabled>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">厂商名称:</label>
|
|
<div class="col-sm-8">
|
|
<select name="appointName" class="form-control m-b" required>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">开单日期:</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group date">
|
|
<input name="createDate" class="form-control time-input" placeholder="yyyy-MM-dd" type="text"
|
|
disabled>
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">交货日期:</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group date">
|
|
<input name="sendDate" class="form-control time-input" placeholder="yyyy-MM-dd" type="text"
|
|
required>
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label is-required">加工工序编号:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <select name="processNo" class="form-control m-b" required>-->
|
|
<!-- <option value="">所有</option>-->
|
|
<!-- </select>-->
|
|
<!-- <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">加工工序名称:</label>
|
|
<div class="col-sm-8">
|
|
<select name="processName" class="form-control m-b" required
|
|
th:with="type=${@dict.getType('process_class')}">
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
|
|
th:value="${dict.dictValue}"></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">联系人:</label>
|
|
<div class="col-sm-8">
|
|
<input name="linkman" class="form-control" type="text" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">传真号码:</label>
|
|
<div class="col-sm-8">
|
|
<input name="faxNumber" class="form-control" type="text" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">厂商地址:</label>
|
|
<div class="col-sm-8">
|
|
<input name="address" class="form-control" type="text" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">厂商电话:</label>
|
|
<div class="col-sm-8">
|
|
<input name="phoneNum" class="form-control" type="text" readonly>
|
|
</div>
|
|
</div>
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">结案否:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <select name="endFlag" class="form-control m-b">-->
|
|
<!-- <option value="0">未结案</option>-->
|
|
<!-- <option value="1">已结案</option>-->
|
|
<!-- </select>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">备注:</label>
|
|
<div class="col-sm-8">
|
|
<input name="remark" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<!-- <div class="form-group">-->
|
|
<!-- <label class="col-sm-3 control-label">发出仓库编号:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <select name="sendStockNo" class="form-control m-b">-->
|
|
<!-- </select>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">发出仓库名称:</label>
|
|
<div class="col-sm-8">
|
|
<select name="sendStockName" class="form-control m-b">
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<!-- <div class="form-group">-->
|
|
<!-- <label class="col-sm-3 control-label">交货仓库编号:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <select name="deliveryStockNo" class="form-control m-b">-->
|
|
<!-- </select>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">交货仓库名称:</label>
|
|
<div class="col-sm-8">
|
|
<select name="deliveryStockName" class="form-control m-b">
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">承运公司:</label>
|
|
<div class="col-sm-8">
|
|
<select name="carrierCompany" class="form-control m-b">
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">确认否:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <select name="confirmFlag" class="form-control m-b">-->
|
|
<!-- <option value="">所有</option>-->
|
|
<!-- </select>-->
|
|
<!-- <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">确认人:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <input name="confirmMan" class="form-control" type="text">-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">确认日期:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <div class="input-group date">-->
|
|
<!-- <input name="confirmDate" class="form-control" placeholder="yyyy-MM-dd" type="text">-->
|
|
<!-- <span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <input name="spare1" class="form-control" type="text">-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <input name="spare2" class="form-control" type="text">-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <input name="spare3" class="form-control" type="text">-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <input name="spare4" class="form-control" type="text">-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <input name="spare5" class="form-control" type="text">-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="form-group"> -->
|
|
<!-- <label class="col-sm-3 control-label">:</label>-->
|
|
<!-- <div class="col-sm-8">-->
|
|
<!-- <input name="spare6" class="form-control" type="text">-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
</form>
|
|
|
|
<div class="col-sm-12">
|
|
<label>物料代码:</label>
|
|
<input type="text" name="wlCode" id="wlCode" class="form-control" placeholder="请输入物料代码"
|
|
style="margin-bottom: 15px">
|
|
<button type="button" class="btn btn-success" id="itemTableSearch">搜索</button>
|
|
<button type="button" class="btn btn-success" onclick="itemTableReset()">重置</button>
|
|
<div class="col-sm-12 select-table table-striped" style="padding-bottom: 100px;">
|
|
<table id="bootstrap-table"></table>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-12" style="text-align: center">
|
|
<button type="button" class="btn btn-success" style="margin-top: 20px"
|
|
onclick="addItem()">确定
|
|
</button>
|
|
</div>
|
|
<div class="col-sm-12 select-table table-striped" style="padding-bottom: 100px;">
|
|
<table id="selectItemTable"></table>
|
|
<!-- <button type="button" onclick="commit()" class="btn btn-primary"-->
|
|
<!-- style="margin-top: 30px;margin-left: 620px;">提交-->
|
|
<!-- </button>-->
|
|
<!-- <button onclick="close()" class="btn btn-danger" type="button" style="margin-top: 30px;margin-left: 200px">-->
|
|
<!-- 关闭-->
|
|
<!-- </button>-->
|
|
</div>
|
|
|
|
</div>
|
|
<th:block th:include="include :: footer"/>
|
|
<script th:src="@{/ajax/libs/select2/select2.js}"></script>
|
|
<th:block th:include="include :: bootstrap-table-editable-js"/>
|
|
<th:block th:include="include :: datetimepicker-js"/>
|
|
<script th:inline="javascript">
|
|
var prefix = ctx + "produce/outSourceOrderHead"
|
|
$("#form-outSourceOrderHead-add").validate({
|
|
focusCleanup: true
|
|
});
|
|
|
|
function submitHandler() {
|
|
// if ($.validate.form()) {
|
|
// $.operate.save(prefix + "/add", $('#form-outSourceOrderHead-add').serialize());
|
|
// }
|
|
submit();
|
|
}
|
|
|
|
let today = new Date();
|
|
today.setTime(today.getTime());
|
|
let time = today.getFullYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate();
|
|
$("input[name='createDate']").val(time);
|
|
|
|
//鼠标移入,显示完整的数据
|
|
function paramsMatter(value, row, index) {
|
|
var span = document.createElement("span");
|
|
span.setAttribute("title", value);
|
|
span.innerHTML = value;
|
|
return span.outerHTML;
|
|
}
|
|
|
|
//获取单号
|
|
let id = "";
|
|
$.ajax({
|
|
url: prefix + "/id",
|
|
type: "post",
|
|
dateType: "json",
|
|
success: function (resp) {
|
|
if (resp.code === 0) {
|
|
$("input[name='outsourceOrderNo']").val(resp.data);
|
|
id = resp.data.slice(2);
|
|
} else {
|
|
$.modal.msgError("失败啦");
|
|
}
|
|
},
|
|
error: function () {
|
|
$.modal.msgError("失败啦");
|
|
}
|
|
});
|
|
|
|
//获取供应商
|
|
$.ajax({
|
|
url: ctx + "ProviderPrice/ProviderPrice/all",
|
|
type: "post",
|
|
resultType: "json",
|
|
success: function (resp) {
|
|
if (resp.data.length > 0) {
|
|
let data = resp.data;
|
|
for (let i in data) {
|
|
//alert(data[i].pCode);
|
|
$("select[name='appointNo']").append("<option value='" + data[i].pCode + "'>" + data[i].pCode + "</option>");
|
|
$("select[name='appointName']").append("<option value='" + data[i].pName + "'>" + data[i].pName + "</option>");
|
|
$("select[name='carrierCompany']").append("<option value='" + data[i].pName + "'>" + data[i].pName + "</option>");
|
|
}
|
|
}
|
|
},
|
|
error: function () {
|
|
$.modal.msgError("出错了!");
|
|
}
|
|
});
|
|
|
|
//选择供应商时自动填入信息
|
|
$("select[name='appointName']").change(function () {
|
|
let pName = $(this).val();
|
|
$.ajax({
|
|
url: ctx + "ProviderPrice/ProviderPrice/findOne",
|
|
data: {"pName": pName},
|
|
type: "post",
|
|
resultType: "json",
|
|
success: function (resp) {
|
|
$("select[name='appointNo']").val(resp.data.pCode).trigger("change");
|
|
$("input[name='linkman']").val(resp.data.pLinkman);
|
|
$("input[name='faxNumber']").val(resp.data.pFax);
|
|
$("input[name='address']").val(resp.data.pAddress);
|
|
$("input[name='phoneNum']").val(resp.data.pTel);
|
|
$("input[name='batchNumber']").val(resp.data.pCode + id);
|
|
},
|
|
error: function () {
|
|
$.modal.msgError("出错了!");
|
|
}
|
|
})
|
|
});
|
|
|
|
//获取仓库名
|
|
$.ajax({
|
|
url: ctx + "stock/stockInfo/all",
|
|
type: "post",
|
|
dataType: "json",
|
|
success: function (resp) {
|
|
if (resp.code === 0) {
|
|
let data = resp.data;
|
|
//alert(JSON.stringify(data));
|
|
for (let i in data) {
|
|
$("select[name='sendStockName']").append("<option value='" + data[i].stockname + "'>" + data[i].stockname + "</option>");
|
|
$("select[name='deliveryStockName']").append("<option value='" + data[i].stockname + "'>" + data[i].stockname + "</option>");
|
|
}
|
|
} else {
|
|
$.modal.msgError(resp.msg);
|
|
}
|
|
},
|
|
error: function () {
|
|
$.modal.msgError("后台出错啦!");
|
|
}
|
|
})
|
|
|
|
//全部库存
|
|
$('#bootstrap-table').bootstrapTable({
|
|
url: ctx + "ck/itemCP/itemList",
|
|
method: 'post',
|
|
striped: true, // 是否显示行间隔色
|
|
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
|
pagination: true, // 是否显示分页(*)
|
|
contentType: "application/x-www-form-urlencoded",
|
|
queryParams: function (params) {
|
|
var curParams = {
|
|
// 传递参数查询参数
|
|
pageSize: params.limit,
|
|
pageNum: params.offset / params.limit + 1
|
|
// searchValue: params.search,
|
|
// orderByColumn: params.sort,
|
|
// isAsc: params.order
|
|
};
|
|
var wlCode = $("#wlCode").val();
|
|
//alert(wlCode);
|
|
var json = $.extend(curParams, {"wlCode": wlCode});
|
|
return json;
|
|
},
|
|
sidePagination: "server", // 分页方式:client客户端分页,server服务端分页(*)
|
|
pageNumber: 1, // 初始化加载第一页,默认第一页
|
|
pageSize: 5, // 每页的记录行数(*)
|
|
pageList: [5, 10, 50], // 可供选择的每页的行数(*)
|
|
clickToSelect: true, // 是否启用点击选中行
|
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
|
cardView: false, // 是否显示详细视图
|
|
detailView: false, // 是否显示父子表
|
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
|
showExport: false, // 是否显示导出按钮
|
|
// singleSelect : true,
|
|
height: 350,
|
|
columns: [{
|
|
checkbox: true
|
|
},
|
|
{
|
|
field: 'wlCode',
|
|
title: '物料代码',
|
|
cellStyle: function (value, row, index) {
|
|
return {
|
|
css: {
|
|
"min-width": "80px",
|
|
"text-overflow": "ellipsis",
|
|
"overflow": "hidden",
|
|
"max-width": "100px",
|
|
"white-space": "nowrap"
|
|
}
|
|
}
|
|
},
|
|
formatter: paramsMatter
|
|
},
|
|
{
|
|
field: 'itemname',
|
|
title: '物料名称',
|
|
cellStyle: function (value, row, index) {
|
|
return {
|
|
css: {
|
|
"min-width": "80px",
|
|
"text-overflow": "ellipsis",
|
|
"overflow": "hidden",
|
|
"max-width": "100px",
|
|
"white-space": "nowrap"
|
|
}
|
|
}
|
|
},
|
|
formatter: paramsMatter
|
|
},
|
|
{
|
|
field: 'itemstandard',
|
|
title: '规格',
|
|
cellStyle: function (value, row, index) {
|
|
return {
|
|
css: {
|
|
"min-width": "80px",
|
|
"text-overflow": "ellipsis",
|
|
"overflow": "hidden",
|
|
"max-width": "100px",
|
|
"white-space": "nowrap"
|
|
}
|
|
}
|
|
},
|
|
formatter: paramsMatter
|
|
},
|
|
{
|
|
field: 'machineNo',
|
|
title: '机种'
|
|
},
|
|
{
|
|
field: 'stockDw',
|
|
title: '单位'
|
|
},
|
|
{
|
|
field: 'pWldm',
|
|
title: '客户料号'
|
|
}
|
|
]
|
|
});
|
|
|
|
//准备提交的item
|
|
$('#selectItemTable').bootstrapTable({
|
|
striped: true, // 是否显示行间隔色
|
|
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
|
// contentType :"application/x-www-form-urlencoded",
|
|
// pageNumber : 1, // 初始化加载第一页,默认第一页
|
|
// pageSize : 10, // 每页的记录行数(*)
|
|
// pageList : [ 5, 10,50], // 可供选择的每页的行数(*)
|
|
// clickToSelect : true, // 是否启用点击选中行
|
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
|
cardView: false, // 是否显示详细视图
|
|
detailView: false, // 是否显示父子表
|
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
|
showExport: false, // 是否显示导出按钮
|
|
singleSelect: true,
|
|
height: 400,
|
|
uniqueId: 'itemCode',
|
|
onEditableSave: function (field, row, oldValue, $el) {
|
|
//alert(row.qty);
|
|
//alert(JSON.stringify(row));
|
|
if (row.qty > 0 && row.price > 0) {
|
|
row.totalPrice = row.qty * row.price;
|
|
}
|
|
},
|
|
columns: [{
|
|
checkbox: false
|
|
},
|
|
{
|
|
field: 'itemCode',
|
|
title: '物料代码',
|
|
cellStyle: function (value, row, index) {
|
|
return {
|
|
css: {
|
|
"min-width": "80px",
|
|
"text-overflow": "ellipsis",
|
|
"overflow": "hidden",
|
|
"max-width": "100px",
|
|
"white-space": "nowrap"
|
|
}
|
|
}
|
|
},
|
|
formatter: paramsMatter
|
|
},
|
|
{
|
|
field: 'itemName',
|
|
title: '物料名称',
|
|
cellStyle: function (value, row, index) {
|
|
return {
|
|
css: {
|
|
"min-width": "80px",
|
|
"text-overflow": "ellipsis",
|
|
"overflow": "hidden",
|
|
"max-width": "100px",
|
|
"white-space": "nowrap"
|
|
}
|
|
}
|
|
},
|
|
formatter: paramsMatter
|
|
},
|
|
{
|
|
field: 'itemSpecification',
|
|
title: '规格型号',
|
|
cellStyle: function (value, row, index) {
|
|
return {
|
|
css: {
|
|
"min-width": "80px",
|
|
"text-overflow": "ellipsis",
|
|
"overflow": "hidden",
|
|
"max-width": "100px",
|
|
"white-space": "nowrap"
|
|
}
|
|
}
|
|
},
|
|
formatter: paramsMatter
|
|
},
|
|
{
|
|
field: 'machineType',
|
|
title: '机种',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'unit',
|
|
title: '单位'
|
|
},
|
|
{
|
|
field: 'qty',
|
|
title: '数量',
|
|
editable: {
|
|
type: 'text',
|
|
title: '数量',
|
|
emptytext: "0",
|
|
validate: function (value) {
|
|
if (parseInt(value) < 0) {
|
|
return '数量不能小于0!';
|
|
}
|
|
if (isNaN(value)) {
|
|
return '数量必须是数字!';
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'price',
|
|
title: '加工单价',
|
|
editable: {
|
|
type: 'text',
|
|
title: '数量',
|
|
emptytext: "0",
|
|
validate: function (value) {
|
|
if (parseInt(value) < 0) {
|
|
return '数量不能小于0!';
|
|
}
|
|
if (isNaN(value)) {
|
|
return '数量必须是数字!';
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'totalPrice',
|
|
title: '总价'
|
|
},
|
|
{
|
|
field: 'sendDate',
|
|
title: '交期',
|
|
editable: {
|
|
type: 'date',
|
|
title: '交期',
|
|
emptytext: time,
|
|
validate: function (value) {
|
|
let now = new Date();
|
|
if (value.getTime() < now.getTime()) {
|
|
return "交期至少是今天!";
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'remark',
|
|
title: '备注',
|
|
editable: {
|
|
type: 'text',
|
|
title: '说明',
|
|
emptytext: ""
|
|
}
|
|
},
|
|
{
|
|
title: '操作',
|
|
align: 'center',
|
|
formatter: function (value, row, index) {
|
|
var actions = [];
|
|
actions.push('<a class="btn btn-danger btn-xs ' + '" href="javascript:void(0)" onclick="remove(\'' + row.itemCode + '\')"><i class="fa fa-remove"></i>删除</a>');
|
|
return actions.join('');
|
|
}
|
|
}
|
|
]
|
|
});
|
|
|
|
//item表格重置
|
|
function itemTableReset() {
|
|
$("input[name='wlCode']").val("");
|
|
$("#bootstrap-table").bootstrapTable("refresh");
|
|
}
|
|
|
|
//搜索item表格
|
|
$("#itemTableSearch").on("click", function () {
|
|
$("#bootstrap-table").bootstrapTable("refresh");
|
|
})
|
|
|
|
//将选中的bom引入待确认bom表格
|
|
function addItem() {
|
|
let row = $("#bootstrap-table").bootstrapTable("getSelections");
|
|
let count = $('#selectItemTable').bootstrapTable('getData').length;
|
|
for (let i = 0; i < row.length; i++) {
|
|
let bootstrapTable = $("#selectItemTable").bootstrapTable("getRowByUniqueId", row[i].wlCode);
|
|
//alert(bootstrapTable);
|
|
if (bootstrapTable != null) {
|
|
alert("物料代码" + row[i].wlCode + "已存在!");
|
|
continue;
|
|
}
|
|
$("#selectItemTable").bootstrapTable('insertRow', {
|
|
index: count + i,
|
|
row: {
|
|
itemCode: row[i].wlCode,
|
|
itemName: row[i].itemname,
|
|
itemSpecification: row[i].itemstandard,
|
|
unit: row[i].stockDw,
|
|
qty: 0,
|
|
price: 0,
|
|
sendDate:new Date()
|
|
}
|
|
});
|
|
}
|
|
itemTableReset();
|
|
}
|
|
|
|
function remove(itemCode) {
|
|
$("#selectItemTable").bootstrapTable("remove", {
|
|
field: 'itemCode',
|
|
values: itemCode
|
|
});
|
|
}
|
|
|
|
//提交
|
|
function submit() {
|
|
let bootstrapTable = $("#selectItemTable").bootstrapTable("getData", true);
|
|
let formData = new FormData($("#form-outSourceOrderHead-add")[0]);
|
|
formData.append("outsourceOrderLists", JSON.stringify(bootstrapTable));
|
|
let data1 = {};
|
|
formData.forEach((value, key) => data1[key] = value);
|
|
//alert(JSON.stringify(data1));
|
|
$.ajax({
|
|
url: prefix + "/add",
|
|
type: "post",
|
|
resultType: "json",
|
|
data: {"jsonStr": JSON.stringify(data1)},
|
|
success: function (resp) {
|
|
if (resp.code === 0) {
|
|
alert("添加成功!");
|
|
// window.location.href = prefix;
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
var parent2 = window.parent;
|
|
parent2.$.table.refresh();
|
|
parent.layer.close(index);//关闭当前页
|
|
} else {
|
|
$.modal.msgError(resp.msg);
|
|
}
|
|
},
|
|
error: function () {
|
|
$.modal.msgError("出错了!");
|
|
}
|
|
});
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|