设备报废记录

This commit is contained in:
xusd 2024-06-17 16:21:54 +08:00
parent 7d25de02db
commit 15a4ddd35c
3 changed files with 383 additions and 9 deletions

View File

@ -0,0 +1,16 @@
import request from "@/utils/request";
export function listEquipCancel(query) {
return request({
url: "/scrap/record/list",
method: "get",
params: query,
});
}
export function getEquipCancelById(id) {
return request({
url: "/scrap/record/" + id,
method: "get",
});
}

View File

@ -1,22 +1,170 @@
<template>
<view>
<view class="detail-container">
<uni-section title="保养基本信息" type="line">
<view style="background: white;padding: 0px 20px 20px 20px;">
<u--form labelPosition="left" :model="equipCanceInfo" label-width="100px">
<u-form-item label="报废单号:" prop="" borderBottom>
{{equipCanceInfo.scrappingRecordNum}}
</u-form-item>
<u-form-item label="报废设备:" prop="" borderBottom>
{{equipCanceInfo.equipName}}
</u-form-item>
<u-form-item label="报废时间:" prop="" borderBottom>
{{equipCanceInfo.scrappingTime}}
</u-form-item>
<u-form-item label="报废记录人:" prop="" borderBottom>
{{equipCanceInfo.creatorName}}
</u-form-item>
<u-form-item label="报废处理人:" prop="" borderBottom>
{{equipCanceInfo.handlerName}}
</u-form-item>
<u-form-item label="报废原因:" prop="" borderBottom>
{{equipCanceInfo.scrappingReason}}
</u-form-item>
<u-form-item label="报废处理方式:" prop="" borderBottom>
{{equipCanceInfo.scrappingTreatment}}
</u-form-item>
<u-form-item label="备注:" prop="" borderBottom>
{{equipCanceInfo.remark}}
</u-form-item>
<u-form-item label="照片:" prop="" borderBottom>
<u--image :showLoading="true" :src="equipCanceInfo.equipPicPath" width="80px" height="80px"
@click="lookImage(equipCanceInfo.equipPicPath)"></u--image>
</u-form-item>
</u--form>
</view>
</uni-section>
</view>
</template>
<script>
import {
getEquipCancelById
} from "@/api/equipCancel/equipCancel.js"
import config from '@/config'
const baseUrl = config.baseUrl
export default {
data() {
return {
id: null,
equipCanceInfo:{},
}
},
onLoad(opts) {
this.id = opts.id;
},
created() {
this.getEquipCanceInfo();
},
methods: {
lookImage(url) {
//
let urls = [];
urls.push(url)
uni.previewImage({
urls: urls
});
},
getEquipCanceInfo() {
getEquipCancelById(this.id).then((res) => {
this.equipCanceInfo = res.data
let equipPicPath = this.equipCanceInfo.equipPicPath;
if (equipPicPath != null && equipPicPath != '') {
this.equipCanceInfo.equipPicPath = baseUrl + equipPicPath;
}
})
}
}
}
</script>
<style>
/* #ifndef APP-NVUE */
page {
display: flex;
flex-direction: column;
box-sizing: border-box;
background-color: #fff;
min-height: 100%;
height: auto;
}
view {
font-size: 14px;
line-height: inherit;
}
/* #endif */
.text {
text-align: center;
font-size: 26rpx;
margin-top: 10rpx;
}
.grid-item-box {
flex: 1;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
align-items: center;
justify-content: center;
padding: 15px 0;
}
.uni-margin-wrap {
width: 690rpx;
width: 100%;
;
}
.swiper {
height: 300rpx;
}
.swiper-box {
height: 150px;
}
.swiper-item {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
color: #fff;
height: 300rpx;
line-height: 300rpx;
}
@media screen and (min-width: 500px) {
.uni-swiper-dot-box {
width: 400px;
/* #ifndef APP-NVUE */
margin: 0 auto;
/* #endif */
margin-top: 8px;
}
.image {
width: 100%;
}
}
.detail-container {
padding: 12px;
background: #f1f1f1;
//
.worker-button {
float: right;
/* margin-right: 24px; */
margin-top: 10px;
}
}
</style>

View File

