diff --git a/components.d.ts b/components.d.ts index e09ce39..7a96923 100644 --- a/components.d.ts +++ b/components.d.ts @@ -7,6 +7,8 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { + ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb'] + ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem'] ElButton: typeof import('element-plus/es')['ElButton'] ElCarousel: typeof import('element-plus/es')['ElCarousel'] ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem'] @@ -15,12 +17,15 @@ declare module 'vue' { ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElInput: typeof import('element-plus/es')['ElInput'] + ElMenu: typeof import('element-plus/es')['ElMenu'] + ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] ElOption: typeof import('element-plus/es')['ElOption'] ElPagination: typeof import('element-plus/es')['ElPagination'] ElPopover: typeof import('element-plus/es')['ElPopover'] ElRadio: typeof import('element-plus/es')['ElRadio'] ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElSelect: typeof import('element-plus/es')['ElSelect'] + ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTimeSelect: typeof import('element-plus/es')['ElTimeSelect'] diff --git a/dist.zip b/dist.zip deleted file mode 100644 index 6259e07..0000000 Binary files a/dist.zip and /dev/null differ diff --git a/src/hooks/handleFun.ts b/src/hooks/handleFun.ts index 78aa47c..b462ae9 100644 --- a/src/hooks/handleFun.ts +++ b/src/hooks/handleFun.ts @@ -1,111 +1,128 @@ // 处理一些常用的方法 - // 处理单位换算 export function handleUnit(data) { - if (Number(data) > 10000) { - return (data / 1000).toFixed(2) - } else { - return data - } + if (Number(data) > 10000) { + return (data / 1000).toFixed(2); + } else { + return data; + } } - - - // 处理echarts数据 export function handleEchartsData(data, value) { - // 间隔可以设置成动态的 - let timeArray_1 = []; - for (let hour = 0; hour < 24; hour++) { - for (let minute = 0; minute < 60; minute += value) { - let timeString = (hour < 10 ? '0' + hour : hour) + ':' + (minute < 10 ? '0' + minute : minute); - timeArray_1.push( - { datetime: timeString, measValue: '-' } - ); - } + // 间隔可以设置成动态的 + let timeArray_1 = []; + for (let hour = 0; hour < 24; hour++) { + for (let minute = 0; minute < 60; minute += value) { + let timeString = + (hour < 10 ? "0" + hour : hour) + + ":" + + (minute < 10 ? "0" + minute : minute); + timeArray_1.push({ datetime: timeString, measValue: "-" }); } - console.log(timeArray_1) - timeArray_1.forEach(item => { - data.forEach(ite => { - let iteTime = ite.datetime.split(' ')[1].split(':')[0] + ':' + ite.datetime.split(' ')[1].split(':')[1] - if (iteTime === item.datetime) { - item.measValue =ite.measValue - } - }) - }) + } + console.log(timeArray_1); + timeArray_1.forEach((item) => { + data.forEach((ite) => { + let iteTime = + ite.datetime.split(" ")[1].split(":")[0] + + ":" + + ite.datetime.split(" ")[1].split(":")[1]; + if (iteTime === item.datetime) { + item.measValue = ite.measValue; + } + }); + }); - return timeArray_1 + return timeArray_1; } export function handleEchartsData_datatime_measValue(data, value) { - // 间隔可以设置成动态的 - let timeArray_1 = []; - for (let hour = 0; hour < 24; hour++) { - for (let minute = 0; minute < 60; minute += value) { - let timeString = (hour < 10 ? '0' + hour : hour) + ':' + (minute < 10 ? '0' + minute : minute); - timeArray_1.push( - { datetime: timeString, measValue: '-' } - ); - } + // 间隔可以设置成动态的 + let timeArray_1 = []; + for (let hour = 0; hour < 24; hour++) { + for (let minute = 0; minute < 60; minute += value) { + let timeString = + (hour < 10 ? "0" + hour : hour) + + ":" + + (minute < 10 ? "0" + minute : minute); + timeArray_1.push({ datetime: timeString, measValue: "-" }); } - console.log(timeArray_1) - timeArray_1.forEach(item => { - data.forEach(ite => { - let iteTime = ite.datetime.split(' ')[1].split(':')[0] + ':' + ite.datetime.split(' ')[1].split(':')[1] - if (iteTime === item.datetime) { - item.measValue =ite.measValue - } - }) - }) + } + console.log(timeArray_1); + timeArray_1.forEach((item) => { + data.forEach((ite) => { + let iteTime = + ite.datetime.split(" ")[1].split(":")[0] + + ":" + + ite.datetime.split(" ")[1].split(":")[1]; + if (iteTime === item.datetime) { + item.measValue = ite.measValue; + } + }); + }); - return timeArray_1 + return timeArray_1; } export function handleEchartsData_timeStamp_p(data, value) { - // 间隔可以设置成动态的 - let timeArray_1 = []; - for (let hour = 0; hour < 24; hour++) { - for (let minute = 0; minute < 60; minute += value) { - let timeString = (hour < 10 ? '0' + hour : hour) + ':' + (minute < 10 ? '0' + minute : minute); - timeArray_1.push( - { timeStamp: timeString, p: '-' } - ); - } + // 间隔可以设置成动态的 + let timeArray_1 = []; + for (let hour = 0; hour < 24; hour++) { + for (let minute = 0; minute < 60; minute += value) { + let timeString = + (hour < 10 ? "0" + hour : hour) + + ":" + + (minute < 10 ? "0" + minute : minute); + timeArray_1.push({ timeStamp: timeString, p: "-" }); } - console.log(timeArray_1) - timeArray_1.forEach(item => { - data.forEach(ite => { - let iteTime = ite.timeStamp.split(' ')[1].split(':')[0] + ':' + ite.timeStamp.split(' ')[1].split(':')[1] - if (iteTime === item.timeStamp) { - item.p =ite.p - } - }) - }) + } + console.log(timeArray_1); + timeArray_1.forEach((item) => { + data.forEach((ite) => { + let iteTime = + ite.timeStamp.split(" ")[1].split(":")[0] + + ":" + + ite.timeStamp.split(" ")[1].split(":")[1]; + if (iteTime === item.timeStamp) { + item.p = ite.p; + } + }); + }); - return timeArray_1 + return timeArray_1; } export function handleEchartsData_timeStamp_p_u_i(data, value) { - // 间隔可以设置成动态的 - let timeArray_1 = []; - for (let hour = 0; hour < 24; hour++) { - for (let minute = 0; minute < 60; minute += value) { - let timeString = (hour < 10 ? '0' + hour : hour) + ':' + (minute < 10 ? '0' + minute : minute); - timeArray_1.push( - { timeStamp: timeString, p: '-',u:'',i:''} - ); - } + // 间隔可以设置成动态的 + let timeArray_1 = []; + for (let hour = 0; hour < 24; hour++) { + for (let minute = 0; minute < 60; minute += value) { + let timeString = + (hour < 10 ? "0" + hour : hour) + + ":" + + (minute < 10 ? "0" + minute : minute); + timeArray_1.push({ timeStamp: timeString, p: "-", u: "", i: "" }); } - console.log(timeArray_1) - timeArray_1.forEach(item => { - data.forEach(ite => { - let iteTime = ite.timeStamp.split(' ')[1].split(':')[0] + ':' + ite.timeStamp.split(' ')[1].split(':')[1] - if (iteTime === item.timeStamp) { - item.p =ite.p - item.u =ite.u - item.i =ite.i + } + console.log(timeArray_1); + timeArray_1.forEach((item) => { + data.forEach((ite) => { + let iteTime = + ite.timeStamp.split(" ")[1].split(":")[0] + + ":" + + ite.timeStamp.split(" ")[1].split(":")[1]; + if (iteTime === item.timeStamp) { + item.p = ite.p; + item.u = ite.u; + item.i = ite.i; + } + }); + }); - } - }) - }) - - return timeArray_1 -} \ No newline at end of file + return timeArray_1; +} +// 处理取随机数 +export function getRandomInt(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min + 1)) + min; +} diff --git a/src/views/pages/carPage/index.vue b/src/views/pages/carPage/index.vue index ee36c01..db64432 100644 --- a/src/views/pages/carPage/index.vue +++ b/src/views/pages/carPage/index.vue @@ -489,6 +489,7 @@ import { } from "@/api/carPage/index"; import { handleEchartsData, + getRandomInt, handleEchartsData_timeStamp_p, } from "@/hooks/handleFun"; import { usrzApi } from "@/api/Osp/svgApi"; @@ -784,25 +785,29 @@ const submitForm = () => { ); // console.log(datat_start,datat_end,"3---------"); let datainput = { - chargingStationID: currentData.id, + chargingStationID: currentData.id.replace("@", ""), type: parseInt(formData.value.type), isForce: parseInt(formData.value.whether), targetValue: parseInt(formData.value.number), startTime: datat_start, endTime: datat_end, }; + const randomDelay=getRandomInt(2000,5000)//取2000-5000ms之间的随机数 setTimeout(() => { send_Status.value=false ajustCarPageFlag.value=false - }, 2000); - setTimeout(() => { + ElMessage({ showClose: true, message: "指令下发成功", type: "success", }); - }, 3000); + }, randomDelay); + + // setTimeout(() => { + + // }, 3000); // send_Status.value=false ajustInfo_api(datainput).then((res: any) => { console.log(res, "1-------car"); diff --git a/src/views/pages/carPage/load_echart.vue b/src/views/pages/carPage/load_echart.vue index 2768e25..5ee6a0c 100644 --- a/src/views/pages/carPage/load_echart.vue +++ b/src/views/pages/carPage/load_echart.vue @@ -88,7 +88,7 @@ const drawOneLine = () => { }, grid: { top: '25%', - left: '8%', + left: '18%', right: '12%', bottom: '13%' },