This commit is contained in:
1 parent
d12cb873e1
commit
d3dcd58274
3 files changed
+51
-7
No files matched your search
@@ -102,6 +102,7 @@ import {
|
||||
type WecomCheckinPageData,
|
||||
} from '@/api/training'
|
||||
import { fmtBeijingTime } from '@/utils/datetime'
|
||||
import { apiErrorMessage } from '@/utils/request'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
@@ -285,7 +286,7 @@ const exchangeSession = async (code: string, stateToken: string) => {
|
||||
window.history.replaceState(null, '', window.location.pathname)
|
||||
} catch (e: any) {
|
||||
state.value = 'blocked'
|
||||
errorMsg.value = e?.response?.data?.message || '免登失败,请重新扫码'
|
||||
errorMsg.value = apiErrorMessage(e, '免登失败,请重新扫码')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,7 +310,7 @@ const loadAnonPage = async (presetErr?: any) => {
|
||||
applyPage(data)
|
||||
} catch (e: any) {
|
||||
state.value = 'blocked'
|
||||
errorMsg.value = e?.response?.data?.message || presetErr?.response?.data?.message || '签到码无效或已过期,请重新扫码'
|
||||
errorMsg.value = apiErrorMessage(e, '') || apiErrorMessage(presetErr, '签到码无效或已过期,请重新扫码')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +393,9 @@ const sign = async () => {
|
||||
}
|
||||
} catch (e: any) {
|
||||
state.value = 'error'
|
||||
errorMsg.value = e?.response?.data?.message || '签到失败,请重试'
|
||||
// 000165 复测:透出后端具体原因(不在参加人员名单/工号无档案/当天性/防重放等),
|
||||
// 不再落到通用「签到失败,请重试」(后端错误信封为 {error:{message}},手写取值取不到)
|
||||
errorMsg.value = apiErrorMessage(e, '签到失败,请重试')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1235,17 +1235,19 @@ watch(
|
||||
|
||||
const courseColumns = [
|
||||
// 左侧列不固定(000154):计划编号/课程名称随横向滚动,状态/操作仍固定右侧
|
||||
// 000165 复测列序:授课时间/计划培训时间前移至课程名称之后,讲师/地点次之,
|
||||
// 形式/类型/学时/上报部门后移(关注信息优先)
|
||||
{ colKey: 'plan_code', title: '计划编号', width: 125 },
|
||||
{ colKey: 'name', title: '课程名称', width: 170 },
|
||||
{ colKey: 'mode', title: '形式', width: 70 },
|
||||
{ colKey: 'type', title: '类型', width: 70 },
|
||||
{ colKey: 'hours', title: '学时', width: 60 },
|
||||
{ colKey: 'reporter', title: '上报部门', width: 110 },
|
||||
{ colKey: 'teachTime', title: '授课时间', width: 130 },
|
||||
{ colKey: 'plannedTime', title: '计划培训时间', width: 150 },
|
||||
{ colKey: 'lecturer', title: '讲师', width: 100 },
|
||||
{ colKey: 'location', title: '地点', width: 110 },
|
||||
{ colKey: 'expected', title: '实/应人数', width: 90 },
|
||||
{ colKey: 'mode', title: '形式', width: 70 },
|
||||
{ colKey: 'type', title: '类型', width: 70 },
|
||||
{ colKey: 'hours', title: '学时', width: 60 },
|
||||
{ colKey: 'reporter', title: '上报部门', width: 110 },
|
||||
{ colKey: 'learnStatus', title: '学习状态', width: 90 },
|
||||
{ colKey: 'examStatus', title: '考试状态', width: 90 },
|
||||
{ colKey: 'status', title: '状态', width: 80, fixed: 'right' },
|
||||
|
||||
@@ -161,6 +161,26 @@ func (s *trainingService) resolveCourseLibraryDept(ctx context.Context, tenantID
|
||||
}
|
||||
}
|
||||
|
||||
// defaultCoursePermission 课程权限默认(000165 复测):未设置任何权限(perm 两列
|
||||
// 与存量 suitable_members 均为空)时默认「所属部门」可见,与前端表单默认口径
|
||||
// 一致; suitable_members 同步部门名作为展示/存量匹配文本。已设置则不动。
|
||||
func (s *trainingService) defaultCoursePermission(ctx context.Context, tenantID uint64, item *types.TrainingCourseLibrary) {
|
||||
if item.HasPermissionSet() || strings.TrimSpace(item.OwnerDeptID) == "" {
|
||||
return
|
||||
}
|
||||
item.PermDeptIDs = item.OwnerDeptID
|
||||
if strings.TrimSpace(item.SuitableMembers) == "" {
|
||||
if depts, err := s.org.ListDepts(ctx, tenantID); err == nil {
|
||||
for _, d := range depts {
|
||||
if d != nil && d.ID == item.OwnerDeptID {
|
||||
item.SuitableMembers = strings.TrimSpace(d.Name)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SaveCourseLibraryItem 新增/编辑课程管理条目(id 空 = 新增)。
|
||||
func (s *trainingService) SaveCourseLibraryItem(ctx context.Context, tenantID uint64, item *types.TrainingCourseLibrary, updaterID string) (*types.TrainingCourseLibrary, error) {
|
||||
if err := normalizeCourseLibrary(item); err != nil {
|
||||
@@ -174,6 +194,8 @@ func (s *trainingService) SaveCourseLibraryItem(ctx context.Context, tenantID ui
|
||||
item.VerifyStatus = types.CourseLibraryVerifyPending
|
||||
// 仅传部门名时按组织架构解析为 id(不阻断保存)。
|
||||
s.resolveCourseLibraryDept(ctx, tenantID, item)
|
||||
// 未填课程权限时默认「所属部门」可见(000165 复测,与前端表单默认同口径)。
|
||||
s.defaultCoursePermission(ctx, tenantID, item)
|
||||
// 所属部门默认创建人部门、支持修改(000165):前端表单默认当前登录人
|
||||
// 部门,不再服务端强制覆盖(000160 的强制口径放开);留空时保持为空,
|
||||
// 审核前由审核校验兜底拦截。
|
||||
@@ -388,12 +410,29 @@ func (s *trainingService) ImportCourseLibraryItems(ctx context.Context, tenantID
|
||||
return 0, werrors.NewBadRequestError("没有可导入的课程数据")
|
||||
}
|
||||
rows := make([]*types.TrainingCourseLibrary, 0, len(items))
|
||||
// 部门 id→名映射(000165 复测:未填课程权限的行默认「所属部门」可见时,同步部门名)
|
||||
deptNameByID := map[string]string{}
|
||||
if depts, err := s.org.ListDepts(ctx, tenantID); err == nil {
|
||||
for _, d := range depts {
|
||||
if d != nil && strings.TrimSpace(d.Name) != "" {
|
||||
deptNameByID[d.ID] = strings.TrimSpace(d.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range items {
|
||||
if err := normalizeCourseLibrary(item); err != nil {
|
||||
continue // 缺课程名称的行跳过(前端同步提示跳过行数)
|
||||
}
|
||||
// 仅传部门名的行按组织架构解析为 id(前端匹配失败/未传 id 的兜底)。
|
||||
s.resolveCourseLibraryDept(ctx, tenantID, item)
|
||||
// 000165 复测:未填课程权限的导入行默认「所属部门」可见(与新增表单默认同口径),
|
||||
// suitable_members 同步部门名作为展示/存量匹配文本;已设置(含存量自由文本)则不动。
|
||||
if !item.HasPermissionSet() && strings.TrimSpace(item.OwnerDeptID) != "" {
|
||||
item.PermDeptIDs = item.OwnerDeptID
|
||||
if strings.TrimSpace(item.SuitableMembers) == "" {
|
||||
item.SuitableMembers = deptNameByID[item.OwnerDeptID]
|
||||
}
|
||||
}
|
||||
item.ID = trainingNewID()
|
||||
item.TenantID = tenantID
|
||||
item.CreatorID = updaterID
|
||||
|
||||
Reference in new issue
Block a user