车辆调度问题
This commit is contained in:
parent
f414712b37
commit
bf9a74e60b
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="uni-common-mt container">
|
<view class="uni-common-mt container">
|
||||||
<view class="title">欢迎使用乐享运维</view>
|
<view class="title">欢迎使用景上运维</view>
|
||||||
|
|
||||||
<!-- 用户名输入框 -->
|
<!-- 用户名输入框 -->
|
||||||
<view class="input-group">
|
<view class="input-group">
|
||||||
@ -135,7 +135,7 @@
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.container {
|
.container {
|
||||||
padding: 20px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container .title {
|
.container .title {
|
||||||
|
|||||||
@ -1,75 +1,136 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<view class="container">
|
<view class="container">
|
||||||
|
|
||||||
|
<view>
|
||||||
|
<uni-forms>
|
||||||
|
<uni-forms-item label="车辆编号">
|
||||||
|
<bikeCodeScan ref="childComponent" @scan-change="bikeCodeScanChange" :codeValue="newbikeCode" />
|
||||||
|
</uni-forms-item>
|
||||||
|
</uni-forms>
|
||||||
|
</view>
|
||||||
|
<view class="button-container">
|
||||||
|
<view class="button-group flex justify-between padding">
|
||||||
|
<button class="cu-btn bg-blue margin-tb-sm lg">开锁</button>
|
||||||
|
<button class="cu-btn bg-blue margin-tb-sm lg"><strong>推车</strong></button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="table-container">
|
||||||
|
<uni-table>
|
||||||
|
<uni-tr>
|
||||||
|
<uni-th width="100" align="center">车辆编号</uni-th>
|
||||||
|
<uni-th width="50" align="center">状态</uni-th>
|
||||||
|
<uni-th width="80" align="center">响铃</uni-th>
|
||||||
|
<uni-th width="80" align="center">操作</uni-th>
|
||||||
|
</uni-tr>
|
||||||
|
<uni-tr v-for="(item, index) in dispatchRecords" :key="index">
|
||||||
|
<uni-td>{{ item.bikeCode }}</uni-td>
|
||||||
|
<uni-td>
|
||||||
|
<view class="name">离线</view>
|
||||||
|
</uni-td>
|
||||||
|
<uni-td align="center">
|
||||||
|
<view class="cu-tag line-blue">
|
||||||
|
<uni-icons type="plus" color="rgb(102,179,255)" size="20"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</uni-td>
|
||||||
|
<uni-td align="center">
|
||||||
|
<uni-icons type="minus-filled" color="black" size="30"
|
||||||
|
@click="deleteDispatchRecord(item.id,index)"></uni-icons>
|
||||||
|
</uni-td>
|
||||||
|
</uni-tr>
|
||||||
|
</uni-table>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="dispatch-btn-container">
|
||||||
<view class="cu-btn bg-blue" @click="getInfoList">
|
<view class="cu-btn bg-blue" @click="getInfoList">
|
||||||
调度
|
调度
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import {
|
||||||
ref
|
ref
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import * as api from '@/utils/api.js';
|
import * as api from '@/utils/api.js';
|
||||||
import {onLoad} from '@dcloudio/uni-app';
|
import {
|
||||||
|
onLoad
|
||||||
|
} from '@dcloudio/uni-app';
|
||||||
|
import {
|
||||||
|
showModelMessage
|
||||||
|
} from '@/utils/tools.js';
|
||||||
|
|
||||||
const orderId=ref("");
|
const orderId = ref("");
|
||||||
onLoad((options)=>{
|
|
||||||
debugger;
|
const newbikeCode = ref("");
|
||||||
orderId.value=options.orderId;;
|
|
||||||
|
const dispatchRecords = ref([]);
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
orderId.value = options.orderId;;
|
||||||
})
|
})
|
||||||
const getInfoList =()=>{
|
const getInfoList = () => {
|
||||||
debugger;
|
api.callEbikeInfo("getDispatchVehicleByOrderId?orderId=" + orderId.value, {}, "get").then(
|
||||||
api.callEbikeInfo("getDispatchVehicleByOrderId?orderId="+orderId.value, {}, "get").then(
|
|
||||||
res => {
|
res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
debugger;
|
|
||||||
|
dispatchRecords.value = res.data.dispatchRecords;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const deleteDispatchRecord = (recordId,index) => {
|
||||||
|
|
||||||
|
// 使用 splice 删除指定索引的元素
|
||||||
|
dispatchRecords.value.splice(index, 1);
|
||||||
|
// api.callEbikeInfo("deleteDispatchRecord?recordId=" + recordId, {}, "get").then(res=>{
|
||||||
|
// if(res.code==200){
|
||||||
|
// dispatchRecords.value.slice(index,1)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
}
|
||||||
|
const bikeCodeScanChange = (bikeCode) => {
|
||||||
|
api.callEbikeInfo("getBikeINfoData?bikeCode=" + bikeCode).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
const params = {
|
||||||
|
"orderId": orderId.value,
|
||||||
|
"bikeCode": bikeCode,
|
||||||
|
"dispatchState": 0
|
||||||
|
}
|
||||||
|
debugger;
|
||||||
|
newbikeCode.value = bikeCode;
|
||||||
|
api.callEbikeInfo("createDispatchRecord", params)
|
||||||
|
.then(re => {
|
||||||
|
if (re.code == "200") {
|
||||||
|
dispatchRecords.value.push(re.data)
|
||||||
|
} else {
|
||||||
|
showModelMessage(re.msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
showModelMessage("车辆不存在!")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.dispatch-container {
|
.container {
|
||||||
text-align: center;
|
padding: 10px
|
||||||
margin-top: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dispatch-button {
|
.button-group button {
|
||||||
padding: 10px 20px;
|
width: 48%;
|
||||||
background-color: #4CAF50;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 5px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dispatch-button:hover {
|
.table-container {
|
||||||
background-color: #45a049;
|
height: 400px;
|
||||||
}
|
width: 100%;
|
||||||
|
padding: 5px;
|
||||||
|
|
||||||
.loading {
|
|
||||||
margin-top: 10px;
|
|
||||||
font-size: 18px;
|
|
||||||
color: #888;
|
|
||||||
}
|
|
||||||
|
|
||||||
.data-display {
|
|
||||||
margin-top: 20px;
|
|
||||||
background-color: #f4f4f4;
|
|
||||||
padding: 15px;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-message {
|
|
||||||
margin-top: 10px;
|
|
||||||
color: red;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user