fangmingyue il y a 2 ans
Parent
révision
90a56f4d9b
7 fichiers modifiés avec 987 ajouts et 987 suppressions
  1. 40
    40
      config/proxy.js
  2. 306
    306
      config/routes.js
  3. 116
    115
      package.json
  4. 154
    154
      src/components/GeoMap/global.less
  5. 110
    111
      src/components/Hatc/sdk.js
  6. 203
    203
      src/pages/Machinery/Machinery/index.jsx
  7. 58
    58
      src/services/machinery.js

+ 40
- 40
config/proxy.js Voir le fichier

@@ -1,40 +1,40 @@
1
-/**
2
- * 在生产环境 代理是无法生效的,所以这里没有生产环境的配置
3
- * -------------------------------
4
- * The agent cannot take effect in the production environment
5
- * so there is no configuration of the production environment
6
- * For details, please see
7
- * https://pro.ant.design/docs/deploy
8
- */
9
-export default {
10
-  dev: {
11
-    // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
12
-    '/api/': {
13
-      // 要代理的地址
14
-      // target: 'http://192.168.89.147:7080',
15
-      // target: 'http://192.168.89.25:7080',
16
-      target: 'http://machine.njyunzhi.com',
17
-      // 配置了这个可以从 http 代理到 https
18
-      // 依赖 origin 的功能可能需要这个,比如 cookie
19
-      changeOrigin: true,
20
-    },
21
-  },
22
-  test: {
23
-    '/api/': {
24
-      target: 'https://proapi.azurewebsites.net',
25
-      changeOrigin: true,
26
-      pathRewrite: {
27
-        '^': '',
28
-      },
29
-    },
30
-  },
31
-  pre: {
32
-    '/api/': {
33
-      target: 'your pre url',
34
-      changeOrigin: true,
35
-      pathRewrite: {
36
-        '^': '',
37
-      },
38
-    },
39
-  },
40
-};
1
+/**
2
+ * 在生产环境 代理是无法生效的,所以这里没有生产环境的配置
3
+ * -------------------------------
4
+ * The agent cannot take effect in the production environment
5
+ * so there is no configuration of the production environment
6
+ * For details, please see
7
+ * https://pro.ant.design/docs/deploy
8
+ */
9
+export default {
10
+  dev: {
11
+    // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
12
+    '/api/': {
13
+      // 要代理的地址
14
+      // target: 'http://192.168.89.147:7080',
15
+      // target: 'http://192.168.89.25:7080',
16
+      target: 'http://machine.njyunzhi.com',
17
+      // 配置了这个可以从 http 代理到 https
18
+      // 依赖 origin 的功能可能需要这个,比如 cookie
19
+      changeOrigin: true,
20
+    },
21
+  },
22
+  test: {
23
+    '/api/': {
24
+      target: 'https://proapi.azurewebsites.net',
25
+      changeOrigin: true,
26
+      pathRewrite: {
27
+        '^': '',
28
+      },
29
+    },
30
+  },
31
+  pre: {
32
+    '/api/': {
33
+      target: 'your pre url',
34
+      changeOrigin: true,
35
+      pathRewrite: {
36
+        '^': '',
37
+      },
38
+    },
39
+  },
40
+};

+ 306
- 306
config/routes.js Voir le fichier

