gaoluyang
2026-06-24 bfdc0e0e6d5e47aa501f9b6fadd143d9c97cf00a
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
59
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeGridPropTypes } from '#/adapter/vxe-table';
import type { MpAccountApi } from '#/api/mp/account';
 
import { formatDateTime } from '../../../packages/utils/src';
 
import { getSimpleAccountList } from '#/api/mp/account';
 
let accountList: MpAccountApi.Account[] = [];
getSimpleAccountList().then((data) => (accountList = data));
 
/** 搜索表单配置 */
export function useGridFormSchema(): VbenFormSchema[] {
  return [
    {
      fieldName: 'accountId',
      label: '公众号',
      component: 'Select',
      componentProps: {
        options: accountList.map((item) => ({
          label: item.name,
          value: item.id,
        })),
        placeholder: '请选择公众号',
        clearable: true,
      },
    },
  ];
}
 
/** 表格列配置 */
export function useGridColumns(): VxeGridPropTypes.Columns {
  return [
    {
      field: 'cover',
      title: '图片',
      width: 360,
      slots: { default: 'cover' },
    },
    {
      field: 'title',
      title: '标题',
      slots: { default: 'title' },
    },
    {
      field: 'updateTime',
      title: '修改时间',
      formatter: ({ row }) => {
        return formatDateTime(row.updateTime * 1000);
      },
    },
    {
      title: '操作',
      width: 120,
      fixed: 'right',
      slots: { default: 'actions' },
    },
  ];
}