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