|
|
@@ -8,7 +8,7 @@
|
|
|
<div class="search" v-show="showSearch" style="display: flex;flex-direction: row;">
|
|
|
<div style="width: 80%;">
|
|
|
<el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
|
|
|
- <el-form-item label="路线">
|
|
|
+ <!-- <el-form-item label="路线">
|
|
|
<el-select v-model="line" placeholder="请选择路线" style="width: 120px">
|
|
|
<el-option v-for="item in carPathList" :key="item.id" :label="item.name"
|
|
|
:value="item.id" />
|
|
|
@@ -16,12 +16,12 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="车辆">
|
|
|
<el-select v-model="line" placeholder="请选择车辆" style="width: 120px">
|
|
|
- <el-option v-for="item in carInfoList" :key="item.id" :label="item.name"
|
|
|
+ <el-option v-for="item in carInfoList" :key="item.id" :label="item.carNum"
|
|
|
:value="item.id" />
|
|
|
</el-select>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
<el-form-item label="时间" prop="carNum">
|
|
|
- <el-date-picker v-model="value2" type="datetimerange" :shortcuts="shortcuts"
|
|
|
+ <el-date-picker v-model="dataValue" type="daterange" :shortcuts="shortcuts"
|
|
|
range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -31,18 +31,14 @@
|
|
|
<!-- <el-button type="primary" plain @click="goadd">今天</el-button>
|
|
|
<el-button type="primary" plain @click="resetQuery">昨天</el-button>
|
|
|
<el-button type="primary" plain @click="resetQuery">近三天</el-button> -->
|
|
|
- <el-button type="primary" @click="goadd">查询</el-button>
|
|
|
+ <el-button type="primary" @click="searchCar">查询</el-button>
|
|
|
<el-button @click="resetQuery">重置</el-button>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
</div>
|
|
|
</transition>
|
|
|
<el-card shadow="never">
|
|
|
-
|
|
|
<tableElm @childToParent='childrenClick' :columns="columns1" ref="table1"></tableElm>
|
|
|
-
|
|
|
- <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
|
|
- v-model:limit="queryParams.pageSize" @pagination="getList" />
|
|
|
</el-card>
|
|
|
</div>
|
|
|
</el-tab-pane>
|
|
|
@@ -53,7 +49,7 @@
|
|
|
<div class="search" v-show="showSearch" style="display: flex;flex-direction: row;">
|
|
|
<div style="width: 80%;">
|
|
|
<el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
|
|
|
- <el-form-item label="路线">
|
|
|
+ <!-- <el-form-item label="路线">
|
|
|
<el-select v-model="line" placeholder="请选择路线" style="width: 120px">
|
|
|
<el-option v-for="item in carPathList" :key="item.id" :label="item.name"
|
|
|
:value="item.id" />
|
|
|
@@ -64,9 +60,9 @@
|
|
|
<el-option v-for="item in carInfoList" :key="item.id" :label="item.name"
|
|
|
:value="item.id" />
|
|
|
</el-select>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
<el-form-item label="时间" prop="carNum">
|
|
|
- <el-date-picker v-model="value2" type="datetimerange" :shortcuts="shortcuts"
|
|
|
+ <el-date-picker v-model="dataValue2" type="daterange" :shortcuts="shortcuts"
|
|
|
range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -83,11 +79,7 @@
|
|
|
</div>
|
|
|
</transition>
|
|
|
<el-card shadow="never">
|
|
|
-
|
|
|
<tableElm @childToParent='childrenClick' :columns="columns2" ref="table2"></tableElm>
|
|
|
-
|
|
|
- <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
|
|
- v-model:limit="queryParams.pageSize" @pagination="getList" />
|
|
|
</el-card>
|
|
|
</div>
|
|
|
</el-tab-pane>
|
|
|
@@ -99,8 +91,10 @@
|
|
|
import { listCarInfo, getCarInfo, delCarInfo, addCarInfo, updateCarInfo } from '@/api/carInfo';
|
|
|
import { CarInfoVO, CarInfoQuery, CarInfoForm } from '@/api/carInfo/types';
|
|
|
import { listCarPath, getCarPath, delCarPath, addCarPath, updateCarPath } from '@/api/carPath';
|
|
|
+import { getCountData } from '@/api/gpsData';
|
|
|
import tableElm from "@/components/Public/table.vue";
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
+import moment from 'moment';
|
|
|
|
|
|
const route = useRoute();
|
|
|
const router = useRouter();
|
|
|
@@ -121,6 +115,15 @@ const carPathList = ref([])
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
const carInfoFormRef = ref<ElFormInstance>();
|
|
|
|
|
|
+const dataValue = ref<[Date, Date]>([
|
|
|
+ new Date(new Date().getTime() - 3600 * 24 * 1000),
|
|
|
+ new Date(),
|
|
|
+])
|
|
|
+
|
|
|
+const dataValue2 = ref<[Date, Date]>([
|
|
|
+ new Date(new Date().getTime() - 3600 * 24 * 1000),
|
|
|
+ new Date(),
|
|
|
+])
|
|
|
|
|
|
const dialog = reactive<DialogOption>({
|
|
|
visible: false,
|
|
|
@@ -131,6 +134,8 @@ const table = ref(tableElm)
|
|
|
const table1 = ref(tableElm)
|
|
|
const table2 = ref(tableElm)
|
|
|
const activeName = ref("first")
|
|
|
+const carFlowList = ref([])
|
|
|
+const lineFlowList = ref([])
|
|
|
|
|
|
const columns = ref([
|
|
|
// {label: '上层位置', prop: 'v', visible: true},
|
|
|
@@ -235,12 +240,21 @@ const data = reactive<PageData<CarInfoForm, CarInfoQuery>>({
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+const paramData = ref({
|
|
|
+ starttime: '',
|
|
|
+ endtime: ''
|
|
|
+})
|
|
|
+
|
|
|
const { queryParams, form, rules } = toRefs(data);
|
|
|
|
|
|
const goadd = () => {
|
|
|
router.push("/car/work/addWork")
|
|
|
}
|
|
|
|
|
|
+const searchData = () => {
|
|
|
+ console.log(dataValue.value)
|
|
|
+}
|
|
|
+
|
|
|
/** 查询车辆信息列表 */
|
|
|
const getList = async () => {
|
|
|
// loading.value = true;
|
|
|
@@ -389,10 +403,69 @@ const initData = async () => {
|
|
|
const res = await listCarPath({ pageSize: 1000 });
|
|
|
carPathList.value = res.rows
|
|
|
const res2 = await listCarInfo({ pageSize: 1000 });
|
|
|
- carInfoList.value = res.rows
|
|
|
+ carInfoList.value = res2.rows
|
|
|
+ carFlowList.value = [];
|
|
|
+ for (var index in carInfoList.value) {
|
|
|
+ if (carInfoList.value[index].deviceInfos != null) {
|
|
|
+ var deviceCode = JSON.parse(carInfoList.value[index].deviceInfos).code
|
|
|
+ await getFlowData(deviceCode,carInfoList.value[index].carNum)
|
|
|
+ }
|
|
|
+ //getFlowData();
|
|
|
+ }
|
|
|
+ table1.value.setButton([]);
|
|
|
+ // console.log(carFlowList.value)
|
|
|
+ table1.value.setDataList(carFlowList.value);
|
|
|
+}
|
|
|
+
|
|
|
+const searchCar = async() =>{
|
|
|
+ carFlowList.value = [];
|
|
|
+ for (var index in carInfoList.value) {
|
|
|
+ if (carInfoList.value[index].deviceInfos != null) {
|
|
|
+ var deviceCode = JSON.parse(carInfoList.value[index].deviceInfos).code
|
|
|
+ await getFlowData(deviceCode,carInfoList.value[index].carNum)
|
|
|
+ }
|
|
|
+ //getFlowData();
|
|
|
+ }
|
|
|
+ table1.value.setButton([]);
|
|
|
+ // console.log(carFlowList.value)
|
|
|
+ table1.value.setDataList(carFlowList.value);
|
|
|
+}
|
|
|
+
|
|
|
+const getFlowData = (carCode,carNum) => {
|
|
|
+ var obj = {
|
|
|
+ starttime: moment(dataValue.value[0]).format('YYYY-MM-DD'),
|
|
|
+ endtime: moment(dataValue.value[1]).format('YYYY-MM-DD')
|
|
|
+ }
|
|
|
+ getCountData({ devicecode: carCode, params: obj }).then(res => {
|
|
|
+ var data = {
|
|
|
+ carNum: carNum,
|
|
|
+ startTime: moment(dataValue.value[0]).format('YYYY-MM-DD'),
|
|
|
+ endTime: moment(dataValue.value[1]).format('YYYY-MM-DD'),
|
|
|
+ upCount: res.data.totalin,
|
|
|
+ downCount: res.data.totalout
|
|
|
+ }
|
|
|
+ carFlowList.value.push(data);
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const getStationData = (carCode,siteName) => {
|
|
|
+ var obj = {
|
|
|
+ starttime: moment(dataValue.value[0]).format('YYYY-MM-DD'),
|
|
|
+ endtime: moment(dataValue.value[1]).format('YYYY-MM-DD')
|
|
|
+ }
|
|
|
+ getCountData({ devicecode: carCode, params: obj }).then(res => {
|
|
|
+ var data = {
|
|
|
+ siteName: siteName,
|
|
|
+ startTime: moment(dataValue.value[0]).format('YYYY-MM-DD'),
|
|
|
+ endTime: moment(dataValue.value[1]).format('YYYY-MM-DD'),
|
|
|
+ upCount: res.data.totalin,
|
|
|
+ downCount: res.data.totalout
|
|
|
+ }
|
|
|
+ carFlowList.value.push(data);
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
- getList();
|
|
|
+ initData();
|
|
|
});
|
|
|
</script>
|