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

master
zhc077 4 weeks ago
parent fdd8173de2
commit 5e7a51cc7a
  1. 2
      jeecgboot-vue3/src/views/demo/jeecg/JVxeTableDemo/func-demo/JSBCDemo.vue
  2. 224
      jeecgboot-vue3/src/views/projectApplication/kejigongguan/yusuanshu/ProjectFeeBudgetDemo.vue
  3. 11
      jeecgboot-vue3/src/views/projectApplication/kejigongguan/yusuanshu/index.vue

@ -1,5 +1,5 @@
<template> <template>
<a-card title="即时保存示例" :bordered="false"> <a-card title="即时保存示例7777777" :bordered="false">
<!-- <!--
即时保存大体思路 即时保存大体思路
1. JVxeTable 上必须加 keep-source 属性 1. JVxeTable 上必须加 keep-source 属性

@ -0,0 +1,224 @@
<template>
<a-card title="即时保存示例7777777" :bordered="false">
<!--
即时保存大体思路
1. JVxeTable 上必须加 keep-source 属性
2. 监听 edit-closed事件这个事件是在编辑完成后触发
3. 在这个事件里面判断数据是否更改如果更改了就调用接口进行保存操作
-->
<JVxeTable
toolbar
:toolbarConfig="toolbarConfig"
rowNumber
rowSelection
keepSource
asyncRemove
:height="340"
:loading="loading"
:columns="columns"
:dataSource="dataSource"
:pagination="pagination"
@save="handleTableSave"
@removed="handleTableRemove"
@edit-closed="handleEditClosed"
@pageChange="handlePageChange"
@selectRowChange="handleSelectRowChange"
/>
</a-card>
</template>
<script lang="ts" setup>
//
import { reactive, ref } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
//
const toolbarConfig = reactive({
// add remove clearSelection
btn: ['add', 'save', 'remove', 'clearSelection'],
});
//
const loading = ref(false);
//
const pagination = reactive({
//
current: 1,
//
pageSize: 200,
//
pageSizeOptions: ['10', '20', '30', '100', '200'],
// 0
total: 0,
});
//
const selectedRows = ref<Recordable[]>([]);
//
const dataSource = ref<Recordable[]>([]);
//
const columns = ref<JVxeColumn[]>([
{ key: 'num', title: '序号', width: 80, type: JVxeTypes.normal },
{
// key
key: 'ship_name',
//
title: '船名',
//
width: 180,
// typeinput
type: JVxeTypes.input,
},
{ 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 },
]);
// url
enum Api {
getData = '/mock/vxe/getData',
//
saveRow = '/mock/vxe/immediateSaveRow',
//
saveAll = '/mock/vxe/immediateSaveAll',
}
loadData();
//
async function loadData() {
loading.value = true;
//
await defHttp
.get({
//
url: Api.getData,
//
params: {
pageNo: pagination.current,
pageSize: pagination.pageSize,
},
})
.then((result) => {
// total
pagination.total = result.total;
// dataSource
dataSource.value = result.records;
//
selectedRows.value = [];
})
.finally(() => {
// loading
loading.value = false;
});
}
//
function handleTableSave({ $table, target }) {
//
$table.validate().then((errMap) => {
//
if (!errMap) {
//
let tableData = target.getTableData();
console.log('当前保存的数据是:', tableData);
//
let newData = target.getNewData();
console.log('-- 新增的数据:', newData);
//
let deleteData = target.getDeleteData();
console.log('-- 删除的数据:', deleteData);
//
loading.value = true;
defHttp
.post({
url: Api.saveAll,
params: tableData,
})
.then(() => {
createMessage.success(`保存成功!`);
})
.finally(() => {
loading.value = false;
});
}
});
}
//
function handleTableRemove(event) {
// event.deleteRows
console.log('待删除的数据: ', event.deleteRows);
// IDID
let deleteIds = event.deleteRows.map((row) => row.id);
console.log('待删除的数据ids: ', deleteIds);
//
loading.value = true;
window.setTimeout(() => {
loading.value = false;
createMessage.success('删除成功');
// confirmRemove()
event.confirmRemove();
}, 1000);
}
//
function handleEditClosed(event) {
let { $table, row, column } = event;
let field = column.property;
//
if ($table.isUpdateByRow(row, field)) {
//
$table.validate(row).then((errMap) => {
//
if (!errMap) {
//
let hideLoading = createMessage.loading(`正在保存"${column.title}"`, 0);
console.log('即时保存数据:', row);
defHttp
.put({
url: Api.saveRow,
params: row,
})
.then((res) => {
createMessage.success(`"${column.title}"保存成功!`);
//
$table.reloadRow(row, null, field);
})
.finally(() => {
hideLoading();
});
}
});
}
}
//
function handlePageChange(event) {
//
pagination.current = event.current;
pagination.pageSize = event.pageSize;
//
loadData();
}
//
function handleSelectRowChange(event) {
selectedRows.value = event.selectedRows;
}
</script>
<style scoped></style>