@@ -1,306 +1,306 @@
1
-export default [
2
-  {
3
-    path: '/user',
4
-    layout: false,
5
-    routes: [
6
-      {
7
-        path: '/user',
8
-        routes: [
9
-          {
10
-            name: 'login',
11
-            path: '/user/login',
12
-            component: './user/Login',
13
-          },
14
-        ],
15
-      },
16
-      {
17
-        component: './404',
18
-      },
19
-    ],
20
-  },
21
-  {
22
-    path: '/welcome',
23
-    name: '工作台',
24
-    icon: 'smile',
25
-    component: './Welcome',
26
-  },
27
-  {
28
-    path: '/MonitoringScreen',
29
-    layout: false,
30
-    name: '数据大屏',
31
-    icon: 'DesktopOutlined',
32
-    component: './MonitoringScreen',
33
-    access: 'screen',
34
-  },
35
-  {
36
-    path: '/ContentManagementSystem',
37
-    name: 'CMS管理',
38
-    icon: 'MediumOutlined',
39
-    component: '../layouts/BasicLayout',
40
-    access: 'cms',
41
-    routes: [
42
-      {
43
-        path: '/ContentManagementSystem/InformationClassification',
44
-        name: '资讯分类',
45
-        access: 'cmstype',
46
-        component: './ContentManagementSystem/InformationClassification',
47
-      },
48
-      {
49
-        path: '/ContentManagementSystem/InformationList',
50
-        name: '资讯列表',
51
-        access: 'news',
52
-        component: './ContentManagementSystem/InformationList',
53
-      },
54
-      {
55
-        path: '/ContentManagementSystem/InformationList/edit.jsx',
56
-        name: '资讯列表编辑',
57
-        component: './ContentManagementSystem/InformationList/edit.jsx',
58
-        hideInMenu: true,
59
-      },
60
-      {
61
-        path: '/ContentManagementSystem/Advertisement',
62
-        name: '广告位管理',
63
-        access: 'banner',
64
-        component: './ContentManagementSystem/Advertisement',
65
-      },
66
-      {
67
-        path: '/ContentManagementSystem/Advertisement/edit.jsx',
68
-        name: '广告位编辑',
69
-        component: './ContentManagementSystem/Advertisement/edit.jsx',
70
-        hideInMenu: true,
71
-      },
72
-    ],
73
-  },
74
-  {
75
-    path: '/customer',
76
-    name: '客户管理',
77
-    icon: 'IdcardOutlined',
78
-    access: 'customer',
79
-    component: '../layouts/BasicLayout',
80
-    routes: [
81
-      {
82
-        path: '/customer/index.jsx',
83
-        name: '客户列表',
84
-        access: 'customerList',
85
-        icon: 'smile',
86
-        component: './customer',
87
-      },
88
-    ],
89
-  },
90
-  {
91
-    path: '/Machinery',
92
-    name: '农机管理',
93
-    icon: 'CarOutlined',
94
-    access: 'agricultural',
95
-    component: '../layouts/BasicLayout',
96
-    routes: [
97
-      {
98
-        path: '/Machinery/Org',
99
-        name: '合作社列表',
100
-        access: 'org',
101
-        component: './Machinery/Org',
102
-      },
103
-      {
104
-        path: '/Machinery/Person',
105
-        name: '人员管理',
106
-        access: 'user',
107
-        component: './Machinery/Person',
108
-      },
109
-      {
110
-        path: '/Machinery/MachineryType',
111
-        name: '分类管理',
112
-        access: 'machinetype',
113
-        component: './Machinery/MachineryType',
114
-      },
115
-      {
116
-        path: '/Machinery/Machinery',
117
-        name: '农机列表',
118
-        access: 'machinery',
119
-        component: './Machinery/Machinery',
120
-      },
121
-      {
122
-        path: '/Machinery/Machinery/Edit',
123
-        name: '农机编辑',
124
-        component: './Machinery/Machinery/Edit',
125
-        hideInMenu: true,
126
-      },
127
-      // {
128
-      //   path: '/Machinery/GPS',
129
-      //   name: '设备管理',
130
-      //   access: 'device',
131
-      //   component: './Machinery/GPS',
132
-      // },
133
-      // {
134
-      //   path: '/Machinery/GPS/edit.jsx',
135
-      //   name: '设备编辑',
136
-      //   component: './Machinery/GPS/edit.jsx',
137
-      //   hideInMenu: true,
138
-      // },
139
-      // {
140
-      //   path: '/Machinery/GIS',
141
-      //   name: '农机GIS',
142
-      //   access: 'gis',
143
-      //   component: './Machinery/GIS',
144
-      // },
145
-    ],
146
-  },
147
-  {
148
-    path: '/OrderManage',
149
-    name: '订单调度',
150
-    access: 'order',
151
-    icon: 'PhoneOutlined',
152
-    component: '../layouts/BasicLayout',
153
-    routes: [
154
-      {
155
-        path: '/OrderManage/index.jsx',
156
-        name: '订单调度',
157
-        access: 'orderjob',
158
-        component: './OrderManage',
159
-      },
160
-      {
161
-        path: '/OrderManage/dispatch.jsx',
162
-        name: '调度详情',
163
-        access: 'orderjob',
164
-        component: './OrderManage/dispatch.jsx',
165
-        hideInMenu: true,
166
-      },
167
-      {
168
-        path: '/OrderManage/OrderList/index.jsx',
169
-        name: '订单列表',
170
-        access: 'orderList',
171
-        component: './OrderManage/OrderList',
172
-      },
173
-      {
174
-        path: '/OrderManage/JobWarning/index.jsx',
175
-        name: '预警监管',
176
-        access: 'orderwarning',
177
-        component: './OrderManage/JobWarning',
178
-      },
179
-      {
180
-        path: '/OrderManage/JobWarning/detail.jsx',
181
-        name: '订单详情',
182
-        access: 'orderwarning',
183
-        component: './OrderManage/JobWarning/detail.jsx',
184
-        hideInMenu: true,
185
-      },
186
-    ],
187
-  },
188
-  {
189
-    path: '/JobStatistics',
190
-    name: '作业统计',
191
-    access: 'statis',
192
-    icon: 'ScheduleOutlined',
193
-    component: '../layouts/BasicLayout',
194
-    routes: [
195
-      {
196
-        path: '/JobStatistics/Order',
197
-        name: '订单统计',
198
-        access: 'st-order',
199
-        component: './JobStatistics/Order',
200
-      },
201
-      {
202
-        path: '/JobStatistics/Job',
203
-        name: '作业统计',
204
-        access: 'st-work',
205
-        component: './JobStatistics/Job',
206
-      },
207
-      // {
208
-      //   path: '/JobStatistics/RevenueExpenditure',
209
-      //   name: '收支统计',
210
-      //   access: 'st-finance',
211
-      //   component: './JobStatistics/RevenueExpenditure',
212
-      // },
213
-    ],
214
-  },
215
-  {
216
-    path: '/Finance',
217
-    name: '财务管理',
218
-    access: 'finance',
219
-    icon: 'DollarOutlined',
220
-    component: '../layouts/BasicLayout',
221
-    routes: [
222
-      {
223
-        path: '/Finance/AccountLog',
224
-        name: '平台流水',
225
-        access: 'fi-system',
226
-        component: './Finance/AccountLog',
227
-      },
228
-      {
229
-        path: '/Finance/Withdrawal',
230
-        name: '提现管理',
231
-        access: 'fi-withdraw',
232
-        component: './Finance/Withdrawal',
233
-      },
234
-      {
235
-        path: '/Finance/Withdrawal/audit.jsx',
236
-        name: '提现审批',
237
-        component: './Finance/Withdrawal/audit.jsx',
238
-        hideInMenu: true,
239
-      },
240
-    ],
241
-  },
242
-  {
243
-    path: '/PlatformMessageManagement',
244
-    name: '消息管理',
245
-    icon: 'MailOutlined',
246
-    access: 'message',
247
-    component: '../layouts/BasicLayout',
248
-    routes: [
249
-      {
250
-        path: '/PlatformMessageManagement/MessageManageList',
251
-        name: '平台消息',
252
-        access: 'sys-message',
253
-        icon: 'smile',
254
-        component: './PlatformMessageManagement/MessageManageList',
255
-      },
256
-      {
257
-        path: '/PlatformMessageManagement/MessageEdit',
258
-        name: '消息查看',
259
-        component: './PlatformMessageManagement/MessageEdit',
260
-        hideInMenu: true,
261
-      },
262
-    ],
263
-  },
264
-  {
265
-    path: '/Feedback',
266
-    name: '意见反馈',
267
-    icon: 'MessageOutlined',
268
-    component: './Feedback',
269
-    access: 'feedback',
270
-  },
271
-  {
272
-    path: '/SystemManagement',
273
-    name: '系统管理',
274
-    icon: 'SettingOutlined',
275
-    access: 'system',
276
-    component: '../layouts/BasicLayout',
277
-    routes: [
278
-      {
279
-        path: '/SystemManagement/Region',
280
-        name: '区域设置',
281
-        access: 'region',
282
-        component: './SystemManagement/Region',
283
-      },
284
-      {
285
-        path: '/SystemManagement/UserRights',
286
-        name: '角色管理',
287
-        access: 'role',
288
-        component: './SystemManagement/UserRights',
289
-      },
290
-      {
291
-        path: '/SystemManagement/BasicParameters',
292
-        name: '基本参数',
293
-        access: 'setting',
294
-        component: './SystemManagement/BasicParameters',
295
-      },
296
-    ],
297
-  },
298
-
299
-  {
300
-    path: '/',
301
-    redirect: '/welcome',
302
-  },
303
-  {
304
-    component: './404',
305
-  },
306
-];
1
+export default [
2
+  {
3
+    path: '/user',
4
+    layout: false,
5
+    routes: [
6
+      {
7
+        path: '/user',
8
+        routes: [
9
+          {
10
+            name: 'login',
11
+            path: '/user/login',
12
+            component: './user/Login',
13
+          },
14
+        ],
15
+      },
16
+      {
17
+        component: './404',
18
+      },
19
+    ],
20
+  },
21
+  {
22
+    path: '/welcome',
23
+    name: '工作台',
24
+    icon: 'smile',
25
+    component: './Welcome',
26
+  },
27
+  {
28
+    path: '/MonitoringScreen',
29
+    layout: false,
30
+    name: '数据大屏',
31
+    icon: 'DesktopOutlined',
32
+    component: './MonitoringScreen',
33
+    access: 'screen',
34
+  },
35
+  {
36
+    path: '/ContentManagementSystem',
37
+    name: 'CMS管理',
38
+    icon: 'MediumOutlined',
39
+    component: '../layouts/BasicLayout',
40
+    access: 'cms',
41
+    routes: [
42
+      {
43
+        path: '/ContentManagementSystem/InformationClassification',
44
+        name: '资讯分类',
45
+        access: 'cmstype',
46
+        component: './ContentManagementSystem/InformationClassification',
47
+      },
48
+      {
49
+        path: '/ContentManagementSystem/InformationList',
50
+        name: '资讯列表',
51
+        access: 'news',
52
+        component: './ContentManagementSystem/InformationList',
53
+      },
54
+      {
55
+        path: '/ContentManagementSystem/InformationList/edit.jsx',
56
+        name: '资讯列表编辑',
57
+        component: './ContentManagementSystem/InformationList/edit.jsx',
58
+        hideInMenu: true,
59
+      },
60
+      {
61
+        path: '/ContentManagementSystem/Advertisement',
62
+        name: '广告位管理',
63
+        access: 'banner',
64
+        component: './ContentManagementSystem/Advertisement',
65
+      },
66
+      {
67
+        path: '/ContentManagementSystem/Advertisement/edit.jsx',
68
+        name: '广告位编辑',
69
+        component: './ContentManagementSystem/Advertisement/edit.jsx',
70
+        hideInMenu: true,
71
+      },
72
+    ],
73
+  },
74
+  {
75
+    path: '/customer',
76
+    name: '客户管理',
77
+    icon: 'IdcardOutlined',
78
+    access: 'customer',
79
+    component: '../layouts/BasicLayout',
80
+    routes: [
81
+      {
82
+        path: '/customer/index.jsx',
83
+        name: '客户列表',
84
+        access: 'customerList',
85
+        icon: 'smile',
86
+        component: './customer',
87
+      },
88
+    ],
89
+  },
90
+  {
91
+    path: '/Machinery',
92
+    name: '农机管理',
93
+    icon: 'CarOutlined',
94
+    access: 'agricultural',
95
+    component: '../layouts/BasicLayout',
96
+    routes: [
97
+      {
98
+        path: '/Machinery/Org',
99
+        name: '合作社列表',
100
+        access: 'org',
101
+        component: './Machinery/Org',
102
+      },
103
+      {
104
+        path: '/Machinery/Person',
105
+        name: '人员管理',
106
+        access: 'user',
107
+        component: './Machinery/Person',
108
+      },
109
+      {
110
+        path: '/Machinery/MachineryType',
111
+        name: '分类管理',
112
+        access: 'machinetype',
113
+        component: './Machinery/MachineryType',
114
+      },
115
+      {
116
+        path: '/Machinery/Machinery',
117
+        name: '农机列表',
118
+        access: 'machinery',
119
+        component: './Machinery/Machinery',
120
+      },
121
+      {
122
+        path: '/Machinery/Machinery/Edit',
123
+        name: '农机编辑',
124
+        component: './Machinery/Machinery/Edit',
125
+        hideInMenu: true,
126
+      },
127
+      // {
128
+      //   path: '/Machinery/GPS',
129
+      //   name: '设备管理',
130
+      //   access: 'device',
131
+      //   component: './Machinery/GPS',
132
+      // },
133
+      // {
134
+      //   path: '/Machinery/GPS/edit.jsx',
135
+      //   name: '设备编辑',
136
+      //   component: './Machinery/GPS/edit.jsx',
137
+      //   hideInMenu: true,
138
+      // },
139
+      // {
140
+      //   path: '/Machinery/GIS',
141
+      //   name: '农机GIS',
142
+      //   access: 'gis',
143
+      //   component: './Machinery/GIS',
144
+      // },
145
+    ],
146
+  },
147
+  {
148
+    path: '/OrderManage',
149
+    name: '订单调度',
150
+    access: 'order',
151
+    icon: 'PhoneOutlined',
152
+    component: '../layouts/BasicLayout',
153
+    routes: [
154
+      {
155
+        path: '/OrderManage/index.jsx',
156
+        name: '订单调度',
157
+        access: 'orderjob',
158
+        component: './OrderManage',
159
+      },
160
+      {
161
+        path: '/OrderManage/dispatch.jsx',
162
+        name: '调度详情',
163
+        access: 'orderjob',
164
+        component: './OrderManage/dispatch.jsx',
165
+        hideInMenu: true,
166
+      },
167
+      {
168
+        path: '/OrderManage/OrderList/index.jsx',
169
+        name: '订单列表',
170
+        access: 'orderList',
171
+        component: './OrderManage/OrderList',
172
+      },
173
+      {
174
+        path: '/OrderManage/JobWarning/index.jsx',
175
+        name: '预警监管',
176
+        access: 'orderwarning',
177
+        component: './OrderManage/JobWarning',
178
+      },
179
+      {
180
+        path: '/OrderManage/JobWarning/detail.jsx',
181
+        name: '订单详情',
182
+        access: 'orderwarning',
183
+        component: './OrderManage/JobWarning/detail.jsx',
184
+        hideInMenu: true,
185
+      },
186
+    ],
187
+  },
188
+  {
189
+    path: '/JobStatistics',
190
+    name: '作业统计',
191
+    access: 'statis',
192
+    icon: 'ScheduleOutlined',
193
+    component: '../layouts/BasicLayout',
194
+    routes: [
195
+      {
196
+        path: '/JobStatistics/Order',
197
+        name: '订单统计',
198
+        access: 'st-order',
199
+        component: './JobStatistics/Order',
200
+      },
201
+      {
202
+        path: '/JobStatistics/Job',
203
+        name: '作业统计',
204
+        access: 'st-work',
205
+        component: './JobStatistics/Job',
206
+      },
207
+      // {
208
+      //   path: '/JobStatistics/RevenueExpenditure',
209
+      //   name: '收支统计',
210
+      //   access: 'st-finance',
211
+      //   component: './JobStatistics/RevenueExpenditure',
212
+      // },
213
+    ],
214
+  },
215
+  {
216
+    path: '/Finance',
217
+    name: '财务管理',
218
+    access: 'finance',
219
+    icon: 'DollarOutlined',
220
+    component: '../layouts/BasicLayout',
221
+    routes: [
222
+      {
223
+        path: '/Finance/AccountLog',
224
+        name: '平台流水',
225
+        access: 'fi-system',
226
+        component: './Finance/AccountLog',
227
+      },
228
+      {
229
+        path: '/Finance/Withdrawal',
230
+        name: '提现管理',
231
+        access: 'fi-withdraw',
232
+        component: './Finance/Withdrawal',
233
+      },
234
+      {
235
+        path: '/Finance/Withdrawal/audit.jsx',
236
+        name: '提现审批',
237
+        component: './Finance/Withdrawal/audit.jsx',
238
+        hideInMenu: true,
239
+      },
240
+    ],
241
+  },
242
+  {
243
+    path: '/PlatformMessageManagement',
244
+    name: '消息管理',
245
+    icon: 'MailOutlined',
246
+    access: 'message',
247
+    component: '../layouts/BasicLayout',
248
+    routes: [
249
+      {
250
+        path: '/PlatformMessageManagement/MessageManageList',
251
+        name: '平台消息',
252
+        access: 'sys-message',
253
+        icon: 'smile',
254
+        component: './PlatformMessageManagement/MessageManageList',
255
+      },
256
+      {
257
+        path: '/PlatformMessageManagement/MessageEdit',
258
+        name: '消息查看',
259
+        component: './PlatformMessageManagement/MessageEdit',
260
+        hideInMenu: true,
261
+      },
262
+    ],
263
+  },
264
+  {
265
+    path: '/Feedback',
266
+    name: '意见反馈',
267
+    icon: 'MessageOutlined',
268
+    component: './Feedback',
269
+    access: 'feedback',
270
+  },
271
+  {
272
+    path: '/SystemManagement',
273
+    name: '系统管理',
274
+    icon: 'SettingOutlined',
275
+    access: 'system',
276
+    component: '../layouts/BasicLayout',
277
+    routes: [
278
+      {
279
+        path: '/SystemManagement/Region',
280
+        name: '区域设置',
281
+        access: 'region',
282
+        component: './SystemManagement/Region',
283
+      },
284
+      {
285
+        path: '/SystemManagement/UserRights',
286
+        name: '角色管理',
287
+        access: 'role',
288
+        component: './SystemManagement/UserRights',
289
+      },
290
+      {
291
+        path: '/SystemManagement/BasicParameters',
292
+        name: '基本参数',
293
+        access: 'setting',
294
+        component: './SystemManagement/BasicParameters',
295
+      },
296
+    ],
297
+  },
298
+
299
+  {
300
+    path: '/',
301
+    redirect: '/welcome',
302
+  },
303
+  {
304
+    component: './404',
305
+  },
306
+];

