万材erp项目
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.
 
 
 
 

1043 lines
41 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">
<style type="text/css">
.select2-container--open {
z-index: 9999999
}
</style>
</head>
<body class="white-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12">
</div>
<form class="form-horizontal m" id="form-poinvoicehead-edit" th:object="${poInvoiceHead}">
<input name="invoiceid" th:field="*{invoiceid}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">发票号:</label>
<div class="col-sm-8">
<input name="Invoiceno" th:field="*{Invoiceno}" 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="pCode" class="form-control m-b" disabled>
<option value="-1">--请选择--</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">厂商名称:</label>
<div class="col-sm-8">
<select name="pName" class="form-control m-b">
<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="HTNO" th:field="*{HTNO}" 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="PAYWAY" th:field="*{PAYWAY}" 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="swater" th:field="*{swater}" 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="boxNum" th:field="*{boxNum}" 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="sendway" th:field="*{sendway}" 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="sendtool" th:field="*{sendtool}" 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="ShouldPayDate"
th:value="${#dates.format(poInvoiceHead.ShouldPayDate, 'yyyy-MM-dd')}"
class="form-control time-input" 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">
<div class="input-group date">
<input name="leavechinaDate"
th:value="${#dates.format(poInvoiceHead.leavechinaDate, 'yyyy-MM-dd')}"
class="form-control time-input" 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">
<select class="form-control" name="crlName" id="crlName"
th:with="type=${@dict.getType('sys_coin_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="ciqName" th:field="*{ciqName}" 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="dwater" th:field="*{dwater}" 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="CPSendID" th:field="*{CPSendID}" 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="taxInvoiceNo" th:field="*{taxInvoiceNo}" 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="taxPrintVersion" th:field="*{taxPrintVersion}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<textarea name="MemoText" class="form-control">[[*{MemoText}]]</textarea>
</div>
</div>
</form>
<button type="button" class="btn btn-success" id="btn_addBom" onclick="addItem()">新增</button>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrapTableBody">
</table>
<!-- <div class="col-sm-12" style="margin-top: 50px">-->
<!-- <div class="row">-->
<!-- <div class="col-sm-12 col-sm-offset-3">-->
<!-- <button type="button" class="btn btn-primary" onclick="submit()" style="margin-left: 230px">提交-->
<!-- </button>-->
<!-- <button onclick="closeAdd()" class="btn btn-danger" type="button" style="margin-left: 200px">-->
<!-- 关闭-->
<!-- </button>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div>
<div class="modal inmodal" id="itemModal" tabindex="-1"
role="dilog" aria-hidden="true" style="padding-bottom: 100px;">
<div class="modal-dialog" style="width: 800px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true"></button>
<h4 class="modal-title">选择物料</h4>
</div>
<div class="modal-body" style="text-align: center">
<div class="row">
<form id="itemForm" class="form-group">
<div class="col-md-6">
<div class="form-group">
<label class="col-sm-3 control-label">物料号:</label>
<div class="col-sm-9">
<input type="text" name="wlCode" class="form-control m-b">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料名:</label>
<div class="col-sm-9">
<input type="text" name="itemName" class="form-control m-b">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料种类:</label>
<div class="col-sm-9">
<select class="form-control m-b" name="itemClass">
<option value="">所有</option>
<option value="成品">成品</option>
<option value="原料">原料</option>
<option value="辅料">辅料</option>
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-sm-3 control-label">客户/厂商料号:</label>
<div class="col-sm-9">
<input type="text" name="pWldm" class="form-control m-b">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">批号:</label>
<div class="col-sm-9">
<input type="text" name="poPiNo" class="form-control m-b">
</div>
</div>
<div class="form-group" style="display: none">
<label class="col-sm-3 control-label">客户名:</label>
<div class="col-sm-9">
<select class="form-control" name="pName" id="pName">
<option value="">所有</option>
</select>
</div>
</div>
</div>
</form>
<div class="col-sm-12 col-sm-offset-3" style="margin-left: 0">
<button type="button" class="btn btn-primary" id="itemTableSearch">搜索</button>
<button type="button" class="btn btn-warning" id="itemTableReset">重置</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table id="itemTable"
class="table table-striped table-responsive" style="padding-bottom: 50px;">
</table>
</div>
</div>
</div>
<button class="btn btn-success" id="btn_addWaitTable" onclick="addItem2()">添加</button>
<div class="row">
<div class="col-md-12">
<div class="table-responsive" style="padding-bottom:30px; ">
<table id="itemTable2"
class="table table-striped table-responsive">
</table>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
onClick="confirm();">确定
</button>
<button type="button" class="btn btn-default" onclick="closeModal()">关闭</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-table-editable-js"/>
<script th:src="@{/ajax/libs/select2/select2.js}"></script>
<script th:inline="javascript">
let prefix = ctx + "invoice/poinvoicehead";
$("#form-poinvoicehead-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-poinvoicehead-edit').serialize());
}
}
//鼠标移入,显示完整的数据
function paramsMatter(value, row, index) {
var span = document.createElement("span");
span.setAttribute("title", value);
span.innerHTML = value;
return span.outerHTML;
}
let getData = [[${poInvoiceHead}]];
$("select[name='crlName']").val(getData.crlName).trigger("change");
//加载物料信息
$.ajax({
url: ctx + "invoice/poinvoicelist/getList",
type: "post",
dataType: "json",
data: {"invoiceid": getData.invoiceid},
success: function (resp) {
if (resp.code === 0) {
let row = resp.data;
let count = $('#bootstrapTableBody').bootstrapTable('getData').length;
for (let i = 0; i < row.length; i++) {
$("#bootstrapTableBody").bootstrapTable('insertRow', {
index: count + i,
row: {
wlCode: row[i].wlCode,
itemName: row[i].itemName,
stockDw: row[i].stockDw,
qty: row[i].qty,
price: row[i].price,
amt: row[i].amt,
crlName:row[i].crlName
}
});
}
} else {
$.modal.msgError(resp.msg);
}
},
error: function () {
$.modal.msgError("出错了!");
}
})
//模态框select2可输入
$.fn.modal.Constructor.prototype.enforceFocus = function () {
};
//点击引入按钮
function addItem() {
$("#itemModal").modal("show");
}
//关闭添加页面
function closeAdd() {
window.location.href = prefix;
}
//获取供应商编号和名称
$.ajax({
url: ctx + "ProviderPrice/ProviderPrice/all",
type: "post",
resultType: "json",
success: function (resp) {
if (resp.data.length > 0) {
$("select [name='pCode']").empty();
$("select [name='pName']").empty();
let data = resp.data;
for (let i in data) {
//alert(data[i].pCode);
$("select[name='pCode']").append("<option value='" + data[i].pCode + "'>" + data[i].pCode + "</option>");
$("select[name='pName']").append("<option value='" + data[i].pName + "'>" + data[i].pName + "</option>");
}
$("select[name='pName']").val(getData.pName).select2();
$("select[name='pCode']").val(getData.pCode).select2();
}
},
error: function () {
$.modal.msgError("出错了!");
}
});
//供应商名称改变时改变供应商编号
$("select[name='pName']").change(function () {
if ($(this).attr("id") === "pName") {
return false;
}
let pName = $(this).val();
$.ajax({
url: ctx + "ProviderPrice/ProviderPrice/findOne",
data: {"pName": pName},
type: "post",
resultType: "json",
success: function (resp) {
$("select[name='pCode']").val(resp.data.pCode).trigger("change");
},
error: function () {
$.modal.msgError("出错了!");
}
})
});
//引入item2表格
function addItem2() {
let row = $("#itemTable").bootstrapTable("getSelections");
let count = $('#itemTable2').bootstrapTable('getData').length;
for (let i = 0; i < row.length; i++) {
let bootstrapTable = $("#itemTable2").bootstrapTable("getRowByUniqueId", row[i].wlCode);
//alert(bootstrapTable);
if (bootstrapTable != null) {
alert(bootstrapTable.wlCode + "已存在!");
continue;
}
$("#itemTable2").bootstrapTable('insertRow', {
index: count + i,
row: {
wlCode: row[i].wlCode,
itemName: row[i].itemName,
itemStandard: row[i].itemStandard,
machineNo: row[i].machineNo,
stockDw: row[i].stockDw,
weight: row[i].weight,
pCode: row[i].pCode,
pName: row[i].pName,
stockNo: row[i].stockNo,
stockName: row[i].stockName,
nowJuan: row[i].nowJuan,
nowQty: row[i].nowQty,
fuWidth: row[i].fuWidth,
longWidth: row[i].longWidth,
wldm: row[i].wldm,
pWldm: row[i].pWldm,
poPiNo: row[i].poPiNo,
madeClass: row[i].madeClass,
inClass: row[i].inClass,
defaultPosition: row[i].defaultPosition
}
});
}
reset();
}
//引入准备提交的item表格
function confirm() {
let row = $("#itemTable2").bootstrapTable("getData", true);
let count = $('#bootstrapTableBody').bootstrapTable('getData').length;
for (let i = 0; i < row.length; i++) {
let bootstrapTable = $("#bootstrapTableBody").bootstrapTable("getRowByUniqueId", row[i].wlCode);
//alert(bootstrapTable);
if (bootstrapTable != null) {
alert(bootstrapTable.wlCode + "已存在!");
continue;
}
$("#bootstrapTableBody").bootstrapTable('insertRow', {
index: count + i,
row: {
wlCode: row[i].wlCode,
itemName: row[i].itemName,
stockDw: row[i].stockDw,
qty: 0,
price: 0,
amt: 0
}
});
}
closeModal();
}
//关闭模态框并刷新
function closeModal() {
$("#itemModal").modal("hide");
reset();
$("#itemTable2").bootstrapTable("removeAll");
}
//重置itemTable
$("#itemTableReset").on("click", function () {
$("input[name='wlCode']").val("");
$("input[name='itemName']").val("");
$("select[name='itemClass']").val("").trigger("change");
//$("#pName").val("").trigger("change");
$("input[name='pWldm']").val("");
$("input[name='poPiNo']").val("");
$("#itemTable").bootstrapTable("refresh");
})
function reset() {
$("input[name='wlCode']").val("");
$("input[name='itemName']").val("");
$("select[name='itemClass']").val("").trigger("change");
//$("#pName").val("").trigger("change");
$("input[name='pWldm']").val("");
$("input[name='poPiNo']").val("");
$("#itemTable").bootstrapTable("refresh");
}
//搜索itemTable
$("#itemTableSearch").on("click", function () {
$("#itemTable").bootstrapTable("refresh");
})
//全部itemList
$('#itemTable').bootstrapTable({
url: ctx + "invoice/poinvoicehead/poInvoiceHeadWithList",
method: 'post',
striped: true, // 是否显示行间隔色
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: true, // 是否显示分页(*)
contentType: "application/x-www-form-urlencoded",
queryParams: function (params) {
let curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1
// searchValue: params.search,
// orderByColumn: params.sort,
// isAsc: params.order
};
let json = $.extend(curParams, $.common.formToJSON("itemForm"));
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": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'itemName',
title: '品名',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'itemStandard',
title: '规格',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'stockDw',
title: '单位'
},
{
field: 'weight',
title: '单位重量'
},
{
field: 'wldm',
title: '物料码',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'stockNo',
title: '仓库号',
},
{
field: 'stockName',
title: '仓库名',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'nowJuan',
title: '库存卷数',
},
{
field: 'nowQty',
title: '库存数量',
},
{
field: 'poPiNo',
title: '批号',
},
{
field: 'pWldm',
title: '基本料号',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'fuWidth',
title: '幅宽',
},
{
field: 'longWidth',
title: '长度',
},
{
field: 'inClass',
title: '所属类别',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'madeClass',
title: '加工类型',
},
{
field: 'defaultPosition',
title: '存放位置',
},
]
});
//待确认item
$('#itemTable2').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: 'wlCode',
columns: [
{
field: 'wlCode',
title: '物料代码',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'itemName',
title: '品名',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'itemStandard',
title: '规格',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'stockDw',
title: '单位'
},
{
field: 'weight',
title: '单位重量'
},
{
field: 'wldm',
title: '物料码',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'stockNo',
title: '仓库号',
},
{
field: 'stockName',
title: '仓库名',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'nowJuan',
title: '库存卷数',
},
{
field: 'nowQty',
title: '库存数量',
},
{
field: 'poPiNo',
title: '批号',
},
{
field: 'pWldm',
title: '基本料号',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'fuWidth',
title: '幅宽',
},
{
field: 'longWidth',
title: '长度',
},
{
field: 'inClass',
title: '所属类别',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'madeClass',
title: '加工类型',
},
{
field: 'defaultPosition',
title: '存放位置',
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="edit()"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + '" href="javascript:void(0)" onclick="remove(\'' + row.wlCode + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}
]
});
//准备提交的item
$('#bootstrapTableBody').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: 'wlCode',
onEditableSave: function (field, row, oldValue, $el) {
if (row.qty > 0 && row.price > 0) {
row.amt = row.qty * row.price;
}
},
columns: [
{
checkbox: false
},
{
field: 'wlCode',
title: '料号',
},
{
field: 'itemName',
title: '品名',
},
{
field: 'stockDw',
title: '单位',
},
{
field: "qty",
title: '数量',
editable: {
type: 'text',
title: '数量',
emptytext: "0",
validate: function (value) {
if (parseInt(value) < 0) {
return '数量不能小于0!';
}
if (isNaN(value)) {
return '数量必须是数字!';
}
}
}
},
{
field: 'crlName',
title: '币别',
editable: {
type: 'select',
title: '币别',
source: function () {
let result = [];
$.ajax({
url: ctx + "system/dict/data/coin",
type: "post",
resultType: "json",
data: {"type": "sys_coin_class"},
async: false,
success: function (resp) {
if (resp.code === 0) {
let temp = resp.data;
for (let i in temp) {
result.push({value: temp[i].dictValue, text: temp[i].dictLabel});
}
} else {
$.modal.msgError(resp.msg);
}
},
error: function () {
$.modal.msgError("出错了!");
}
});
return result;
}
}
},
{
field: 'price',
title: '单价',
editable: {
type: 'text',
title: '单价',
emptytext: "0",
validate: function (value) {
if (parseInt(value) <= 0) {
return '单价必须大于0!';
}
if (isNaN(value)) {
return '数量必须是数字!';
}
}
}
},
{
field: 'amt',
title: '金额'
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs ' + '" href="javascript:void(0)" onclick="remove2(\'' + row.wlCode + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
});
//移除bomtable2的对应行数据
function remove(wlCode) {
$("#itemTable2").bootstrapTable("remove", {
field: 'wlCode',
values: wlCode
});
}
function remove2(wlCode) {
$("#bootstrapTableBody").bootstrapTable("remove", {
field: 'wlCode',
values: wlCode
});
}
//提交修改
function submit() {
let bootstrapTable = $("#bootstrapTableBody").bootstrapTable("getData", true);
let formData = new FormData($("#form-poinvoicehead-edit")[0]);
formData.append("poInvoiceListList", JSON.stringify(bootstrapTable));
let data = {};
formData.forEach((value, key) => data[key] = value);
//alert(JSON.stringify(data1));
$.ajax({
url: prefix + "/edit",
type: "post",
resultType: "json",
data: {"jsonStr": JSON.stringify(data)},
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("出错了!");
}
});
}
function submitHandler() {
// if ($.validate.form()) {
// $.operate.edit(prefix + "/edit", $('#form-ProviderPrice-add').serialize());
// }
submit();
}
</script>
</body>
</html>