zhangsiqi
3 months ago
17 changed files with 670 additions and 758 deletions
@ -1,303 +1,307 @@ |
|||||
<!DOCTYPE html> |
<!DOCTYPE html> |
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
||||
<head> |
<head> |
||||
<th:block th:include="include :: header('修改报销单')" /> |
<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-editable-css" /> |
||||
</head> |
</head> |
||||
<body class="white-bg"> |
<body class="white-bg"> |
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
<form class="form-horizontal m" id="form-baseExpense-edit" th:object="${baseExpenseAccount}"> |
<form class="form-horizontal m" id="form-baseExpense-zozj" th:object="${baseExpenseAccount}"> |
||||
<input name="expenseId" th:field="*{expenseId}" type="hidden"> |
<input name="expenseId" th:field="*{expenseId}" type="hidden"> |
||||
<div class="form-group"> |
<input name="expenseCode" th:field="*{expenseCode}" type="hidden"> |
||||
<label class="col-sm-3 control-label">报销单编号:</label> |
<input name="instanceId" th:field="*{instanceId}" type="hidden"> |
||||
<div class="col-sm-8"> |
<!--驳回调整允许更新内容--> |
||||
<input name="expenseCode" th:field="*{expenseCode}" class="form-control" type="text"> |
<div class="form-group"> |
||||
</div> |
<label class="col-sm-3 control-label">标题:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="title" th:field="*{applyTitle}" 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="deptName" th:field="*{deptName}" class="form-control" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">岗位:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="postName" th:field="*{postName}" class="form-control"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">姓名:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="fullName" th:field="*{fullName}" class="form-control"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-6 control-label">报销方式:</label> |
||||
|
<div class="col-sm-6"> |
||||
|
<select id="edit_expenseMethod" name="expenseMethod" th:field="*{expenseMethod}" onchange="handleExpenseMethod(this)" |
||||
|
class="form-control" |
||||
|
th:with="dictList=${@dict.getType('sys_base_expense_method')}"> |
||||
|
<option th:each="dict : ${dictList}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> |
||||
|
</select> |
||||
</div> |
</div> |
||||
<div class="form-group"> |
</div> |
||||
<label class="col-sm-3 control-label">部门:</label> |
<div id="edit_expenseMethodModal" class="container" style="display: none"> |
||||
|
<div class="col-xs-6"> |
||||
|
<label class="col-sm-3 control-label">是否是委外/采购采销:</label> |
||||
<div class="col-sm-8"> |
<div class="col-sm-8"> |
||||
<input name="deptName" th:field="*{deptName}" class="form-control" type="text"> |
<select name="isPurchaseOutsource" class="form-control" th:with="dictList=${@dict.getType('sys_whether')}"> |
||||
|
<option th:each="dict : ${dictList}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> |
||||
|
</select> |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
<div class="form-group"> |
<div class="col-xs-6"> |
||||
<label class="col-sm-3 control-label">岗位:</label> |
<label class="col-sm-3 control-label">供应商ID:</label> |
||||
<div class="col-sm-8"> |
<div class="col-sm-8"> |
||||
<input name="postName" th:field="*{postName}" class="form-control" type="text"> |
<select id="supplierCode" name="supplierCode" class="form-control"></select> |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
<div class="form-group"> |
<div class="col-xs-6"> |
||||
<label class="col-sm-3 control-label">姓名:</label> |
<label class="col-sm-3 control-label">对公收款方:</label> |
||||
<div class="col-sm-8"> |
<div class="col-sm-8"> |
||||
<input name="fullName" th:field="*{fullName}" class="form-control" type="text"> |
<input name="corporatePayee" th:field="*{corporatePayee}" class="form-control" type="text"> |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
<div class="form-group"> |
<div class="col-xs-6"> |
||||
<label class="col-sm-6 control-label">报销方式:</label> |
<label class="col-sm-3 control-label">对公收款账户:</label> |
||||
<div class="col-sm-6"> |
<div class="col-sm-8"> |
||||
<select id="add_expenseMethod" name="expenseMethod" onchange="handleExpenseMethod(this)" class="form-control" th:with="dictList=${@dict.getType('sys_base_expense_method')}"> |
<input name="corporateReceivingAccount" th:field="*{corporateReceivingAccount}" class="form-control" type="text"> |
||||
<option th:each="dict : ${dictList}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> |
|
||||
</select> |
|
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
<div id="add_expenseMethodModal" class="container" style="display: none"> |
<div class="col-xs-6"> |
||||
<div class="form-group"> |
<label class="col-sm-3 control-label">对公开户行:</label> |
||||
<label class="col-sm-6 control-label">是否是委外/采购采销:</label> |
<div class="col-sm-8"> |
||||
<div class="col-sm-6"> |
<input name="publicAccountBanks" th:field="*{publicAccountBanks}" class="form-control" type="text"> |
||||
<select name="isPurchaseOutsource" class="form-control" th:with="dictList=${@dict.getType('sys_whether')}"> |
|
||||
<option th:each="dict : ${dictList}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> |
|
||||
</select> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label class="col-sm-6 control-label">供应商ID:</label> |
|
||||
<div class="col-sm-6"> |
|
||||
<select id="supplierCode" name="supplierCode" class="form-control"> |
|
||||
</select> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label class="col-sm-6 control-label">对公收款方:</label> |
|
||||
<div class="col-sm-6"> |
|
||||
<input name="corporatePayee" class="form-control" type="text"> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label class="col-sm-6 control-label">对公收款账户:</label> |
|
||||
<div class="col-sm-6"> |
|
||||
<input name="corporateReceivingAccount" class="form-control" type="text"> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label class="col-sm-6 control-label">对公开户行:</label> |
|
||||
<div class="col-sm-6"> |
|
||||
<input name="publicAccountBanks" class="form-control" type="text"> |
|
||||
</div> |
|
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
</form> |
<input type="hidden" name="expenseDetailList" id="expenseDetailList"> |
||||
<div class="container"> |
</div> |
||||
<div class="form-row"> |
</form> |
||||
<div class="btn-group-sm" id="toolbar" role="group"> |
<div class="container"> |
||||
<span style="color: black;font-size:17px;font-weight: bold" >报销分类信息</span> |
<div class="form-row"> |
||||
<a class="btn btn-success" onclick="insertRow()"> |
<div class="btn-group-sm" id="toolbar" role="group"> |
||||
<span class="fa fa-plus"></span> 添加报销 |
<span>选择报销分类信息</span> |
||||
</a> |
<a class="btn btn-success" onclick="insertRow()"> |
||||
</div> |
<span class="fa fa-plus"></span> 添加报销 |
||||
|
</a> |
||||
|
<a class="btn btn-danger" onclick="removeRow()"> |
||||
|
<span class="fa fa-remove"></span> 删除报销 |
||||
|
</a> |
||||
</div> |
</div> |
||||
|
</div> |
||||
|
<div class="row"> |
||||
<div class="col-sm-12 select-table table-striped"> |
<div class="col-sm-12 select-table table-striped"> |
||||
<table id="bootstrap-sub-table-expense"></table> |
<table id="bootstrap-sub-table-expense-edit"></table> |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
<th:block th:include="include :: footer" /> |
</div> |
||||
<th:block th:include="include :: bootstrap-table-editable-js" /> |
<th:block th:include="include :: footer" /> |
||||
<script th:inline="javascript"> |
<th:block th:include="include :: datetimepicker-js" /> |
||||
var prefix = ctx + "system/baseExpense" |
<th:block th:include="include :: select2-js" /> |
||||
var costTypeDatas = [[${@category.getChildByCode('costType')}]]; |
<th:block th:include="include :: bootstrap-table-editable-js" /> |
||||
var supplier = [[${formData.supplierCode}]]; |
<script th:src="@{/js/activiti.js}"></script> |
||||
$("#form-baseExpense-add").validate({focusCleanup: true}); |
<script th:inline="javascript"> |
||||
$(function(){ |
var prefix = ctx + "system/baseExpense"; |
||||
$.ajax({ |
var costTypeDatas = [[${@category.getChildByCode('costType')}]]; |
||||
url: prefix + "/getId", |
var taskId = [[${taskId}]]; |
||||
type: "post", |
var baseExpense = [[${baseExpenseAccount}]]; |
||||
dataType: "json", |
var $table = $("#bootstrap-sub-table-expense-edit"); |
||||
success: function(result) { |
$("#form-baseExpense-edit").validate({focusCleanup: true}); |
||||
if (result.code == 0) { |
|
||||
$("input[name='expenseCode']").val(result.data); |
$(function() { |
||||
} else { |
var options = { |
||||
$.modal.msgError(result.msg); |
id:'bootstrap-sub-table-expense-edit', |
||||
|
url: ctx + "system/expenseChild/list", |
||||
|
queryParams: function(params) {return {expenseCode: $("#expenseCode").val()};}, |
||||
|
sidePagination: "client", |
||||
|
pagination: true, |
||||
|
showColumns: false, |
||||
|
showSearch: false, |
||||
|
showRefresh:false, |
||||
|
showToggle:false, |
||||
|
model: "报销单数据", |
||||
|
columns: [ |
||||
|
{checkbox: true}, |
||||
|
{title:'主键',field: 'index',align: 'center', |
||||
|
formatter: function (value, row, index) { |
||||
|
var index = index + 1; |
||||
|
return index; |
||||
} |
} |
||||
} |
|
||||
}); |
|
||||
}) |
|
||||
var $table = $("#bootstrap-sub-table-expense"); |
|
||||
//获取子表信息 |
|
||||
$(function() { |
|
||||
var options = { |
|
||||
id:'bootstrap-sub-table-expense', |
|
||||
url: ctx + "system/expenseChild/list", |
|
||||
queryParams: function(params) { |
|
||||
return { |
|
||||
expenseCode: $("#expenseCode").val() |
|
||||
}; |
|
||||
}, |
}, |
||||
pagination: false, |
{title: '报销单分项子表',field: 'expenseChildId',visible: false}, |
||||
sidePagination: "client", |
{title: '关联报销单号',field: 'expenseCode',visible: false}, |
||||
model: "报销单数据", |
{title: '成本类型',field: 'costType', |
||||
editable: true, |
formatter:function (value, row, index) {return costTypeFormatter(value,row,index);} |
||||
columns: [ |
}, |
||||
{checkbox: true}, |
{title: '成本小类',field:'costSmallType', |
||||
{title: '主键',field: 'index',visible: false, |
formatter:function(value, row, index){return getCostSmallType(value,row,index)} |
||||
formatter: function (value, row, index) { |
}, |
||||
return index; |
{title: '用途',field: 'purpose', editable:{type:'text', mode:'inline',}}, |
||||
} |
{title: '金额',field: 'amounts', editable:{type:'text', mode:'inline',}}, |
||||
}, |
{title: '报销时间',field: 'expenseTime', editable: {type: 'date',title: '报销时间', placement: 'left',}}, |
||||
{title: '报销单分项子表',field: 'expenseChildId',visible: false}, |
{title: '出差单号',field: 'evectionCode',editable:{type:'text', mode:'inline',}}, |
||||
{title: '关联报销单号',field: 'expenseCode',visible: false}, |
{title: '采购单号',field: 'purchaseCode',editable:{type:'text', mode:'inline',}}, |
||||
{title: '成本类型',field: 'costType', |
{title: '委外单号',field: 'outsourceCode',editable:{type:'text', mode:'inline',}}, |
||||
formatter:function (value, row, index) { |
{title: '操作', align: 'center', |
||||
return costTypeFormatter(value,row,index); |
formatter: function (value, row, index) { |
||||
} |
return '<a class="btn btn-danger btn-xs" onclick="removeRow(\'' + row.index + '\')"><i class="fa fa-remove"></i>删除</a>'; |
||||
}, |
|
||||
{title: '成本小类',field: 'costSmallType', |
|
||||
formatter:function(value, row, index){ |
|
||||
return getCostSmallType(value,row,index) |
|
||||
} |
|
||||
}, |
|
||||
{title: '用途',field: 'purpose',editable:{type:'text',mode:'inline'}}, |
|
||||
{title: '金额',field: 'amounts',editable: {type:'text',mode:'inline'}}, |
|
||||
{title: '报销时间',field: 'expenseTime',editable:{type:'date',mode:'inline',}}, |
|
||||
{title: '出差单号',field: 'evectionCode',editable: {type:'text',mode:'inline'}}, |
|
||||
{title: '采购单号',field: 'purcahseCode',editable: {type:'text',mode:'inline',}}, |
|
||||
{title: '委外单号',field: 'outsourceCode',editable: {type:'text',mode:'inline',}}, |
|
||||
{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.index + '\')"><i class="fa fa-remove"></i>删除</a> '); |
|
||||
return actions.join(''); |
|
||||
} |
|
||||
} |
|
||||
], |
|
||||
}; |
|
||||
$.table.init(options); |
|
||||
// 假设此函数返回供应商列表 |
|
||||
$("#supplierCode").select2({ |
|
||||
theme: "bootstrap", |
|
||||
allowClear: true, |
|
||||
placeholder: "请选择供应商", |
|
||||
ajax: { |
|
||||
url: '/system/supplier/getSupplier', |
|
||||
dataType: 'json', |
|
||||
method: "post", |
|
||||
delay: 250, |
|
||||
processResults: function (res, params) { |
|
||||
var options = []; |
|
||||
if(res.code==0){ |
|
||||
var resultList = res.rows; |
|
||||
for(let i in resultList){ |
|
||||
var option = resultList[i]; |
|
||||
option.id = resultList[i]["supplierCode"]; |
|
||||
option.text = resultList[i]["supplierCode"]; |
|
||||
options.push(option); |
|
||||
} |
|
||||
} |
|
||||
return { |
|
||||
results: options |
|
||||
}; |
|
||||
} |
} |
||||
} |
} |
||||
}); |
], |
||||
$("#supplierCode").val(supplier); |
}; |
||||
|
$.table.init(options); |
||||
|
handleExpenseMethod(this); |
||||
|
loadSupplierCodes(); |
||||
|
}); |
||||
|
function removeRow(index) { |
||||
|
// 使用索引值移除行 |
||||
|
$('#bootstrap-sub-table-expense-edit').bootstrapTable('remove', { |
||||
|
field: 'index', |
||||
|
values: index |
||||
}); |
}); |
||||
function handleExpenseMethod(expenseMethodSelect) { |
} |
||||
//获取页面元素中的下拉框选中的值 |
// 列中获取成本类型的下拉改变数据 |
||||
var expenseMethod = $("#add_expenseMethod option:selected").val(); |
function onCostTypeChange(selectElement, rowIndex) { |
||||
if (expenseMethod === '1') { |
var newSupplierId = $(selectElement).val(); |
||||
$("#add_expenseMethodModal").show(); |
var tableData = $table.bootstrapTable('getData'); |
||||
} else { |
var newRow = tableData[rowIndex]; // 获取当前行数据 |
||||
$("#add_expenseMethodModal").hide(); |
newRow.costType = newSupplierId; // 更新供应商ID |
||||
} |
// 重新渲染成本小类的设备名称列 |
||||
} |
// 更新行数据 |
||||
$('#supplierCode').on('select2:select', function (e) { |
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow}); |
||||
var data = e.params.data; |
} |
||||
$("input[name='corporatePayee']").val(data.supplierName); |
// 自定义供应商名称列的格式化函数 |
||||
$("input[name='corporateReceivingAccount']").val(data.bankAccount); |
function costTypeFormatter(value, row, index) { |
||||
$("input[name='publicAccountBanks']").val(data.depositBank); |
var selectHtml = '<select class="form-control" onchange="onCostTypeChange(this, ' + index + ')">'; |
||||
|
costTypeDatas.forEach(function (child) { |
||||
|
selectHtml += '<option value="' + child.code + '"' + (value === child.code ? ' selected' : '') + '>' + child.name + '</option>' ; |
||||
}); |
}); |
||||
|
selectHtml += '</select>'; |
||||
function insertRow() { |
return selectHtml; |
||||
$table.bootstrapTable('insertRow', { |
} |
||||
index:1, |
// 自定义设备名称列的格式化函数,依赖于供应商列的选择 |
||||
row: { |
function getCostSmallType(value, row, index) { |
||||
expenseChildId:'', |
var selectHtml = '<select class="form-control" onchange="onCostSmallTypeChange(this, ' + index + ')">'; |
||||
costType: "", |
// 假设此函数根据供应商ID返回设备列表 |
||||
costSmallType:"", |
var costSamllTypes = []; |
||||
purpose:'' , |
$.ajax({ |
||||
amounts: '', |
url: ctx + 'system/category/getChildCode', |
||||
expenseTime: '', |
type: 'post', |
||||
evectionCode:'' , |
data: {code: row.costType}, |
||||
purcahseCode:'', |
async: false, |
||||
outsourceCode: '', |
success: function (result) { |
||||
} |
console.log(result); |
||||
}) |
costSamllTypes = result; |
||||
layer.close(index); |
|
||||
} |
|
||||
/* 删除指定表格行 */ |
|
||||
function removeRow(id){ |
|
||||
$table.bootstrapTable('remove', { |
|
||||
field: 'id', |
|
||||
values: id |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
function submitHandler() { |
|
||||
if ($.validate.form()) { |
|
||||
var formData = $('#form-baseExpense-edit').serializeArray(); |
|
||||
var tableData = $table.bootstrapTable('getData'); |
|
||||
var rows = tableData.length; |
|
||||
if(rows==0){ |
|
||||
$.modal.alertWarning("子表数据不能为空!"); |
|
||||
}else{ |
|
||||
formData.push({"name": "expenseAccountChildList", "value": tableData}); |
|
||||
var jsonData = $.common.formDataToJson(formData); |
|
||||
$.operate.saveJson(prefix + "/edit", jsonData); |
|
||||
} |
|
||||
} |
} |
||||
} |
}); |
||||
// 列中获取成本类型的下拉改变数据 |
if (costSamllTypes) { |
||||
function onCostTypeChange(selectElement, rowIndex) { |
costSamllTypes.forEach(function (child) { |
||||
var newSupplierId = $(selectElement).val(); |
selectHtml += '<option value="' + child.code + '"' + (value === child.code ? ' selected' : '') + '>' + child.name + '</option>'; |
||||
var tableData = $table.bootstrapTable('getData'); |
|
||||
var newRow = tableData[rowIndex]; // 获取当前行数据 |
|
||||
newRow.costType = newSupplierId; // 更新供应商ID |
|
||||
// 重新渲染成本小类的设备名称列 |
|
||||
// 更新行数据 |
|
||||
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow}); |
|
||||
} |
|
||||
|
|
||||
// 自定义供应商名称列的格式化函数 |
|
||||
function costTypeFormatter(value, row, index) { |
|
||||
var selectHtml = '<select class="form-control" onchange="onCostTypeChange(this, ' + index + ')">'; |
|
||||
costTypeDatas.forEach(function (child) { |
|
||||
selectHtml += '<option value="' + child.code + '"' + (value === child.code ? ' selected' : '') + '>' + child.name + '</option>' ; |
|
||||
}); |
}); |
||||
selectHtml += '</select>'; |
selectHtml += '</select>'; |
||||
return selectHtml; |
return selectHtml; |
||||
} |
} |
||||
|
} |
||||
// 自定义设备名称列的格式化函数,依赖于供应商列的选择 |
function onCostSmallTypeChange(selectElement, rowIndex) { |
||||
function getCostSmallType(value, row, index) { |
var newCostSmallType = $(selectElement).val(); |
||||
var selectHtml = '<select class="form-control" onchange="onCostSmallTypeChange(this, ' + index + ')">'; |
var tableData = $table.bootstrapTable('getData'); |
||||
// 假设此函数根据供应商ID返回设备列表 |
var newRow = tableData[rowIndex]; // 获取当前行数据 |
||||
var costSamllTypes = []; |
newRow.costSmallType = newCostSmallType; |
||||
$.ajax({ |
// 重新渲染当前行的设备名称列 |
||||
url: ctx + 'system/category/getChildCode', |
// 更新行数据 |
||||
type: 'post', |
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow}); |
||||
data: {code: row.costType}, |
} |
||||
async: false, |
// 假设此函数返回供应商列表 |
||||
success: function (result) { |
function handleExpenseMethod(expenseMethodSelect) { |
||||
console.log(result); |
//获取页面元素中的下拉框选中的值 |
||||
costSamllTypes = result; |
var expenseMethod = $("#edit_expenseMethod option:selected").val(); |
||||
} |
if (expenseMethod === '1') { |
||||
}); |
$("#edit_expenseMethodModal").show(); |
||||
if (costSamllTypes) { |
} else { |
||||
costSamllTypes.forEach(function (child) { |
$("#edit_expenseMethodModal").hide(); |
||||
selectHtml += '<option value="' + child.code + '"' + (value === child.code ? ' selected' : '') + '>' + child.name + '</option>'; |
|
||||
}); |
|
||||
selectHtml += '</select>'; |
|
||||
return selectHtml; |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
|
function getSelections(){ |
||||
|
$.ajax({ |
||||
|
url: ctx + "system/requisitioning/getEmpUserName", |
||||
|
type: "get", |
||||
|
dataType: "json", |
||||
|
success: function (data) { |
||||
|
$("input[name='deptName']").val(data.deptName); |
||||
|
$("input[name='fullName']").val(data.userName); |
||||
|
$("input[name='postName']").val(data.postName); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
function onCostSmallTypeChange(selectElement, rowIndex) { |
$("input[name='expenseTime']").datetimepicker({ |
||||
var newCostSmallType = $(selectElement).val(); |
format: "yyyy-mm-dd", |
||||
var tableData = $table.bootstrapTable('getData'); |
minView: "month", |
||||
var newRow = tableData[rowIndex]; // 获取当前行数据 |
autoclose: true |
||||
newRow.costSmallType = newCostSmallType; |
}); |
||||
// 重新渲染当前行的设备名称列 |
|
||||
// 更新行数据 |
function submitHandler() { |
||||
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow}); |
if ($.validate.form()) { |
||||
|
var tableData = $("#bootstrap-sub-table-expense-edit").bootstrapTable('getData'); |
||||
|
var formData = $("#form-baseExpense-add").serializeArray(); |
||||
|
var rows = tableData.length; |
||||
|
if(rows==0){ |
||||
|
$.modal.alertWarning("子表数据不能为空!"); |
||||
|
}else{ |
||||
|
formData.push({"name": "expenseAccountChildList", "value": tableData}); |
||||
|
var jsonData = $.common.formDataToJson(formData); |
||||
|
$.operate.saveJson(prefix + "/edit", jsonData); |
||||
|
} |
||||
} |
} |
||||
</script> |
} |
||||
|
function loadSupplierCodes() { |
||||
|
var url = ctx + 'system/supplier/getSupplier'; |
||||
|
$.ajax({ |
||||
|
type: 'post', // 请求类型 |
||||
|
url: url, // 后端接口URL |
||||
|
dataType: 'json', // 预期服务器返回的数据类型 |
||||
|
success: function(data) { |
||||
|
if (data.rows && Array.isArray(data.rows)) { |
||||
|
var selectElement = $('#supplierCode'); // 获取仓库编号下拉框元素 |
||||
|
// 清空下拉框现有选项 |
||||
|
selectElement.empty(); |
||||
|
// 添加默认选项(如果需要)编辑时不需要添加默认选项 |
||||
|
selectElement.append('<option value="">所有</option>'); |
||||
|
// 遍历返回的数据,添加为下拉框的选项 |
||||
|
$.each(data.rows, function(index, item) { |
||||
|
// 仓库ID |
||||
|
selectElement.append('<option value="' + item.supplierCode + '">' + item.supplierCode + '</option>'); |
||||
|
}); |
||||
|
selectElement.val(baseExpense.supplierCode); |
||||
|
} else { |
||||
|
$.modal.alertWarning("数据为空"); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
$('#supplierCode').on('change',function (e) { |
||||
|
$.ajax({ |
||||
|
type: 'post', // 请求类型 |
||||
|
url: ctx + 'system/supplier/getSupplierName', // 后端接口URL |
||||
|
dataType: 'json', // 预期服务器返回的数据类型 |
||||
|
data:{ |
||||
|
supplierCode: $('#supplierCode option:selected').val(), |
||||
|
}, |
||||
|
success: function(data) { |
||||
|
var expenseAccount = data[0]; |
||||
|
$("input[name='corporatePayee']").val(expenseAccount.supplierName); |
||||
|
$("input[name='corporateReceivingAccount']").val(expenseAccount.bankAccount); |
||||
|
$("input[name='publicAccountBanks']").val(expenseAccount.depositBank); |
||||
|
}, |
||||
|
}); |
||||
|
}); |
||||
|
</script> |
||||
</body> |
</body> |
||||
</html> |
</html> |
Loading…
Reference in new issue