feat(优化):年培训计划:已确认行的删除按钮、勾选框、批量删除均仅超级管理员可见/可用;提示文案随角色变化
deploy-hxtesting / build-and-deploy (push) Successful in 1m14s
deploy-hxtesting / build-and-deploy (push) Successful in 1m14s
课程管理:canDeleteCourse 超管不限状态/部门(已审核/已发布行可删,确认弹窗文案区分);批量删除按钮超管可见 月培训计划:已发布行的「删除」仅超管可见(普通维护角色仍只能删未发布计划),行内确认弹窗替代原 window.confirm,失败时透出后端文案 Training.vue:canManageTabs 加入 super_admin,纯超管(未兼其他角色)也能进入这三个页面执行删除
This commit is contained in:
1 parent
a448598df5
commit
2f1cda34da
19 files changed
+589
-278
No files matched your search
@@ -41,49 +41,52 @@
|
||||
<t-button variant="outline" @click="onSearchDemands">查询</t-button>
|
||||
<t-button variant="outline" @click="onResetDemandSearch">重置</t-button>
|
||||
<t-button v-if="canConfirm" theme="primary" variant="outline" :disabled="!selectedDemandKeys.length" :loading="batchSaving" @click="onBatchConfirm">批量确认</t-button>
|
||||
<t-button v-if="canManage" theme="danger" variant="outline" :disabled="!selectedDemandKeys.length" :loading="batchSaving" @click="onBatchDelete">批量删除</t-button>
|
||||
<span class="demand-selected-hint">已选 {{ selectedDemandKeys.length }} 项(可批量确认/删除未确认需求)</span>
|
||||
<t-button v-if="canManage || isSuperAdmin" theme="danger" variant="outline" :disabled="!selectedDemandKeys.length" :loading="batchSaving" @click="onBatchDelete">批量删除</t-button>
|
||||
<span class="demand-selected-hint">已选 {{ selectedDemandKeys.length }} 项(可批量确认/删除未确认需求{{ isSuperAdmin ? ';超级管理员可删除已确认需求' : '' }})</span>
|
||||
</div>
|
||||
<t-table
|
||||
v-model:selected-row-keys="selectedDemandKeys"
|
||||
:data="pagedDemands"
|
||||
:columns="demandColumns"
|
||||
row-key="id"
|
||||
size="small"
|
||||
:loading="loading"
|
||||
>
|
||||
<template #dept_name="{ row }">{{ row.dept_name || '-' }}</template>
|
||||
<template #code="{ row }">
|
||||
<t-tooltip v-if="row.code" :content="row.code">
|
||||
<span class="cell-ellipsis">{{ row.code }}</span>
|
||||
</t-tooltip>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #lecturer_name="{ row }">{{ row.lecturer_name || '-' }}</template>
|
||||
<!-- 计划培训月份入库格式「YYYY-M」(如 2027-1),原样展示 -->
|
||||
<template #planned_time="{ row }">{{ row.planned_time || '-' }}</template>
|
||||
<template #location="{ row }">{{ row.location || '-' }}</template>
|
||||
<!-- 适合人员/备注可能很长:单行省略,悬停浮出全部内容 -->
|
||||
<template #post_scope="{ row }">
|
||||
<t-tooltip v-if="row.post_scope" :content="row.post_scope">
|
||||
<span class="cell-ellipsis">{{ row.post_scope }}</span>
|
||||
</t-tooltip>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #remark="{ row }">
|
||||
<t-tooltip v-if="row.remark" :content="row.remark">
|
||||
<span class="cell-ellipsis">{{ row.remark }}</span>
|
||||
</t-tooltip>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<!-- 创建人(提报人姓名)/创建时间:记录需求由谁何时录入 -->
|
||||
<template #submitter_name="{ row }">{{ row.submitter_name || '-' }}</template>
|
||||
<template #created_at="{ row }">{{ fmtBeijingTime(row.created_at) || '-' }}</template>
|
||||
<template #check_status="{ row }">
|
||||
<t-tag v-if="row.check_status === 'passed'" theme="success" variant="light" size="small">已确认</t-tag>
|
||||
<t-tag v-else-if="row.check_status === 'pending'" theme="warning" variant="light" size="small">待核验</t-tag>
|
||||
<t-tag v-else theme="default" variant="light" size="small">已修正</t-tag>
|
||||
</template>
|
||||
<!-- 表格滚动区:面板满屏,筛选/表头/分页固定,仅数据行滚动(height=100% 启用固定表头) -->
|
||||
<div class="table-scroll">
|
||||
<t-table
|
||||
v-model:selected-row-keys="selectedDemandKeys"
|
||||
:data="pagedDemands"
|
||||
:columns="demandColumns"
|
||||
row-key="id"
|
||||
size="small"
|
||||
height="100%"
|
||||
:loading="loading"
|
||||
>
|
||||
<template #dept_name="{ row }">{{ row.dept_name || '-' }}</template>
|
||||
<template #code="{ row }">
|
||||
<t-tooltip v-if="row.code" :content="row.code">
|
||||
<span class="cell-ellipsis">{{ row.code }}</span>
|
||||
</t-tooltip>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #lecturer_name="{ row }">{{ row.lecturer_name || '-' }}</template>
|
||||
<!-- 计划培训月份入库格式「YYYY-M」(如 2027-1),原样展示 -->
|
||||
<template #planned_time="{ row }">{{ row.planned_time || '-' }}</template>
|
||||
<template #location="{ row }">{{ row.location || '-' }}</template>
|
||||
<!-- 适合人员/备注可能很长:单行省略,悬停浮出全部内容 -->
|
||||
<template #post_scope="{ row }">
|
||||
<t-tooltip v-if="row.post_scope" :content="row.post_scope">
|
||||
<span class="cell-ellipsis">{{ row.post_scope }}</span>
|
||||
</t-tooltip>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #remark="{ row }">
|
||||
<t-tooltip v-if="row.remark" :content="row.remark">
|
||||
<span class="cell-ellipsis">{{ row.remark }}</span>
|
||||
</t-tooltip>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<!-- 创建人(提报人姓名)/创建时间:记录需求由谁何时录入 -->
|
||||
<template #submitter_name="{ row }">{{ row.submitter_name || '-' }}</template>
|
||||
<template #created_at="{ row }">{{ fmtBeijingTime(row.created_at) || '-' }}</template>
|
||||
<template #check_status="{ row }">
|
||||
<t-tag v-if="row.check_status === 'passed'" theme="success" variant="light" size="small">已确认</t-tag>
|
||||
<t-tag v-else-if="row.check_status === 'pending'" theme="warning" variant="light" size="small">待核验</t-tag>
|
||||
<t-tag v-else theme="default" variant="light" size="small">已修正</t-tag>
|
||||
</template>
|
||||
<template #op="{ row }">
|
||||
<template v-if="row.status !== 'confirmed'">
|
||||
<t-button
|
||||
@@ -97,8 +100,16 @@
|
||||
<t-button variant="text" theme="danger" size="small">删除</t-button>
|
||||
</t-popconfirm>
|
||||
</template>
|
||||
<!-- 已确认需求纳入年度排期,普通角色不可删;超级管理员职称角色放开终态删除 -->
|
||||
<t-popconfirm
|
||||
v-else-if="isSuperAdmin"
|
||||
content="该需求已确认,删除后不可恢复,确定删除?" theme="danger" @confirm="onDeleteDemand(row)"
|
||||
>
|
||||
<t-button variant="text" theme="danger" size="small">删除</t-button>
|
||||
</t-popconfirm>
|
||||
</template>
|
||||
</t-table>
|
||||
</t-table>
|
||||
</div>
|
||||
<!-- 共用分页(000163):默认每页 15 条 -->
|
||||
<TrainingPagination v-model:current="demandPage" v-model:page-size="demandPageSize" :total="demandTotal" />
|
||||
</div>
|
||||
@@ -421,8 +432,14 @@ const deptDisplay = computed(() => {
|
||||
return myDeptName.value
|
||||
})
|
||||
|
||||
const demandColumns = [
|
||||
{ colKey: 'row-select', type: 'multiple', width: 44, disabled: ({ row }: { row: TrainingDemand }) => row.status === 'confirmed' },
|
||||
// 超级管理员职称角色(super_admin):终态数据(已确认需求等)删除权唯一入口;
|
||||
// roles 已按权限组展开,自定义角色继承「超级管理员」权限组后同样命中
|
||||
const isSuperAdmin = computed(() => props.roles.includes('super_admin'))
|
||||
|
||||
// 已确认行默认禁止勾选(批量确认/删除仅作用于未确认需求);超级管理员可勾选
|
||||
// 以批量删除,故勾选禁用按角色动态计算(computed 随 props.roles 就绪刷新)
|
||||
const demandColumns = computed(() => [
|
||||
{ colKey: 'row-select', type: 'multiple', width: 44, disabled: ({ row }: { row: TrainingDemand }) => row.status === 'confirmed' && !isSuperAdmin.value },
|
||||
// 年计划编号(AP-<year>-####,创建时由服务端生成)
|
||||
{ colKey: 'code', title: '编号', width: 130 },
|
||||
{ colKey: 'course_name', title: '课程名称' },
|
||||
@@ -439,7 +456,7 @@ const demandColumns = [
|
||||
// 状态/操作固定在列表右侧,横向滚动时始终可见
|
||||
{ colKey: 'check_status', title: '状态', width: 84, fixed: 'right' },
|
||||
{ colKey: 'op', title: '操作', width: 160, fixed: 'right' },
|
||||
]
|
||||
])
|
||||
|
||||
// 批量确认/删除(仅作用于未确认需求,已确认行不可勾选)
|
||||
const selectedDemandKeys = ref<string[]>([])
|
||||
@@ -482,9 +499,11 @@ const onBatchConfirm = async () => {
|
||||
}
|
||||
|
||||
const onBatchDelete = async () => {
|
||||
const rows = demands.value.filter((d) => selectedDemandKeys.value.includes(d.id) && d.status !== 'confirmed')
|
||||
// 勾选口径:未确认行全员可勾;已确认行仅超级管理员可勾(isSuperAdmin 放开勾选),
|
||||
// 后端按行校验终态删除权,越权行整批报错提示
|
||||
const rows = demands.value.filter((d) => selectedDemandKeys.value.includes(d.id))
|
||||
if (!rows.length) {
|
||||
MessagePlugin.warning('请先勾选未确认的需求')
|
||||
MessagePlugin.warning('请先勾选要删除的需求')
|
||||
return
|
||||
}
|
||||
batchSaving.value = true
|
||||
@@ -1043,6 +1062,12 @@ onMounted(() => {
|
||||
.training-form-hints-below();
|
||||
}
|
||||
|
||||
// 满屏列表布局(000164):页头固定,面板占满页身剩余高度,
|
||||
// 筛选区/表头/分页固定,仅表格数据区滚动
|
||||
.plan-panel {
|
||||
.training-fill-panel();
|
||||
}
|
||||
|
||||
// 已确认行不做整行置灰:t-table 行选择列 disabled 命中时会加 __row--disabled
|
||||
// 类(整行 text-color-disabled),业务上已确认行仅禁止勾选,文字保持正常色
|
||||
:deep(.t-table__row--disabled) {
|
||||
|
||||
Reference in new issue
Block a user