forked from dyf/dyf-vue-ui
Merge branch 'main' of http://47.107.152.87:3000/dyf/dyf-vue-ui
This commit is contained in:
77
src/api/debugCenter/debugCenter.ts
Normal file
77
src/api/debugCenter/debugCenter.ts
Normal file
@ -0,0 +1,77 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
//获取列表数据
|
||||
function getDevice(queryParams){
|
||||
return request({
|
||||
url: '/api/device/debug/list',
|
||||
method: 'get',
|
||||
params: queryParams
|
||||
})
|
||||
}
|
||||
|
||||
//上传文件
|
||||
function uploadFile(formData){
|
||||
return request({
|
||||
url: '/api/device/debug/addFile',
|
||||
method: 'post',
|
||||
data: formData
|
||||
})
|
||||
}
|
||||
|
||||
//修改操作视频
|
||||
function addVideo(formData){
|
||||
return request({
|
||||
url: '/api/device/debug/addVideo',
|
||||
method: 'post',
|
||||
data: formData
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//修改单个数据的多个文件
|
||||
function updateItem(formData){
|
||||
|
||||
return request({
|
||||
url: '/api/device/debug/editDebug',
|
||||
method: 'post',
|
||||
data: formData
|
||||
})
|
||||
//开发时假装成功
|
||||
// return new Promise((resolve,reject)=>{
|
||||
// resolve({
|
||||
// code:200,
|
||||
// msg:"操作成功"
|
||||
// });
|
||||
// });
|
||||
}
|
||||
//批量上传开机画面
|
||||
function uploadBoot(formData){
|
||||
return request({
|
||||
url: '/api/device/debug/addLogo',
|
||||
method: 'post',
|
||||
data: formData
|
||||
})
|
||||
//开发时假装成功
|
||||
// return new Promise((resolve, reject) => {
|
||||
// //开机画面
|
||||
// resolve({ code: 200, msg: '操作成功' });
|
||||
// });
|
||||
}
|
||||
|
||||
function getDeviceInfoById(id){
|
||||
|
||||
return request({
|
||||
url: '/api/device/debug/detail/'+id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export default{
|
||||
getDevice:getDevice,
|
||||
uploadFile:uploadFile,
|
||||
addVideo:addVideo,
|
||||
updateItem:updateItem,
|
||||
uploadBoot:uploadBoot,
|
||||
getDeviceInfoById:getDeviceInfoById
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
//日期格式化
|
||||
function DateFormat(date, format) {
|
||||
if (!date) {
|
||||
return '';
|
||||
@ -39,7 +40,7 @@ function DateFormat(date, format) {
|
||||
return formatMap[match];
|
||||
});
|
||||
}
|
||||
|
||||
//日期加减
|
||||
function DateAdd(datePart, number, date) {
|
||||
// 创建日期的副本,避免修改原日期对象
|
||||
const newDate = new Date(date.getTime());
|
||||
@ -71,7 +72,47 @@ function DateAdd(datePart, number, date) {
|
||||
return newDate;
|
||||
}
|
||||
|
||||
//将字节转换成0.53kb 10.13MB 1GB这样的友好单位
|
||||
function formatBytes(bytes, decimals = 2) {
|
||||
// 处理0字节的情况
|
||||
if (bytes === 0) return '0 B';
|
||||
|
||||
// 定义单位和换算比例
|
||||
const k = 1024;
|
||||
const dm = decimals < 0 ? 0 : decimals;
|
||||
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
|
||||
// 计算最合适的单位
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
|
||||
// 格式化并返回结果
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
||||
}
|
||||
|
||||
//数组某个字段取唯一值
|
||||
function getUniqueValues(dataSource, field) {
|
||||
if(!field){
|
||||
return [];
|
||||
}
|
||||
// 使用Set来存储唯一值,因为Set会自动去重
|
||||
const uniqueValues = new Set();
|
||||
|
||||
// 遍历数据源
|
||||
for (const item of dataSource) {
|
||||
// 检查对象是否包含指定字段
|
||||
if (item.hasOwnProperty(field)) {
|
||||
uniqueValues.add(item[field]);
|
||||
}
|
||||
}
|
||||
|
||||
// 将Set转换为数组并返回
|
||||
return Array.from(uniqueValues);
|
||||
}
|
||||
|
||||
|
||||
export default{
|
||||
DateFormat:DateFormat,
|
||||
DateAdd:DateAdd
|
||||
DateAdd:DateAdd,
|
||||
formatBytes:formatBytes,
|
||||
getUniqueValues:getUniqueValues
|
||||
}
|
||||
211
src/utils/coordinate-transform.ts
Normal file
211
src/utils/coordinate-transform.ts
Normal file
@ -0,0 +1,211 @@
|
||||
/**
|
||||
* 坐标系转换工具
|
||||
* WGS84(地球坐标系)与 GCJ02(火星坐标系)相互转换
|
||||
*/
|
||||
|
||||
// 地标转国测常量
|
||||
const X_PI = (3.14159265358979324 * 3000.0) / 180.0;
|
||||
const PI = 3.1415926535897932384626;
|
||||
const A = 6378245.0; // 卫星椭球坐标投影到平面地图坐标系的投影因子
|
||||
const EE = 0.00669342162296594323; // 椭球的偏心率
|
||||
|
||||
/**
|
||||
* 坐标点类型定义
|
||||
*/
|
||||
export interface CoordinatePoint {
|
||||
lng: number; // 经度
|
||||
lat: number; // 纬度
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否在国内,在中国国内的经纬度才需要做偏移
|
||||
* @param lng 经度
|
||||
* @param lat 纬度
|
||||
* @returns 是否在国外
|
||||
*/
|
||||
function outOfChina(lng: number, lat: number): boolean {
|
||||
return (
|
||||
lng < 72.004 ||
|
||||
lng > 137.8347 ||
|
||||
lat < 0.8293 ||
|
||||
lat > 55.8271
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化经度
|
||||
* @param lng 经度
|
||||
* @param lat 纬度
|
||||
* @returns 转换后的经度偏移量
|
||||
*/
|
||||
function transformLng(lng: number, lat: number): number {
|
||||
let ret =
|
||||
300.0 +
|
||||
lng +
|
||||
2.0 * lat +
|
||||
0.1 * lng * lng +
|
||||
0.1 * lng * lat +
|
||||
0.1 * Math.sqrt(Math.abs(lng));
|
||||
|
||||
ret +=
|
||||
((20.0 * Math.sin(6.0 * lng * PI) +
|
||||
20.0 * Math.sin(2.0 * lng * PI)) *
|
||||
2.0) /
|
||||
3.0;
|
||||
|
||||
ret +=
|
||||
((20.0 * Math.sin(lng * PI) +
|
||||
40.0 * Math.sin((lng / 3.0) * PI)) *
|
||||
2.0) /
|
||||
3.0;
|
||||
|
||||
ret +=
|
||||
((150.0 * Math.sin((lng / 12.0) * PI) +
|
||||
300.0 * Math.sin((lng / 30.0) * PI)) *
|
||||
2.0) /
|
||||
3.0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化纬度
|
||||
* @param lng 经度
|
||||
* @param lat 纬度
|
||||
* @returns 转换后的纬度偏移量
|
||||
*/
|
||||
function transformLat(lng: number, lat: number): number {
|
||||
let ret =
|
||||
-100.0 +
|
||||
2.0 * lng +
|
||||
3.0 * lat +
|
||||
0.2 * lat * lat +
|
||||
0.1 * lng * lat +
|
||||
0.2 * Math.sqrt(Math.abs(lng));
|
||||
|
||||
ret +=
|
||||
((20.0 * Math.sin(6.0 * lng * PI) +
|
||||
20.0 * Math.sin(2.0 * lng * PI)) *
|
||||
2.0) /
|
||||
3.0;
|
||||
|
||||
ret +=
|
||||
((20.0 * Math.sin(lat * PI) +
|
||||
40.0 * Math.sin((lat / 3.0) * PI)) *
|
||||
2.0) /
|
||||
3.0;
|
||||
|
||||
ret +=
|
||||
((160.0 * Math.sin((lat / 12.0) * PI) +
|
||||
320 * Math.sin((lat * PI) / 30.0)) *
|
||||
2.0) /
|
||||
3.0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* WGS84坐标系转GCJ02坐标系(地球坐标系转火星坐标系)
|
||||
* @param lng 经度
|
||||
* @param lat 纬度
|
||||
* @returns 转换后的坐标 [经度, 纬度]
|
||||
*/
|
||||
export function wgs84ToGcj02(lng: number, lat: number): [number, number] {
|
||||
if (outOfChina(lng, lat)) {
|
||||
return [lng, lat];
|
||||
}
|
||||
|
||||
const dlat = transformLat(lng - 105.0, lat - 35.0);
|
||||
const dlng = transformLng(lng - 105.0, lat - 35.0);
|
||||
const radlat = (lat / 180.0) * PI;
|
||||
let magic = Math.sin(radlat);
|
||||
magic = 1 - EE * magic * magic;
|
||||
const sqrtmagic = Math.sqrt(magic);
|
||||
|
||||
const transformedLat =
|
||||
(dlat * 180.0) /
|
||||
(((A * (1 - EE)) / (magic * sqrtmagic)) * PI);
|
||||
const transformedLng =
|
||||
(dlng * 180.0) / ((A / sqrtmagic) * Math.cos(radlat) * PI);
|
||||
|
||||
const mglat = lat + transformedLat;
|
||||
const mglng = lng + transformedLng;
|
||||
|
||||
return [mglng, mglat];
|
||||
}
|
||||
|
||||
/**
|
||||
* GCJ02坐标系转WGS84坐标系(火星坐标系转地球坐标系)
|
||||
* @param lng 经度
|
||||
* @param lat 纬度
|
||||
* @returns 转换后的坐标 [经度, 纬度]
|
||||
*/
|
||||
export function gcj02ToWgs84(lng: number, lat: number): [number, number] {
|
||||
if (outOfChina(lng, lat)) {
|
||||
return [lng, lat];
|
||||
}
|
||||
|
||||
const dlat = transformLat(lng - 105.0, lat - 35.0);
|
||||
const dlng = transformLng(lng - 105.0, lat - 35.0);
|
||||
const radlat = (lat / 180.0) * PI;
|
||||
let magic = Math.sin(radlat);
|
||||
magic = 1 - EE * magic * magic;
|
||||
const sqrtmagic = Math.sqrt(magic);
|
||||
|
||||
const transformedLat = (dlat * 180.0) / ((A * (1 - EE)) / (magic * sqrtmagic) * PI);
|
||||
const transformedLng = (dlng * 180.0) / (A / sqrtmagic * Math.cos(radlat) * PI);
|
||||
|
||||
const mglat = lat + transformedLat;
|
||||
const mglng = lng + transformedLng;
|
||||
|
||||
return [lng * 2 - mglng, lat * 2 - mglat];
|
||||
}
|
||||
|
||||
/**
|
||||
* 对象形式的坐标转换 - WGS84转GCJ02
|
||||
* @param point 坐标点对象 {lng: 经度, lat: 纬度}
|
||||
* @returns 转换后的坐标点对象
|
||||
*/
|
||||
export function wgs84ToGcj02Point(point: CoordinatePoint): CoordinatePoint {
|
||||
const [lng, lat] = wgs84ToGcj02(point.lng, point.lat);
|
||||
return { lng, lat };
|
||||
}
|
||||
|
||||
/**
|
||||
* 对象形式的坐标转换 - GCJ02转WGS84
|
||||
* @param point 坐标点对象 {lng: 经度, lat: 纬度}
|
||||
* @returns 转换后的坐标点对象
|
||||
*/
|
||||
export function gcj02ToWgs84Point(point: CoordinatePoint): CoordinatePoint {
|
||||
const [lng, lat] = gcj02ToWgs84(point.lng, point.lat);
|
||||
return { lng, lat };
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量转换坐标点 - WGS84转GCJ02
|
||||
* @param points 坐标点数组
|
||||
* @returns 转换后的坐标点数组
|
||||
*/
|
||||
export function batchWgs84ToGcj02(points: CoordinatePoint[]): CoordinatePoint[] {
|
||||
return points.map(point => wgs84ToGcj02Point(point));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量转换坐标点 - GCJ02转WGS84
|
||||
* @param points 坐标点数组
|
||||
* @returns 转换后的坐标点数组
|
||||
*/
|
||||
export function batchGcj02ToWgs84(points: CoordinatePoint[]): CoordinatePoint[] {
|
||||
return points.map(point => gcj02ToWgs84Point(point));
|
||||
}
|
||||
|
||||
// 默认导出
|
||||
export default {
|
||||
wgs84ToGcj02,
|
||||
gcj02ToWgs84,
|
||||
wgs84ToGcj02Point,
|
||||
gcj02ToWgs84Point,
|
||||
batchWgs84ToGcj02,
|
||||
batchGcj02ToWgs84,
|
||||
outOfChina
|
||||
};
|
||||
@ -316,3 +316,15 @@ export const removeClass = (ele: HTMLElement, cls: string) => {
|
||||
export const isExternal = (path: string) => {
|
||||
return /^(https?:|http?:|mailto:|tel:)/.test(path);
|
||||
};
|
||||
|
||||
// 导出坐标系转换工具
|
||||
export { default as coordinateTransform } from './coordinate-transform';
|
||||
export type { CoordinatePoint } from './coordinate-transform';
|
||||
export {
|
||||
wgs84ToGcj02,
|
||||
gcj02ToWgs84,
|
||||
wgs84ToGcj02Point,
|
||||
gcj02ToWgs84Point,
|
||||
batchWgs84ToGcj02,
|
||||
batchGcj02ToWgs84
|
||||
} from './coordinate-transform';
|
||||
1010
src/views/debugCenter/debugPanel/index.vue
Normal file
1010
src/views/debugCenter/debugPanel/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -125,7 +125,7 @@ watch(
|
||||
|
||||
if (newVal === 3) {
|
||||
// 确保参数有效
|
||||
debugger;
|
||||
|
||||
console.log('newVal=', newVal);
|
||||
getRecordList(); // 调用回调
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ watch(
|
||||
|
||||
if (newVal === 3) {
|
||||
// 确保参数有效
|
||||
debugger;
|
||||
|
||||
console.log('newVal=', newVal);
|
||||
getRecordList(); // 调用回调
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ function initData(item, Refresh) {
|
||||
params: params
|
||||
})
|
||||
.then((res) => {
|
||||
debugger;
|
||||
|
||||
if (res.code == 200) {
|
||||
if (res.rows) {
|
||||
if (res.rows.length) {
|
||||
|
||||
@ -10,11 +10,15 @@
|
||||
|
||||
<el-form :inline="true" :model="filter" class="demo-form-inline">
|
||||
<el-form-item label="">
|
||||
<el-input v-model="filter.phonenumber" placeholder="查找分享用户" @input="Search">
|
||||
<template #append>
|
||||
<el-button :icon="'Search'" />
|
||||
</template>
|
||||
</el-input>
|
||||
|
||||
|
||||
<el-input
|
||||
v-model="filter.phonenumber"
|
||||
placeholder="查找分享用户"
|
||||
:suffix-icon="'Search'"
|
||||
@input="Search"
|
||||
/>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="分享时间">
|
||||
<el-date-picker
|
||||
@ -72,13 +76,13 @@
|
||||
<el-checkbox :label="item.label" v-for="item in power" :value="item.value" />
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="验证码" label-position="right">
|
||||
<!-- <el-form-item label="验证码" label-position="right">
|
||||
<el-input v-model="cEdit.smsCode" placeholder="验证码">
|
||||
<template #append
|
||||
><div class="btnSendSms" @click.stop="sendSms">{{ time > 0 ? time + '秒后重发' : '发送验证码' }}</div></template
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="center" style="margin-top: 10px">
|
||||
@ -288,7 +292,7 @@ function DelShare(item, isBatch) {
|
||||
alert('请选择需要删除的数据');
|
||||
return;
|
||||
}
|
||||
debugger;
|
||||
|
||||
let OkDel = () => {
|
||||
hideConfirm();
|
||||
Status.fullLoading = true;
|
||||
@ -353,12 +357,12 @@ function sendSms() {
|
||||
}
|
||||
//权限设置
|
||||
function powerSet(item) {
|
||||
debugger;
|
||||
|
||||
Status.ShowPowerSet = true;
|
||||
cEdit.permission = item.permission.split(',');
|
||||
cEdit.phonenumber = item.phonenumber;
|
||||
cEdit.remark = item.remark;
|
||||
cEdit.smsCode = '123456';
|
||||
cEdit.smsCode = '';
|
||||
}
|
||||
|
||||
function getUsrs() {
|
||||
@ -403,7 +407,7 @@ function initData(item, Refresh) {
|
||||
Status.loading = false;
|
||||
return;
|
||||
}
|
||||
debugger;
|
||||
|
||||
List.value = [];
|
||||
|
||||
deviceid = item.data.deviceId;
|
||||
|
||||
@ -469,7 +469,7 @@ function getRecordList() {
|
||||
|
||||
|
||||
|
||||
}, 2000);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -502,7 +502,7 @@ function ToggleAdvance() {
|
||||
|
||||
//显示编辑
|
||||
function ShowEdit(item = undefined, isEdit = true) {
|
||||
debugger;
|
||||
|
||||
Status.ShowEditPop = true;
|
||||
let def = {
|
||||
recordId: null,//维修记录id
|
||||
|
||||
Reference in New Issue
Block a user