Merge branch 'dev' into picture-feedback

This commit is contained in:
HTEWJ\26070045 committed 2026-10-29 11:04:59 +08:00
commit 34ad40778b
180 files changed
+13262 -5333

No files matched your search

@@ -1,13 +1,20 @@
<!--
features/equipment-acceptance/views/EquipmentAcceptanceConfigPage.vue
用途:设备验收预警配置页。按升级轮次编辑天数、第 4 轮开关和三个固定岗位。
依赖:equipment-acceptance.api、UserPickerDialog、userPicker.utils、vue-i18n。
逻辑:由 Chat 作业面的「预警配置」Tab 嵌入。同一岗位在多个轮次里共用一个人。
发送时刻不在本页,由排程 Cron 配置。非管理员只能查看。
依赖:equipment-acceptance.api、Element Plus、UserPickerDialog、userPicker.utils、vue-i18n。
逻辑:由 Chat 作业面的「预警配置」Tab 嵌入。样式和 ElConfigProvider 由作业面提供。
同一岗位在多个轮次里共用一个人。发送时刻不在本页,由排程 Cron 配置。非管理员只能查看。
-->
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import {
ElButton,
ElCard,
ElCheckbox,
ElInputNumber,
ElLoading,
} from 'element-plus';
import { BusinessError } from '@/shared/api/client';
import UserPickerDialog from '@/shared/components/UserPickerDialog.vue';
import { useMessage } from '@/shared/composables/useMessage';
@@ -60,6 +67,7 @@ const ROUNDS: Array<{ index: number; lines: RoundLine[] }> = [
const { t } = useI18n();
const msg = useMessage();
const vLoading = ElLoading.directive;
const loading = ref(false);
const saving = ref(false);
const days = ref<number[]>([30, 37, 44, 51]);
@@ -224,100 +232,74 @@ onMounted(() => {
</script>
<template>
<section class="min-h-0 flex-1 overflow-auto px-5 pb-6 pt-3">
<p class="mb-3 text-sm text-[#64748b]">{{ t('admin.equipmentAcceptance.configLead') }}</p>
<p v-if="loading" class="text-sm text-[#64748b]">{{ t('admin.equipmentAcceptance.loading') }}</p>
<template v-else>
<section class="overflow-hidden rounded-2xl border border-[#dce4ef] bg-white">
<div class="px-5 pb-2 pt-4">
<h2 class="text-sm font-bold text-[#142033]">{{ t('admin.equipmentAcceptance.configSheetTitle') }}</h2>
<p class="mt-1 text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.configSheetLead') }}</p>
<section v-loading="loading" class="ea-scroll">
<p class="ea-lead">{{ t('admin.equipmentAcceptance.configLead') }}</p>
<ElCard v-if="!loading" shadow="never" class="ea-config-card">
<template #header>
<h2 class="ea-card-title">{{ t('admin.equipmentAcceptance.configSheetTitle') }}</h2>
<p class="ea-lead">{{ t('admin.equipmentAcceptance.configSheetLead') }}</p>
</template>
<article
v-for="round in ROUNDS"
:key="round.index"
class="ea-round"
:class="round.index === ROUNDS.length - 1 ? 'ea-round--last' : ''"
>
<div class="ea-round__when">
<b>{{ t('admin.equipmentAcceptance.roundName', { n: round.index + 1 }) }}</b>
<label class="ea-days">
{{ t('admin.equipmentAcceptance.overPrefix') }}
<ElInputNumber
v-model="days[round.index]"
:min="1"
:step="1"
:precision="0"
:disabled="!editable"
controls-position="right"
/>
{{ t('admin.equipmentAcceptance.dayUnit') }}
</label>
<template v-if="round.index === 3">
<ElCheckbox v-model="round4Enabled" :disabled="!editable">
{{ t('admin.equipmentAcceptance.round4Enabled') }}
</ElCheckbox>
<p class="ea-lead">{{ t('admin.equipmentAcceptance.round4ShortHint') }}</p>
</template>
</div>
<div class="px-3 pb-2">
<article
v-for="round in ROUNDS"
:key="round.index"
class="relative ml-4 grid grid-cols-1 gap-3 border-l-2 border-[#c9d4e3] py-4 pl-7 sm:grid-cols-[168px_minmax(0,1fr)] sm:gap-x-5"
:class="round.index === ROUNDS.length - 1 ? 'border-transparent' : ''"
>
<span class="absolute -left-[7px] top-6 h-3 w-3 rounded-full border-2 border-white bg-[#1d4e89] shadow-[0_0_0_1px_#c9d4e3]"></span>
<div class="flex flex-col gap-2">
<b class="text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.roundName', { n: round.index + 1 }) }}</b>
<label class="flex items-center gap-2 text-[13px] text-[#64748b]">
{{ t('admin.equipmentAcceptance.overPrefix') }}
<input
v-model.number="days[round.index]"
class="h-10 w-[72px] rounded-lg border border-[#d5dee8] bg-[#f8fafc] text-center text-[22px] font-semibold text-[#142033] disabled:opacity-70"
type="number"
min="1"
:disabled="!editable"
/>
{{ t('admin.equipmentAcceptance.dayUnit') }}
</label>
<template v-if="round.index === 3">
<label class="flex items-center gap-1.5 text-[13px] font-bold text-[#142033]">
<input v-model="round4Enabled" class="h-4 w-4 accent-[#1d4e89]" type="checkbox" :disabled="!editable" />
{{ t('admin.equipmentAcceptance.round4Enabled') }}
</label>
<small class="text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.round4ShortHint') }}</small>
<div class="ea-round__who" :class="round.index === 3 && !round4Enabled ? 'is-muted' : ''">
<div v-for="(line, lineIndex) in round.lines" :key="`${round.index}-${lineIndex}`" class="ea-line">
<span class="ea-line__tag">{{ t(`admin.equipmentAcceptance.${line.tag}`) }}</span>
<div class="ea-line__body">
<template v-if="line.kind === 'plain'">
<p class="ea-line__text">{{ t(`admin.equipmentAcceptance.${line.text}`) }}</p>
<p v-if="line.note" class="ea-lead">{{ t(`admin.equipmentAcceptance.${line.note}`) }}</p>
</template>
</div>
<div class="flex flex-col gap-2" :class="round.index === 3 && !round4Enabled ? 'opacity-45' : ''">
<div v-for="(line, lineIndex) in round.lines" :key="`${round.index}-${lineIndex}`" class="flex items-start gap-2.5">
<span class="mt-1.5 w-9 shrink-0 text-xs font-bold text-[#64748b]">{{ t(`admin.equipmentAcceptance.${line.tag}`) }}</span>
<div class="min-w-0">
<template v-if="line.kind === 'plain'">
<p class="mt-1 text-sm font-semibold text-[#142033]">{{ t(`admin.equipmentAcceptance.${line.text}`) }}</p>
<p v-if="line.note" class="mt-1 text-xs text-[#94a3b8]">{{ t(`admin.equipmentAcceptance.${line.note}`) }}</p>
</template>
<div v-else class="flex flex-wrap gap-2">
<div
v-for="role in line.roles"
:key="role"
class="flex min-h-8 items-center gap-2 rounded-full bg-[#eef3f8] py-1 pl-1 pr-2"
>
<span class="grid h-6 w-6 place-items-center rounded-full bg-[#d7e4f2] text-xs font-bold text-[#1d4e89]">{{ roleInitial(role) }}</span>
<span class="flex flex-col leading-tight">
<strong class="text-[13px] text-[#142033]">{{ roleName(role) || t('admin.equipmentAcceptance.roleEmpty') }}</strong>
<span class="text-[11px] text-[#64748b]">{{ roleMeta(role) }}</span>
</span>
<button
v-if="editable"
class="text-xs font-bold text-[#1d4e89]"
type="button"
@click="openPicker(role)"
>
{{ roleIds[role] ? t('admin.equipmentAcceptance.replaceUser') : t('admin.equipmentAcceptance.selectUser') }}
</button>
<button
v-if="editable && roleIds[role]"
class="text-xs text-[#64748b]"
type="button"
@click="clearRole(role)"
>
{{ t('admin.equipmentAcceptance.clearUser') }}
</button>
</div>
</div>
<div v-else class="ea-people">
<div v-for="role in line.roles" :key="role" class="ea-person">
<span class="ea-person__avatar">{{ roleInitial(role) }}</span>
<span class="ea-person__text">
<strong>{{ roleName(role) || t('admin.equipmentAcceptance.roleEmpty') }}</strong>
<span>{{ roleMeta(role) }}</span>
</span>
<ElButton v-if="editable" link type="primary" @click="openPicker(role)">
{{ roleIds[role] ? t('admin.equipmentAcceptance.replaceUser') : t('admin.equipmentAcceptance.selectUser') }}
</ElButton>
<ElButton v-if="editable && roleIds[role]" link @click="clearRole(role)">
{{ t('admin.equipmentAcceptance.clearUser') }}
</ElButton>
</div>
</div>
</div>
</article>
</div>
</div>
<div class="flex items-center justify-between gap-4 border-t border-[#dce4ef] bg-[#fafbfd] px-5 py-3.5">
<span class="text-xs text-[#64748b]">{{ editable ? t('admin.equipmentAcceptance.configSaveHint') : t('admin.equipmentAcceptance.configReadOnly') }}</span>
<button
v-if="editable"
class="h-9 rounded-lg bg-[#1d4e89] px-4 text-[13px] font-bold text-white disabled:opacity-50"
type="button"
:disabled="saving"
@click="save"
>
{{ t('admin.equipmentAcceptance.saveConfig') }}
</button>
</div>
</section>
</template>
</article>
<div class="ea-config-foot">
<span>{{ editable ? t('admin.equipmentAcceptance.configSaveHint') : t('admin.equipmentAcceptance.configReadOnly') }}</span>
<ElButton v-if="editable" type="primary" :loading="saving" @click="save">
{{ t('admin.equipmentAcceptance.saveConfig') }}
</ElButton>
</div>
</ElCard>
<UserPickerDialog
v-model="pickerOpen"
@@ -329,3 +311,166 @@ onMounted(() => {
/>
</section>
</template>
<style scoped>
.ea-scroll {
flex: 1 1 auto;
min-height: 240px;
overflow: auto;
}
.ea-lead {
margin: 0;
font-size: var(--el-font-size-extra-small);
line-height: 1.4;
color: var(--el-text-color-secondary);
}
.ea-scroll > .ea-lead {
margin-bottom: 8px;
}
.ea-config-card :deep(.el-card__header) {
padding: 12px 16px 8px;
}
.ea-config-card :deep(.el-card__body) {
padding: 0 16px 12px;
}
.ea-card-title {
margin: 0 0 4px;
font-size: var(--el-font-size-base);
font-weight: var(--el-font-weight-primary);
color: var(--el-text-color-primary);
}
.ea-round {
position: relative;
display: grid;
grid-template-columns: 200px minmax(0, 1fr);
gap: 12px 20px;
margin-left: 12px;
border-left: 2px solid var(--el-border-color);
padding: 12px 0 12px 20px;
}
.ea-round--last {
border-left-color: transparent;
}
.ea-round::before {
content: '';
position: absolute;
left: -7px;
top: 18px;
width: 12px;
height: 12px;
border: 2px solid var(--el-bg-color);
border-radius: 999px;
background: var(--el-color-primary);
box-shadow: 0 0 0 1px var(--el-border-color);
}
.ea-round__when {
display: flex;
flex-direction: column;
gap: 8px;
color: var(--el-text-color-secondary);
font-size: var(--el-font-size-small);
}
.ea-days {
display: flex;
align-items: center;
gap: 8px;
}
.ea-days :deep(.el-input-number) {
width: 120px;
}
.ea-round__who.is-muted {
opacity: 0.45;
}
.ea-line {
display: flex;
align-items: flex-start;
gap: 8px;
margin-bottom: 8px;
}
.ea-line__tag {
flex: none;
width: 36px;
margin-top: 6px;
font-size: var(--el-font-size-extra-small);
font-weight: var(--el-font-weight-primary);
color: var(--el-text-color-secondary);
}
.ea-line__text {
margin: 6px 0 0;
color: var(--el-text-color-primary);
font-weight: var(--el-font-weight-primary);
}
.ea-people {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.ea-person {
display: flex;
align-items: center;
gap: 8px;
min-height: 32px;
padding: 4px 8px 4px 4px;
border-radius: 999px;
background: var(--el-fill-color-light);
}
.ea-person__avatar {
display: grid;
width: 24px;
height: 24px;
place-items: center;
border-radius: 999px;
background: var(--el-color-primary-light-8);
color: var(--el-color-primary);
font-size: var(--el-font-size-extra-small);
font-weight: var(--el-font-weight-primary);
}
.ea-person__text {
display: flex;
flex-direction: column;
line-height: 1.2;
color: var(--el-text-color-primary);
}
.ea-person__text span {
color: var(--el-text-color-secondary);
font-size: var(--el-font-size-extra-small);
}
.ea-config-foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin: 4px -16px 0;
padding: 12px 16px;
border-top: 1px solid var(--el-border-color-lighter);
color: var(--el-text-color-secondary);
font-size: var(--el-font-size-extra-small);
}
@media (max-width: 720px) {
.ea-round {
grid-template-columns: 1fr;
}
}
</style>