修改
This commit is contained in:
parent
61f89dfda6
commit
286e598f0d
|
|
@ -195,6 +195,30 @@ public class OrganizationsController : BaseApiController
|
|||
return NotFound(new { message = "账户不存在" });
|
||||
}
|
||||
|
||||
// 检查是否有关联的上报记录
|
||||
var hasConsumptionReports = await _context.ConsumptionReports
|
||||
.AnyAsync(r => r.ReportedByUserId == accountId);
|
||||
if (hasConsumptionReports)
|
||||
{
|
||||
return BadRequest(new { message = "该账户有上报记录,无法删除" });
|
||||
}
|
||||
|
||||
// 检查是否有关联的配额分配上报
|
||||
var hasDistributionReports = await _context.AllocationDistributions
|
||||
.AnyAsync(d => d.ReportedByUserId == accountId);
|
||||
if (hasDistributionReports)
|
||||
{
|
||||
return BadRequest(new { message = "该账户有配额上报记录,无法删除" });
|
||||
}
|
||||
|
||||
// 检查是否有关联的人员审批历史
|
||||
var hasApprovalHistory = await _context.PersonnelApprovalHistories
|
||||
.AnyAsync(h => h.ReviewedByUserId == accountId);
|
||||
if (hasApprovalHistory)
|
||||
{
|
||||
return BadRequest(new { message = "该账户有审批记录,无法删除" });
|
||||
}
|
||||
|
||||
_context.UserAccounts.Remove(account);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<div class="stat-value">{{ stats.allocations }}</div>
|
||||
<div class="stat-label">总配额数</div>
|
||||
<div class="stat-label">总配额条数</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
|
|
|
|||
|
|
@ -552,7 +552,15 @@ async function loadAllocations() {
|
|||
|
||||
async function handleViewDistribution(allocation: MaterialAllocation) {
|
||||
selectedAllocation.value = allocation
|
||||
distributions.value = allocation.distributions || []
|
||||
// 对于非师团级账号,只显示本单位及下级单位的分配记录
|
||||
if (authStore.canCreateAllocations) {
|
||||
// 师团级显示所有分配
|
||||
distributions.value = allocation.distributions || []
|
||||
} else {
|
||||
// 团部及以下只显示本单位的分配(不显示上级单位)
|
||||
const myUnitId = authStore.user?.organizationalUnitId
|
||||
distributions.value = (allocation.distributions || []).filter(d => d.targetUnitId === myUnitId)
|
||||
}
|
||||
showDistributionDialog.value = true
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user