|
|
@ -37,41 +37,37 @@ |
|
|
|
<input name="expenseMethod" th:field="*{expenseMethod}" class="form-control" type="text"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-row" id="expanseType"> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">供应商ID:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="supplierCode" th:field="*{supplierCode}" class="form-control" type="text"> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">供应商ID:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="supplierCode" th:field="*{supplierCode}" class="form-control" type="text"> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">是否是委外/采购采销:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="isPurchaseOutsource" th:field="*{isPurchaseOutsource}" 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="isPurchaseOutsource" th:field="*{isPurchaseOutsource}" 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="corporatePayee" th:field="*{corporatePayee}" class="form-control" type="text"> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">对公收款方:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="corporatePayee" th:field="*{corporatePayee}" class="form-control" type="text"> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<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 class="form-group"> |
|
|
|
<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 class="form-group"> |
|
|
|
<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> |
|
|
|
<div class="form-group"> |
|
|
|
<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"> |
|
|
@ -90,6 +86,7 @@ |
|
|
|
<th:block th:include="include :: footer" /> |
|
|
|
<script th:inline="javascript"> |
|
|
|
var prefix = ctx + "system/baseExpense" |
|
|
|
var costTypeDatas = [[${@category.getChildByCode('costType')}]]; |
|
|
|
$("#form-baseExpense-add").validate({focusCleanup: true}); |
|
|
|
$(function(){ |
|
|
|
$.ajax({ |
|
|
@ -128,8 +125,16 @@ |
|
|
|
}, |
|
|
|
{title: '报销单分项子表',field: 'expenseChildId',visible: false}, |
|
|
|
{title: '关联报销单号',field: 'quoteId',visible: false}, |
|
|
|
{title: '成本类型',field: 'costType',}, |
|
|
|
{title: '成本小类',field: 'costSmallType',}, |
|
|
|
{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',options:{maxlength:100}}}, |
|
|
|
{title: '金额',field: 'amounts',editable: {type:'text',options:{maxlength:100}}}, |
|
|
|
{title: '报销时间',field: 'expenseTime',editable:{type:'date'}}, |
|
|
@ -152,15 +157,14 @@ |
|
|
|
index:1, |
|
|
|
row: { |
|
|
|
expenseChildId:'', |
|
|
|
costType: "<select name='costType' class='form-control'>"+ "<option value=''>所有</option>" + "</select>", |
|
|
|
costSmallType:"<select name='costSmallType' class='form-control'>"+ "\"<option value=''>所有</option>\"" +"</select>", |
|
|
|
purpose:'<input name="purpose" class="form-control" type="text">' , |
|
|
|
amounts: '<input name="amounts" class="form-control" type="text">', |
|
|
|
expenseTime: '<div class="input-group date">\n' + |
|
|
|
'<input name="expenseTime" class="form-control" placeholder="yyyy-MM-dd" type="date"></div>', |
|
|
|
evectionCode:'<input name="evectionCode" class="form-control" type="text">' , |
|
|
|
purcahseCode:'<input name="purcahseCode" class="form-control" type="text">', |
|
|
|
outsourceCode: '<input name="outsourceCode" class="form-control" type="text">', |
|
|
|
costType: "", |
|
|
|
costSmallType:"", |
|
|
|
purpose:'' , |
|
|
|
amounts: '', |
|
|
|
expenseTime: '', |
|
|
|
evectionCode:'' , |
|
|
|
purcahseCode:'', |
|
|
|
outsourceCode: '', |
|
|
|
} |
|
|
|
}) |
|
|
|
layer.close(index); |
|
|
@ -175,9 +179,87 @@ |
|
|
|
|
|
|
|
function submitHandler() { |
|
|
|
if ($.validate.form()) { |
|
|
|
$.operate.save(prefix + "/edit", $('#form-baseExpense-edit').serialize()); |
|
|
|
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 submitHandler() { |
|
|
|
if ($.validate.form()) { |
|
|
|
var formData = $('#form-baseExpense-add').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 + "/add", jsonData); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 列中获取成本类型的下拉改变数据 |
|
|
|
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>' ; |
|
|
|
}); |
|
|
|
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}); |
|
|
|
} |
|
|
|
</script> |
|
|
|
</body> |
|
|
|
</html> |