统一后台列表页样式并调整站长菜单
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
@section('title', '任命管理')
|
||||
|
||||
@section('content')
|
||||
@php require resource_path('views/admin/partials/list-theme.php'); @endphp
|
||||
|
||||
<div x-data="{
|
||||
showForm: false,
|
||||
username: '',
|
||||
@@ -52,79 +54,86 @@
|
||||
}
|
||||
}">
|
||||
|
||||
<div class="{{ $adminListPageClass }}">
|
||||
{{-- 头部 --}}
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<div>
|
||||
<h2 class="text-lg font-bold text-gray-800">任命管理</h2>
|
||||
<p class="text-sm text-gray-500">管理当前所有在职职位人员,执行任命或撤销操作</p>
|
||||
</div>
|
||||
<div class="flex space-x-2">
|
||||
<div class="{{ $adminListHeaderCardClass }}">
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
|
||||
<div>
|
||||
<h2 class="{{ $adminListHeaderTitleClass }}">任命管理</h2>
|
||||
<p class="{{ $adminListHeaderSubtitleClass }}">管理当前所有在职职位人员,执行任命或撤销操作</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<a href="{{ route('admin.appointments.history') }}"
|
||||
style="background-color:#e5e7eb;color:#374151;padding:0.5rem 1rem;border-radius:0.5rem;font-weight:700;font-size:0.875rem;display:inline-flex;align-items:center;text-decoration:none;"
|
||||
onmouseover="this.style.backgroundColor='#d1d5db'" onmouseout="this.style.backgroundColor='#e5e7eb'">
|
||||
class="{{ $adminListSecondaryButtonClass }} inline-flex items-center justify-center">
|
||||
历史记录
|
||||
</a>
|
||||
<button @click="openAppoint()"
|
||||
style="background-color:#f97316;color:#fff;padding:0.5rem 1.25rem;border-radius:0.5rem;font-weight:700;border:none;cursor:pointer;box-shadow:0 1px 2px rgba(0,0,0,.1);"
|
||||
onmouseover="this.style.backgroundColor='#ea580c'" onmouseout="this.style.backgroundColor='#f97316'">
|
||||
class="inline-flex items-center justify-center rounded-lg bg-orange-500 px-4 py-2 text-sm font-semibold text-white shadow-sm transition hover:bg-orange-600">
|
||||
+ 新增任命
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 在职人员列表 --}}
|
||||
<div class="bg-white rounded-xl shadow-sm border overflow-hidden">
|
||||
<table class="w-full text-sm">
|
||||
<thead class="bg-gray-50 text-gray-600 text-xs">
|
||||
<tr>
|
||||
<th class="px-4 py-3 text-left">用户</th>
|
||||
<th class="px-4 py-3 text-left">部门·职务</th>
|
||||
<th class="px-4 py-3 text-center">等级</th>
|
||||
<th class="px-4 py-3 text-left">任命人</th>
|
||||
<th class="px-4 py-3 text-center">任命时间</th>
|
||||
<th class="px-4 py-3 text-center">在职天数</th>
|
||||
<th class="px-4 py-3 text-right">操作</th>
|
||||
<div class="{{ $adminListCardClass }}">
|
||||
<div class="{{ $adminListSectionHeadClass }}">
|
||||
<h3 class="{{ $adminListSectionTitleClass }}">在职人员列表</h3>
|
||||
<p class="{{ $adminListSectionDescClass }}">展示当前所有已任命且仍在职的人员,可直接查看履职日志或执行撤销。</p>
|
||||
</div>
|
||||
<div class="{{ $adminListTableWrapClass }}">
|
||||
<table class="{{ $adminListTableClass }} whitespace-nowrap">
|
||||
<thead>
|
||||
<tr class="{{ $adminListTableHeadRowClass }}">
|
||||
<th class="{{ $adminListTableHeadCellClass }}">用户</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }}">部门·职务</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-center">等级</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }}">任命人</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-center">任命时间</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-center">在职天数</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-right">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100">
|
||||
<tbody class="{{ $adminListTableBodyClass }}">
|
||||
@forelse ($activePositions as $up)
|
||||
<tr class="hover:bg-gray-50 transition">
|
||||
<tr class="{{ $adminListTableRowClass }}">
|
||||
<td class="px-4 py-3">
|
||||
<div class="font-bold text-gray-800">{{ $up->user->username }}</div>
|
||||
<div class="text-xs text-gray-400">Lv.{{ $up->user->user_level }}</div>
|
||||
<div class="{{ $adminListPrimaryTextClass }}">{{ $up->user->username }}</div>
|
||||
<div class="{{ $adminListSecondaryTextClass }}">Lv.{{ $up->user->user_level }}</div>
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
<div class="flex items-center space-x-1">
|
||||
<span class="text-lg">{{ $up->position->icon }}</span>
|
||||
<div>
|
||||
<div class="text-xs text-gray-400">{{ $up->position->department->name }}</div>
|
||||
<div class="font-bold" style="color: {{ $up->position->department->color }}">
|
||||
<div class="{{ $adminListSecondaryTextClass }}">{{ $up->position->department->name }}</div>
|
||||
<div class="text-sm font-semibold" style="color: {{ $up->position->department->color }}">
|
||||
{{ $up->position->name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center">
|
||||
<span class="text-xs bg-orange-100 text-orange-700 px-2 py-0.5 rounded font-mono">
|
||||
<span class="inline-flex items-center rounded-full bg-orange-100 px-2 py-0.5 text-xs font-mono font-semibold text-orange-700">
|
||||
Lv.{{ $up->position->level }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-gray-600">{{ $up->appointedBy?->username ?? '系统' }}</td>
|
||||
<td class="px-4 py-3 text-center text-gray-500">
|
||||
<td class="px-4 py-3 {{ $adminListBodyTextClass }}">{{ $up->appointedBy?->username ?? '系统' }}</td>
|
||||
<td class="px-4 py-3 text-center {{ $adminListSecondaryTextClass }}">
|
||||
{{ $up->appointed_at->format('Y-m-d') }}
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center">
|
||||
<span class="text-xs bg-blue-100 text-blue-700 px-2 py-0.5 rounded">
|
||||
<span class="inline-flex items-center rounded-full bg-blue-100 px-2 py-0.5 text-xs font-semibold text-blue-700">
|
||||
{{ $up->duration_days }} 天
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-right space-x-1">
|
||||
<td class="px-4 py-3 text-right">
|
||||
<div class="flex flex-wrap items-center justify-end gap-2">
|
||||
<a href="{{ route('admin.appointments.duty-logs', $up->id) }}"
|
||||
class="text-xs bg-blue-50 text-blue-600 font-bold px-2 py-1 rounded hover:bg-blue-600 hover:text-white transition">
|
||||
class="{{ $adminListActionButtonClass }} bg-blue-50 text-blue-600 hover:bg-blue-600 hover:text-white">
|
||||
登录日志
|
||||
</a>
|
||||
<a href="{{ route('admin.appointments.authority-logs', $up->id) }}"
|
||||
class="text-xs bg-purple-50 text-purple-600 font-bold px-2 py-1 rounded hover:bg-purple-600 hover:text-white transition">
|
||||
class="{{ $adminListActionButtonClass }} bg-purple-50 text-purple-600 hover:bg-purple-600 hover:text-white">
|
||||
操作日志
|
||||
</a>
|
||||
<form action="{{ route('admin.appointments.revoke', $up->id) }}" method="POST"
|
||||
@@ -132,53 +141,53 @@
|
||||
data-admin-confirm="确定撤销【{{ $up->user->username }}】的【{{ $up->position->name }}】职务?撤销后其等级将归 1。">
|
||||
@csrf @method('DELETE')
|
||||
<button type="submit"
|
||||
class="text-xs bg-red-50 text-red-600 font-bold px-2 py-1 rounded hover:bg-red-600 hover:text-white transition">
|
||||
class="{{ $adminListActionButtonClass }} bg-red-50 text-red-600 hover:bg-red-600 hover:text-white">
|
||||
撤销职务
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="7" class="px-4 py-12 text-center text-gray-400">暂无在职人员</td>
|
||||
<td colspan="7" class="{{ $adminListEmptyClass }}">暂无在职人员</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 新增任命弹窗 --}}
|
||||
<div x-show="showForm" style="display: none;"
|
||||
class="fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4">
|
||||
<div @click.away="showForm = false" class="bg-white rounded-xl shadow-2xl w-full max-w-md" x-transition>
|
||||
<div
|
||||
style="background-color:#c2410c;padding:1rem 1.5rem;display:flex;justify-content:space-between;align-items:center;border-radius:0.75rem 0.75rem 0 0;">
|
||||
<h3 style="font-weight:700;font-size:1.125rem;color:#fff;margin:0;">新增任命</h3>
|
||||
<div class="flex items-center justify-between rounded-t-xl border-b border-orange-800 bg-orange-700 px-6 py-4">
|
||||
<h3 class="text-lg font-bold text-white">新增任命</h3>
|
||||
<button @click="showForm = false"
|
||||
style="color:#fed7aa;background:none;border:none;font-size:1.5rem;cursor:pointer;line-height:1;"
|
||||
onmouseover="this.style.color='#fff'" onmouseout="this.style.color='#fed7aa'">×</button>
|
||||
class="text-2xl leading-none text-orange-200 transition hover:text-white">×</button>
|
||||
</div>
|
||||
<div class="p-6">
|
||||
<form action="{{ route('admin.appointments.store') }}" method="POST">
|
||||
@csrf
|
||||
<div class="space-y-4">
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-600 mb-1">用户名</label>
|
||||
<label class="{{ $adminListFilterLabelClass }}">用户名</label>
|
||||
<div class="relative">
|
||||
<input type="text" name="username" x-model="username" required
|
||||
placeholder="输入关键字搜索用户..." @input="doSearch($event.target.value)"
|
||||
@blur="setTimeout(() => showDropdown = false, 200)"
|
||||
@focus="if(username.length > 0) doSearch(username)"
|
||||
class="w-full border rounded-md p-2 text-sm" autocomplete="off">
|
||||
class="w-full {{ $adminListFilterInputClass }}" autocomplete="off">
|
||||
{{-- 搜索中指示 --}}
|
||||
<span x-show="searching"
|
||||
class="absolute right-2 top-2.5 text-gray-400 text-xs">搜索中…</span>
|
||||
{{-- 下拉结果 --}}
|
||||
<div x-show="showDropdown" style="display:none;"
|
||||
class="absolute z-50 w-full bg-white border rounded-md shadow-lg mt-1 max-h-48 overflow-y-auto">
|
||||
class="absolute z-50 mt-1 max-h-48 w-full overflow-y-auto rounded-lg border border-orange-100 bg-white shadow-lg">
|
||||
<template x-for="u in searchResults" :key="u.id">
|
||||
<div @mousedown="selectUser(u)"
|
||||
class="px-3 py-2 hover:bg-orange-50 cursor-pointer flex justify-between items-center">
|
||||
class="flex cursor-pointer items-center justify-between px-3 py-2 hover:bg-orange-50">
|
||||
<span class="font-bold text-sm" x-text="u.username"></span>
|
||||
<span class="text-xs text-gray-400" x-text="'Lv.' + u.user_level"></span>
|
||||
</div>
|
||||
@@ -189,9 +198,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-600 mb-1">目标职务</label>
|
||||
<label class="{{ $adminListFilterLabelClass }}">目标职务</label>
|
||||
<select name="position_id" x-model="position_id" required
|
||||
class="w-full border rounded-md p-2 text-sm">
|
||||
class="w-full {{ $adminListFilterInputClass }}">
|
||||
<option value="">-- 请选择职务 --</option>
|
||||
@foreach ($departments as $dept)
|
||||
<optgroup label="{{ $dept->name }}">
|
||||
@@ -215,21 +224,16 @@
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-600 mb-1">任命备注(可选)</label>
|
||||
<label class="{{ $adminListFilterLabelClass }}">任命备注(可选)</label>
|
||||
<input type="text" name="remark" x-model="remark" maxlength="255"
|
||||
placeholder="例:表现优秀,特此提拔" class="w-full border rounded-md p-2 text-sm">
|
||||
placeholder="例:表现优秀,特此提拔" class="w-full {{ $adminListFilterInputClass }}">
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style="display:flex;justify-content:flex-end;gap:0.75rem;padding-top:1rem;margin-top:1rem;border-top:1px solid #e5e7eb;">
|
||||
<div class="mt-4 flex justify-end gap-3 border-t border-gray-100 pt-4">
|
||||
<button type="button" @click="showForm = false"
|
||||
style="padding:0.5rem 1rem;border:1px solid #d1d5db;border-radius:0.375rem;font-weight:500;color:#4b5563;background:#fff;cursor:pointer;"
|
||||
onmouseover="this.style.background='#f9fafb'"
|
||||
onmouseout="this.style.background='#fff'">取消</button>
|
||||
class="{{ $adminListSecondaryButtonClass }}">取消</button>
|
||||
<button type="submit"
|
||||
style="padding:0.5rem 1rem;background-color:#f97316;color:#fff;border-radius:0.375rem;font-weight:700;border:none;cursor:pointer;box-shadow:0 1px 2px rgba(0,0,0,.1);"
|
||||
onmouseover="this.style.backgroundColor='#ea580c'"
|
||||
onmouseout="this.style.backgroundColor='#f97316'">
|
||||
class="rounded-lg bg-orange-500 px-4 py-2 text-sm font-semibold text-white shadow-sm transition hover:bg-orange-600">
|
||||
确认任命
|
||||
</button>
|
||||
</div>
|
||||
@@ -237,5 +241,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user