This commit is contained in:
18631081161 2026-01-16 14:26:43 +08:00
parent 61f89dfda6
commit 286e598f0d
3 changed files with 34 additions and 2 deletions

View File

@ -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();

View File

@ -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">

View File

@ -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
}