修改了一些明显的问题
This commit is contained in:
parent
fd7ceaceae
commit
b250fced58
|
@ -4,6 +4,9 @@ from .models import *
|
||||||
|
|
||||||
|
|
||||||
class EmployeeInformationForm(forms.ModelForm):
|
class EmployeeInformationForm(forms.ModelForm):
|
||||||
|
"""
|
||||||
|
人力资源管理-人员基本信息表单
|
||||||
|
"""
|
||||||
primary_department = forms.ChoiceField(
|
primary_department = forms.ChoiceField(
|
||||||
choices=[('', '---------')] + [(dept.department_name, dept.department_name) for dept in PrimaryDepartment.objects.all()],
|
choices=[('', '---------')] + [(dept.department_name, dept.department_name) for dept in PrimaryDepartment.objects.all()],
|
||||||
widget=forms.Select(attrs={'class': 'form-control'}),
|
widget=forms.Select(attrs={'class': 'form-control'}),
|
||||||
|
@ -65,6 +68,9 @@ class EmployeeInformationForm(forms.ModelForm):
|
||||||
|
|
||||||
|
|
||||||
class EmployeeAttendanceRecordForm(forms.ModelForm):
|
class EmployeeAttendanceRecordForm(forms.ModelForm):
|
||||||
|
"""
|
||||||
|
人力资源管理-员工考勤记录表单
|
||||||
|
"""
|
||||||
class Meta:
|
class Meta:
|
||||||
model = EmployeeAttendanceRecord
|
model = EmployeeAttendanceRecord
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -80,16 +86,10 @@ class EmployeeAttendanceRecordForm(forms.ModelForm):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class OtherLeaveDetailsForm(forms.ModelForm):
|
|
||||||
class Meta:
|
|
||||||
model = OtherLeaveDetails
|
|
||||||
fields = '__all__'
|
|
||||||
widgets = {
|
|
||||||
'description': forms.Textarea(attrs={'rows': 3}),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class AnnualLeaveRecordForm(forms.ModelForm):
|
class AnnualLeaveRecordForm(forms.ModelForm):
|
||||||
|
"""
|
||||||
|
人力资源管理-年假使用记录表单
|
||||||
|
"""
|
||||||
class Meta:
|
class Meta:
|
||||||
model = AnnualLeaveRecord
|
model = AnnualLeaveRecord
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -102,6 +102,9 @@ class AnnualLeaveRecordForm(forms.ModelForm):
|
||||||
|
|
||||||
|
|
||||||
class RankForm(forms.ModelForm):
|
class RankForm(forms.ModelForm):
|
||||||
|
"""
|
||||||
|
人力资源管理-职级表单
|
||||||
|
"""
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Rank
|
model = Rank
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -112,6 +115,9 @@ class RankForm(forms.ModelForm):
|
||||||
|
|
||||||
|
|
||||||
class PositionForm(forms.ModelForm):
|
class PositionForm(forms.ModelForm):
|
||||||
|
"""
|
||||||
|
人力资源管理-岗位表单
|
||||||
|
"""
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Position
|
model = Position
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -122,12 +128,9 @@ class PositionForm(forms.ModelForm):
|
||||||
|
|
||||||
|
|
||||||
class PerformanceEvaluationForm(forms.ModelForm):
|
class PerformanceEvaluationForm(forms.ModelForm):
|
||||||
class Meta:
|
"""
|
||||||
model = PerformanceEvaluation
|
人力资源管理-员工绩效表单
|
||||||
fields = '__all__'
|
"""
|
||||||
|
|
||||||
|
|
||||||
class PerformanceEvaluationAddForm(forms.ModelForm):
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PerformanceEvaluation
|
model = PerformanceEvaluation
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
|
@ -865,7 +865,7 @@ def performance_add(request):
|
||||||
基础数据-人力资源管理-员工绩效表-添加
|
基础数据-人力资源管理-员工绩效表-添加
|
||||||
"""
|
"""
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = PerformanceEvaluationAddForm(request.POST)
|
form = PerformanceEvaluationForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
form.save()
|
form.save()
|
||||||
return JsonResponse({"message": "添加成功"})
|
return JsonResponse({"message": "添加成功"})
|
||||||
|
@ -873,7 +873,7 @@ def performance_add(request):
|
||||||
form_html = render_to_string('form_partial.html', {'form': form}, request)
|
form_html = render_to_string('form_partial.html', {'form': form}, request)
|
||||||
return JsonResponse({"form_html": form_html, "errors": form.errors}, status=400)
|
return JsonResponse({"form_html": form_html, "errors": form.errors}, status=400)
|
||||||
elif request.method == 'GET':
|
elif request.method == 'GET':
|
||||||
form = PerformanceEvaluationAddForm()
|
form = PerformanceEvaluationForm()
|
||||||
form_html = render_to_string('form_partial.html', {'form': form}, request)
|
form_html = render_to_string('form_partial.html', {'form': form}, request)
|
||||||
return JsonResponse({"form_html": form_html})
|
return JsonResponse({"form_html": form_html})
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import datetime
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from .models import *
|
from .models import *
|
||||||
|
@ -5,17 +7,24 @@ from ..org_mgnt.models import PrimaryDepartment
|
||||||
|
|
||||||
|
|
||||||
class GroupBusinessTargetForm(forms.ModelForm):
|
class GroupBusinessTargetForm(forms.ModelForm):
|
||||||
|
current_year = datetime.datetime.now().year
|
||||||
|
|
||||||
primary_department = forms.ChoiceField(
|
primary_department = forms.ChoiceField(
|
||||||
choices=[('', '---------')] + [(dept.department_name, dept.department_name) for dept in PrimaryDepartment.objects.all()],
|
choices=[('', '---------')] + [(dept.department_name, dept.department_name) for dept in PrimaryDepartment.objects.all()],
|
||||||
widget=forms.Select(attrs={'class': 'form-control'}),
|
widget=forms.Select(attrs={'class': 'form-control'}),
|
||||||
label="一级部门"
|
label="一级部门"
|
||||||
)
|
)
|
||||||
|
year = forms.ChoiceField(
|
||||||
|
choices=[('', '---------')] + [(year, year) for year in range(current_year-1, current_year+2)],
|
||||||
|
widget=forms.Select(attrs={'class': 'form-control'}),
|
||||||
|
label="年份",
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = GroupBusinessTarget
|
model = GroupBusinessTarget
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
widgets = {
|
widgets = {
|
||||||
'year': forms.NumberInput(attrs={'class': 'form-control'}),
|
|
||||||
'project_nature': forms.Select(attrs={'class': 'form-control'}),
|
'project_nature': forms.Select(attrs={'class': 'form-control'}),
|
||||||
'sales': forms.NumberInput(attrs={'class': 'form-control'}),
|
'sales': forms.NumberInput(attrs={'class': 'form-control'}),
|
||||||
'total_revenue_target': forms.NumberInput(attrs={'class': 'form-control'}),
|
'total_revenue_target': forms.NumberInput(attrs={'class': 'form-control'}),
|
||||||
|
@ -44,12 +53,17 @@ class GroupBusinessTargetForm(forms.ModelForm):
|
||||||
|
|
||||||
|
|
||||||
class EmployeePerformanceTargetForm(forms.ModelForm):
|
class EmployeePerformanceTargetForm(forms.ModelForm):
|
||||||
|
department = forms.ChoiceField(
|
||||||
|
choices=[('', '---------')] + [(dept.department_name, dept.department_name) for dept in PrimaryDepartment.objects.all()],
|
||||||
|
widget=forms.Select(attrs={'class': 'form-control'}),
|
||||||
|
label="一级部门"
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = EmployeePerformanceTarget
|
model = EmployeePerformanceTarget
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
widgets = {
|
widgets = {
|
||||||
'name': forms.TextInput(attrs={'class': 'form-control'}),
|
'name': forms.TextInput(attrs={'class': 'form-control'}),
|
||||||
'department': forms.Select(attrs={'class': 'form-control'}),
|
|
||||||
'year': forms.NumberInput(attrs={'class': 'form-control'}),
|
'year': forms.NumberInput(attrs={'class': 'form-control'}),
|
||||||
'project_nature': forms.Select(attrs={'class': 'form-control'}),
|
'project_nature': forms.Select(attrs={'class': 'form-control'}),
|
||||||
'sales_target': forms.NumberInput(attrs={'class': 'form-control'}),
|
'sales_target': forms.NumberInput(attrs={'class': 'form-control'}),
|
||||||
|
@ -57,3 +71,6 @@ class EmployeePerformanceTargetForm(forms.ModelForm):
|
||||||
'new_revenue_target': forms.NumberInput(attrs={'class': 'form-control'}),
|
'new_revenue_target': forms.NumberInput(attrs={'class': 'form-control'}),
|
||||||
'existing_revenue_target': forms.NumberInput(attrs={'class': 'form-control'}),
|
'existing_revenue_target': forms.NumberInput(attrs={'class': 'form-control'}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(EmployeePerformanceTargetForm, self).__init__(*args, **kwargs)
|
||||||
|
|
|
@ -16,14 +16,14 @@ class GroupBusinessTarget(models.Model):
|
||||||
primary_department = models.CharField(max_length=255, verbose_name='一级部门')
|
primary_department = models.CharField(max_length=255, verbose_name='一级部门')
|
||||||
year = models.IntegerField(verbose_name='年份')
|
year = models.IntegerField(verbose_name='年份')
|
||||||
project_nature = models.CharField(max_length=255, choices=PROJECT_NATURE_CHOICES, verbose_name='项目性质')
|
project_nature = models.CharField(max_length=255, choices=PROJECT_NATURE_CHOICES, verbose_name='项目性质')
|
||||||
sales = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='销售额(元)')
|
sales = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='销售额(元)', null=True, blank=True)
|
||||||
total_revenue_target = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='收入总目标(元)')
|
total_revenue_target = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='收入总目标(元)', null=True, blank=True)
|
||||||
new_revenue_target = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='新增收入目标(元)')
|
new_revenue_target = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='新增收入目标(元)', null=True, blank=True)
|
||||||
existing_revenue_target = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='存量收入目标(元)')
|
existing_revenue_target = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='存量收入目标(元)', null=True, blank=True)
|
||||||
cost_limit = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='成本限额(元)')
|
cost_limit = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='成本限额(元)', null=True, blank=True)
|
||||||
gross_profit = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='毛利润(元)')
|
gross_profit = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='毛利润(元)', null=True, blank=True)
|
||||||
expense_limit = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='费用限额(元)')
|
expense_limit = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='费用限额(元)', null=True, blank=True)
|
||||||
operating_profit = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='营业利润(元)')
|
operating_profit = models.DecimalField(max_digits=15, decimal_places=2, verbose_name='营业利润(元)', null=True, blank=True)
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
primary_department_name = PrimaryDepartment.objects.filter(department_name=self.primary_department).first()
|
primary_department_name = PrimaryDepartment.objects.filter(department_name=self.primary_department).first()
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
{% for field in item|get_fields:table_exclude_field_name %}
|
{% for field in item|get_fields:table_exclude_field_name %}
|
||||||
{% if '(元)' in field.verbose_name %}
|
{% if '(元)' in field.verbose_name %}
|
||||||
<td class="text-center">{{ field.value|thousands_separator }}</td>
|
<td class="text-center">{{ field.value|default_if_none:'-'|thousands_separator }}</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td class="text-center">{{ field.value|default_if_none:'-' }}</td>
|
<td class="text-center">{{ field.value|default_if_none:'-' }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue