From 93c133349a5ccd7a328371fa113dce69d5611f21 Mon Sep 17 00:00:00 2001
From: liuyu <yu.liu@cqgbkj.com>
Date: 星期二, 22 九月 2026 09:25:39 +0800
Subject: [PATCH] feat(tms): 完成课程考试自测等页面与接口对接
---
apps/jnpf-web-apps-main/src/views/x/tms/record/index.vue | 112 ++++++++++++++++++++++++++++++++-----------------------
1 files changed, 65 insertions(+), 47 deletions(-)
diff --git a/apps/jnpf-web-apps-main/src/views/x/tms/record/index.vue b/apps/jnpf-web-apps-main/src/views/x/tms/record/index.vue
index cdae71f..5f7ccde 100644
--- a/apps/jnpf-web-apps-main/src/views/x/tms/record/index.vue
+++ b/apps/jnpf-web-apps-main/src/views/x/tms/record/index.vue
@@ -3,7 +3,7 @@
import type { RecordListMode, TmsRecordListItem } from './types';
-import { computed, watch } from 'vue';
+import { computed, onMounted, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useMessage } from '@jnpf/hooks';
@@ -12,8 +12,11 @@
import { Modal } from 'ant-design-vue';
import { archiveTmsRecords, deleteTmsRecords, getTmsRecordList } from '#/api/x/tms/record';
+import { TMS_BTN } from '#/views/x/tms/shared/ui';
-import { LIST_MODE_LABEL, RECORD_LIST_PATH } from './constants';
+import { LIST_MODE_LABEL, RECORD_LIST_PATH, labelOfCategory, labelOfEvalMode, labelOfTrainMode, loadRecordDics } from './constants';
+
+import '#/views/x/tms/shared/page.css';
defineOptions({ name: 'TmsRecord' });
@@ -35,7 +38,12 @@
const columns: BasicColumn[] = [
{ title: '缂栧彿', dataIndex: 'recordNo', width: 140 },
- { title: '鍩硅鍒嗙被', dataIndex: 'category', width: 120 },
+ {
+ title: '鍩硅鍒嗙被',
+ dataIndex: 'category',
+ width: 120,
+ customRender: ({ record }) => labelOfCategory((record as TmsRecordListItem).category),
+ },
{
title: '鍩硅涓婚',
dataIndex: 'subject',
@@ -43,9 +51,22 @@
slots: { default: 'subject' },
},
{ title: '鍩硅甯�', dataIndex: 'trainerName', width: 100 },
- { title: '鍩硅绫诲瀷', dataIndex: 'trainType', width: 110 },
+ {
+ title: '鍩硅绫诲瀷',
+ dataIndex: 'trainType',
+ width: 110,
+ customRender: ({ record }) => {
+ const row = record as TmsRecordListItem;
+ return labelOfTrainMode(row.trainMode || row.trainType);
+ },
+ },
{ title: '鍩硅寮�濮嬫椂闂�', dataIndex: 'startTime', width: 160 },
- { title: '鑰冩牳鏂瑰紡', dataIndex: 'evalMode', width: 110 },
+ {
+ title: '鑰冩牳鏂瑰紡',
+ dataIndex: 'evalMode',
+ width: 110,
+ customRender: ({ record }) => labelOfEvalMode((record as TmsRecordListItem).evalMode),
+ },
];
const [registerTable, { reload, getSelectRows }] = useVxeTable({
@@ -59,6 +80,7 @@
baseColProps: { span: 6 },
compact: true,
showAdvancedButton: true,
+ alwaysShowLines: 1,
autoAdvancedLine: 1,
schemas: [
{
@@ -100,12 +122,20 @@
() => reload(),
);
+onMounted(() => {
+ loadRecordDics();
+});
+
async function fetchList(params: Record<string, any>) {
+ const page = await getTmsRecordList({
+ ...params,
+ listMode: listMode.value,
+ });
return {
- data: await getTmsRecordList({
- ...params,
- listMode: listMode.value,
- }),
+ data: {
+ list: Array.isArray(page?.list) ? page.list : [],
+ pagination: page?.pagination || { total: 0 },
+ },
};
}
@@ -139,19 +169,13 @@
router.push(RECORD_LIST_PATH[mode]);
}
-function handleQrcode() {
- const row = requireOneRow();
- if (!row) return;
- createMessage.success(`宸茬敓鎴愩��${row.recordNo}銆嶇鍒颁簩缁寸爜锛堟帴鍙h仈璋冨悗鐢熸晥锛塦);
-}
-
-function handleAdd() {
- createMessage.info('鏂板鍩硅璁板綍锛堣仈璋冧换鍔″彂甯冨悗鐢辩郴缁熻嚜鍔ㄧ敓鎴愶紝鎵嬪伐鏂板寰呭悗绔帴鍙o級');
-}
-
function handleEdit() {
const row = requireOneRow();
if (!row) return;
+ if (row.archiveStatus === 'archived' || isArchivedView.value) {
+ createMessage.warning('宸插綊妗h褰曚笉鍙慨鏀�');
+ return;
+ }
router.push(`/tms/record/edit/${row.id}`);
}
@@ -164,10 +188,8 @@
});
}
-function handleSign() {
- const row = requireOneRow();
- if (!row) return;
- router.push(`/tms/record/sign/${row.id}`);
+function handleAdminSignUnavailable() {
+ createMessage.info('绠$悊绔ˉ绛�/鎵爜绛惧埌鍗冲皢鎺ュ叆锛岃瀛﹀憳鍦ㄣ�屼釜浜哄煿璁换鍔°�嶄腑瀹屾垚绛惧埌');
}
function handleDelete() {
@@ -207,14 +229,7 @@
}
function getTableActions(record: TmsRecordListItem): ActionItem[] {
- const actions: ActionItem[] = [{ label: '鏌ョ湅', onClick: handleView.bind(null, record) }];
- if (isMainView.value) {
- actions.push({
- label: '绛惧埌',
- onClick: () => router.push(`/tms/record/sign/${record.id}`),
- });
- }
- return actions;
+ return [{ label: TMS_BTN.detail, onClick: handleView.bind(null, record) }];
}
</script>
@@ -226,33 +241,36 @@
<template #tableTitle>
<!-- 1. 鍩硅璁板綍 -->
<a-space v-if="isMainView" wrap>
- <a-button pre-icon="icon-ym icon-ym-generator-qrcode" @click="handleQrcode">鐢熸垚浜岀淮鐮�</a-button>
- <a-button pre-icon="icon-ym icon-ym-btn-edit" @click="handleEdit">淇敼</a-button>
- <a-button pre-icon="icon-ym icon-ym-btn-preview" @click="handleView()">鏌ョ湅</a-button>
- <a-button pre-icon="icon-ym icon-ym-extend-form" @click="handleSign">绛惧埌</a-button>
+ <a-button pre-icon="icon-ym icon-ym-btn-edit" @click="handleEdit">{{ TMS_BTN.edit }}</a-button>
+ <a-button pre-icon="icon-ym icon-ym-btn-preview" @click="handleView()">{{ TMS_BTN.detail }}</a-button>
+ <a-button pre-icon="icon-ym icon-ym-extend-form" @click="handleAdminSignUnavailable">
+ {{ TMS_BTN.sign }}
+ </a-button>
<a-button pre-icon="icon-ym icon-ym-file-text" @click="goList('ready')">鍙綊妗e垪琛�</a-button>
<a-button pre-icon="icon-ym icon-ym-extend-folder" @click="goList('archived')">宸插綊妗e垪琛�</a-button>
- <span class="text-gray-400 text-sm">褰撳墠锛歿{ listModeTitle }}</span>
+ <span class="tms-toolbar-hint">褰撳墠锛歿{ listModeTitle }} 路 璁板綍鐢变换鍔″彂甯冭嚜鍔ㄧ敓鎴�</span>
</a-space>
<!-- 2. 鍙綊妗e垪琛� -->
<a-space v-else-if="isReadyView" wrap>
- <a-button type="primary" pre-icon="icon-ym icon-ym-btn-add" @click="handleAdd">鏂板</a-button>
- <a-button pre-icon="icon-ym icon-ym-btn-edit" @click="handleEdit">淇敼</a-button>
- <a-button danger pre-icon="icon-ym icon-ym-btn-clearn" @click="handleDelete">鍒犻櫎</a-button>
- <a-button pre-icon="icon-ym icon-ym-extend-folder" @click="handleArchive">褰掓。</a-button>
- <a-button @click="goList('main')">杩斿洖</a-button>
+ <a-button pre-icon="icon-ym icon-ym-btn-edit" @click="handleEdit">{{ TMS_BTN.edit }}</a-button>
+ <a-button danger pre-icon="icon-ym icon-ym-btn-clearn" @click="handleDelete">
+ {{ TMS_BTN.delete }}
+ </a-button>
+ <a-button type="primary" pre-icon="icon-ym icon-ym-extend-folder" @click="handleArchive">
+ {{ TMS_BTN.archive }}
+ </a-button>
+ <a-button @click="goList('main')">{{ TMS_BTN.back }}</a-button>
<a-button pre-icon="icon-ym icon-ym-file-text" @click="goList('archived')">宸插綊妗e垪琛�</a-button>
- <span class="text-gray-400 text-sm">褰撳墠锛歿{ listModeTitle }}</span>
+ <span class="tms-toolbar-hint">褰撳墠锛歿{ listModeTitle }}</span>
</a-space>
<!-- 3. 宸插綊妗e垪琛� -->
<a-space v-else wrap>
- <a-button @click="handleView()">鏌ョ湅</a-button>
- <a-button @click="handleEdit">淇敼</a-button>
- <a-button @click="goList('main')">杩斿洖</a-button>
- <a-button type="primary" @click="goList('ready')">鍙綊妗e垪琛�</a-button>
- <span class="text-gray-400 text-sm">褰撳墠锛歿{ listModeTitle }}</span>
+ <a-button @click="handleView()">{{ TMS_BTN.detail }}</a-button>
+ <a-button @click="goList('main')">{{ TMS_BTN.back }}</a-button>
+ <a-button type="primary" ghost @click="goList('ready')">鍙綊妗e垪琛�</a-button>
+ <span class="tms-toolbar-hint">褰撳墠锛歿{ listModeTitle }} 路 宸插綊妗d笉鍙慨鏀�</span>
</a-space>
</template>
<template #subject="{ record }">
--
Gitblit v1.8.0