|
|
|
|
@ -3,51 +3,51 @@
|
|
|
|
|
<uni-card :is-shadow="false" is-full>
|
|
|
|
|
<uni-row>
|
|
|
|
|
<uni-col :span="10">
|
|
|
|
|
<text class="uni-h6" >计划:
|
|
|
|
|
<el-text class="mx-1" type="primary">{{planDo.code}}</el-text>
|
|
|
|
|
<text class="uni-h6">计划:
|
|
|
|
|
<text class="highlight primary">{{ (planDo && planDo.code) ? planDo.code : '-' }}</text>
|
|
|
|
|
</text>
|
|
|
|
|
</uni-col>
|
|
|
|
|
<uni-col :span="14">
|
|
|
|
|
<text class="uni-h6">产品:
|
|
|
|
|
<el-text class="mx-1" type="warning">{{planDo.productName}}</el-text>
|
|
|
|
|
<text class="highlight warning">{{ (planDo && planDo.productName) ? planDo.productName : '-' }}</text>
|
|
|
|
|
</text>
|
|
|
|
|
</uni-col>
|
|
|
|
|
</uni-row>
|
|
|
|
|
</uni-card>
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<el-table :data="progressList" :stripe="true" :show-overflow-tooltip="true">
|
|
|
|
|
<el-table-column label="工序" align="center" prop="orgType" >
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<text> {{findTextByValue(scope.row.orgType)}}</text>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="数量" align="center" prop="totalQualityNumber" width="80px"/>
|
|
|
|
|
<el-table-column label="进度" align="center">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-progress
|
|
|
|
|
:percentage="Number((scope.row.totalQualityNumber/planDo.planNumber)*100).toFixed(2)"
|
|
|
|
|
:stroke-width="15"
|
|
|
|
|
:color="finishColors"
|
|
|
|
|
:striped="true"
|
|
|
|
|
:striped-flow="true"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="废品" align="center" prop="totalWasteNumber" width="60px"/>
|
|
|
|
|
<el-table-column label="废品率" align="center" >
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<span class="percentage-value">{{Number((scope.row.totalWasteNumber/(scope.row.totalQualityNumber+scope.row.totalWasteNumber))*100 ).toFixed(2)}}%</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
<view class="progress-table">
|
|
|
|
|
<view class="progress-row progress-header">
|
|
|
|
|
<text class="col col-process">工序</text>
|
|
|
|
|
<text class="col col-num">数量</text>
|
|
|
|
|
<text class="col col-progress">进度</text>
|
|
|
|
|
<text class="col col-waste">废品</text>
|
|
|
|
|
<text class="col col-rate">废品率</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-for="(row, index) in progressList" :key="index" class="progress-row">
|
|
|
|
|
<text class="col col-process">{{ findTextByValue(row.orgType) || '-' }}</text>
|
|
|
|
|
<text class="col col-num">{{ (row && row.totalQualityNumber !== null && row.totalQualityNumber !== undefined) ? row.totalQualityNumber : 0 }}</text>
|
|
|
|
|
<view class="col col-progress">
|
|
|
|
|
<progress
|
|
|
|
|
:percent="calcQualityPercent(row)"
|
|
|
|
|
:stroke-width="12"
|
|
|
|
|
activeColor="#18b566"
|
|
|
|
|
backgroundColor="#e5e5e5"
|
|
|
|
|
/>
|
|
|
|
|
<text class="progress-text">{{ calcQualityPercent(row).toFixed(2) }}%</text>
|
|
|
|
|
</view>
|
|
|
|
|
<text class="col col-waste">{{ (row && row.totalWasteNumber !== null && row.totalWasteNumber !== undefined) ? row.totalWasteNumber : 0 }}</text>
|
|
|
|
|
<text class="col col-rate">{{ calcWastePercent(row).toFixed(2) }}%</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="!progressList || progressList.length === 0" class="empty">
|
|
|
|
|
<text class="empty-text">暂无数据</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
import {processTypes,findTextByValue} from "@/api/system/dict/data";
|
|
|
|
|
import {getPlanProgress,getById} from "@/api/mes/plan"
|
|
|
|
|
import {getPlanProgress} from "@/api/mes/plan"
|
|
|
|
|
|
|
|
|
|
import tab from "@/plugins/tab";
|
|
|
|
|
import modal from "@/plugins/modal";
|
|
|
|
|
@ -72,18 +72,127 @@ export default {
|
|
|
|
|
findTextByValue(value) {
|
|
|
|
|
return findTextByValue(this.processTypes, value)
|
|
|
|
|
},
|
|
|
|
|
calcQualityPercent(row) {
|
|
|
|
|
const planNumber = Number(this.planDo && this.planDo.planNumber ? this.planDo.planNumber : 0)
|
|
|
|
|
const totalQualityNumber = Number(row && row.totalQualityNumber ? row.totalQualityNumber : 0)
|
|
|
|
|
if (!Number.isFinite(planNumber) || planNumber <= 0) return 0
|
|
|
|
|
const raw = (totalQualityNumber / planNumber) * 100
|
|
|
|
|
const safe = Number.isFinite(raw) ? raw : 0
|
|
|
|
|
return Math.max(0, Math.min(100, Number(safe.toFixed(2))))
|
|
|
|
|
},
|
|
|
|
|
calcWastePercent(row) {
|
|
|
|
|
const waste = Number(row && row.totalWasteNumber ? row.totalWasteNumber : 0)
|
|
|
|
|
const quality = Number(row && row.totalQualityNumber ? row.totalQualityNumber : 0)
|
|
|
|
|
const denom = waste + quality
|
|
|
|
|
if (!Number.isFinite(denom) || denom <= 0) return 0
|
|
|
|
|
const raw = (waste / denom) * 100
|
|
|
|
|
const safe = Number.isFinite(raw) ? raw : 0
|
|
|
|
|
return Math.max(0, Math.min(100, Number(safe.toFixed(2))))
|
|
|
|
|
},
|
|
|
|
|
getProgressList() {
|
|
|
|
|
modal.loading("正在加载...")
|
|
|
|
|
if(this.planDo)
|
|
|
|
|
getPlanProgress(this.planDo.id).then(response => {
|
|
|
|
|
this.progressList = response.data;
|
|
|
|
|
})
|
|
|
|
|
modal.closeLoading()
|
|
|
|
|
if (!this.planDo || !this.planDo.id) {
|
|
|
|
|
modal.closeLoading()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
getPlanProgress(this.planDo.id)
|
|
|
|
|
.then(response => {
|
|
|
|
|
this.progressList = (response && response.data) ? response.data : []
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
this.progressList = []
|
|
|
|
|
modal.msgError("获取进度失败")
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
modal.closeLoading()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.container {
|
|
|
|
|
padding: 24rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.highlight {
|
|
|
|
|
margin-left: 8rpx;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.primary {
|
|
|
|
|
color: #1a73e8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.warning {
|
|
|
|
|
color: #f59e0b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.progress-table {
|
|
|
|
|
background: #ffffff;
|
|
|
|
|
border-radius: 16rpx;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.progress-row {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 20rpx 16rpx;
|
|
|
|
|
border-bottom: 1px solid #f2f2f2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.progress-header {
|
|
|
|
|
background: #0f172a;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.progress-header .col {
|
|
|
|
|
color: #e5e7eb;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.col {
|
|
|
|
|
color: #111827;
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.col-process {
|
|
|
|
|
width: 160rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.col-num {
|
|
|
|
|
width: 90rpx;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.col-progress {
|
|
|
|
|
flex: 1;
|
|
|
|
|
padding: 0 12rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.progress-text {
|
|
|
|
|
margin-top: 8rpx;
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
color: #6b7280;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.col-waste {
|
|
|
|
|
width: 90rpx;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.col-rate {
|
|
|
|
|
width: 120rpx;
|
|
|
|
|
text-align: right;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.empty {
|
|
|
|
|
padding: 40rpx 16rpx;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.empty-text {
|
|
|
|
|
color: #6b7280;
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|