优化添加排序

master
fanluyan 2 years ago
parent 5a0af44875
commit c9278d0b2e

@ -162,12 +162,13 @@
width="80"
v-if="gycheck"
sortable
key="gy"
>
<template slot-scope="scope">
{{ protocolMap[scope.row.protocol] }}
</template>
</el-table-column>
<el-table-column label="电池状态" width="118" v-if="dccheck">
<el-table-column label="电池状态" width="118" key="dc" v-if="dccheck">
<template slot-scope="scope">
{{
scope.row.raw_report.hasOwnProperty("msgs")
@ -177,7 +178,7 @@
</template>
</el-table-column>
<el-table-column label="心跳信息" v-if="xtcheck">
<el-table-column label="心跳信息" v-if="xtcheck" key="xt">
<el-table-column label="次数" min-width="48">
<template slot-scope="scope">
{{
@ -207,7 +208,7 @@
</el-table-column>
</el-table-column>
<el-table-column label="拍照" v-if="pzcheck">
<el-table-column label="拍照" v-if="pzcheck" key="pz">
<el-table-column label="计划/实际" min-width="60">
<template slot-scope="scope">
{{
@ -237,7 +238,7 @@
</el-table-column>
</el-table-column>
<el-table-column label="网络信号" v-if="wlcheck">
<el-table-column label="网络信号" v-if="wlcheck" key="wl">
<el-table-column label="卡1" min-width="60" prop="signature1">
<template slot-scope="scope">
<el-tooltip
@ -275,18 +276,24 @@
}} -->
</template>
</el-table-column>
<el-table-column label="错误" min-width="48">
<el-table-column
label="错误"
min-width="48"
prop="networkError"
sortable
:sort-method="sortNumbersErr"
>
<template slot-scope="scope">
{{
scope.row.raw_report.hasOwnProperty("msgs")
? scope.row.raw_report.msgs.networkError
scope.row.raw_report.msgs.hasOwnProperty("networkError")
? Number(scope.row.raw_report.msgs.networkError)
: ""
}}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="重启次数" v-if="cqcheck">
<el-table-column label="重启次数" v-if="cqcheck" key="cq">
<el-table-column
label="系统"
min-width="48"
@ -302,26 +309,23 @@
}}
</template>
</el-table-column>
<el-table-column label="I1" min-width="48" prop="i1RebootTimes">
<el-table-column
label="I1"
min-width="48"
prop="i1RebootTimes"
sortable
:sort-method="sortNumbers2"
>
<template slot-scope="scope">
{{
scope.row.raw_report.hasOwnProperty("msgs")
? scope.row.raw_report.msgs.i1RebootTimes
scope.row.raw_report.msgs.hasOwnProperty("i1RebootTimes")
? Number(scope.row.raw_report.msgs.i1RebootTimes)
: ""
}}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="CMA服务器" v-if="cmacheck" width="160">
<template slot-scope="scope">
{{
scope.row.raw_report.hasOwnProperty("msgs")
? scope.row.raw_report.msgs.cma
: ""
}}
</template>
</el-table-column>
<el-table-column label="SIM卡" v-if="simcheck" min-width="160">
<el-table-column label="SIM卡" v-if="simcheck" min-width="160" key="sim">
<el-table-column label="卡1" min-width="48" prop="simcard1">
<template slot-scope="scope">
{{
@ -341,11 +345,22 @@
</template>
</el-table-column>
</el-table-column>
<el-table-column label="CMA服务器" v-if="cmacheck" width="160" key="cma">
<template slot-scope="scope">
{{
scope.row.raw_report.hasOwnProperty("msgs")
? scope.row.raw_report.msgs.cma
: ""
}}
</template>
</el-table-column>
<el-table-column
label="版本"
min-width="120"
v-if="bbcheck"
class-name="bbStyle"
v-if="bbcheck"
key="bb"
>
<template
slot-scope="scope"
@ -416,12 +431,13 @@
<el-checkbox v-model="cqcheck" @change="saveLocalStorage"
>重启次数</el-checkbox
>
<el-checkbox v-model="cmacheck" @change="saveLocalStorage"
>CMA服务器</el-checkbox
>
<el-checkbox v-model="simcheck" @change="saveLocalStorage"
>SIM卡</el-checkbox
>
<el-checkbox v-model="cmacheck" @change="saveLocalStorage"
>CMA服务器</el-checkbox
>
<el-checkbox v-model="bbcheck" @change="saveLocalStorage"
>版本</el-checkbox
>
@ -851,6 +867,19 @@ export default {
Number(b.raw_report.msgs.rebootTimes)
);
},
sortNumbers2(a, b) {
return (
Number(a.raw_report.msgs.i1RebootTimes) -
Number(b.raw_report.msgs.i1RebootTimes)
);
},
sortNumbersErr(a, b) {
return (
Number(a.raw_report.msgs.networkError) -
Number(b.raw_report.msgs.networkError)
);
},
// sortSignature1(a, b) {
// return (
// Number(a.raw_report.msgs.signature1.split("/")[0]) -
@ -1281,6 +1310,17 @@ export default {
this.bbcheck = localStorage.getItem("bbcheck")
? JSON.parse(localStorage.getItem("bbcheck"))
: true;
console.log(
"规约:" + this.gycheck,
"电池:" + this.dccheck,
"心跳:" + this.xtcheck,
"拍照:" + this.pzcheck,
"网络信号:" + this.wlcheck,
"重启次数:" + this.cqcheck,
"sim卡" + this.simcheck,
"cma服务器" + this.cmacheck,
"版本:" + this.bbcheck
);
},
},
};

Loading…
Cancel
Save