优化店务端员工删除确认样式
This commit is contained in:
@@ -35,23 +35,53 @@
|
||||
</section>
|
||||
|
||||
<section class="card delete-panel section">
|
||||
<div>
|
||||
<strong>删除员工</strong>
|
||||
<p>删除后该员工会从当前店铺员工列表移除,登录账号仍会保留。</p>
|
||||
<div class="delete-panel__head">
|
||||
<div class="delete-panel__icon">
|
||||
<TriangleAlert :size="18" aria-hidden="true" />
|
||||
</div>
|
||||
<div class="delete-panel__copy">
|
||||
<div class="delete-panel__title">
|
||||
<strong>删除员工</strong>
|
||||
<span class="danger-badge">危险操作</span>
|
||||
</div>
|
||||
<p>删除后该员工会从当前店铺员工列表移除,登录账号仍会保留。</p>
|
||||
</div>
|
||||
</div>
|
||||
<button class="danger-btn" type="button" :disabled="deletingEmployee" @click="requestDeleteEmployee">
|
||||
{{ deletingEmployee ? '删除中...' : '删除员工' }}
|
||||
<div class="delete-panel__facts">
|
||||
<span>移除店铺关系</span>
|
||||
<span>保留登录账号</span>
|
||||
</div>
|
||||
<button class="danger-btn delete-panel__action" type="button" :disabled="deletingEmployee" @click="requestDeleteEmployee">
|
||||
<Trash2 :size="15" aria-hidden="true" />
|
||||
<span>{{ deletingEmployee ? '删除中...' : '删除员工' }}</span>
|
||||
</button>
|
||||
</section>
|
||||
<div v-if="deleteConfirmVisible" class="reset-confirm delete-confirm">
|
||||
<p>确定要删除该员工吗?该操作只移除当前店铺员工关系,不会删除登录账号。</p>
|
||||
<div class="reset-confirm__actions">
|
||||
<button class="secondary-btn" type="button" :disabled="deletingEmployee" @click="deleteConfirmVisible = false">取消</button>
|
||||
<button class="danger-btn" type="button" :disabled="deletingEmployee" @click="confirmDeleteEmployee">
|
||||
{{ deletingEmployee ? '删除中...' : '确认删除' }}
|
||||
</button>
|
||||
<BaseModal
|
||||
:model-value="deleteConfirmVisible"
|
||||
title="确认删除员工"
|
||||
:close-disabled="deletingEmployee"
|
||||
panel-class="employee-delete-confirm-modal"
|
||||
@update:model-value="deleteConfirmVisible = $event"
|
||||
>
|
||||
<div class="delete-confirm">
|
||||
<div class="delete-confirm__icon">
|
||||
<TriangleAlert :size="22" aria-hidden="true" />
|
||||
</div>
|
||||
<h3>确认删除员工</h3>
|
||||
<p>该操作只会移除当前店铺员工关系,不会删除员工登录账号和历史订单。</p>
|
||||
<div class="delete-confirm__facts">
|
||||
<div><span>员工列表</span><strong>移除</strong></div>
|
||||
<div><span>登录账号</span><strong>保留</strong></div>
|
||||
</div>
|
||||
<div class="delete-confirm__actions">
|
||||
<button class="secondary-btn" type="button" :disabled="deletingEmployee" @click="deleteConfirmVisible = false">取消</button>
|
||||
<button class="danger-btn" type="button" :disabled="deletingEmployee" @click="confirmDeleteEmployee">
|
||||
<Trash2 :size="15" aria-hidden="true" />
|
||||
<span>{{ deletingEmployee ? '删除中...' : '确认删除' }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</BaseModal>
|
||||
</template>
|
||||
<EmptyState v-else title="员工不存在" />
|
||||
|
||||
@@ -132,7 +162,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { KeyRound, Pencil, Trash2, Upload } from 'lucide-vue-next'
|
||||
import { KeyRound, Pencil, Trash2, TriangleAlert, Upload } from 'lucide-vue-next'
|
||||
import BaseModal from '@/components/BaseModal.vue'
|
||||
import DefaultPasswordNoticeModal from '@/components/DefaultPasswordNoticeModal.vue'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
@@ -557,34 +587,169 @@ watch(editModalVisible, syncEditDraft)
|
||||
}
|
||||
|
||||
.delete-panel {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
padding: 12px;
|
||||
border: 1px solid rgba(189, 71, 71, 0.16);
|
||||
background:
|
||||
linear-gradient(90deg, rgba(189, 71, 71, 0.08), rgba(255, 253, 248, 0) 46%),
|
||||
var(--card-bg);
|
||||
}
|
||||
|
||||
.delete-panel__head {
|
||||
display: grid;
|
||||
grid-template-columns: 42px 1fr;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.delete-panel__icon {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
border-radius: 14px;
|
||||
background: rgba(189, 71, 71, 0.12);
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.delete-panel__copy {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.delete-panel__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
padding: 14px;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.delete-panel strong,
|
||||
.delete-panel p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.delete-panel strong {
|
||||
display: block;
|
||||
.delete-panel__title strong {
|
||||
overflow: hidden;
|
||||
color: var(--ink);
|
||||
font-size: 14px;
|
||||
font-size: 15px;
|
||||
font-weight: 900;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.danger-badge {
|
||||
flex: 0 0 auto;
|
||||
min-height: 24px;
|
||||
padding: 3px 9px;
|
||||
border-radius: 999px;
|
||||
background: #fff3ef;
|
||||
color: var(--danger);
|
||||
font-size: 11px;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.delete-panel p {
|
||||
margin-top: 4px;
|
||||
color: var(--muted);
|
||||
margin: 5px 0 0;
|
||||
color: #71665d;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.delete-panel__facts {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.delete-panel__facts span {
|
||||
min-height: 34px;
|
||||
padding: 8px 10px;
|
||||
border-radius: 10px;
|
||||
background: rgba(255, 255, 255, 0.68);
|
||||
color: #6f625a;
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.delete-panel__action {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.delete-panel__action svg {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
:global(.employee-delete-confirm-modal) {
|
||||
align-self: center;
|
||||
width: min(calc(100vw - 32px), 340px);
|
||||
max-height: calc(100vh - 64px);
|
||||
border-radius: 18px;
|
||||
}
|
||||
|
||||
:global(.employee-delete-confirm-modal .modal-panel__head),
|
||||
:global(.employee-delete-confirm-modal .modal-panel__footer) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.delete-confirm {
|
||||
margin-top: 12px;
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
padding: 18px 16px 16px;
|
||||
}
|
||||
|
||||
.delete-confirm__icon {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
margin: 0 auto;
|
||||
border-radius: 16px;
|
||||
background: rgba(189, 71, 71, 0.12);
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.delete-confirm h3,
|
||||
.delete-confirm p {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.delete-confirm h3 {
|
||||
color: var(--ink);
|
||||
font-size: 18px;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.delete-confirm p {
|
||||
color: #6f665d;
|
||||
font-size: 13px;
|
||||
line-height: 1.65;
|
||||
}
|
||||
|
||||
.delete-confirm__facts {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.delete-confirm__facts div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 36px;
|
||||
padding: 9px 10px;
|
||||
border-radius: 10px;
|
||||
background: rgba(240, 236, 229, 0.7);
|
||||
color: #635c55;
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.delete-confirm__facts strong {
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.delete-confirm__actions {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.modal-form {
|
||||
|
||||
@@ -152,3 +152,11 @@
|
||||
- 处理方式:GitNexus 使用 `E:\Development\Node\node-v24\node.exe` 直接执行全局 `gitnexus/dist/cli/index.js`;前端验证使用 Node 24 直接执行本地 `vitest.mjs`、`vue-tsc.js`、`vite.js`。
|
||||
- 以后避免:涉及 GitNexus、Vite、Vitest、vue-tsc 的验证前先确认 `node --version`;如果默认不是 Node 20.19+ 或 22.12+,不要调用裸 `npm` 或 `.bin/*.cmd`。
|
||||
- 验证方式:`E:\Development\Node\node-v24\node.exe --version` 返回 v24.16.0;用该 Node 直接执行 GitNexus、Vitest、vue-tsc、Vite build 均通过。
|
||||
|
||||
## 2026-07-21 店务端 BaseModal 面板样式要用 :global
|
||||
|
||||
- 问题:在 `EmployeeDetailView.vue` 中把删除员工确认态改为 `BaseModal` 后,如果父组件 scoped CSS 直接写 `.employee-delete-confirm-modal .modal-panel__head`,样式不会命中弹窗内部面板,可能导致确认框仍按底部弹窗展示或标题栏无法隐藏。
|
||||
- 原因:`BaseModal` 内部节点由子组件渲染并 Teleport 到 body,普通 scoped 选择器会被编译成带父组件 `data-v-*` 的选择器,无法匹配子组件内部的 `modal-panel`、`modal-panel__head` 和 `modal-panel__footer`。
|
||||
- 处理方式:父组件通过 `panel-class` 定制 `BaseModal` 内部结构时,使用 `:global(.employee-delete-confirm-modal ...)`;父组件 slot 内容自身仍使用普通 scoped class。
|
||||
- 以后避免:新增居中确认弹窗或隐藏 `BaseModal` 头尾区域时,先参考 `AppointmentDetailView.vue` 的 `:global(.appointment-status-confirm-modal ...)` 写法,不要用普通 scoped 选择器打子组件内部节点。
|
||||
- 验证方式:运行 `vue-tsc` 和 `vite build` 后,在 `dist/assets` 中搜索目标 `panel-class`,确认面板选择器未被追加父组件 `data-v-*`;再用浏览器截图确认弹窗居中和头部隐藏生效。
|
||||
|
||||
Reference in New Issue
Block a user