+ 116
- 115
package.json Voir le fichier

@@ -1,115 +1,116 @@
1
-{
2
-  "name": "ant-design-pro",
3
-  "version": "5.2.0",
4
-  "private": true,
5
-  "description": "An out-of-box UI solution for enterprise applications",
6
-  "scripts": {
7
-    "analyze": "cross-env ANALYZE=1 umi build",
8
-    "build": "umi build",
9
-    "deploy": "npm run build && npm run gh-pages",
10
-    "dev": "npm run start:dev",
11
-    "gh-pages": "gh-pages -d dist",
12
-    "i18n-remove": "pro i18n-remove --locale=zh-CN --write",
13
-    "postinstall": "umi g tmp",
14
-    "lint": "umi g tmp && npm run lint:js && npm run lint:style && npm run lint:prettier && npm run tsc",
15
-    "lint-staged": "lint-staged",
16
-    "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
17
-    "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style",
18
-    "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
19
-    "lint:prettier": "prettier -c --write \"src/**/*\" --end-of-line auto",
20
-    "lint:style": "stylelint --fix \"src/**/*.less\" --syntax less",
21
-    "openapi": "umi openapi",
22
-    "playwright": "playwright install && playwright test",
23
-    "prettier": "prettier -c --write \"src/**/*\"",
24
-    "serve": "umi-serve",
25
-    "start": "cross-env UMI_ENV=dev umi dev",
26
-    "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev umi dev",
27
-    "start:no-mock": "cross-env MOCK=none UMI_ENV=dev umi dev",
28
-    "start:no-ui": "cross-env UMI_UI=none UMI_ENV=dev umi dev",
29
-    "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev umi dev",
30
-    "start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev umi dev",
31
-    "test": "umi test",
32
-    "test:component": "umi test ./src/components",
33
-    "test:e2e": "node ./tests/run-tests.js",
34
-    "tsc": "tsc --noEmit"
35
-  },
36
-  "lint-staged": {
37
-    "**/*.less": "stylelint --syntax less",
38
-    "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js",
39
-    "**/*.{js,jsx,tsx,ts,less,md,json}": [
40
-      "prettier --write"
41
-    ]
42
-  },
43
-  "browserslist": [
44
-    "> 1%",
45
-    "last 2 versions",
46
-    "not ie <= 10"
47
-  ],
48
-  "dependencies": {
49
-    "@amap/amap-jsapi-loader": "^1.0.1",
50
-    "@ant-design/icons": "^4.7.0",
51
-    "@ant-design/pro-card": "^1.18.34",
52
-    "@ant-design/pro-descriptions": "^1.10.0",
53
-    "@ant-design/pro-form": "^1.52.0",
54
-    "@ant-design/pro-layout": "^6.32.0",
55
-    "@ant-design/pro-list": "^1.21.32",
56
-    "@ant-design/pro-table": "^2.61.0",
57
-    "@umijs/route-utils": "^2.0.0",
58
-    "ali-oss": "^6.17.1",
59
-    "antd": "^4.17.0",
60
-    "classnames": "^2.3.0",
61
-    "echarts": "^5.3.1",
62
-    "lodash": "^4.17.0",
63
-    "md5": "^2.3.0",
64
-    "moment": "^2.29.1",
65
-    "omit.js": "^2.0.2",
66
-    "rc-menu": "^9.1.0",
67
-    "rc-util": "^5.16.0",
68
-    "react": "^17.0.0",
69
-    "react-dev-inspector": "^1.7.0",
70
-    "react-dom": "^17.0.0",
71
-    "react-helmet-async": "^1.2.0",
72
-    "swiper": "^8.0.7",
73
-    "umi": "^3.5.0"
74
-  },
75
-  "devDependencies": {
76
-    "@ant-design/pro-cli": "^2.1.0",
77
-    "@playwright/test": "^1.17.0",
78
-    "@types/express": "^4.17.0",
79
-    "@types/history": "^4.7.0",
80
-    "@types/jest": "^26.0.0",
81
-    "@types/lodash": "^4.14.0",
82
-    "@types/react": "^17.0.0",
83
-    "@types/react-dom": "^17.0.0",
84
-    "@types/react-helmet": "^6.1.0",
85
-    "@umijs/fabric": "^2.8.0",
86
-    "@umijs/openapi": "^1.3.0",
87
-    "@umijs/plugin-blocks": "^2.2.0",
88
-    "@umijs/plugin-esbuild": "^1.4.0",
89
-    "@umijs/plugin-openapi": "^1.3.0",
90
-    "@umijs/preset-ant-design-pro": "^1.3.0",
91
-    "@umijs/preset-dumi": "^1.1.0",
92
-    "@umijs/preset-react": "^1.8.17",
93
-    "@umijs/yorkie": "^2.0.5",
94
-    "carlo": "^0.9.46",
95
-    "cross-env": "^7.0.0",
96
-    "cross-port-killer": "^1.3.0",
97
-    "detect-installer": "^1.0.0",
98
-    "enzyme": "^3.11.0",
99
-    "eslint": "^7.32.0",
100
-    "express": "^4.17.0",
101
-    "gh-pages": "^3.2.0",
102
-    "jsdom-global": "^3.0.0",
103
-    "lint-staged": "^10.0.0",
104
-    "mockjs": "^1.1.0",
105
-    "prettier": "^2.5.0",
106
-    "puppeteer-core": "^8.0.0",
107
-    "stylelint": "^13.0.0",
108
-    "swagger-ui-react": "^3.52.0",
109
-    "typescript": "^4.5.0",
110
-    "umi-serve": "^1.9.10"
111
-  },
112
-  "engines": {
113
-    "node": ">=10.0.0"
114
-  }
115
-}
1
+{
2
+  "name": "ant-design-pro",
3
+  "version": "5.2.0",
4
+  "private": true,
5
+  "description": "An out-of-box UI solution for enterprise applications",
6
+  "scripts": {
7
+    "analyze": "cross-env ANALYZE=1 umi build",
8
+    "build": "umi build",
9
+    "deploy": "npm run build && npm run gh-pages",
10
+    "dev": "npm run start:dev",
11
+    "gh-pages": "gh-pages -d dist",
12
+    "i18n-remove": "pro i18n-remove --locale=zh-CN --write",
13
+    "postinstall": "umi g tmp",
14
+    "lint": "umi g tmp && npm run lint:js && npm run lint:style && npm run lint:prettier && npm run tsc",
15
+    "lint-staged": "lint-staged",
16
+    "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
17
+    "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style",
18
+    "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
19
+    "lint:prettier": "prettier -c --write \"src/**/*\" --end-of-line auto",
20
+    "lint:style": "stylelint --fix \"src/**/*.less\" --syntax less",
21
+    "openapi": "umi openapi",
22
+    "playwright": "playwright install && playwright test",
23
+    "prettier": "prettier -c --write \"src/**/*\"",
24
+    "serve": "umi-serve",
25
+    "start": "cross-env UMI_ENV=dev umi dev",
26
+    "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev umi dev",
27
+    "start:no-mock": "cross-env MOCK=none UMI_ENV=dev umi dev",
28
+    "start:no-ui": "cross-env UMI_UI=none UMI_ENV=dev umi dev",
29
+    "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev umi dev",
30
+    "start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev umi dev",
31
+    "test": "umi test",
32
+    "test:component": "umi test ./src/components",
33
+    "test:e2e": "node ./tests/run-tests.js",
34
+    "tsc": "tsc --noEmit"
35
+  },
36
+  "lint-staged": {
37
+    "**/*.less": "stylelint --syntax less",
38
+    "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js",
39
+    "**/*.{js,jsx,tsx,ts,less,md,json}": [
40
+      "prettier --write"
41
+    ]
42
+  },
43
+  "browserslist": [
44
+    "> 1%",
45
+    "last 2 versions",
46
+    "not ie <= 10"
47
+  ],
48
+  "dependencies": {
49
+    "@amap/amap-jsapi-loader": "^1.0.1",
50
+    "@ant-design/icons": "^4.7.0",
51
+    "@ant-design/pro-card": "^1.18.34",
52
+    "@ant-design/pro-descriptions": "^1.10.0",
53
+    "@ant-design/pro-form": "^1.52.0",
54
+    "@ant-design/pro-layout": "^6.32.0",
55
+    "@ant-design/pro-list": "^1.21.32",
56
+    "@ant-design/pro-table": "^2.61.0",
57
+    "@umijs/route-utils": "^2.0.0",
58
+    "ali-oss": "^6.17.1",
59
+    "antd": "^4.17.0",
60
+    "classnames": "^2.3.0",
61
+    "echarts": "^5.3.1",
62
+    "lodash": "^4.17.0",
63
+    "md5": "^2.3.0",
64
+    "moment": "^2.29.1",
65
+    "omit.js": "^2.0.2",
66
+    "rc-menu": "^9.1.0",
67
+    "rc-util": "^5.16.0",
68
+    "react": "^17.0.0",
69
+    "react-dev-inspector": "^1.7.0",
70
+    "react-dom": "^17.0.0",
71
+    "react-helmet-async": "^1.2.0",
72
+    "swiper": "^8.0.7",
73
+    "umi": "^3.5.0",
74
+    "web-control": "^1.0.2"
75
+  },
76
+  "devDependencies": {
77
+    "@ant-design/pro-cli": "^2.1.0",
78
+    "@playwright/test": "^1.17.0",
79
+    "@types/express": "^4.17.0",
80
+    "@types/history": "^4.7.0",
81
+    "@types/jest": "^26.0.0",
82
+    "@types/lodash": "^4.14.0",
83
+    "@types/react": "^17.0.0",
84
+    "@types/react-dom": "^17.0.0",
85
+    "@types/react-helmet": "^6.1.0",
86
+    "@umijs/fabric": "^2.8.0",
87
+    "@umijs/openapi": "^1.3.0",
88
+    "@umijs/plugin-blocks": "^2.2.0",
89
+    "@umijs/plugin-esbuild": "^1.4.0",
90
+    "@umijs/plugin-openapi": "^1.3.0",
91
+    "@umijs/preset-ant-design-pro": "^1.3.0",
92
+    "@umijs/preset-dumi": "^1.1.0",
93
+    "@umijs/preset-react": "^1.8.17",
94
+    "@umijs/yorkie": "^2.0.5",
95
+    "carlo": "^0.9.46",
96
+    "cross-env": "^7.0.0",
97
+    "cross-port-killer": "^1.3.0",
98
+    "detect-installer": "^1.0.0",
99
+    "enzyme": "^3.11.0",
100
+    "eslint": "^7.32.0",
101
+    "express": "^4.17.0",
102
+    "gh-pages": "^3.2.0",
103
+    "jsdom-global": "^3.0.0",
104
+    "lint-staged": "^10.0.0",
105
+    "mockjs": "^1.1.0",
106
+    "prettier": "^2.5.0",
107
+    "puppeteer-core": "^8.0.0",
108
+    "stylelint": "^13.0.0",
109
+    "swagger-ui-react": "^3.52.0",
110
+    "typescript": "^4.5.0",
111
+    "umi-serve": "^1.9.10"
112
+  },
113
+  "engines": {
114
+    "node": ">=10.0.0"
115
+  }
116
+}

