liuyu
22 小时以前 93c133349a5ccd7a328371fa113dce69d5611f21
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>) {
  return {
    data: await getTmsRecordList({
  const page = await getTmsRecordList({
      ...params,
      listMode: listMode.value,
    }),
  });
  return {
    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}」签到二维码(接口联调后生效)`);
}
function handleAdd() {
  createMessage.info('新增培训记录(联调任务发布后由系统自动生成,手工新增待后端接口)');
}
function handleEdit() {
  const row = requireOneRow();
  if (!row) return;
  if (row.archiveStatus === 'archived' || isArchivedView.value) {
    createMessage.warning('已归档记录不可修改');
    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')">可归档列表</a-button>
              <a-button pre-icon="icon-ym icon-ym-extend-folder" @click="goList('archived')">已归档列表</a-button>
              <span class="text-gray-400 text-sm">当前:{{ listModeTitle }}</span>
              <span class="tms-toolbar-hint">当前:{{ listModeTitle }} · 记录由任务发布自动生成</span>
            </a-space>
            <!-- 2. 可归档列表 -->
            <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')">已归档列表</a-button>
              <span class="text-gray-400 text-sm">当前:{{ listModeTitle }}</span>
              <span class="tms-toolbar-hint">当前:{{ listModeTitle }}</span>
            </a-space>
            <!-- 3. 已归档列表 -->
            <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')">可归档列表</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')">可归档列表</a-button>
              <span class="tms-toolbar-hint">当前:{{ listModeTitle }} · 已归档不可修改</span>
            </a-space>
          </template>
          <template #subject="{ record }">