liu
5 天以前 b337be5073334334962e873c1a980968ad2cf068
src/views/research/application/modules/member-table.vue
@@ -9,7 +9,7 @@
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { $t } from '#/locales';
import { MEMBER_ROLE_OPTIONS, toSubmitMembers } from '../data';
import { MEMBER_TYPE_OPTIONS, toSubmitMembers } from '../data';
const props = withDefaults(
  defineProps<{
@@ -29,42 +29,35 @@
const [Grid, gridApi] = useVbenVxeGrid({
  gridOptions: {
    columns: [
      { type: 'seq', title: '序号', width: 55, fixed: 'left' },
      {
        field: 'sortNo',
        title: '署名顺序',
        width: 110,
        slots: { default: 'sortNo' },
      },
      {
        field: 'memberType',
        title: '成员类型',
        width: 130,
        slots: { default: 'memberType' },
      },
      {
        field: 'name',
        title: '姓名',
        minWidth: 110,
        title: '成员姓名',
        minWidth: 120,
        slots: { default: 'name' },
      },
      {
        field: 'contactPhone',
        title: '联系电话',
        minWidth: 140,
        slots: { default: 'contactPhone' },
      },
      {
        field: 'workUnit',
        title: '所属单位',
        minWidth: 180,
        title: '所属部门',
        minWidth: 220,
        slots: { default: 'workUnit' },
      },
      {
        field: 'jobTitle',
        title: '职称/职务',
        minWidth: 120,
        slots: { default: 'jobTitle' },
      },
      {
        field: 'memberRole',
        title: '成员角色',
        title: '职称',
        minWidth: 130,
        slots: { default: 'memberRole' },
      },
      {
        field: 'sortNo',
        title: '排序',
        width: 90,
        slots: { default: 'sortNo' },
        slots: { default: 'jobTitle' },
      },
      {
        title: '操作',
@@ -113,7 +106,7 @@
async function handleAdd() {
  await gridApi.grid.insertAt(
    {
      memberRole: '参与人',
      memberType: '教师',
      sortNo: collectMembers().length + 1,
    } as unknown as ResearchApplicationApi.ApplicationMember,
    -1,
@@ -133,7 +126,7 @@
  for (let i = 0; i < rows.length; i++) {
    const row = rows[i];
    if (!row?.name || String(row.name).trim() === '') {
      throw new Error(`第 ${i + 1} 行成员:请填写姓名`);
      throw new Error(`第 ${i + 1} 行成员:请填写成员姓名`);
    }
    const phone = row.contactPhone ? String(row.contactPhone).trim() : '';
    if (phone !== '' && !/^1[3-9]\d{9}$/.test(phone)) {
@@ -165,49 +158,6 @@
<template>
  <Grid class="w-full">
    <template #name="{ row }">
      <Input
        v-model:value="row.name"
        :disabled="disabled"
        placeholder="请输入姓名"
        @change="() => recalc()"
      />
    </template>
    <template #contactPhone="{ row }">
      <Input
        v-model:value="row.contactPhone"
        :disabled="disabled"
        :maxlength="11"
        placeholder="11 位手机号(选填)"
        @change="() => recalc()"
      />
    </template>
    <template #workUnit="{ row }">
      <Input
        v-model:value="row.workUnit"
        :disabled="disabled"
        placeholder="请输入所属单位"
        @change="() => recalc()"
      />
    </template>
    <template #jobTitle="{ row }">
      <Input
        v-model:value="row.jobTitle"
        :disabled="disabled"
        placeholder="请输入职称/职务"
        @change="() => recalc()"
      />
    </template>
    <template #memberRole="{ row }">
      <Select
        v-model:value="row.memberRole"
        :disabled="disabled"
        :options="MEMBER_ROLE_OPTIONS"
        placeholder="请选择角色"
        allow-clear
        @change="() => recalc()"
      />
    </template>
    <template #sortNo="{ row }">
      <InputNumber
        v-model:value="row.sortNo"
@@ -218,6 +168,40 @@
        @change="() => recalc()"
      />
    </template>
    <template #memberType="{ row }">
      <Select
        v-model:value="row.memberType"
        :disabled="disabled"
        :options="MEMBER_TYPE_OPTIONS"
        placeholder="请选择成员类型"
        allow-clear
        @change="() => recalc()"
      />
    </template>
    <template #name="{ row }">
      <Input
        v-model:value="row.name"
        :disabled="disabled"
        placeholder="请输入成员姓名"
        @change="() => recalc()"
      />
    </template>
    <template #workUnit="{ row }">
      <Input
        v-model:value="row.workUnit"
        :disabled="disabled"
        placeholder="请输入所属部门"
        @change="() => recalc()"
      />
    </template>
    <template #jobTitle="{ row }">
      <Input
        v-model:value="row.jobTitle"
        :disabled="disabled"
        placeholder="请输入职称"
        @change="() => recalc()"
      />
    </template>
    <template #actions="{ row }">
      <TableAction
        :actions="[