预算书-经费预算表 功能添加 10.30

master
zhc077 3 weeks ago
parent 9adef74056
commit 572747de6c
  1. 1
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/mock/vxe/json/projectFeeBudget.json
  2. 24
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectFeeBudget/controller/ProjectFeeBudgetController.java
  3. 48
      jeecgboot-vue3/src/views/projectApplication/kejigongguan/yusuanshu/ProjectFeeBudgetDemo.vue

@ -9,7 +9,6 @@
{"budgetSubject":"专家咨询费","totalFee":0.00,"specialFee":0.00,"selfFee":0.00,"specialFeeMark":""}
{"budgetSubject":"其他支出","totalFee":0.00,"specialFee":0.00,"selfFee":0.00,"specialFeeMark":""}
{"budgetSubject":"本次申请省财政经费支持","totalFee":0.00,"specialFee":0.00,"selfFee":0.00,"specialFeeMark":""}
{"budgetSubject":"本次申请省财政经费支持","totalFee":0.00,"specialFee":0.00,"selfFee":0.00,"specialFeeMark":""}
{"budgetSubject":"其他财政拨款","totalFee":0.00,"specialFee":0.00,"selfFee":0.00,"specialFeeMark":""}
{"budgetSubject":"单位自有货币资金","totalFee":0.00,"specialFee":0.00,"selfFee":0.00,"specialFeeMark":""}
{"budgetSubject":"其他资金","totalFee":0.00,"specialFee":0.00,"selfFee":0.00,"specialFeeMark":""}

@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.ddl.history.IDdlGenerator;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -12,9 +11,12 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.demo.project.entity.Project;
import org.jeecg.modules.demo.project.service.IProjectService;
import org.jeecg.modules.demo.projectFeeBudget.entity.ProjectFeeBudget;
import org.jeecg.modules.demo.projectFeeBudget.service.IProjectFeeBudgetService;
import org.springframework.beans.factory.annotation.Autowired;
@ -23,8 +25,11 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
/**
* @Description: 项目经费预算
@ -40,6 +45,9 @@ public class ProjectFeeBudgetController extends JeecgController<ProjectFeeBudget
@Autowired
private IProjectFeeBudgetService projectFeeBudgetService;
@Autowired
private IProjectService iProjectService;
/**
* @description: 保存项目经费预算
* @param: [projectId, tableData]
@ -48,13 +56,21 @@ public class ProjectFeeBudgetController extends JeecgController<ProjectFeeBudget
* @date: 24/10/29 16:10
*/
@PostMapping("/saveAll/{projectId}")
public Result saveAll(@PathVariable("projectId") String projectId, @RequestBody JSONArray tableData){
projectFeeBudgetService.remove(new LambdaQueryWrapper<ProjectFeeBudget>().eq(ProjectFeeBudget::getProjectId,projectId));
public Result saveAll(@PathVariable("projectId") String projectId, @RequestBody JSONArray tableData) {
Project project = iProjectService.getById(projectId);
Optional.ofNullable(project).orElseThrow(() -> new JeecgBootException("项目不存在"));
List<ProjectFeeBudget> list = JSONArray.parseArray(tableData.toJSONString(), ProjectFeeBudget.class);
list.forEach(obj->{
list.forEach(obj -> {
obj.setProjectId(projectId);
obj.setId(UUIDGenerator.generate());
});
BigDecimal sumFee = Optional.ofNullable(list).orElse(new LinkedList<>()).stream().map(ProjectFeeBudget::getTotalFee).reduce(BigDecimal.ZERO, BigDecimal::add);
//申请财政拨款与经费明细总各比较,不相等 异常退出
/*if(project.getApplyFund().compareTo(sumFee) != 0){
throw new JeecgBootException("申请财政拨款与项目经费预算表合计金额不等,请核对!");
}*/
projectFeeBudgetService.remove(new LambdaQueryWrapper<ProjectFeeBudget>().eq(ProjectFeeBudget::getProjectId, projectId));
projectFeeBudgetService.saveBatch(list);
return Result.ok();
}

@ -15,6 +15,7 @@
:loading="loading"
:columns="columns"
:dataSource="dataSource"
@valueChange="handleValueChange"
@save="handleTableSave"
/>
</a-card>
@ -68,11 +69,11 @@ const columns = ref<JVxeColumn[]>([
//
width: 260,
// typeinput
type: JVxeTypes.inputNumber,
type: JVxeTypes.normal,
},
{ key: 'specialFee', title: '专项经费', width: 260, type: JVxeTypes.inputNumber },
{ key: 'selfFee', title: '自筹经费', width: 260, type: JVxeTypes.inputNumber },
{ key: 'specialFeeMark', title: '专项经费说明', width: 260, type: JVxeTypes.textarea },
{ key: 'selfFee', title: '自筹经费', width: 130, type: JVxeTypes.inputNumber },
{ key: 'specialFeeMark', title: '专项经费说明', width: 380, type: JVxeTypes.textarea },
]);
// url
@ -88,6 +89,31 @@ enum Api {
loadData();
//
function handleSelectRowChange(event) {
/*console.log("handleSelectRowChange")
selectedRows.value = event.selectedRows;
console.log("handleSelectRowChange-event:", event)
const {type, row, column, value, target, $table} = event
// row.totalFee = event.value;
console.log('--------------------')
console.log('selfFee',row.selfFee)
console.log('totalFee',row.totalFee)*/
// target.$refs.vxe.columns[4].options = this.stationIdList;
// target.$refs.vxe.columns[17].options = this.userIdList;
};
function handleValueChange(event) {
console.log('handleValueChange.event: ', event);
const {type, row, column, value, target, $table} = event
/*console.log('selfFee',row.specialFee)
console.log('selfFee',row.selfFee)
console.log('--------------------')*/
row.totalFee = row.selfFee + row.specialFee;
console.log('the new totalFee',row.totalFee)
}
//
async function loadData() {
loading.value = true;
@ -140,6 +166,7 @@ function handleTableSave({ $table, target }) {
})
.then(() => {
createMessage.success(`保存成功!`);
loadData();
})
.finally(() => {
loading.value = false;
@ -170,6 +197,7 @@ function handleTableSave({ $table, target }) {
function handleEditClosed(event) {
let { $table, row, column } = event;
let field = column.property;
// console.log('field',field);
//
if ($table.isUpdateByRow(row, field)) {
//
@ -177,9 +205,9 @@ function handleEditClosed(event) {
//
if (!errMap) {
//
let hideLoading = createMessage.loading(`正在保存"${column.title}"`, 0);
console.log('即时保存数据:', row);
defHttp
// let hideLoading = createMessage.loading(`"${column.title}"`, 0);
console.log('-----handleEditClosed()--即时保存行row数据:', JSON.stringify(row));
/*defHttp
.put({
url: Api.saveRow,
params: row,
@ -191,7 +219,7 @@ function handleEditClosed(event) {
})
.finally(() => {
hideLoading();
});
});*/
}
});
}
@ -207,9 +235,9 @@ function handlePageChange(event) {
}*/
//
function handleSelectRowChange(event) {
selectedRows.value = event.selectedRows;
}
// function handleSelectRowChange(event) {
// selectedRows.value = event.selectedRows;
// }
</script>
<style scoped></style>

Loading…
Cancel
Save