项目管理明细默认必有的数据

master
xxssyyyyssxx 2021-11-04 10:32:16 +08:00
parent 725cf6e1b6
commit 00a2b870bd
8 changed files with 62 additions and 15 deletions

View File

@ -41,6 +41,11 @@ public class ProjectBudgetCostProjectManageDetail {
private String predictWhy;
private String remark;
/**
*
*/
private int deletable;
public Integer getId() {
return id;
}
@ -135,4 +140,12 @@ public class ProjectBudgetCostProjectManageDetail {
}
return price.multiply(new BigDecimal(amount));
}
public int getDeletable() {
return deletable;
}
public void setDeletable(int deletable) {
this.deletable = deletable;
}
}

View File

@ -3,9 +3,12 @@ package cn.palmte.work.service;
import cn.palmte.work.bean.BudgetBean;
import cn.palmte.work.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import top.jfunc.common.utils.CollectionUtil;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@ -28,6 +31,8 @@ public class ProjectBudgetService {
@Autowired
private ProjectBudgetCostProjectManageDetailRepository projectBudgetCostProjectManageDetailRepository;
@Value("#{'${fourcal.fixedprojectmanagedetails}'.split('\\|')}")
private String[] fixedProjectManageDetails;
public void clearBudget(Project project){
List<ProjectBudgetIncome> incomes = projectBudgetIncomeRepository.findAllByProjectIdEquals(project.getId());
@ -283,6 +288,29 @@ public class ProjectBudgetService {
}
}
public List<ProjectBudgetCostProjectManageDetail> getBudgetCostProjectManageDetail(Project project){
return projectBudgetCostProjectManageDetailRepository.findAllByProjectIdEquals(project.getId());
List<ProjectBudgetCostProjectManageDetail> projectManageDetails = projectBudgetCostProjectManageDetailRepository.findAllByProjectIdEquals(project.getId());
if(CollectionUtil.isNotEmpty(projectManageDetails)){
return projectManageDetails;
}else {
//默认必填的明细
return getFixedNotDeletable();
}
}
private List<ProjectBudgetCostProjectManageDetail> getFixedNotDeletable() {
List<ProjectBudgetCostProjectManageDetail> projectManageDetails = new ArrayList<>(6);
for (String fixedProjectManageDetail : fixedProjectManageDetails) {
String[] split = fixedProjectManageDetail.split(",");
ProjectBudgetCostProjectManageDetail detail = new ProjectBudgetCostProjectManageDetail();
detail.setType(Integer.parseInt(split[0]));
detail.setName(split[1]);
detail.setPrice(new BigDecimal(0));
detail.setAmount(0);
detail.setDeletable(0);
projectManageDetails.add(detail);
}
return projectManageDetails;
}
}

View File

@ -46,4 +46,7 @@ fourcal.excluded.pc.urls=
fourcal.log.excluded.urls=
fourcal.slideInterval=1800000
fourcal.slideInterval=1800000
fourcal.fixedprojectmanagedetails=1,\u4EBA\u5DE5\u8D39|1,\u603B\u90E8\u652F\u6491\u4EBA\u529B\u8D39\u7528|2,\u4EBA\u5458\u5DEE\u65C5\u8D39|2,\u4E1A\u52A1\u8D39\u7528|2,\u5546\u52A1\u53CA\u4E13\u9879\u9A8C\u6536\u8D39\u7528|2,\u529E\u516C\u8D39\u7528

View File

