预算书-专项经费预算 功能添加 10.29

master
zhc077 4 weeks ago
parent 5e7a51cc7a
commit 6b31ff9d95
  1. 39
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/mock/vxe/controller/VxeMockController.java
  2. 16
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/mock/vxe/json/projectFeeBudget.json
  3. 24
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectFeeBudget/controller/ProjectFeeBudgetController.java
  4. 83
      jeecgboot-vue3/src/views/projectApplication/kejigongguan/yusuanshu/ProjectFeeBudgetDemo.vue

@ -1,8 +1,10 @@
package org.jeecg.modules.demo.mock.vxe.controller; package org.jeecg.modules.demo.mock.vxe.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -16,6 +18,9 @@ import org.jeecg.common.system.query.QueryCondition;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.demo.mock.vxe.entity.MockEntity; import org.jeecg.modules.demo.mock.vxe.entity.MockEntity;
import org.jeecg.modules.demo.mock.vxe.websocket.VxeSocket; import org.jeecg.modules.demo.mock.vxe.websocket.VxeSocket;
import org.jeecg.modules.demo.projectFeeBudget.entity.ProjectFeeBudget;
import org.jeecg.modules.demo.projectFeeBudget.service.IProjectFeeBudgetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -33,6 +38,9 @@ import java.util.*;
@Slf4j @Slf4j
public class VxeMockController { public class VxeMockController {
@Autowired
private IProjectFeeBudgetService projectFeeBudgetService;
/** /**
* 模拟更改状态 * 模拟更改状态
* *
@ -200,6 +208,37 @@ public class VxeMockController {
return Result.ok(page); return Result.ok(page);
} }
/**
* @description: 获取项目经费预算填报项
* @param: [pageNo, pageSize, parentId]
* @return: org.jeecg.common.api.vo.Result
* @author: z.h.c
* @date: 24/10/29 15:47
*/
@GetMapping("/getProjectFeeBudgetList/{projectId}")
public Result getProjectFeeBudgetList(@PathVariable("projectId") String projectId,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
// 父级id,根据父级id查询子级,如果为空则查询顶级
@RequestParam(name = "parentId", required = false) String parentId) {
JSONArray dataList;
List<ProjectFeeBudget> feeBudgetList = projectFeeBudgetService.list(new LambdaQueryWrapper<ProjectFeeBudget>().eq(ProjectFeeBudget::getProjectId,projectId));
if (ObjectUtil.isNotEmpty(feeBudgetList)) {
dataList = JSONArray.parseArray(JSON.toJSONString(feeBudgetList));
} else {
String path = "classpath:org/jeecg/modules/demo/mock/vxe/json/projectFeeBudget.json";
dataList = readJsonData(path);
/*// 读取JSON数据
if (dataList == null) {
return Result.error("读取数据失败!");
}*/
}
IPage<JSONObject> page = this.queryDataPage(dataList, parentId, pageNo, pageSize);
return Result.ok(page);
}
/** /**
* 获取模拟调度计划页面的数据 * 获取模拟调度计划页面的数据
* *

@ -0,0 +1,16 @@
[
{"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":""}
{"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":""}
]

@ -1,7 +1,10 @@
package org.jeecg.modules.demo.projectFeeBudget.controller; package org.jeecg.modules.demo.projectFeeBudget.controller;
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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.ddl.history.IDdlGenerator;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -11,6 +14,7 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.demo.projectFeeBudget.entity.ProjectFeeBudget; import org.jeecg.modules.demo.projectFeeBudget.entity.ProjectFeeBudget;
import org.jeecg.modules.demo.projectFeeBudget.service.IProjectFeeBudgetService; import org.jeecg.modules.demo.projectFeeBudget.service.IProjectFeeBudgetService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -20,6 +24,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
/** /**
* @Description: 项目经费预算 * @Description: 项目经费预算
@ -35,6 +40,25 @@ public class ProjectFeeBudgetController extends JeecgController<ProjectFeeBudget
@Autowired @Autowired
private IProjectFeeBudgetService projectFeeBudgetService; private IProjectFeeBudgetService projectFeeBudgetService;
/**
* @description: 保存项目经费预算
* @param: [projectId, tableData]
* @return: org.jeecg.common.api.vo.Result
* @author: z.h.c
* @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));
List<ProjectFeeBudget> list = JSONArray.parseArray(tableData.toJSONString(), ProjectFeeBudget.class);
list.forEach(obj->{
obj.setProjectId(projectId);
obj.setId(UUIDGenerator.generate());
});
projectFeeBudgetService.saveBatch(list);
return Result.ok();
}
/** /**
* 分页列表查询 * 分页列表查询
* *

@ -1,5 +1,5 @@
<template> <template>
<a-card title="即时保存示例7777777" :bordered="false"> <a-card :bordered="true">
<!-- <!--
即时保存大体思路 即时保存大体思路
1. JVxeTable 上必须加 keep-source 属性 1. JVxeTable 上必须加 keep-source 属性
@ -9,22 +9,19 @@
<JVxeTable <JVxeTable
toolbar toolbar
:toolbarConfig="toolbarConfig" :toolbarConfig="toolbarConfig"
rowNumber
rowSelection rowSelection
keepSource keepSource
asyncRemove :height="600"
:height="340"
:loading="loading" :loading="loading"
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:pagination="pagination"
@save="handleTableSave" @save="handleTableSave"
@removed="handleTableRemove"
@edit-closed="handleEditClosed"
@pageChange="handlePageChange"
@selectRowChange="handleSelectRowChange"
/> />
</a-card> </a-card>
<div class="button-container">
<a-button type="primary" @click="router.back()">返回</a-button>
<!-- <a-button type="primary" @click="handleTableSave()">保存</a-button>-->
</div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -33,16 +30,19 @@ import { reactive, ref } from 'vue';
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types'; import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import {useRoute, useRouter} from "vue-router";
const router = useRouter();
const route = useRoute();
const { createMessage } = useMessage(); const { createMessage } = useMessage();
// //
const toolbarConfig = reactive({ const toolbarConfig = reactive({
// add remove clearSelection // add remove clearSelection
btn: ['add', 'save', 'remove', 'clearSelection'], btn: [/*'add',*/'save'/*, 'remove', 'clearSelection'*/],
}); });
// //
const loading = ref(false); const loading = ref(false);
// /*// 分页器参
const pagination = reactive({ const pagination = reactive({
// //
current: 1, current: 1,
@ -52,47 +52,38 @@ const pagination = reactive({
pageSizeOptions: ['10', '20', '30', '100', '200'], pageSizeOptions: ['10', '20', '30', '100', '200'],
// 0 // 0
total: 0, total: 0,
}); });*/
// //
const selectedRows = ref<Recordable[]>([]); const selectedRows = ref<Recordable[]>([]);
// //
const dataSource = ref<Recordable[]>([]); const dataSource = ref<Recordable[]>([]);
// //
const columns = ref<JVxeColumn[]>([ const columns = ref<JVxeColumn[]>([
{ key: 'num', title: '序号', width: 80, type: JVxeTypes.normal }, { key: 'budgetSubject', title: '预算科目', width: 300, type: JVxeTypes.normal },
{ {
// key // key
key: 'ship_name', key: 'totalFee',
// //
title: '船名', title: '合计',
// //
width: 180, width: 260,
// typeinput // typeinput
type: JVxeTypes.input, type: JVxeTypes.inputNumber,
},
{ key: 'call', title: '呼叫', width: 80, type: JVxeTypes.input },
{ key: 'len', title: '长', width: 80, type: JVxeTypes.input },
{ key: 'ton', title: '吨', width: 120, defaultValue: 233, type: JVxeTypes.input },
{ key: 'payer', title: '付款方', width: 120, defaultValue: '张三', type: JVxeTypes.input },
{ key: 'count', title: '数', width: 40, type: JVxeTypes.normal },
{
key: 'company',
title: '公司',
// minWidth
//
minWidth: 180,
type: JVxeTypes.input,
}, },
{ key: 'trend', title: '动向', width: 120, type: JVxeTypes.input }, { key: 'specialFee', title: '专项经费', width: 260, type: JVxeTypes.inputNumber },
{ key: 'selfFee', title: '自筹经费', width: 260, type: JVxeTypes.inputNumber },
{ key: 'specialFeeMark', title: '专项经费说明', width: 260, type: JVxeTypes.textarea },
]); ]);
// url // url
enum Api { enum Api {
getData = '/mock/vxe/getData', getData = '/mock/vxe/getData',
getData4ProjectFeeBudgetList = '/mock/vxe/getProjectFeeBudgetList',
// //
saveRow = '/mock/vxe/immediateSaveRow', saveRow = '/mock/vxe/immediateSaveRow',
// //
saveAll = '/mock/vxe/immediateSaveAll', saveAll = '/mock/vxe/immediateSaveAll',
saveAll4ProjectFeeBudget = '/projectFeeBudget/projectFeeBudget/saveAll',
} }
loadData(); loadData();
@ -104,16 +95,16 @@ async function loadData() {
await defHttp await defHttp
.get({ .get({
// //
url: Api.getData, url: Api.getData4ProjectFeeBudgetList+'/'+route.query.id,
// //
params: { // params: {
pageNo: pagination.current, // pageNo: pagination.current,
pageSize: pagination.pageSize, // pageSize: pagination.pageSize,
}, // },
}) params: { pageNo: 1, pageSize: 30 },
.then((result) => { }).then((result) => {
// total // total
pagination.total = result.total; // pagination.total = result.total;
// dataSource // dataSource
dataSource.value = result.records; dataSource.value = result.records;
// //
@ -134,17 +125,17 @@ function handleTableSave({ $table, target }) {
// //
let tableData = target.getTableData(); let tableData = target.getTableData();
console.log('当前保存的数据是:', tableData); console.log('当前保存的数据是:', tableData);
// /* // 获取新增的数
let newData = target.getNewData(); let newData = target.getNewData();
console.log('-- 新增的数据:', newData); console.log('-- 新增的数据:', newData);
// //
let deleteData = target.getDeleteData(); let deleteData = target.getDeleteData();
console.log('-- 删除的数据:', deleteData); console.log('-- 删除的数据:', deleteData);*/
// //
loading.value = true; loading.value = true;
defHttp defHttp
.post({ .post({
url: Api.saveAll, url: Api.saveAll4ProjectFeeBudget+'/'+route.query.id,
params: tableData, params: tableData,
}) })
.then(() => { .then(() => {
@ -158,7 +149,7 @@ function handleTableSave({ $table, target }) {
} }
// //
function handleTableRemove(event) { /*function handleTableRemove(event) {
// event.deleteRows // event.deleteRows
console.log('待删除的数据: ', event.deleteRows); console.log('待删除的数据: ', event.deleteRows);
// IDID // IDID
@ -173,7 +164,7 @@ function handleTableRemove(event) {
// confirmRemove() // confirmRemove()
event.confirmRemove(); event.confirmRemove();
}, 1000); }, 1000);
} }*/
// //
function handleEditClosed(event) { function handleEditClosed(event) {
@ -206,14 +197,14 @@ function handleEditClosed(event) {
} }
} }
// /*// 当分页参数变化时触发的事
function handlePageChange(event) { function handlePageChange(event) {
// //
pagination.current = event.current; pagination.current = event.current;
pagination.pageSize = event.pageSize; pagination.pageSize = event.pageSize;
// //
loadData(); loadData();
} }*/
// //
function handleSelectRowChange(event) { function handleSelectRowChange(event) {

Loading…
Cancel
Save