刘光辉
9 小时以前 0dfe84494048ce27ba8449831782128412d3eb13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
 
import { useMessage } from '@jnpf/hooks';
 
import { getWorkflowTableConfig, type WorkflowTableConfigRow } from '#/api/test/workflowTableConfig';
 
defineOptions({ name: 'WorkflowTableConfigTest' });
 
const DEFAULT_FLOW_ID = '864125763559883717';
const { createMessage } = useMessage();
const flowId = ref(DEFAULT_FLOW_ID);
const rows = ref<WorkflowTableConfigRow[]>([]);
const loading = ref(false);
 
const columns = [
  { title: '表单 ID', dataIndex: 'formId', key: 'formId', width: 220 },
  { title: '表单名称', dataIndex: 'formName', key: 'formName', width: 180 },
  { title: '表类型', dataIndex: 'tableType', key: 'tableType', width: 100 },
  { title: '表名', dataIndex: 'tableName', key: 'tableName', width: 260 },
  { title: '表显示名称', dataIndex: 'tableDisplayName', key: 'tableDisplayName', minWidth: 220 },
];
 
async function loadData() {
  loading.value = true;
  try {
    const response = await getWorkflowTableConfig(flowId.value.trim());
    rows.value = Array.isArray(response?.data) ? response.data : [];
  } catch (error: any) {
    rows.value = [];
    createMessage.error(error?.message || '查询失败');
  } finally {
    loading.value = false;
  }
}
 
onMounted(loadData);
</script>
 
<template>
  <div class="jnpf-content-wrapper">
    <div class="jnpf-content-wrapper-center">
      <div class="jnpf-content-wrapper-content p-4">
        <div class="mb-4 flex items-center gap-2">
          <a-input v-model:value="flowId" placeholder="流程 ID" allow-clear class="max-w-[320px]" @press-enter="loadData" />
          <a-button type="primary" :loading="loading" @click="loadData">查询</a-button>
        </div>
        <a-table
          :columns="columns"
          :data-source="rows"
          :loading="loading"
          :pagination="false"
          :scroll="{ x: 980 }"
          :row-key="(_, index) => String(index)" />
      </div>
    </div>
  </div>
</template>