|
|
|
|
@ -7,10 +7,6 @@
|
|
|
|
|
</view>
|
|
|
|
|
<view class="header-content">
|
|
|
|
|
<text class="header-title">关键件详情</text>
|
|
|
|
|
<text class="header-code">{{ keypartData.code }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="status-badge" :class="'status-' + keypartData.statusType">
|
|
|
|
|
<text>{{ keypartData.status }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
@ -19,58 +15,24 @@
|
|
|
|
|
<view class="card-title">基本信息</view>
|
|
|
|
|
<view class="info-list">
|
|
|
|
|
<view class="info-row">
|
|
|
|
|
<text class="info-label">关键件名称</text>
|
|
|
|
|
<text class="info-value">{{ keypartData.name }}</text>
|
|
|
|
|
<text class="info-label">编码</text>
|
|
|
|
|
<text class="info-value">{{ detailValue(detailData?.code) }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="info-row">
|
|
|
|
|
<text class="info-label">关键件类型</text>
|
|
|
|
|
<text class="info-value">{{ keypartData.type }}</text>
|
|
|
|
|
<text class="info-label">名称</text>
|
|
|
|
|
<text class="info-value">{{ detailValue(detailData?.name) }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="info-row">
|
|
|
|
|
<text class="info-label">规格型号</text>
|
|
|
|
|
<text class="info-value">{{ keypartData.spec }}</text>
|
|
|
|
|
<text class="info-label">描述</text>
|
|
|
|
|
<text class="info-value">{{ detailValue(detailData?.description) }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="info-row">
|
|
|
|
|
<text class="info-label">所属设备</text>
|
|
|
|
|
<text class="info-value">{{ keypartData.equipment }}</text>
|
|
|
|
|
<text class="info-label">数量</text>
|
|
|
|
|
<text class="info-value">{{ detailValue(detailData?.count) }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="info-row">
|
|
|
|
|
<text class="info-label">安装位置</text>
|
|
|
|
|
<text class="info-value">{{ keypartData.location }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="info-card">
|
|
|
|
|
<view class="card-title">维护信息</view>
|
|
|
|
|
<view class="info-list">
|
|
|
|
|
<view class="info-row">
|
|
|
|
|
<text class="info-label">更换周期</text>
|
|
|
|
|
<text class="info-value highlight">{{ keypartData.replaceCycle }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="info-row">
|
|
|
|
|
<text class="info-label">上次更换</text>
|
|
|
|
|
<text class="info-value">{{ keypartData.lastReplace }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="info-row">
|
|
|
|
|
<text class="info-label">下次更换</text>
|
|
|
|
|
<text class="info-value warning">{{ keypartData.nextReplace }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="info-card">
|
|
|
|
|
<view class="card-title">维护记录</view>
|
|
|
|
|
<view class="record-list">
|
|
|
|
|
<view v-for="(record, index) in maintenanceRecords" :key="index" class="record-item">
|
|
|
|
|
<view class="record-dot"></view>
|
|
|
|
|
<view class="record-content">
|
|
|
|
|
<text class="record-title">{{ record.title }}</text>
|
|
|
|
|
<text class="record-time">{{ record.time }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="record-type" :class="'type-' + record.type">
|
|
|
|
|
<text>{{ record.typeText }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<text class="info-label">备注</text>
|
|
|
|
|
<text class="info-value">{{ detailValue(detailData?.remark) }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
@ -79,41 +41,53 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { reactive, onMounted } from 'vue';
|
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
import { onLoad } from '@dcloudio/uni-app'
|
|
|
|
|
import request from '@/utils/request'
|
|
|
|
|
|
|
|
|
|
const keypartData = reactive({
|
|
|
|
|
code: '',
|
|
|
|
|
name: '主轴轴承',
|
|
|
|
|
type: '旋转部件',
|
|
|
|
|
spec: 'NSK-7014CTYNSULP4',
|
|
|
|
|
equipment: '数控加工中心-VMC850',
|
|
|
|
|
location: '主轴箱内部',
|
|
|
|
|
status: '正常',
|
|
|
|
|
statusType: 'normal',
|
|
|
|
|
replaceCycle: '2000小时',
|
|
|
|
|
lastReplace: '2024-01-15',
|
|
|
|
|
nextReplace: '2024-04-15'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const maintenanceRecords = reactive([
|
|
|
|
|
{ title: '定期更换', time: '2024-01-15', type: 'replace', typeText: '更换' },
|
|
|
|
|
{ title: '状态检查', time: '2024-02-15', type: 'check', typeText: '检查' },
|
|
|
|
|
{ title: '润滑保养', time: '2024-02-01', type: 'maintain', typeText: '保养' },
|
|
|
|
|
{ title: '定期更换', time: '2023-07-15', type: 'replace', typeText: '更换' }
|
|
|
|
|
]);
|
|
|
|
|
const keypartId = ref(undefined)
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
const detailData = ref(null)
|
|
|
|
|
|
|
|
|
|
function goBack() {
|
|
|
|
|
uni.navigateBack();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
const pages = getCurrentPages();
|
|
|
|
|
const currentPage = pages[pages.length - 1];
|
|
|
|
|
const options = currentPage.options || {};
|
|
|
|
|
if (options.code) {
|
|
|
|
|
keypartData.code = decodeURIComponent(options.code);
|
|
|
|
|
onLoad((query) => {
|
|
|
|
|
const rawId = query && (query.id !== undefined ? query.id : query.code)
|
|
|
|
|
const decoded = rawId ? decodeURIComponent(String(rawId)) : ''
|
|
|
|
|
keypartId.value = decoded ? decoded : undefined
|
|
|
|
|
fetchDetail()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
async function fetchDetail() {
|
|
|
|
|
if (!keypartId.value) {
|
|
|
|
|
uni.showToast({ title: '缺少关键件ID', icon: 'none' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const res = await request({
|
|
|
|
|
url: '/admin-api/mes/critical-component/get',
|
|
|
|
|
method: 'get',
|
|
|
|
|
params: { id: keypartId.value }
|
|
|
|
|
})
|
|
|
|
|
detailData.value = res && res.data !== undefined ? res.data : res
|
|
|
|
|
} catch (e) {
|
|
|
|
|
uni.showToast({ title: '加载失败', icon: 'none' })
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function detailValue(v) {
|
|
|
|
|
if (v === 0) return '0'
|
|
|
|
|
if (v === false) return '否'
|
|
|
|
|
if (v === true) return '是'
|
|
|
|
|
if (v === null || v === undefined) return '-'
|
|
|
|
|
const s = String(v).trim()
|
|
|
|
|
return s ? s : '-'
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
@ -165,33 +139,9 @@ onMounted(() => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status-badge {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 60rpx;
|
|
|
|
|
right: 30rpx;
|
|
|
|
|
padding: 12rpx 24rpx;
|
|
|
|
|
border-radius: 24rpx;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status-normal {
|
|
|
|
|
background: rgba(24, 188, 55, 0.2);
|
|
|
|
|
color: #18bc37;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status-warning {
|
|
|
|
|
background: rgba(255, 140, 0, 0.2);
|
|
|
|
|
color: #ff8c00;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status-danger {
|
|
|
|
|
background: rgba(255, 77, 79, 0.2);
|
|
|
|
|
color: #ff4d4f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content-section {
|
|
|
|
|
padding: 0 30rpx 30rpx;
|
|
|
|
|
margin-top: -40rpx;
|
|
|
|
|
margin-top: 40rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.info-card {
|
|
|
|
|
@ -236,77 +186,5 @@ onMounted(() => {
|
|
|
|
|
.info-value {
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #333333;
|
|
|
|
|
|
|
|
|
|
&.highlight {
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: #1a3a5c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.warning {
|
|
|
|
|
color: #ff8c00;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.record-list {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.record-item {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 24rpx 0;
|
|
|
|
|
border-bottom: 1rpx solid #f5f7fa;
|
|
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.record-dot {
|
|
|
|
|
width: 16rpx;
|
|
|
|
|
height: 16rpx;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background: #1a3a5c;
|
|
|
|
|
margin-right: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.record-content {
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
|
|
.record-title {
|
|
|
|
|
display: block;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #333333;
|
|
|
|
|
margin-bottom: 8rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.record-time {
|
|
|
|
|
display: block;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
color: #999999;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.record-type {
|
|
|
|
|
padding: 8rpx 16rpx;
|
|
|
|
|
border-radius: 8rpx;
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.type-replace {
|
|
|
|
|
background: rgba(24, 188, 55, 0.1);
|
|
|
|
|
color: #18bc37;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.type-check {
|
|
|
|
|
background: rgba(74, 144, 194, 0.1);
|
|
|
|
|
color: #4a90c2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.type-maintain {
|
|
|
|
|
background: rgba(255, 140, 0, 0.1);
|
|
|
|
|
color: #ff8c00;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|