zhangsiqi
3 months ago
17 changed files with 670 additions and 758 deletions
@ -1,303 +1,307 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|||
<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> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-baseExpense-edit" th:object="${baseExpenseAccount}"> |
|||
<input name="expenseId" th:field="*{expenseId}" type="hidden"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">报销单编号:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="expenseCode" th:field="*{expenseCode}" class="form-control" type="text"> |
|||
</div> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-baseExpense-zozj" th:object="${baseExpenseAccount}"> |
|||
<input name="expenseId" th:field="*{expenseId}" type="hidden"> |
|||
<input name="expenseCode" th:field="*{expenseCode}" type="hidden"> |
|||
<input name="instanceId" th:field="*{instanceId}" type="hidden"> |
|||
<!--驳回调整允许更新内容--> |
|||
<div class="form-group"> |
|||
<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 class="form-group"> |
|||
<label class="col-sm-3 control-label">部门:</label> |
|||
</div> |
|||
<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"> |
|||
<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 class="form-group"> |
|||
<label class="col-sm-3 control-label">岗位:</label> |
|||
<div class="col-xs-6"> |
|||
<label class="col-sm-3 control-label">供应商ID:</label> |
|||
<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 class="form-group"> |
|||
<label class="col-sm-3 control-label">姓名:</label> |
|||
<div class="col-xs-6"> |
|||
<label class="col-sm-3 control-label">对公收款方:</label> |
|||
<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 class="form-group"> |
|||
<label class="col-sm-6 control-label">报销方式:</label> |
|||
<div class="col-sm-6"> |
|||
<select id="add_expenseMethod" name="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 class="col-xs-6"> |
|||
<label class="col-sm-3 control-label">对公收款账户:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="corporateReceivingAccount" th:field="*{corporateReceivingAccount}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
<div id="add_expenseMethodModal" class="container" style="display: none"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-6 control-label">是否是委外/采购采销:</label> |
|||
<div class="col-sm-6"> |
|||
<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 class="col-xs-6"> |
|||
<label class="col-sm-3 control-label">对公开户行:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="publicAccountBanks" th:field="*{publicAccountBanks}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
<div class="container"> |
|||
<div class="form-row"> |
|||
<div class="btn-group-sm" id="toolbar" role="group"> |
|||
<span style="color: black;font-size:17px;font-weight: bold" >报销分类信息</span> |
|||
<a class="btn btn-success" onclick="insertRow()"> |
|||
<span class="fa fa-plus"></span> 添加报销 |
|||
</a> |
|||
</div> |
|||
<input type="hidden" name="expenseDetailList" id="expenseDetailList"> |
|||
</div> |
|||
</form> |
|||
<div class="container"> |
|||
<div class="form-row"> |
|||
<div class="btn-group-sm" id="toolbar" role="group"> |
|||
<span>选择报销分类信息</span> |
|||
<a class="btn btn-success" onclick="insertRow()"> |
|||
<span class="fa fa-plus"></span> 添加报销 |
|||
</a> |
|||
<a class="btn btn-danger" onclick="removeRow()"> |
|||
<span class="fa fa-remove"></span> 删除报销 |
|||
</a> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<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> |
|||
<th:block th:include="include :: footer" /> |
|||
<th:block th:include="include :: bootstrap-table-editable-js" /> |
|||
<script th:inline="javascript"> |
|||
var prefix = ctx + "system/baseExpense" |
|||
var costTypeDatas = [[${@category.getChildByCode('costType')}]]; |
|||
var supplier = [[${formData.supplierCode}]]; |
|||
$("#form-baseExpense-add").validate({focusCleanup: true}); |
|||
$(function(){ |
|||
$.ajax({ |
|||
url: prefix + "/getId", |
|||
type: "post", |
|||
dataType: "json", |
|||
success: function(result) { |
|||
if (result.code == 0) { |
|||
$("input[name='expenseCode']").val(result.data); |
|||
} else { |
|||
$.modal.msgError(result.msg); |
|||
</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-table-editable-js" /> |
|||
<script th:src="@{/js/activiti.js}"></script> |
|||
<script th:inline="javascript"> |
|||
var prefix = ctx + "system/baseExpense"; |
|||
var costTypeDatas = [[${@category.getChildByCode('costType')}]]; |
|||
var taskId = [[${taskId}]]; |
|||
var baseExpense = [[${baseExpenseAccount}]]; |
|||
var $table = $("#bootstrap-sub-table-expense-edit"); |
|||
$("#form-baseExpense-edit").validate({focusCleanup: true}); |
|||
|
|||
$(function() { |
|||
var options = { |
|||
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, |
|||
sidePagination: "client", |
|||
model: "报销单数据", |
|||
editable: true, |
|||
columns: [ |
|||
{checkbox: true}, |
|||
{title: '主键',field: 'index',visible: false, |
|||
formatter: function (value, row, index) { |
|||
return index; |
|||
} |
|||
}, |
|||
{title: '报销单分项子表',field: 'expenseChildId',visible: false}, |
|||
{title: '关联报销单号',field: 'expenseCode',visible: false}, |
|||
{title: '成本类型',field: 'costType', |
|||
formatter:function (value, row, index) { |
|||
return costTypeFormatter(value,row,index); |
|||
} |
|||
}, |
|||
{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 |
|||
}; |
|||
{title: '报销单分项子表',field: 'expenseChildId',visible: false}, |
|||
{title: '关联报销单号',field: 'expenseCode',visible: false}, |
|||
{title: '成本类型',field: 'costType', |
|||
formatter:function (value, row, index) {return costTypeFormatter(value,row,index);} |
|||
}, |
|||
{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',title: '报销时间', placement: 'left',}}, |
|||
{title: '出差单号',field: 'evectionCode',editable:{type:'text', mode:'inline',}}, |
|||
{title: '采购单号',field: 'purchaseCode',editable:{type:'text', mode:'inline',}}, |
|||
{title: '委外单号',field: 'outsourceCode',editable:{type:'text', mode:'inline',}}, |
|||
{title: '操作', align: 'center', |
|||
formatter: function (value, row, index) { |
|||
return '<a class="btn btn-danger btn-xs" onclick="removeRow(\'' + row.index + '\')"><i class="fa fa-remove"></i>删除</a>'; |
|||
} |
|||
} |
|||
}); |
|||
$("#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(); |
|||
if (expenseMethod === '1') { |
|||
$("#add_expenseMethodModal").show(); |
|||
} else { |
|||
$("#add_expenseMethodModal").hide(); |
|||
} |
|||
} |
|||
$('#supplierCode').on('select2:select', function (e) { |
|||
var data = e.params.data; |
|||
$("input[name='corporatePayee']").val(data.supplierName); |
|||
$("input[name='corporateReceivingAccount']").val(data.bankAccount); |
|||
$("input[name='publicAccountBanks']").val(data.depositBank); |
|||
} |
|||
// 列中获取成本类型的下拉改变数据 |
|||
function onCostTypeChange(selectElement, rowIndex) { |
|||
var newSupplierId = $(selectElement).val(); |
|||
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>' ; |
|||
}); |
|||
|
|||
function insertRow() { |
|||
$table.bootstrapTable('insertRow', { |
|||
index:1, |
|||
row: { |
|||
expenseChildId:'', |
|||
costType: "", |
|||
costSmallType:"", |
|||
purpose:'' , |
|||
amounts: '', |
|||
expenseTime: '', |
|||
evectionCode:'' , |
|||
purcahseCode:'', |
|||
outsourceCode: '', |
|||
} |
|||
}) |
|||
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); |
|||
} |
|||
selectHtml += '</select>'; |
|||
return selectHtml; |
|||
} |
|||
// 自定义设备名称列的格式化函数,依赖于供应商列的选择 |
|||
function getCostSmallType(value, row, index) { |
|||
var selectHtml = '<select class="form-control" onchange="onCostSmallTypeChange(this, ' + index + ')">'; |
|||
// 假设此函数根据供应商ID返回设备列表 |
|||
var costSamllTypes = []; |
|||
$.ajax({ |
|||
url: ctx + 'system/category/getChildCode', |
|||
type: 'post', |
|||
data: {code: row.costType}, |
|||
async: false, |
|||
success: function (result) { |
|||
console.log(result); |
|||
costSamllTypes = result; |
|||
} |
|||
} |
|||
// 列中获取成本类型的下拉改变数据 |
|||
function onCostTypeChange(selectElement, rowIndex) { |
|||
var newSupplierId = $(selectElement).val(); |
|||
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>' ; |
|||
}); |
|||
if (costSamllTypes) { |
|||
costSamllTypes.forEach(function (child) { |
|||
selectHtml += '<option value="' + child.code + '"' + (value === child.code ? ' selected' : '') + '>' + child.name + '</option>'; |
|||
}); |
|||
selectHtml += '</select>'; |
|||
return selectHtml; |
|||
} |
|||
|
|||
// 自定义设备名称列的格式化函数,依赖于供应商列的选择 |
|||
function getCostSmallType(value, row, index) { |
|||
var selectHtml = '<select class="form-control" onchange="onCostSmallTypeChange(this, ' + index + ')">'; |
|||
// 假设此函数根据供应商ID返回设备列表 |
|||
var costSamllTypes = []; |
|||
$.ajax({ |
|||
url: ctx + 'system/category/getChildCode', |
|||
type: 'post', |
|||
data: {code: row.costType}, |
|||
async: false, |
|||
success: function (result) { |
|||
console.log(result); |
|||
costSamllTypes = result; |
|||
} |
|||
}); |
|||
if (costSamllTypes) { |
|||
costSamllTypes.forEach(function (child) { |
|||
selectHtml += '<option value="' + child.code + '"' + (value === child.code ? ' selected' : '') + '>' + child.name + '</option>'; |
|||
}); |
|||
selectHtml += '</select>'; |
|||
return selectHtml; |
|||
} |
|||
} |
|||
function onCostSmallTypeChange(selectElement, rowIndex) { |
|||
var newCostSmallType = $(selectElement).val(); |
|||
var tableData = $table.bootstrapTable('getData'); |
|||
var newRow = tableData[rowIndex]; // 获取当前行数据 |
|||
newRow.costSmallType = newCostSmallType; |
|||
// 重新渲染当前行的设备名称列 |
|||
// 更新行数据 |
|||
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow}); |
|||
} |
|||
// 假设此函数返回供应商列表 |
|||
function handleExpenseMethod(expenseMethodSelect) { |
|||
//获取页面元素中的下拉框选中的值 |
|||
var expenseMethod = $("#edit_expenseMethod option:selected").val(); |
|||
if (expenseMethod === '1') { |
|||
$("#edit_expenseMethodModal").show(); |
|||
} else { |
|||
$("#edit_expenseMethodModal").hide(); |
|||
} |
|||
} |
|||
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) { |
|||
var newCostSmallType = $(selectElement).val(); |
|||
var tableData = $table.bootstrapTable('getData'); |
|||
var newRow = tableData[rowIndex]; // 获取当前行数据 |
|||
newRow.costSmallType = newCostSmallType; |
|||
// 重新渲染当前行的设备名称列 |
|||
// 更新行数据 |
|||
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow}); |
|||
$("input[name='expenseTime']").datetimepicker({ |
|||
format: "yyyy-mm-dd", |
|||
minView: "month", |
|||
autoclose: true |
|||
}); |
|||
|
|||
function submitHandler() { |
|||
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> |
|||
</html> |
Loading…
Reference in new issue