Commit d93daf3603bf821d6726e9b60f8fb22586c8e26c

Authored by xp.Huang
2 parents 620c62bb 5644a9f4

Merge branch 'f-dev' into 'main'

fix:修改Teambition上的问题 pref:优化报表配置表单字段

See merge request huang/yun-teng-iot-front!265
  1 +import { BasicPageParams } from '/@/api/model/baseModel';
  2 +export type CameraQueryParam = BasicPageParams & CameraParam;
  3 +
  4 +export type CameraParam = {
  5 + status: true;
  6 + name: string;
  7 + organizationId: string;
  8 + orderFiled: string;
  9 + orderType: string;
  10 +};
  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;
  43 + createTime: string;
  44 + name: string;
  45 + enabled: boolean;
  46 + tenantId: string;
  47 + sn: string;
  48 + 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;
  60 + 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[];
  84 +}
... ...
  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',
  19 +}
  20 +
  21 +export const cameraPage = (params: CameraQueryParam) => {
  22 + return defHttp.get<CameraQueryParam>({
  23 + url: CameraManagerApi.CAMERA_GET_URL,
  24 + params,
  25 + });
  26 +};
  27 +
  28 +/**
  29 + * 删除视频
  30 + * @param ids 删除的ids
  31 + */
  32 +export const deleteCameraManage = (ids: string[]) => {
  33 + return defHttp.delete({
  34 + url: CameraManagerApi.CAMERA_DELETE_URL,
  35 + data: {
  36 + ids: ids,
  37 + },
  38 + });
  39 +};
  40 +
  41 +// 创建或编辑视频
  42 +export const createOrEditCameraManage = (data) => {
  43 + return defHttp.post<CameraModel>({
  44 + url: CameraManagerApi.CAMERA_POST_URL,
  45 + data,
  46 + });
  47 +};
  48 +
  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 +};
  91 +
  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 +};
... ...
... ... @@ -77,7 +77,7 @@
77 77 }
78 78
79 79 let resStr = '';
80   - let dirStr = isBefore ? t('component.time.after') : t('component.time.before');
  80 + let dirStr = isBefore ? t('component.time.before') : t('component.time.after');
