修改轮胎生命周期

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

@ -16,3 +16,30 @@ export function setCarTyres(query) {
params: 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' import request from '@/utils/request'
// 查询列表 // 查询生命周期
export function listBaseCar(query) { export function getTyreLife(query) {
return request({ return request({
url: '/basecar/car/list', url: '/basetyre/tyre/getTyreLife',
method: 'get', method: 'get',
params: query params: query
}) })

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

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

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

@ -63,11 +63,28 @@
</div> </div>
<div v-if="!!nowClick" <div v-if="!!nowClick"
style="display: inline-block;width: calc(100% - 600px);margin-left: 40px;max-width:400px;height: 200px;vertical-align:top;"> 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%;"> <el-form-item label="当前轮胎位置" style="width: 100%;">
{{ form2.location }} {{ form2.location }}
</el-form-item> </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"> <el-input v-model="form2.outerTireNumber">
<template #append> <template #append>
<el-button :icon="Search" @click="outerTireNumberSearchClick"/> <el-button :icon="Search" @click="outerTireNumberSearchClick"/>
@ -86,12 +103,13 @@
<el-form-item label="当前花纹深度" style="width: 100%;"> <el-form-item label="当前花纹深度" style="width: 100%;">
<el-input-number v-model="form2.currentTextureDepth" :precision="2" :step="0.1"/> <el-input-number v-model="form2.currentTextureDepth" :precision="2" :step="0.1"/>
&nbsp; &nbsp; &nbsp; &nbsp;
<el-button @click="modifiedPatternDepth"></el-button> <el-button @click="installClick(4)"></el-button>
</el-form-item> </el-form-item>
<el-form-item label=" "> <el-form-item label=" ">
<el-button type="primary" @click="installClick(1)"></el-button> <el-button type="primary" @click="installClick()">/</el-button>
<el-button type="primary" @click="installClick(2)"></el-button> <!-- <el-button type="primary" @click="installClick(1)">/</el-button>-->
<el-button @click="uninstallClick"></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-item>
</el-form> </el-form>
</div> </div>
@ -99,7 +117,7 @@
</template> </template>
<script name="basetyre" setup> <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 {Search} from '@element-plus/icons-vue'
import {useI18n} from 'vue-i18n'; import {useI18n} from 'vue-i18n';
import Cookies from "js-cookie"; import Cookies from "js-cookie";
@ -132,9 +150,36 @@ const form2 = ref({
outerTireNumber: null, outerTireNumber: null,
sensorId: "", sensorId: "",
size: "", size: "",
tyrePositionVal: '',
tyrePosition: "", 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) => { const backgroundColorState = (e) => {
if (installedTyre.value.includes(e)) { if (installedTyre.value.includes(e)) {
return '#41ca7f' return '#41ca7f'
@ -155,9 +200,8 @@ const borderColorState = (e) => {
const tyreClick = (e, location) => { const tyreClick = (e, location) => {
nowClick.value = e 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} form2.value = {...data, location}
console.log(form2.value)
} }
const getList = async () => { const getList = async () => {
@ -181,6 +225,7 @@ const carQueueChange = (e) => {
outerTireNumber: null, outerTireNumber: null,
sensorId: "", sensorId: "",
size: "", size: "",
tyrePositionVal: '',
tyrePosition: "", tyrePosition: "",
tyreiId: '' tyreiId: ''
} }
@ -201,6 +246,7 @@ const licenseNumberChange = async (e) => {
outerTireNumber: null, outerTireNumber: null,
sensorId: "", sensorId: "",
size: "", size: "",
tyrePositionVal: "",
tyrePosition: "", tyrePosition: "",
tyreiId: '' tyreiId: ''
} }
@ -209,44 +255,81 @@ const licenseNumberChange = async (e) => {
tireArrangement.value = (res.carType?.split('T')[1]?.split('|').filter(e => e !== '') || []).map((res) => { tireArrangement.value = (res.carType?.split('T')[1]?.split('|').filter(e => e !== '') || []).map((res) => {
return parseInt(res.split('-')[1]) 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 => { tireList.value = res.carTyresList.map(e => {
return { return {
...e, ...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 = () => { const outerTireNumberSearchClick = async () => {
console.log(form2.value.outerTireNumber) 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)
} }
if (list[1] === 1 && list[2] === 1) {
const modifiedPatternDepth =() =>{ num += 4
console.log({ }
currentTextureDepth:form2.value.currentTextureDepth, if (list[1] === 1 && list[2] === 2) {
tyreiId:form2.value.tyreiId, num += 3
carLicense:licenseNumberOption.value.filter(e => e.value === form.value.licenseNumber)?.[0].label, }
id:form.value.licenseNumber 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) => { const installClick = (e) => {
console.log(e === 1? '安装' :'更换') let state = e
console.log({ if (!e) {
state = 1
}
proxy.$refs["form22"].validate((valid) => {
if (valid) {
TyreInstall({
...form2.value, ...form2.value,
carLicense: licenseNumberOption.value.filter(e => e.value === form.value.licenseNumber)?.[0].label, 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 = () => { const uninstallClick = (val) => {
console.log({ if (form2.value.tyreId) {
tyreiId:form2.value.tyreiId, TyreUnInstall({
...form2.value,
carLicense: licenseNumberOption.value.filter(e => e.value === form.value.licenseNumber)?.[0].label, 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() getList()
</script> </script>

@ -4,7 +4,13 @@
<img alt="" src="@/assets/images/lifecycle/tyre.png" style="height: 100%"> <img alt="" src="@/assets/images/lifecycle/tyre.png" style="height: 100%">
<div <div
style="color:white;line-height:26px;margin-left: 10px;width: calc(100% - 150px);display: inline-block;vertical-align:top;"> 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>品牌{{ tireInfo.info1 }} 规格{{ tireInfo.info2 }} 花纹{{ tireInfo.info3 }}</div>
<div> <div>
<span class="yellow">使用时间&nbsp;&nbsp;</span> <span class="yellow">使用时间&nbsp;&nbsp;</span>
@ -51,10 +57,18 @@
<div style="width:100%"> <div style="width:100%">
<span> <span>
<Aim style="display:inline-block;position: absolute;top: 10px;left:4px" width="20"/> <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> </span>
</div> </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> </div>
</div> </div>
@ -64,22 +78,86 @@
<script setup> <script setup>
import AMapLoader from '@amap/amap-jsapi-loader'; 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 {parseTime} from "@/utils/ruoyi";
import {onBeforeUnmount} from "@vue/runtime-core"; import {Search} from '@element-plus/icons-vue'
const {proxy} = getCurrentInstance(); const {proxy} = getCurrentInstance();
const way = ref() const way = ref()
const list = ref([])
const wayList = ref([])
const repetitiveBackground = ref(0)
const wayWheel = (e) => { const wayWheel = (e) => {
way.value.scrollLeft += (e.deltaY || 0) 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 percentage = '3.33'
const run = '3.33' const run = '3.33'
const tireInfo = { const tireInfo = ref({
title: 'F35D090D785', title: '1001',
info1: '品牌', info1: '品牌',
info2: '规格', info2: '规格',
info3: '花纹', info3: '花纹',
@ -96,70 +174,12 @@ const tireInfo = {
num: 1 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> </script>
<style lang="scss"> <style lang="scss">
.yellow { .yellow {
color: yellow; color: yellow;
} }
@ -284,7 +304,8 @@ fun()
.info { .info {
position: absolute; position: absolute;
width: 200px; width: 200px;
height: 70px; //height: 100px;
padding: 4px 0;
border-radius: 10px; border-radius: 10px;
background-color: #ffffff; background-color: #ffffff;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);

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

Loading…
Cancel
Save