1493 lines
42 KiB
Vue
1493 lines
42 KiB
Vue
<template>
|
||
<div class="page-container duty-schedule-page">
|
||
<section class="panel">
|
||
<div class="panel-top">
|
||
<h2 class="title-bar-heading">值班排班</h2>
|
||
<div class="month-nav">
|
||
<el-button class="btn-ghost" @click="shiftMonth(-1)">
|
||
<el-icon><ArrowLeft /></el-icon>
|
||
</el-button>
|
||
<span class="month-label">{{ year }}年 {{ month }}月</span>
|
||
<el-button class="btn-ghost" @click="shiftMonth(1)">
|
||
<el-icon><ArrowRight /></el-icon>
|
||
</el-button>
|
||
<el-button class="btn-ghost" @click="goToday">
|
||
<el-icon><Calendar /></el-icon>
|
||
今天
|
||
</el-button>
|
||
</div>
|
||
<div class="legend">
|
||
<span><i class="dot am" />早班</span>
|
||
<span><i class="dot pm" />晚班</span>
|
||
<span><i class="dot duty" />值班</span>
|
||
<span><i class="dot other" />其他</span>
|
||
<span class="muted">{{
|
||
viewMode === 'stats' ? '点击本月合计可返回日历' : '点击日期配置 / 复制链接'
|
||
}}</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="filter-row">
|
||
<div class="month-stats">
|
||
<button
|
||
type="button"
|
||
class="stat"
|
||
:class="{ active: viewMode === 'calendar' && filterShiftType === 'morning' }"
|
||
@click="toggleShiftFilter('morning')"
|
||
>
|
||
<i class="dot am" />早班 <em>{{ monthShiftStats.morning }}</em>
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="stat"
|
||
:class="{ active: viewMode === 'calendar' && filterShiftType === 'evening' }"
|
||
@click="toggleShiftFilter('evening')"
|
||
>
|
||
<i class="dot pm" />晚班 <em>{{ monthShiftStats.evening }}</em>
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="stat"
|
||
:class="{ active: viewMode === 'calendar' && filterShiftType === 'duty' }"
|
||
@click="toggleShiftFilter('duty')"
|
||
>
|
||
<i class="dot duty" />值班 <em>{{ monthShiftStats.duty }}</em>
|
||
</button>
|
||
<button
|
||
v-if="monthShiftStats.other > 0"
|
||
type="button"
|
||
class="stat"
|
||
:class="{ active: viewMode === 'calendar' && filterShiftType === 'other' }"
|
||
@click="toggleShiftFilter('other')"
|
||
>
|
||
<i class="dot other" />其他 <em>{{ monthShiftStats.other }}</em>
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="stat total"
|
||
:class="{ active: viewMode === 'stats' }"
|
||
@click="toggleStatsView"
|
||
>
|
||
本月合计 <em>{{ monthShiftStats.total }}</em>
|
||
</button>
|
||
</div>
|
||
|
||
<div v-if="viewMode === 'calendar' && personStats.length" class="person-bar">
|
||
<span class="person-bar-label">本月人员</span>
|
||
<button
|
||
v-for="p in personStats"
|
||
:key="p.key"
|
||
type="button"
|
||
class="person-chip"
|
||
:class="{ active: filterPersonKey === p.key }"
|
||
@click="togglePersonFilter(p.key)"
|
||
>
|
||
{{ p.name }}
|
||
<em>{{ p.count }}</em>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div v-if="viewMode === 'calendar'" v-loading="loading" class="cal-wrap">
|
||
<table class="duty-cal">
|
||
<thead>
|
||
<tr>
|
||
<th class="wknd">日</th>
|
||
<th>一</th>
|
||
<th>二</th>
|
||
<th>三</th>
|
||
<th>四</th>
|
||
<th>五</th>
|
||
<th class="wknd">六</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr v-for="(week, wi) in weeks" :key="wi">
|
||
<td
|
||
v-for="(cell, di) in week"
|
||
:key="di"
|
||
:class="{
|
||
muted: !cell.inMonth,
|
||
today: cell.isToday,
|
||
'has-day': cell.inMonth
|
||
}"
|
||
@click="cell.inMonth && openDay(cell.dateStr)"
|
||
>
|
||
<div class="day-num">{{ cell.day }}</div>
|
||
<template v-if="cell.inMonth">
|
||
<span
|
||
v-for="(chip, ci) in cell.chips"
|
||
:key="ci"
|
||
class="chip"
|
||
:class="chip.cls"
|
||
:title="chip.title || chip.text"
|
||
>
|
||
{{ chip.text }}
|
||
</span>
|
||
</template>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
<div v-else v-loading="loading" class="stats-wrap">
|
||
<div v-if="!personCards.length" class="stats-empty">本月暂无排班数据</div>
|
||
<div v-else class="stats-grid">
|
||
<article v-for="(card, ci) in personCards" :key="card.key" class="stats-card">
|
||
<header class="stats-card-hd">
|
||
<div class="avatar" :style="{ background: avatarColor(ci) }">
|
||
{{ card.initial }}
|
||
</div>
|
||
<div class="who">
|
||
<div class="name">{{ card.name }}</div>
|
||
</div>
|
||
<div class="total-box">
|
||
<strong>{{ card.total }}</strong>
|
||
<span>总次数</span>
|
||
</div>
|
||
</header>
|
||
<div class="stats-breakdown" :class="{ 'has-other': card.other > 0 }">
|
||
<div class="cell am">
|
||
<span><i class="dot am" />早班</span>
|
||
<strong>{{ card.morning }}</strong>
|
||
</div>
|
||
<div class="cell pm">
|
||
<span><i class="dot pm" />晚班</span>
|
||
<strong>{{ card.evening }}</strong>
|
||
</div>
|
||
<div class="cell duty">
|
||
<span><i class="dot duty" />值班</span>
|
||
<strong>{{ card.duty }}</strong>
|
||
</div>
|
||
<div v-if="card.other > 0" class="cell other">
|
||
<span><i class="dot other" />其他</span>
|
||
<strong>{{ card.other }}</strong>
|
||
</div>
|
||
</div>
|
||
<div class="stats-bar">
|
||
<i
|
||
v-if="card.morning"
|
||
class="seg am"
|
||
:style="{ width: barPct(card.morning, card.total) }"
|
||
/>
|
||
<i
|
||
v-if="card.evening"
|
||
class="seg pm"
|
||
:style="{ width: barPct(card.evening, card.total) }"
|
||
/>
|
||
<i
|
||
v-if="card.duty"
|
||
class="seg duty"
|
||
:style="{ width: barPct(card.duty, card.total) }"
|
||
/>
|
||
<i
|
||
v-if="card.other"
|
||
class="seg other"
|
||
:style="{ width: barPct(card.other, card.total) }"
|
||
/>
|
||
</div>
|
||
<footer class="stats-card-ft"> {{ year }}年{{ pad(month) }}月 排班统计 </footer>
|
||
</article>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<el-dialog
|
||
v-model="dialogVisible"
|
||
class="dialog-form-layout duty-day-dialog"
|
||
:title="`配置 · ${editingDate}`"
|
||
width="880px"
|
||
align-center
|
||
destroy-on-close
|
||
:close-on-click-modal="false"
|
||
>
|
||
<el-form label-position="top" class="duty-day-form">
|
||
<p class="form-tip">
|
||
为当天配置班次名额,保存后生成公开链接。直接安排与公开链接仅可选择已分配「值班人员」角色的用户。
|
||
</p>
|
||
|
||
<div v-for="slot in formSlots" :key="slot.shiftType" class="slot-card">
|
||
<div class="slot-hd">
|
||
<el-checkbox v-model="slot.enabled">{{ shiftLabel(slot.shiftType) }}</el-checkbox>
|
||
<div v-if="slot.enabled" class="cap-field">
|
||
<span>名额</span>
|
||
<el-input-number
|
||
v-model="slot.capacity"
|
||
:min="1"
|
||
:max="99"
|
||
controls-position="right"
|
||
/>
|
||
</div>
|
||
</div>
|
||
<template v-if="slot.enabled">
|
||
<div class="form-grid-2 slot-fields-row">
|
||
<el-form-item label="开始时间">
|
||
<el-time-picker
|
||
v-model="slot.startTime"
|
||
value-format="HH:mm"
|
||
format="HH:mm"
|
||
placeholder="可选"
|
||
style="width: 100%"
|
||
clearable
|
||
@change="() => syncCrossDay(slot)"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="结束时间">
|
||
<el-time-picker
|
||
v-model="slot.endTime"
|
||
value-format="HH:mm"
|
||
format="HH:mm"
|
||
placeholder="可选"
|
||
style="width: 100%"
|
||
clearable
|
||
@change="() => syncCrossDay(slot)"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="跨日">
|
||
<el-checkbox v-model="slot.crossDay">结束时间跨日</el-checkbox>
|
||
</el-form-item>
|
||
<el-form-item label="工作安排" class="form-col-span-2">
|
||
<el-select
|
||
:model-value="slot.workPlans"
|
||
multiple
|
||
filterable
|
||
allow-create
|
||
default-first-option
|
||
clearable
|
||
placeholder="选择或输入工作安排"
|
||
style="width: 100%"
|
||
@change="(v) => onWorkPlansChange(slot, v as string[])"
|
||
>
|
||
<el-option
|
||
v-for="o in workPlanOptions"
|
||
:key="o.value"
|
||
:label="o.label"
|
||
:value="o.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="备注" class="form-col-span-2">
|
||
<el-input
|
||
v-model="slot.remark"
|
||
type="textarea"
|
||
:rows="2"
|
||
maxlength="500"
|
||
show-word-limit
|
||
placeholder="可选,填写备注(与工作安排分离)"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="值班安排" class="form-col-span-2">
|
||
<el-select
|
||
v-model="slot.pendingUserId"
|
||
filterable
|
||
clearable
|
||
placeholder="选择员工后添加"
|
||
style="width: 100%"
|
||
@change="(v) => addAssign(slot, String(v || ''))"
|
||
>
|
||
<el-option
|
||
v-for="u in userOptions"
|
||
:key="u.value"
|
||
:label="u.label"
|
||
:value="u.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</div>
|
||
<div class="person-tags">
|
||
<el-tag
|
||
v-for="(a, ai) in slot.assignments"
|
||
:key="a.id || `${a.source}-${a.personName}-${ai}`"
|
||
:type="a.source === 'grab' ? 'warning' : 'success'"
|
||
closable
|
||
size="small"
|
||
@close="removeAssign(slot, ai)"
|
||
>
|
||
{{ a.personName }}({{ a.source === 'grab' ? '抢班' : '指定' }})
|
||
</el-tag>
|
||
<span v-if="!slot.assignments.length" class="empty-tip">暂无报名</span>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
|
||
<div class="add-shift-row">
|
||
<el-select
|
||
v-model="addShiftDraft"
|
||
filterable
|
||
allow-create
|
||
default-first-option
|
||
clearable
|
||
placeholder="选择或输入班次类型"
|
||
style="flex: 1; min-width: 180px"
|
||
>
|
||
<el-option
|
||
v-for="o in availableShiftOptions"
|
||
:key="o.value"
|
||
:label="o.label"
|
||
:value="o.value"
|
||
/>
|
||
</el-select>
|
||
<el-button class="btn-ghost" :loading="addingShift" @click="confirmAddShift">
|
||
<el-icon><Plus /></el-icon>
|
||
添加班次
|
||
</el-button>
|
||
</div>
|
||
|
||
<div v-if="dayDetail?.publicUrl" class="link-box">
|
||
<span>公开链接</span>
|
||
<code>{{ dayDetail.publicUrl }}</code>
|
||
<el-button class="btn-main" type="primary" size="small" @click="copyLink">
|
||
<el-icon><CopyDocument /></el-icon>
|
||
复制
|
||
</el-button>
|
||
<el-button v-if="dayDetail.id" class="btn-ghost" size="small" @click="toggleLink">
|
||
<el-icon><SwitchButton /></el-icon>
|
||
{{ dayDetail.linkStatus === 'closed' ? '打开链接' : '关闭链接' }}
|
||
</el-button>
|
||
</div>
|
||
</el-form>
|
||
|
||
<template #footer>
|
||
<el-button class="btn-ghost" @click="dialogVisible = false">
|
||
<el-icon><Close /></el-icon>
|
||
取消
|
||
</el-button>
|
||
<el-button class="btn-main" type="primary" :loading="saving" @click="handleSave">
|
||
<el-icon><Check /></el-icon>
|
||
保存
|
||
</el-button>
|
||
</template>
|
||
</el-dialog>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { computed, onMounted, ref } from 'vue'
|
||
import {
|
||
ArrowLeft,
|
||
ArrowRight,
|
||
Calendar,
|
||
Check,
|
||
Close,
|
||
CopyDocument,
|
||
Plus,
|
||
SwitchButton
|
||
} from '@element-plus/icons-vue'
|
||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||
import { fetchDictDataOptions } from '@/api/admin'
|
||
import {
|
||
deleteDutyAssignment,
|
||
ensureDutyDict,
|
||
fetchDutyDay,
|
||
fetchDutyMonth,
|
||
fetchDutyUserOptions,
|
||
saveDutyDay,
|
||
setDutyLinkStatus,
|
||
type DutyDayItem,
|
||
type DutySlotItem
|
||
} from '@/api/duty'
|
||
|
||
defineOptions({ name: 'DutySchedule' })
|
||
|
||
const PRESET_TYPES = ['morning', 'evening', 'duty'] as const
|
||
type PresetShift = (typeof PRESET_TYPES)[number]
|
||
type FilterShift = PresetShift | 'other' | ''
|
||
|
||
const SHIFT_LABELS: Record<string, string> = {
|
||
morning: '早班',
|
||
evening: '晚班',
|
||
duty: '值班'
|
||
}
|
||
const SHIFT_CLS: Record<string, string> = {
|
||
morning: 'am',
|
||
evening: 'pm',
|
||
duty: 'duty'
|
||
}
|
||
|
||
const now = new Date()
|
||
const year = ref(now.getFullYear())
|
||
const month = ref(now.getMonth() + 1)
|
||
const loading = ref(false)
|
||
const saving = ref(false)
|
||
const addingShift = ref(false)
|
||
const monthDays = ref<DutyDayItem[]>([])
|
||
const filterPersonKey = ref('')
|
||
const filterShiftType = ref<FilterShift>('')
|
||
const viewMode = ref<'calendar' | 'stats'>('calendar')
|
||
const dialogVisible = ref(false)
|
||
const editingDate = ref('')
|
||
const dayDetail = ref<DutyDayItem | null>(null)
|
||
const userOptions = ref<Array<{ label: string; value: string }>>([])
|
||
const shiftTypeOptions = ref<Array<{ label: string; value: string }>>([])
|
||
const workPlanOptions = ref<Array<{ label: string; value: string }>>([])
|
||
const addShiftDraft = ref('')
|
||
|
||
type FormSlot = {
|
||
shiftType: string
|
||
enabled: boolean
|
||
capacity: number
|
||
workPlans: string[]
|
||
remark: string
|
||
startTime: string | null
|
||
endTime: string | null
|
||
crossDay: boolean
|
||
pendingUserId: string
|
||
assignments: DutySlotItem['assignments']
|
||
}
|
||
|
||
function defaultTimesFor(shiftType: string) {
|
||
if (shiftType === 'morning') return { startTime: '08:00', endTime: '18:00', crossDay: false }
|
||
if (shiftType === 'evening') return { startTime: '18:00', endTime: '07:00', crossDay: true }
|
||
return { startTime: null as string | null, endTime: null as string | null, crossDay: false }
|
||
}
|
||
|
||
function blankFormSlots(): FormSlot[] {
|
||
return PRESET_TYPES.map((t) => ({
|
||
shiftType: t,
|
||
enabled: t === 'morning' || t === 'evening',
|
||
capacity: 1,
|
||
workPlans: [],
|
||
remark: '',
|
||
...defaultTimesFor(t),
|
||
pendingUserId: '',
|
||
assignments: []
|
||
}))
|
||
}
|
||
|
||
const formSlots = ref<FormSlot[]>(blankFormSlots())
|
||
|
||
function isPresetShift(t: string): t is PresetShift {
|
||
return (PRESET_TYPES as readonly string[]).includes(t)
|
||
}
|
||
|
||
function shiftChipCls(t: string) {
|
||
return SHIFT_CLS[t] || 'other'
|
||
}
|
||
|
||
function shiftLabel(t: string) {
|
||
return shiftTypeOptions.value.find((o) => o.value === t)?.label || SHIFT_LABELS[t] || t
|
||
}
|
||
|
||
function pad(n: number) {
|
||
return n < 10 ? `0${n}` : String(n)
|
||
}
|
||
|
||
function toDateStr(y: number, m: number, d: number) {
|
||
return `${y}-${pad(m)}-${pad(d)}`
|
||
}
|
||
|
||
function personDisplayName(a: { userId?: string | null; personName?: string }) {
|
||
return (a.personName || '').trim()
|
||
}
|
||
|
||
function assignmentMatchesFilter(
|
||
a: { userId?: string | null; personName?: string },
|
||
nameKey: string
|
||
) {
|
||
if (!nameKey) return true
|
||
return personDisplayName(a) === nameKey
|
||
}
|
||
|
||
function matchesShiftFilter(shiftType: string, filter: FilterShift) {
|
||
if (!filter) return true
|
||
if (filter === 'other') return !isPresetShift(shiftType)
|
||
return shiftType === filter
|
||
}
|
||
|
||
const availableShiftOptions = computed(() => {
|
||
const used = new Set(formSlots.value.map((s) => s.shiftType))
|
||
return shiftTypeOptions.value.filter((o) => !used.has(o.value))
|
||
})
|
||
|
||
const personStats = computed(() => {
|
||
const map = new Map<string, { key: string; name: string; count: number }>()
|
||
const shiftFilter = filterShiftType.value
|
||
for (const day of monthDays.value) {
|
||
for (const slot of day.slots || []) {
|
||
if (!matchesShiftFilter(slot.shiftType, shiftFilter)) continue
|
||
for (const a of slot.assignments || []) {
|
||
const name = personDisplayName(a)
|
||
if (!name) continue
|
||
const cur = map.get(name)
|
||
if (cur) cur.count += 1
|
||
else map.set(name, { key: name, name, count: 1 })
|
||
}
|
||
}
|
||
}
|
||
return Array.from(map.values()).sort((a, b) => {
|
||
if (b.count !== a.count) return b.count - a.count
|
||
return a.name.localeCompare(b.name, 'zh-CN')
|
||
})
|
||
})
|
||
|
||
const monthShiftStats = computed(() => {
|
||
const counts = { morning: 0, evening: 0, duty: 0, other: 0 }
|
||
for (const day of monthDays.value) {
|
||
for (const slot of day.slots || []) {
|
||
const n = (slot.assignments || []).length
|
||
if (slot.shiftType === 'morning') counts.morning += n
|
||
else if (slot.shiftType === 'evening') counts.evening += n
|
||
else if (slot.shiftType === 'duty') counts.duty += n
|
||
else counts.other += n
|
||
}
|
||
}
|
||
return {
|
||
...counts,
|
||
total: counts.morning + counts.evening + counts.duty + counts.other
|
||
}
|
||
})
|
||
|
||
const personCards = computed(() => {
|
||
type Acc = {
|
||
key: string
|
||
name: string
|
||
morning: number
|
||
evening: number
|
||
duty: number
|
||
other: number
|
||
}
|
||
const map = new Map<string, Acc>()
|
||
for (const day of monthDays.value) {
|
||
for (const slot of day.slots || []) {
|
||
for (const a of slot.assignments || []) {
|
||
const name = personDisplayName(a)
|
||
if (!name) continue
|
||
let row = map.get(name)
|
||
if (!row) {
|
||
row = { key: name, name, morning: 0, evening: 0, duty: 0, other: 0 }
|
||
map.set(name, row)
|
||
}
|
||
if (slot.shiftType === 'morning') row.morning += 1
|
||
else if (slot.shiftType === 'evening') row.evening += 1
|
||
else if (slot.shiftType === 'duty') row.duty += 1
|
||
else row.other += 1
|
||
}
|
||
}
|
||
}
|
||
return Array.from(map.values())
|
||
.map((row) => ({
|
||
...row,
|
||
total: row.morning + row.evening + row.duty + row.other,
|
||
initial: row.name.slice(0, 1)
|
||
}))
|
||
.sort((a, b) => {
|
||
if (b.total !== a.total) return b.total - a.total
|
||
return a.name.localeCompare(b.name, 'zh-CN')
|
||
})
|
||
})
|
||
|
||
const AVATAR_COLORS = [
|
||
'#10b981',
|
||
'#3b82f6',
|
||
'#f59e0b',
|
||
'#ef4444',
|
||
'#8b5cf6',
|
||
'#06b6d4',
|
||
'#ec4899',
|
||
'#84cc16'
|
||
]
|
||
|
||
function avatarColor(index: number) {
|
||
return AVATAR_COLORS[index % AVATAR_COLORS.length]
|
||
}
|
||
|
||
function barPct(part: number, total: number) {
|
||
if (!total) return '0%'
|
||
return `${Math.round((part / total) * 1000) / 10}%`
|
||
}
|
||
|
||
const dayMap = computed(() => {
|
||
const map = new Map<string, DutyDayItem>()
|
||
for (const d of monthDays.value) {
|
||
if (d.dutyDate) map.set(d.dutyDate, d)
|
||
}
|
||
return map
|
||
})
|
||
|
||
const weeks = computed(() => {
|
||
const y = year.value
|
||
const m = month.value
|
||
const first = new Date(y, m - 1, 1)
|
||
const startWeekday = first.getDay()
|
||
const daysInMonth = new Date(y, m, 0).getDate()
|
||
const todayStr = toDateStr(now.getFullYear(), now.getMonth() + 1, now.getDate())
|
||
const filterKey = filterPersonKey.value
|
||
const shiftFilter = filterShiftType.value
|
||
const hasFilter = !!(filterKey || shiftFilter)
|
||
const cells: Array<{
|
||
day: number
|
||
inMonth: boolean
|
||
dateStr: string
|
||
isToday: boolean
|
||
summary?: DutyDayItem
|
||
chips: Array<{ text: string; cls: string; title?: string }>
|
||
}> = []
|
||
|
||
const prevDays = new Date(y, m - 1, 0).getDate()
|
||
for (let i = 0; i < startWeekday; i++) {
|
||
const d = prevDays - startWeekday + i + 1
|
||
cells.push({ day: d, inMonth: false, dateStr: '', isToday: false, chips: [] })
|
||
}
|
||
for (let d = 1; d <= daysInMonth; d++) {
|
||
const dateStr = toDateStr(y, m, d)
|
||
const summary = dayMap.value.get(dateStr)
|
||
const chips: Array<{ text: string; cls: string; title?: string }> = []
|
||
if (summary?.slots?.length) {
|
||
for (const s of summary.slots) {
|
||
if (!matchesShiftFilter(s.shiftType, shiftFilter)) continue
|
||
const matched = (s.assignments || []).filter((a) => assignmentMatchesFilter(a, filterKey))
|
||
if (filterKey && !matched.length) continue
|
||
const names = matched.map((a) => a.personName).filter(Boolean)
|
||
const taken = s.taken ?? (s.assignments || []).length
|
||
const label = s.shiftLabel || shiftLabel(s.shiftType)
|
||
const planText = (s.workPlanLabels || []).filter(Boolean).join('、')
|
||
let text: string
|
||
if (filterKey) {
|
||
text = `${label} ${names.join('、')}`
|
||
} else if (names.length) {
|
||
text = `${label} ${names.slice(0, 2).join('、')}${names.length > 2 ? '…' : ''}`
|
||
} else {
|
||
text = `${label} ${taken}/${s.capacity}`
|
||
}
|
||
if (planText) {
|
||
text = `${text} · ${planText}`
|
||
}
|
||
chips.push({
|
||
text,
|
||
cls: shiftChipCls(s.shiftType),
|
||
title: planText || undefined
|
||
})
|
||
}
|
||
if (!hasFilter && !chips.length) {
|
||
chips.push({ text: '未排班 · 点击配置', cls: 'empty' })
|
||
}
|
||
} else if (!hasFilter) {
|
||
chips.push({ text: '未排班 · 点击配置', cls: 'empty' })
|
||
}
|
||
cells.push({
|
||
day: d,
|
||
inMonth: true,
|
||
dateStr,
|
||
isToday: dateStr === todayStr,
|
||
summary,
|
||
chips
|
||
})
|
||
}
|
||
while (cells.length % 7 !== 0) {
|
||
cells.push({
|
||
day: cells.length % 7,
|
||
inMonth: false,
|
||
dateStr: '',
|
||
isToday: false,
|
||
chips: []
|
||
})
|
||
}
|
||
const rows: (typeof cells)[] = []
|
||
for (let i = 0; i < cells.length; i += 7) rows.push(cells.slice(i, i + 7))
|
||
return rows
|
||
})
|
||
|
||
function togglePersonFilter(key: string) {
|
||
filterPersonKey.value = filterPersonKey.value === key ? '' : key
|
||
}
|
||
|
||
function toggleShiftFilter(shift: Exclude<FilterShift, ''>) {
|
||
if (viewMode.value === 'stats') {
|
||
viewMode.value = 'calendar'
|
||
}
|
||
filterShiftType.value = filterShiftType.value === shift ? '' : shift
|
||
if (filterPersonKey.value && !personStats.value.some((p) => p.key === filterPersonKey.value)) {
|
||
filterPersonKey.value = ''
|
||
}
|
||
}
|
||
|
||
function toggleStatsView() {
|
||
if (viewMode.value === 'stats') {
|
||
viewMode.value = 'calendar'
|
||
return
|
||
}
|
||
filterShiftType.value = ''
|
||
filterPersonKey.value = ''
|
||
viewMode.value = 'stats'
|
||
}
|
||
|
||
async function loadDictOptions() {
|
||
try {
|
||
const [shifts, plans] = await Promise.all([
|
||
fetchDictDataOptions('duty_shift_type'),
|
||
fetchDictDataOptions('duty_work_plan')
|
||
])
|
||
shiftTypeOptions.value = (shifts || []).map((x) => ({
|
||
label: x.label,
|
||
value: x.value
|
||
}))
|
||
workPlanOptions.value = (plans || []).map((x) => ({
|
||
label: x.label,
|
||
value: x.value
|
||
}))
|
||
} catch {
|
||
shiftTypeOptions.value = []
|
||
workPlanOptions.value = []
|
||
}
|
||
}
|
||
|
||
async function loadMonth() {
|
||
loading.value = true
|
||
filterPersonKey.value = ''
|
||
filterShiftType.value = ''
|
||
try {
|
||
const res = await fetchDutyMonth(year.value, month.value)
|
||
monthDays.value = Array.isArray(res) ? res : []
|
||
} catch (e: any) {
|
||
ElMessage.error(e?.message || '加载月历失败')
|
||
monthDays.value = []
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
|
||
function shiftMonth(delta: number) {
|
||
let y = year.value
|
||
let m = month.value + delta
|
||
if (m < 1) {
|
||
m = 12
|
||
y -= 1
|
||
} else if (m > 12) {
|
||
m = 1
|
||
y += 1
|
||
}
|
||
year.value = y
|
||
month.value = m
|
||
void loadMonth()
|
||
}
|
||
|
||
function goToday() {
|
||
year.value = now.getFullYear()
|
||
month.value = now.getMonth() + 1
|
||
void loadMonth()
|
||
}
|
||
|
||
function applyFoundToFormSlot(fs: FormSlot, found: DutySlotItem) {
|
||
fs.enabled = true
|
||
fs.capacity = found.capacity || 1
|
||
fs.workPlans = [...(found.workPlans || [])]
|
||
fs.remark = (found.remark || '').trim()
|
||
fs.startTime = found.startTime || null
|
||
fs.endTime = found.endTime || null
|
||
fs.crossDay = !!found.crossDay
|
||
fs.pendingUserId = ''
|
||
fs.assignments = found ? [...(found.assignments || [])] : []
|
||
}
|
||
|
||
function resetFormSlots(detail: DutyDayItem | null) {
|
||
const slots = blankFormSlots()
|
||
if (detail?.slots?.length) {
|
||
for (const fs of slots) {
|
||
const found = detail.slots.find((s) => s.shiftType === fs.shiftType)
|
||
if (found) applyFoundToFormSlot(fs, found)
|
||
else fs.enabled = false
|
||
}
|
||
for (const s of detail.slots) {
|
||
if (isPresetShift(s.shiftType)) continue
|
||
if (slots.some((x) => x.shiftType === s.shiftType)) continue
|
||
const custom: FormSlot = {
|
||
shiftType: s.shiftType,
|
||
enabled: true,
|
||
capacity: 1,
|
||
workPlans: [],
|
||
remark: '',
|
||
...defaultTimesFor(s.shiftType),
|
||
pendingUserId: '',
|
||
assignments: []
|
||
}
|
||
applyFoundToFormSlot(custom, s)
|
||
slots.push(custom)
|
||
}
|
||
}
|
||
formSlots.value = slots
|
||
addShiftDraft.value = ''
|
||
}
|
||
|
||
function syncCrossDay(slot: FormSlot) {
|
||
const start = slot.startTime || ''
|
||
const end = slot.endTime || ''
|
||
if (start && end && end < start) {
|
||
slot.crossDay = true
|
||
}
|
||
}
|
||
|
||
async function resolveDictValue(
|
||
dictType: 'duty_shift_type' | 'duty_work_plan',
|
||
raw: string,
|
||
options: Array<{ label: string; value: string }>
|
||
) {
|
||
const existing = options.find((o) => o.value === raw || o.label === raw)
|
||
if (existing) return existing.value
|
||
const res = await ensureDutyDict({ dictType, label: raw })
|
||
if (!options.some((o) => o.value === res.value)) {
|
||
options.push({ label: res.label || raw, value: res.value })
|
||
}
|
||
return res.value
|
||
}
|
||
|
||
async function onWorkPlansChange(slot: FormSlot, values: string[]) {
|
||
const next: string[] = []
|
||
for (const raw of values || []) {
|
||
const v = String(raw || '').trim()
|
||
if (!v) continue
|
||
try {
|
||
const value = await resolveDictValue('duty_work_plan', v, workPlanOptions.value)
|
||
if (!next.includes(value)) next.push(value)
|
||
} catch (e: any) {
|
||
ElMessage.error(e?.message || '创建工作安排失败')
|
||
}
|
||
}
|
||
slot.workPlans = next
|
||
}
|
||
|
||
async function confirmAddShift() {
|
||
const raw = String(addShiftDraft.value || '').trim()
|
||
if (!raw) {
|
||
ElMessage.warning('请选择或输入班次类型')
|
||
return
|
||
}
|
||
addingShift.value = true
|
||
try {
|
||
const shiftType = await resolveDictValue('duty_shift_type', raw, shiftTypeOptions.value)
|
||
if (formSlots.value.some((s) => s.shiftType === shiftType)) {
|
||
ElMessage.warning('该班次类型当日已存在,不可重复')
|
||
addShiftDraft.value = ''
|
||
return
|
||
}
|
||
formSlots.value.push({
|
||
shiftType,
|
||
enabled: true,
|
||
capacity: 1,
|
||
workPlans: [],
|
||
remark: '',
|
||
...defaultTimesFor(shiftType),
|
||
pendingUserId: '',
|
||
assignments: []
|
||
})
|
||
addShiftDraft.value = ''
|
||
} catch (e: any) {
|
||
ElMessage.error(e?.message || '添加班次失败')
|
||
} finally {
|
||
addingShift.value = false
|
||
}
|
||
}
|
||
|
||
async function openDay(dateStr: string) {
|
||
editingDate.value = dateStr
|
||
dialogVisible.value = true
|
||
try {
|
||
const detail = (await fetchDutyDay(dateStr)) as DutyDayItem
|
||
dayDetail.value = detail
|
||
resetFormSlots(detail)
|
||
} catch (e: any) {
|
||
ElMessage.error(e?.message || '加载失败')
|
||
dayDetail.value = { dutyDate: dateStr, linkStatus: 'open', slots: [] }
|
||
resetFormSlots(null)
|
||
}
|
||
}
|
||
|
||
function addAssign(slot: FormSlot, userId: string) {
|
||
if (!userId) return
|
||
const u = userOptions.value.find((x) => x.value === userId)
|
||
if (!u) return
|
||
if (slot.assignments.some((a) => a.userId === userId || a.personName === u.label)) {
|
||
ElMessage.warning('该员工已在名单中')
|
||
slot.pendingUserId = ''
|
||
return
|
||
}
|
||
if (slot.assignments.length >= slot.capacity) {
|
||
ElMessage.warning('已达名额上限')
|
||
slot.pendingUserId = ''
|
||
return
|
||
}
|
||
slot.assignments.push({
|
||
source: 'assign',
|
||
userId,
|
||
personName: u.label
|
||
})
|
||
slot.pendingUserId = ''
|
||
}
|
||
|
||
async function removeAssign(slot: FormSlot, index: number) {
|
||
const a = slot.assignments[index]
|
||
if (a?.id) {
|
||
try {
|
||
await ElMessageBox.confirm('确认删除该报名?', '提示', { type: 'warning' })
|
||
await deleteDutyAssignment(a.id)
|
||
} catch {
|
||
return
|
||
}
|
||
}
|
||
slot.assignments.splice(index, 1)
|
||
}
|
||
|
||
async function handleSave() {
|
||
const enabled = formSlots.value.filter((s) => s.enabled)
|
||
const types = enabled.map((s) => s.shiftType)
|
||
if (new Set(types).size !== types.length) {
|
||
ElMessage.warning('同一天不能重复配置相同班次类型')
|
||
return
|
||
}
|
||
const slots = enabled.map((s) => ({
|
||
shiftType: s.shiftType,
|
||
capacity: s.capacity,
|
||
workPlans: s.workPlans || [],
|
||
remark: s.remark.trim() || null,
|
||
startTime: s.startTime || null,
|
||
endTime: s.endTime || null,
|
||
crossDay: !!s.crossDay,
|
||
assignments: s.assignments
|
||
.filter((a) => a.source === 'assign')
|
||
.map((a) => ({
|
||
source: 'assign' as const,
|
||
userId: a.userId || undefined,
|
||
personName: a.personName
|
||
}))
|
||
}))
|
||
if (!slots.length) {
|
||
ElMessage.warning('请至少启用一个班次')
|
||
return
|
||
}
|
||
saving.value = true
|
||
try {
|
||
const detail = (await saveDutyDay({
|
||
dutyDate: editingDate.value,
|
||
slots,
|
||
linkStatus: dayDetail.value?.linkStatus || 'open'
|
||
})) as DutyDayItem
|
||
dayDetail.value = detail
|
||
ElMessage.success('保存成功')
|
||
await loadMonth()
|
||
resetFormSlots(detail)
|
||
} catch (e: any) {
|
||
ElMessage.error(e?.message || '保存失败')
|
||
} finally {
|
||
saving.value = false
|
||
}
|
||
}
|
||
|
||
async function copyLink() {
|
||
const url = dayDetail.value?.publicUrl
|
||
if (!url) return
|
||
try {
|
||
await navigator.clipboard.writeText(url)
|
||
ElMessage.success('已复制链接')
|
||
} catch {
|
||
ElMessage.info(url)
|
||
}
|
||
}
|
||
|
||
async function toggleLink() {
|
||
if (!dayDetail.value?.id) return
|
||
const next = dayDetail.value.linkStatus === 'closed' ? 'open' : 'closed'
|
||
try {
|
||
dayDetail.value = (await setDutyLinkStatus(dayDetail.value.id, next)) as DutyDayItem
|
||
ElMessage.success(next === 'closed' ? '已关闭链接' : '已打开链接')
|
||
await loadMonth()
|
||
} catch (e: any) {
|
||
ElMessage.error(e?.message || '操作失败')
|
||
}
|
||
}
|
||
|
||
onMounted(async () => {
|
||
await loadDictOptions()
|
||
try {
|
||
const opts = await fetchDutyUserOptions()
|
||
userOptions.value = (Array.isArray(opts) ? opts : []) as Array<{
|
||
label: string
|
||
value: string
|
||
}>
|
||
} catch {
|
||
userOptions.value = []
|
||
}
|
||
await loadMonth()
|
||
})
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.duty-schedule-page {
|
||
.panel-top {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: center;
|
||
gap: 12px 16px;
|
||
margin-bottom: 16px;
|
||
}
|
||
.month-nav {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
}
|
||
.month-label {
|
||
min-width: 110px;
|
||
text-align: center;
|
||
font-weight: 600;
|
||
}
|
||
.legend {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 12px;
|
||
margin-left: auto;
|
||
font-size: 12px;
|
||
color: var(--mint-text-muted, #64748b);
|
||
}
|
||
.legend .muted {
|
||
color: var(--mint-text-muted, #94a3b8);
|
||
}
|
||
.dot {
|
||
display: inline-block;
|
||
width: 8px;
|
||
height: 8px;
|
||
border-radius: 50%;
|
||
margin-right: 4px;
|
||
vertical-align: middle;
|
||
}
|
||
.dot.am {
|
||
background: #f59e0b;
|
||
}
|
||
.dot.pm {
|
||
background: #3b82f6;
|
||
}
|
||
.dot.duty {
|
||
background: #ef4444;
|
||
}
|
||
.dot.other {
|
||
background: #64748b;
|
||
}
|
||
|
||
.filter-row {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 10px 16px;
|
||
align-items: flex-start;
|
||
justify-content: space-between;
|
||
margin: 0 0 14px;
|
||
}
|
||
|
||
.month-stats {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 8px 10px;
|
||
align-items: center;
|
||
flex-shrink: 0;
|
||
margin: 0;
|
||
font-size: 14px;
|
||
color: #334155;
|
||
}
|
||
.month-stats .stat {
|
||
display: inline-flex;
|
||
gap: 4px;
|
||
align-items: center;
|
||
height: 30px;
|
||
padding: 0 10px;
|
||
font: inherit;
|
||
font-size: 14px;
|
||
color: #334155;
|
||
cursor: pointer;
|
||
background: transparent;
|
||
border: 1px solid var(--mint-border, #d9e8e2);
|
||
border-radius: 999px;
|
||
}
|
||
.month-stats .stat:hover {
|
||
background: #f8fafc;
|
||
}
|
||
.month-stats .stat.active {
|
||
color: #fff;
|
||
background: var(--el-color-primary, #10b981);
|
||
border-color: var(--el-color-primary, #10b981);
|
||
}
|
||
.month-stats .stat.active .dot {
|
||
background: #fff !important;
|
||
}
|
||
.month-stats .stat.active em {
|
||
color: #fff;
|
||
}
|
||
.month-stats .stat em {
|
||
font-style: normal;
|
||
font-weight: 700;
|
||
color: #0f172a;
|
||
}
|
||
.month-stats .stat.total {
|
||
padding: 4px 10px;
|
||
font-size: 14px;
|
||
color: #64748b;
|
||
background: #f1f5f9;
|
||
border: 1px solid var(--mint-border, #d9e8e2);
|
||
border-radius: 999px;
|
||
}
|
||
.month-stats .stat.total:hover {
|
||
background: #e2e8f0;
|
||
}
|
||
.month-stats .stat.total.active {
|
||
color: #fff;
|
||
background: var(--el-color-primary, #10b981);
|
||
border-color: var(--el-color-primary, #10b981);
|
||
}
|
||
.month-stats .stat.total.active em {
|
||
color: #fff;
|
||
}
|
||
.month-stats .stat.total em {
|
||
color: #0f172a;
|
||
}
|
||
|
||
.stats-wrap {
|
||
min-height: 200px;
|
||
}
|
||
.stats-empty {
|
||
padding: 48px 16px;
|
||
font-size: 14px;
|
||
color: var(--mint-text-muted, #94a3b8);
|
||
text-align: center;
|
||
}
|
||
.stats-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||
gap: 16px;
|
||
}
|
||
@media (max-width: 1100px) {
|
||
.stats-grid {
|
||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||
}
|
||
}
|
||
@media (max-width: 720px) {
|
||
.stats-grid {
|
||
grid-template-columns: 1fr;
|
||
}
|
||
}
|
||
.stats-card {
|
||
padding: 16px;
|
||
background: #fff;
|
||
border: 1px solid var(--mint-border, #d9e8e2);
|
||
border-radius: 12px;
|
||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
|
||
}
|
||
.stats-card-hd {
|
||
display: flex;
|
||
gap: 10px;
|
||
align-items: center;
|
||
margin-bottom: 14px;
|
||
}
|
||
.stats-card .avatar {
|
||
display: flex;
|
||
flex-shrink: 0;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 40px;
|
||
height: 40px;
|
||
font-size: 16px;
|
||
font-weight: 700;
|
||
color: #fff;
|
||
border-radius: 50%;
|
||
}
|
||
.stats-card .who {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
.stats-card .name {
|
||
font-size: 15px;
|
||
font-weight: 700;
|
||
color: #0f172a;
|
||
}
|
||
.stats-card .total-box {
|
||
text-align: right;
|
||
}
|
||
.stats-card .total-box strong {
|
||
display: block;
|
||
font-size: 22px;
|
||
line-height: 1.1;
|
||
color: #0f172a;
|
||
}
|
||
.stats-card .total-box span {
|
||
font-size: 11px;
|
||
color: var(--mint-text-muted, #94a3b8);
|
||
}
|
||
.stats-breakdown {
|
||
display: grid;
|
||
grid-template-columns: repeat(3, 1fr);
|
||
gap: 8px;
|
||
margin-bottom: 12px;
|
||
}
|
||
.stats-breakdown.has-other {
|
||
grid-template-columns: repeat(4, 1fr);
|
||
}
|
||
.stats-breakdown .cell {
|
||
padding: 10px 8px;
|
||
text-align: center;
|
||
border-radius: 8px;
|
||
}
|
||
.stats-breakdown .cell span {
|
||
display: flex;
|
||
gap: 4px;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 12px;
|
||
color: #64748b;
|
||
}
|
||
.stats-breakdown .cell strong {
|
||
display: block;
|
||
margin-top: 4px;
|
||
font-size: 20px;
|
||
line-height: 1.2;
|
||
color: #0f172a;
|
||
}
|
||
.stats-breakdown .cell.am {
|
||
background: #fffbeb;
|
||
}
|
||
.stats-breakdown .cell.pm {
|
||
background: #eff6ff;
|
||
}
|
||
.stats-breakdown .cell.duty {
|
||
background: #fef2f2;
|
||
}
|
||
.stats-breakdown .cell.other {
|
||
background: #f1f5f9;
|
||
}
|
||
.stats-bar {
|
||
display: flex;
|
||
height: 8px;
|
||
overflow: hidden;
|
||
background: #f1f5f9;
|
||
border-radius: 999px;
|
||
}
|
||
.stats-bar .seg {
|
||
display: block;
|
||
height: 100%;
|
||
}
|
||
.stats-bar .seg.am {
|
||
background: #f59e0b;
|
||
}
|
||
.stats-bar .seg.pm {
|
||
background: #3b82f6;
|
||
}
|
||
.stats-bar .seg.duty {
|
||
background: #ef4444;
|
||
}
|
||
.stats-bar .seg.other {
|
||
background: #64748b;
|
||
}
|
||
.stats-card-ft {
|
||
margin-top: 10px;
|
||
font-size: 11px;
|
||
color: var(--mint-text-muted, #94a3b8);
|
||
text-align: center;
|
||
}
|
||
|
||
.person-bar {
|
||
display: flex;
|
||
flex: 1;
|
||
flex-wrap: wrap;
|
||
gap: 8px;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
min-width: 200px;
|
||
margin: 0;
|
||
padding: 0;
|
||
background: transparent;
|
||
border: none;
|
||
}
|
||
.person-bar-label {
|
||
margin-right: 4px;
|
||
font-size: 14px;
|
||
font-weight: 600;
|
||
color: var(--mint-text-muted, #64748b);
|
||
}
|
||
.person-chip {
|
||
display: inline-flex;
|
||
gap: 6px;
|
||
align-items: center;
|
||
height: 30px;
|
||
padding: 0 10px;
|
||
font-size: 14px;
|
||
color: #334155;
|
||
cursor: pointer;
|
||
background: transparent;
|
||
border: 1px solid var(--mint-border, #d9e8e2);
|
||
border-radius: 999px;
|
||
}
|
||
.person-chip em {
|
||
font-style: normal;
|
||
font-weight: 700;
|
||
color: inherit;
|
||
}
|
||
.person-chip:hover {
|
||
background: #f8fafc;
|
||
}
|
||
.person-chip.active {
|
||
color: #fff;
|
||
background: var(--el-color-primary, #10b981);
|
||
border-color: var(--el-color-primary, #10b981);
|
||
}
|
||
.person-chip.active em {
|
||
color: #fff;
|
||
}
|
||
.duty-cal {
|
||
width: 100%;
|
||
table-layout: fixed;
|
||
border-collapse: separate;
|
||
border-spacing: 0;
|
||
border: 1px solid var(--mint-border, #d9e8e2);
|
||
border-radius: 8px;
|
||
overflow: hidden;
|
||
}
|
||
.duty-cal th {
|
||
padding: 10px;
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
color: var(--mint-text-muted, #64748b);
|
||
background: #f8fafc;
|
||
border-bottom: 1px solid var(--mint-border, #d9e8e2);
|
||
}
|
||
.duty-cal th.wknd {
|
||
color: #dc2626;
|
||
}
|
||
.duty-cal td {
|
||
height: 120px;
|
||
padding: 6px;
|
||
vertical-align: top;
|
||
border-right: 1px solid var(--mint-border, #d9e8e2);
|
||
border-bottom: 1px solid var(--mint-border, #d9e8e2);
|
||
background: #fff;
|
||
cursor: default;
|
||
}
|
||
.duty-cal tr td:last-child {
|
||
border-right: none;
|
||
}
|
||
.duty-cal tr:last-child td {
|
||
border-bottom: none;
|
||
}
|
||
.duty-cal td.has-day {
|
||
cursor: pointer;
|
||
}
|
||
.duty-cal td.has-day:hover {
|
||
background: #f0fdf4;
|
||
}
|
||
.duty-cal td.muted {
|
||
background: #fafafa;
|
||
color: #94a3b8;
|
||
}
|
||
.day-num {
|
||
margin-bottom: 4px;
|
||
font-size: 14px;
|
||
font-weight: 600;
|
||
}
|
||
.duty-cal td.today .day-num {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 24px;
|
||
height: 24px;
|
||
color: #fff;
|
||
background: var(--el-color-primary, #10b981);
|
||
border-radius: 50%;
|
||
}
|
||
.chip {
|
||
display: block;
|
||
margin-bottom: 3px;
|
||
padding: 3px 6px;
|
||
overflow: hidden;
|
||
font-size: 14px;
|
||
line-height: 1.35;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
border-radius: 4px;
|
||
}
|
||
.chip.am {
|
||
color: #b45309;
|
||
background: #fffbeb;
|
||
}
|
||
.chip.pm {
|
||
color: #1d4ed8;
|
||
background: #eff6ff;
|
||
}
|
||
.chip.duty {
|
||
color: #b91c1c;
|
||
background: #fef2f2;
|
||
}
|
||
.chip.other {
|
||
color: #475569;
|
||
background: #f1f5f9;
|
||
}
|
||
.chip.empty {
|
||
color: var(--mint-text-muted, #64748b);
|
||
background: #f1f5f9;
|
||
border: 1px dashed #cbd5e1;
|
||
}
|
||
}
|
||
|
||
.duty-day-form {
|
||
.form-tip {
|
||
margin: 0 0 12px;
|
||
font-size: 13px;
|
||
color: var(--mint-text-muted, #64748b);
|
||
}
|
||
.slot-card {
|
||
margin-bottom: 12px;
|
||
padding: 12px;
|
||
background: #fafafa;
|
||
border: 1px solid var(--mint-border, #d9e8e2);
|
||
border-radius: 8px;
|
||
}
|
||
.slot-hd {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 12px;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-bottom: 8px;
|
||
}
|
||
.slot-fields-row {
|
||
margin-bottom: 4px;
|
||
:deep(.el-form-item) {
|
||
margin-bottom: 0;
|
||
}
|
||
}
|
||
.cap-field {
|
||
display: flex;
|
||
gap: 8px;
|
||
align-items: center;
|
||
font-size: 13px;
|
||
}
|
||
.person-tags {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 6px;
|
||
margin-top: 4px;
|
||
}
|
||
.empty-tip {
|
||
font-size: 12px;
|
||
color: var(--mint-text-muted, #94a3b8);
|
||
}
|
||
.add-shift-row {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 8px;
|
||
align-items: center;
|
||
margin: 4px 0 12px;
|
||
}
|
||
.link-box {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 8px;
|
||
align-items: center;
|
||
margin-top: 12px;
|
||
padding: 10px 12px;
|
||
font-size: 12px;
|
||
background: var(--el-color-primary-light-9, #ecfdf5);
|
||
border: 1px solid #a7f3d0;
|
||
border-radius: 8px;
|
||
}
|
||
.link-box code {
|
||
flex: 1;
|
||
min-width: 160px;
|
||
word-break: break-all;
|
||
color: var(--el-color-primary-dark-2, #059669);
|
||
}
|
||
}
|
||
</style>
|