fix: fix some bug in finance pages
This commit is contained in:
@@ -5,7 +5,7 @@ from finance.models import Department
|
||||
|
||||
class ProjectGroup(models.Model):
|
||||
"""项目组模型"""
|
||||
name = models.CharField(max_length=100, unique=True, verbose_name="项目组名称")
|
||||
name = models.CharField(max_length=100, verbose_name="项目组名称")
|
||||
department = models.ForeignKey(Department, on_delete=models.CASCADE, verbose_name="所属部门")
|
||||
description = models.TextField(blank=True, null=True, verbose_name="项目组描述")
|
||||
created_at = models.DateTimeField(auto_now_add=True, verbose_name="创建时间")
|
||||
@@ -30,7 +30,6 @@ class Personnel(models.Model):
|
||||
name = models.CharField(max_length=50, verbose_name="姓名")
|
||||
student_id = models.CharField(
|
||||
max_length=20,
|
||||
unique=True,
|
||||
verbose_name="学号",
|
||||
validators=[RegexValidator(
|
||||
regex=r'^\d{8,12}$',
|
||||
|
||||
@@ -44,15 +44,6 @@ class PersonnelWriteSerializer(serializers.ModelSerializer):
|
||||
'is_active', 'phone', 'qq', 'email', 'description'
|
||||
]
|
||||
|
||||
def validate_student_id(self, value):
|
||||
"""验证学号唯一性"""
|
||||
if self.instance and self.instance.student_id == value:
|
||||
return value
|
||||
|
||||
if Personnel.objects.filter(student_id=value).exists():
|
||||
raise serializers.ValidationError("该学号已存在")
|
||||
return value
|
||||
|
||||
def validate_project_group(self, value):
|
||||
"""验证项目组是否属于选定的部门"""
|
||||
if value and hasattr(self, 'initial_data'):
|
||||
|
||||
@@ -295,7 +295,7 @@ export default {
|
||||
);
|
||||
|
||||
// 构建详细信息
|
||||
let detailInfo = `<div style="max-width: 400px;">
|
||||
let detailInfo = `<div>
|
||||
<h3 style="margin: 0 0 15px 0; color: #409eff;">${date} - ${seriesName}</h3>
|
||||
<p style="margin: 0 0 10px 0; font-size: 18px; font-weight: bold; color: ${seriesName === '收入' ? '#67c23a' : '#f56c6c'};">
|
||||
总计: ¥${value.toFixed(2)}
|
||||
@@ -328,7 +328,7 @@ export default {
|
||||
showClose: true,
|
||||
closeOnClickModal: true,
|
||||
closeOnPressEscape: true
|
||||
});
|
||||
}).catch(() => { /* 关闭时不做操作,否则会炸 */ });
|
||||
});
|
||||
|
||||
// 添加鼠标悬停时显示数据标签
|
||||
|
||||
Reference in New Issue
Block a user