feat: 重构操作按钮为下拉菜单并新增工单详情弹窗
- 重构角色、菜单、项目方案、客户账号页面的操作按钮,将多个操作整合为下拉菜单 - 统一使用 Modal.confirm 替代 Popconfirm 解决下拉菜单内锚定问题 - 新增勘察工单详情弹窗,支持查看工单完整信息 - 调整操作列宽度和对齐方式,优化表格布局 - 统一中文 locale 配置,使用 dayjs 中文 locale
This commit is contained in:
1 parent
ae79d5157b
commit
e03fb019c5
6 files changed
+497
-230
No files matched your search
@@ -60,22 +60,18 @@
|
||||
<a-badge :count="(record.details || []).length" :number-style="{ backgroundColor: '#1677ff' }" />
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button type="link" size="small" @click="handleView(record)">
|
||||
<template #icon><SearchOutlined /></template>
|
||||
明细
|
||||
</a-button>
|
||||
<a-button type="link" size="small" @click="handleEdit(record)">
|
||||
<template #icon><EditOutlined /></template>
|
||||
编辑
|
||||
</a-button>
|
||||
<a-popconfirm title="确定要删除该方案吗?" ok-text="确定" cancel-text="取消" @confirm="handleDelete(record.id)">
|
||||
<a-button type="link" size="small" danger>
|
||||
<template #icon><DeleteOutlined /></template>
|
||||
删除
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
<div class="row-actions">
|
||||
<a-button type="primary" size="small" @click="handleEdit(record)">编辑</a-button>
|
||||
<a-dropdown trigger="click">
|
||||
<a-button type="link" size="small">更多 <DownOutlined /></a-button>
|
||||
<template #overlay>
|
||||
<a-menu @click="({ key }) => handleMore(key as string, record)">
|
||||
<a-menu-item key="view">明细</a-menu-item>
|
||||
<a-menu-item key="delete" danger>删除</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -183,8 +179,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { SearchOutlined, ReloadOutlined, PlusOutlined, DeleteOutlined, EditOutlined } from '@ant-design/icons-vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { SearchOutlined, ReloadOutlined, PlusOutlined, DownOutlined } from '@ant-design/icons-vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { projectPlanApi, type ProjectPlanInfo, type ProjectPlanQuery, type PlanDetail } from '@/api/projectPlan';
|
||||
import { customerApi } from '@/api/customer';
|
||||
@@ -227,7 +223,7 @@ const columns = [
|
||||
{ title: '登记时间', key: 'registerTime', width: 110 },
|
||||
{ title: '明细数', key: 'details', align: 'center' as const, width: 90 },
|
||||
{ title: '状态', key: 'status', align: 'center' as const, width: 90 },
|
||||
{ title: '操作', key: 'action', width: 180, fixed: 'right' as const },
|
||||
{ title: '操作', key: 'action', width: 150, align: 'center' as const, fixed: 'right' as const },
|
||||
];
|
||||
|
||||
const detailColumns = [
|
||||
@@ -418,6 +414,25 @@ async function handleDelete(id: number) {
|
||||
message.error('删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
// 「更多」下拉分发:删除需二次确认,popconfirm 在 dropdown 内无法正常锚定,改用 Modal.confirm
|
||||
function handleMore(key: string, record: ProjectPlanInfo) {
|
||||
if (key === 'view') return handleView(record);
|
||||
if (key === 'delete') return confirmDelete(record);
|
||||
}
|
||||
|
||||
function confirmDelete(record: ProjectPlanInfo) {
|
||||
Modal.confirm({
|
||||
title: '确认删除该方案?',
|
||||
content: `方案「${record.planNo}」及其明细将被删除。`,
|
||||
okText: '确认删除',
|
||||
okType: 'danger',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
return handleDelete(record.id);
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -459,6 +474,13 @@ async function handleDelete(id: number) {
|
||||
font-size: 14px;
|
||||
height: 100%;
|
||||
}
|
||||
.row-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 2px;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
:deep(.ant-btn-link) {
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user