代码优化
This commit is contained in:
parent
b83382b9f2
commit
dd43a7fa97
|
|
@ -776,6 +776,7 @@ export default {
|
|||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.$refs.mychildSon.inputValue = ''
|
||||
this.queryParams.time = []
|
||||
this.queryParams.typeId = ''
|
||||
// this.resetForm("queryForm");
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -757,10 +757,10 @@ export default {
|
|||
// },
|
||||
/** 查询用户列表--库管员,维修员 */
|
||||
getUserList() {
|
||||
getUserByRoleList({ roleId: '101' }).then((response) => {
|
||||
getUserByRoleList({ roleIds: [132, 139] }).then((response) => {
|
||||
this.keeperList = response.data
|
||||
})
|
||||
getUserByRoleList({ roleId: '102' }).then((response) => {
|
||||
getUserByRoleList({ roleIds: [133] }).then((response) => {
|
||||
this.repairUserList = response.data
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -37,14 +37,14 @@
|
|||
</el-card>
|
||||
|
||||
<el-row :gutter="24" class="map-container">
|
||||
<el-col :span="6">
|
||||
<el-col :span="6" v-loading="loadingData">
|
||||
<el-tabs type="border-card" class="map-left">
|
||||
<el-tab-pane label="行程">
|
||||
<template v-if="tripList.length > 0">
|
||||
<template v-if="tripInfoListNew.length > 0">
|
||||
<div
|
||||
class="trip-container"
|
||||
@click="handlePreviewTrip(item, index)"
|
||||
v-for="(item, index) in tripList"
|
||||
v-for="(item, index) in tripInfoListNew"
|
||||
:key="index"
|
||||
>
|
||||
<div class="left-num">{{ index + 1 }}</div>
|
||||
|
|
@ -95,9 +95,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{
|
||||
loadingData ? '数据加载中...' : '暂无数据 '
|
||||
}}
|
||||
{{ loadingData ? '数据加载中...' : '暂无数据' }}
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="停留点">
|
||||
|
|
@ -228,6 +226,8 @@ export default {
|
|||
parkList: [],
|
||||
warningList: [],
|
||||
loadingData: true,
|
||||
|
||||
tripInfoListNew: [], // 新行程信息
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
|
|
@ -279,29 +279,30 @@ export default {
|
|||
this.$message.error('请选择时间范围!')
|
||||
return
|
||||
}
|
||||
this.loadingData = true
|
||||
this.tripParams.iotId = this.iotCode
|
||||
const res = await getIotDeviceTripApi({ ...this.tripParams })
|
||||
console.log(res, '行程信息--')
|
||||
// const res = await getIotDeviceTripApi({ ...this.tripParams })
|
||||
// console.log(res, '行程信息--')
|
||||
|
||||
const resS = await getIotDeviceParkDetailApi({ ...this.tripParams })
|
||||
|
||||
console.log(resS, '停留点信息--')
|
||||
|
||||
const params = { ...this.tripParams }
|
||||
params.beginTime = params.beginTime.slice(0, 10)
|
||||
params.endTime = params.endTime.slice(0, 10)
|
||||
const resSs = await getIotDeviceAlarmApi(params)
|
||||
|
||||
this.loadingData = false
|
||||
|
||||
this.warningList = resSs.data
|
||||
this.warningList.forEach((e) => {
|
||||
e.warnTime = moment(parseInt(e.startAlarmTime)).format(
|
||||
'YYYY-MM-DD HH:mm:ss',
|
||||
)
|
||||
})
|
||||
console.log(resSs, '报警信息--')
|
||||
|
||||
this.parkList = resS.data
|
||||
this.parkList.forEach((e) => {
|
||||
console.log(e, '----')
|
||||
e.startTime = moment(parseInt(e.beginTime)).format(
|
||||
'YYYY-MM-DD HH:mm:ss',
|
||||
)
|
||||
|
|
@ -319,37 +320,71 @@ export default {
|
|||
60,
|
||||
)
|
||||
})
|
||||
let tripInfo = JSON.parse(res.msg)
|
||||
console.log(tripInfo, '反序列化之后', this.parkList)
|
||||
|
||||
let addressList = []
|
||||
if (tripInfo.addressmap) {
|
||||
addressList = Object.keys(tripInfo.addressmap)
|
||||
}
|
||||
|
||||
tripInfo.totaltrips.forEach((e) => {
|
||||
e.startTime = moment(e.trackstarttime).format(
|
||||
'YYYY-MM-DD HH:mm:ss',
|
||||
)
|
||||
e.endTime = moment(e.trackendtime).format('YYYY-MM-DD HH:mm:ss')
|
||||
|
||||
e.drivingDuration = parseInt(
|
||||
(e.trackendtime - e.trackstarttime) / 1000,
|
||||
)
|
||||
|
||||
addressList.forEach((v) => {
|
||||
if (v.indexOf(e.slat.toString().slice(0, 7)) > -1) {
|
||||
e.startAddress = tripInfo.addressmap[v]
|
||||
}
|
||||
if (v.indexOf(e.elat.toString().slice(0, 7)) > -1) {
|
||||
e.endAddress = tripInfo.addressmap[v]
|
||||
// 处理行程信息
|
||||
this.tripInfoListNew = []
|
||||
let tripInfoList = []
|
||||
if (this.parkList.length > 1) {
|
||||
this.parkList.forEach((e, index) => {
|
||||
if (index < this.parkList.length - 1) {
|
||||
let obj = {
|
||||
startTime: e.startTime,
|
||||
startAddress: e.address,
|
||||
startLng: e.callon,
|
||||
startLat: e.callat,
|
||||
endLng: '',
|
||||
endLat: '',
|
||||
endTime: '',
|
||||
endAddress: '',
|
||||
}
|
||||
tripInfoList.push(obj)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
this.tripList = tripInfo.totaltrips
|
||||
this.parkList.forEach((e, index) => {
|
||||
if (index > 0) {
|
||||
tripInfoList[index - 1].endTime = e.startTime
|
||||
tripInfoList[index - 1].endAddress = e.address
|
||||
tripInfoList[index - 1].endLng = e.callon
|
||||
tripInfoList[index - 1].endLat = e.callat
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
console.log(tripInfo, '处理之后-----')
|
||||
this.tripInfoListNew = tripInfoList
|
||||
|
||||
// console.log(tripInfoList, '处理后的行程---')
|
||||
// let tripInfo = JSON.parse(res.msg)
|
||||
// console.log(tripInfo, '反序列化之后', this.parkList)
|
||||
|
||||
// let addressList = []
|
||||
// if (tripInfo.addressmap) {
|
||||
// addressList = Object.keys(tripInfo.addressmap)
|
||||
// }
|
||||
|
||||
// tripInfo.totaltrips.forEach((e) => {
|
||||
// e.startTime = moment(e.trackstarttime).format(
|
||||
// 'YYYY-MM-DD HH:mm:ss',
|
||||
// )
|
||||
// e.endTime = moment(e.trackendtime).format('YYYY-MM-DD HH:mm:ss')
|
||||
|
||||
// e.drivingDuration = parseInt(
|
||||
// (e.trackendtime - e.trackstarttime) / 1000,
|
||||
// )
|
||||
|
||||
// addressList.forEach((v) => {
|
||||
// if (v.indexOf(e.slat.toString().slice(0, 7)) > -1) {
|
||||
// e.startAddress = tripInfo.addressmap[v]
|
||||
// }
|
||||
// if (v.indexOf(e.elat.toString().slice(0, 7)) > -1) {
|
||||
// e.endAddress = tripInfo.addressmap[v]
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
|
||||
// this.tripList = tripInfo.totaltrips
|
||||
|
||||
// console.log(tripInfo, '处理之后-----')
|
||||
},
|
||||
/** 查看行程 */
|
||||
handlePreviewTrip(item, index) {
|
||||
|
|
@ -359,10 +394,10 @@ export default {
|
|||
}
|
||||
this.map.clearOverlays()
|
||||
let pointList = []
|
||||
this.linePointList[0].lng = item.slon
|
||||
this.linePointList[0].lat = item.slat
|
||||
this.linePointList[1].lng = item.elon
|
||||
this.linePointList[1].lat = item.elat
|
||||
this.linePointList[0].lng = item.startLng
|
||||
this.linePointList[0].lat = item.startLat
|
||||
this.linePointList[1].lng = item.endLng
|
||||
this.linePointList[1].lat = item.endLat
|
||||
if (this.linePointList.length === 0) return
|
||||
for (var i = 0; i < this.linePointList.length; i++) {
|
||||
pointList.push(
|
||||
|
|
@ -381,9 +416,9 @@ export default {
|
|||
// polyline.setStrokeWeight(2) // 线宽
|
||||
this.trackAni = new BMapGLLib.TrackAnimation(this.map, polyline, {
|
||||
overallView: true, // 动画完成后自动调整视野到总览
|
||||
tilt: 30, // 轨迹播放的角度,默认为55
|
||||
duration: 3000, // 动画持续时长,默认为10000,单位ms
|
||||
delay: 500, // 动画开始的延迟,默认0,单位ms
|
||||
tilt: 55, // 轨迹播放的角度,默认为55
|
||||
duration: 1500, // 动画持续时长,默认为10000,单位ms
|
||||
delay: 100, // 动画开始的延迟,默认0,单位ms
|
||||
})
|
||||
this.trackAni.start()
|
||||
// 设置起点终点图标
|
||||
|
|
|
|||
|
|
@ -780,11 +780,11 @@ export default {
|
|||
// },
|
||||
/** 查询用户列表--库管员,维修员 */
|
||||
getUserList() {
|
||||
getMaUserList().then((response) => {
|
||||
getMaUserList({ roleIds: [132, 139] }).then((response) => {
|
||||
console.log(response, '库管员')
|
||||
this.keeperList = response.data
|
||||
})
|
||||
getUserByRoleList().then((response) => {
|
||||
getUserByRoleList({ roleIds: [133] }).then((response) => {
|
||||
console.log(response, '维修员')
|
||||
this.repairUserList = response.data
|
||||
})
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@
|
|||
filterable
|
||||
:disabled="isDisabled"
|
||||
style="width: 240px"
|
||||
@change="changeSupplier"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in supplierList"
|
||||
|
|
@ -605,7 +604,7 @@ export default {
|
|||
methods: {
|
||||
/** 查询用户列表--采购员 */
|
||||
getUserList() {
|
||||
getUserByRoleList({ roleId: '104' }).then((response) => {
|
||||
getUserByRoleList({ roleIds: [152] }).then((response) => {
|
||||
this.userList = response.data
|
||||
})
|
||||
},
|
||||
|
|
@ -655,11 +654,11 @@ export default {
|
|||
}
|
||||
},
|
||||
//选择机具厂家
|
||||
changeSupplier(supplierId) {
|
||||
this.equipmentList.forEach((item) => {
|
||||
this.$set(item, 'supplierId', supplierId)
|
||||
})
|
||||
},
|
||||
// changeSupplier(supplierId) {
|
||||
// this.equipmentList.forEach((item) => {
|
||||
// this.$set(item, 'supplierId', supplierId)
|
||||
// })
|
||||
// },
|
||||
/** 新增按钮操作 */
|
||||
handleSave() {
|
||||
if (this.equipmentList.length > 0) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@
|
|||
clearable
|
||||
filterable
|
||||
style="width: 240px"
|
||||
@change="changeSupplier"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in supplierList"
|
||||
|
|
@ -463,20 +462,26 @@ export default {
|
|||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 如果有厂家则代入
|
||||
if (this.queryParams.supplierId) {
|
||||
this.$set(row, 'supplierId', this.queryParams.supplierId)
|
||||
} else {
|
||||
this.$set(row, 'supplierId', '')
|
||||
}
|
||||
this.$set(row, 'createTime', null)
|
||||
this.$set(row, 'productionTime', '')
|
||||
this.$set(row, 'supplierId', '')
|
||||
this.$set(row, 'purchasePrice', 0)
|
||||
this.$set(row, 'purchaseNum', 1)
|
||||
this.equipmentList.unshift(row)
|
||||
}
|
||||
},
|
||||
//选择机具厂家
|
||||
changeSupplier(supplierId) {
|
||||
this.equipmentList.forEach((item) => {
|
||||
this.$set(item, 'supplierId', supplierId)
|
||||
})
|
||||
},
|
||||
// changeSupplier(supplierId) {
|
||||
// this.equipmentList.forEach((item) => {
|
||||
// this.$set(item, 'supplierId', supplierId)
|
||||
// })
|
||||
// },
|
||||
//选择出厂日期
|
||||
changeTime(time) {
|
||||
console.log(time)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ module.exports = {
|
|||
// target: `https://test-cc.zhgkxt.com`,//线上环境-南网
|
||||
// target: `https://z.csgmall.com.cn`,
|
||||
|
||||
target: `http://192.168.2.135:49080`, //超
|
||||
target: `http://192.168.2.152:49080`, //超
|
||||
// target: `http://10.40.92.81:8080`, //韩/
|
||||
// target: `http://192.168.2.82:49080`,//旭/
|
||||
// target: `http://192.168.2.248:28080`, //帅
|
||||
|
|
|
|||
Loading…
Reference in New Issue