数据报表添加排序

jc
fanluyan 11 months ago
parent 04dda6ab1b
commit 21fc05bb1d

@ -105,6 +105,7 @@
style="width: 100%" style="width: 100%"
:height="tableheight" :height="tableheight"
fit fit
:default-sort="{ order: 'descending' }"
> >
<template slot="empty"> <template slot="empty">
<el-empty :image-size="160" description="暂无数据"></el-empty> <el-empty :image-size="160" description="暂无数据"></el-empty>
@ -115,14 +116,21 @@
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column prop="id" label="ID" width="80px"> </el-table-column> --> <!-- <el-table-column prop="id" label="ID" width="80px"> </el-table-column> -->
<el-table-column prop="dyName" label="电压等级"> </el-table-column> <el-table-column prop="dyName" label="电压等级" sortable>
<el-table-column prop="lineName" label="线路名称" show-overflow-tooltip> </el-table-column>
<el-table-column
prop="lineName"
label="线路名称"
show-overflow-tooltip
sortable
>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="towerName" prop="towerName"
label="杆塔名称" label="杆塔名称"
min-width="180" min-width="180"
show-overflow-tooltip show-overflow-tooltip
sortable
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -130,6 +138,7 @@
label="装置id" label="装置id"
min-width="140" min-width="140"
show-overflow-tooltip show-overflow-tooltip
sortable
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
@ -140,13 +149,19 @@
></template ></template
> >
</el-table-column> </el-table-column>
<el-table-column prop="protocolName" label="规约" show-overflow-tooltip> <el-table-column
prop="protocolName"
label="规约"
show-overflow-tooltip
sortable
>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="lastHeartbeat" prop="lastHeartbeat"
label="最后心跳时间" label="最后心跳时间"
min-width="130" min-width="130"
show-overflow-tooltip show-overflow-tooltip
sortable
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
@ -168,6 +183,7 @@
label="当天第一张照片时间" label="当天第一张照片时间"
min-width="130" min-width="130"
show-overflow-tooltip show-overflow-tooltip
sortable
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.photoInfo.firstPhotoTime }} {{ scope.row.photoInfo.firstPhotoTime }}
@ -178,30 +194,39 @@
label="照片最后接收时间" label="照片最后接收时间"
min-width="130" min-width="130"
show-overflow-tooltip show-overflow-tooltip
sortable
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.photoInfo.lastRecvTime }} {{ scope.row.photoInfo.lastRecvTime }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="rebootCount" label="重启次数"> </el-table-column> <el-table-column prop="rebootCount" label="重启次数" sortable>
</el-table-column>
<el-table-column <el-table-column
prop="workingStatus.bootTime" prop="workingStatus.bootTime"
label="最后重启时间" label="最后重启时间"
min-width="130" min-width="130"
show-overflow-tooltip show-overflow-tooltip
sortable
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ {{ formatLastHeartbeat(scope.row.workingStatus.bootTime) }}
<!-- {{
scope.row.workingStatus.bootTime == null || scope.row.workingStatus.bootTime == null ||
scope.row.workingStatus.bootTime == 0 scope.row.workingStatus.bootTime == 0
? "" ? ""
: $moment(scope.row.workingStatus.bootTime * 1000).format( : $moment(scope.row.workingStatus.bootTime * 1000).format(
"YYYY-MM-DD HH:mm:ss" "YYYY-MM-DD HH:mm:ss"
) )
}} }} -->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="photoCount" label="照片数量"> <el-table-column
prop="photoCount"
label="照片数量"
sortable
:sort-method="picSort"
>
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.photoInfo.photoCount }} {{ scope.row.photoInfo.photoCount }}
</template> </template>
@ -213,6 +238,7 @@
@size-change="handleSizeChange" @size-change="handleSizeChange"
:current-page="page" :current-page="page"
:page-size="pageSize" :page-size="pageSize"
:page-sizes="[20, 50, 100, 500, 1000]"
layout="sizes, prev, pager, next, jumper,total" layout="sizes, prev, pager, next, jumper,total"
:total="total" :total="total"
background background
@ -286,6 +312,22 @@ export default {
}, },
watch: {}, watch: {},
methods: { methods: {
//pic
picSort(a, b) {
// a b mntnStatus.reportMap
const aPic = (a.photoInfo.photoCount && a.photoInfo.photoCount) || 0;
const bPic = (b.photoInfo.photoCount && b.photoInfo.photoCount) || 0;
// pic
const numA = Number(aPic);
const numB = Number(bPic);
//
//
return numA - numB;
// numB - numA
},
formatLastHeartbeat(timestamp) {
return this.$moment(timestamp * 1000).format("YYYY-MM-DD HH:mm:ss");
},
// //
getSearchdy() { getSearchdy() {
getSearchInfo({ type: 1 }) getSearchInfo({ type: 1 })

@ -23,8 +23,8 @@ module.exports = defineConfig({
//表示拦截以/api开头的请求路径 //表示拦截以/api开头的请求路径
//target: "http://192.168.1.190:8080", //190 需要去掉/Api //target: "http://192.168.1.190:8080", //190 需要去掉/Api
target: "http://61.169.135.146:9911/", //运维 覆冰 //target: "http://61.169.135.146:9911/", //运维 覆冰
//target: "http://61.169.135.146:40080/", //dell target: "http://61.169.135.146:40080/", //dell
//target: "http://192.168.50.198:8093", //java本机 //target: "http://192.168.50.198:8093", //java本机
changOrigin: true, //是否开启跨域 changOrigin: true, //是否开启跨域
pathRewrite: { pathRewrite: {

Loading…
Cancel
Save