config.ts
2.15 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import { BasicColumn, FormSchema } from '/@/components/Table';
import { PackageField, PackageType } from './packageDetail.config';
import { dateUtil } from '/@/utils/dateUtil';
import { DEFAULT_DATE_FORMAT } from '/@/views/visual/board/detail/config/util';
export interface ModalPassRecord {
  isUpdate: boolean;
  record?: Recordable;
}
export enum OtaPermissionKey {
  CREATE = 'api:operation:ota:post',
  UPDATE = 'api:operation:ota:update',
  DELETE = 'api:operation:ota:delete',
  DOWNLOAD = 'api:operation:ota:download',
  DETAIL = 'api:operation:ota:detail',
}
export const columns: BasicColumn[] = [
  {
    title: '创建时间',
    dataIndex: PackageField.CREATE_TIME,
    format(text) {
      return dateUtil(text).format(DEFAULT_DATE_FORMAT);
    },
    width: 140,
  },
  {
    title: '标题',
    dataIndex: PackageField.TITLE,
    width: 120,
  },
  {
    title: '版本',
    dataIndex: PackageField.VERSION,
    width: 120,
  },
  {
    title: '版本标签',
    dataIndex: PackageField.VERSION_TAG,
    width: 120,
  },
  {
    title: '包类型',
    dataIndex: PackageField.PACKAGE_TYPE,
    format: (text) => {
      return text === PackageType.FIRMWARE ? '固件' : '软件';
    },
    width: 120,
  },
  {
    title: '直接URL',
    dataIndex: PackageField.URL,
    width: 120,
  },
  {
    title: '文件名',
    dataIndex: PackageField.FILE_NAME,
    width: 120,
  },
  {
    title: '文件大小',
    dataIndex: PackageField.FILE_SIZE,
    format(text, record) {
      return record[PackageField.FILE_SIZE]
        ? `${Math.ceil(((text as unknown as number) / 1024) * 100) / 100}kb`
        : '';
    },
    width: 120,
  },
  {
    title: '校验和',
    dataIndex: PackageField.CHECK_SUM,
    format(text, record) {
      return text ? `${record[PackageField.CHECK_SUM_ALG]}: ${text.slice(0, 11)}` : '';
    },
    width: 120,
  },
  {
    title: '操作',
    dataIndex: 'action',
    flag: 'ACTION',
    fixed: 'right',
    width: 200,
    slots: {
      customRender: 'action',
    },
  },
];
export const searchFormSchema: FormSchema[] = [
  {
    field: PackageField.TITLE,
    label: '标题',
    component: 'Input',
    colProps: { span: 8 },
  },
];