From 586013019f57fe90642dde9f3973f33f4a6d206a Mon Sep 17 00:00:00 2001 From: wangxingyuan <2944009893@qq.com> Date: Thu, 15 May 2025 10:40:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=BF=A1=E6=81=AF=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/qunaioXiTong.html | 2 +- src/api/quniao/infoStatistics.js | 8 + src/components/FlvPlayer/index.vue | 18 +- src/views/quniao/device/index.vue | 208 ++++++++++++++++- src/views/quniao/infoStatistics/index.vue | 268 +++++++++++++++++++++- 5 files changed, 479 insertions(+), 25 deletions(-) diff --git a/public/static/qunaioXiTong.html b/public/static/qunaioXiTong.html index 9e90c59..a6baf94 100644 --- a/public/static/qunaioXiTong.html +++ b/public/static/qunaioXiTong.html @@ -224,7 +224,7 @@ // let URL=localStorage.getItem('localHost'); // let URL='http://192.168.1.62:8081'; - let URL='http://192.168.1.70:8082'; + let URL='http://192.168.1.108:8081'; // 驱鸟设备列表接口 function selectBridDeviceList() { diff --git a/src/api/quniao/infoStatistics.js b/src/api/quniao/infoStatistics.js index 961b3c2..ef735f4 100644 --- a/src/api/quniao/infoStatistics.js +++ b/src/api/quniao/infoStatistics.js @@ -13,4 +13,12 @@ export function reportList(data) { method: 'post', data: data }) +} +// 预览 +export function previewData(data) { + return request({ + url: `/api/brid/previewData?reportCode=${data.reportCode}&reportType=${data.reportType}`, + method: 'post', + // data: data + }) } \ No newline at end of file diff --git a/src/components/FlvPlayer/index.vue b/src/components/FlvPlayer/index.vue index becb25c..36e1c24 100644 --- a/src/components/FlvPlayer/index.vue +++ b/src/components/FlvPlayer/index.vue @@ -82,39 +82,39 @@ video { height: 100%; object-fit: cover; } -video::-webkit-media-controls-fullscreen-button { +.videoDom::-webkit-media-controls-fullscreen-button { display: none; } -video::-webkit-media-controls-play-button { +.videoDom::-webkit-media-controls-play-button { display: none; } -video::-webkit-media-controls-timeline { +.videoDom::-webkit-media-controls-timeline { display: none; } -video::-webkit-media-controls-current-time-display { +.videoDom::-webkit-media-controls-current-time-display { display: none; } -video::-webkit-media-controls-time-remaining-display { +.videoDom::-webkit-media-controls-time-remaining-display { display: none; } -video::-webkit-media-controls-mute-button { +.videoDom::-webkit-media-controls-mute-button { display: none; } -video::-webkit-media-controls-toggle-closed-captions-button { +.videoDom::-webkit-media-controls-toggle-closed-captions-button { display: none; } -video::-webkit-media-controls-enclosure { +.videoDom::-webkit-media-controls-enclosure { display: none; } -video::-webkit-media-controls-volume-slider { +.videoDom::-webkit-media-controls-volume-slider { display: none; } diff --git a/src/views/quniao/device/index.vue b/src/views/quniao/device/index.vue index 6fe46dd..1cd3caa 100644 --- a/src/views/quniao/device/index.vue +++ b/src/views/quniao/device/index.vue @@ -168,7 +168,7 @@
@@ -263,6 +263,7 @@ import { addDeviceTask, } from "@/api/quniao/deviceOption"; import musicList from "./musicList.vue"; +import { get } from "jquery"; export default { components: { musicList, @@ -280,50 +281,62 @@ export default { { title: "一月", states: 1, + monthNum: 0, }, { title: "二月", states: 1, + monthNum: 1, }, { title: "三月", states: 1, + monthNum: 2, }, { title: "四月", states: 1, + monthNum: 3, }, { title: "五月", states: 1, + monthNum: 4, }, { title: "六月", states: 1, + monthNum: 5, }, { title: "七月", states: 1, + monthNum: 6, }, { title: "八月", states: 1, + monthNum: 7, }, { title: "九月", states: 1, + monthNum: 8, }, { title: "十月", states: 1, + monthNum: 9, }, { title: "十一月", states: 1, + monthNum: 10, }, { title: "十二月", states: 1, + monthNum: 11, }, ], @@ -350,7 +363,6 @@ export default { console.log(value); }, radioChange(value) { - console.log(value); this.deviceSetStatus = value; }, @@ -539,26 +551,193 @@ export default { console.log(res); }); }, + //获取当前的年 月 周 日等时间 + getWeek(value) { + let data = new Date(); + + switch (value) { + case 1: + return data.getDate(); + break; + case 2: + return data.getDay(); + break; + case 3: + return data.getMonth(); + break; + case 4: + return data.getFullYear(); + break; + } + }, + // 获取所选星期转数字 + getWeekNum(value) { + let num = null; + switch (value) { + case "周一": + num = 1; + break; + case "周二": + num = 2; + break; + case "周三": + num = 3; + break; + case "周四": + num = 4; + break; + case "周五": + num = 5; + break; + case "周六": + num = 6; + break; + case "周日": + num = 0; + break; + } + return num; + }, + // 获取下周日期 + getNextMonday(targetWeekday) { + const today = new Date(); + const currentWeekday = today.getDay(); // 当前星期几 + + let diff; + if (targetWeekday === 7) targetWeekday = 0; // 如果目标是周日,用 0 表示 + + if (currentWeekday === targetWeekday) { + // 如果今天正好是目标星期几,则返回下一周的日期 + diff = 7; + } else { + diff = (targetWeekday - currentWeekday + 7) % 7 || 7; + } + const nextDate = new Date(today); + nextDate.setDate(today.getDate() + diff); + return this.formatDate(nextDate); + }, + // 获取本周指定星期几的日期 + getThisWeekDay(targetWeekday) { + const today = new Date(); + const currentWeekday = today.getDay(); // 当前星期几 + + let targetNum; + + if (typeof targetWeekday === "string") { + // 如果传入的是中文名,转成数字 + targetNum = this.getWeekNum(targetWeekday); + } else { + targetNum = targetWeekday; + } + + // 计算偏移天数(从今天往前或往后推) + const diff = targetNum - currentWeekday; + const targetDate = new Date(today); + + targetDate.setDate(today.getDate() + diff); + + return this.formatDate(targetDate); + }, + // 获取指定月份的所有日期 + getMonthDays(year, month, num) { + const date = new Date(year, month, num); // 设置为当月第一天 + const days = []; + + while (true) { + const currentYear = date.getFullYear(); + const currentMonth = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始 + const currentDate = String(date.getDate()).padStart(2, "0"); + + days.push({ + taskTime: `${currentYear}-${currentMonth}-${currentDate}`, + }); + + date.setDate(date.getDate() + 1); + if (date.getMonth() !== month) break; // 如果下一天不是这个月了,就停止 + } + + return days; + }, + getTaskTimes(value) { + let currentYear = this.getWeek(4); //获取当前年份 + let currentMonth = this.getWeek(3); //获取当前月份 + let currentDays = new Date(currentYear, currentMonth, 0).getDate(); //获取当前月份的天数 + let currentWeek = this.getWeek(2); //获取当前星期 + let currentDay = this.getWeek(1); //当前几号 + let weekTimeList = []; + let weekTimeIndex = []; + if (value == 2) { + this.WeekList.forEach((item, index) => { + let weekIndex = this.getWeekNum(item); + if (weekIndex < currentWeek) { + // 下周日期 + weekTimeList.push({ taskTime: this.getNextMonday(weekIndex) }); + } else { + // 本周日期 + weekTimeList.push({ taskTime: this.getThisWeekDay(weekIndex) }); + } + }); + return weekTimeList; + } else if (value == 3) { + let numValue = 1; + let list = []; + let newList = []; + this.MounthList.forEach((item) => { + let index = this.getMounth(item); + if (index == currentMonth) { + numValue = currentDay; + } else { + numValue = 1; + } + list.push(this.getMonthDays(currentYear, index, numValue)); + }); + weekTimeList = list.flat(); + return weekTimeList; + } + }, + // 判断月份 + getMounth(value) { + let num; + console.log(value, "月份筛选"); + this.mounthData.forEach((item) => { + if (item.title == value) { + num = item.monthNum; + } + }); + return num; + }, + // 格式化日期为 yyyy-MM-dd + formatDate(date) { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始 + const day = String(date.getDate()).padStart(2, "0"); + return `${year}-${month}-${day}`; + }, // 添加 onSubmit() { let data = { deviceIds: this.checkList.toString(), taskType: this.radio, - taskTimes: [{ taskTime: this.dayData }], startTimeinfo: this.formatTime(this.startTime), endTimeinfo: this.formatTime(this.endTime), taskName: this.taskName, + taskTimes: [{ taskTime: this.dayData }], }; + if (this.radio == 1) { + data.taskTimes = [{ taskTime: this.dayData }]; + } else{ + data.taskTimes = this.getTaskTimes(this.radio)||[]; + } + if ( data.deviceIds && data.taskType && - data.taskTimes && + data.taskTimes.length > 0 && data.startTimeinfo && data.endTimeinfo && data.taskName - ) { + ) { addDeviceTask(data).then((res) => { - console.log(res, 1111111111); if (res.code == 200) { this.getTaskList(); } @@ -566,16 +745,10 @@ export default { } else { this.$message.error("请填写完整信息"); } - console.log(data); }, // 时间格式转换 formatTime(chinaStandard) { var date = new Date(chinaStandard); - // var y = date.getFullYear(); - // var m = date.getMonth() + 1; - // m = m < 10 ? "0" + m : m; - // var d = date.getDate(); - // d = d < 10 ? "0" + d : d; var h = date.getHours(); h = h < 10 ? "0" + h : h; var minute = date.getMinutes(); @@ -584,6 +757,17 @@ export default { s = s < 10 ? "0" + s : s; return h + ":" + minute + ":" + s; }, + // 取消 + cancelTask(){ + this.radio=0; + this.checkList=[]; + this.dayData=""; + this.WeekList=[]; + this.MounthList=[]; + this.startTime=""; + this.endTime=""; + this.taskName=""; + } }, mounted() { diff --git a/src/views/quniao/infoStatistics/index.vue b/src/views/quniao/infoStatistics/index.vue index 7d3b5ce..7095dc4 100644 --- a/src/views/quniao/infoStatistics/index.vue +++ b/src/views/quniao/infoStatistics/index.vue @@ -125,8 +125,8 @@