@ -6,13 +6,14 @@
<a-tab-pane key="TianBaoShuMingDemo" tab="填报说明" force-render></a-tab-pane> <a-tab-pane key="TianBaoShuMingDemo" tab="填报说明" force-render></a-tab-pane>
<a-tab-pane key="ProjectBaseInfoDemo" tab="项目基本情况表"></a-tab-pane> <a-tab-pane key="ProjectBaseInfoDemo" tab="项目基本情况表"></a-tab-pane>
<a-tab-pane key="DepartBaseInfoDemo" tab="部门基本情况表"></a-tab-pane> <a-tab-pane key="DepartBaseInfoDemo" tab="部门基本情况表"></a-tab-pane>
<a-tab-pane key="ZhengWenDemo" tab="正文"></a-tab-pane> <a-tab-pane key="ProjectFeeBudgetDemo" tab="项目经费预算表"></a-tab-pane>
<a-tab-pane key="XiangMuHeZuoKaiFaDemo" tab="项目合作开发情况"></a-tab-pane> <!-- <a-tab-pane key="ZhengWenDemo" tab="正文"></a-tab-pane>-->
<a-tab-pane key="HeZuoDanWeiDemo" tab="合作单位"></a-tab-pane> <!-- <a-tab-pane key="XiangMuHeZuoKaiFaDemo" tab="项目合作开发情况"></a-tab-pane>-->
<!-- <a-tab-pane key="HeZuoDanWeiDemo" tab="合作单位"></a-tab-pane>-->
<!-- <a-tab-pane key="ZhuYaoRenYuanDemo" tab="项目主要参加人员"></a-tab-pane>--> <!-- <a-tab-pane key="ZhuYaoRenYuanDemo" tab="项目主要参加人员"></a-tab-pane>-->
<!-- <a-tab-pane key="JeecgPdfView" tab="PDF预览"></a-tab-pane>--> <!-- <a-tab-pane key="JeecgPdfView" tab="PDF预览"></a-tab-pane>-->
<!-- <a-tab-pane key="XiangMuJiXiaoMuBiaoDemo" tab="项目绩效目标"></a-tab-pane>--> <!-- <a-tab-pane key="XiangMuJiXiaoMuBiaoDemo" tab="项目绩效目标"></a-tab-pane>-->
<a-tab-pane key="YiJianDemo" tab="意见"></a-tab-pane> <!-- <a-tab-pane key="YiJianDemo" tab="意见"></a-tab-pane>-->
<a-tab-pane key="FuJianDemo" tab="附件"></a-tab-pane> <a-tab-pane key="FuJianDemo" tab="附件"></a-tab-pane>
</a-tabs> </a-tabs>
<component :is="currentComponent"></component> <component :is="currentComponent"></component>
@ -28,6 +29,7 @@
import TianBaoShuMingDemo from './TianBaoShuMingDemo.vue'; import TianBaoShuMingDemo from './TianBaoShuMingDemo.vue';
import ProjectBaseInfoDemo from './ProjectBaseInfoDemo.vue'; import ProjectBaseInfoDemo from './ProjectBaseInfoDemo.vue';
import DepartBaseInfoDemo from './DepartBaseInfoDemo.vue'; import DepartBaseInfoDemo from './DepartBaseInfoDemo.vue';
import ProjectFeeBudgetDemo from './ProjectFeeBudgetDemo.vue';
import XiangMuJiXiaoMuBiaoDemo from '../xiangmushu/XiangMuJiXiaoMuBiaoDemo.vue'; import XiangMuJiXiaoMuBiaoDemo from '../xiangmushu/XiangMuJiXiaoMuBiaoDemo.vue';
import YiJianDemo from '../xiangmushu/YiJianDemo.vue'; import YiJianDemo from '../xiangmushu/YiJianDemo.vue';
import HeZuoDanWeiDemo from '../xiangmushu/HeZuoDanWeiDemo.vue'; import HeZuoDanWeiDemo from '../xiangmushu/HeZuoDanWeiDemo.vue';
@ -50,6 +52,7 @@
FengMianDemo: FengMianDemo, FengMianDemo: FengMianDemo,
ProjectBaseInfoDemo: ProjectBaseInfoDemo, ProjectBaseInfoDemo: ProjectBaseInfoDemo,
DepartBaseInfoDemo: DepartBaseInfoDemo, DepartBaseInfoDemo: DepartBaseInfoDemo,
ProjectFeeBudgetDemo: ProjectFeeBudgetDemo,
ZhengWenDemo: ZhengWenDemo, ZhengWenDemo: ZhengWenDemo,
XiangMuHeZuoKaiFaDemo: XiangMuHeZuoKaiFaDemo, XiangMuHeZuoKaiFaDemo: XiangMuHeZuoKaiFaDemo,
XiangMuJiXiaoMuBiaoDemo: XiangMuJiXiaoMuBiaoDemo, XiangMuJiXiaoMuBiaoDemo: XiangMuJiXiaoMuBiaoDemo,

Loading…
Cancel
Save