Commit c2696eb206baad6b3f17c409135c37752e397d9d

Authored by xp.Huang
2 parents 35b677d2 19159770

Merge branch 'f-dev' into 'main'

fix:修改Teambition上的问题

See merge request huang/yun-teng-iot-front!269
@@ -5,8 +5,8 @@ enum ReportManagerApi { @@ -5,8 +5,8 @@ enum ReportManagerApi {
5 GET_REPORT_API = '/report_form/config', 5 GET_REPORT_API = '/report_form/config',
6 POST_REPORT_API = '/report_form/config', 6 POST_REPORT_API = '/report_form/config',
7 DELETE_REPORT_API = '/report_form/config', 7 DELETE_REPORT_API = '/report_form/config',
8 - // PUT_REPORT_API = '/report_form',  
9 - // PUTID_REPORT_API = '/report_form', 8 + PUT_REPORT_API = '/report_form/config',
  9 + PUTID_REPORT_API = '/report_form',
10 } 10 }
11 11
12 //分页 12 //分页
@@ -27,7 +27,7 @@ export const deleteReportManage = (ids: string[]) => { @@ -27,7 +27,7 @@ export const deleteReportManage = (ids: string[]) => {
27 }); 27 });
28 }; 28 };
29 29
30 -// 创建或编辑 30 +// 创建
31 export const createOrEditReportManage = (data) => { 31 export const createOrEditReportManage = (data) => {
32 return defHttp.post<ReportModel>({ 32 return defHttp.post<ReportModel>({
33 url: ReportManagerApi.POST_REPORT_API, 33 url: ReportManagerApi.POST_REPORT_API,
@@ -35,18 +35,17 @@ export const createOrEditReportManage = (data) => { @@ -35,18 +35,17 @@ export const createOrEditReportManage = (data) => {
35 }); 35 });
36 }; 36 };
37 37
38 -// // 修改状态  
39 -// export const putReportConfigManage = (data) => {  
40 -// return defHttp.post<ReportModel>({  
41 -// url: ReportManagerApi.PUT_REPORT_API,  
42 -// data,  
43 -// });  
44 -// }; 38 +// 编辑
  39 +export const putReportConfigManage = (data) => {
  40 + return defHttp.put<ReportModel>({
  41 + url: ReportManagerApi.PUT_REPORT_API,
  42 + data
  43 + });
  44 +};
45 45
46 -// // 修改状态  
47 -// export const putReportByidAndStatusManage = (data) => {  
48 -// return defHttp.post<ReportModel>({  
49 -// url: ReportManagerApi.PUTID_REPORT_API,  
50 -// data,  
51 -// });  
52 -// }; 46 +// 修改状态 id status
  47 +export const putReportByidAndStatusManage = (id, status) => {
  48 + return defHttp.put<ReportModel>({
  49 + url: ReportManagerApi.PUTID_REPORT_API + '/config/' + id + '/' + status,
  50 + });
  51 +};
@@ -26,7 +26,7 @@ export const MqttSchemas: FormSchema[] = [ @@ -26,7 +26,7 @@ export const MqttSchemas: FormSchema[] = [
26 componentProps: { 26 componentProps: {
27 placeholder: '请输入遥测数据 topic 筛选器', 27 placeholder: '请输入遥测数据 topic 筛选器',
28 }, 28 },
29 - colProps: { span: 11 }, 29 + colProps: { span: 23 },
30 }, 30 },
31 { 31 {
32 field: 'deviceAttributesTopic', 32 field: 'deviceAttributesTopic',
@@ -37,7 +37,7 @@ export const MqttSchemas: FormSchema[] = [ @@ -37,7 +37,7 @@ export const MqttSchemas: FormSchema[] = [
37 componentProps: { 37 componentProps: {
38 placeholder: '请输入Attributes topic 筛选器', 38 placeholder: '请输入Attributes topic 筛选器',
39 }, 39 },
40 - colProps: { span: 11 }, 40 + colProps: { span: 23 },
41 }, 41 },
42 { 42 {
43 field: 'desc', 43 field: 'desc',
@@ -36,8 +36,8 @@ @@ -36,8 +36,8 @@
36 const getTableData = () => { 36 const getTableData = () => {
37 for (let i = 0; i < 100; i++) { 37 for (let i = 0; i < 100; i++) {
38 tableData.value.push({ 38 tableData.value.push({
39 - tdDevice: `设备${i}`,  
40 - attr: `CO${i}、Temp${i}`, 39 + device: `设备${i}`,
  40 + attribute: `CO${i}、Temp${i}`,
41 }); 41 });
42 } 42 }
43 }; 43 };
@@ -9,28 +9,38 @@ @@ -9,28 +9,38 @@
9 > 9 >
10 <BasicForm @register="registerForm"> 10 <BasicForm @register="registerForm">
11 <template #deviceAttr="{ model, field }"> 11 <template #deviceAttr="{ model, field }">
12 - <deviceAttrColumn :orgId="model['organizationId']" :value="model['devices']" /> 12 + <deviceAttrColumn
  13 + @change="handleChange"
  14 + :orgId="!isUpdate ? model['organizationId'] : orgId"
  15 + :value="!isUpdate ? model['devices'] : deviceAttrData"
  16 + :isEdit="!isUpdate ? false : true"
  17 + />
13 <p style="display: none">{{ field }}</p> 18 <p style="display: none">{{ field }}</p>
14 </template> 19 </template>
15 </BasicForm> 20 </BasicForm>
16 </BasicDrawer> 21 </BasicDrawer>
17 </template> 22 </template>
18 <script lang="ts" setup> 23 <script lang="ts" setup>
19 - import { ref, computed, unref, nextTick } from 'vue'; 24 + import { ref, computed, unref, reactive } from 'vue';
20 import { BasicForm, useForm } from '/@/components/Form'; 25 import { BasicForm, useForm } from '/@/components/Form';
21 import { formSchema } from './config.data'; 26 import { formSchema } from './config.data';
22 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; 27 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
23 - import { createOrEditReportManage } from '/@/api/report/reportManager'; 28 + import { createOrEditReportManage, putReportConfigManage } from '/@/api/report/reportManager';
24 import { useMessage } from '/@/hooks/web/useMessage'; 29 import { useMessage } from '/@/hooks/web/useMessage';
25 import deviceAttrColumn from './cpns/MappingsForm.vue'; 30 import deviceAttrColumn from './cpns/MappingsForm.vue';
  31 + import moment from 'moment';
  32 + import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi';
26 33
27 const emit = defineEmits(['success', 'register']); 34 const emit = defineEmits(['success', 'register']);
28 const isUpdate = ref(true); 35 const isUpdate = ref(true);
29 const editId = ref(''); 36 const editId = ref('');
30 - const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ 37 + const orgId = ref('');
  38 + let deviceAttrData: any = ref([]);
  39 + const [registerForm, { validate, setFieldsValue, resetFields, updateSchema }] = useForm({
31 labelWidth: 120, 40 labelWidth: 120,
32 schemas: formSchema, 41 schemas: formSchema,
33 showActionButtonGroup: false, 42 showActionButtonGroup: false,
  43 + fieldMapToTime: [['timeZone', ['startTime', 'endTime'], 'YYYY-MM-DD HH:mm:ss']],
34 }); 44 });
35 45
36 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { 46 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
@@ -38,26 +48,119 @@ @@ -38,26 +48,119 @@
38 setDrawerProps({ confirmLoading: false }); 48 setDrawerProps({ confirmLoading: false });
39 isUpdate.value = !!data?.isUpdate; 49 isUpdate.value = !!data?.isUpdate;
40 if (unref(isUpdate)) { 50 if (unref(isUpdate)) {
41 - await nextTick(); 51 + //回显
42 editId.value = data.record.id; 52 editId.value = data.record.id;
43 await setFieldsValue(data.record); 53 await setFieldsValue(data.record);
  54 + //TODO 模拟的数据 待服务端返回
  55 + const deviceIds: any = [
  56 + '8943f0b0-f1f7-11ec-98ad-a9680487d1e0',
  57 + '8f5b4280-f29e-11ec-98ad-a9680487d1e0',
  58 + '54e199d0-f1f7-11ec-98ad-a9680487d1e0',
  59 + '6d9043f0-f1f7-11ec-98ad-a9680487d1e0',
  60 + ];
  61 + setFieldsValue({
  62 + agg: queryCondition?.agg,
  63 + interval: queryCondition?.interval,
  64 + devices: deviceIds,
  65 + });
  66 + orgId.value = data.record.organizationId;
  67 + //获取该组织下的设备--排除网关设备
  68 + const { items } = await screenLinkPageByDeptIdGetDevice({
  69 + organizationId: data.record.organizationId,
  70 + });
  71 + const options = items.map((item) => {
  72 + if (item.deviceType !== 'GATEWAY')
  73 + return {
  74 + label: item.name,
  75 + value: item.tbDeviceId,
  76 + };
  77 + });
  78 + updateSchema({
  79 + field: 'devices',
  80 + componentProps: {
  81 + options,
  82 + },
  83 + });
  84 + //TODO 回显设备属性 模拟的数据 待服务端返回
  85 + deviceAttrData.value = [
  86 + {
  87 + device: '8943f0b0-f1f7-11ec-98ad-a9680487d1e0',
  88 + attribute: 'CO2',
  89 + name: '奥迪网关子设备',
  90 + },
  91 + {
  92 + device: '6d9043f0-f1f7-11ec-98ad-a9680487d1e0',
  93 + attribute: 'co',
  94 + name: '宝马默认设备',
  95 + },
  96 + {
  97 + device: '8f5b4280-f29e-11ec-98ad-a9680487d1e0',
  98 + attribute: 'hot',
  99 + name: '奔驰默认设备',
  100 + },
  101 + {
  102 + device: '54e199d0-f1f7-11ec-98ad-a9680487d1e0',
  103 + attribute: 'wet',
  104 + name: '新增奥迪测试设备',
  105 + },
  106 + ];
44 } else { 107 } else {
45 editId.value = ''; 108 editId.value = '';
  109 + updateSchema({
  110 + field: 'devices',
  111 + componentProps: {
  112 + options: [],
  113 + },
  114 + });
46 } 115 }
47 }); 116 });
48 117
  118 + const getAttrDevice: any = ref([]);
49 const getTitle = computed(() => (!unref(isUpdate) ? '新增报表配置' : '编辑报表配置')); 119 const getTitle = computed(() => (!unref(isUpdate) ? '新增报表配置' : '编辑报表配置'));
50 120
  121 + const handleChange = (e) => (getAttrDevice.value = e);
  122 + let postObj: any = reactive({});
  123 + let queryCondition: any = reactive({});
  124 + let executeContent: any = reactive({});
  125 + const endTs: any = ref(0);
51 async function handleSubmit() { 126 async function handleSubmit() {
52 setDrawerProps({ confirmLoading: true }); 127 setDrawerProps({ confirmLoading: true });
53 try { 128 try {
54 const { createMessage } = useMessage(); 129 const { createMessage } = useMessage();
55 const values = await validate(); 130 const values = await validate();
56 - console.log(values);  
57 if (!values) return; 131 if (!values) return;
  132 + if (values.executeWay == 0) {
  133 + executeContent = null;
  134 + } else {
  135 + executeContent = {};
  136 + }
  137 + if (values.timeZone) {
  138 + const getTime = JSON.stringify(values.timeZone);
  139 + endTs.value = moment(JSON.parse(getTime)[0]).valueOf() || 1659424160000;
  140 + }
  141 + queryCondition = {
  142 + agg: values.agg,
  143 + interval: values.interval,
  144 + limit: values.limit,
  145 + };
  146 + delete values.devices;
  147 + delete values.agg;
  148 + delete values.interval;
  149 + delete values.timeZone;
  150 + postObj = {
  151 + ...values,
  152 + ...{ executeAttributes: getAttrDevice.value },
  153 + ...{ queryCondition },
  154 + ...{ endTs: endTs.value },
  155 + ...{ executeContent },
  156 + ...{ id: editId.value !== '' ? editId.value : '' },
  157 + };
58 let saveMessage = '添加成功'; 158 let saveMessage = '添加成功';
59 let updateMessage = '修改成功'; 159 let updateMessage = '修改成功';
60 - await createOrEditReportManage(values); 160 + editId.value !== ''
  161 + ? await putReportConfigManage(postObj)
  162 + : await createOrEditReportManage(postObj);
  163 +
61 closeDrawer(); 164 closeDrawer();
62 emit('success'); 165 emit('success');
63 createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); 166 createMessage.success(unref(isUpdate) ? updateMessage : saveMessage);
@@ -17,8 +17,20 @@ import { @@ -17,8 +17,20 @@ import {
17 isAvg, 17 isAvg,
18 isSum, 18 isSum,
19 isCountAll, 19 isCountAll,
20 - AggregateDataEnum,  
21 } from './timeConfig'; 20 } from './timeConfig';
  21 +import { AggregateDataEnum } from '../../device/localtion/cpns/TimePeriodForm/config';
  22 +export enum SchemaFiled {
  23 + WAY = 'way',
  24 + TIME_PERIOD = 'timePeriod',
  25 + KEYS = 'keys',
  26 + DATE_RANGE = 'dataRange',
  27 + START_TS = 'startTs',
  28 + END_TS = 'endTs',
  29 + INTERVAL = 'interval',
  30 + LIMIT = 'limit',
  31 + AGG = 'agg',
  32 + ORDER_BY = 'orderBy',
  33 +}
22 34
23 // 表格配置 35 // 表格配置
24 export const columns: BasicColumn[] = [ 36 export const columns: BasicColumn[] = [
@@ -36,16 +48,23 @@ export const columns: BasicColumn[] = [ @@ -36,16 +48,23 @@ export const columns: BasicColumn[] = [
36 title: '数据类型', 48 title: '数据类型',
37 dataIndex: 'dataCompare', 49 dataIndex: 'dataCompare',
38 width: 120, 50 width: 120,
  51 + format: (_text: string, record: Recordable) => {
  52 + return record.dataCompare === 0 ? '历史数据' : record.dataCompare === 1 ? '同比' : '环比';
  53 + },
39 }, 54 },
40 { 55 {
41 title: '配置状态', 56 title: '配置状态',
42 dataIndex: 'status', 57 dataIndex: 'status',
43 width: 120, 58 width: 120,
  59 + slots: { customRender: 'status' },
44 }, 60 },
45 { 61 {
46 title: '执行方式', 62 title: '执行方式',
47 dataIndex: 'executeWay', 63 dataIndex: 'executeWay',
48 width: 160, 64 width: 160,
  65 + format: (_text: string, record: Recordable) => {
  66 + return record.executeWay === 0 ? '立即执行' : '定时执行';
  67 + },
49 }, 68 },
50 { 69 {
51 title: '执行设备', 70 title: '执行设备',
@@ -67,12 +86,12 @@ export const columns: BasicColumn[] = [ @@ -67,12 +86,12 @@ export const columns: BasicColumn[] = [
67 export const viewDeviceColumn: BasicColumn[] = [ 86 export const viewDeviceColumn: BasicColumn[] = [
68 { 87 {
69 title: '设备', 88 title: '设备',
70 - dataIndex: 'tdDevice', 89 + dataIndex: 'device',
71 width: 80, 90 width: 80,
72 }, 91 },
73 { 92 {
74 title: '属性', 93 title: '属性',
75 - dataIndex: 'attributes', 94 + dataIndex: 'attribute',
76 width: 120, 95 width: 120,
77 }, 96 },
78 ]; 97 ];
@@ -109,7 +128,7 @@ export const searchFormSchema: FormSchema[] = [ @@ -109,7 +128,7 @@ export const searchFormSchema: FormSchema[] = [
109 }, 128 },
110 }, 129 },
111 { 130 {
112 - field: 'createTime', 131 + field: 'sendTime',
113 label: '创建时间', 132 label: '创建时间',
114 component: 'RangePicker', 133 component: 'RangePicker',
115 componentProps: { 134 componentProps: {
@@ -145,15 +164,16 @@ export const formSchema: QFormSchema[] = [ @@ -145,15 +164,16 @@ export const formSchema: QFormSchema[] = [
145 return { 164 return {
146 async onChange(e) { 165 async onChange(e) {
147 if (e) { 166 if (e) {
148 - //获取该组织下的设备 167 + //获取该组织下的设备--排除网关设备
149 const { items } = await screenLinkPageByDeptIdGetDevice({ 168 const { items } = await screenLinkPageByDeptIdGetDevice({
150 organizationId: e, 169 organizationId: e,
151 }); 170 });
152 const options = items.map((item) => { 171 const options = items.map((item) => {
153 - return {  
154 - label: item.name,  
155 - value: item.tbDeviceId,  
156 - }; 172 + if (item.deviceType !== 'GATEWAY')
  173 + return {
  174 + label: item.name,
  175 + value: item.tbDeviceId,
  176 + };
157 }); 177 });
158 updateSchema({ 178 updateSchema({
159 field: 'devices', 179 field: 'devices',
@@ -190,17 +210,17 @@ export const formSchema: QFormSchema[] = [ @@ -190,17 +210,17 @@ export const formSchema: QFormSchema[] = [
190 colProps: { 210 colProps: {
191 span: 24, 211 span: 24,
192 }, 212 },
193 - defaultValue: 1, 213 + defaultValue: 0,
194 componentProps: { 214 componentProps: {
195 placeholder: '请选择执行方式', 215 placeholder: '请选择执行方式',
196 options: [ 216 options: [
197 { 217 {
198 label: '立即执行', 218 label: '立即执行',
199 - value: 1, 219 + value: 0,
200 }, 220 },
201 { 221 {
202 label: '定时执行', 222 label: '定时执行',
203 - value: 0, 223 + value: 1,
204 }, 224 },
205 ], 225 ],
206 }, 226 },
@@ -280,7 +300,7 @@ export const formSchema: QFormSchema[] = [ @@ -280,7 +300,7 @@ export const formSchema: QFormSchema[] = [
280 field: 'devices', 300 field: 'devices',
281 label: '设备', 301 label: '设备',
282 required: true, 302 required: true,
283 - helpMessage: ['报表配置只对拥有数值型属性的设备才能配置'], 303 + helpMessage: ['报表配置只对拥有"数值型"属性的设备才能配置'],
284 component: 'Select', 304 component: 'Select',
285 componentProps: { 305 componentProps: {
286 placeholder: '请选择设备', 306 placeholder: '请选择设备',
@@ -298,7 +318,7 @@ export const formSchema: QFormSchema[] = [ @@ -298,7 +318,7 @@ export const formSchema: QFormSchema[] = [
298 }, 318 },
299 defaultValue: 0, 319 defaultValue: 0,
300 componentProps: ({ formActionType }) => { 320 componentProps: ({ formActionType }) => {
301 - const { updateSchema } = formActionType; 321 + const { updateSchema, setFieldsValue } = formActionType;
302 const options = [ 322 const options = [
303 { 323 {
304 label: '共有', 324 label: '共有',
@@ -315,6 +335,7 @@ export const formSchema: QFormSchema[] = [ @@ -315,6 +335,7 @@ export const formSchema: QFormSchema[] = [
315 if (e) { 335 if (e) {
316 let dataCompareOpions: any = []; 336 let dataCompareOpions: any = [];
317 if (e.target.value == 1) { 337 if (e.target.value == 1) {
  338 + setFieldsValue({ dataCompare: '' });
318 dataCompareOpions = [{ label: '历史数据', value: 0 }]; 339 dataCompareOpions = [{ label: '历史数据', value: 0 }];
319 updateSchema({ 340 updateSchema({
320 field: 'dataCompare', 341 field: 'dataCompare',
@@ -323,6 +344,7 @@ export const formSchema: QFormSchema[] = [ @@ -323,6 +344,7 @@ export const formSchema: QFormSchema[] = [
323 }, 344 },
324 }); 345 });
325 } else { 346 } else {
  347 + setFieldsValue({ dataCompare: '' });
326 dataCompareOpions = [ 348 dataCompareOpions = [
327 { label: '历史数据', value: 0 }, 349 { label: '历史数据', value: 0 },
328 { label: '同比', value: 1 }, 350 { label: '同比', value: 1 },
@@ -345,13 +367,12 @@ export const formSchema: QFormSchema[] = [ @@ -345,13 +367,12 @@ export const formSchema: QFormSchema[] = [
345 { 367 {
346 field: 'devices1', 368 field: 'devices1',
347 label: '设备属性', 369 label: '设备属性',
348 - required: true,  
349 component: 'Select', 370 component: 'Select',
350 componentProps: { 371 componentProps: {
351 placeholder: '请选择设备属性', 372 placeholder: '请选择设备属性',
352 }, 373 },
353 colProps: { span: 24 }, 374 colProps: { span: 24 },
354 - slot:'deviceAttr' 375 + slot: 'deviceAttr',
355 }, 376 },
356 { 377 {
357 field: 'dataCompare', 378 field: 'dataCompare',
@@ -369,43 +390,25 @@ export const formSchema: QFormSchema[] = [ @@ -369,43 +390,25 @@ export const formSchema: QFormSchema[] = [
369 colProps: { span: 24 }, 390 colProps: { span: 24 },
370 }, 391 },
371 { 392 {
372 - field: 'agg', 393 + field: SchemaFiled.AGG,
373 label: '聚合条件', 394 label: '聚合条件',
374 required: true, 395 required: true,
375 component: 'Select', 396 component: 'Select',
376 componentProps: { 397 componentProps: {
377 placeholder: '请选择聚合条件', 398 placeholder: '请选择聚合条件',
378 options: [ 399 options: [
379 - {  
380 - label: '平均值',  
381 - value: AggregateDataEnum.AVG,  
382 - },  
383 - {  
384 - label: '总和',  
385 - value: AggregateDataEnum.SUM,  
386 - },  
387 - {  
388 - label: '最大值',  
389 - value: AggregateDataEnum.MAX,  
390 - },  
391 - {  
392 - label: '最小值',  
393 - value: AggregateDataEnum.MIN,  
394 - },  
395 - {  
396 - label: '计数',  
397 - value: AggregateDataEnum.COUNT,  
398 - },  
399 - {  
400 - label: '空',  
401 - value: AggregateDataEnum.NONE,  
402 - }, 400 + { label: '最小值', value: AggregateDataEnum.MIN },
  401 + { label: '最大值', value: AggregateDataEnum.MAX },
  402 + { label: '平均值', value: AggregateDataEnum.AVG },
  403 + { label: '求和', value: AggregateDataEnum.SUM },
  404 + { label: '计数', value: AggregateDataEnum.COUNT },
  405 + { label: '空', value: AggregateDataEnum.NONE },
403 ], 406 ],
404 }, 407 },
405 colProps: { span: 24 }, 408 colProps: { span: 24 },
406 }, 409 },
407 { 410 {
408 - field: 'limit', 411 + field: SchemaFiled.LIMIT,
409 component: 'InputNumber', 412 component: 'InputNumber',
410 label: '最大值', 413 label: '最大值',
411 required: true, 414 required: true,
@@ -441,25 +444,23 @@ export const formSchema: QFormSchema[] = [ @@ -441,25 +444,23 @@ export const formSchema: QFormSchema[] = [
441 }, 444 },
442 }, 445 },
443 { 446 {
444 - field: 'interval', 447 + field: 'timeZone',
445 label: '时间段', 448 label: '时间段',
446 - required: true,  
447 component: 'RangePicker', 449 component: 'RangePicker',
448 componentProps: { 450 componentProps: {
449 - showTime: {  
450 - defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],  
451 - },  
452 - placeholder: '请选择时间段', 451 + format: 'YYYY-MM-DD HH:mm:ss',
  452 + placeholder: ['开始时间', '结束时间'],
  453 + showTime: { format: 'HH:mm:ss' },
453 }, 454 },
454 colProps: { span: 24 }, 455 colProps: { span: 24 },
455 ifShow: ({ values }) => isDefultWeek(values.defaultWeek), 456 ifShow: ({ values }) => isDefultWeek(values.defaultWeek),
456 }, 457 },
457 { 458 {
458 - field: '91112', 459 + field: 'startTs',
459 label: '时间周期', 460 label: '时间周期',
460 required: true, 461 required: true,
461 component: 'ApiSelect', 462 component: 'ApiSelect',
462 - defaultValue: '1000', 463 + defaultValue: 1000,
463 componentProps: ({ formActionType }) => { 464 componentProps: ({ formActionType }) => {
464 const { updateSchema } = formActionType; 465 const { updateSchema } = formActionType;
465 return { 466 return {
@@ -468,7 +469,7 @@ export const formSchema: QFormSchema[] = [ @@ -468,7 +469,7 @@ export const formSchema: QFormSchema[] = [
468 const option = data.map((item) => { 469 const option = data.map((item) => {
469 return { 470 return {
470 label: item.itemText, 471 label: item.itemText,
471 - value: item.itemValue, 472 + value: Number(item.itemValue),
472 }; 473 };
473 }); 474 });
474 return option; 475 return option;
@@ -477,7 +478,7 @@ export const formSchema: QFormSchema[] = [ @@ -477,7 +478,7 @@ export const formSchema: QFormSchema[] = [
477 if (Number(e) <= 30000) { 478 if (Number(e) <= 30000) {
478 //30秒以内 -> 1秒 479 //30秒以内 -> 1秒
479 updateSchema({ 480 updateSchema({
480 - field: '102121', 481 + field: 'interval',
481 componentProps: { 482 componentProps: {
482 options: optionsConfig.slice(0, 1), 483 options: optionsConfig.slice(0, 1),
483 }, 484 },
@@ -485,7 +486,7 @@ export const formSchema: QFormSchema[] = [ @@ -485,7 +486,7 @@ export const formSchema: QFormSchema[] = [
485 } else if (Number(e) == 60000) { 486 } else if (Number(e) == 60000) {
486 //1分钟以内 -> 1秒 5秒 487 //1分钟以内 -> 1秒 5秒
487 updateSchema({ 488 updateSchema({
488 - field: '102121', 489 + field: 'interval',
489 componentProps: { 490 componentProps: {
490 options: optionsConfig.slice(0, 2), 491 options: optionsConfig.slice(0, 2),
491 }, 492 },
@@ -493,7 +494,7 @@ export const formSchema: QFormSchema[] = [ @@ -493,7 +494,7 @@ export const formSchema: QFormSchema[] = [
493 } else if (Number(e) == 120000) { 494 } else if (Number(e) == 120000) {
494 //2分钟以内 -> 1秒 5秒 10 15 495 //2分钟以内 -> 1秒 5秒 10 15
495 updateSchema({ 496 updateSchema({
496 - field: '102121', 497 + field: 'interval',
497 componentProps: { 498 componentProps: {
498 options: optionsConfig.slice(0, 4), 499 options: optionsConfig.slice(0, 4),
499 }, 500 },
@@ -501,7 +502,7 @@ export const formSchema: QFormSchema[] = [ @@ -501,7 +502,7 @@ export const formSchema: QFormSchema[] = [
501 } else if (Number(e) == 300000) { 502 } else if (Number(e) == 300000) {
502 //5分钟以内 -> 1秒 5秒 10 15 30 503 //5分钟以内 -> 1秒 5秒 10 15 30
503 updateSchema({ 504 updateSchema({
504 - field: '102121', 505 + field: 'interval',
505 componentProps: { 506 componentProps: {
506 options: optionsConfig.slice(0, 5), 507 options: optionsConfig.slice(0, 5),
507 }, 508 },
@@ -509,7 +510,7 @@ export const formSchema: QFormSchema[] = [ @@ -509,7 +510,7 @@ export const formSchema: QFormSchema[] = [
509 } else if (Number(e) == 600000) { 510 } else if (Number(e) == 600000) {
510 //10分钟以内 -> 5秒 10 15 30 1分钟 511 //10分钟以内 -> 5秒 10 15 30 1分钟
511 updateSchema({ 512 updateSchema({
512 - field: '102121', 513 + field: 'interval',
513 componentProps: { 514 componentProps: {
514 options: optionsConfig.slice(1, 2).concat(optionsConfig.slice(2, 6)), 515 options: optionsConfig.slice(1, 2).concat(optionsConfig.slice(2, 6)),
515 }, 516 },
@@ -517,7 +518,7 @@ export const formSchema: QFormSchema[] = [ @@ -517,7 +518,7 @@ export const formSchema: QFormSchema[] = [
517 } else if (Number(e) == 900000 || Number(e) == 1800000) { 518 } else if (Number(e) == 900000 || Number(e) == 1800000) {
518 //15 30 分钟以内 -> 5秒 10 15 30 1分钟 2分钟 519 //15 30 分钟以内 -> 5秒 10 15 30 1分钟 2分钟
519 updateSchema({ 520 updateSchema({
520 - field: '102121', 521 + field: 'interval',
521 componentProps: { 522 componentProps: {
522 options: optionsConfig.slice(1, 2).concat(optionsConfig.slice(2, 7)), 523 options: optionsConfig.slice(1, 2).concat(optionsConfig.slice(2, 7)),
523 }, 524 },
@@ -525,7 +526,7 @@ export const formSchema: QFormSchema[] = [ @@ -525,7 +526,7 @@ export const formSchema: QFormSchema[] = [
525 } else if (Number(e) == 3600000) { 526 } else if (Number(e) == 3600000) {
526 //1小时以内 -> 10秒 15 30 1分钟 2分钟 5分钟 527 //1小时以内 -> 10秒 15 30 1分钟 2分钟 5分钟
527 updateSchema({ 528 updateSchema({
528 - field: '102121', 529 + field: 'interval',
529 componentProps: { 530 componentProps: {
530 options: optionsConfig.slice(2, 8), 531 options: optionsConfig.slice(2, 8),
531 }, 532 },
@@ -533,7 +534,7 @@ export const formSchema: QFormSchema[] = [ @@ -533,7 +534,7 @@ export const formSchema: QFormSchema[] = [
533 } else if (Number(e) == 7200000) { 534 } else if (Number(e) == 7200000) {
534 //2小时以内 -> 15秒 30 1分钟 2分钟 5分钟 10 15 535 //2小时以内 -> 15秒 30 1分钟 2分钟 5分钟 10 15
535 updateSchema({ 536 updateSchema({
536 - field: '102121', 537 + field: 'interval',
537 componentProps: { 538 componentProps: {
538 options: optionsConfig.slice(3, 10), 539 options: optionsConfig.slice(3, 10),
539 }, 540 },
@@ -541,7 +542,7 @@ export const formSchema: QFormSchema[] = [ @@ -541,7 +542,7 @@ export const formSchema: QFormSchema[] = [
541 } else if (Number(e) == 18000000) { 542 } else if (Number(e) == 18000000) {
542 //5小时以内 -> 1分钟 2分钟 5分钟 10 15 30 543 //5小时以内 -> 1分钟 2分钟 5分钟 10 15 30
543 updateSchema({ 544 updateSchema({
544 - field: '102121', 545 + field: 'interval',
545 componentProps: { 546 componentProps: {
546 options: optionsConfig.slice(5, 11), 547 options: optionsConfig.slice(5, 11),
547 }, 548 },
@@ -549,7 +550,7 @@ export const formSchema: QFormSchema[] = [ @@ -549,7 +550,7 @@ export const formSchema: QFormSchema[] = [
549 } else if (Number(e) == 36000000 || Number(e) == 43200000) { 550 } else if (Number(e) == 36000000 || Number(e) == 43200000) {
550 //10 12小时以内 -> 2分钟 5分钟 10 15 30 1小时 551 //10 12小时以内 -> 2分钟 5分钟 10 15 30 1小时
551 updateSchema({ 552 updateSchema({
552 - field: '102121', 553 + field: 'interval',
553 componentProps: { 554 componentProps: {
554 options: optionsConfig.slice(6, 12), 555 options: optionsConfig.slice(6, 12),
555 }, 556 },
@@ -557,7 +558,7 @@ export const formSchema: QFormSchema[] = [ @@ -557,7 +558,7 @@ export const formSchema: QFormSchema[] = [
557 } else if (Number(e) == 86400000) { 558 } else if (Number(e) == 86400000) {
558 //1天以内 -> 5分钟 10 15 30 1小时 2 559 //1天以内 -> 5分钟 10 15 30 1小时 2
559 updateSchema({ 560 updateSchema({
560 - field: '102121', 561 + field: 'interval',
561 componentProps: { 562 componentProps: {
562 options: optionsConfig.slice(7, 13), 563 options: optionsConfig.slice(7, 13),
563 }, 564 },
@@ -565,7 +566,7 @@ export const formSchema: QFormSchema[] = [ @@ -565,7 +566,7 @@ export const formSchema: QFormSchema[] = [
565 } else if (Number(e) == 604800000) { 566 } else if (Number(e) == 604800000) {
566 //7天以内 -> 30分钟 1小时 2 5 10 12 1天 567 //7天以内 -> 30分钟 1小时 2 5 10 12 1天
567 updateSchema({ 568 updateSchema({
568 - field: '102121', 569 + field: 'interval',
569 componentProps: { 570 componentProps: {
570 options: optionsConfig.slice(10, 17), 571 options: optionsConfig.slice(10, 17),
571 }, 572 },
@@ -573,7 +574,7 @@ export const formSchema: QFormSchema[] = [ @@ -573,7 +574,7 @@ export const formSchema: QFormSchema[] = [
573 } else if (Number(e) == 2592000000) { 574 } else if (Number(e) == 2592000000) {
574 //30天以内 -> 2小时 5 10 12 1天 575 //30天以内 -> 2小时 5 10 12 1天
575 updateSchema({ 576 updateSchema({
576 - field: '102121', 577 + field: 'interval',
577 componentProps: { 578 componentProps: {
578 options: optionsConfig.slice(12, 17), 579 options: optionsConfig.slice(12, 17),
579 }, 580 },
@@ -594,18 +595,18 @@ export const formSchema: QFormSchema[] = [ @@ -594,18 +595,18 @@ export const formSchema: QFormSchema[] = [
594 isCountAll(values.agg), 595 isCountAll(values.agg),
595 }, 596 },
596 { 597 {
597 - field: '102121', 598 + field: 'interval',
598 label: '间隔时间', 599 label: '间隔时间',
599 required: true, 600 required: true,
600 component: 'Select', 601 component: 'Select',
601 colProps: { span: 24 }, 602 colProps: { span: 24 },
602 - defaultValue: '1000', 603 + defaultValue: 1000,
603 componentProps: { 604 componentProps: {
604 placeholder: '请选择间隔时间', 605 placeholder: '请选择间隔时间',
605 options: [ 606 options: [
606 { 607 {
607 label: '1秒', 608 label: '1秒',
608 - value: '1000', 609 + value: 1000,
609 }, 610 },
610 ], 611 ],
611 }, 612 },
@@ -7,33 +7,20 @@ @@ -7,33 +7,20 @@
7 <a-input 7 <a-input
8 :disabled="true" 8 :disabled="true"
9 placeholder="设备" 9 placeholder="设备"
10 - v-model:value="param.key" 10 + v-model:value="param.device"
11 style="width: 38%; margin-bottom: 5px; margin-left: 1vh" 11 style="width: 38%; margin-bottom: 5px; margin-left: 1vh"
12 @change="emitChange" 12 @change="emitChange"
13 /> 13 />
14 <Select 14 <Select
15 placeholder="请选择设备属性" 15 placeholder="请选择设备属性"
16 - v-model:value="param.dataType" 16 + v-model:value="param.attribute"
17 style="width: 160px; margin-left: 1.8vw" 17 style="width: 160px; margin-left: 1.8vw"
18 :options="selectOptions" 18 :options="selectOptions"
19 @change="emitChange" 19 @change="emitChange"
20 /> 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> 21 </div>
34 </template> 22 </template>
35 <script lang="ts"> 23 <script lang="ts">
36 - import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons-vue';  
37 import { defineComponent, reactive, UnwrapRef, watchEffect, ref } from 'vue'; 24 import { defineComponent, reactive, UnwrapRef, watchEffect, ref } from 'vue';
38 import { propTypes } from '/@/utils/propTypes'; 25 import { propTypes } from '/@/utils/propTypes';
39 import { SelectTypes } from 'ant-design-vue/es/select'; 26 import { SelectTypes } from 'ant-design-vue/es/select';
@@ -43,63 +30,60 @@ @@ -43,63 +30,60 @@
43 30
44 interface Params { 31 interface Params {
45 [x: string]: string; 32 [x: string]: string;
46 - dataType: string;  
47 - key: string; 33 + attribute: string;
  34 + device: string;
48 } 35 }
49 36
50 export default defineComponent({ 37 export default defineComponent({
51 name: 'JAddInput', 38 name: 'JAddInput',
52 components: { 39 components: {
53 - MinusCircleOutlined,  
54 - PlusCircleOutlined,  
55 Select, 40 Select,
56 }, 41 },
57 //--------------不继承Antd Design Vue Input的所有属性 否则控制台报大片警告-------------- 42 //--------------不继承Antd Design Vue Input的所有属性 否则控制台报大片警告--------------
58 inheritAttrs: false, 43 inheritAttrs: false,
59 props: { 44 props: {
60 value: propTypes.array.def([]), 45 value: propTypes.array.def([]),
61 - //自定义删除按钮多少才会显示  
62 - min: propTypes.integer.def(0),  
63 orgId: propTypes.string.def(''), 46 orgId: propTypes.string.def(''),
  47 + isEdit: propTypes.bool.def(false),
64 }, 48 },
65 emits: ['change', 'update:value', 'dynamicReduceHeight', 'dynamicAddHeight'], 49 emits: ['change', 'update:value', 'dynamicReduceHeight', 'dynamicAddHeight'],
66 setup(props, { emit }) { 50 setup(props, { emit }) {
67 const selectOptions = ref<SelectTypes['options']>([]); 51 const selectOptions = ref<SelectTypes['options']>([]);
68 -  
69 //input动态数据 52 //input动态数据
70 const dynamicInput: UnwrapRef<{ params: Params[] }> = reactive({ params: [] }); 53 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 54 //监听传入数据value
92 watchEffect(() => { 55 watchEffect(() => {
93 initVal(); 56 initVal();
94 }); 57 });
95 -  
96 /** 58 /**
97 * 初始化数值 59 * 初始化数值
98 */ 60 */
99 async function initVal() { 61 async function initVal() {
100 dynamicInput.params = []; 62 dynamicInput.params = [];
101 - if (props.value) {  
102 - if (props.orgId) { 63 + if (props.isEdit) {
  64 + console.log('edit');
  65 + let jsonObj = props.value;
  66 + let deviceIdArr: any = [];
  67 + jsonObj.forEach((item: Params) => {
  68 + dynamicInput.params.push({
  69 + attribute: item.attribute,
  70 + device: item.name,
  71 + value: item.device,
  72 + });
  73 + deviceIdArr.push(item.device);
  74 + });
  75 + if (deviceIdArr.length > 0) {
  76 + const res = await getAttribute(props.orgId, deviceIdArr.join(','));
  77 + selectOptions.value = res.map((o) => {
  78 + return {
  79 + label: o,
  80 + value: o,
  81 + };
  82 + });
  83 + }
  84 + } else {
  85 + console.log('add');
  86 + if (props.value && props.orgId) {
103 const res = await getAttribute(props.orgId, props.value.join(',')); 87 const res = await getAttribute(props.orgId, props.value.join(','));
104 selectOptions.value = res.map((o) => { 88 selectOptions.value = res.map((o) => {
105 return { 89 return {
@@ -130,8 +114,8 @@ @@ -130,8 +114,8 @@
130 let jsonObj = temp; 114 let jsonObj = temp;
131 jsonObj.forEach((item: Params) => { 115 jsonObj.forEach((item: Params) => {
132 dynamicInput.params.push({ 116 dynamicInput.params.push({
133 - dataType: item.dataType,  
134 - key: item.label, 117 + attribute: item.attribute,
  118 + device: item.label,
135 value: item.value, 119 value: item.value,
136 }); 120 });
137 }); 121 });
@@ -146,21 +130,17 @@ @@ -146,21 +130,17 @@
146 if (dynamicInput.params.length > 0) { 130 if (dynamicInput.params.length > 0) {
147 dynamicInput.params.forEach((item: Params) => { 131 dynamicInput.params.forEach((item: Params) => {
148 obj.push({ 132 obj.push({
149 - attr: item.dataType,  
150 - tbDeviceId: item.value, 133 + attribute: item.attribute,
  134 + device: item.value,
151 }); 135 });
152 }); 136 });
153 } 137 }
154 - console.log('数值改变', obj);  
155 emit('change', obj); 138 emit('change', obj);
156 emit('update:value', obj); 139 emit('update:value', obj);
157 } 140 }
158 -  
159 return { 141 return {
160 dynamicInput, 142 dynamicInput,
161 emitChange, 143 emitChange,
162 - remove,  
163 - add,  
164 selectOptions, 144 selectOptions,
165 }; 145 };
166 }, 146 },
@@ -46,6 +46,16 @@ @@ -46,6 +46,16 @@
46 ]" 46 ]"
47 /> 47 />
48 </template> 48 </template>
  49 + <template #status="{ record }">
  50 + <Switch
  51 + :disabled="disabledSwitch"
  52 + :checked="record.status === 1"
  53 + :loading="record.pendingStatus"
  54 + checkedChildren="启用"
  55 + unCheckedChildren="禁用"
  56 + @change="(checked:boolean)=>statusChange(checked,record)"
  57 + />
  58 + </template>
49 </BasicTable> 59 </BasicTable>
50 <ReportConfigDrawer @register="registerDrawer" @success="handleSuccess" /> 60 <ReportConfigDrawer @register="registerDrawer" @success="handleSuccess" />
51 <DevicePreviewModal @register="registerModal" /> 61 <DevicePreviewModal @register="registerModal" />
@@ -53,21 +63,26 @@ @@ -53,21 +63,26 @@
53 </template> 63 </template>
54 64
55 <script lang="ts" setup> 65 <script lang="ts" setup>
56 - import { reactive, nextTick } from 'vue'; 66 + import { reactive, nextTick, ref } from 'vue';
57 import { BasicTable, useTable, TableAction } from '/@/components/Table'; 67 import { BasicTable, useTable, TableAction } from '/@/components/Table';
58 import { useDrawer } from '/@/components/Drawer'; 68 import { useDrawer } from '/@/components/Drawer';
59 import ReportConfigDrawer from './ReportConfigDrawer.vue'; 69 import ReportConfigDrawer from './ReportConfigDrawer.vue';
60 import DevicePreviewModal from './DevicePreviewModal.vue'; 70 import DevicePreviewModal from './DevicePreviewModal.vue';
61 - import { reportPage, deleteReportManage } from '/@/api/report/reportManager'; 71 + import {
  72 + reportPage,
  73 + deleteReportManage,
  74 + putReportByidAndStatusManage,
  75 + } from '/@/api/report/reportManager';
62 import { searchFormSchema, columns } from './config.data'; 76 import { searchFormSchema, columns } from './config.data';
63 import { Authority } from '/@/components/Authority'; 77 import { Authority } from '/@/components/Authority';
64 import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; 78 import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
65 - import { Popconfirm } from 'ant-design-vue'; 79 + import { Popconfirm, Switch } from 'ant-design-vue';
66 import { useModal } from '/@/components/Modal'; 80 import { useModal } from '/@/components/Modal';
67 import { useGo } from '/@/hooks/web/usePage'; 81 import { useGo } from '/@/hooks/web/usePage';
  82 + import { useMessage } from '/@/hooks/web/useMessage';
68 83
69 const searchInfo = reactive<Recordable>({}); 84 const searchInfo = reactive<Recordable>({});
70 - 85 + const disabledSwitch = ref(false);
71 const [registerTable, { reload, setProps }] = useTable({ 86 const [registerTable, { reload, setProps }] = useTable({
72 title: '报表列表', 87 title: '报表列表',
73 api: reportPage, 88 api: reportPage,
@@ -77,6 +92,7 @@ @@ -77,6 +92,7 @@
77 formConfig: { 92 formConfig: {
78 labelWidth: 120, 93 labelWidth: 120,
79 schemas: searchFormSchema, 94 schemas: searchFormSchema,
  95 + fieldMapToTime: [['sendTime', ['startTime', 'endTime'], 'YYYY-MM-DD HH:mm:ss']],
80 }, 96 },
81 useSearchForm: true, 97 useSearchForm: true,
82 showTableSetting: true, 98 showTableSetting: true,
@@ -93,6 +109,7 @@ @@ -93,6 +109,7 @@
93 109
94 // 弹框 110 // 弹框
95 const [registerDrawer, { openDrawer }] = useDrawer(); 111 const [registerDrawer, { openDrawer }] = useDrawer();
  112 + const { createMessage } = useMessage();
96 113
97 // 刷新 114 // 刷新
98 const handleSuccess = () => { 115 const handleSuccess = () => {
@@ -131,5 +148,28 @@ @@ -131,5 +148,28 @@
131 record, 148 record,
132 }); 149 });
133 }; 150 };
  151 + const statusChange = async (checked, record) => {
  152 + try {
  153 + setProps({
  154 + loading: true,
  155 + });
  156 + disabledSwitch.value = true;
  157 + const newStatus = checked ? 1 : 0;
  158 + const res = await putReportByidAndStatusManage(record.id, newStatus);
  159 + if (res && newStatus) {
  160 + createMessage.success(`启用成功`);
  161 + } else {
  162 + createMessage.success('禁用成功');
  163 + }
  164 + } finally {
  165 + setTimeout(() => {
  166 + setProps({
  167 + loading: false,
  168 + });
  169 + disabledSwitch.value = false;
  170 + }, 500);
  171 + reload();
  172 + }
  173 + };
134 const go = useGo(); 174 const go = useGo();
135 </script> 175 </script>
1 interface IOptionConfig { 1 interface IOptionConfig {
2 label: string; 2 label: string;
3 - value: string; 3 + value: number;
4 } 4 }
5 5
6 export const optionsConfig: IOptionConfig[] = [ 6 export const optionsConfig: IOptionConfig[] = [
7 { 7 {
8 label: '1秒', 8 label: '1秒',
9 - value: '1000', 9 + value: 1000,
10 }, 10 },
11 { 11 {
12 label: '5秒', 12 label: '5秒',
13 - value: '5000', 13 + value: 5000,
14 }, 14 },
15 { 15 {
16 label: '10秒', 16 label: '10秒',
17 - value: '10000', 17 + value: 10000,
18 }, 18 },
19 { 19 {
20 label: '15秒', 20 label: '15秒',
21 - value: '15000', 21 + value: 15000,
22 }, 22 },
23 { 23 {
24 label: '30秒', 24 label: '30秒',
25 - value: '30000', 25 + value: 30000,
26 }, 26 },
27 { 27 {
28 label: '1分钟', 28 label: '1分钟',
29 - value: '60000', 29 + value: 60000,
30 }, 30 },
31 { 31 {
32 label: '2分钟', 32 label: '2分钟',
33 - value: '120000', 33 + value: 120000,
34 }, 34 },
35 { 35 {
36 label: '5分钟', 36 label: '5分钟',
37 - value: '300000', 37 + value: 300000,
38 }, 38 },
39 { 39 {
40 label: '10分钟', 40 label: '10分钟',
41 - value: '600000', 41 + value: 600000,
42 }, 42 },
43 { 43 {
44 label: '15分钟', 44 label: '15分钟',
45 - value: '900000', 45 + value: 900000,
46 }, 46 },
47 { 47 {
48 label: '30分钟', 48 label: '30分钟',
49 - value: '1800000', 49 + value: 1800000,
50 }, 50 },
51 { 51 {
52 label: '1小时', 52 label: '1小时',
53 - value: '3600000', 53 + value: 3600000,
54 }, 54 },
55 { 55 {
56 label: '2小时', 56 label: '2小时',
57 - value: '7200000', 57 + value: 7200000,
58 }, 58 },
59 { 59 {
60 label: '5小时', 60 label: '5小时',
61 - value: '18000000', 61 + value: 18000000,
62 }, 62 },
63 { 63 {
64 label: '10小时', 64 label: '10小时',
65 - value: '36000000', 65 + value: 36000000,
66 }, 66 },
67 { 67 {
68 label: '12小时', 68 label: '12小时',
69 - value: '43200000', 69 + value: 43200000,
70 }, 70 },
71 { 71 {
72 label: '1天', 72 label: '1天',
73 - value: '86400000', 73 + value: 86400000,
74 }, 74 },
75 ]; 75 ];
76 76
77 export enum TypeEnum { 77 export enum TypeEnum {
78 - IS_TIMING = 0, 78 + IS_TIMING = 1,
79 IS_WEEK = 'week', 79 IS_WEEK = 'week',
80 IS_MONTH = 'month', 80 IS_MONTH = 'month',
81 IS_EMPTY = 'NONE', 81 IS_EMPTY = 'NONE',
@@ -201,9 +201,9 @@ @@ -201,9 +201,9 @@
201 if (!isJpgOrPng) { 201 if (!isJpgOrPng) {
202 createMessage.error('只能上传图片文件!'); 202 createMessage.error('只能上传图片文件!');
203 } 203 }
204 - const isLt2M = (file.size as number) / 1024 / 1024 < 5; 204 + const isLt2M = (file.size as number) / 1024 / 1024 < 2;
205 if (!isLt2M) { 205 if (!isLt2M) {
206 - createMessage.error('图片大小不能超过5MB!'); 206 + createMessage.error('图片大小不能超过2MB!');
207 } 207 }
208 return isJpgOrPng && isLt2M; 208 return isJpgOrPng && isLt2M;
209 }; 209 };
@@ -234,9 +234,9 @@ @@ -234,9 +234,9 @@
234 if (!isJpgOrPng) { 234 if (!isJpgOrPng) {
235 createMessage.error('只能上传图片文件!'); 235 createMessage.error('只能上传图片文件!');
236 } 236 }
237 - const isLt2M = (file.size as number) / 1024 / 1024 < 5; 237 + const isLt2M = (file.size as number) / 1024 / 1024 < 3;
238 if (!isLt2M) { 238 if (!isLt2M) {
239 - createMessage.error('图片大小不能超过5MB!'); 239 + createMessage.error('图片大小不能超过3MB!');
240 } 240 }
241 return isJpgOrPng && isLt2M; 241 return isJpgOrPng && isLt2M;
242 }; 242 };