From 8534025c45b4736975730678b9ccf23570a75f95 Mon Sep 17 00:00:00 2001
From: liuyu <yu.liu@cqgbkj.com>
Date: 星期二, 22 九月 2026 09:25:48 +0800
Subject: [PATCH] feat(tms): 新增试卷、培训任务、个人任务页面

---
 apps/jnpf-web-apps-main/src/views/x/tms/question/index.vue |  127 ++++++++++++++++++++++++++++++++----------
 1 files changed, 96 insertions(+), 31 deletions(-)

diff --git a/apps/jnpf-web-apps-main/src/views/x/tms/question/index.vue b/apps/jnpf-web-apps-main/src/views/x/tms/question/index.vue
index f098095..0c97947 100644
--- a/apps/jnpf-web-apps-main/src/views/x/tms/question/index.vue
+++ b/apps/jnpf-web-apps-main/src/views/x/tms/question/index.vue
@@ -11,14 +11,16 @@
 
 import { Modal } from 'ant-design-vue';
 
-import { deleteQuestion, getQuestionBanks, getQuestionList } from '#/api/x/tms/question';
+import { getQuestionBanks, getQuestionList, invalidateQuestion } from '#/api/x/tms/question';
 
 import {
   QUESTION_TYPE_OPTIONS,
   STATUS_OPTIONS,
   labelOfStatus,
   labelOfType,
+  loadQuestionDics,
 } from './constants';
+import { TMS_DIC_FIELD_NAMES } from '#/views/x/tms/shared/dic';
 
 defineOptions({ name: 'TmsQuestionList' });
 
@@ -53,17 +55,18 @@
   },
 ];
 
