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