优化代码
This commit is contained in:
@ -62,7 +62,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-dialog v-model="dialogOpen" width="700px" append-to-body :title="dialogTitle" :close-on-click-modal="false"
|
||||
<el-dialog v-model="dialogOpen" width="800px" append-to-body :title="dialogTitle" :close-on-click-modal="false"
|
||||
@close="cancel">
|
||||
<el-alert v-if="isBalance" type="success" show-icon :closable="false"
|
||||
center
|
||||
@ -79,10 +79,21 @@
|
||||
<p class="balance-label">期末现金及现金等价物余额(38行)</p>
|
||||
</div>
|
||||
<div class="operator">−</div>
|
||||
<div class="balance-item">
|
||||
<div class="balance-item" style="width: 40%">
|
||||
<p class="balance-amount" v-if="startingBalance !== 0.00">{{ formatBalance(startingBalance) }}</p>
|
||||
<p class="balance-amount" v-else>0.00</p>
|
||||
<p class="balance-label">科目初始余额</p>
|
||||
<!-- 分割线 -->
|
||||
<hr class="balance-divider"/>
|
||||
<!-- 明细列表 -->
|
||||
<div
|
||||
class="balance-detail"
|
||||
v-for="(item, index) in bookInitBalances"
|
||||
:key="index"
|
||||
>
|
||||
<span class="balance-detail-left">·{{ item.code }}{{ item.name }}</span>
|
||||
<span class="balance-detail-right">{{ formatBalance(item.balance)}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="operator">=</div>
|
||||
|
||||
@ -114,12 +125,11 @@ import {ElForm} from "element-plus";
|
||||
const {t} = useI18n()
|
||||
const {proxy} = getCurrentInstance()!;
|
||||
const dataList: any = ref<any>([]);
|
||||
const bookInitBalances: any = ref<any>([]);
|
||||
const loading: any = ref(false);
|
||||
const data = reactive({
|
||||
queryParams: {},
|
||||
form: {
|
||||
|
||||
}
|
||||
form: {}
|
||||
});
|
||||
const {queryParams, form} = toRefs(data);
|
||||
const inputRef = ref<any>(null);
|
||||
@ -352,12 +362,14 @@ const tableRowClassName = ({row, rowIndex}: { row: TableItem; rowIndex: number }
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
fetchPage(queryParams.value).then((response: any) => {
|
||||
dataList.value = response.data.map((item: any) => ({
|
||||
dataList.value = response.data.configCashFlowBalances.map((item: any) => ({
|
||||
...item,
|
||||
editing: false,
|
||||
inputBalance: item.balance
|
||||
}));
|
||||
|
||||
bookInitBalances.value = response.data.bookInitBalances;
|
||||
|
||||
loading.value = false;
|
||||
// 在数据加载完成后执行一次计算
|
||||
calculateAllValues();
|
||||
@ -592,7 +604,7 @@ getList();
|
||||
|
||||
.balance-calculation {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
justify-content: space-around;
|
||||
align-items: flex-start;
|
||||
margin: 30px 0;
|
||||
gap: 20px;
|
||||
@ -623,4 +635,27 @@ getList();
|
||||
color: #909399;
|
||||
margin-top: 4px; /* 调整操作符垂直对齐位置 */
|
||||
}
|
||||
|
||||
.balance-divider {
|
||||
margin: 10px auto;
|
||||
border: none;
|
||||
border-top: 1px solid #eee;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.balance-detail {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
padding: 2px 20px;
|
||||
}
|
||||
|
||||
.balance-detail-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.balance-detail-right {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package com.jinbooks.entity.vo;
|
||||
|
||||
import com.jinbooks.entity.base.BookInitBalance;
|
||||
import com.jinbooks.entity.config.ConfigCashFlowBalance;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: orangeBabu
|
||||
* @time: 2025/6/3 16:37
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CashFlowSubjectBalanceVo {
|
||||
List<ConfigCashFlowBalance> configCashFlowBalances;
|
||||
|
||||
List<BookInitBalance> bookInitBalances;
|
||||
}
|
||||
@ -24,13 +24,15 @@ import com.jinbooks.entity.book.dto.BookChangeDto;
|
||||
import com.jinbooks.entity.config.ConfigCashFlowBalance;
|
||||
import com.jinbooks.entity.config.dto.ConfigCashFlowChangeDto;
|
||||
import com.jinbooks.entity.config.dto.ConfigCashFlowPageDto;
|
||||
import com.jinbooks.entity.vo.CashFlowSubjectBalanceVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 24096
|
||||
*/
|
||||
public interface ConfigCashFlowBalanceService extends IService<ConfigCashFlowBalance> {
|
||||
Message<List<ConfigCashFlowBalance>> pageList(ConfigCashFlowPageDto dto);
|
||||
Message<CashFlowSubjectBalanceVo> pageList(ConfigCashFlowPageDto dto);
|
||||
|
||||
/**
|
||||
* @Description: 获取现金流量选择项
|
||||
|
||||
@ -27,6 +27,7 @@ import com.jinbooks.entity.book.dto.BookChangeDto;
|
||||
import com.jinbooks.entity.config.ConfigCashFlowBalance;
|
||||
import com.jinbooks.entity.config.dto.ConfigCashFlowChangeDto;
|
||||
import com.jinbooks.entity.config.dto.ConfigCashFlowPageDto;
|
||||
import com.jinbooks.entity.vo.CashFlowSubjectBalanceVo;
|
||||
import com.jinbooks.exception.BusinessException;
|
||||
import com.jinbooks.persistence.mapper.BookInitBalanceMapper;
|
||||
import com.jinbooks.persistence.mapper.ConfigCashFlowBalanceMapper;
|
||||
@ -56,12 +57,13 @@ public class ConfigCashFlowBalanceServiceImpl extends ServiceImpl<ConfigCashFlow
|
||||
private final BookInitBalanceMapper bookInitBalanceMapper;
|
||||
|
||||
@Override
|
||||
public Message<List<ConfigCashFlowBalance>> pageList(ConfigCashFlowPageDto dto) {
|
||||
public Message<CashFlowSubjectBalanceVo> pageList(ConfigCashFlowPageDto dto) {
|
||||
LambdaQueryWrapper<ConfigCashFlowBalance> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ConfigCashFlowBalance::getBookId, dto.getBookId())
|
||||
.orderByAsc(ConfigCashFlowBalance::getSortIndex);
|
||||
List<ConfigCashFlowBalance> list = super.list(wrapper);
|
||||
|
||||
//获取科目初始余额
|
||||
LambdaQueryWrapper<BookInitBalance> wrapperBookInit = new LambdaQueryWrapper<>();
|
||||
wrapperBookInit.eq(BookInitBalance::getBookId, dto.getBookId());
|
||||
wrapperBookInit.eq(BookInitBalance::getLevel, 1);
|
||||
@ -115,9 +117,8 @@ public class ConfigCashFlowBalanceServiceImpl extends ServiceImpl<ConfigCashFlow
|
||||
}
|
||||
}
|
||||
|
||||
// super.updateBatchById(list);
|
||||
|
||||
return Message.ok(list);
|
||||
CashFlowSubjectBalanceVo cashFlowSubjectBalanceVo = new CashFlowSubjectBalanceVo(list, bookInitBalances);
|
||||
return Message.ok(cashFlowSubjectBalanceVo);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -457,7 +457,7 @@ public class StatementReportServiceImpl implements StatementReportService {
|
||||
}
|
||||
|
||||
//设置期初余额
|
||||
//获取初始余额
|
||||
//获取科目初始余额
|
||||
LambdaQueryWrapper<BookInitBalance> wrapperBookInit = new LambdaQueryWrapper<>();
|
||||
wrapperBookInit.eq(BookInitBalance::getBookId, bookId);
|
||||
wrapperBookInit.eq(BookInitBalance::getLevel, 1);
|
||||
|
||||
@ -20,6 +20,7 @@ package com.jinbooks.web.config.contorller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jinbooks.entity.vo.CashFlowSubjectBalanceVo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
@ -57,7 +58,7 @@ public class ConfigCashFlowBalanceController {
|
||||
private final ConfigCashFlowBalanceService configCashFlowService;
|
||||
|
||||
@GetMapping(value = {"/fetch"})
|
||||
public Message<List<ConfigCashFlowBalance>> fetch(@ParameterObject ConfigCashFlowPageDto dto,
|
||||
public Message<CashFlowSubjectBalanceVo> fetch(@ParameterObject ConfigCashFlowPageDto dto,
|
||||
@CurrentUser UserInfo currentUser) {
|
||||
logger.debug("fetch {}", dto);
|
||||
dto.setBookId(currentUser.getBookId());
|
||||
|
||||
Reference in New Issue
Block a user