-const [registerTable, { reload, getForm }] = useVxeTable({
+const [registerTable, { reload, getForm, getSelectRows }] = useVxeTable({
   api: fetchList,
   columns,
-  immediate: true,
+  immediate: false,
   rowKey: 'id',
   useSearchForm: true,
   formConfig: {
     baseColProps: { span: 6 },
     compact: true,
     showAdvancedButton: true,
-    autoAdvancedLine: 1,
+    alwaysShowLines: 1,
+    autoAdvancedLine: 4,
     schemas: [
       {
         field: 'bankId',
@@ -84,7 +87,8 @@
           allowClear: true,
           showSearch: true,
           placeholder: '璇烽�夋嫨棰樺瀷',
-          options: QUESTION_TYPE_OPTIONS,
+          options: QUESTION_TYPE_OPTIONS.value,
+          fieldNames: TMS_DIC_FIELD_NAMES,
         },
       },
       {
@@ -95,7 +99,8 @@
           allowClear: true,
           showSearch: true,
           placeholder: '璇烽�夋嫨鐘舵��',
-          options: STATUS_OPTIONS.filter((x) => x.id !== 'invalid'),
+          options: STATUS_OPTIONS.value,
+          fieldNames: TMS_DIC_FIELD_NAMES,
         },
       },
       {
@@ -114,8 +119,9 @@
       },
     ],
   },
+  rowSelection: { type: 'checkbox' },
   actionColumn: {
-    width: 100,
+    width: 180,
     title: '鎿嶄綔',
     dataIndex: 'action',
     fixed: 'right',
@@ -123,20 +129,55 @@
 });
 
 onMounted(async () => {
-  banks.value = (await getQuestionBanks()) || [];
-  getForm()?.updateSchema?.({
-    field: 'bankId',
-    componentProps: {
-      allowClear: true,
-      showSearch: true,
-      placeholder: '璇烽�夋嫨棰樺簱',
-      options: banks.value,
+  await loadQuestionDics();
+  try {
+    const list = await getQuestionBanks();
+    banks.value = Array.isArray(list) ? list : [];
+  } catch {
+    banks.value = [];
+  }
+  getForm()?.updateSchema?.([
+    {
+      field: 'bankId',
+      componentProps: {
+        allowClear: true,
+        showSearch: true,
+        placeholder: '璇烽�夋嫨棰樺簱',
+        options: banks.value,
+      },
     },
-  });
+    {
+      field: 'questionType',
+      componentProps: {
+        allowClear: true,
+        showSearch: true,
+        placeholder: '璇烽�夋嫨棰樺瀷',
+        options: QUESTION_TYPE_OPTIONS.value,
+        fieldNames: TMS_DIC_FIELD_NAMES,
+      },
+    },
+    {
+      field: 'bizStatus',
+      componentProps: {
+        allowClear: true,
+        showSearch: true,
+        placeholder: '璇烽�夋嫨鐘舵��',
+        options: STATUS_OPTIONS.value,
+        fieldNames: TMS_DIC_FIELD_NAMES,
+      },
+    },
+  ]);
+  reload();
 });
 
 async function fetchList(params: Record<string, any>) {
-  return { data: await getQuestionList(params) };
+  const page = await getQuestionList(params);
+  return {
+    data: {
+      list: Array.isArray(page?.list) ? page.list : [],
+      pagination: page?.pagination || { total: 0 },
+    },
+  };
 }
 
 function stripHtml(html?: string) {
@@ -155,31 +196,55 @@
   router.push('/tms/question/create');
 }
 
-function handleEdit(record: QuestionEntity) {
-  router.push(`/tms/question/edit/${record.id}`);
-}
-
-function handleDelete(record: QuestionEntity) {
+function handleManage() {
+  const rows = (getSelectRows?.() || []) as QuestionEntity[];
+  if (!rows.length) {
+    createMessage.warning('璇峰厛鍕鹃�夎绠$悊鐨勮瘯棰�');
+    return;
+  }
+  if (rows.length === 1) {
+    handleEdit(rows[0]!);
+    return;
+  }
   Modal.confirm({
-    title: '纭鍒犻櫎',
-    content: `纭畾鍒犻櫎璇曢銆�${stripHtml(record.stem) || record.questionNo}銆嶅悧锛焋,
+    title: '鎵归噺搴熷純',
+    content: `宸插嬀閫� ${rows.length} 閬撹瘯棰橈紝纭畾鍏ㄩ儴搴熷純鍚楋紵`,
     onOk: async () => {
-      await deleteQuestion(record.id!);
-      createMessage.success('鍒犻櫎鎴愬姛');
+      for (const row of rows) {
+        if (row.id) await invalidateQuestion(row.id);
+      }
+      createMessage.success('搴熷純鎴愬姛');
       reload();
     },
   });
 }
 
+function handleDetail(record: QuestionEntity) {
+  router.push(`/tms/question/detail/${record.id}`);
+}
+
+function handleEdit(record: QuestionEntity) {
+  router.push(`/tms/question/edit/${record.id}`);
+}
+
+async function handleInvalidate(record: QuestionEntity) {
+  await invalidateQuestion(record.id!);
+  createMessage.success('搴熷純鎴愬姛');
+  reload();
+}
+
 function getTableActions(record: QuestionEntity): ActionItem[] {
   return [
-    { icon: 'icon-ym icon-ym-btn-edit', tooltip: '缂栬緫', onClick: handleEdit.bind(null, record) },
+    { label: '缂栬緫', onClick: handleEdit.bind(null, record) },
     {
-      icon: 'icon-ym icon-ym-btn-clearn',
-      tooltip: '鍒犻櫎',
+      label: '搴熷純',
       color: 'error',
-      onClick: handleDelete.bind(null, record),
+      modelConfirm: {
+        content: `纭畾搴熷純璇曢銆�${stripHtml(record.stem) || record.questionNo}銆嶅悧锛熷簾寮冨悗灏嗕粠鍒楄〃绉婚櫎銆俙,
+        onOk: handleInvalidate.bind(null, record),
+      },
     },
+    { label: '璇︽儏', onClick: handleDetail.bind(null, record) },
   ];
 }
 </script>
@@ -192,7 +257,7 @@
           <template #tableTitle>
             <a-space>
               <a-button type="primary" pre-icon="icon-ym icon-ym-btn-add" @click="handleCreate">鍒涘缓璇曢</a-button>
-              <a-button disabled>绠$悊璇曢</a-button>
+              <a-button @click="handleManage">绠$悊璇曢</a-button>
             </a-space>
           </template>
           <template #bizStatus="{ record }">

--
Gitblit v1.8.0