guoshilong
2023-09-08 cee338f18d22bbbb989d79c0add082fdb4e2b8ef
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
export enum FormProject {
  PROJECT_NAME = 'projectName',
  PROJECT_STATUS = 'projectStatus',
  PROJCECT_INTRO = 'projectIntro',
  LONGITUDE = 'longitude',
  LATITUDE = 'latitude',
  DEVICELIST = 'deviceList',
  USERLIST = 'userList',
  PROJECT_BLOCKING = 'projectBlocking',
}
export enum blocking {
  WINDSPEED = 'windDevice',
  WINDSPEEDREPORT = 'windWeatherReport',
  RAIN = 'rain',
  CLOUDBLOCKINGCONFIGENABLE = 'cloudBlockingConfigEnable',
  WEATHERREPORTENABLE = 'weatherReportEnable',
}
enum weather {
  '开启' = '1',
  '关闭' = '2'
}
interface deviceList {
  nickName: string
  deviceSource: number
  deviceType: number
  [key: string]: any
}
interface projectBlocking {
  [blocking.WEATHERREPORTENABLE]?: string
  [blocking.CLOUDBLOCKINGCONFIGENABLE]: string
  [blocking.WINDSPEED]?: number
  [blocking.WINDSPEEDREPORT]?: number
  [blocking.RAIN]?: number
}
export interface FormState {
  [FormProject.PROJECT_NAME]: string
  [FormProject.PROJECT_STATUS]: string
  [FormProject.PROJCECT_INTRO]: string
  [FormProject.LONGITUDE]?: number | null
  [FormProject.LATITUDE]?: number | null
  [FormProject.DEVICELIST]?: deviceList[]
  [FormProject.USERLIST]: number[]
  [FormProject.PROJECT_BLOCKING]: projectBlocking
}
 
/*
  项目成员表格
*/
export const Usercolumns = [
  {
    title: '人员项目呼号',
    dataIndex: 'name',
    key: 'name',
    ellipsis: true,
    slots: { customRender: 'name' },
  },
  {
    title: '项目角色',
    dataIndex: 'role',
    key: 'role',
    responsive: ['md'],
    ellipsis: true,
    slots: { customRender: 'role' },
  },
  {
    title: '编辑',
    dataIndex: 'edit',
    key: 'edit',
    responsive: ['lg'],
    width: '24%',
    ellipsis: true,
    slots: { customRender: 'operation' },
  },
]
 
export interface ProjectUser {
  key: string;
  name: string;
  role: number;
}
 
/*
  项目设备表格数据
*/
export const Devicecolumns = [
  {
    title: '项目设备呼号',
    dataIndex: 'device',
    key: 'device',
    ellipsis: true,
    slots: { customRender: 'device' },
  },
  {
    title: '设备型号',
    dataIndex: 'model',
    key: 'model',
    responsive: ['md'],
    ellipsis: true,
    slots: { customRender: 'model' },
  },
  {
    title: '编辑',
    dataIndex: 'edit',
    key: 'edit',
    responsive: ['lg'],
    width: '24%',
    ellipsis: true,
    slots: { customRender: 'operation' },
  },
]
 
export interface ProjectDevice {
  key: string;
  device: string;
  model: string;
}
 
// 校验表单规则
export const rules = {
  [FormProject.PROJECT_NAME]: [
    { required: true, message: '请输入项目名称', trigger: 'blur' },
  ],
  [FormProject.LATITUDE]: [
    { required: true, type: 'number', message: '请设置项目中心点', trigger: 'blur' },
  ],
}