diff --git a/.cursor/settings.json b/.cursor/settings.json new file mode 100644 index 0000000..87765e3 --- /dev/null +++ b/.cursor/settings.json @@ -0,0 +1,20 @@ +{ + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + }, + "files.associations": { + "*.vue": "vue", + "*.js": "javascript", + "*.json": "json", + "*.css": "css", + "*.scss": "scss", + "*.less": "less" + }, + "javascript.updateImportsOnFileMove.enabled": "always", + "typescript.updateImportsOnFileMove.enabled": "always", + "editor.semanticHighlighting.enabled": true, + "editor.bracketPairColorization.enabled": true, + "editor.guides.bracketPairs": true +} \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..36cb16a --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "semi": false, + "singleQuote": true, + "printWidth": 100, + "trailingComma": "none", + "arrowParens": "avoid", + "endOfLine": "auto" +} \ No newline at end of file diff --git a/src/api/car/statistics.js b/src/api/car/statistics.js new file mode 100644 index 0000000..b47bc2a --- /dev/null +++ b/src/api/car/statistics.js @@ -0,0 +1,117 @@ +import request from '@/utils/request' + +// 模拟数据 +const mockOverviewData = { + month: { + total: 42, + onlineRate: 90.9, + communicationCount: 50, + avgCommunicationTime: 2.0 + }, + year: { + total: 45, + onlineRate: 92.5, + communicationCount: 580, + avgCommunicationTime: 2.2 + } +} + +const mockTrendData = { + month: { + legends: ['大连', '小连'], + xAxis: ['1日', '2日', '3日', '4日', '5日', '6日', '7日', '8日', '9日', '10日', '11日', '12日', '13日', '14日', '15日', '16日', '17日', '18日', '19日', '20日', '21日', '22日', '23日', '24日', '25日', '26日', '27日', '28日', '29日', '30日', '31日'], + series: [ + { + name: '大连', + data: [60, 58, 65, 70, 75, 85, 80, 70, 60, 90, 85, 80, 95, 85, 65, 70, 75, 85, 80, 70, 60, 90, 85, 80, 95, 85, 65, 70, 75, 85, 80] + }, + { + name: '小连', + data: [65, 70, 80, 75, 60, 55, 90, 85, 95, 85, 75, 60, 55, 65, 80, 75, 60, 55, 90, 85, 95, 85, 75, 60, 55, 65, 80, 75, 60, 55, 90] + } + ] + }, + year: { + legends: ['大连', '小连'], + xAxis: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], + series: [ + { + name: '大连', + data: [85, 88, 90, 92, 88, 85, 90, 92, 95, 90, 88, 85] + }, + { + name: '小连', + data: [80, 85, 88, 90, 85, 80, 88, 90, 92, 88, 85, 80] + } + ] + } +} + +// 获取设备统计概览数据 +export function getDeviceOverview(params) { + return { + data: mockOverviewData[params.type] + } +} + +// 获取设备在线率趋势数据 +export function getDeviceOnlineTrend(params) { + return { + data: mockTrendData[params.type] + } +} + +// 获取行驶概览数据 +export function getDrivingOverview(params) { + return new Promise((resolve) => { + setTimeout(() => { + resolve({ + data: { + totalMileage: 12345.67, + avgMileage: 1234.56, + maxMileage: 2345.67, + minMileage: 123.45 + } + }) + }, 500) + }) +} + +// 获取行驶趋势数据 +export function getDrivingTrend(params) { + return new Promise((resolve) => { + setTimeout(() => { + const isMonth = params.type === 'month' + const xAxis = isMonth + ? Array.from({length: 31}, (_, i) => `${i + 1}日`) + : Array.from({length: 12}, (_, i) => `${i + 1}月`) + + const series = Array.from({length: xAxis.length}, () => + Math.floor(Math.random() * 2000) + 500 + ) + + resolve({ + data: { + xAxis, + series + } + }) + }, 500) + }) +} + +// 获取行驶排名数据 +export function getDrivingRanking(params) { + return new Promise((resolve) => { + setTimeout(() => { + const data = Array.from({length: params.limit}, (_, i) => ({ + deviceName: `设备${i + 1}`, + mileage: Math.floor(Math.random() * 2000) + 500 + })).sort((a, b) => b.mileage - a.mileage) + + resolve({ + data + }) + }, 500) + }) +} \ No newline at end of file diff --git a/src/api/car/warning.js b/src/api/car/warning.js new file mode 100644 index 0000000..d75d92a --- /dev/null +++ b/src/api/car/warning.js @@ -0,0 +1,71 @@ +import request from '@/utils/request' + +// 获取警告列表 +export function getWarningList(params) { + // 模拟数据 + const mockData = { + data: [ + { + id: '1', + device_no: 'PT001', + device_name: '泵车A', + warning_type: '低电量', + warning_time: '2024-01-20 14:30:50', + location: '上海市浦东新区世纪大道', + status: '未处理' + }, + { + id: '2', + device_no: 'PT002', + device_name: '泵车B', + warning_type: '低电量预警', + warning_time: '2024-01-20 14:30:50', + location: '上海市浦东新区世纪大道', + status: '已处理' + }, + { + id: '3', + device_no: 'PT003', + device_name: '泵车C', + warning_type: '低电量超低预警', + warning_time: '2024-01-20 14:30:50', + location: '上海市浦东新区世纪大道', + status: '处理中' + } + ], + total: 3 + } + + // 模拟 API 调用 + return new Promise((resolve) => { + setTimeout(() => { + resolve(mockData); + }, 500); + }); +} + +// 搜索警告 +export function searchWarnings(params) { + // 模拟数据 + const mockData = { + data: [ + { + id: '1', + device_no: 'PT001', + device_name: '泵车A', + warning_type: '低电量', + warning_time: '2024-01-20 14:30:50', + location: '上海市浦东新区世纪大道', + status: '未处理' + } + ], + total: 1 + } + + // 模拟 API 调用 + return new Promise((resolve) => { + setTimeout(() => { + resolve(mockData); + }, 500); + }); +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index 4e159f2..0153702 100644 --- a/src/main.js +++ b/src/main.js @@ -4,7 +4,7 @@ import 'normalize.css/normalize.css' // A modern alternative to CSS resets import ElementUI from 'element-ui' import '@/styles/element-variables.scss' -import locale from 'element-ui/lib/locale/lang/en' // lang i18n +import locale from 'element-ui/lib/locale/lang/zh-CN' // 改为中文语言包 import '@/styles/index.scss' // global css @@ -38,9 +38,7 @@ if (process.env.NODE_ENV === 'production') { import VueParticles from 'vue-particles' Vue.use(VueParticles) // set ElementUI lang to EN -//Vue.use(ElementUI, { locale }) -// 如果想要中文版 element-ui,按如下方式声明 -Vue.use(ElementUI) +Vue.use(ElementUI, { locale }) // 使用中文语言包 import Message from 'element-ui/lib/message'; diff --git a/src/views/car/devStatistics.vue b/src/views/car/devStatistics.vue new file mode 100644 index 0000000..eea3e40 --- /dev/null +++ b/src/views/car/devStatistics.vue @@ -0,0 +1,276 @@ + + + + + diff --git a/src/views/car/driveStatistics.vue b/src/views/car/driveStatistics.vue new file mode 100644 index 0000000..7e76daa --- /dev/null +++ b/src/views/car/driveStatistics.vue @@ -0,0 +1,308 @@ + + + + + diff --git a/src/views/car/playback.vue b/src/views/car/playback.vue index 7643c23..c461bba 100644 --- a/src/views/car/playback.vue +++ b/src/views/car/playback.vue @@ -49,9 +49,9 @@
GPS:{{boatEquipment}} -
-
- 车牌/船号:{{boatPlate}} +
+
+ 车牌/船号:{{boatPlate}}
@@ -84,9 +84,9 @@
-
名称:{{boatName}}
-
- 车牌/船号:{{boatPlate}} +
名称:{{boatName}}
+
+ 车牌/船号:{{boatPlate}}
GPS:{{boatEquipment}}
开始:{{start_time}}
@@ -194,7 +194,7 @@ boatName: '', boatBranch: '', modelName: "", - boatEquipment: "", + boatEquipment: "", boatPlate:'', start_time: "", end_time: "", @@ -325,50 +325,50 @@ prop: 'latitude', label: '纬度', align: 'center' - }], - columnsZJ: [{ - prop: 'area', - label: '状态', - align: 'center', - width: "120", - formatter: (row, column, cellValue) => { - return `` - } - }, { - prop: 'created_at', - label: '定位时间', - align: 'center', - width: "180" - },{ - prop: 'orp', - label: 'ORP', - align: 'center' - },{ - prop: 'oxygen', - label: '溶解氧', - align: 'center' - }, { - prop: 'ph', - label: 'PH', - align: 'center' - }, { - prop: 'shipbow', - label: '船艏测距仪', - align: 'center' - }, { - prop: 'temperature', - label: '温度', - align: 'center' - },{ - prop: 'longitude', - label: '经度', - align: 'center', - width: "180" - }, { - prop: 'latitude', - label: '纬度', - align: 'center', - width: "180" + }], + columnsZJ: [{ + prop: 'area', + label: '状态', + align: 'center', + width: "120", + formatter: (row, column, cellValue) => { + return `` + } + }, { + prop: 'created_at', + label: '定位时间', + align: 'center', + width: "180" + },{ + prop: 'orp', + label: 'ORP', + align: 'center' + },{ + prop: 'oxygen', + label: '溶解氧', + align: 'center' + }, { + prop: 'ph', + label: 'PH', + align: 'center' + }, { + prop: 'shipbow', + label: '船艏测距仪', + align: 'center' + }, { + prop: 'temperature', + label: '温度', + align: 'center' + },{ + prop: 'longitude', + label: '经度', + align: 'center', + width: "180" + }, { + prop: 'latitude', + label: '纬度', + align: 'center', + width: "180" }], // 速度分析 speedArr: { @@ -387,7 +387,7 @@ mounted() { this.$store.dispatch('app/toggleSideBar') // 实时定位跳转到轨迹回放 - this.boatEquipment = this.$route.query.boatEquipment ? this.$route.query.boatEquipment : "" + this.boatEquipment = this.$route.query.boatEquipment ? this.$route.query.boatEquipment : "" this.boatPlate = this.$route.query.boatPlate ? this.$route.query.boatPlate : "" this.boatName = this.$route.query.boatName ? this.$route.query.boatName : "" this.boatBranch = this.$route.query.boatBranch ? this.$route.query.boatBranch : "" @@ -405,7 +405,7 @@ this.$refs.boatTree.filter(val); } }, - created() { + created() { this.getData() this.getmapHeight() this.chart2(7); @@ -498,45 +498,45 @@ }) }, // 获取轨迹 - getList(checkTime, callday) { - // this.pointsArr = [{ - // longitude:"120.630041", - // latitude:'31.314108', - // },{ - // longitude:"120.640773", - // latitude:'31.291506', - // },{ - // longitude:"120.633048", - // latitude:'31.294151', - // },{ - // longitude:"120.633073", - // latitude:'31.294158', - // },{ - // longitude:"120.640076", - // latitude:'31.326990', - // },{ - // longitude:"120.635291", - // latitude:'31.329283', - // },{ - // longitude:"120.630042", - // latitude:'31.314108', - // },{ - // longitude:"120.640774", - // latitude:'31.291506', - // },{ - // longitude:"120.633049", - // latitude:'31.294151', - // },{ - // longitude:"120.633079", - // latitude:'31.294158', - // },{ - // longitude:"120.640071", - // latitude:'31.326990', - // },{ - // longitude:"120.635299", - // latitude:'31.329283', - // }] - + getList(checkTime, callday) { + // this.pointsArr = [{ + // longitude:"120.630041", + // latitude:'31.314108', + // },{ + // longitude:"120.640773", + // latitude:'31.291506', + // },{ + // longitude:"120.633048", + // latitude:'31.294151', + // },{ + // longitude:"120.633073", + // latitude:'31.294158', + // },{ + // longitude:"120.640076", + // latitude:'31.326990', + // },{ + // longitude:"120.635291", + // latitude:'31.329283', + // },{ + // longitude:"120.630042", + // latitude:'31.314108', + // },{ + // longitude:"120.640774", + // latitude:'31.291506', + // },{ + // longitude:"120.633049", + // latitude:'31.294151', + // },{ + // longitude:"120.633079", + // latitude:'31.294158', + // },{ + // longitude:"120.640071", + // latitude:'31.326990', + // },{ + // longitude:"120.635299", + // latitude:'31.329283', + // }] + // return if (!checkTime) { this.getCurrentTime(callday) @@ -547,8 +547,8 @@ start_time: this.start_time, end_time: this.end_time, equipment_number: this.boatEquipment, - status: this.status, - sort_name:'id', + status: this.status, + sort_name:'id', sort_type:'ASC' }).then(res => { this.paginations.total = res.total @@ -584,7 +584,7 @@ if (!val.children) { this.boatName = val.name this.boatEquipment = val.gps - this.boatBranch = val.branch + this.boatBranch = val.branch this.boatPlate = val.plate this.modelName = val.model ? val.model : '' this.showMapTime = true @@ -596,7 +596,7 @@ getListTime(val, time) { console.log("val", val) this.boatName = val.data.name - this.boatEquipment = val.data.gps + this.boatEquipment = val.data.gps this.boatPlate = val.data.plate this.boatBranch = val.data.branch this.modelName = val.data.model @@ -679,8 +679,8 @@ height: 60%; overflow: hidden; } - .treeInput{ - margin: 10px 0; + .treeInput{ + margin: 10px 0; } .treewrap .el-tree { height: calc(100% - 60px); @@ -759,4 +759,4 @@ /deep/ .el-tabs--border-card>.el-tabs__content { padding: 0 } - + diff --git a/src/views/car/statistics.vue b/src/views/car/statistics.vue index 9ba4b9f..2cc1651 100644 --- a/src/views/car/statistics.vue +++ b/src/views/car/statistics.vue @@ -1,24 +1,207 @@ - + \ No newline at end of file diff --git a/src/views/car/warning.vue b/src/views/car/warning.vue index 5945d93..53bb7c7 100644 --- a/src/views/car/warning.vue +++ b/src/views/car/warning.vue @@ -1,24 +1,167 @@ -