修改工资凭证
This commit is contained in:
@ -37,7 +37,7 @@
|
||||
<el-cascader
|
||||
style="width: 100%"
|
||||
filterable
|
||||
v-model="scope.row.subjectId"
|
||||
v-model="scope.row.subjectCode"
|
||||
:options="deptOptions"
|
||||
:props="defaultProps"
|
||||
/>
|
||||
@ -121,7 +121,7 @@ const props: any = defineProps({
|
||||
const defaultProps: any = ref({
|
||||
expandTrigger: 'hover',
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
value: 'code',
|
||||
children: 'children',
|
||||
checkStrictly: false,
|
||||
emitPath: false,
|
||||
@ -145,7 +145,7 @@ interface VoucherItem {
|
||||
id: null;
|
||||
summary: string;
|
||||
direction: string;
|
||||
subjectId: number | null;
|
||||
subjectCode: string | null;
|
||||
selectedValue: string;
|
||||
// 其他可能的字段...
|
||||
[key: string]: any; // 这允许添加其他可能从后端返回的字段
|
||||
@ -193,7 +193,7 @@ function reset(): any {
|
||||
id: null,
|
||||
summary: summaryTemplate,
|
||||
direction: "1",
|
||||
subjectId: props.deptOptions?.[0]?.id || null,
|
||||
subjectCode: props.deptOptions?.[0]?.code || null,
|
||||
selectedValue: salary_values.value[0].value,
|
||||
}]
|
||||
|
||||
@ -209,7 +209,7 @@ function addRecord() {
|
||||
id: null,
|
||||
summary: summaryTemplate,
|
||||
direction: "1",
|
||||
subjectId: props.deptOptions?.[0]?.id || null,
|
||||
subjectCode: props.deptOptions?.[0]?.code || null,
|
||||
selectedValue: salary_values.value[0].value,
|
||||
});
|
||||
}
|
||||
|
||||
@ -46,8 +46,6 @@ public class EmployeeSalaryVoucherRule extends BaseEntity {
|
||||
|
||||
private String direction;
|
||||
|
||||
private String subjectId;
|
||||
|
||||
private String templateId;
|
||||
|
||||
private String selectedValue;
|
||||
@ -55,6 +53,5 @@ public class EmployeeSalaryVoucherRule extends BaseEntity {
|
||||
@TableField(exist = false)
|
||||
private String subjectName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String subjectCode;
|
||||
}
|
||||
|
||||
@ -39,8 +39,8 @@ public class SalaryTemplateDetailDto {
|
||||
@NotEmpty(message = "借贷方向不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String direction;
|
||||
|
||||
@NotEmpty(message = "科目不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String subjectId;
|
||||
@NotEmpty(message = "科目编码不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String subjectCode;
|
||||
|
||||
@NotEmpty(message = "取值不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String selectedValue;
|
||||
|
||||
@ -182,7 +182,7 @@ public class EmployeeSalarySummaryServiceImpl extends ServiceImpl<EmployeeSalary
|
||||
};
|
||||
|
||||
boolean isDebit = "1".equals(rule.getDirection());
|
||||
voucherItems.add(createVoucherItemDto(rule, isDebit, amount));
|
||||
voucherItems.add(createVoucherItemDto(bookId, rule, isDebit, amount));
|
||||
|
||||
if (isDebit) {
|
||||
debitAmount = debitAmount.add(amount);
|
||||
@ -259,14 +259,17 @@ public class EmployeeSalarySummaryServiceImpl extends ServiceImpl<EmployeeSalary
|
||||
/**
|
||||
* Creates a voucher item dto based on rule and direction
|
||||
*/
|
||||
private VoucherItemChangeDto createVoucherItemDto(
|
||||
private VoucherItemChangeDto createVoucherItemDto(String bookId,
|
||||
EmployeeSalaryVoucherRule rule, boolean isDebit, BigDecimal amount) {
|
||||
|
||||
BookSubject bookSubject = bookSubjectMapper.selectById(rule.getSubjectId());
|
||||
LambdaQueryWrapper<BookSubject> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookSubject::getBookId, bookId);
|
||||
wrapper.eq(BookSubject::getCode, rule.getSubjectCode());
|
||||
BookSubject bookSubject = bookSubjectMapper.selectOne(wrapper);
|
||||
|
||||
VoucherItemChangeDto itemDto = new VoucherItemChangeDto();
|
||||
itemDto.setSummary(rule.getSummary());
|
||||
itemDto.setSubjectId(rule.getSubjectId());
|
||||
itemDto.setSubjectId(bookSubject.getId());
|
||||
if (isDebit) {
|
||||
itemDto.setDebitAmount(amount);
|
||||
} else {
|
||||
|
||||
@ -266,7 +266,7 @@ public class EmployeeSalaryVoucherRuleServiceImpl extends ServiceImpl<EmployeeSa
|
||||
// 设置属性
|
||||
rule.setSummary(dto.getSummary());
|
||||
rule.setDirection(dto.getDirection());
|
||||
rule.setSubjectId(dto.getSubjectId());
|
||||
rule.setSubjectCode(dto.getSubjectCode());
|
||||
rule.setSelectedValue(dto.getSelectedValue());
|
||||
// 设置其他属性...
|
||||
return rule;
|
||||
@ -276,7 +276,7 @@ public class EmployeeSalaryVoucherRuleServiceImpl extends ServiceImpl<EmployeeSa
|
||||
// 更新属性
|
||||
rule.setSummary(dto.getSummary());
|
||||
rule.setDirection(dto.getDirection());
|
||||
rule.setSubjectId(dto.getSubjectId());;
|
||||
rule.setSubjectCode(dto.getSubjectCode());
|
||||
rule.setSelectedValue(dto.getSelectedValue());
|
||||
// 更新其他属性...
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user