+ 154
- 154
src/components/GeoMap/global.less Voir le fichier

@@ -1,154 +1,154 @@
1
-.geo-map-modal {
2
-  .ant-modal-header,
3
-  .ant-modal-content {
4
-    background: transparent;
5
-  }
6
-
7
-  .ant-modal-header {
8
-    color: rgba(0, 0, 0, 0);
9
-  }
10
-
11
-  .ant-modal-body {
12
-    padding: 0;
13
-    border: 2px solid #0bdaff;
14
-  }
15
-
16
-  .ant-modal-close {
17
-    top: 8px;
18
-    right: -16px;
19
-  }
20
-
21
-  .ant-modal-close-x {
22
-    color: #0bdaff;
23
-    font-size: 24px;
24
-  }
25
-}
26
-
27
-.geo-map-marker-label {
28
-  display: inline-block;
29
-  padding: 20px;
30
-  background: rgba(0, 0, 0, 0.4);
31
-}
32
-
33
-.geo-map-marker-label-text {
34
-  font-size: 24px;
35
-  line-height: 24px;
36
-  background-image: linear-gradient(180deg, #fca790 0%, #e63404 93.84765625%);
37
-  background-clip: text;
38
-  -webkit-text-fill-color: transparent;
39
-}
40
-
41
-// 合作社的样式----Start----
42
-
43
-.geo-map-rural-box {
44
-  padding: 18px;
45
-  font-weight: 800;
46
-  font-size: 12px;
47
-  background: rgba(3, 3, 3, 0.3);
48
-  border: 1px solid rgba(61, 129, 240, 0.5);
49
-  border-radius: 4px;
50
-}
51
-
52
-.borderBox {
53
-  background: #86fcb5;
54
-  background-clip: text;
55
-  -webkit-text-fill-color: transparent;
56
-}
57
-.geo-map-rural-text-span {
58
-  word-spacing: 19px;
59
-}
60
-// 合作社的样式----End----
61
-
62
-// 农机监控----Start----
63
-.SquareBox-box-carsMarker {
64
-  position: relative;
65
-  // height: 100%;
66
-  background: rgba(3, 3, 3, 0.3);
67
-  border: 1px solid rgba(61, 129, 240, 0.5);
68
-  border-radius: 4px;
69
-}
70
-.SquareBox-body-carsMarker {
71
-  height: 100%;
72
-  padding: 11px;
73
-  color: #fff;
74
-  // background: rgba(8, 40, 90, 0.4);
75
-  background: rgba(3, 3, 3, 0.3);
76
-  border: 2px solid rgba(61, 129, 240, 0.5);
77
-}
78
-.border_corner-carsMarker {
79
-  position: absolute;
80
-  width: 4px;
81
-  height: 4px;
82
-  background-color: #67ffff;
83
-  border-radius: 50%;
84
-}
85
-.border_corner_left_top-left {
86
-  top: 0;
87
-  left: -2px;
88
-  border-right: none;
89
-  border-bottom: none;
90
-}
91
-.border_corner_right_top-right {
92
-  top: 0;
93
-  right: -2px;
94
-  border-bottom: none;
95
-  border-left: none;
96
-}
97
-.border_corner_left_bottom-left {
98
-  bottom: 0;
99
-  left: -2px;
100
-  border-top: none;
101
-  border-right: none;
102
-}
103
-.border_corner_right_bottom-right {
104
-  right: -2px;
105
-  bottom: 0;
106
-  border-top: none;
107
-  border-left: none;
108
-}
109
-// 合作社的样式----End----
110
-
111
-// 农机监控信息----Start----
112
-
113
-//上部
114
-.map-top-border {
115
-  width: 100%;
116
-}
117
-
118
-.map-top-cars {
119
-  width: 7vw;
120
-}
121
-
122
-.map-top-start {
123
-  position: absolute;
124
-  top: 6.8vh;
125
-  left: 3.4vw;
126
-  // position: relative;
127
-  // top: 0px;
128
-  // left: 60px;
129
-}
130
-.map-top-stop {
131
-  position: absolute;
132
-  right: 1vw;
133
-  bottom: 8vh;
134
-}
135
-
136
-//底部
137
-.map-button-border {
138
-  font-weight: 800;
139
-  font-size: 12px;
140
-}
141
-.carsName {
142
-  margin-top: 15px;
143
-  background: #86fcb5;
144
-  background-clip: text;
145
-  -webkit-text-fill-color: transparent;
146
-}
147
-.map-button-border-carsRural {
148
-  display: flex;
149
-  justify-content: space-between;
150
-  > span {
151
-    font-weight: 800;
152
-  }
153
-}
154
-// 合作社的样式----End----
1
+.geo-map-modal {
2
+  .ant-modal-header,
3
+  .ant-modal-content {
4
+    background: transparent;
5
+  }
6
+
7
+  .ant-modal-header {
8
+    color: rgba(0, 0, 0, 0);
9
+  }
10
+
11
+  .ant-modal-body {
12
+    padding: 0;
13
+    border: 2px solid #0bdaff;
14
+  }
15
+
16
+  .ant-modal-close {
17
+    top: 8px;
18
+    right: -16px;
19
+  }
20
+
21
+  .ant-modal-close-x {
22
+    color: #0bdaff;
23
+    font-size: 24px;
24
+  }
25
+}
26
+
27
+.geo-map-marker-label {
28
+  display: inline-block;
29
+  padding: 20px;
30
+  background: rgba(0, 0, 0, 0.4);
31
+}
32
+
33
+.geo-map-marker-label-text {
34
+  font-size: 24px;
35
+  line-height: 24px;
36
+  background-image: linear-gradient(180deg, #fca790 0%, #e63404 93.84765625%);
37
+  background-clip: text;
38
+  -webkit-text-fill-color: transparent;
39
+}
40
+
41
+// 合作社的样式----Start----
42
+
43
+.geo-map-rural-box {
44
+  padding: 18px;
45
+  font-weight: 800;
46
+  font-size: 12px;
47
+  background: rgba(3, 3, 3, 0.3);
48
+  border: 1px solid rgba(61, 129, 240, 0.5);
49
+  border-radius: 4px;
50
+}
51
+
52
+.borderBox {
53
+  background: #86fcb5;
54
+  background-clip: text;
55
+  -webkit-text-fill-color: transparent;
56
+}
57
+.geo-map-rural-text-span {
58
+  word-spacing: 19px;
59
+}
60
+// 合作社的样式----End----
61
+
62
+// 农机监控----Start----
63
+.SquareBox-box-carsMarker {
64
+  position: relative;
65
+  // height: 100%;
66
+  background: rgba(3, 3, 3, 0.3);
67
+  border: 1px solid rgba(61, 129, 240, 0.5);
68
+  border-radius: 4px;
69
+}
70
+.SquareBox-body-carsMarker {
71
+  height: 100%;
72
+  padding: 11px;
73
+  color: #fff;
74
+  // background: rgba(8, 40, 90, 0.4);
75
+  background: rgba(3, 3, 3, 0.3);
76
+  border: 2px solid rgba(61, 129, 240, 0.5);
77
+}
78
+.border_corner-carsMarker {
79
+  position: absolute;
80
+  width: 4px;
81
+  height: 4px;
82
+  background-color: #67ffff;
83
+  border-radius: 50%;
84
+}
85
+.border_corner_left_top-left {
86
+  top: 0;
87
+  left: -2px;
88
+  border-right: none;
89
+  border-bottom: none;
90
+}
91
+.border_corner_right_top-right {
92
+  top: 0;
93
+  right: -2px;
94
+  border-bottom: none;
95
+  border-left: none;
96
+}
97
+.border_corner_left_bottom-left {
98
+  bottom: 0;
99
+  left: -2px;
100
+  border-top: none;
101
+  border-right: none;
102
+}
103
+.border_corner_right_bottom-right {
104
+  right: -2px;
105
+  bottom: 0;
106
+  border-top: none;
107
+  border-left: none;
108
+}
109
+// 合作社的样式----End----
110
+
111
+// 农机监控信息----Start----
112
+
113
+//上部
114
+.map-top-border {
115
+  width: 100%;
116
+}
117
+
118
+.map-top-cars {
119
+  width: 7vw;
120
+}
121
+
122
+.map-top-start {
123
+  position: absolute;
124
+  top: 6.8vh;
125
+  left: 3.4vw;
126
+  // position: relative;
127
+  // top: 0px;
128
+  // left: 60px;
129
+}
130
+.map-top-stop {
131
+  position: absolute;
132
+  right: 1vw;
133
+  bottom: 8vh;
134
+}
135
+
136
+//底部
137
+.map-button-border {
138
+  font-weight: 800;
139
+  font-size: 12px;
140
+}
141
+.carsName {
142
+  margin-top: 15px;
143
+  background: #86fcb5;
144
+  background-clip: text;
145
+  -webkit-text-fill-color: transparent;
146
+}
147
+.map-button-border-carsRural {
148
+  display: flex;
149
+  justify-content: space-between;
150
+  > span {
151
+    font-weight: 800;
152
+  }
153
+}
154
+// 合作社的样式----End----

+ 110
- 111
src/components/Hatc/sdk.js Voir le fichier

@@ -1,111 +1,110 @@
1
-/**
2
- * https://yz-websit.oss-cn-hangzhou.aliyuncs.com/nanyang/%E8%B7%A8%E6%B5%8F%E8%A7%88%E5%99%A8%E5%AA%92%E4%BD%93%E6%8F%92%E4%BB%B6%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.pdf
3
- * SDK 使用大致说明
4
- * 1、npm i web-control
5
- * 2、使用 new WebControl 实例化插件
6
- * 3、使用 JS_StartService 开启服务
7
- * 4、使用 JS_SetWindowControlCallback 注册回调
8
- * 5、使用 JS_CreateWnd 创建窗口
9
- * 6、使用 JS_DestroyWnd 销毁窗口
10
- * 7、使用 JS_Disconnect 断开连接
11
- */
12
-
13
-/**
14
- * SDK
15
- */
16
-export default function SDK({ id, width, height }) {
17
-  return new Promise((resolve, reject) => {
18
-    const ctx = {};
19
-    const ctrl = new WebControl({
20
-      szPluginContainer: id,
21
-      iServicePortStart: 14430, // 固定值
22
-      iServicePortEnd: 14439, // 固定值
23
-      szClassId: '29DDBC9A-8AEA-4827-9C3A-805D697CF38F', // 固定值
24
-      cbConnectSuccess: function () {
25
-        console.log('cbConnectSuccess');
26
-
27
-        // ctrl.SetWindowControlCallback({
28
-        //   cbIntegrationCallBack: callback,
29
-        // });
30
-
31
-        ctrl
32
-          .JS_StartService('window', {
33
-            dllPath: './WebPreview.dll',
34
-          })
35
-          .then(() => {
36
-            resolve(ctx);
37
-          })
38
-          .catch((err) => {
39
-            console.error(err);
40
-            reject(err);
41
-          });
42
-      },
43
-      cbConnectError: function () {
44
-        console.log('cbConnectError');
45
-        reject(new Error('cbConnectError'));
46
-      },
47
-      cbConnectClose: function (bNormalClose) {
48
-        console.log('cbConnectClose');
49
-      },
50
-    });
51
-    ctx.ctrl = ctrl;
52
-
53
-    // 实时预览
54
-    function preview(params) {
55
-      console.log('------preview-------', params);
56
-      return ctrl.JS_CreateWnd(id, width, height).then(function (resp) {
57
-        console.log('------JS_CreateWnd-------', resp);
58
-        return ctrl
59
-          .JS_RequestInterface({
60
-            funcName: 'setPreviewLayout',
61
-            arguments: {
62
-              devSerialNum: params.devSerialNum,
63
-              productKey: params.productKey,
64
-              layout: 1,
65
-              channels: [{ channel: params.channel, channelName: '前视' }],
66
-              channelName: '前视',
67
-              channel: params.channel,
68
-            },
69
-          })
70
-          .then(function (oData) {
71
-            console.log('------setPreviewLayout-------', oData);
72
-            return ctrl
73
-              .JS_RequestInterface({
74
-                funcName: 'startPreview',
75
-                arguments: {
76
-                  url: params.url,
77
-                  devSerialNum: params.devSerialNum,
78
-                  productKey: params.productKey,
79
-                  channel: params.channel,
80
-                  streamType: params.streamType,
81
-                  code: params.code,
82
-                  protocol: params.protocol,
83
-                },
84
-              })
85
-              .then((res) => {
86
-                console.log('------startPreview-------', res);
87
-              });
88
-          });
89
-      });
90
-    }
91
-    ctx.preview = preview;
92
-
93
-    // 停止播放
94
-    function stopPreview() {
95
-      ctrl.JS_RequestInterface({
96
-        funcName: 'stopAllPreview',
97
-        arguments: {},
98
-      });
99
-      ctrl.JS_DestroyWnd();
100
-    }
101
-    ctx.stopPreview = stopPreview;
102
-
103
-    // 销毁
104
-    function destroy() {
105
-      // 关闭所有预览
106
-      stopPreview();
107
-      ctrl.JS_Disconnect();
108
-    }
109
-    ctx.destroy = destroy;
110
-  });
111
-}
1
+/**
2
+ * https://yz-websit.oss-cn-hangzhou.aliyuncs.com/nanyang/%E8%B7%A8%E6%B5%8F%E8%A7%88%E5%99%A8%E5%AA%92%E4%BD%93%E6%8F%92%E4%BB%B6%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.pdf
3
+ * SDK 使用大致说明
4
+ * 1、npm i web-control
5
+ * 2、使用 new WebControl 实例化插件
6
+ * 3、使用 JS_StartService 开启服务
7
+ * 4、使用 JS_SetWindowControlCallback 注册回调
8
+ * 5、使用 JS_CreateWnd 创建窗口
9
+ * 6、使用 JS_DestroyWnd 销毁窗口
10
+ * 7、使用 JS_Disconnect 断开连接
11
+ */
12
+
13
+/**
14
+ * SDK
15
+ */
16
+export default function SDK ({ id, width, height }) {
17
+  return new Promise((resolve, reject) => {
18
+    const ctx = {};
19
+    const ctrl = new WebControl({
20
+      szPluginContainer: id,
21
+      iServicePortStart: 14430, // 固定值
22
+      iServicePortEnd: 14439, // 固定值
23
+      szClassId: '29DDBC9A-8AEA-4827-9C3A-805D697CF38F', // 固定值
24
+      cbConnectSuccess: function () {
25
+        console.log('cbConnectSuccess');
26
+
27
+        // ctrl.SetWindowControlCallback({
28
+        //   cbIntegrationCallBack: callback,
29
+        // });
30
+        ctrl
31
+          .JS_StartService('window', {
32
+            dllPath: './WebPreview.dll',
33
+          })
34
+          .then(() => {
35
+            resolve(ctx);
36
+          })
37
+          .catch((err) => {
38
+            console.error(err);
39
+            reject(err);
40
+          });
41
+      },
42
+      cbConnectError: function () {
43
+        console.log('cbConnectError');
44
+        reject(new Error('cbConnectError'));
45
+      },
46
+      cbConnectClose: function (bNormalClose) {
47
+        console.log('cbConnectClose');
48
+      },
49
+    });
50
+    ctx.ctrl = ctrl;
51
+
52
+    // 实时预览
53
+    function preview (params) {
54
+      console.log('------preview-------', params);
55
+      return ctrl.JS_CreateWnd(id, width, height).then(function (resp) {
56
+        console.log('------JS_CreateWnd-------', resp);
57
+        return ctrl
58
+          .JS_RequestInterface({
59
+            funcName: 'setPreviewLayout',
60
+            arguments: {
61
+              devSerialNum: params.devSerialNum,
62
+              productKey: params.productKey,
63
+              layout: 1,
64
+              channels: [{ channel: params.channel, channelName: '前视' }],
65
+              channelName: '前视',
66
+              channel: params.channel,
67
+            },
68
+          })
69
+          .then(function (oData) {
70
+            console.log('------setPreviewLayout-------', oData);
71
+            return ctrl
72
+              .JS_RequestInterface({
73
+                funcName: 'startPreview',
74
+                arguments: {
75
+                  url: params.url,
76
+                  devSerialNum: params.devSerialNum,
77
+                  productKey: params.productKey,
78
+                  channel: params.channel,
79
+                  streamType: params.streamType,
80
+                  code: params.code,
81
+                  protocol: params.protocol,
82
+                },
83
+              })
84
+              .then((res) => {
85
+                console.log('------startPreview-------', res);
86
+              });
87
+          });
88
+      });
89
+    }
90
+    ctx.preview = preview;
91
+
92
+    // 停止播放
93
+    function stopPreview () {
94
+      ctrl.JS_RequestInterface({
95
+        funcName: 'stopAllPreview',
96
+        arguments: {},
97
+      });
98
+      ctrl.JS_DestroyWnd();
99
+    }
100
+    ctx.stopPreview = stopPreview;
101
+
102
+    // 销毁
103
+    function destroy () {
104
+      // 关闭所有预览
105
+      stopPreview();
106
+      ctrl.JS_Disconnect();
107
+    }
108
+    ctx.destroy = destroy;
109
+  });
110
+}

+ 203
- 203
src/pages/Machinery/Machinery/index.jsx Voir le fichier

@@ -1,203 +1,203 @@
1
-import React, { useRef, useEffect, useState } from 'react';
2
-import { history } from 'umi';
3
-import { Button, Popconfirm, message, Select, Modal } from 'antd';
4
-import { PlusOutlined } from '@ant-design/icons';
5
-import { PageHeaderWrapper } from '@ant-design/pro-layout';
6
-import PageTable from '@/components/PageTable';
7
-import { getMachineryList, deleteMachinery, updateMachinery, updateRepair } from '@/services/machinery';
8
-import { getMachineryTypeList } from '@/services/machineryType';
9
-import { getCooperativeList } from '@/services/cooperative';
10
-
11
-const { Option } = Select;
12
-
13
-export default (props) => {
14
-  const actionRef = useRef();
15
-  const [machineryTypeList, setMachineryTypeList] = useState([]);
16
-  const [cooperativeList, setCooperativeList] = useState([]);
17
-
18
-  const gotoEdit = (id) => {
19
-    const queryStr = id ? `?id=${id}` : '';
20
-    history.push(`./machinery/Edit${queryStr}`);
21
-  };
22
-  const handleDelete = (id) => {
23
-    deleteMachinery(id).then(() => {
24
-      message.success('删除成功');
25
-      actionRef.current.reload();
26
-    }).catch((err) => {
27
-      console.log(err.message)
28
-    });
29
-  };
30
-  //列表切换农机状态方法
31
-  const handleOK = (record, data) => {
32
-    const title = record.status
33
-      ? '您确定要将该农机状态变更为维修中吗? 变更后后该农机将不能调度'
34
-      : '您确定要将该农机状态变更为正常吗? 变更后该农机可以调度';
35
-    Modal.confirm({
36
-      title: title,
37
-      okText: '确认',
38
-      cancelText: '取消',
39
-      onOk() {
40
-        updateRepair(record.machineryId, record.status === 1 ? 0 : 1)
41
-          .then((res) => {
42
-            message.success('操作成功');
43
-            actionRef.current.reload();
44
-          })
45
-          .catch((err) => {
46
-            console.log(err.message)
47
-          });
48
-      },
49
-    });
50
-  };
51
-  useEffect(() => {
52
-    getCooperativeList({ pageSize: 999 }).then((res) => {
53
-      setCooperativeList(res.records);
54
-    }).catch((err) => {
55
-      console.log(err.message)
56
-    });
57
-    getMachineryTypeList({ pageSize: 999 }).then((res) => {
58
-      setMachineryTypeList(res.records);
59
-    }).catch((err) => {
60
-      console.log(err.message)
61
-    });
62
-  }, []);
63
-  const actions = () => [
64
-    <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => gotoEdit()}>
65
-      新增农机
66
-    </Button>,
67
-  ];
68
-  const columns = [
69
-    {
70
-      title: '合作社',
71
-      dataIndex: 'orgId',
72
-      key: 'orgId',
73
-      hideInTable: true,
74
-      renderFormItem: (item, field, form) => {
75
-        return (
76
-          <Select>
77
-            {cooperativeList.map((item) => (
78
-              <Option value={item.orgId} key={item.orgId}>
79
-                {item.name}
80
-              </Option>
81
-            ))}
82
-          </Select>
83
-        )
84
-      }
85
-    },
86
-    {
87
-      title: '名称',
88
-      dataIndex: 'name',
89
-      key: 'name',
90
-    },
91
-    {
92
-      title: '合作社',
93
-      dataIndex: 'orgName',
94
-      key: 'orgName',
95
-      search: false
96
-    },
97
-    {
98
-      title: '农机类型',
99
-      dataIndex: 'typeId',
100
-      key: 'typeId',
101
-      renderFormItem: (item, field, form) => {
102
-        return (
103
-          <Select>
104
-            {machineryTypeList.map((item) => (
105
-              <Option value={item.typeId} key={item.typeId}>
106
-                {item.name}
107
-              </Option>
108
-            ))}
109
-          </Select>
110
-        );
111
-      },
112
-      hideInTable: true,
113
-    },
114
-    {
115
-      title: '农机类型',
116
-      dataIndex: 'typeName',
117
-      key: 'typeName',
118
-      search: false,
119
-    },
120
-    {
121
-      title: '区域',
122
-      dataIndex: 'regionName',
123
-      key: 'regionName',
124
-      search: false,
125
-    },
126
-    {
127
-      title: '农机单价',
128
-      dataIndex: 'price',
129
-      key: 'price',
130
-      render: (t) => t / 100,
131
-      search: false,
132
-    },
133
-    {
134
-      title: '主图',
135
-      dataIndex: 'thumb',
136
-      key: 'thumb',
137
-      width: 150,
138
-      render: (t) => <img width={110} src={t} alt="" />,
139
-      search: false,
140
-    },
141
-    {
142
-      title: '工作状态',
143
-      dataIndex: 'jobStatus',
144
-      key: 'jobStatus',
145
-      search: false,
146
-      render: (_, record) => {
147
-        return record.jobStatus == 1 ? '使用中' : '空闲中';
148
-      },
149
-    },
150
-    {
151
-      title: '状态',
152
-      dataIndex: 'status',
153
-      key: 'status',
154
-      search: false,
155
-      render: (_, record) => {
156
-        return record.status === 1 ? '正常' : '维修中';
157
-      },
158
-    },
159
-    {
160
-      title: '操作',
161
-      valueType: 'option',
162
-      render: (_, record) => [
163
-        <Button style={{ padding: 0 }} type="link" key={1} onClick={() => handleOK(record)}>
164
-          {record.status === 0 ? '完成维修' : '维修'}
165
-        </Button>,
166
-        <Button
167
-          style={{ padding: 0 }}
168
-          type="link"
169
-          key={2}
170
-          onClick={() => gotoEdit(record.machineryId)}
171
-        >
172
-          编辑
173
-        </Button>,
174
-        <Popconfirm
175
-          key={3}
176
-          title="您是否确认删除 ?"
177
-          onConfirm={() => handleDelete(record.machineryId)}
178
-          okText="确定"
179
-          cancelText="取消"
180
-        >
181
-          <Button style={{ padding: 0 }} type="link">
182
-            删除
183
-          </Button>
184
-        </Popconfirm>,
185
-      ],
186
-    },
187
-  ];
188
-
189
-  return (
190
-    <PageHeaderWrapper>
191
-      <PageTable
192
-        request={getMachineryList}
193
-        // expfunc={exportPersonList}
194
-        toolBarRender={actions}
195
-        actionRef={actionRef}
196
-        columns={columns}
197
-        rowKey="machineryId"
198
-        options={false}
199
-        scroll={{ x: 1000 }}
200
-      />
201
-    </PageHeaderWrapper>
202
-  );
203
-};
1
+import React, { useRef, useEffect, useState } from 'react';
2
+import { history } from 'umi';
3
+import { Button, Popconfirm, message, Select, Modal } from 'antd';
4
+import { PlusOutlined } from '@ant-design/icons';
5
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
6
+import PageTable from '@/components/PageTable';
7
+import { getMachineryList, deleteMachinery, updateMachinery, updateRepair } from '@/services/machinery';
8
+import { getMachineryTypeList } from '@/services/machineryType';
9
+import { getCooperativeList } from '@/services/cooperative';
10
+
11
+const { Option } = Select;
12
+
13
+export default (props) => {
14
+  const actionRef = useRef();
15
+  const [machineryTypeList, setMachineryTypeList] = useState([]);
16
+  const [cooperativeList, setCooperativeList] = useState([]);
17
+
18
+  const gotoEdit = (id) => {
19
+    const queryStr = id ? `?id=${id}` : '';
20
+    history.push(`./machinery/Edit${queryStr}`);
21
+  };
22
+  const handleDelete = (id) => {
23
+    deleteMachinery(id).then(() => {
24
+      message.success('删除成功');
25
+      actionRef.current.reload();
26
+    }).catch((err) => {
27
+      console.log(err.message)
28
+    });
29
+  };
30
+  //列表切换农机状态方法
31
+  const handleOK = (record, data) => {
32
+    const title = record.status
33
+      ? '您确定要将该农机状态变更为维修中吗? 变更后后该农机将不能调度'
34
+      : '您确定要将该农机状态变更为正常吗? 变更后该农机可以调度';
35
+    Modal.confirm({
36
+      title: title,
37
+      okText: '确认',
38
+      cancelText: '取消',
39
+      onOk() {
40
+        updateRepair(record.machineryId, record.status === 1 ? 0 : 1)
41
+          .then((res) => {
42
+            message.success('操作成功');
43
+            actionRef.current.reload();
44
+          })
45
+          .catch((err) => {
46
+            console.log(err.message)
47
+          });
48
+      },
49
+    });
50
+  };
51
+  useEffect(() => {
52
+    getCooperativeList({ pageSize: 999 }).then((res) => {
53
+      setCooperativeList(res.records);
54
+    }).catch((err) => {
55
+      console.log(err.message)
56
+    });
57
+    getMachineryTypeList({ pageSize: 999 }).then((res) => {
58
+      setMachineryTypeList(res.records);
59
+    }).catch((err) => {
60
+      console.log(err.message)
61
+    });
62
+  }, []);
63
+  const actions = () => [
64
+    <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => gotoEdit()}>
65
+      新增农机
66
+    </Button>,
67
+  ];
68
+  const columns = [
69
+    {
70
+      title: '合作社',
71
+      dataIndex: 'orgId',
72
+      key: 'orgId',
73
+      hideInTable: true,
74
+      renderFormItem: (item, field, form) => {
75
+        return (
76
+          <Select>
77
+            {cooperativeList.map((item) => (
78
+              <Option value={item.orgId} key={item.orgId}>
79
+                {item.name}
80
+              </Option>
81
+            ))}
82
+          </Select>
83
+        )
84
+      }
85
+    },
86
+    {
87
+      title: '名称',
88
+      dataIndex: 'name',
89
+      key: 'name',
90
+    },
91
+    {
92
+      title: '合作社',
93
+      dataIndex: 'orgName',
94
+      key: 'orgName',
95
+      search: false
96
+    },
97
+    {
98
+      title: '农机类型',
99
+      dataIndex: 'typeId',
100
+      key: 'typeId',
101
+      renderFormItem: (item, field, form) => {
102
+        return (
103
+          <Select>
104
+            {machineryTypeList.map((item) => (
105
+              <Option value={item.typeId} key={item.typeId}>
106
+                {item.name}
107
+              </Option>
108
+            ))}
109
+          </Select>
110
+        );
111
+      },
112
+      hideInTable: true,
113
+    },
114
+    {
115
+      title: '农机类型',
116
+      dataIndex: 'typeName',
117
+      key: 'typeName',
118
+      search: false,
119
+    },
120
+    {
121
+      title: '区域',
122
+      dataIndex: 'regionName',
123
+      key: 'regionName',
124
+      search: false,
125
+    },
126
+    {
127
+      title: '农机单价',
128
+      dataIndex: 'price',
129
+      key: 'price',
130
+      render: (t) => t / 100,
131
+      search: false,
132
+    },
133
+    {
134
+      title: '主图',
135
+      dataIndex: 'thumb',
136
+      key: 'thumb',
137
+      width: 150,
138
+      render: (t) => <img width={110} src={t} alt="" />,
139
+      search: false,
140
+    },
141
+    {
142
+      title: '工作状态',
143
+      dataIndex: 'jobStatus',
144
+      key: 'jobStatus',
145
+      search: false,
146
+      render: (_, record) => {
147
+        return record.jobStatus == 1 ? '使用中' : '空闲中';
148
+      },
149
+    },
150
+    {
151
+      title: '状态',
152
+      dataIndex: 'status',
153
+      key: 'status',
154
+      search: false,
155
+      render: (_, record) => {
156
+        return record.status === 1 ? '正常' : '维修中';
157
+      },
158
+    },
159
+    {
160
+      title: '操作',
161
+      valueType: 'option',
162
+      render: (_, record) => [
163
+        <Button style={{ padding: 0 }} type="link" key={1} onClick={() => handleOK(record)}>
164
+          {record.status === 0 ? '完成维修' : '维修'}
165
+        </Button>,
166
+        <Button
167
+          style={{ padding: 0 }}
168
+          type="link"
169
+          key={2}
170
+          onClick={() => gotoEdit(record.machineryId)}
171
+        >
172
+          编辑
173
+        </Button>,
174
+        <Popconfirm
175
+          key={3}
176
+          title="您是否确认删除 ?"
177
+          onConfirm={() => handleDelete(record.machineryId)}
178
+          okText="确定"
179
+          cancelText="取消"
180
+        >
181
+          <Button style={{ padding: 0 }} type="link">
182
+            删除
183
+          </Button>
184
+        </Popconfirm>,
185
+      ],
186
+    },
187
+  ];
188
+
189
+  return (
190
+    <PageHeaderWrapper>
191
+      <PageTable
192
+        request={getMachineryList}
193
+        // expfunc={exportPersonList}
194
+        toolBarRender={actions}
195
+        actionRef={actionRef}
196
+        columns={columns}
197
+        rowKey="machineryId"
198
+        options={false}
199
+        scroll={{ x: 1000 }}
200
+      />
201
+    </PageHeaderWrapper>
202
+  );
203
+};