81 81
82 82 if (diff < ONE_SECONDS) {
83 83 resStr = t('component.time.just');
... ...
... ... @@ -42,8 +42,9 @@
42 42 alt="avatar"
43 43 />
44 44 <div v-else>
45   - <div style="">
46   - <PlusOutlined style="font-size: 30px" />
  45 + <div>
  46 + <LoadingOutlined style="font-size: 30px" v-if="loading" />
  47 + <PlusOutlined v-else style="font-size: 30px" />
47 48 </div>
48 49 </div>
49 50 </Upload>
... ... @@ -53,10 +54,9 @@
53 54 <Description
54 55 class="mt-8"
55 56 :column="1"
56   - :schema="schema"
57 57 :bordered="true"
58 58 :data="getPersonalDetailValue"
59   - @register="registerDesc"
  59 + :schema="schema"
60 60 />
61 61 </div>
62 62 <div
... ... @@ -83,7 +83,7 @@
83 83 import { BasicModal, useModalInner } from '/@/components/Modal/index';
84 84 import { BasicForm, useForm } from '/@/components/Form/index';
85 85 import { formSchema } from './config';
86   - import { Description, DescItem, useDescription } from '/@/components/Description/index';
  86 + import { Description, DescItem } from '/@/components/Description/index';
87 87 import { uploadApi, personalPut } from '/@/api/personal/index';
88 88 import { useMessage } from '/@/hooks/web/useMessage';
89 89 import { USER_INFO_KEY } from '/@/enums/cacheEnum';
... ... @@ -92,6 +92,7 @@
92 92 import { PlusOutlined } from '@ant-design/icons-vue';
93 93 import { useUserStore } from '/@/store/modules/user';
94 94 import type { FileItem } from '/@/components/Upload/src/typing';
  95 + import { LoadingOutlined } from '@ant-design/icons-vue';
95 96
96 97 const schema: DescItem[] = [
97 98 {
... ... @@ -119,11 +120,20 @@
119 120 label: '创建时间:',
120 121 },
121 122 ];
  123 + const mockData: Recordable = {
  124 + username: 'test',
  125 + phoneNumber: 'VB',
  126 + email: '123',
  127 + realName: '15695909xxx',
  128 + accountExpireTime: '190848757@qq.com',
  129 + createTime: '厦门市思明区',
  130 + };
122 131 export default defineComponent({
123 132 name: 'Index',
124   - components: { BasicModal, BasicForm, Description, Upload, PlusOutlined },
  133 + components: { BasicModal, BasicForm, Description, Upload, PlusOutlined, LoadingOutlined },
125 134 emits: ['refreshPersonl', 'register'],
126 135 setup(_, { emit }) {
  136 + const loading = ref(false);
127 137 const userInfo = getAuthCache(USER_INFO_KEY);
128 138 const { createMessage } = useMessage();
129 139 const getPersonalValue: any = ref({});
... ... @@ -133,21 +143,18 @@
133 143 const getData: any = ref({});
134 144 const updataPersonlData: any = ref({});
135 145 const userStore = useUserStore();
136   - // const getUpdateUserInfo: any = ref({});
137   - const [registerDesc] = useDescription({
138   - title: '个人详情',
139   - schema: schema,
140   - });
141   -
142 146 const peresonalPic = ref();
143 147
144 148 const customUploadqrcodePic = async ({ file }) => {
145 149 if (beforeUploadqrcodePic(file)) {
  150 + peresonalPic.value = '';
  151 + loading.value = true;
146 152 const formData = new FormData();
147 153 formData.append('file', file);
148 154 const response = await uploadApi(formData);
149 155 if (response.fileStaticUri) {
150 156 peresonalPic.value = response.fileStaticUri;
  157 + loading.value = false;
151 158 }
152 159 }
153 160 };
... ... @@ -236,10 +243,11 @@
236 243 compHeight,
237 244 handleSubmit,
238 245 getPersonalDetailValue,
239   - registerDesc,
240 246 schema,
241 247 registerModal,
242 248 registerForm,
  249 + loading,
  250 + mockData
243 251 };
244 252 },
245 253 });
... ...
1 1 <template>
2 2 <div>
3   - <BasicTable @register="registerTable" :dataSource="tableData">
  3 + <BasicTable @register="registerTable" :dataSource="tableData" style="height: 12rem">
4 4 <template #status>
5 5 <Switch
6 6 checked-children="开"
... ... @@ -11,7 +11,7 @@
11 11 />
12 12 </template>
13 13 </BasicTable>
14   - <div style="margin-top: -54vh">
  14 + <div style="margin-left: 0.44rem">
