feat(odf-cable-faults): Add mileage correction calculation to fault display
- Add calcDisplayMileage function to automatically apply mileage correction to displayed fault mileage - Update fault list display in uniapp to show corrected mileage value - Update fault list table in Vue admin to show corrected mileage using template slot - Add CalcDisplayMileage method in OdfCableFaultsController for export functionality - Ensure consistent mileage calculation across mobile, web, and export features
This commit is contained in:
parent
3a98d5cc11
commit
793c1dd691
|
|
@ -38,7 +38,7 @@
|
|||
</view>
|
||||
<view class="fault-row">
|
||||
<text class="fault-label">表显故障里程:</text>
|
||||
<text class="fault-value">{{ item.mileage }}</text>
|
||||
<text class="fault-value">{{ calcDisplayMileage(item.mileage, item.mileageCorrection) }}</text>
|
||||
</view>
|
||||
<view class="fault-row last-row">
|
||||
<text class="fault-label">所属光缆:</text>
|
||||
|
|
@ -71,6 +71,15 @@ const pageSize = ref(20)
|
|||
const totalPage = ref(1)
|
||||
const loading = ref(false)
|
||||
|
||||
function calcDisplayMileage(mileage, mileageCorrection) {
|
||||
const m = parseFloat(mileage)
|
||||
const c = parseFloat(mileageCorrection)
|
||||
if (!isNaN(m) && !isNaN(c)) {
|
||||
return String(Math.round((m + c) * 10000) / 10000)
|
||||
}
|
||||
return mileage || ''
|
||||
}
|
||||
|
||||
async function loadFaultList(isLoadMore = false) {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ namespace ZR.Admin.WebApi.Controllers.Business
|
|||
["故障发生频次"] = item.FaultCount,
|
||||
["人员"] = item.Personnel,
|
||||
["故障原因"] = item.FaultReason,
|
||||
["表显故障里程"] = item.Mileage,
|
||||
["表显故障里程"] = CalcDisplayMileage(item.Mileage, item.MileageCorrection),
|
||||
["表显里程矫正"] = item.MileageCorrection,
|
||||
["地点"] = item.Location,
|
||||
["纬度"] = item.Latitude,
|
||||
|
|
@ -199,5 +199,16 @@ namespace ZR.Admin.WebApi.Controllers.Business
|
|||
var result = DownloadImportTemplate(new List<OdfCableFaultImportDto>() { }, "OdfCableFaults");
|
||||
return ExportExcel(result.Item2, result.Item1);
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算表显故障里程(自动加上表显里程矫正)
|
||||
/// </summary>
|
||||
private static string CalcDisplayMileage(string mileage, string mileageCorrection)
|
||||
{
|
||||
if (decimal.TryParse(mileage, out var m) && decimal.TryParse(mileageCorrection, out var c))
|
||||
{
|
||||
return (m + c).ToString();
|
||||
}
|
||||
return mileage ?? "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,11 @@
|
|||
<el-table-column prop="faultTime" label="故障时间" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('faultTime')" />
|
||||
<el-table-column prop="personnel" label="人员" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('personnel')" />
|
||||
<el-table-column prop="faultReason" label="故障原因" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('faultReason')" />
|
||||
<el-table-column prop="mileage" label="表显故障里程" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('mileage')" />
|
||||
<el-table-column label="表显故障里程" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('mileage')">
|
||||
<template #default="scope">
|
||||
{{ calcDisplayMileage(scope.row.mileage, scope.row.mileageCorrection) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="mileageCorrection" label="表显里程矫正" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('mileageCorrection')" />
|
||||
<el-table-column prop="cableName" label="所属光缆" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('cableName')" />
|
||||
<el-table-column prop="faultCount" label="故障频次" align="center" v-if="columns.showColumn('faultCount')" />
|
||||
|
|
@ -246,6 +250,16 @@ const detailDisplayMileage = computed(() => {
|
|||
return detailData.value.mileage || ''
|
||||
})
|
||||
|
||||
// 计算表显故障里程(自动加上表显里程矫正)
|
||||
function calcDisplayMileage(mileage, mileageCorrection) {
|
||||
const m = parseFloat(mileage)
|
||||
const c = parseFloat(mileageCorrection)
|
||||
if (!isNaN(m) && !isNaN(c)) {
|
||||
return String(Math.round((m + c) * 10000) / 10000)
|
||||
}
|
||||
return mileage || ''
|
||||
}
|
||||
|
||||
// 远程搜索光缆
|
||||
function remoteCableSearch(query) {
|
||||
if (query) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user