commit
1.完成视图数据页面和base.html权限校验 2. 修复账号权限表与用户权限表权限设置后翻页未记录选择框状态 3. 项目回款记录table不显示开票记录字段 4. 公司主体信息登记表-银行账户新增账户状态 5. 人员基本信息表-添加数据根据生日自动算出年龄 6. 处理了一些页面不需要显示筛选和编辑和ID的问题
This commit is contained in:
parent
677f3079cf
commit
dc9bb836d5
|
@ -210,6 +210,20 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
$('#pageInfo').text('第 ' + currentPage + ' 页, 共 ' + Math.ceil(permissionsData.length / itemsPerPage) + ' 页');
|
||||
|
||||
// 更新复选框的状态
|
||||
updateCheckboxStates();
|
||||
}
|
||||
|
||||
// 用户权限-更新复选框的状态
|
||||
function updateCheckboxStates() {
|
||||
$('#permissionsTable input[type="checkbox"]').each(function() {
|
||||
const permId = $(this).data('id');
|
||||
const permType = $(this).attr('name');
|
||||
if (modifiedPermissions[permId] && modifiedPermissions[permId][permType] !== undefined) {
|
||||
$(this).prop('checked', modifiedPermissions[permId][permType]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 渲染分页
|
||||
|
@ -307,6 +321,14 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#userPermissionModal').on('hidden.bs.modal', function () {
|
||||
permissionsData = [];
|
||||
modifiedPermissions = {};
|
||||
$('#permissionsTable tbody').empty();
|
||||
$('#u-totalData').text('');
|
||||
$('#u-pageInfo').text('');
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('createGroupButton').addEventListener('click', function() {
|
||||
|
|
|
@ -377,6 +377,21 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
$('#u-pageInfo').text('第 ' + currentPage + ' 页, 共 ' + Math.ceil(permissionsData.length / itemsPerPage) + ' 页');
|
||||
|
||||
// 更新复选框的状态
|
||||
updateCheckboxStates();
|
||||
}
|
||||
|
||||
|
||||
// 用户权限-更新复选框的状态
|
||||
function updateCheckboxStates() {
|
||||
$('#permissionsTable input[type="checkbox"]').each(function() {
|
||||
const permId = $(this).data('id');
|
||||
const permType = $(this).attr('name');
|
||||
if (modifiedPermissions[permId] && modifiedPermissions[permId][permType] !== undefined) {
|
||||
$(this).prop('checked', modifiedPermissions[permId][permType]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 用户权限-渲染分页
|
||||
|
@ -507,6 +522,14 @@ $(document).ready(function() {
|
|||
});
|
||||
});
|
||||
|
||||
$('#userPermissionModal').on('hidden.bs.modal', function () {
|
||||
permissionsData = [];
|
||||
modifiedPermissions = {};
|
||||
$('#permissionsTable tbody').empty();
|
||||
$('#u-totalData').text('');
|
||||
$('#u-pageInfo').text('');
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -0,0 +1,235 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load static tags %}
|
||||
|
||||
{% block content %}
|
||||
<section class="pcoded-main-container">
|
||||
<div class="pcoded-wrapper">
|
||||
<div class="pcoded-content">
|
||||
<div class="pcoded-inner-content">
|
||||
<div class="main-body">
|
||||
<div class="page-wrapper">
|
||||
{% include 'breadcrumb.html' %}
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
</div>
|
||||
<div class="col-md-4 mt-4 text-end">
|
||||
{% render_button 'modify_records_button' %}
|
||||
{% render_button 'add_button' %}
|
||||
{% render_button 'report_excel_button' %}
|
||||
{% render_button 'import_excel_button' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-12">
|
||||
<div class="card">
|
||||
<div class="card-body table-border-style">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
{% get_verbose_field_names_from_model model_config table_exclude_field_name as columns %}
|
||||
<thead>
|
||||
<tr>
|
||||
{% for column in columns %}
|
||||
<th class="text-center">{{ column }}</th>
|
||||
{% endfor %}
|
||||
<th class="text-center">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="result" style="color: white;">
|
||||
{% for item in items %}
|
||||
<tr>
|
||||
{% for field in item|get_fields:table_exclude_field_name %}
|
||||
<td class="text-center">{{ field.value }}</td>
|
||||
{% endfor %}
|
||||
<td class="text-center">
|
||||
<a href="#"
|
||||
id="deleteBtn"
|
||||
class="edit-btn"
|
||||
style="color: red"
|
||||
data-id="{{ item|get_pk_value }}"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#deleteModal">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td class="text-center"
|
||||
colspan="{{ table_columns|length }}">暂无数据
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'pagination_ps.html' with page_obj=items query_params=query_params %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<div id="addEditModal" class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog"
|
||||
aria-labelledby="formModalCenterTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-xl" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="formModalTitle">{{ form_title }}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="deleteModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="deleteModalLabel">提示</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<p>此操作会删除当前数据,是否继续?</p>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-danger" id="confirmDeleteBtn">删除</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include 'modify_record_modal.html' with modify_records_url=modify_records_url %}
|
||||
{% include 'upload_excel_modal.html' with excel_upload_config=excel_upload_config %}
|
||||
|
||||
<script>
|
||||
const add_url = "{{ add_url }}";
|
||||
const modify_url = "{{ modify_url }}";
|
||||
const deleteUrl = "{{ delete_url }}";
|
||||
let targetIdToDelete = null;
|
||||
|
||||
$(document).ready(function () {
|
||||
// 处理添加按钮点击事件
|
||||
$('#addItemBtn').click(function () {
|
||||
$.ajax({
|
||||
url: add_url,
|
||||
type: 'get',
|
||||
success: function (response) {
|
||||
// 将新的表单 HTML 插入到模态框中
|
||||
$('#addEditModal .modal-body').html(response.form_html);
|
||||
// 动态设置模态框标题
|
||||
$('#formModalTitle').text('新增');
|
||||
// 动态设置表单提交URL
|
||||
$('#addEditForm').attr('action', add_url);
|
||||
// 显示模态框
|
||||
$('#addEditModal').modal('show');
|
||||
|
||||
// 绑定表单提交事件
|
||||
bindFormSubmit();
|
||||
},
|
||||
error: function () {
|
||||
$('#addEditModal').modal('hide');
|
||||
showAlert('danger', '获取表单请求出错');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 处理编辑按钮点击事件
|
||||
$('#editBtn').click(function () {
|
||||
var itemId = $(this).data('id');
|
||||
$.ajax({
|
||||
url: modify_url,
|
||||
type: 'get',
|
||||
data: {id: itemId},
|
||||
success: function (response) {
|
||||
// 将表单 HTML 插入到模态框中
|
||||
$('#addEditModal .modal-body').html(response.form_html);
|
||||
$('#formModalTitle').text('编辑');
|
||||
// 动态设置表单提交URL
|
||||
$('#addEditForm').attr('action', modify_url);
|
||||
// 显示模态框
|
||||
$('#addEditModal').modal('show');
|
||||
|
||||
// 绑定表单提交事件
|
||||
bindFormSubmit();
|
||||
},
|
||||
error: function () {
|
||||
$('#addEditModal').modal('hide');
|
||||
showAlert('danger', '获取表单请求出错');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 保存
|
||||
function bindFormSubmit() {
|
||||
$('#addEditForm').submit(function (e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: $(this).attr('action'), // 动态获取URL
|
||||
type: 'post', // 使用 POST 请求来提交表单
|
||||
data: $(this).serialize(),
|
||||
success: function (response) {
|
||||
// 关闭模态框并显示成功消息
|
||||
$('#addEditModal').modal('hide');
|
||||
showAlert('success', response.message);
|
||||
location.reload();
|
||||
},
|
||||
error: function (xhr) {
|
||||
// 处理表单错误并显示错误消息
|
||||
var response = xhr.responseJSON;
|
||||
$('#addEditModal .modal-body').html(response.form_html);
|
||||
bindFormSubmit();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 删除和确认删除
|
||||
$(document).on('click', '#deleteBtn, #confirmDeleteBtn', function (event) {
|
||||
if (event.target.id === 'deleteBtn') {
|
||||
// 打开删除模态框
|
||||
targetIdToDelete = $(this).data('id');
|
||||
$('#deleteModal').modal('show');
|
||||
} else if (event.target.id === 'confirmDeleteBtn') {
|
||||
// 确认删除
|
||||
if (targetIdToDelete !== null) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: deleteUrl,
|
||||
data: {
|
||||
'id': targetIdToDelete
|
||||
},
|
||||
success: function (response) {
|
||||
showAlert('success', "删除成功");
|
||||
location.reload();
|
||||
},
|
||||
error: function (response) {
|
||||
showAlert('danger', "删除失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#deleteModal').modal('hide');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -44,10 +44,7 @@ def exp_type_list_view(request):
|
|||
{"title": "财会管理", "name": "index"},
|
||||
{"title": "费用类型", "name": "exp_type_list"}
|
||||
],
|
||||
"filters": [
|
||||
{"type": "select", "id": "expense_type", "name": "expense_type", "label": "费用类型",
|
||||
"options": [{"value": "差旅费", "display": "差旅费"}, {"value": "办公费", "display": "办公费"}]}
|
||||
],
|
||||
"filters": [],
|
||||
"table_exclude_field_name": ['type_id'],
|
||||
"excel_upload_config": {
|
||||
"template_url": reverse("download_template", kwargs={'template_name': template_name}),
|
||||
|
@ -65,7 +62,7 @@ def exp_type_list_view(request):
|
|||
"add_button": True,
|
||||
"import_excel_button": True
|
||||
}
|
||||
return render(request, 'items_list.html', context)
|
||||
return render(request, 'exp_list.html', context)
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -168,7 +165,7 @@ def exp_detail_list_view(request):
|
|||
"add_button": True,
|
||||
"import_excel_button": True
|
||||
}
|
||||
return render(request, 'items_list.html', context)
|
||||
return render(request, 'exp_list.html', context)
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -1252,7 +1249,7 @@ def rep_rec_list_view(request):
|
|||
"repayment_amount": {"type": "number", "width": "100px"},
|
||||
}
|
||||
},
|
||||
"table_exclude_field_name": ['record_id'],
|
||||
"table_exclude_field_name": ['record_id', 'invoice'],
|
||||
"query_params": query_params,
|
||||
"form_action_url": 'rep_rec_list',
|
||||
"modify_url": reverse("rep_rec_list_modify"),
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
{% for column in columns %}
|
||||
{% if column|is_in_list:"离职类型,离职原因,离职时间" %}
|
||||
{% if column|is_in_list:"离职类型,离职原因,离职日期" %}
|
||||
{# Skip these columns #}
|
||||
{% else %}
|
||||
<th class="text-center">{{ column }}</th>
|
||||
|
@ -116,12 +116,12 @@
|
|||
<span style="color: red; cursor: pointer"
|
||||
onclick="showResignationModal('{{ item.resignation_type }}', '{{ item.resignation_reason }}', '{{ item.resignation_date }}')">离职</span>
|
||||
</td>
|
||||
{% elif field.verbose_name == '基础工资' %}
|
||||
{% elif field.verbose_name == '基础工资(元)' %}
|
||||
<td class="text-center">
|
||||
<span style="color: blueviolet; cursor: pointer"
|
||||
onclick="showSalaryModal('{{ item.employee_id }}')">{{ item.base_salary }}</span>
|
||||
</td>
|
||||
{% elif field.verbose_name|is_in_list:"离职类型,离职原因,离职时间" %}
|
||||
{% elif field.verbose_name|is_in_list:"离职类型,离职原因,离职日期" %}
|
||||
{# Skip these columns #}
|
||||
{% else %}
|
||||
<td class="text-center">{{ field.value }}</td>
|
||||
|
@ -246,6 +246,18 @@
|
|||
const add_url = "{{ add_url }}";
|
||||
const modify_url = "{{ modify_url }}";
|
||||
|
||||
function calculateAge(birthday) {
|
||||
var birthDate = new Date(birthday);
|
||||
var today = new Date();
|
||||
var age = today.getFullYear() - birthDate.getFullYear();
|
||||
var m = today.getMonth() - birthDate.getMonth();
|
||||
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
|
||||
age--;
|
||||
}
|
||||
return age;
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
// 处理添加按钮点击事件
|
||||
$('#addItemBtn').click(function () {
|
||||
|
@ -318,6 +330,16 @@
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('change', '#id_birthday', function () {
|
||||
var birthday = $(this).val();
|
||||
if (birthday) {
|
||||
var age = calculateAge(birthday);
|
||||
$('#id_age').val(age);
|
||||
} else {
|
||||
$('#id_age').val('');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function showResignationModal(resignation_type, resignation_reason, resignation_date) {
|
||||
|
@ -374,7 +396,6 @@
|
|||
.catch(error => console.error('Error fetching salary change records:', error));
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -177,7 +177,7 @@ def emp_list_modify(request):
|
|||
if 'id' in request.POST:
|
||||
instance = EmployeeInformation.objects.get(employee_id=request.POST['id'])
|
||||
current_base_salary = instance.base_salary # 获取当前基本工资
|
||||
form = EmployeeInformationForm(request.POST, instance=instance)
|
||||
form = EmployeeInformationEditForm(request.POST, instance=instance)
|
||||
else:
|
||||
form = EmployeeInformationEditForm(request.POST)
|
||||
|
||||
|
@ -195,6 +195,11 @@ def emp_list_modify(request):
|
|||
approved_by=request.user.username
|
||||
)
|
||||
|
||||
employee.resignation_type = form.cleaned_data.get('resignation_type')
|
||||
employee.resignation_date = form.cleaned_data.get('resignation_date')
|
||||
employee.resignation_description = form.cleaned_data.get('resignation_description')
|
||||
employee.save()
|
||||
|
||||
return JsonResponse({"message": "保存成功"})
|
||||
else:
|
||||
form_html = render_to_string('form_partial.html', {'form': form}, request)
|
||||
|
|
|
@ -72,19 +72,30 @@ class CompanyBankAccount(models.Model):
|
|||
('一般户', '一般户'),
|
||||
)
|
||||
|
||||
ACCOUNT_STATUS_CHOICES = (
|
||||
('活跃', '活跃'),
|
||||
('不活跃', '不活跃'),
|
||||
('已关闭', '已关闭'),
|
||||
('暂停', '暂停'),
|
||||
('待处理', '待处理'),
|
||||
('冻结', '冻结'),
|
||||
)
|
||||
|
||||
account_id = models.AutoField(primary_key=True, verbose_name='账户ID')
|
||||
company_entity = models.ForeignKey(CompanyEntity, on_delete=models.CASCADE, related_name='bank_accounts',
|
||||
verbose_name='公司ID', default=1)
|
||||
bank_name = models.CharField(max_length=255, verbose_name='开户行名称')
|
||||
account_number = models.CharField(max_length=255, verbose_name='账号')
|
||||
account_type = models.CharField(max_length=10, choices=ACCOUNT_TYPE_CHOICES, verbose_name='账户类型')
|
||||
account_status = models.CharField(max_length=10, choices=ACCOUNT_STATUS_CHOICES, verbose_name='账户状态',
|
||||
default='active')
|
||||
|
||||
class Meta:
|
||||
verbose_name = '公司银行账户'
|
||||
verbose_name_plural = '公司银行账户表'
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.bank_name} - {self.account_number}"
|
||||
return f"{self.company_entity.company_name} - {self.bank_name} - {self.account_number}"
|
||||
|
||||
|
||||
class PrimaryDepartment(models.Model):
|
||||
|
|
|
@ -242,6 +242,7 @@
|
|||
<th class="text-center">开户行名称</th>
|
||||
<th class="text-center">账号</th>
|
||||
<th class="text-center">账户类型</th>
|
||||
<th class="text-center">账户状态</th>
|
||||
<th class="text-center">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -286,6 +287,17 @@
|
|||
<option value="一般户">一般户</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="addAccountStatus" class="form-label">账户状态</label>
|
||||
<select class="form-control" id="addAccountStatus" required>
|
||||
<option value="活跃">活跃</option>
|
||||
<option value="不活跃">不活跃</option>
|
||||
<option value="已关闭">已关闭</option>
|
||||
<option value="暂停">暂停</option>
|
||||
<option value="待处理">待处理</option>
|
||||
<option value="冻结">冻结</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<button type="submit" class="btn btn-primary" onclick="addBankAccount()">保存</button>
|
||||
</div>
|
||||
|
@ -340,6 +352,17 @@
|
|||
<option value="一般户">一般户</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="editAccountStatus" class="form-label">账户状态</label>
|
||||
<select class="form-control" id="editAccountStatus" required>
|
||||
<option value="活跃">活跃</option>
|
||||
<option value="不活跃">不活跃</option>
|
||||
<option value="已关闭">已关闭</option>
|
||||
<option value="暂停">暂停</option>
|
||||
<option value="待处理">待处理</option>
|
||||
<option value="冻结">冻结</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<button type="button" class="btn btn-primary" onclick="submitEditBankAccount()">保存
|
||||
</button>
|
||||
|
@ -535,6 +558,7 @@
|
|||
row.appendChild(createCell(account.bank_name));
|
||||
row.appendChild(createCell(account.account_number));
|
||||
row.appendChild(createCell(account.account_type));
|
||||
row.appendChild(createCell(account.account_status));
|
||||
|
||||
const actionsCell = document.createElement('td');
|
||||
actionsCell.className = 'text-center';
|
||||
|
@ -612,7 +636,8 @@
|
|||
const data = {
|
||||
bank_name: document.getElementById('addBankName').value,
|
||||
account_number: document.getElementById('addAccountNumber').value,
|
||||
account_type: document.getElementById('addAccountType').value
|
||||
account_type: document.getElementById('addAccountType').value,
|
||||
account_status: document.getElementById('addAccountStatus').value
|
||||
};
|
||||
|
||||
fetch(`/basic_data/om/entities/${entityId}/bank_accounts/add/`, {
|
||||
|
@ -648,7 +673,6 @@
|
|||
fetch(`/basic_data/om/bank_account/${accountId}/`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
debugger;
|
||||
document.getElementById('editBankName').value = data.bank_name;
|
||||
document.getElementById('editAccountNumber').value = data.account_number;
|
||||
document.getElementById('editAccountType').value = data.account_type;
|
||||
|
@ -663,6 +687,7 @@
|
|||
const bankName = document.getElementById('editBankName').value;
|
||||
const accountNumber = document.getElementById('editAccountNumber').value;
|
||||
const accountType = document.getElementById('editAccountType').value;
|
||||
const accountStatus= document.getElementById('editAccountStatus').value;
|
||||
|
||||
fetch(`/basic_data/om/bank_accounts/${accountIdToEdit}/update/`, {
|
||||
method: 'PUT',
|
||||
|
@ -673,7 +698,8 @@
|
|||
body: JSON.stringify({
|
||||
bank_name: bankName,
|
||||
account_number: accountNumber,
|
||||
account_type: accountType
|
||||
account_type: accountType,
|
||||
account_status: accountStatus,
|
||||
})
|
||||
})
|
||||
.then(response => {
|
||||
|
@ -738,7 +764,7 @@
|
|||
}
|
||||
|
||||
</script>
|
||||
<script>
|
||||
<script>
|
||||
const add_url = "{{ add_url }}";
|
||||
const modify_url = "{{ modify_url }}";
|
||||
let Commission_id = '';
|
||||
|
|
|
@ -10,6 +10,7 @@ from django.http import JsonResponse, Http404
|
|||
from django.shortcuts import render, get_object_or_404
|
||||
from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
from django.utils.timezone import now
|
||||
from django.views.decorators.csrf import csrf_protect
|
||||
from openpyxl import load_workbook
|
||||
from rest_framework import status
|
||||
|
@ -28,7 +29,7 @@ from application.org_mgnt.models import (
|
|||
PrimaryDepartment,
|
||||
SecondaryDepartment,
|
||||
CompanyEntity,
|
||||
CompanyBankAccount
|
||||
CompanyBankAccount, EntityChangeRecord
|
||||
)
|
||||
from application.org_mgnt.serializers import (
|
||||
EntityChangeRecordSerializer,
|
||||
|
@ -150,7 +151,6 @@ def eir_list_add(request):
|
|||
return JsonResponse({"message": "无效的请求方法"}, status=405)
|
||||
|
||||
|
||||
@custom_permission_required('org_mgnt.change_companyentity')
|
||||
def eir_list_modify(request):
|
||||
if request.method == 'POST':
|
||||
if 'id' in request.POST:
|
||||
|
@ -160,6 +160,30 @@ def eir_list_modify(request):
|
|||
form = CompanyEntityForm(request.POST)
|
||||
|
||||
if form.is_valid():
|
||||
if 'id' in request.POST:
|
||||
original_instance = CompanyEntity.objects.get(entity_id=request.POST['id'])
|
||||
original_data = {field.name: getattr(original_instance, field.name) for field in
|
||||
original_instance._meta.fields}
|
||||
|
||||
updated_instance = form.save(commit=False)
|
||||
updated_data = {field.name: getattr(updated_instance, field.name) for field in
|
||||
updated_instance._meta.fields}
|
||||
|
||||
if 'id' in request.POST:
|
||||
changes = {field: (original_data[field], updated_data[field]) for field in original_data if
|
||||
original_data[field] != updated_data[field]}
|
||||
|
||||
for field, (original_value, updated_value) in changes.items():
|
||||
EntityChangeRecord.objects.create(
|
||||
company_entity=instance,
|
||||
change_date=now(),
|
||||
change_type=f"修改 {field}",
|
||||
content_before_change=str(original_value),
|
||||
content_after_change=str(updated_value),
|
||||
change_reason=request.POST.get('change_reason', '未提供变更原因'),
|
||||
change_executed_by=request.user.username
|
||||
)
|
||||
|
||||
form.save()
|
||||
return JsonResponse({"message": "保存成功"})
|
||||
else:
|
||||
|
|
|
@ -444,7 +444,6 @@
|
|||
res = 1 - (parseFloat(cost) / parseFloat(revenue));
|
||||
|
||||
data.invoices.forEach(invoice => {
|
||||
debugger
|
||||
res_num = parseFloat(invoice.total_amount) * res
|
||||
const row = document.createElement('tr');
|
||||
row.innerHTML = `
|
||||
|
@ -475,7 +474,6 @@
|
|||
// 计算净收入比例
|
||||
res = 1 - (parseFloat(cost) / parseFloat(revenue));
|
||||
data.repayments.forEach(repayment => {
|
||||
debugger
|
||||
const res_num = parseFloat(repayment.repayment_amount) * res;
|
||||
const row = document.createElement('tr');
|
||||
row.innerHTML = `
|
||||
|
|
|
@ -145,61 +145,102 @@
|
|||
<li><a href="{% url 'user_homepage' %}">用户中心</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% if request.user|is_in_group:"董事会、总经办" %}
|
||||
{% if request.user|has_module_permission:"exec_tbl" %}
|
||||
<li data-username="" class="nav-item pcoded-hasmenu">
|
||||
<a href="#" class="nav-link"><span class="pcoded-micon">
|
||||
<i class="feather icon-home"></i></span><span class="pcoded-mtext">董事会、总经办</span></a>
|
||||
<ul class="pcoded-submenu">
|
||||
<li><a href="{% url 'financial_data_list' %}">整体经营情况表</a></li>
|
||||
<li><a href="{% url 'monthly_financial_data_list' %}">整体收入情况</a></li>
|
||||
<li><a href="{% url 'receivables_data_list' %}">应收账款情况</a></li>
|
||||
<li><a href="{% url 'receivables_detail_list' %}">应收账款明细</a></li>
|
||||
<li><a href="{% url 'employee_status_list' %}">人员情况</a></li>
|
||||
<li><a href="{% url 'employee_performance_list' %}">员工业绩及提成情况</a></li>
|
||||
<li><a href="{% url 'employee_attendance_list' %}">员工出勤情况</a></li>
|
||||
<li><a href="{% url 'project_ledger_list' %}">项目台账</a></li>
|
||||
{% if request.user|has_view_permission:"view_financialdata" %}
|
||||
<li><a href="{% url 'financial_data_list' %}">整体经营情况表</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_monthlyfinancialdata" %}
|
||||
<li><a href="{% url 'monthly_financial_data_list' %}">整体收入情况</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_receivablesdata" %}
|
||||
<li><a href="{% url 'receivables_data_list' %}">应收账款情况</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_receivablesdetail" %}
|
||||
<li><a href="{% url 'receivables_detail_list' %}">应收账款明细</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_employeestatus" %}
|
||||
<li><a href="{% url 'employee_status_list' %}">人员情况</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_employeeperformance" %}
|
||||
<li><a href="{% url 'employee_performance_list' %}">员工业绩及提成情况</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_employeeattendance" %}
|
||||
<li><a href="{% url 'employee_attendance_list' %}">员工出勤情况</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_projectledger" %}
|
||||
<li><a href="{% url 'project_ledger_list' %}">项目台账</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if request.user|is_in_group:"业务部门" %}
|
||||
{% if request.user|has_module_permission:"busi_tbl" %}
|
||||
<li data-username="" class="nav-item pcoded-hasmenu">
|
||||
<a href="#" class="nav-link"><span class="pcoded-micon"><i
|
||||
class="feather icon-home"></i></span><span class="pcoded-mtext">业务部门</span></a>
|
||||
<ul class="pcoded-submenu">
|
||||
<li><a href="{% url 'department_annual_performance_list' %}">年度总体经营指标</a></li>
|
||||
<li><a href="{% url 'department_monthly_income_list' %}">收入情况</a></li>
|
||||
<li><a href="{% url 'department_monthly_cost_list' %}">成本情况</a></li>
|
||||
<li><a href="{% url 'department_monthly_profit_list' %}">利润情况</a></li>
|
||||
<li><a href="{% url 'department_project_progress_list' %}">项目进度</a></li>
|
||||
<li><a href="{% url 'department_project_settlement_list' %}">项目结算情况</a></li>
|
||||
<li><a href="{% url 'department_project_payment_list' %}">项目回款情况</a></li>
|
||||
<li><a href="{% url 'department_revenue_structure_list' %}">收入结构</a></li>
|
||||
<li><a href="{% url 'department_profit_structure_list' %}">利润结构</a></li>
|
||||
<li>
|
||||
<a href="{% url 'department_project_manager_income_commission_list' %}">项目经理收入完成及提成情况</a>
|
||||
</li>
|
||||
<li><a href="{% url 'department_attendance_list' %}">出勤情况</a></li>
|
||||
{% if request.user|has_view_permission:"view_departmentannualperformance" %}
|
||||
<li><a href="{% url 'department_annual_performance_list' %}">年度总体经营指标</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_departmentmonthlyincome" %}
|
||||
<li><a href="{% url 'department_monthly_income_list' %}">收入情况</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_departmentmonthlycost" %}
|
||||
<li><a href="{% url 'department_monthly_cost_list' %}">成本情况</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_departmentmonthlyprofit" %}
|
||||
<li><a href="{% url 'department_monthly_profit_list' %}">利润情况</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_departmentprojectprogress" %}
|
||||
<li><a href="{% url 'department_project_progress_list' %}">项目进度</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_departmentprojectsettlement" %}
|
||||
<li><a href="{% url 'department_project_settlement_list' %}">项目结算情况</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_departmentprojectpayment" %}
|
||||
<li><a href="{% url 'department_project_payment_list' %}">项目回款情况</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_departmentrevenuestructure" %}
|
||||
<li><a href="{% url 'department_revenue_structure_list' %}">收入结构</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_departmentprofitstructure" %}
|
||||
<li><a href="{% url 'department_profit_structure_list' %}">利润结构</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_departmentprojectmanagerincomecommission" %}
|
||||
<li><a href="{% url 'department_project_manager_income_commission_list' %}">项目经理收入完成及提成情况</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_departmentattendance" %}
|
||||
<li><a href="{% url 'department_attendance_list' %}">出勤情况</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if request.user|is_in_group:"中后台" %}
|
||||
{% if request.user|has_module_permission:"ops_tbl" %}
|
||||
<li data-username="" class="nav-item pcoded-hasmenu">
|
||||
<a href="#" class="nav-link"><span class="pcoded-micon"><i
|
||||
class="feather icon-home"></i></span><span class="pcoded-mtext">中后台</span></a>
|
||||
<ul class="pcoded-submenu">
|
||||
<li><a href="{% url 'department_expense_data_list' %}">各部门费用情况</a></li>
|
||||
{% if request.user|has_view_permission:"view_departmentexpensedata" %}
|
||||
<li><a href="{% url 'department_expense_data_list' %}">各部门费用情况</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if request.user|is_in_group:"财务部" %}
|
||||
{% if request.user|has_module_permission:"fin_tbl" %}
|
||||
<li data-username="" class="nav-item pcoded-hasmenu">
|
||||
<a href="#" class="nav-link"><span class="pcoded-micon"><i
|
||||
class="feather icon-home"></i></span><span class="pcoded-mtext">财务部</span></a>
|
||||
<a href="#" class="nav-link"><span class="pcoded-micon">
|
||||
<i class="feather icon-home"></i></span><span class="pcoded-mtext">财务部</span></a>
|
||||
<ul class="pcoded-submenu">
|
||||
<li><a href="{% url 'department_operational_data_list' %}">各一级部门经营情况</a></li>
|
||||
{% if request.user|has_view_permission:"view_departmentoperationaldata" %}
|
||||
<li><a href="{% url 'department_operational_data_list' %}">各一级部门经营情况</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
@ -308,6 +349,9 @@
|
|||
{% if request.user|has_view_permission:"view_repaymentrecord" %}
|
||||
<li><a href="{% url 'rep_rec_list' %}">回款记录表</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_employeecommission" %}
|
||||
<li><a href="{% url 'emp_comm_list' %}">员工提成情况表</a></li>
|
||||
{% endif %}
|
||||
{% if request.user|has_view_permission:"view_projectcommission" %}
|
||||
<li><a href="{% url 'project_commission_list' %}">项目提成情况表</a></li>
|
||||
{% endif %}
|
||||
|
|
|
@ -61,9 +61,11 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if filters %}
|
||||
<div class="col mt-4 d-flex align-items-center">
|
||||
<button type="submit" class="btn btn-primary">查询</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -112,4 +112,5 @@
|
|||
var page = $(this).data('page');
|
||||
fetchAuditRecords(page);
|
||||
});
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue