修改轮胎生命周期

master
夜笙歌 2 years ago
parent b1e13133a2
commit 084625263d

@ -16,3 +16,30 @@ export function setCarTyres(query) {
params: query
})
}
// 查询轮胎详情
export function TyreInstall(query) {
return request({
url: '/basetyre/tyre/TyreInstall',
method: 'post',
data: query
})
}
// 查询轮胎详情
export function getTyreInfo(query) {
return request({
url: '/basetyre/tyre/getTyreInfoById',
method: 'get',
params: query
})
}
// 卸载轮胎
export function TyreUnInstall(query) {
return request({
url: '/basetyre/tyre/TyreUnInstall',
method: 'post',
data: query
})
}

@ -1,9 +1,9 @@
import request from '@/utils/request'
// 查询列表
export function listBaseCar(query) {
// 查询生命周期
export function getTyreLife(query) {
return request({
url: '/basecar/car/list',
url: '/basetyre/tyre/getTyreLife',
method: 'get',
params: query
})

@ -25,7 +25,7 @@ defineProps({
}
})
// const title = ref('');
const title = ref('');
const settingsStore = useSettingsStore();
const sideTheme = computed(() => settingsStore.sideTheme);
</script>

@ -9,6 +9,7 @@ import useUserStore from '@/store/modules/user'
import Cookies from "js-cookie";
import en from "element-plus/lib/locale/lang/en";
import zhCn from "element-plus/lib/locale/lang/zh-cn";
let lang = Cookies.get('language') === 'en' ? 'en' : 'zhCn'
if (lang === 'en') {
lang = 'en_US'
@ -27,7 +28,6 @@ const service = axios.create({
// 超时
timeout: 10000
})
// request拦截器
service.interceptors.request.use(config => {
// 是否需要设置 token
@ -39,10 +39,15 @@ service.interceptors.request.use(config => {
}
// get请求映射params参数
if (config.method === 'get' && (config.params || {})) {
let url = config.url + '?' + tansParams({
let url
if (!config.isNoLang) {
url = config.url + '?' + tansParams({
...(config.params || {}),
lang
});
} else {
url = config.url
}
url = url.slice(0, -1);
config.params = {};
config.url = url;

@ -61,14 +61,6 @@
<el-tab-pane label="有车载设备车辆" name="有车载设备车辆">
<el-form ref="queryRef" :inline="true" :model="queryParams"
label-width="60px" max-height="800">
<el-form-item label="车队" prop="carQueueId">
<el-input
v-model="queryParams.carQueueId"
clearable
style="width: 200px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="车牌号" prop="carLicense">
<el-input
v-model="queryParams.carLicense"
@ -207,7 +199,6 @@ const tabsName = ref('有车载设备车辆')
const queryParams = ref({
pageNum: 1,
pageSize: 10,
carQueueId: '',
carLicense: '',
})
const tableData = ref([])
@ -225,7 +216,6 @@ const resetQuery = () => {
queryParams.value = {
pageNum: 1,
pageSize: 10,
carQueueId: '',
carLicense: '',
}
handleQuery();

@ -63,11 +63,28 @@
</div>
<div v-if="!!nowClick"
style="display: inline-block;width: calc(100% - 600px);margin-left: 40px;max-width:400px;height: 200px;vertical-align:top;">
<el-form :model="form2" inline label-width="120px">
<el-form ref="form22" :model="form2" :rules="rules" inline label-width="120px">
<el-form-item label="当前轮胎位置" style="width: 100%;">
{{ form2.location }}
</el-form-item>
<el-form-item label="轮胎编号" style="width: 100%;">
<el-form-item label="轮胎编号" prop="outerTireNumber" style="width: 100%;">
<!-- <el-select-->
<!-- v-model="value"-->
<!-- :loading="loading"-->
<!-- :remote-method="outerTireNumberSearchClick"-->
<!-- filterable-->
<!-- multiple-->
<!-- placeholder="Please enter a keyword"-->
<!-- remote-->
<!-- reserve-keyword-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="item in outerTireNumberOption"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- />-->
<!-- </el-select>-->
<el-input v-model="form2.outerTireNumber">
<template #append>
<el-button :icon="Search" @click="outerTireNumberSearchClick"/>
@ -86,12 +103,13 @@
<el-form-item label="当前花纹深度" style="width: 100%;">
<el-input-number v-model="form2.currentTextureDepth" :precision="2" :step="0.1"/>
&nbsp; &nbsp;
<el-button @click="modifiedPatternDepth"></el-button>
<el-button @click="installClick(4)"></el-button>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="installClick(1)"></el-button>
<el-button type="primary" @click="installClick(2)"></el-button>
<el-button @click="uninstallClick"></el-button>
<el-button type="primary" @click="installClick()">/</el-button>
<!-- <el-button type="primary" @click="installClick(1)">/</el-button>-->
<!-- <el-button type="primary" @click="installClick(2)"></el-button>-->
<el-button :disabled="!form2?.tyreId" @click="uninstallClick(3)"></el-button>
</el-form-item>
</el-form>
</div>
@ -99,7 +117,7 @@
</template>
<script name="basetyre" setup>
import {listCarQueue, setCarTyres} from "@/api/tireManagement/install";
import {listCarQueue, setCarTyres, TyreInstall, getTyreInfo, TyreUnInstall} from "@/api/tireManagement/install";
import {Search} from '@element-plus/icons-vue'
import {useI18n} from 'vue-i18n';
import Cookies from "js-cookie";
@ -132,9 +150,36 @@ const form2 = ref({
outerTireNumber: null,
sensorId: "",
size: "",
tyrePositionVal: '',
tyrePosition: "",
})
const rules = {
outerTireNumber: [
{required: true, message: '请输入轮胎编号',trigger: 'change'},
]
}
const outerTireNumberOption = ref([
{
value: 'Option1',
label: 'Option1',
},
{
value: 'Option2',
label: 'Option2',
},
{
value: 'Option3',
label: 'Option3',
},
{
value: 'Option4',
label: 'Option4',
},
{
value: 'Option5',
label: 'Option5',
}
])
const backgroundColorState = (e) => {
if (installedTyre.value.includes(e)) {
return '#41ca7f'
@ -155,9 +200,8 @@ const borderColorState = (e) => {
const tyreClick = (e, location) => {
nowClick.value = e
let data = tireList.value.filter(res => res.tyrePosition === e)?.[0] || {}
let data = tireList.value.filter(res => res.tyrePositionVal === e)?.[0] || {}
form2.value = {...data, location}
console.log(form2.value)
}
const getList = async () => {
@ -181,6 +225,7 @@ const carQueueChange = (e) => {
outerTireNumber: null,
sensorId: "",
size: "",
tyrePositionVal: '',
tyrePosition: "",
tyreiId: ''
}
@ -201,6 +246,7 @@ const licenseNumberChange = async (e) => {
outerTireNumber: null,
sensorId: "",
size: "",
tyrePositionVal: "",
tyrePosition: "",
tyreiId: ''
}
@ -209,44 +255,81 @@ const licenseNumberChange = async (e) => {
tireArrangement.value = (res.carType?.split('T')[1]?.split('|').filter(e => e !== '') || []).map((res) => {
return parseInt(res.split('-')[1])
})
installedTyre.value = res.carTyresList.map(e => (e.tyrePosition.split('-')[0] + '-' + e.tyrePosition.split('-')[1] + '-' + e.tyrePosition.split('-')[2]))
installedTyre.value = res.carTyresList.map(e => (e.tyrePosition?.split('-')[0] + '-' + e.tyrePosition?.split('-')[1] + '-' + e.tyrePosition?.split('-')[2]))
tireList.value = res.carTyresList.map(e => {
return {
...e,
tyrePosition: e.tyrePosition.split('-')[0] + '-' + e.tyrePosition.split('-')[1] + '-' + e.tyrePosition.split('-')[2]
tyrePositionVal: e.tyrePosition?.split('-')[0] + '-' + e.tyrePosition?.split('-')[1] + '-' + e.tyrePosition?.split('-')[2]
}
})
}
const outerTireNumberSearchClick = () => {
console.log(form2.value.outerTireNumber)
const outerTireNumberSearchClick = async () => {
const {data} = await getTyreInfo({outerTireNumber: form2.value.outerTireNumber})
let list = nowClick.value?.split('-').map(e => parseFloat(e))
let num = 0
for (let i = 0; i < list?.[0] - 1; i++) {
num += (tireArrangement.value[i] * 4)
}
const modifiedPatternDepth =() =>{
console.log({
currentTextureDepth:form2.value.currentTextureDepth,
tyreiId:form2.value.tyreiId,
carLicense:licenseNumberOption.value.filter(e => e.value === form.value.licenseNumber)?.[0].label,
id:form.value.licenseNumber
})
if (list[1] === 1 && list[2] === 1) {
num += 4
}
if (list[1] === 1 && list[2] === 2) {
num += 3
}
if (list[1] === 2 && list[2] === 2) {
num += 2
}
if (list[1] === 2 && list[2] === 1) {
num += 1
}
form2.value.brand = data.brand
form2.value.size = data.size
form2.value.sensorId = data.sensorId
form2.value.tyreId = data.id
form2.value.tyrePosition = nowClick.value + '-' + num
}
const installClick = (e) => {
console.log(e === 1? '安装' :'更换')
console.log({
let state = e
if (!e) {
state = 1
}
proxy.$refs["form22"].validate((valid) => {
if (valid) {
TyreInstall({
...form2.value,
carLicense: licenseNumberOption.value.filter(e => e.value === form.value.licenseNumber)?.[0].label,
id:form.value.licenseNumber
carId: form.value.licenseNumber,
type: state
}).then(async (e) => {
proxy.$modal.msgSuccess(e.msg);
let param = nowClick.value
let str = form2.value.location
await licenseNumberChange()
tyreClick(param, str)
})
}
});
}
const uninstallClick = () => {
console.log({
tyreiId:form2.value.tyreiId,
const uninstallClick = (val) => {
if (form2.value.tyreId) {
TyreUnInstall({
...form2.value,
carLicense: licenseNumberOption.value.filter(e => e.value === form.value.licenseNumber)?.[0].label,
id:form.value.licenseNumber
carId: form.value.licenseNumber,
type: val
}).then(async (e) => {
proxy.$modal.msgSuccess(e.msg);
let param = nowClick.value
let str = form2.value.location
await licenseNumberChange()
tyreClick(param, str)
})
}
}
getList()
</script>

@ -4,7 +4,13 @@
<img alt="" src="@/assets/images/lifecycle/tyre.png" style="height: 100%">
<div
style="color:white;line-height:26px;margin-left: 10px;width: calc(100% - 150px);display: inline-block;vertical-align:top;">
<div>{{ tireInfo.title }}</div>
<div style="width: 200px">
<el-input v-model="tireInfo.title" size="small">
<template #append>
<el-button :icon="Search" size="small" @click="outerTireNumberSearchClick"/>
</template>
</el-input>
</div>
<div>品牌{{ tireInfo.info1 }} 规格{{ tireInfo.info2 }} 花纹{{ tireInfo.info3 }}</div>
<div>
<span class="yellow">使用时间&nbsp;&nbsp;</span>
@ -51,10 +57,18 @@
<div style="width:100%">
<span>
<Aim style="display:inline-block;position: absolute;top: 10px;left:4px" width="20"/>
<span style="margin-left:26px;font-size:18px;line-height: 40px">注册</span>
<span style="margin-left:26px;font-size:18px;line-height: 30px">{{ i.description }}</span>
</span>
</div>
<div>{{ parseTime(new Date(i.time), '{y}-{m}-{d}') }}</div>
<div style="width:100%;padding-left: 4px;line-height: 24px">
{{ i.carLicence || '' }}
</div>
<div style="width:100%;padding-left: 4px;line-height: 24px">
{{ tyrePosition(i.carPosition) || '' }}
</div>
<div style="width:100%;padding-left: 4px;line-height: 24px">
{{ i.datetime ? parseTime(new Date(i.datetime), '{y}-{m}-{d}') : '' }}
</div>
</div>
</div>
</div>
@ -64,22 +78,86 @@
<script setup>
import AMapLoader from '@amap/amap-jsapi-loader';
import {getCarGpsList, listBaseCar} from '@/api/tireManagement/lifecycle'
import {getTyreLife,} from '@/api/tireManagement/lifecycle'
import {parseTime} from "@/utils/ruoyi";
import {onBeforeUnmount} from "@vue/runtime-core";
import {Search} from '@element-plus/icons-vue'
const {proxy} = getCurrentInstance();
const way = ref()
const list = ref([])
const wayList = ref([])
const repetitiveBackground = ref(0)
const wayWheel = (e) => {
way.value.scrollLeft += (e.deltaY || 0)
}
const getList = () => {
list.value.forEach(e => {
e.datetime = new Date(e.datetime).getTime()
if (e.description === '1') {
e.description = '安装轮胎'
}
if (e.description === '2') {
e.description = '更换轮胎'
}
if (e.description === '3') {
e.description = '卸载轮胎'
}
if (e.description === '4') {
e.description = '修改花纹深度'
}
})
list.value = list.value.sort((a, b) => {
return a.datetime - b.datetime
})
let arr = []
list.value.forEach((e, index) => {
let step = (e.datetime - list[index - 1]?.datetime) / 1000 / 60 / 60 / 24 || 0
if (step > 1) {
step = 1 + ((step - 1) / 100)
} else {
step = 1
}
step += arr[index - 1]?.step || 0
arr[index] = {...e, step}
})
wayList.value = arr
repetitiveBackground.value = Math.round(arr.at(-1).step / 10) + 1
arr.push({
// datetime: 1678199843735,
description: '终点',
step: (Math.round(arr.at(-1).step / 10) + 1) * 10 - 1
})
}
const outerTireNumberSearchClick = async () => {
const {data: info} = await getTyreLife({
outerTireNumber: tireInfo.value.title
})
console.log(info)
list.value = info
list.value.push({
datetime: new Date().getTime(),
description: '今日'
})
getList()
// console.log(tireInfo.title)
}
const tyrePosition = (e) => {
if (!e) return
let arr = e?.split('-')
let position = [parseFloat(arr?.[0]), parseFloat(arr?.[1]), parseFloat(arr?.[2])]
let Enum1 = ['左', '右']
let Enum2 = ['外', '内']
return `${position[0]}${Enum1[position[1] - 1]}${Enum1[position[2] - 1]}`
console.log(position)
}
const percentage = '3.33'
const run = '3.33'
const tireInfo = {
title: 'F35D090D785',
const tireInfo = ref({
title: '1001',
info1: '品牌',
info2: '规格',
info3: '花纹',
@ -96,70 +174,12 @@ const tireInfo = {
num: 1
}
]
}
let list = [
{
time: 1678059835735,
info: '123'
},
{
time: 1658170035735,
info: '2'
},
{
time: 1678259824735,
info: '3'
},
{
time: 1678154445735,
info: '4'
},
{
time: 1678199843735,
info: '5'
},
{
time: 1678199843735,
info: '5'
},
{
time: 1678199843735,
info: '5'
},
{
time: 1678199843735,
info: '5'
},
]
const fun = () => {
list = list.sort((a, b) => {
return a.time - b.time
})
let arr = []
list.forEach((e, index) => {
let step = (e.time - list[index - 1]?.time) / 1000 / 60 / 60 / 24 || 0
if (step > 1) {
step = 1 + ((step - 1) / 100)
} else {
step = 1
}
step += arr[index - 1]?.step || 0
arr[index] = {...e, step}
})
console.log(arr)
wayList.value = arr
repetitiveBackground.value = Math.ceil(arr.at(-1).step / 10)
}
const wayList = ref([])
const repetitiveBackground = ref(0)
fun()
</script>
<style lang="scss">
.yellow {
color: yellow;
}
@ -284,7 +304,8 @@ fun()
.info {
position: absolute;
width: 200px;
height: 70px;
//height: 100px;
padding: 4px 0;
border-radius: 10px;
background-color: #ffffff;
transform: translate(-50%, -50%);

@ -31,8 +31,8 @@ export default defineConfig(({mode, command}) => {
proxy: {
// https://cn.vitejs.dev/config/#server-proxy
'/dev-api': {
// target: 'http://10.11.41.249:8080',
target: 'http://localhost:8080',
target: 'http://10.10.42.32:8080',
// target: 'http://localhost:8080',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '')
}

Loading…
Cancel
Save