成本明细保存与更新

master
xxssyyyyssxx 2021-11-03 16:50:54 +08:00
parent 43bb7c8ea8
commit 7ddb2aaf85
3 changed files with 312 additions and 101 deletions

View File

@ -176,17 +176,17 @@ public class ProjectController extends BaseController{
@ResponseBody @ResponseBody
public ResponseMsg budgetEditSaveIncomeDetail(@RequestBody String body) { public ResponseMsg budgetEditSaveIncomeDetail(@RequestBody String body) {
JSONObject jsonObject = JSON.parseObject(body); JSONObject jsonObject = JSON.parseObject(body);
JSONArray incomeDetails = jsonObject.getJSONArray("incomeDetails"); JSONArray details = jsonObject.getJSONArray("details");
List<ProjectBudgetIncomeDetail> incomeDetailList = new ArrayList<>(incomeDetails.size()); List<ProjectBudgetIncomeDetail> detailList = new ArrayList<>(details.size());
for (int i = 0; i < incomeDetails.size(); i++) { for (int i = 0; i < details.size(); i++) {
ProjectBudgetIncomeDetail incomeDetail = incomeDetails.getObject(i, ProjectBudgetIncomeDetail.class); ProjectBudgetIncomeDetail incomeDetail = details.getObject(i, ProjectBudgetIncomeDetail.class);
incomeDetailList.add(incomeDetail); detailList.add(incomeDetail);
} }
Project project = projectService.getProject(jsonObject.getInteger("projectId")); Project project = projectService.getProject(jsonObject.getInteger("projectId"));
projectBudgetService.clearBudgetIncomeDetail(project); projectBudgetService.clearBudgetIncomeDetail(project);
projectBudgetService.saveBudgetIncomeDetail(project, incomeDetailList); projectBudgetService.saveBudgetIncomeDetail(project, detailList);
return ResponseMsg.buildSuccessMsg("成功"); return ResponseMsg.buildSuccessMsg("成功");
} }
@ -194,19 +194,20 @@ public class ProjectController extends BaseController{
* *
*/ */
@RequestMapping("/budgetEditSaveCostDetail") @RequestMapping("/budgetEditSaveCostDetail")
@ResponseBody
public ResponseMsg budgetEditSaveCostDetail(@RequestBody String body) { public ResponseMsg budgetEditSaveCostDetail(@RequestBody String body) {
JSONObject jsonObject = JSON.parseObject(body); JSONObject jsonObject = JSON.parseObject(body);
JSONArray costDetails = jsonObject.getJSONArray("costDetails"); JSONArray details = jsonObject.getJSONArray("details");
List<ProjectBudgetCostDetail> costDetailList = new ArrayList<>(costDetails.size()); List<ProjectBudgetCostDetail> detailList = new ArrayList<>(details.size());
for (int i = 0; i < costDetails.size(); i++) { for (int i = 0; i < details.size(); i++) {
ProjectBudgetCostDetail costDetail = costDetails.getObject(i, ProjectBudgetCostDetail.class); ProjectBudgetCostDetail costDetail = details.getObject(i, ProjectBudgetCostDetail.class);
costDetailList.add(costDetail); detailList.add(costDetail);
} }
Project project = projectService.getProject(jsonObject.getInteger("projectId")); Project project = projectService.getProject(jsonObject.getInteger("projectId"));
projectBudgetService.clearBudgetCostDetail(project); projectBudgetService.clearBudgetCostDetail(project);
projectBudgetService.saveBudgetCostDetail(project, costDetailList); projectBudgetService.saveBudgetCostDetail(project, detailList);
return ResponseMsg.buildSuccessMsg("成功"); return ResponseMsg.buildSuccessMsg("成功");
} }
@ -214,19 +215,20 @@ public class ProjectController extends BaseController{
* *
*/ */
@RequestMapping("/budgetEditSaveCostProjectManageDetail") @RequestMapping("/budgetEditSaveCostProjectManageDetail")
@ResponseBody
public ResponseMsg budgetEditSaveCostProjectManageDetail(@RequestBody String body) { public ResponseMsg budgetEditSaveCostProjectManageDetail(@RequestBody String body) {
JSONObject jsonObject = JSON.parseObject(body); JSONObject jsonObject = JSON.parseObject(body);
JSONArray costDetails = jsonObject.getJSONArray("costProjectManageDetails"); JSONArray details = jsonObject.getJSONArray("details");
List<ProjectBudgetCostProjectManageDetail> costDetailList = new ArrayList<>(costDetails.size()); List<ProjectBudgetCostProjectManageDetail> detailList = new ArrayList<>(details.size());
for (int i = 0; i < costDetails.size(); i++) { for (int i = 0; i < details.size(); i++) {
ProjectBudgetCostProjectManageDetail costDetail = costDetails.getObject(i, ProjectBudgetCostProjectManageDetail.class); ProjectBudgetCostProjectManageDetail costDetail = details.getObject(i, ProjectBudgetCostProjectManageDetail.class);
costDetailList.add(costDetail); detailList.add(costDetail);
} }
Project project = projectService.getProject(jsonObject.getInteger("projectId")); Project project = projectService.getProject(jsonObject.getInteger("projectId"));
projectBudgetService.clearBudgetCostProjectManageDetail(project); projectBudgetService.clearBudgetCostProjectManageDetail(project);
projectBudgetService.saveBudgetCostProjectManageDetail(project, costDetailList); projectBudgetService.saveBudgetCostProjectManageDetail(project, detailList);
return ResponseMsg.buildSuccessMsg("成功"); return ResponseMsg.buildSuccessMsg("成功");
} }

View File

@ -34,37 +34,81 @@ function arr2Object(arr, mapArr) {
return obj; return obj;
} }
/**
* 收集收入明细的数据因为动态添加的行modal无法识别所以自己来收集
* @returns {Array}
*/
function collectData(className) {
var a= [];
$("." + className).each(function (t) {
a.push($(this).val());
});
return a;
}
/**
* 绑定每一行的删除事件删除当前的一行tr
*/
function bindDeleteBtn() {
$(".am-modal-line-delete").click(function () {
//删除自己对应的tr
$(this).parent().parent().remove();
});
}
/** /**
* 一个收入详情的字段 * 一个收入详情的字段
*/ */
INCOME_DETAIL_ARR=["type","name","unit","amount","price","taxRate","totalTaxInclude","totalTaxExclude"]; INCOME_DETAIL_ARR=["type","name","unit","amount","price","taxRate","totalTaxInclude","totalTaxExclude"];
/**
* 一个采购成本详情的字段
*/
COST_DETAIL_ARR=["type","category","name","unit","amount","price","taxRate","totalTaxInclude","totalTaxExclude"];
/** /**
* 保存收入明细数据 * 将页面收集到的数据转换为ajax请求的数据一维数组转换为对象数组
* @param data
* @param detailPropertyArr
* @returns {Array}
*/ */
function saveIncomeDetail(url, data, projectId) { function convertDetail(data,detailPropertyArr) {
if(Array.isArray(data) && data.length != 0){ var arr = arrayToMatrix(data,detailPropertyArr.length);
var incomeDetails = convertIncomeDetail(data);
var da = { var details = [];
"incomeDetails":incomeDetails, for (var i=0;i<arr.length;i++){
"projectId":projectId var obj = arr2Object(arr[i], detailPropertyArr);
}; if(obj){
console.log(da); details.push(obj);
$.ajax({ }
url: url,
data: JSON.stringify(da),
type: "post",
dataType: "json",
contentType:"application/json",
async: false,
success: function (d) {
console.log(d);
updateIncomeData(incomeDetails);
}
});
} }
return details;
} }
function prepareAjaxData(data,detailPropertyArr,projectId){
var details = convertDetail(data, detailPropertyArr);
return {
"details":details,
"projectId":projectId
};
}
function saveDetail(url, data, callback) {
$.ajax({
url: url,
data: JSON.stringify(data),
type: "post",
dataType: "json",
contentType:"application/json",
async: false,
success: function (d) {
console.log(d);
callback(data.details);
}
});
}
/** /**
* 更新页面收入的数据累加 * 更新页面收入的数据累加
*/ */
@ -102,51 +146,11 @@ function updateIncomeData(incomeDetails) {
} }
/**
* 将页面收集到的数据转换为ajax请求的数据一维数组转换为对象数组
* @param data
* @returns {Array}
*/
function convertIncomeDetail(data) {
var arr = arrayToMatrix(data,INCOME_DETAIL_ARR.length);
var incomeDetails = [];
for (var i=0;i<arr.length;i++){
var obj = arr2Object(arr[i], INCOME_DETAIL_ARR);
if(obj){
incomeDetails.push(obj);
}
}
return incomeDetails;
}
/**
* 收集收入明细的数据因为动态添加的行modal无法识别所以自己来收集
* @returns {Array}
*/
function collectIncomeData(className) {
var a= [];
$("." + className).each(function (t) {
a.push($(this).val());
});
return a;
}
/**
* 绑定每一行的删除事件删除当前的一行tr
*/
function bindDeleteBtn() {
$(".am-modal-line-delete").click(function () {
//删除自己对应的tr
$(this).parent().parent().remove();
});
}
/** /**
* 绑定每个可改变的输入框修改后改变对应输入框的值 * 绑定每个可改变的输入框修改后改变对应输入框的值
*/ */
function bindIncomeChangeableInput() { function bindChangeableInput() {
//数量改变 //数量改变
$(".input-changeable-amount").change(function () { $(".input-changeable-amount").change(function () {
var amount = parseFloat($(this).val()); var amount = parseFloat($(this).val());
@ -205,5 +209,117 @@ function appendTrIncome() {
$("#incomeTable").append(template); $("#incomeTable").append(template);
//重新绑定删除事件和input修改事件 //重新绑定删除事件和input修改事件
bindDeleteBtn(); bindDeleteBtn();
bindIncomeChangeableInput(); bindChangeableInput();
}
/**
* 采购成本增加一行
*/
function appendTrCost() {
var template = '<tr><td><select style="width: auto" class="am-modal-prompt-input am-modal-prompt-input-cost">'+
'<option value="1">设备</option>'+
'<option value="2">施工</option>'+
'<option value="3">服务</option>'+
'<option value="4">其他</option>'+
'</select>'+
'</td>'+
'<td>'+
'<select style="width: auto" class="am-modal-prompt-input am-modal-prompt-input-cost">'+
'<option value="1">华智产品</option>'+
'<option value="2">紫光其他产品</option>'+
'<option value="3">外购产品</option>'+
'<option value="4">外购工程</option>'+
'<option value="5">华智服务</option>'+
'<option value="6">紫光其他服务</option>'+
'<option value="7">外购服务</option>'+
'<option value="8">其他</option>'+
'</select>'+
'</td>'+
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost"></td>'+
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost""></td>'+
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-amount"></td>'+
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-price"></td>'+
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-tax-rate"></td>'+
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-include" readonly></td>'+
'<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-exclude" readonly></td>'+
'<td><button type="button" class="am-btn am-btn-warning am-btn-xs am-modal-line-delete"><span class="am-icon-minus"></span></button></td>'+
'</tr>';
$("#costTable").append(template);
//重新绑定删除事件和input修改事件
bindDeleteBtn();
bindChangeableInput();
}
/**
* 更新页面收入的数据累加
*/
function updateCostData(details) {
var deviceTaxInclude = 0;
var deviceTaxExclude = 0;
var buildTaxInclude = 0;
var buildTaxExclude = 0;
var serviceTaxInclude = 0;
var serviceTaxExclude = 0;
var otherTaxInclude = 0;
var otherTaxExclude = 0;
details.forEach(function (t, number, ts) {
if(t["type"] == "1"){
//设备类
deviceTaxInclude += parseFloat(t["totalTaxInclude"]);
deviceTaxExclude += parseFloat(t["totalTaxExclude"]);
}else if(t["type"] == "2"){
//施工类
buildTaxInclude += parseFloat(t["totalTaxInclude"]);
buildTaxExclude += parseFloat(t["totalTaxExclude"]);
}else if(t["type"] == "3"){
//服务类
serviceTaxInclude += parseFloat(t["totalTaxInclude"]);
serviceTaxExclude += parseFloat(t["totalTaxExclude"]);
}else if(t["type"] == "4"){
//其他类
otherTaxInclude += parseFloat(t["totalTaxInclude"]);
otherTaxExclude += parseFloat(t["totalTaxExclude"]);
}
});
$("input[name='costPurchaseDeviceTaxInclude']").val(deviceTaxInclude);
$("input[name='costPurchaseDeviceTaxExclude']").val(deviceTaxExclude);
$("input[name='costPurchaseBuildTaxInclude']").val(buildTaxInclude);
$("input[name='costPurchaseBuildTaxExclude']").val(buildTaxExclude);
$("input[name='costPurchaseServiceTaxInclude']").val(serviceTaxInclude);
$("input[name='costPurchaseServiceTaxExclude']").val(serviceTaxExclude);
$("input[name='costPurchaseOtherTaxInclude']").val(otherTaxInclude);
$("input[name='costPurchaseOtherTaxExclude']").val(otherTaxExclude);
var costOtherOtherTaxInclude = parseFloat($("input[name='costOtherOtherTaxInclude']").val());
var costOtherOtherTaxExclude = parseFloat($("input[name='costOtherOtherTaxExclude']").val());
var costProjectManageTaxExclude = parseFloat($("input[name='costProjectManageTaxExclude']").val());
$("input[name='costTotalTaxInclude']").val(deviceTaxInclude+buildTaxInclude+serviceTaxInclude+otherTaxInclude+costOtherOtherTaxInclude);
$("input[name='costTotalTaxExclude']").val(deviceTaxExclude+buildTaxExclude+serviceTaxExclude+otherTaxExclude+costOtherOtherTaxExclude+costProjectManageTaxExclude);
}
function bindOtherOtherChangeable() {
$("input[name='costOtherOtherTaxInclude']").change(function () {
var costPurchaseDeviceTaxInclude = parseFloat($("input[name='costPurchaseDeviceTaxInclude']").val());
var costPurchaseBuildTaxInclude = parseFloat($("input[name='costPurchaseBuildTaxInclude']").val());
var costPurchaseServiceTaxInclude = parseFloat($("input[name='costPurchaseServiceTaxInclude']").val());
var costPurchaseOtherTaxInclude = parseFloat($("input[name='costPurchaseOtherTaxInclude']").val());
var costOtherOther = parseFloat($(this).val());
$("input[name='costTotalTaxInclude']").val(costPurchaseDeviceTaxInclude+costPurchaseBuildTaxInclude+costPurchaseServiceTaxInclude+costPurchaseOtherTaxInclude+costOtherOther);
});
$("input[name='costOtherOtherTaxExclude']").change(function () {
var costPurchaseDeviceTaxExclude = parseFloat($("input[name='costPurchaseDeviceTaxExclude']").val());
var costPurchaseBuildTaxExclude = parseFloat($("input[name='costPurchaseBuildTaxExclude']").val());
var costPurchaseServiceTaxExclude = parseFloat($("input[name='costPurchaseServiceTaxExclude']").val());
var costPurchaseOtherTaxExclude = parseFloat($("input[name='costPurchaseOtherTaxExclude']").val());
var costProjectManageTaxExclude = parseFloat($("input[name='costProjectManageTaxExclude']").val());
var costOtherOther = parseFloat($(this).val());
$("input[name='costTotalTaxExclude']").val(costPurchaseDeviceTaxExclude+costPurchaseBuildTaxExclude+costPurchaseServiceTaxExclude+costPurchaseOtherTaxExclude+costProjectManageTaxExclude+costOtherOther);
});
} }

View File

@ -18,7 +18,7 @@
<div class="admin-content"> <div class="admin-content">
<div class="admin-content-body"> <div class="admin-content-body">
<div class="am-cf am-padding"> <div class="am-cf am-padding">
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">项目算表</strong> / <small>${project.name}</small></div> <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">项目算表</strong> / <small>${project.name}</small></div>
</div> </div>
<form method="post" class="am-form" id="pmsForm" action="${base}/project/budgetEditSave"> <form method="post" class="am-form" id="pmsForm" action="${base}/project/budgetEditSave">
@ -228,8 +228,8 @@
</tbody> </tbody>
</table> </table>
<span class="am-text-lg">成本</span> <span class="am-text-lg">成本</span>
<span class="am-text-primary"><a style="cursor: pointer">采购成本明细表</a></span> <span class="am-text-primary"><a style="cursor: pointer" id="cost-detail">采购成本明细表</a></span>
<span class="am-text-primary"><a style="cursor: pointer">项目管理成本表</a></span> <span class="am-text-primary"><a style="cursor: pointer" id="cost-project-manage-detail">项目管理成本表</a></span>
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;"> <table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
<tbody> <tbody>
<tr class="am-text-xl"> <tr class="am-text-xl">
@ -243,55 +243,55 @@
<td>成本</td> <td>成本</td>
<td>采购成本</td> <td>采购成本</td>
<td>设备</td> <td>设备</td>
<td><input name="costPurchaseDeviceTaxInclude" value="${budgetBean.costPurchaseDeviceTaxInclude!9}" readonly required></td> <td><input name="costPurchaseDeviceTaxInclude" value="${budgetBean.costPurchaseDeviceTaxInclude!0}" readonly required></td>
<td><input name="costPurchaseDeviceTaxExclude" value="${budgetBean.costPurchaseDeviceTaxExclude!10}" readonly required></td> <td><input name="costPurchaseDeviceTaxExclude" value="${budgetBean.costPurchaseDeviceTaxExclude!0}" readonly required></td>
</tr> </tr>
<tr> <tr>
<td>成本</td> <td>成本</td>
<td>采购成本</td> <td>采购成本</td>
<td>施工</td> <td>施工</td>
<td><input name="costPurchaseBuildTaxInclude" value="${budgetBean.costPurchaseBuildTaxInclude!11}" readonly required></td> <td><input name="costPurchaseBuildTaxInclude" value="${budgetBean.costPurchaseBuildTaxInclude!0}" readonly required></td>
<td><input name="costPurchaseBuildTaxExclude" value="${budgetBean.costPurchaseBuildTaxExclude!12}" readonly required></td> <td><input name="costPurchaseBuildTaxExclude" value="${budgetBean.costPurchaseBuildTaxExclude!0}" readonly required></td>
</tr> </tr>
<tr> <tr>
<td>成本</td> <td>成本</td>
<td>采购成本</td> <td>采购成本</td>
<td>服务</td> <td>服务</td>
<td><input name="costPurchaseServiceTaxInclude" value="${budgetBean.costPurchaseServiceTaxInclude!13}" readonly required></td> <td><input name="costPurchaseServiceTaxInclude" value="${budgetBean.costPurchaseServiceTaxInclude!0}" readonly required></td>
<td><input name="costPurchaseServiceTaxExclude" value="${budgetBean.costPurchaseServiceTaxExclude!0}" readonly required></td> <td><input name="costPurchaseServiceTaxExclude" value="${budgetBean.costPurchaseServiceTaxExclude!0}" readonly required></td>
</tr> </tr>
<tr> <tr>
<td>成本</td> <td>成本</td>
<td>采购成本</td> <td>采购成本</td>
<td>其他</td> <td>其他</td>
<td><input name="costPurchaseOtherTaxInclude" value="${budgetBean.costPurchaseOtherTaxInclude!14}" readonly required></td> <td><input name="costPurchaseOtherTaxInclude" value="${budgetBean.costPurchaseOtherTaxInclude!0}" readonly required></td>
<td><input name="costPurchaseOtherTaxExclude" value="${budgetBean.costPurchaseOtherTaxExclude!15}" readonly required></td> <td><input name="costPurchaseOtherTaxExclude" value="${budgetBean.costPurchaseOtherTaxExclude!0}" readonly required></td>
</tr> </tr>
<tr> <tr>
<td>成本</td> <td>成本</td>
<td>项目管理成本</td> <td>项目管理成本</td>
<td>项目管理成本</td> <td>项目管理成本</td>
<td><#--<input name="costProjectManageTaxInclude" value="${budgetBean.costProjectManageTaxInclude!}" readonly required>-->/</td> <td><#--<input name="costProjectManageTaxInclude" value="${budgetBean.costProjectManageTaxInclude!}" readonly required>-->/</td>
<td><input name="costProjectManageTaxExclude" value="${budgetBean.costProjectManageTaxExclude!17}" readonly required></td> <td><input name="costProjectManageTaxExclude" value="${budgetBean.costProjectManageTaxExclude!0}" readonly required></td>
</tr> </tr>
<tr> <tr>
<td>成本</td> <td>成本</td>
<td>其他</td> <td>其他</td>
<td>其他</td> <td>其他</td>
<td><input name="costOtherOtherTaxInclude" value="${budgetBean.costOtherOtherTaxInclude!}" required></td> <td><input name="costOtherOtherTaxInclude" value="${budgetBean.costOtherOtherTaxInclude!0}" required></td>
<td><input name="costOtherOtherTaxExclude" value="${budgetBean.costOtherOtherTaxExclude!}" required></td> <td><input name="costOtherOtherTaxExclude" value="${budgetBean.costOtherOtherTaxExclude!0}" required></td>
</tr> </tr>
<tr> <tr>
<td>合计</td> <td>合计</td>
<td></td> <td></td>
<td></td> <td></td>
<td><input name="costTotalTaxInclude" value="${budgetBean.costTotalTaxInclude!18}" readonly required></td> <td><input name="costTotalTaxInclude" value="${budgetBean.costTotalTaxInclude!0}" readonly required></td>
<td><input name="costTotalTaxExclude" value="${budgetBean.costTotalTaxExclude!19}" readonly required></td> <td><input name="costTotalTaxExclude" value="${budgetBean.costTotalTaxExclude!0}" readonly required></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<span class="am-text-lg">管理</span> <span class="am-text-lg">管理</span>
<span class="am-text-primary"><a style="cursor: pointer">资金计划表</a></span> <span class="am-text-primary"><a style="cursor: pointer" id="plan-detail">资金计划表</a></span>
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;"> <table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
<tbody> <tbody>
<tr class="am-text-xl"> <tr class="am-text-xl">
@ -406,6 +406,7 @@
</div> </div>
<#--收入明细表弹窗-->
<div class="am-modal am-modal-prompt" style="width: 1200px;max-height:600px;overflow-y:auto;" tabindex="-1" id="my-prompt-income-detail"> <div class="am-modal am-modal-prompt" style="width: 1200px;max-height:600px;overflow-y:auto;" tabindex="-1" id="my-prompt-income-detail">
<div class="am-modal-dialog"> <div class="am-modal-dialog">
<div class="am-modal-hd">新增销售收入明细表——${project.name}</div> <div class="am-modal-hd">新增销售收入明细表——${project.name}</div>
@ -456,6 +457,77 @@
</div> </div>
</div> </div>
</div> </div>
<#--采购成本明细弹窗-->
<div class="am-modal am-modal-prompt" style="width: 1200px;max-height:600px;overflow-y:auto;" tabindex="-1" id="my-prompt-cost-detail">
<div class="am-modal-dialog">
<div class="am-modal-hd">新增采购成本明细表——${project.name}</div>
<div class="am-modal-bd">
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;" id="costTable">
<tbody>
<tr>
<td>大类</td>
<td>类别</td>
<td>名称</td>
<td>单位</td>
<td>数量</td>
<td>单价</td>
<td>税率(%</td>
<td>含税总金额(元)</td>
<td>不含税金额(元)</td>
<td>操作</td>
</tr>
<#if costDetails??>
<#list costDetails as costDetail>
<tr>
<td>
<select style="width: auto" class="am-modal-prompt-input am-modal-prompt-input-cost">
<option value="1" <#if costDetail.type == 1>selected</#if>>设备</option>
<option value="2" <#if costDetail.type == 2>selected</#if>>施工</option>
<option value="3" <#if costDetail.type == 3>selected</#if>>服务</option>
<option value="4" <#if costDetail.type == 4>selected</#if>>其他</option>
</select>
</td>
<td>
<select style="width: auto" class="am-modal-prompt-input am-modal-prompt-input-cost">
<option value="1" <#if costDetail.category == 1>selected</#if>>华智产品</option>
<option value="2" <#if costDetail.category == 2>selected</#if>>紫光其他产品</option>
<option value="3" <#if costDetail.category == 3>selected</#if>>外购产品</option>
<option value="4" <#if costDetail.category == 4>selected</#if>>外购工程</option>
<option value="5" <#if costDetail.category == 5>selected</#if>>华智服务</option>
<option value="6" <#if costDetail.category == 6>selected</#if>>紫光其他服务</option>
<option value="7" <#if costDetail.category == 7>selected</#if>>外购服务</option>
<option value="8" <#if costDetail.category == 8>selected</#if>>其他</option>
</select>
</td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" value="${costDetail.name!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost" value="${costDetail.unit!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-amount" value="${costDetail.amount!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-price" value="${costDetail.price!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-tax-rate" value="${costDetail.taxRate!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-include" value="${costDetail.totalTaxInclude!}" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost input-changeable-total-tax-exclude" value="${costDetail.totalTaxExclude!}" readonly></td>
<td><button type="button" class="am-btn am-btn-warning am-btn-xs am-modal-line-delete"><span class="am-icon-minus"></span></button></td>
</tr>
</#list>
</#if>
</tbody>
</table>
<button type="button" id="costAddBtn" class="am-btn am-btn-primary am-btn-xs"><span class="am-icon-plus"></span></button>
</div>
<div class="am-modal-footer">
<span class="am-modal-btn" data-am-modal-cancel>取消</span>
<span class="am-modal-btn" data-am-modal-confirm>保存</span>
</div>
</div>
</div>
@ -473,6 +545,12 @@
<script src="${base}/assets/js/project_budget.js"></script> <script src="${base}/assets/js/project_budget.js"></script>
<script> <script>
$(function () { $(function () {
bindDeleteBtn();
bindChangeableInput();
bindOtherOtherChangeable();
$("#saveDraft").click(function () { $("#saveDraft").click(function () {
$("#pmsForm").attr("action","${base}/project/budgetEditSave"); $("#pmsForm").attr("action","${base}/project/budgetEditSave");
$("#pmsForm").submit(); $("#pmsForm").submit();
@ -487,8 +565,9 @@
relatedTarget: this, relatedTarget: this,
onConfirm: function(e) { onConfirm: function(e) {
//不能使用e.data因为无法获取动态添加的 //不能使用e.data因为无法获取动态添加的
var data = collectIncomeData("am-modal-prompt-input-income"); var data = collectData("am-modal-prompt-input-income");
saveIncomeDetail("${base}/project/budgetEditSaveIncomeDetail", data, $("#id").val()); data = prepareAjaxData(data, INCOME_DETAIL_ARR, $("#id").val());
saveDetail("${base}/project/budgetEditSaveIncomeDetail", data, updateIncomeData);
}, },
onCancel: function(e) { onCancel: function(e) {
} }
@ -498,8 +577,22 @@
appendTrIncome(); appendTrIncome();
}); });
bindDeleteBtn(); $("#cost-detail").click(function () {
bindIncomeChangeableInput(); $('#my-prompt-cost-detail').modal({
relatedTarget: this,
onConfirm: function(e) {
//不能使用e.data因为无法获取动态添加的
var data = collectData("am-modal-prompt-input-cost");
data = prepareAjaxData(data, COST_DETAIL_ARR, $("#id").val());
saveDetail("${base}/project/budgetEditSaveCostDetail", data, updateCostData);
},
onCancel: function(e) {
}
});
});
$("#costAddBtn").click(function () {
appendTrCost();
});
}); });
</script> </script>
</@defaultLayout.layout> </@defaultLayout.layout>