+ 58
- 58
src/services/machinery.js Voir le fichier

@@ -1,58 +1,58 @@
1
-import request from '@/utils/request';
2
-
3
-/**
4
- * 保存农机
5
- * @param {*} data
6
- * @returns
7
- */
8
-export const addMachinery = (data) => request('/machinery', { method: 'post', data });
9
-
10
-/**
11
- * 修改农机
12
- * @param {*} data
13
- * @returns
14
- */
15
-export const updateMachinery = (id, data) => request(`/machinery/${id}`, { method: 'put', data });
16
-
17
-/**
18
- * 维修/完成维修农机
19
- * @param {*} data
20
- * @returns
21
- */
22
-export const updateRepair = (id, status) =>
23
-  request(`/machinery/${id}/status/${status}`, { method: 'put' });
24
-
25
-/**
26
- * 查询农机列表
27
- * @param {*} params
28
- * @returns
29
- */
30
-export const getMachineryList = (params) => request('/machinery', { params });
31
-
32
-/**
33
- * 删除农机
34
- * @param {*} data
35
- * @returns
36
- */
37
-export const deleteMachinery = (id) => request(`/machinery/${id}`, { method: 'delete' });
38
-
39
-/**
40
- * 查询农机详情
41
- * @param {*} params
42
- * @returns
43
- */
44
-export const getMachineryDetail = (id) => request(`/machinery/${id}`);
45
-
46
-/**
47
- * 查询预约状态
48
- * @param {*} params
49
- * @returns
50
- */
51
-export const getduty = (id, params) => request(`/machinery/${id}/duty`, { params });
52
-
53
-/**
54
- * 查询实时预览信息
55
- * @param {*} id
56
- * @returns
57
- */
58
-export const getPreviewInfo = (id) => request(`/machinery/${id}/preview`);
1
+import request from '@/utils/request';
2
+
3
+/**
4
+ * 保存农机
5
+ * @param {*} data
6
+ * @returns
7
+ */
8
+export const addMachinery = (data) => request('/machinery', { method: 'post', data });
9
+
10
+/**
11
+ * 修改农机
12
+ * @param {*} data
13
+ * @returns
14
+ */
15
+export const updateMachinery = (id, data) => request(`/machinery/${id}`, { method: 'put', data });
16
+
17
+/**
18
+ * 维修/完成维修农机
19
+ * @param {*} data
20
+ * @returns
21
+ */
22
+export const updateRepair = (id, status) =>
23
+  request(`/machinery/${id}/status/${status}`, { method: 'put' });
24
+
25
+/**
26
+ * 查询农机列表
27
+ * @param {*} params
28
+ * @returns
29
+ */
30
+export const getMachineryList = (params) => request('/machinery', { params });
31
+
32
+/**
33
+ * 删除农机
34
+ * @param {*} data
35
+ * @returns
36
+ */
37
+export const deleteMachinery = (id) => request(`/machinery/${id}`, { method: 'delete' });
38
+
39
+/**
40
+ * 查询农机详情
41
+ * @param {*} params
42
+ * @returns
43
+ */
44
+export const getMachineryDetail = (id) => request(`/machinery/${id}`);
45
+
46
+/**
47
+ * 查询预约状态
48
+ * @param {*} params
49
+ * @returns
50
+ */
51
+export const getduty = (id, params) => request(`/machinery/${id}/duty`, { params });
52
+
53
+/**
54
+ * 查询实时预览信息
55
+ * @param {*} id
56
+ * @returns
57
+ */
58
+export const getPreviewInfo = (id) => request(`/machinery/${id}/preview`);