@ -50,7 +50,7 @@ function appendTrCost() {
'<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>'+
'<td><button type="button" class="am-btn am-btn-warning am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>'+
'</tr>';
$("#costTable").append(template);
//重新绑定删除事件和input修改事件

View File

@ -1,7 +1,7 @@
/**
* 一个采购成本详情的字段
*/
COST_PROJECT_MANAGE_DETAIL_ARR=["type","name","detail","unit","amount","price","total","predictMethod","predictWhy","remark"];
COST_PROJECT_MANAGE_DETAIL_ARR=["type","name","detail","unit","amount","price","total","predictMethod","predictWhy","remark","deletable"];
$(function () {
$("#cost-project-manage-detail").click(function () {
$('#my-prompt-cost-project-manage-detail').modal({
@ -41,7 +41,8 @@ function appendTrCostProjectManage() {
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage"></td>\n' +
' <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>\n' +
' <td><button type="button" class="am-btn am-btn-warning am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button>' +
' <input type="hidden" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="1"></td>\n' +
' </tr>';
$("#costProjectManageTable").append(template);
//重新绑定删除事件和input修改事件

View File

@ -81,7 +81,7 @@ function appendTrIncome() {
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-tax-rate"></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-include" readonly></td>\n' +
' <td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-exclude" readonly></td>\n' +
' <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>\n' +
' <td><button type="button" class="am-btn am-btn-warning am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>\n' +
' </tr>';
$("#incomeTable").append(template);
//重新绑定删除事件和input修改事件

View File

@ -442,14 +442,14 @@
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-tax-rate" value="${incomeDetail.taxRate!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-include" value="${incomeDetail.totalTaxInclude!}" readonly></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-income input-changeable-total-tax-exclude" value="${incomeDetail.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>
<td><button type="button" class="am-btn am-btn-warning am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></td>
</tr>
</#list>
</#if>
</tbody>
</table>
<button type="button" id="incomeAddBtn" class="am-btn am-btn-primary am-btn-xs"><span class="am-icon-plus"></span></button>
<button type="button" id="incomeAddBtn" class="am-btn am-btn-primary am-btn-xs am-round"><span class="am-icon-plus"></span></button>
</div>
<div class="am-modal-footer">
<span class="am-modal-btn" data-am-modal-cancel>取消</span>
@ -507,14 +507,14 @@
<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>
<td><button type="button" class="am-btn am-btn-warning am-btn-xs am-round 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>
<button type="button" id="costAddBtn" class="am-btn am-btn-primary am-btn-xs am-round"><span class="am-icon-plus"></span></button>
</div>
<div class="am-modal-footer">
<span class="am-modal-btn" data-am-modal-cancel>取消</span>
@ -547,13 +547,13 @@
<#list costProjectManageDetails as costProjectManageDetail>
<tr>
<td>
<select style="width: auto" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage">
<select style="width: auto" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" <#if costProjectManageDetail.deletable==0>readonly</#if>>
<option value="1" <#if costProjectManageDetail.type == 1>selected</#if>>人工成本</option>
<option value="2" <#if costProjectManageDetail.type == 2>selected</#if>>业务费用</option>
<option value="3" <#if costProjectManageDetail.type == 3>selected</#if>>其他费用</option>
</select>
</td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="${costProjectManageDetail.name!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="${costProjectManageDetail.name!}" <#if costProjectManageDetail.deletable==0>readonly</#if>></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="${costProjectManageDetail.detail!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="${costProjectManageDetail.unit!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage input-changeable-amount-project-manage" value="${costProjectManageDetail.amount!}"></td>
@ -562,14 +562,16 @@
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="${costProjectManageDetail.predictMethod!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="${costProjectManageDetail.predictWhy!}"></td>
<td><input type="text" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="${costProjectManageDetail.remark!}"></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>
<td><#if costProjectManageDetail.deletable==1><button type="button" class="am-btn am-btn-warning am-btn-xs am-round am-modal-line-delete"><span class="am-icon-minus"></span></button></#if>
<input type="hidden" class="am-modal-prompt-input am-modal-prompt-input-cost-project-manage" value="${costProjectManageDetail.deletable!}">
</td>
</tr>
</#list>
</#if>
</tbody>
</table>
<button type="button" id="costProjectManageAddBtn" class="am-btn am-btn-primary am-btn-xs"><span class="am-icon-plus"></span></button>
<button type="button" id="costProjectManageAddBtn" class="am-btn am-btn-primary am-btn-xs am-round"><span class="am-icon-plus"></span></button>
</div>
<div class="am-modal-footer">
<span class="am-modal-btn" data-am-modal-cancel>取消</span>

View File

@ -255,7 +255,7 @@
<td>成本</td>
<td>项目管理成本</td>
<td>项目管理成本</td>
<td><input name="costProjectManageTaxInclude" required></td>
<td><#--<input name="costProjectManageTaxInclude" required>-->/</td>
<td><input name="costProjectManageTaxExclude" required></td>
</tr>
<tr>