预算书-财政拨款、年度预算表 功能添加 10.31

master
zhc077 3 weeks ago
parent 078932ef82
commit 932d97af93
  1. 15
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectAnnualBudget/controller/ProjectAnnualBudgetController.java
  2. 24
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectAnnualBudget/entity/ProjectAnnualBudget.java
  3. 74
      jeecgboot-vue3/src/views/projectApplication/kejigongguan/yusuanshu/NianDuYuSuanDemo.vue

@ -79,12 +79,11 @@ public class ProjectAnnualBudgetController extends JeecgController<ProjectAnnual
@ApiOperation(value = "财政拨款分单位年度预算-添加", notes = "财政拨款分单位年度预算-添加") @ApiOperation(value = "财政拨款分单位年度预算-添加", notes = "财政拨款分单位年度预算-添加")
// @RequiresPermissions("projectAnnualBudget:project_annual_budget:add") // @RequiresPermissions("projectAnnualBudget:project_annual_budget:add")
@PostMapping(value = "/add/{projectId}") @PostMapping(value = "/add/{projectId}")
public Result<String> add(@PathVariable("projectId") String projectId, @RequestBody List<ProjectAnnualBudget> list) { public Result<String> add(@PathVariable("projectId") String projectId, @RequestBody ProjectAnnualBudget projectAnnualBudget) {
Project project = iProjectService.getById(projectId); Project project = iProjectService.getById(projectId);
Optional.ofNullable(project).orElseThrow(() -> new JeecgBootException("项目不存在")); Optional.ofNullable(project).orElseThrow(() -> new JeecgBootException("项目不存在"));
BigDecimal sumFee = Optional.ofNullable(list).orElse(new LinkedList<>()).stream().map(ProjectAnnualBudget::getTotalAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
projectAnnualBudgetService.remove(new LambdaQueryWrapper<ProjectAnnualBudget>().eq(ProjectAnnualBudget::getProjectId, projectId)); projectAnnualBudgetService.remove(new LambdaQueryWrapper<ProjectAnnualBudget>().eq(ProjectAnnualBudget::getProjectId, projectId));
projectAnnualBudgetService.saveBatch(list); projectAnnualBudgetService.save(projectAnnualBudget);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
@ -151,6 +150,16 @@ public class ProjectAnnualBudgetController extends JeecgController<ProjectAnnual
return Result.OK(projectAnnualBudget); return Result.OK(projectAnnualBudget);
} }
@ApiOperation(value = "财政拨款分单位年度预算-通过id查询", notes = "财政拨款分单位年度预算-通过id查询")
@GetMapping(value = "/queryByProjectId/{projectId}")
public Result<ProjectAnnualBudget> queryByProjectId(@PathVariable("projectId") String projectId) {
ProjectAnnualBudget projectAnnualBudget = projectAnnualBudgetService.getOne(new LambdaQueryWrapper<ProjectAnnualBudget>().eq(ProjectAnnualBudget::getProjectId,projectId));
if (projectAnnualBudget == null) {
return Result.error("未找到对应数据");
}
return Result.OK(projectAnnualBudget);
}
/** /**
* 导出excel * 导出excel
* *

@ -71,24 +71,40 @@ public class ProjectAnnualBudget implements Serializable {
@Excel(name = "项目id", width = 15) @Excel(name = "项目id", width = 15)
@ApiModelProperty(value = "项目id") @ApiModelProperty(value = "项目id")
private String projectId; private String projectId;
@Excel(name = "年度1", width = 15)
@ApiModelProperty(value = "年度1")
private String year1;
/**
* 年度2
*/
@Excel(name = "年度2", width = 15)
@ApiModelProperty(value = "年度2")
private String year2;
/** /**
* 年度1 * 年度3
*/ */
@Excel(name = "年度3", width = 15)
@ApiModelProperty(value = "年度3")
private String year3;
@Excel(name = "年度1", width = 15) @Excel(name = "年度1", width = 15)
@ApiModelProperty(value = "年度1") @ApiModelProperty(value = "年度1")
private String annual1; private String year1Value;
/** /**
* 年度2 * 年度2
*/ */
@Excel(name = "年度2", width = 15) @Excel(name = "年度2", width = 15)
@ApiModelProperty(value = "年度2") @ApiModelProperty(value = "年度2")
private String annual2; private String year2Value;
/** /**
* 年度3 * 年度3
*/ */
@Excel(name = "年度3", width = 15) @Excel(name = "年度3", width = 15)
@ApiModelProperty(value = "年度3") @ApiModelProperty(value = "年度3")
private String annual3; private String year3Value;
/** /**
* 部门名称 * 部门名称
*/ */

@ -28,17 +28,17 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td><a-input v-model:value="data.name" /></td> <td><a-input v-model:value="data.departName" /></td>
<td><a-input prefix="¥" suffix="RMB" v-model:value="data.year1Value" /></td> <td><a-input prefix="¥" suffix="RMB" v-model:value="data.year1Value" /></td>
<td><a-input prefix="¥" suffix="RMB" v-model:value="data.year2Value" /></td> <td><a-input prefix="¥" suffix="RMB" v-model:value="data.year2Value" /></td>
<td><a-input prefix="¥" suffix="RMB" v-model:value="data.year3Value" /></td> <td><a-input prefix="¥" suffix="RMB" v-model:value="data.year3Value" /></td>
<td>{{sum}}</td> <td>{{Amount}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="button-container"> <div class="button-container">
<a-button type="primary" @click="save">保存</a-button> <a-button type="primary" @click="handleSubmit">保存</a-button>
<a-button type="primary" @click="router.back();">返回</a-button> <a-button type="primary" @click="router.back();">返回</a-button>
</div> </div>
</template> </template>
@ -46,7 +46,10 @@
<script setup> <script setup>
import {ref,onMounted,computed} from 'vue' import {ref,onMounted,computed} from 'vue'
import {useRoute, useRouter} from "vue-router"; import {useRoute, useRouter} from "vue-router";
import {saveOrUpdate} from "@/views/projectApplication/project/Project.api"; import {saveOrUpdate} from "@/views/projectAnnualBudget/ProjectAnnualBudget.api";
import {defHttp} from "@/utils/http/axios";
import {useMessage} from "@/hooks/web/useMessage";
const { createMessage } = useMessage();
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
@ -58,25 +61,14 @@ const data = ref({
year1Value:0, year1Value:0,
year2Value:0, year2Value:0,
year3Value:0, year3Value:0,
name:'', departName:'',
sum:'' totalAmount:''
}) })
onMounted(()=> { onMounted(()=> {
// data.value.year1 = '2025' loadData();
}) })
async function handleSubmit() { const handleSubmit = async () => {
let val = await validate();
console.log('val----------',JSON.stringify(val))
// let data = getFieldsValue();
// let params = Object.assign({}, formData, data);
val.id = route.query.id;
console.log('表单数据', val)
await saveOrUpdate(val, true)
}
const save = () => {
let params = { let params = {
year1:data.value.year1.$y, year1:data.value.year1.$y,
year2:data.value.year2.$y, year2:data.value.year2.$y,
@ -84,12 +76,48 @@ const save = () => {
year1Value:data.value.year1Value, year1Value:data.value.year1Value,
year2Value:data.value.year2Value, year2Value:data.value.year2Value,
year3Value:data.value.year3Value, year3Value:data.value.year3Value,
name:data.value.name, departName:data.value.departName,
sum:data.value.sum, totalAmount:Number(data.value.year1Value) + Number(data.value.year2Value) + Number(data.value.year3Value),
} }
console.log(JSON.stringify(params)) params.projectId = route.query.id;
defHttp
.post({
url: '/projectAnnualBudget/projectAnnualBudget/add/'+route.query.id,
params: params,
})
/*.then(() => {
// createMessage.success(``);
// loadData();
})
.finally(() => {
// loading.value = false;
});*/
} }
const sum = computed(() => {
//
async function loadData() {
// loading.value = true;
//
await defHttp
.get({
//
url: '/projectAnnualBudget/projectAnnualBudget/queryByProjectId/'+route.query.id,
}).then((result) => {
data.value.year1Value = result.year1Value
data.value.year2Value = result.year2Value
data.value.year3Value = result.year3Value
data.value.departName = result.departName
console.log("the data()",JSON.stringify(result))
// total
// pagination.total = result.total;
// dataSource
// dataSource.value = result.records;
// //
// selectedRows.value = [];
})
}
const Amount = computed(() => {
return Number(data.value.year1Value) + Number(data.value.year2Value) + Number(data.value.year3Value) return Number(data.value.year1Value) + Number(data.value.year2Value) + Number(data.value.year3Value)
}) })
</script> </script>

Loading…
Cancel
Save