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
@@ -46,97 +46,103 @@
|
||||
<span v-if="selectedKeys.length" class="library-filter-count">已选 {{ selectedKeys.length }} 项</span>
|
||||
</div>
|
||||
|
||||
<t-table
|
||||
v-model:selected-row-keys="selectedKeys"
|
||||
:data="pagedItems" :columns="columns" row-key="id" size="small" :loading="loading"
|
||||
>
|
||||
<template #code="{ row }">{{ row.code || '-' }}</template>
|
||||
<template #name="{ row }"><span class="clamp-2">{{ row.name }}</span></template>
|
||||
<template #description="{ row }">
|
||||
<t-tooltip v-if="row.description" :content="row.description">
|
||||
<span class="cell-ellipsis">{{ row.description }}</span>
|
||||
</t-tooltip>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #category="{ row }">
|
||||
<t-tag v-if="row.category" theme="primary" variant="light" size="small">{{ row.category }}</t-tag>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #type="{ row }">
|
||||
<t-tag :theme="row.type === 'elective' ? 'default' : 'warning'" variant="light" size="small">
|
||||
{{ row.type === 'elective' ? '选修课' : '必修课' }}
|
||||
</t-tag>
|
||||
</template>
|
||||
<template #mode="{ row }">
|
||||
<t-tag :theme="row.mode === 'online' ? 'primary' : 'default'" variant="light" size="small">
|
||||
{{ row.mode === 'online' ? '线上' : '线下' }}
|
||||
</t-tag>
|
||||
</template>
|
||||
<template #lecturer="{ row }">{{ lecturerText(row) }}</template>
|
||||
<template #hours="{ row }">{{ row.hours ? `${row.hours} 学时` : '-' }}</template>
|
||||
<template #owner_dept="{ row }">
|
||||
<span v-if="row.owner_dept_name" class="cell-ellipsis" :title="row.owner_dept_name">{{ row.owner_dept_name }}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #suitable_members="{ row }">
|
||||
<!-- 课程权限(000163,原「适合人员」):部门+人员展示文本 -->
|
||||
<span v-if="permissionText(row)" class="cell-ellipsis" :title="permissionText(row)">{{ permissionText(row) }}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #material="{ row }">
|
||||
<!-- 课件只展示有/无:有=已上传文件或已挂接知识库课件,点击直达课件管理抽屉 -->
|
||||
<t-tag v-if="hasMaterial(row)" theme="success" variant="light" size="small" class="cell-link" @click="openMaterialDrawer(row)">有</t-tag>
|
||||
<t-tag v-else theme="default" variant="light" size="small">无</t-tag>
|
||||
</template>
|
||||
<template #question="{ row }">
|
||||
<!-- 试题只展示有/无:有=课程已关联题库,点击直达试题管理抽屉 -->
|
||||
<t-tag v-if="(row.question_bank_count || 0) > 0" theme="success" variant="light" size="small" class="cell-link" @click="openQuestions(row)">有</t-tag>
|
||||
<t-tag v-else theme="default" variant="light" size="small">无</t-tag>
|
||||
</template>
|
||||
<template #created_at="{ row }">{{ fmtBeijingTime(row.created_at) || '-' }}</template>
|
||||
<!-- 创建人(联查 users):记录课程由谁录入 -->
|
||||
<template #creator_name="{ row }">{{ row.creator_name || '-' }}</template>
|
||||
<template #publish_status="{ row }">
|
||||
<t-tag
|
||||
:theme="row.publish_status === 'published' ? 'success' : row.publish_status === 'offline' ? 'default' : 'warning'"
|
||||
variant="light" size="small"
|
||||
>{{ publishStatusText(row.publish_status) }}</t-tag>
|
||||
</template>
|
||||
<!-- 审核状态(000157/000163):新增/编辑后待审核,课长/经理审核确认后
|
||||
即自动发布(无需再点发布) -->
|
||||
<template #verify_status="{ row }">
|
||||
<t-tag :theme="row.verify_status === 'confirmed' ? 'success' : 'warning'" variant="light" size="small">
|
||||
{{ row.verify_status === 'confirmed' ? '已审核' : '待审核' }}
|
||||
</t-tag>
|
||||
</template>
|
||||
<template #op="{ row }">
|
||||
<t-button v-if="canEditCourse(row)" variant="text" theme="primary" size="small" @click="openForm(row)">编辑</t-button>
|
||||
<t-button variant="text" size="small" @click="openMaterialDrawer(row)">课件</t-button>
|
||||
<t-button variant="text" size="small" @click="openQuestions(row)">试题</t-button>
|
||||
<t-popconfirm
|
||||
v-if="canVerifyCourse(row)"
|
||||
content="审核通过后将立即发布(权限范围内的部门和人员可在培训中心/培训计划中查看),确认审核通过?" theme="primary"
|
||||
@confirm="onVerify(row)"
|
||||
>
|
||||
<t-button variant="text" theme="primary" size="small">审核</t-button>
|
||||
</t-popconfirm>
|
||||
<!-- 下线(000163):下线后课程不能再被使用 —— 和信课程撤回、计划不可
|
||||
再选用、已建计划学习时提示「该课程已下线」;存量培训计划保留 -->
|
||||
<t-popconfirm
|
||||
v-if="canManage && row.publish_status === 'published'"
|
||||
content="下线后该课程不能再被使用:培训中心「和信课程」不再展示,培训计划不可再选用,已建计划学习时提示「该课程已下线」(已有培训计划不会消失)。确定下线?" theme="danger"
|
||||
@confirm="onSetPublishStatus(row, 'offline')"
|
||||
>
|
||||
<t-button variant="text" theme="danger" size="small">下线</t-button>
|
||||
</t-popconfirm>
|
||||
<!-- 表格滚动区:面板满屏,筛选/表头/分页固定,仅数据行滚动(height=100% 启用固定表头) -->
|
||||
<div class="table-scroll">
|
||||
<t-table
|
||||
v-model:selected-row-keys="selectedKeys"
|
||||
:data="pagedItems" :columns="columns" row-key="id" size="small" height="100%" :loading="loading"
|
||||
>
|
||||
<template #code="{ row }">{{ row.code || '-' }}</template>
|
||||
<template #name="{ row }"><span class="clamp-2">{{ row.name }}</span></template>
|
||||
<template #description="{ row }">
|
||||
<t-tooltip v-if="row.description" :content="row.description">
|
||||
<span class="cell-ellipsis">{{ row.description }}</span>
|
||||
</t-tooltip>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #category="{ row }">
|
||||
<t-tag v-if="row.category" theme="primary" variant="light" size="small">{{ row.category }}</t-tag>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #type="{ row }">
|
||||
<t-tag :theme="row.type === 'elective' ? 'default' : 'warning'" variant="light" size="small">
|
||||
{{ row.type === 'elective' ? '选修课' : '必修课' }}
|
||||
</t-tag>
|
||||
</template>
|
||||
<template #mode="{ row }">
|
||||
<t-tag :theme="row.mode === 'online' ? 'primary' : 'default'" variant="light" size="small">
|
||||
{{ row.mode === 'online' ? '线上' : '线下' }}
|
||||
</t-tag>
|
||||
</template>
|
||||
<template #lecturer="{ row }">{{ lecturerText(row) }}</template>
|
||||
<template #hours="{ row }">{{ row.hours ? `${row.hours} 学时` : '-' }}</template>
|
||||
<template #owner_dept="{ row }">
|
||||
<span v-if="row.owner_dept_name" class="cell-ellipsis" :title="row.owner_dept_name">{{ row.owner_dept_name }}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #suitable_members="{ row }">
|
||||
<!-- 课程权限(000163,原「适合人员」):部门+人员展示文本 -->
|
||||
<span v-if="permissionText(row)" class="cell-ellipsis" :title="permissionText(row)">{{ permissionText(row) }}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #material="{ row }">
|
||||
<!-- 课件只展示有/无:有=已上传文件或已挂接知识库课件,点击直达课件管理抽屉 -->
|
||||
<t-tag v-if="hasMaterial(row)" theme="success" variant="light" size="small" class="cell-link" @click="openMaterialDrawer(row)">有</t-tag>
|
||||
<t-tag v-else theme="default" variant="light" size="small">无</t-tag>
|
||||
</template>
|
||||
<template #question="{ row }">
|
||||
<!-- 试题只展示有/无:有=课程已关联题库,点击直达试题管理抽屉 -->
|
||||
<t-tag v-if="(row.question_bank_count || 0) > 0" theme="success" variant="light" size="small" class="cell-link" @click="openQuestions(row)">有</t-tag>
|
||||
<t-tag v-else theme="default" variant="light" size="small">无</t-tag>
|
||||
</template>
|
||||
<template #created_at="{ row }">{{ fmtBeijingTime(row.created_at) || '-' }}</template>
|
||||
<!-- 创建人(联查 users):记录课程由谁录入 -->
|
||||
<template #creator_name="{ row }">{{ row.creator_name || '-' }}</template>
|
||||
<template #publish_status="{ row }">
|
||||
<t-tag
|
||||
:theme="row.publish_status === 'published' ? 'success' : row.publish_status === 'offline' ? 'default' : 'warning'"
|
||||
variant="light" size="small"
|
||||
>{{ publishStatusText(row.publish_status) }}</t-tag>
|
||||
</template>
|
||||
<!-- 审核状态(000157/000163):新增/编辑后待审核,课长/经理审核确认后
|
||||
即自动发布(无需再点发布) -->
|
||||
<template #verify_status="{ row }">
|
||||
<t-tag :theme="row.verify_status === 'confirmed' ? 'success' : 'warning'" variant="light" size="small">
|
||||
{{ row.verify_status === 'confirmed' ? '已审核' : '待审核' }}
|
||||
</t-tag>
|
||||
</template>
|
||||
<template #op="{ row }">
|
||||
<t-button v-if="canEditCourse(row)" variant="text" theme="primary" size="small" @click="openForm(row)">编辑</t-button>
|
||||
<t-button variant="text" size="small" @click="openMaterialDrawer(row)">课件</t-button>
|
||||
<t-button variant="text" size="small" @click="openQuestions(row)">试题</t-button>
|
||||
<t-popconfirm
|
||||
v-if="canVerifyCourse(row)"
|
||||
content="审核通过后将立即发布(权限范围内的部门和人员可在培训中心/培训计划中查看),确认审核通过?" theme="primary"
|
||||
@confirm="onVerify(row)"
|
||||
>
|
||||
<t-button variant="text" theme="primary" size="small">审核</t-button>
|
||||
</t-popconfirm>
|
||||
<!-- 下线(000163):下线后课程不能再被使用 —— 和信课程撤回、计划不可
|
||||
再选用、已建计划学习时提示「该课程已下线」;存量培训计划保留 -->
|
||||
<t-popconfirm
|
||||
v-if="canManage && row.publish_status === 'published'"
|
||||
content="下线后该课程不能再被使用:培训中心「和信课程」不再展示,培训计划不可再选用,已建计划学习时提示「该课程已下线」(已有培训计划不会消失)。确定下线?" theme="danger"
|
||||
@confirm="onSetPublishStatus(row, 'offline')"
|
||||
>
|
||||
<t-button variant="text" theme="danger" size="small">下线</t-button>
|
||||
</t-popconfirm>
|
||||
<t-popconfirm
|
||||
v-if="canDeleteCourse(row)"
|
||||
content="仅待审核状态的课程可删除,确定删除该课程?已创建的月培训计划不受影响。" theme="danger" @confirm="onDelete(row)"
|
||||
:content="row.verify_status === 'pending'
|
||||
? '确定删除该课程?已创建的月培训计划不受影响。'
|
||||
: '该课程已审核,删除后已创建的月培训计划不受影响但课程不可恢复,确定删除?'"
|
||||
theme="danger" @confirm="onDelete(row)"
|
||||
>
|
||||
<t-button variant="text" theme="danger" size="small">删除</t-button>
|
||||
</t-popconfirm>
|
||||
</template>
|
||||
</t-table>
|
||||
<t-button variant="text" theme="danger" size="small">删除</t-button>
|
||||
</t-popconfirm>
|
||||
</template>
|
||||
</t-table>
|
||||
</div>
|
||||
<!-- 共用分页(000163):默认每页 15 条 -->
|
||||
<TrainingPagination v-model:current="itemPage" v-model:page-size="itemPageSize" :total="itemTotal" />
|
||||
</div>
|
||||
@@ -725,16 +731,19 @@ const hasPermSet = (row: TrainingLibraryCourse) =>
|
||||
// 审核/删除权限(000157):严格限「本部门课长/经理」——人事/空间管理员一律无
|
||||
// 跨部门审核/删除权(roles 已按权限组展开,经理经课长继承自动命中 supervisor)。
|
||||
const canVerify = computed(() => props.roles.includes('supervisor'))
|
||||
const canDelete = canVerify
|
||||
// 超级管理员职称角色(super_admin):终态数据删除权唯一入口,已审核/已发布课程
|
||||
// 与跨部门均可删(后端 DeleteCourseLibraryItem 同口径兜底);审核权不放宽
|
||||
const isSuperAdmin = computed(() => props.roles.includes('super_admin'))
|
||||
const canDelete = computed(() => canVerify.value || isSuperAdmin.value)
|
||||
// 仅本部门「待审核」课程可审核/删除;与后端 callerVerifyDeptScope 同口径:
|
||||
// 无部门身份或课程所属部门与本人不一致时一律不可操作。
|
||||
// 无部门身份或课程所属部门与本人不一致时一律不可操作。超级管理员不限状态/部门。
|
||||
const canVerifyCourse = (row: TrainingLibraryCourse) =>
|
||||
canVerify.value &&
|
||||
row.verify_status === 'pending' &&
|
||||
Boolean(myDeptId.value) &&
|
||||
Boolean(row.owner_dept_id) &&
|
||||
row.owner_dept_id === myDeptId.value
|
||||
const canDeleteCourse = canVerifyCourse
|
||||
const canDeleteCourse = (row: TrainingLibraryCourse) => isSuperAdmin.value || canVerifyCourse(row)
|
||||
|
||||
// 编辑权限:维护角色可编辑可见课程;无维护角色的学员仅可编辑「与我相关」课程
|
||||
// (本人创建或本人授课,后端兜底校验同口径)
|
||||
@@ -1057,10 +1066,11 @@ const onBatchVerify = async () => {
|
||||
}
|
||||
|
||||
const onBatchDelete = async () => {
|
||||
// 与后端口径一致:仅本部门待审核行提交(已审核/越权行跳过)
|
||||
// 与后端口径一致:普通角色仅本部门待审核行提交(已审核/越权行跳过);
|
||||
// 超级管理员不限状态/部门(canDeleteCourse 按角色过滤,终态行可整批删除)
|
||||
const rows = filteredItems.value.filter((r) => selectedKeys.value.includes(r.id) && canDeleteCourse(r))
|
||||
if (!rows.length) {
|
||||
MessagePlugin.warning('请先勾选本部门待审核状态的课程')
|
||||
MessagePlugin.warning(isSuperAdmin.value ? '请先勾选要删除的课程' : '请先勾选本部门待审核状态的课程')
|
||||
return
|
||||
}
|
||||
batchSaving.value = true
|
||||
@@ -1897,6 +1907,10 @@ onMounted(loadAll)
|
||||
.panel-box {
|
||||
.training-panel-box();
|
||||
}
|
||||
|
||||
// 满屏列表布局(000164):页头固定,面板占满页身剩余高度,
|
||||
// 筛选区/表头/分页固定,仅表格数据区滚动
|
||||
.training-fill-panel();
|
||||
}
|
||||
|
||||
.library-filters {
|
||||
|
||||
Reference in new issue
Block a user