15 15 <a-button type="primary" class="mr-4" :disabled="disabled" @click="handleFrpRemote"
16 16 >远程连接</a-button
17 17 >
... ... @@ -27,7 +27,6 @@
27 27 import { Tag } from 'ant-design-vue';
28 28 import { frpGetInfoApi, frpPutInfoApi } from '/@/api/device/deviceConfigApi';
29 29 import { useMessage } from '/@/hooks/web/useMessage';
30   - import { ConsoleSqlOutlined } from '@ant-design/icons-vue';
31 30
32 31 const props = defineProps({
33 32 deviceDetail: {
... ... @@ -42,7 +41,7 @@
42 41 const disabled = ref<boolean>(true);
43 42 const viewDeviceColumn: BasicColumn[] = [
44 43 {
45   - title: 'Frp连接状态',
  44 + title: '远程连接状态',
46 45 dataIndex: 'status',
47 46 width: 80,
48 47 customRender: ({ record }) => {
... ... @@ -53,7 +52,7 @@
53 52 },
54 53 },
55 54 {
56   - title: '远程连接',
  55 + title: '允许远程连接',
57 56 dataIndex: 'enableRemote',
58 57 width: 80,
59 58 slots: { customRender: 'status' },
... ... @@ -78,7 +77,6 @@
78 77 const address = ref('');
79 78 const enableRemoteDisabled = ref(false);
80 79 const getTableData = async () => {
81   - // const res = await frpGetInfoApi('1000000061664FF');
82 80 const res = await frpGetInfoApi(props.deviceDetail.sn);
83 81 enableRemote.value = res.enableRemote;
84 82 proxyName.value = res.proxyName;
... ...
... ... @@ -15,7 +15,7 @@
15 15 import { BasicForm, useForm } from '/@/components/Form';
16 16 import { formSchema } from './config.data';
17 17 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
18   - import { createOrEditCameraManage } from '/@/api/camera/cameraManager';
  18 + // import { createOrEditCameraManage } from '/@/api/camera/cameraManager';
19 19 import { useMessage } from '/@/hooks/web/useMessage';
20 20
21 21 const emit = defineEmits(['success', 'register']);
... ... @@ -47,10 +47,11 @@
47 47 try {
48 48 const { createMessage } = useMessage();
49 49 const values = await validate();
  50 + console.log(values);
50 51 if (!values) return;
51 52 let saveMessage = '添加成功';
52 53 let updateMessage = '修改成功';
53   - await createOrEditCameraManage(values);
  54 + // await createOrEditCameraManage(values);
54 55 closeDrawer();
55 56 emit('success');
56 57 createMessage.success(unref(isUpdate) ? updateMessage : saveMessage);
... ...
... ... @@ -5,6 +5,7 @@ import { getOrganizationList } from '/@/api/system/system';
5 5 import { copyTransFun } from '/@/utils/fnUtils';
6 6 import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi';
7 7 import { getAttribute } from '/@/api/ruleengine/ruleengineApi';
  8 +import { findDictItemByCode } from '/@/api/system/dict';
8 9
9 10 export enum TypeEnum {
10 11 IS_TIMING = 'TIMING',
... ... @@ -22,7 +23,6 @@ export const isMonth = (type: string) => {
22 23 return type === TypeEnum.IS_MONTH;
23 24 };
24 25
25   -
26 26 export enum AggregateDataEnum {
27 27 MIN = 'MIN',
28 28 MAX = 'MAX',
... ... @@ -139,7 +139,6 @@ export const formSchema: QFormSchema[] = [
139 139 field: '1',
140 140 label: '报表名称',
141 141 colProps: { span: 24 },
142   - helpMessage: ['报表配置', '只对拥有数值型属性', '的设备才能配置'],
143 142 required: true,
144 143 component: 'Input',
145 144 componentProps: {
... ... @@ -241,7 +240,7 @@ export const formSchema: QFormSchema[] = [
241 240 label: '周期',
242 241 required: true,
243 242 colProps: { span: 24 },
244   - defaultValue: '1',
  243 + defaultValue: 'day',
245 244 componentProps: {
246 245 placeholder: '请选择周期',
247 246 options: [
... ... @@ -253,55 +252,56 @@ export const formSchema: QFormSchema[] = [
253 252 ifShow: ({ values }) => isTiming(values.actionS),
254 253 },
255 254 {
256   - field: '5',
257   - component: 'Select',
  255 + field: '51111',
  256 + component: 'ApiSelect',
258 257 label: '每周',
259 258 required: true,
260 259 colProps: { span: 24 },
261   - defaultValue: '1',
  260 + defaultValue: '0 0 0 ? * 1',
262 261 componentProps: {
263 262 placeholder: '请选择周期',
264   - options: [
265   - { label: '星期一', value: '1' },
266   - { label: '星期二', value: '2' },
267   - { label: '星期三', value: '3' },
268   - { label: '星期四', value: '3' },
269   - { label: '星期五', value: '3' },
270   - ],
  263 + api: findDictItemByCode,
  264 + params: {
  265 + dictCode: 'every_week',
  266 + },
  267 + labelField: 'itemText',
  268 + valueField: 'itemValue',
271 269 },
272 270 ifShow: ({ values }) => isWeek(values.timeWeek),
273 271 },
274 272 {
275   - field: '5',
276   - component: 'Select',
  273 + field: '71111',
  274 + component: 'ApiSelect',
277 275 label: '每月',
278 276 required: true,
279 277 colProps: { span: 24 },
280   - defaultValue: '1',
  278 + defaultValue: '0 0 0 1 * ? *',
281 279 componentProps: {
282   - placeholder: '请选择周期',
283   - options: [
284   - { label: '1日', value: '1' },
285   - { label: '2日', value: '7' },
286   - { label: '3日', value: '30' },
287   - ],
  280 + placeholder: '请选择月份',
  281 + api: findDictItemByCode,
  282 + params: {
  283 + dictCode: 'every_month',
  284 + },
  285 + labelField: 'itemText',
  286 + valueField: 'itemValue',
288 287 },
289 288 ifShow: ({ values }) => isMonth(values.timeWeek),
290 289 },
291 290 {
292   - field: '6',
293   - component: 'Select',
  291 + field: '62121',
  292 + component: 'ApiSelect',
294 293 label: '时间',
295 294 required: true,
296 295 colProps: { span: 24 },
297   - defaultValue: '1',
  296 + defaultValue: '0 0 0 * * ?',
298 297 componentProps: {
299 298 placeholder: '请选择时间',
300   - options: [
301   - { label: '00点', value: '1' },
302   - { label: '01点', value: '2' },
303   - { label: '02点', value: '3' },
304   - ],
  299 + api: findDictItemByCode,
  300 + params: {
  301 + dictCode: 'every_day',
  302 + },
  303 + labelField: 'itemText',
  304 + valueField: 'itemValue',
305 305 },
306 306 ifShow: ({ values }) => isTiming(values.actionS),
307 307 },
... ... @@ -309,6 +309,7 @@ export const formSchema: QFormSchema[] = [
309 309 field: 'entityId',
310 310 label: '设备',
311 311 required: true,
  312 + helpMessage: ['报表配置只对拥有数值型属性的设备才能配置'],
312 313 component: 'Select',
313 314 componentProps: {
314 315 placeholder: '请选择设备',
... ... @@ -359,7 +360,7 @@ export const formSchema: QFormSchema[] = [
359 360 options: [
360 361 { label: '历史数据', value: '1' },
361 362 { label: '同比', value: '2' },
362   - { label: '环比', value: '2' },
  363 + { label: '环比', value: '3' },
363 364 ],
364 365 },
365 366 colProps: { span: 24 },
... ... @@ -393,32 +394,49 @@ export const formSchema: QFormSchema[] = [
393 394 colProps: { span: 24 },
394 395 },
395 396 {
396   - field: '9',
  397 + field: '91112',
397 398 label: '查询周期',
398 399 required: true,
399 400 component: 'Select',
400 401 componentProps: {
401 402 placeholder: '请选择查询周期',
402 403 options: [
403   - { label: '1分钟', value: '60000' },
404   - { label: '2分钟', value: '120000' },
405   - { label: '3分钟', value: '180000' },
  404 + { label: '1秒', value: '1000' },
  405 + { label: '5秒', value: '5000' },
  406 + { label: '10秒', value: '10000' },
  407 + { label: '15秒', value: '15000' },
  408 + { label: '30秒', value: '30000' },
  409 + { label: '1分', value: '60000' },
  410 + { label: '2分', value: '120000' },
  411 + { label: '5分', value: '300000' },
  412 + { label: '10分', value: '600000' },
  413 + { label: '15分', value: '900000' },
  414 + { label: '30分', value: '1800000' },
  415 + { label: '1小时', value: '3600000' },
  416 + { label: '2小时', value: '7200000' },
  417 + { label: '5小时', value: '18000000' },
  418 + { label: '10小时', value: '36000000' },
  419 + { label: '12小时', value: '43200000' },
  420 + { label: '1天', value: '86400000' },
  421 + { label: '7天', value: '604800000' },
  422 + { label: '30天', value: '2592000000' },
406 423 ],
407 424 },
408 425 colProps: { span: 24 },
409 426 },
410 427 {
411   - field: '10',
  428 + field: '102121',
412 429 label: '间隔时间',
413 430 required: true,
414 431 component: 'Select',
415 432 componentProps: {
416 433 placeholder: '请选择间隔时间',
417 434 options: [
418   - { label: '1秒', value: '1000' },
419   - { label: '5秒', value: '5000' },
420   - { label: '10秒', value: '10000' },
421   - { label: '15秒', value: '150000' },
  435 + { label: '2小时', value: '7200000' },
  436 + { label: '5小时', value: '18000000' },
  437 + { label: '10小时', value: '36000000' },
  438 + { label: '12小时', value: '43200000' },
  439 + { label: '1天', value: '86400000' },
422 440 ],
423 441 },
424 442 colProps: { span: 24 },
... ...