|
@ -1,248 +1,171 @@ |
|
|
<!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"> |
|
|
|
|
|
<input name="expenseCode" th:field="*{expenseCode}" type="hidden"> |
|
|
|
|
|
<input name="instanceId" th:field="*{instanceId}" type="hidden"> |
|
|
|
|
|
<!--驳回调整允许更新内容--> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<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="expenseCode" th:field="*{expenseCode}" class="form-control" type="text"> |
|
|
<input name="title" th:field="*{applyTitle}" class="form-control" type="text" readonly> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<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="deptName" th:field="*{deptName}" class="form-control" type="text"> |
|
|
<input name="deptName" th:field="*{deptName}" class="form-control" /> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<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="postName" th:field="*{postName}" class="form-control" type="text"> |
|
|
<input name="postName" th:field="*{postName}" class="form-control"/> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<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="fullName" th:field="*{fullName}" class="form-control"/> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-6 control-label">报销方式:</label> |
|
|
<label class="col-sm-6 control-label">报销方式:</label> |
|
|
<div class="col-sm-6"> |
|
|
<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')}"> |
|
|
<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> |
|
|
<option th:each="dict : ${dictList}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> |
|
|
</select> |
|
|
</select> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div id="add_expenseMethodModal" class="container" style="display: none"> |
|
|
<div id="edit_expenseMethodModal" class="container" style="display: none"> |
|
|
<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 name="isPurchaseOutsource" class="form-control" th:with="dictList=${@dict.getType('sys_whether')}"> |
|
|
<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> |
|
|
<option th:each="dict : ${dictList}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> |
|
|
</select> |
|
|
</select> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="col-xs-6"> |
|
|
<label class="col-sm-6 control-label">供应商ID:</label> |
|
|
<label class="col-sm-3 control-label">供应商ID:</label> |
|
|
<div class="col-sm-6"> |
|
|
<div class="col-sm-8"> |
|
|
<select id="supplierCode" name="supplierCode" class="form-control"> |
|
|
<select id="supplierCode" name="supplierCode" class="form-control"></select> |
|
|
</select> |
|
|
|
|
|
</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"> |
|
|
<input name="corporatePayee" 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"> |
|
|
<input name="corporateReceivingAccount" class="form-control" type="text"> |
|
|
<input name="corporateReceivingAccount" th:field="*{corporateReceivingAccount}" 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"> |
|
|
<input name="publicAccountBanks" class="form-control" type="text"> |
|
|
<input name="publicAccountBanks" th:field="*{publicAccountBanks}" class="form-control" type="text"> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<input type="hidden" name="expenseDetailList" id="expenseDetailList"> |
|
|
</div> |
|
|
</div> |
|
|
</form> |
|
|
</form> |
|
|
<div class="container"> |
|
|
<div class="container"> |
|
|
<div class="form-row"> |
|
|
<div class="form-row"> |
|
|
<div class="btn-group-sm" id="toolbar" role="group"> |
|
|
<div class="btn-group-sm" id="toolbar" role="group"> |
|
|
<span style="color: black;font-size:17px;font-weight: bold" >报销分类信息</span> |
|
|
<span>选择报销分类信息</span> |
|
|
<a class="btn btn-success" onclick="insertRow()"> |
|
|
<a class="btn btn-success" onclick="insertRow()"> |
|
|
<span class="fa fa-plus"></span> 添加报销 |
|
|
<span class="fa fa-plus"></span> 添加报销 |
|
|
</a> |
|
|
</a> |
|
|
|
|
|
<a class="btn btn-danger" onclick="removeRow()"> |
|
|
|
|
|
<span class="fa fa-remove"></span> 删除报销 |
|
|
|
|
|
</a> |
|
|
</div> |
|
|
</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" /> |
|
|
|
|
|
<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 costTypeDatas = [[${@category.getChildByCode('costType')}]]; |
|
|
var supplier = [[${formData.supplierCode}]]; |
|
|
var taskId = [[${taskId}]]; |
|
|
$("#form-baseExpense-add").validate({focusCleanup: true}); |
|
|
var baseExpense = [[${baseExpenseAccount}]]; |
|
|
$(function(){ |
|
|
var $table = $("#bootstrap-sub-table-expense-edit"); |
|
|
$.ajax({ |
|
|
$("#form-baseExpense-edit").validate({focusCleanup: true}); |
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}) |
|
|
|
|
|
var $table = $("#bootstrap-sub-table-expense"); |
|
|
|
|
|
//获取子表信息 |
|
|
|
|
|
$(function() { |
|
|
$(function() { |
|
|
var options = { |
|
|
var options = { |
|
|
id:'bootstrap-sub-table-expense', |
|
|
id:'bootstrap-sub-table-expense-edit', |
|
|
url: ctx + "system/expenseChild/list", |
|
|
url: ctx + "system/expenseChild/list", |
|
|
queryParams: function(params) { |
|
|
queryParams: function(params) {return {expenseCode: $("#expenseCode").val()};}, |
|
|
return { |
|
|
|
|
|
expenseCode: $("#expenseCode").val() |
|
|
|
|
|
}; |
|
|
|
|
|
}, |
|
|
|
|
|
pagination: false, |
|
|
|
|
|
sidePagination: "client", |
|
|
sidePagination: "client", |
|
|
|
|
|
pagination: true, |
|
|
|
|
|
showColumns: false, |
|
|
|
|
|
showSearch: false, |
|
|
|
|
|
showRefresh:false, |
|
|
|
|
|
showToggle:false, |
|
|
model: "报销单数据", |
|
|
model: "报销单数据", |
|
|
editable: true, |
|
|
|
|
|
columns: [ |
|
|
columns: [ |
|
|
{checkbox: true}, |
|
|
{checkbox: true}, |
|
|
{title: '主键',field: 'index',visible: false, |
|
|
{title:'主键',field: 'index',align: 'center', |
|
|
formatter: function (value, row, index) { |
|
|
formatter: function (value, row, index) { |
|
|
|
|
|
var index = index + 1; |
|
|
return index; |
|
|
return index; |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
{title: '报销单分项子表',field: 'expenseChildId',visible: false}, |
|
|
{title: '报销单分项子表',field: 'expenseChildId',visible: false}, |
|
|
{title: '关联报销单号',field: 'expenseCode',visible: false}, |
|
|
{title: '关联报销单号',field: 'expenseCode',visible: false}, |
|
|
{title: '成本类型',field: 'costType', |
|
|
{title: '成本类型',field: 'costType', |
|
|
formatter:function (value, row, index) { |
|
|
formatter:function (value, row, index) {return costTypeFormatter(value,row,index);} |
|
|
return costTypeFormatter(value,row,index); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
{title: '成本小类',field: 'costSmallType', |
|
|
{title: '成本小类',field:'costSmallType', |
|
|
formatter:function(value, row, index){ |
|
|
formatter:function(value, row, index){return getCostSmallType(value,row,index)} |
|
|
return getCostSmallType(value,row,index) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
{title: '用途',field: 'purpose',editable:{type:'text',mode:'inline'}}, |
|
|
{title: '用途',field: 'purpose', editable:{type:'text', mode:'inline',}}, |
|
|
{title: '金额',field: 'amounts',editable: {type:'text',mode:'inline'}}, |
|
|
{title: '金额',field: 'amounts', editable:{type:'text', mode:'inline',}}, |
|
|
{title: '报销时间',field: 'expenseTime',editable:{type:'date',mode:'inline',}}, |
|
|
{title: '报销时间',field: 'expenseTime', editable: {type: 'date',title: '报销时间', placement: 'left',}}, |
|
|
{title: '出差单号',field: 'evectionCode',editable: {type:'text',mode:'inline'}}, |
|
|
{title: '出差单号',field: 'evectionCode',editable:{type:'text', mode:'inline',}}, |
|
|
{title: '采购单号',field: 'purcahseCode',editable: {type:'text',mode:'inline',}}, |
|
|
{title: '采购单号',field: 'purchaseCode',editable:{type:'text', mode:'inline',}}, |
|
|
{title: '委外单号',field: 'outsourceCode',editable: {type:'text',mode:'inline',}}, |
|
|
{title: '委外单号',field: 'outsourceCode',editable:{type:'text', mode:'inline',}}, |
|
|
{title: '操作', align: 'center', |
|
|
{title: '操作', align: 'center', |
|
|
formatter: function (value, row, index) { |
|
|
formatter: function (value, row, index) { |
|
|
var actions = []; |
|
|
return '<a class="btn btn-danger btn-xs" onclick="removeRow(\'' + row.index + '\')"><i class="fa fa-remove"></i>删除</a>'; |
|
|
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); |
|
|
$.table.init(options); |
|
|
// 假设此函数返回供应商列表 |
|
|
handleExpenseMethod(this); |
|
|
$("#supplierCode").select2({ |
|
|
loadSupplierCodes(); |
|
|
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); |
|
|
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 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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
// 列中获取成本类型的下拉改变数据 |
|
|
// 列中获取成本类型的下拉改变数据 |
|
|
function onCostTypeChange(selectElement, rowIndex) { |
|
|
function onCostTypeChange(selectElement, rowIndex) { |
|
@ -254,7 +177,6 @@ |
|
|
// 更新行数据 |
|
|
// 更新行数据 |
|
|
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow}); |
|
|
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 自定义供应商名称列的格式化函数 |
|
|
// 自定义供应商名称列的格式化函数 |
|
|
function costTypeFormatter(value, row, index) { |
|
|
function costTypeFormatter(value, row, index) { |
|
|
var selectHtml = '<select class="form-control" onchange="onCostTypeChange(this, ' + index + ')">'; |
|
|
var selectHtml = '<select class="form-control" onchange="onCostTypeChange(this, ' + index + ')">'; |
|
@ -264,7 +186,6 @@ |
|
|
selectHtml += '</select>'; |
|
|
selectHtml += '</select>'; |
|
|
return selectHtml; |
|
|
return selectHtml; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 自定义设备名称列的格式化函数,依赖于供应商列的选择 |
|
|
// 自定义设备名称列的格式化函数,依赖于供应商列的选择 |
|
|
function getCostSmallType(value, row, index) { |
|
|
function getCostSmallType(value, row, index) { |
|
|
var selectHtml = '<select class="form-control" onchange="onCostSmallTypeChange(this, ' + index + ')">'; |
|
|
var selectHtml = '<select class="form-control" onchange="onCostSmallTypeChange(this, ' + index + ')">'; |
|
@ -288,7 +209,6 @@ |
|
|
return selectHtml; |
|
|
return selectHtml; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function onCostSmallTypeChange(selectElement, rowIndex) { |
|
|
function onCostSmallTypeChange(selectElement, rowIndex) { |
|
|
var newCostSmallType = $(selectElement).val(); |
|
|
var newCostSmallType = $(selectElement).val(); |
|
|
var tableData = $table.bootstrapTable('getData'); |
|
|
var tableData = $table.bootstrapTable('getData'); |
|
@ -298,6 +218,90 @@ |
|
|
// 更新行数据 |
|
|
// 更新行数据 |
|
|
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow}); |
|
|
$table.bootstrapTable('updateRow', {index: rowIndex, row: newRow}); |
|
|
} |
|
|
} |
|
|
</script> |
|
|
// 假设此函数返回供应商列表 |
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$("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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
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> |