Browse Source
应收账款 新增非销售订单创建收款凭证和含有销售订单的数据展示不同页面的功能 新增非销售订单创建收款凭证addReceivablesVoucher.html页面 修改addReceivablesVouche.html和 addReceivablesVoucher.html的部分字段为只读dev
liuxiaoxu
6 months ago
5 changed files with 340 additions and 32 deletions
@ -0,0 +1,295 @@ |
|||
<!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" /> |
|||
<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-receivables-edit" th:object="${financialReceivables}"> |
|||
<input name="financialReceivablesId" th:field="*{financialReceivablesId}" type="hidden"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">应收单号:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="financialReceivablesCode" th:field="*{financialReceivablesCode}" 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="receivablesClosingStatus" class="form-control m-b" th:with="type=${@dict.getType('receivables_closing_status')}" readonly disabled> |
|||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{receivablesClosingStatus}"></option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">贷方科目:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="creditAccount" th:field="*{creditAccount}" 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="creditDetail" th:field="*{creditDetail}" 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="openBank" th:field="*{openBank}" 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="openAccount" th:field="*{openAccount}" 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="contractNumber" th:field="*{contractNumber}" 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="currencyType" class="form-control m-b" th:with="type=${@dict.getType('sys_common_currency')}" readonly disabled> |
|||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{currencyType}"></option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">不含税金额:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="priceExcludingTax" th:field="*{priceExcludingTax}" 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="priceIncludesTax" th:field="*{priceIncludesTax}" 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="paymentCondition" th:field="*{paymentCondition}" class="form-control" type="text" readonly> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
<div class="container"> |
|||
<!-- 收款记录 --> |
|||
<div class="row"> |
|||
<div class="col-sm-12 select-table table-striped"> |
|||
<h3 class="mb-4">收款记录</h3> |
|||
<table id="bootstrap-receivablesRecords-table"></table> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- 间隔行,用于分隔 --> |
|||
<div class="row"> |
|||
<div class="col-sm-12 mt-5"><!-- 使用mt-* 类来增加上边距,例如 mt-5 对应 Bootstrap 的 margin-top: 3rem; --></div> |
|||
</div> |
|||
|
|||
<!-- 收款凭证 --> |
|||
<div class="row"> |
|||
<div class="col-sm-12 d-flex align-items-center"> |
|||
<span style="font-weight: bold; font-family: Arial, sans-serif; font-size: 15px;">收款凭证</span> |
|||
<a class="btn btn-success ml-auto" onclick="addReceivablesRecordsDetail()"> |
|||
<i class="fa fa-plus"></i> 添加收款明细 |
|||
</a> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-sm-12 select-table table-striped"> |
|||
<table id="bootstrap-receivablesVoucher-table"></table> |
|||
</div> |
|||
</div> |
|||
|
|||
<div id="totalReceivablesAmount" class="col-sm-12 d-flex align-items-center mt-3"> |
|||
<span style="font-family: Arial, sans-serif; font-size: 10px;">收款合计:</span> |
|||
<span id="totalAmountDisplay">0.00</span> |
|||
</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:inline="javascript"> |
|||
var financialReceivables = [[${financialReceivables}]]; |
|||
var prefix = ctx + "financial/receivables"; |
|||
$("#form-receivables-edit").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
function submitHandler() { |
|||
// 获取表单数据 |
|||
const financialReceivablesData = $("#form-receivables-edit").serializeArray().reduce((obj, item) => { |
|||
obj[item.name] = item.value; |
|||
return obj; |
|||
}, {}); |
|||
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 |
|||
var table = $('#bootstrap-receivablesVoucher-table').bootstrapTable('getData'); |
|||
// 检查表格数据是否为空 |
|||
if (table.length===0){ |
|||
$.modal.alertWarning("请至少添加一条收款明细后再保存!"); |
|||
return; |
|||
} |
|||
// 将表数据转换成与complaintNoticeData格式一致的数组 |
|||
var financialReceivablesRecordsList = table.map(function(item) { |
|||
// 根据实际字段名调整 |
|||
return { |
|||
"receivablesAbstract": item.receivablesAbstract, |
|||
"receivablesPrice": item.receivablesPrice, |
|||
// ...其他字段 |
|||
}; |
|||
}); |
|||
|
|||
// 合并表单数据和表格数据 |
|||
const combinedData = Object.assign({}, financialReceivablesData, { receivablesRecordsVOList: financialReceivablesRecordsList }); |
|||
|
|||
console.log(combinedData) |
|||
// 使用 JSON.stringify() 序列化数据 |
|||
const jsonData = JSON.stringify(combinedData); |
|||
// 发送 AJAX 请求到后端接口 |
|||
$.operate.saveJson(prefix + "/addReceivablesVoucherNoSales", jsonData); |
|||
} |
|||
|
|||
|
|||
|
|||
$("input[name='receivablesDate']").datetimepicker({ |
|||
format: "yyyy-mm-dd", |
|||
minView: "month", |
|||
autoclose: true |
|||
}); |
|||
|
|||
$("input[name='operatingTime']").datetimepicker({ |
|||
format: "yyyy-mm-dd", |
|||
minView: "month", |
|||
autoclose: true |
|||
}); |
|||
|
|||
/*根据收款编号对应的收款明细*/ |
|||
$(function() { |
|||
var options = { |
|||
id:"bootstrap-receivablesRecords-table", |
|||
url: prefix + "/getReceivablesRecords", |
|||
modalName: "收款记录", |
|||
showColumns: false, |
|||
pagination: false, |
|||
showToggle: false, |
|||
showRefresh:false, |
|||
showSearch:false, |
|||
queryParams:queryParams, |
|||
columns: [ |
|||
{ |
|||
title: '财务应收账款记录id', |
|||
field: 'receivablesRecordsId', |
|||
visible: false |
|||
}, |
|||
{ |
|||
title: '操作时间', |
|||
field: 'operatingTime', |
|||
}, |
|||
{ |
|||
title: '摘要', |
|||
field: 'receivablesAbstract', |
|||
}, |
|||
{ |
|||
title: '收款金额', |
|||
field: 'receivablesPrice', |
|||
formatter: function(value, row, index) { |
|||
// 格式化收款金额为保留两位小数的字符串 |
|||
return parseFloat(value).toFixed(2); |
|||
} |
|||
}, |
|||
] |
|||
}; |
|||
$.table.init(options); |
|||
}) |
|||
function queryParams(params) { |
|||
var curParams = { |
|||
// 传递参数查询参数 |
|||
financialReceivablesCode: financialReceivables.financialReceivablesCode |
|||
}; |
|||
return curParams; |
|||
} |
|||
|
|||
//添加收款明细 |
|||
function addReceivablesRecordsDetail() { |
|||
// 生成一个简单的唯一标识,这里使用时间戳作为示例 |
|||
var uniqueId = new Date().getTime(); |
|||
// 创建一个新行数据模板,这里仅为示例,具体根据表格列来定义 |
|||
var newRow = { |
|||
receivablesRecordsId:uniqueId, |
|||
receivablesAbstract: "", |
|||
receivablesPrice: "", |
|||
}; |
|||
|
|||
// 使用Bootstrap Table的API插入新行 |
|||
$('#bootstrap-receivablesVoucher-table').bootstrapTable('append', newRow); |
|||
|
|||
} |
|||
//收款凭证table列表 |
|||
$(function() { |
|||
var options = { |
|||
id:"bootstrap-receivablesVoucher-table", |
|||
modalName: "收款凭证", |
|||
showColumns: false, |
|||
pagination: false, |
|||
showToggle: false, |
|||
showRefresh:false, |
|||
showSearch:false, |
|||
singleSelect:true, |
|||
columns: [{ |
|||
checkbox: false |
|||
}, |
|||
{ |
|||
title: '财务应收账款记录id', |
|||
field: 'receivablesRecordsId', |
|||
visible: false |
|||
}, |
|||
{ |
|||
title: '收款摘要', |
|||
field: 'receivablesAbstract', |
|||
editable: { |
|||
type: 'text', // 表示该列可以被编辑为文本 |
|||
}, |
|||
}, |
|||
{ |
|||
title: '收款金额', |
|||
field: 'receivablesPrice', |
|||
editable: { |
|||
type: 'text', // 表示该列可以被编辑为文本 |
|||
}, |
|||
}, |
|||
{ |
|||
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.receivablesRecordsId + '\')"><i class="fa fa-remove"></i>删除</a> '); |
|||
return actions.join(''); |
|||
} |
|||
} |
|||
] |
|||
}; |
|||
$.table.init(options); |
|||
}) |
|||
|
|||
|
|||
// 逻辑删除收款凭证前端的一行数据 |
|||
function removeRow(receivablesRecordsId){ |
|||
console.log(receivablesRecordsId); |
|||
// 直接使用 receivablesRecordsId 值进行删除操作 |
|||
$("#bootstrap-receivablesVoucher-table").bootstrapTable('remove', { |
|||
field: 'receivablesRecordsId', |
|||
values: receivablesRecordsId |
|||
}); |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
Loading…
Reference in new issue