Showing
8 changed files
with
348 additions
and
228 deletions
1 | 1 | import { BasicPageParams } from '/@/api/model/baseModel'; |
2 | -export type CameraQueryParam = BasicPageParams & CameraParam; | |
2 | +export type ReportQueryParam = BasicPageParams & CameraParam; | |
3 | 3 | |
4 | 4 | export type CameraParam = { |
5 | 5 | status: true; |
... | ... | @@ -9,76 +9,38 @@ export type CameraParam = { |
9 | 9 | orderType: string; |
10 | 10 | }; |
11 | 11 | |
12 | -export interface CameraModel { | |
13 | - accessMode: number; | |
14 | - avatar?: string; | |
15 | - brand: string; | |
16 | - createTime?: '2022-04-19T11:33:13.113Z'; | |
17 | - creator?: string; | |
18 | - defaultConfig?: string; | |
19 | - description?: string; | |
20 | - deviceInfo?: string; | |
21 | - deviceType?: string; | |
22 | - enabled?: true; | |
23 | - icon?: string; | |
24 | - id?: string; | |
25 | - name: string; | |
26 | - organizationId: string; | |
27 | - organizationName?: string; | |
28 | - roleIds?: ['string']; | |
29 | - sn: string; | |
30 | - status?: false; | |
31 | - tenantExpireTime?: '2022-04-19T11:33:13.113Z'; | |
32 | - tenantId?: string; | |
33 | - tenantProfileId?: string; | |
34 | - tenantStatus?: 'DISABLED'; | |
35 | - updateTime?: '2022-04-19T11:33:13.113Z'; | |
36 | - updater?: string; | |
37 | - videoUrl: string; | |
38 | -} | |
39 | - | |
40 | -export interface StreamingManageRecord { | |
41 | - id: string; | |
42 | - creator: string; | |
12 | +export interface ReportModel { | |
13 | + attributeNature: number; | |
14 | + attributes: [string]; | |
43 | 15 | createTime: string; |
16 | + creator: string; | |
17 | + dataCompare: number; | |
18 | + defaultConfig: string; | |
19 | + description: string; | |
20 | + devices: [string]; | |
21 | + enabled: true; | |
22 | + endTs: number; | |
23 | + executeContent: string; | |
24 | + executeWay: number; | |
25 | + icon: string; | |
26 | + id: string; | |
44 | 27 | name: string; |
45 | - enabled: boolean; | |
46 | - tenantId: string; | |
47 | - sn: string; | |
48 | 28 | organizationId: string; |
49 | - organizationName: string; | |
50 | - status: boolean; | |
51 | - accessMode: number; | |
52 | - playProtocol: number; | |
53 | -} | |
54 | - | |
55 | -export interface StreamingMediaModel { | |
56 | - id: string; | |
57 | - creator: string; | |
58 | - createTime: string; | |
59 | - enabled: boolean; | |
29 | + queryCondition: { | |
30 | + agg: string; | |
31 | + interval: number; | |
32 | + limit: number; | |
33 | + orderBy: string; | |
34 | + useStrictDataTypes: false; | |
35 | + }; | |
36 | + remark: string; | |
37 | + roleIds: [string]; | |
38 | + startTs: number; | |
39 | + status: number; | |
40 | + tenantExpireTime: string; | |
60 | 41 | tenantId: string; |
61 | - type: number; | |
62 | - host: string; | |
63 | - appKey: string; | |
64 | - appSecret: string; | |
65 | - ssl: number; | |
66 | -} | |
67 | - | |
68 | -export interface StreamingQueryParam { | |
69 | - host?: string; | |
70 | -} | |
71 | - | |
72 | -export interface StreamingSubmitParam { | |
73 | - type: number; | |
74 | - ssl: number; | |
75 | - host: string; | |
76 | - appKey: string; | |
77 | - appSecret: string; | |
78 | - id?: string; | |
79 | -} | |
80 | - | |
81 | -export interface StreamingMediaDeleteParam { | |
82 | - tenantId?: string; | |
83 | - ids: string[]; | |
42 | + tenantProfileId: string; | |
43 | + tenantStatus: string; | |
44 | + updateTime: string; | |
45 | + updater: string; | |
84 | 46 | } | ... | ... |
1 | 1 | import { defHttp } from '/@/utils/http/axios'; |
2 | -import { | |
3 | - CameraModel, | |
4 | - CameraQueryParam, | |
5 | - StreamingMediaDeleteParam, | |
6 | - StreamingQueryParam, | |
7 | - StreamingSubmitParam, | |
8 | -} from './model/reportModel'; | |
9 | - | |
10 | -enum CameraManagerApi { | |
11 | - CAMERA_POST_URL = '/video', | |
12 | - CAMERA_GET_URL = '/video', | |
13 | - CAMERA_DELETE_URL = '/video', | |
14 | - CAMERA_GET_DETAIL_URL = '/video', | |
15 | - STREAMING_GET_URL = '/video/platform', | |
16 | - STREAMING_POST_URL = '/video/platform', | |
17 | - STREAMING_DELETE_URL = '/video/platform', | |
18 | - STREAMING_PLAY_GET_URL = '/video/url', | |
2 | +import { ReportModel, ReportQueryParam } from './model/reportModel'; | |
3 | + | |
4 | +enum ReportManagerApi { | |
5 | + GET_REPORT_API = '/report_form/config', | |
6 | + POST_REPORT_API = '/report_form/config', | |
7 | + DELETE_REPORT_API = '/report_form/config', | |
8 | + // PUT_REPORT_API = '/report_form', | |
9 | + // PUTID_REPORT_API = '/report_form', | |
19 | 10 | } |
20 | 11 | |
21 | -export const cameraPage = (params: CameraQueryParam) => { | |
22 | - return defHttp.get<CameraQueryParam>({ | |
23 | - url: CameraManagerApi.CAMERA_GET_URL, | |
12 | +//分页 | |
13 | +export const reportPage = (params: ReportQueryParam) => { | |
14 | + return defHttp.get<ReportQueryParam>({ | |
15 | + url: ReportManagerApi.GET_REPORT_API, | |
24 | 16 | params, |
25 | 17 | }); |
26 | 18 | }; |
27 | 19 | |
28 | -/** | |
29 | - * 删除视频 | |
30 | - * @param ids 删除的ids | |
31 | - */ | |
32 | -export const deleteCameraManage = (ids: string[]) => { | |
20 | +//删除 | |
21 | +export const deleteReportManage = (ids: string[]) => { | |
33 | 22 | return defHttp.delete({ |
34 | - url: CameraManagerApi.CAMERA_DELETE_URL, | |
23 | + url: ReportManagerApi.DELETE_REPORT_API, | |
35 | 24 | data: { |
36 | 25 | ids: ids, |
37 | 26 | }, |
38 | 27 | }); |
39 | 28 | }; |
40 | 29 | |
41 | -// 创建或编辑视频 | |
42 | -export const createOrEditCameraManage = (data) => { | |
43 | - return defHttp.post<CameraModel>({ | |
44 | - url: CameraManagerApi.CAMERA_POST_URL, | |
30 | +// 创建或编辑 | |
31 | +export const createOrEditReportManage = (data) => { | |
32 | + return defHttp.post<ReportModel>({ | |
33 | + url: ReportManagerApi.POST_REPORT_API, | |
45 | 34 | data, |
46 | 35 | }); |
47 | 36 | }; |
48 | 37 | |
49 | -// 查询视频详情 | |
50 | -export const getCameraManageDetail = (id: string) => { | |
51 | - return defHttp.get({ | |
52 | - url: CameraManagerApi.CAMERA_GET_DETAIL_URL + `/${id}`, | |
53 | - }); | |
54 | -}; | |
55 | - | |
56 | -/** | |
57 | - * @description 获取流媒体列表 | |
58 | - * @param params | |
59 | - * @returns | |
60 | - */ | |
61 | -export const getStreamingMediaList = (params: StreamingQueryParam) => { | |
62 | - return defHttp.get({ | |
63 | - url: CameraManagerApi.STREAMING_GET_URL, | |
64 | - params, | |
65 | - }); | |
66 | -}; | |
67 | - | |
68 | -/** | |
69 | - * @description 更新/新增流媒体记录 | |
70 | - * @param params | |
71 | - * @returns | |
72 | - */ | |
73 | -export const createOrUpdateStreamingMediaRecord = (params: StreamingSubmitParam) => { | |
74 | - return defHttp.post({ | |
75 | - url: CameraManagerApi.STREAMING_POST_URL, | |
76 | - params, | |
77 | - }); | |
78 | -}; | |
79 | - | |
80 | -/** | |
81 | - * @description 删除流媒体记录 | |
82 | - * @param params | |
83 | - * @returns | |
84 | - */ | |
85 | -export const deleteStreamingMediaRecord = (params: StreamingMediaDeleteParam) => { | |
86 | - return defHttp.delete({ | |
87 | - url: CameraManagerApi.STREAMING_POST_URL, | |
88 | - params, | |
89 | - }); | |
90 | -}; | |
38 | +// // 修改状态 | |
39 | +// export const putReportConfigManage = (data) => { | |
40 | +// return defHttp.post<ReportModel>({ | |
41 | +// url: ReportManagerApi.PUT_REPORT_API, | |
42 | +// data, | |
43 | +// }); | |
44 | +// }; | |
91 | 45 | |
92 | -/** | |
93 | - * @description 获取流媒体播放地址 | |
94 | - * @param entityId | |
95 | - * @returns | |
96 | - */ | |
97 | -export const getStreamingPlayUrl = (entityId: string) => { | |
98 | - return defHttp.get({ | |
99 | - url: `${CameraManagerApi.STREAMING_PLAY_GET_URL}/${entityId}`, | |
100 | - }); | |
101 | -}; | |
46 | +// // 修改状态 | |
47 | +// export const putReportByidAndStatusManage = (data) => { | |
48 | +// return defHttp.post<ReportModel>({ | |
49 | +// url: ReportManagerApi.PUTID_REPORT_API, | |
50 | +// data, | |
51 | +// }); | |
52 | +// }; | ... | ... |
... | ... | @@ -7,7 +7,12 @@ |
7 | 7 | width="30%" |
8 | 8 | @ok="handleSubmit" |
9 | 9 | > |
10 | - <BasicForm @register="registerForm" /> | |
10 | + <BasicForm @register="registerForm"> | |
11 | + <template #deviceAttr="{ model, field }"> | |
12 | + <deviceAttrColumn :orgId="model['organizationId']" :value="model['devices']" /> | |
13 | + <p style="display: none">{{ field }}</p> | |
14 | + </template> | |
15 | + </BasicForm> | |
11 | 16 | </BasicDrawer> |
12 | 17 | </template> |
13 | 18 | <script lang="ts" setup> |
... | ... | @@ -15,8 +20,9 @@ |
15 | 20 | import { BasicForm, useForm } from '/@/components/Form'; |
16 | 21 | import { formSchema } from './config.data'; |
17 | 22 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
18 | - // import { createOrEditCameraManage } from '/@/api/camera/cameraManager'; | |
23 | + import { createOrEditReportManage } from '/@/api/report/reportManager'; | |
19 | 24 | import { useMessage } from '/@/hooks/web/useMessage'; |
25 | + import deviceAttrColumn from './cpns/MappingsForm.vue'; | |
20 | 26 | |
21 | 27 | const emit = defineEmits(['success', 'register']); |
22 | 28 | const isUpdate = ref(true); |
... | ... | @@ -51,7 +57,7 @@ |
51 | 57 | if (!values) return; |
52 | 58 | let saveMessage = '添加成功'; |
53 | 59 | let updateMessage = '修改成功'; |
54 | - // await createOrEditCameraManage(values); | |
60 | + await createOrEditReportManage(values); | |
55 | 61 | closeDrawer(); |
56 | 62 | emit('success'); |
57 | 63 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | ... | ... |
... | ... | @@ -4,7 +4,6 @@ import moment from 'moment'; |
4 | 4 | import { getOrganizationList } from '/@/api/system/system'; |
5 | 5 | import { copyTransFun } from '/@/utils/fnUtils'; |
6 | 6 | import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; |
7 | -import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; | |
8 | 7 | import { findDictItemByCode } from '/@/api/system/dict'; |
9 | 8 | import { |
10 | 9 | optionsConfig, |
... | ... | @@ -25,43 +24,43 @@ import { |
25 | 24 | export const columns: BasicColumn[] = [ |
26 | 25 | { |
27 | 26 | title: '配置名称', |
28 | - dataIndex: '1', | |
27 | + dataIndex: 'name', | |
29 | 28 | width: 80, |
30 | 29 | }, |
31 | 30 | { |
32 | 31 | title: '所属组织', |
33 | - dataIndex: '2', | |
32 | + dataIndex: 'organizationId', | |
34 | 33 | width: 120, |
35 | 34 | }, |
36 | 35 | { |
37 | 36 | title: '数据类型', |
38 | - dataIndex: '3', | |
37 | + dataIndex: 'dataCompare', | |
39 | 38 | width: 120, |
40 | 39 | }, |
41 | 40 | { |
42 | 41 | title: '配置状态', |
43 | - dataIndex: '4', | |
42 | + dataIndex: 'status', | |
44 | 43 | width: 120, |
45 | 44 | }, |
46 | 45 | { |
47 | 46 | title: '执行方式', |
48 | - dataIndex: '5', | |
47 | + dataIndex: 'executeWay', | |
49 | 48 | width: 160, |
50 | 49 | }, |
51 | 50 | { |
52 | 51 | title: '执行设备', |
53 | - dataIndex: '6', | |
52 | + dataIndex: 'devices', | |
54 | 53 | width: 160, |
55 | 54 | slots: { customRender: 'doDeviceSlot' }, |
56 | 55 | }, |
57 | 56 | { |
58 | 57 | title: '创建人', |
59 | - dataIndex: '7', | |
58 | + dataIndex: 'creator', | |
60 | 59 | width: 180, |
61 | 60 | }, |
62 | 61 | { |
63 | 62 | title: '创建日期', |
64 | - dataIndex: '8', | |
63 | + dataIndex: 'createTime', | |
65 | 64 | width: 180, |
66 | 65 | }, |
67 | 66 | ]; |
... | ... | @@ -73,7 +72,7 @@ export const viewDeviceColumn: BasicColumn[] = [ |
73 | 72 | }, |
74 | 73 | { |
75 | 74 | title: '属性', |
76 | - dataIndex: 'attr', | |
75 | + dataIndex: 'attributes', | |
77 | 76 | width: 120, |
78 | 77 | }, |
79 | 78 | ]; |
... | ... | @@ -81,7 +80,7 @@ export const viewDeviceColumn: BasicColumn[] = [ |
81 | 80 | // 查询配置 |
82 | 81 | export const searchFormSchema: FormSchema[] = [ |
83 | 82 | { |
84 | - field: '1', | |
83 | + field: 'name', | |
85 | 84 | label: '配置名称', |
86 | 85 | component: 'Input', |
87 | 86 | colProps: { span: 6 }, |
... | ... | @@ -91,7 +90,7 @@ export const searchFormSchema: FormSchema[] = [ |
91 | 90 | }, |
92 | 91 | }, |
93 | 92 | { |
94 | - field: '2', | |
93 | + field: 'status', | |
95 | 94 | label: '配置状态', |
96 | 95 | component: 'Select', |
97 | 96 | colProps: { span: 6 }, |
... | ... | @@ -110,7 +109,7 @@ export const searchFormSchema: FormSchema[] = [ |
110 | 109 | }, |
111 | 110 | }, |
112 | 111 | { |
113 | - field: '3', | |
112 | + field: 'createTime', | |
114 | 113 | label: '创建时间', |
115 | 114 | component: 'RangePicker', |
116 | 115 | componentProps: { |
... | ... | @@ -125,7 +124,7 @@ export const searchFormSchema: FormSchema[] = [ |
125 | 124 | // 新增编辑配置 |
126 | 125 | export const formSchema: QFormSchema[] = [ |
127 | 126 | { |
128 | - field: '1', | |
127 | + field: 'name', | |
129 | 128 | label: '报表名称', |
130 | 129 | colProps: { span: 24 }, |
131 | 130 | required: true, |
... | ... | @@ -157,26 +156,9 @@ export const formSchema: QFormSchema[] = [ |
157 | 156 | }; |
158 | 157 | }); |
159 | 158 | updateSchema({ |
160 | - field: 'entityId', | |
159 | + field: 'devices', | |
161 | 160 | componentProps: { |
162 | 161 | options, |
163 | - async onChange(e1) { | |
164 | - if (e1) { | |
165 | - const res = await getAttribute(e, e1.join(',')); | |
166 | - const attr = res.map((item) => { | |
167 | - return { | |
168 | - label: item, | |
169 | - value: item, | |
170 | - }; | |
171 | - }); | |
172 | - updateSchema({ | |
173 | - field: 'attr', | |
174 | - componentProps: { | |
175 | - options: attr, | |
176 | - }, | |
177 | - }); | |
178 | - } | |
179 | - }, | |
180 | 162 | }, |
181 | 163 | }); |
182 | 164 | } |
... | ... | @@ -192,7 +174,7 @@ export const formSchema: QFormSchema[] = [ |
192 | 174 | }, |
193 | 175 | }, |
194 | 176 | { |
195 | - field: '3', | |
177 | + field: 'remark', | |
196 | 178 | label: '描述', |
197 | 179 | colProps: { span: 24 }, |
198 | 180 | component: 'InputTextArea', |
... | ... | @@ -202,23 +184,23 @@ export const formSchema: QFormSchema[] = [ |
202 | 184 | }, |
203 | 185 | }, |
204 | 186 | { |
205 | - field: 'actionS', | |
187 | + field: 'executeWay', | |
206 | 188 | component: 'RadioGroup', |
207 | 189 | label: '执行方式', |
208 | 190 | colProps: { |
209 | 191 | span: 24, |
210 | 192 | }, |
211 | - defaultValue: '1', | |
193 | + defaultValue: 1, | |
212 | 194 | componentProps: { |
213 | 195 | placeholder: '请选择执行方式', |
214 | 196 | options: [ |
215 | 197 | { |
216 | 198 | label: '立即执行', |
217 | - value: '1', | |
199 | + value: 1, | |
218 | 200 | }, |
219 | 201 | { |
220 | 202 | label: '定时执行', |
221 | - value: 'TIMING', | |
203 | + value: 0, | |
222 | 204 | }, |
223 | 205 | ], |
224 | 206 | }, |
... | ... | @@ -238,7 +220,7 @@ export const formSchema: QFormSchema[] = [ |
238 | 220 | { label: '每月', value: 'month' }, |
239 | 221 | ], |
240 | 222 | }, |
241 | - ifShow: ({ values }) => isTiming(values.actionS), | |
223 | + ifShow: ({ values }) => isTiming(values.executeWay), | |
242 | 224 | }, |
243 | 225 | { |
244 | 226 | field: '51111', |
... | ... | @@ -292,10 +274,10 @@ export const formSchema: QFormSchema[] = [ |
292 | 274 | labelField: 'itemText', |
293 | 275 | valueField: 'itemValue', |
294 | 276 | }, |
295 | - ifShow: ({ values }) => isTiming(values.actionS), | |
277 | + ifShow: ({ values }) => isTiming(values.executeWay), | |
296 | 278 | }, |
297 | 279 | { |
298 | - field: 'entityId', | |
280 | + field: 'devices', | |
299 | 281 | label: '设备', |
300 | 282 | required: true, |
301 | 283 | helpMessage: ['报表配置只对拥有数值型属性的设备才能配置'], |
... | ... | @@ -307,30 +289,61 @@ export const formSchema: QFormSchema[] = [ |
307 | 289 | colProps: { span: 24 }, |
308 | 290 | }, |
309 | 291 | { |
310 | - field: '7', | |
292 | + field: 'attributeNature', | |
311 | 293 | component: 'RadioGroup', |
312 | 294 | label: '属性性质', |
313 | 295 | required: true, |
314 | 296 | colProps: { |
315 | 297 | span: 24, |
316 | 298 | }, |
317 | - defaultValue: '1', | |
318 | - componentProps: { | |
319 | - placeholder: '请选择属性性质', | |
320 | - options: [ | |
299 | + defaultValue: 0, | |
300 | + componentProps: ({ formActionType }) => { | |
301 | + const { updateSchema } = formActionType; | |
302 | + const options = [ | |
321 | 303 | { |
322 | 304 | label: '共有', |
323 | - value: '1', | |
305 | + value: 0, | |
324 | 306 | }, |
325 | 307 | { |
326 | 308 | label: '全部', |
327 | - value: '2', | |
309 | + value: 1, | |
328 | 310 | }, |
329 | - ], | |
311 | + ]; | |
312 | + return { | |
313 | + options, | |
314 | + async onChange(e) { | |
315 | + if (e) { | |
316 | + let dataCompareOpions: any = []; | |
317 | + if (e.target.value == 1) { | |
318 | + dataCompareOpions = [{ label: '历史数据', value: 0 }]; | |
319 | + updateSchema({ | |
320 | + field: 'dataCompare', | |
321 | + componentProps: { | |
322 | + options: dataCompareOpions, | |
323 | + }, | |
324 | + }); | |
325 | + } else { | |
326 | + dataCompareOpions = [ | |
327 | + { label: '历史数据', value: 0 }, | |
328 | + { label: '同比', value: 1 }, | |
329 | + { label: '环比', value: 2 }, | |
330 | + ]; | |
331 | + updateSchema({ | |
332 | + field: 'dataCompare', | |
333 | + componentProps: { | |
334 | + options: dataCompareOpions, | |
335 | + }, | |
336 | + }); | |
337 | + } | |
338 | + } | |
339 | + }, | |
340 | + maxLength: 250, | |
341 | + placeholder: '请选择属性性质', | |
342 | + }; | |
330 | 343 | }, |
331 | 344 | }, |
332 | 345 | { |
333 | - field: 'attr', | |
346 | + field: 'devices1', | |
334 | 347 | label: '设备属性', |
335 | 348 | required: true, |
336 | 349 | component: 'Select', |
... | ... | @@ -338,24 +351,25 @@ export const formSchema: QFormSchema[] = [ |
338 | 351 | placeholder: '请选择设备属性', |
339 | 352 | }, |
340 | 353 | colProps: { span: 24 }, |
354 | + slot:'deviceAttr' | |
341 | 355 | }, |
342 | 356 | { |
343 | - field: '9', | |
357 | + field: 'dataCompare', | |
344 | 358 | label: '数据类型', |
345 | 359 | required: true, |
346 | 360 | component: 'Select', |
347 | 361 | componentProps: { |
348 | 362 | placeholder: '请选择数据类型', |
349 | 363 | options: [ |
350 | - { label: '历史数据', value: '1' }, | |
351 | - { label: '同比', value: '2' }, | |
352 | - { label: '环比', value: '3' }, | |
364 | + { label: '历史数据', value: 0 }, | |
365 | + { label: '同比', value: 1 }, | |
366 | + { label: '环比', value: 2 }, | |
353 | 367 | ], |
354 | 368 | }, |
355 | 369 | colProps: { span: 24 }, |
356 | 370 | }, |
357 | 371 | { |
358 | - field: 'condition', | |
372 | + field: 'agg', | |
359 | 373 | label: '聚合条件', |
360 | 374 | required: true, |
361 | 375 | component: 'Select', |
... | ... | @@ -391,7 +405,7 @@ export const formSchema: QFormSchema[] = [ |
391 | 405 | colProps: { span: 24 }, |
392 | 406 | }, |
393 | 407 | { |
394 | - field: 'maxNumber', | |
408 | + field: 'limit', | |
395 | 409 | component: 'InputNumber', |
396 | 410 | label: '最大值', |
397 | 411 | required: true, |
... | ... | @@ -401,7 +415,7 @@ export const formSchema: QFormSchema[] = [ |
401 | 415 | min: 7, |
402 | 416 | max: 50000, |
403 | 417 | }, |
404 | - ifShow: ({ values }) => isEmpty(values.condition), | |
418 | + ifShow: ({ values }) => isEmpty(values.agg), | |
405 | 419 | }, |
406 | 420 | { |
407 | 421 | field: 'defaultWeek', |
... | ... | @@ -427,7 +441,7 @@ export const formSchema: QFormSchema[] = [ |
427 | 441 | }, |
428 | 442 | }, |
429 | 443 | { |
430 | - field: '3ddsadds', | |
444 | + field: 'interval', | |
431 | 445 | label: '时间段', |
432 | 446 | required: true, |
433 | 447 | component: 'RangePicker', |
... | ... | @@ -572,12 +586,12 @@ export const formSchema: QFormSchema[] = [ |
572 | 586 | }, |
573 | 587 | colProps: { span: 24 }, |
574 | 588 | ifShow: ({ values }) => |
575 | - (!isEmpty(values.condition) && !isDefultWeek(values.defaultWeek)) || | |
576 | - isMin(values.condition) || | |
577 | - isMax(values.condition) || | |
578 | - isAvg(values.condition) || | |
579 | - isSum(values.condition) || | |
580 | - isCountAll(values.condition), | |
589 | + (!isEmpty(values.agg) && !isDefultWeek(values.defaultWeek)) || | |
590 | + isMin(values.agg) || | |
591 | + isMax(values.agg) || | |
592 | + isAvg(values.agg) || | |
593 | + isSum(values.agg) || | |
594 | + isCountAll(values.agg), | |
581 | 595 | }, |
582 | 596 | { |
583 | 597 | field: '102121', |
... | ... | @@ -596,11 +610,11 @@ export const formSchema: QFormSchema[] = [ |
596 | 610 | ], |
597 | 611 | }, |
598 | 612 | ifShow: ({ values }) => |
599 | - (!isEmpty(values.condition) && !isDefultWeek(values.defaultWeek)) || | |
600 | - isMin(values.condition) || | |
601 | - isMax(values.condition) || | |
602 | - isAvg(values.condition) || | |
603 | - isSum(values.condition) || | |
604 | - isCountAll(values.condition), | |
613 | + (!isEmpty(values.agg) && !isDefultWeek(values.defaultWeek)) || | |
614 | + isMin(values.agg) || | |
615 | + isMax(values.agg) || | |
616 | + isAvg(values.agg) || | |
617 | + isSum(values.agg) || | |
618 | + isCountAll(values.agg), | |
605 | 619 | }, |
606 | 620 | ]; | ... | ... |
1 | +<template> | |
2 | + <div | |
3 | + v-for="(param, index) in dynamicInput.params" | |
4 | + :key="index" | |
5 | + style="display: flex; margin-top: 0.25vh" | |
6 | + > | |
7 | + <a-input | |
8 | + :disabled="true" | |
9 | + placeholder="设备" | |
10 | + v-model:value="param.key" | |
11 | + style="width: 38%; margin-bottom: 5px; margin-left: 1vh" | |
12 | + @change="emitChange" | |
13 | + /> | |
14 | + <Select | |
15 | + placeholder="请选择设备属性" | |
16 | + v-model:value="param.dataType" | |
17 | + style="width: 160px; margin-left: 1.8vw" | |
18 | + :options="selectOptions" | |
19 | + @change="emitChange" | |
20 | + /> | |
21 | + <MinusCircleOutlined | |
22 | + v-if="dynamicInput.params.length > min" | |
23 | + class="dynamic-delete-button" | |
24 | + @click="remove(param)" | |
25 | + style="width: 50px; display: none" | |
26 | + /> | |
27 | + </div> | |
28 | + <div style="display: none"> | |
29 | + <a-button type="text" style="width: 28%; margin-top: 0.25vh" @click="add"> | |
30 | + <PlusCircleOutlined /> | |
31 | + Add mapping | |
32 | + </a-button> | |
33 | + </div> | |
34 | +</template> | |
35 | +<script lang="ts"> | |
36 | + import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons-vue'; | |
37 | + import { defineComponent, reactive, UnwrapRef, watchEffect, ref } from 'vue'; | |
38 | + import { propTypes } from '/@/utils/propTypes'; | |
39 | + import { SelectTypes } from 'ant-design-vue/es/select'; | |
40 | + import { Select } from 'ant-design-vue'; | |
41 | + import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; | |
42 | + import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; | |
43 | + | |
44 | + interface Params { | |
45 | + [x: string]: string; | |
46 | + dataType: string; | |
47 | + key: string; | |
48 | + } | |
49 | + | |
50 | + export default defineComponent({ | |
51 | + name: 'JAddInput', | |
52 | + components: { | |
53 | + MinusCircleOutlined, | |
54 | + PlusCircleOutlined, | |
55 | + Select, | |
56 | + }, | |
57 | + //--------------不继承Antd Design Vue Input的所有属性 否则控制台报大片警告-------------- | |
58 | + inheritAttrs: false, | |
59 | + props: { | |
60 | + value: propTypes.array.def([]), | |
61 | + //自定义删除按钮多少才会显示 | |
62 | + min: propTypes.integer.def(0), | |
63 | + orgId: propTypes.string.def(''), | |
64 | + }, | |
65 | + emits: ['change', 'update:value', 'dynamicReduceHeight', 'dynamicAddHeight'], | |
66 | + setup(props, { emit }) { | |
67 | + const selectOptions = ref<SelectTypes['options']>([]); | |
68 | + | |
69 | + //input动态数据 | |
70 | + const dynamicInput: UnwrapRef<{ params: Params[] }> = reactive({ params: [] }); | |
71 | + //删除Input | |
72 | + const remove = (item: Params) => { | |
73 | + let index = dynamicInput.params.indexOf(item); | |
74 | + if (index !== -1) { | |
75 | + dynamicInput.params.splice(index, 1); | |
76 | + } | |
77 | + emitChange(); | |
78 | + emit('dynamicReduceHeight'); | |
79 | + }; | |
80 | + | |
81 | + //新增Input | |
82 | + const add = () => { | |
83 | + dynamicInput.params.push({ | |
84 | + dataType: 'STRING', | |
85 | + key: '', | |
86 | + }); | |
87 | + emitChange(); | |
88 | + emit('dynamicAddHeight'); | |
89 | + }; | |
90 | + | |
91 | + //监听传入数据value | |
92 | + watchEffect(() => { | |
93 | + initVal(); | |
94 | + }); | |
95 | + | |
96 | + /** | |
97 | + * 初始化数值 | |
98 | + */ | |
99 | + async function initVal() { | |
100 | + dynamicInput.params = []; | |
101 | + if (props.value) { | |
102 | + if (props.orgId) { | |
103 | + const res = await getAttribute(props.orgId, props.value.join(',')); | |
104 | + selectOptions.value = res.map((o) => { | |
105 | + return { | |
106 | + label: o, | |
107 | + value: o, | |
108 | + }; | |
109 | + }); | |
110 | + const { items } = await screenLinkPageByDeptIdGetDevice({ | |
111 | + organizationId: props.orgId, | |
112 | + }); | |
113 | + const options = items.map((item) => { | |
114 | + return { | |
115 | + label: item.name, | |
116 | + value: item.tbDeviceId, | |
117 | + }; | |
118 | + }); | |
119 | + const temp: any = []; | |
120 | + options.forEach((f) => { | |
121 | + props.value.forEach((f1) => { | |
122 | + if (f1 == f.value) { | |
123 | + temp.push({ | |
124 | + label: f.label, | |
125 | + value: f.value, | |
126 | + }); | |
127 | + } | |
128 | + }); | |
129 | + }); | |
130 | + let jsonObj = temp; | |
131 | + jsonObj.forEach((item: Params) => { | |
132 | + dynamicInput.params.push({ | |
133 | + dataType: item.dataType, | |
134 | + key: item.label, | |
135 | + value: item.value, | |
136 | + }); | |
137 | + }); | |
138 | + } | |
139 | + } | |
140 | + } | |
141 | + /** | |
142 | + * 数值改变 | |
143 | + */ | |
144 | + function emitChange() { | |
145 | + let obj: any = []; | |
146 | + if (dynamicInput.params.length > 0) { | |
147 | + dynamicInput.params.forEach((item: Params) => { | |
148 | + obj.push({ | |
149 | + attr: item.dataType, | |
150 | + tbDeviceId: item.value, | |
151 | + }); | |
152 | + }); | |
153 | + } | |
154 | + console.log('数值改变', obj); | |
155 | + emit('change', obj); | |
156 | + emit('update:value', obj); | |
157 | + } | |
158 | + | |
159 | + return { | |
160 | + dynamicInput, | |
161 | + emitChange, | |
162 | + remove, | |
163 | + add, | |
164 | + selectOptions, | |
165 | + }; | |
166 | + }, | |
167 | + }); | |
168 | +</script> | |
169 | +<style scoped> | |
170 | + .dynamic-delete-button { | |
171 | + cursor: pointer; | |
172 | + position: relative; | |
173 | + top: 4px; | |
174 | + font-size: 24px; | |
175 | + color: #999; | |
176 | + transition: all 0.3s; | |
177 | + } | |
178 | + | |
179 | + .dynamic-delete-button:hover { | |
180 | + color: #777; | |
181 | + } | |
182 | + | |
183 | + .dynamic-delete-button[disabled] { | |
184 | + cursor: not-allowed; | |
185 | + opacity: 0.5; | |
186 | + } | |
187 | +</style> | ... | ... |
... | ... | @@ -58,7 +58,7 @@ |
58 | 58 | import { useDrawer } from '/@/components/Drawer'; |
59 | 59 | import ReportConfigDrawer from './ReportConfigDrawer.vue'; |
60 | 60 | import DevicePreviewModal from './DevicePreviewModal.vue'; |
61 | - import { cameraPage, deleteCameraManage } from '/@/api/camera/cameraManager'; | |
61 | + import { reportPage, deleteReportManage } from '/@/api/report/reportManager'; | |
62 | 62 | import { searchFormSchema, columns } from './config.data'; |
63 | 63 | import { Authority } from '/@/components/Authority'; |
64 | 64 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
... | ... | @@ -70,7 +70,7 @@ |
70 | 70 | |
71 | 71 | const [registerTable, { reload, setProps }] = useTable({ |
72 | 72 | title: '报表列表', |
73 | - api: cameraPage, | |
73 | + api: reportPage, | |
74 | 74 | columns, |
75 | 75 | showIndexColumn: false, |
76 | 76 | clickToRowSelect: false, |
... | ... | @@ -100,7 +100,7 @@ |
100 | 100 | }; |
101 | 101 | |
102 | 102 | const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( |
103 | - deleteCameraManage, | |
103 | + deleteReportManage, | |
104 | 104 | handleSuccess, |
105 | 105 | setProps |
106 | 106 | ); | ... | ... |