@ -1,22 +1,232 @@
<template>
<view>
<view class="card-group">
<u-popup :show="showEquip" mode="bottom" :closeable="closeableEquip" @open="openPopupEquip"
@close="closePopupEquip">
<ly-tree :tree-data="treeData" :ready="ready" node-key="id" :props="props"
:expandOnClickNode="expandOnClickNode" @node-click="handleNodeClick"></ly-tree>
</u-popup>
<u-button :disabled="isJump" @click="showEquip = true">{{equipName}}</u-button>
<view class="card-group" v-if="total === 0">
<leruge-empty text="暂无数据" type="minus"></leruge-empty>
</view>
<view class="cu-card dynamic" v-if="total != 0" v-for="(item,index) in equipCancelList" :key="index">
<view class="cu-item shadow" @click="goItem(item)">
<view class="cu-list menu-avatar">
<view class="cu-item">
<view class="content flex-sub card-title">
<view>{{item.equipName}}</view>
<button class="label-btn" size="mini"
:style="{'background': item.bgColor,'color':item.color}">{{item.nameStatus}}</button>
</view>
</view>
</view>
<view class="content-container">
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">报废单号: {{item.scrappingRecordNum}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">报废时间: {{item.scrappingTime}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">报废原因: {{item.scrappingReason}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">报废处理方式: {{item.scrappingTreatment}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">报废记录人: {{item.creatorName}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">报废处理人: {{item.handlerName}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">备注: {{item.remark}}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
getEquipTree
} from "@/api/equip/equip.js"
import {
listEquipCancel
} from "@/api/equipCancel/equipCancel.js"
export default {
data() {
return {
equipCancelList: [],
isJump: false,
equipId: null,
equipName: "选择设备",
//
showEquip: false,
//
closeableEquip: true,
ready: false,
expandOnClickNode: false,
//
treeData: [],
//
finished: false,
total: 0,
tipText: "正在加载...",
props: function() {
return {
label: 'equipName',
children: 'childList'
}
},
queryParams: {
pageNum: 1,
pageSize: 10
},
}
},
onLoad(opts) {
if (opts.equipId != null && opts.equipId != '') {
this.equipId = opts.equipId;
this.equipName = opts.equipName;
this.isJump = true;
}
},
onShow() {
this.equipCancelList = [];
this.queryParams = {
pageNum: 1,
pageSize: 10
};
this.getEquipCancelList();
},
onReachBottom() {
const allTotal = this.queryParams.pageNum * this.queryParams.pageSize;
if (allTotal < this.total) {
this.queryParams.pageNum += 1;
this.getEquipCancelList();
} else {
this.finished = true;
this.tipText = "已加载完成";
}
},
methods: {
goItem(item) {
this.$tab.navigateTo("/pages/work/equipCancel/detailsEquipCancel?id=" + item.id);
},
getEquipCancelList() {
this.finished = true;
this.queryParams.equipId = this.equipId;
listEquipCancel(this.queryParams).then((res) => {
this.finished = false;
this.equipCancelList = this.equipCancelList.concat(res.rows);
this.total = res.total;
this.equipCancelList.forEach((item) => {
item.color = "#FFF";
item.bgColor = "#909399";
item.nameStatus = "已报废"
})
})
},
openPopupEquip() {
this.getEquipList();
},
closePopupEquip() {
this.showEquip = false;
},
getEquipList() {
this.ready = false;
this.treeData = [{
"id": null,
"equipName": "所有设备"
}];
getEquipTree().then((res) => {
this.treeData = this.treeData.concat(res);
this.ready = true;
})
},
handleNodeClick(obj) {
this.equipName = obj.label;
this.equipId = obj.key;
this.showEquip = false;
this.equipCancelList = [];
this.getEquipCancelList();
},
}
}
</script>
<style>
/* 卡片的样式 start */
.card-group .cu-card .cu-item {
box-shadow: rgba(0, 0, 0, 0.08) 0px 0px 3px 1px;
}
.card-group .card-title {
left: 20px !important;
color: #333;
font-weight: 600;
display: flex;
justify-content: space-between;
width: calc(100% - 20px) !important;
}
.card-group .card-title .label-btn {
margin: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-top-left-radius: 16px;
border-bottom-left-radius: 16px;
letter-spacing: 1px;
}
.card-group .cu-list.menu-avatar>.cu-item {
height: 50px;
}
.card-group .cu-list.menu-avatar>.cu-item:after {
border-bottom: none !important;
}
.card-group .content-container {
padding-left: 20px;
color: #909399;
margin-bottom: 6px;
}
.card-group .content-container .text-content .iconfont {
font-size: 16px;
margin-right: 4px;
}
.card-group .content-container .text-content .text-description {
font-size: 14px;
}
.card-group .text-bottom {
margin: 0 20px;
border-top: 1px dotted #aaa;
padding: 6px 0;
}
/* 卡片的样式 end */
/* 下拉加载提示字的样式 end */
.loading-tip {
font-size: 12px;
color: #666;
padding-bottom: 12px;
text-align: center;
}
</style>