设备详情跳转以及备件列表和备件详情页面

This commit is contained in:
xusd 2024-06-13 15:26:16 +08:00
parent 84df762ddd
commit d2a7a36c08
5 changed files with 561 additions and 1 deletions

18
api/parts/parts.js Normal file
View File

@ -0,0 +1,18 @@
import request from "@/utils/request";
//备件库存列表
export function getStockList(query) {
return request({
url: "/spareparts/info/stockList",
method: "get",
params: query,
});
}
//备件详情
export function getPartsDetailsByPartsId(partsId) {
return request({
url: "/spareparts/info/" + partsId,
method: "get"
});
}

View File

@ -164,6 +164,20 @@
{ {
"navigationBarTitleText" : "设备图纸" "navigationBarTitleText" : "设备图纸"
} }
},
{
"path" : "pages/work/parts/listParts",
"style" :
{
"navigationBarTitleText" : "备件管理"
}
},
{
"path" : "pages/work/parts/detailsParts",
"style" :
{
"navigationBarTitleText" : "备件详情"
}
}], }],
"tabBar": { "tabBar": {
"color": "#000000", "color": "#000000",

View File

@ -43,7 +43,42 @@
</u--form> </u--form>
</view> </view>
</uni-section> </uni-section>
<uni-section style="margin-top: -20px;" title="设备相关信息" type="line">
<view class="grid-body">
<uni-grid :column="3" :showBorder="false">
<uni-grid-item>
<view class="grid-item-box" @click="clickMaintenance">
<uni-icons type="shop-filled" size="30"></uni-icons>
<text class="text">保养记录</text>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box" @click="clickService">
<uni-icons type="gear-filled" size="30"></uni-icons>
<text class="text">维修记录</text>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box" @click="clickEquipCancel">
<uni-icons type="clear" size="30"></uni-icons>
<text class="text">报废记录</text>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box" @click="clickParts">
<uni-icons type="paperclip" size="30"></uni-icons>
<text class="text">相关备件</text>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box" @click="clickDrawing">
<uni-icons type="images" size="30"></uni-icons>
<text class="text">设备图纸</text>
</view>
</uni-grid-item>
</uni-grid>
</view>
</uni-section>
</view> </view>
</template> </template>
@ -71,11 +106,105 @@
this.equipInfo = res.data; this.equipInfo = res.data;
}) })
}, },
clickDrawing() {
this.$tab.navigateTo("/pages/work/drawing/listDrawing?equipId=" + this.equipId + "&equipName=" + this
.equipInfo.equipName)
},
clickParts() {
this.$tab.navigateTo("/pages/work/parts/listParts?equipId=" + this.equipId + "&equipName=" + this.equipInfo
.equipName)
},
clickMaintenance() {
this.$tab.navigateTo("/pages/work/maintenance/listMaintenance?equipId=" + this.equipId + "&equipName=" +
this.equipInfo.equipName)
},
clickService() {
this.$tab.navigateTo("/pages/work/service/listService?equipId=" + this.equipId + "&equipName=" + this
.equipInfo.equipName)
},
clickEquipCancel() {
this.$tab.navigateTo("/pages/work/equipCancel/listEquipCancel?equipId=" + this.equipId + "&equipName=" +
this.equipInfo.equipName)
},
} }
} }
</script> </script>
<style> <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 { .detail-container {
padding: 12px; padding: 12px;
background: #f1f1f1; background: #f1f1f1;

View File

@ -0,0 +1,164 @@
<template>
<view class="detail-container">
<uni-section title="备件基本信息" type="line">
<view style="background: white;padding: 0px 20px 20px 20px;">
<u--form labelPosition="left" :model="partsInfo" label-width="100px">
<u-form-item label="备件名称:" prop="" borderBottom>
{{partsInfo.partsName}}
</u-form-item>
<u-form-item label="备件编号:" prop="" borderBottom>
{{partsInfo.partsNum}}
</u-form-item>
<u-form-item label="备件规格型号:" prop="" borderBottom>
{{partsInfo.partsSpecifications}}
</u-form-item>
<u-form-item label="供应商:" prop="" borderBottom>
{{partsInfo.supplier}}
</u-form-item>
<u-form-item label="供应商编号:" prop="" borderBottom>
{{partsInfo.supplierCode}}
</u-form-item>
<u-form-item label="备件类型:" prop="" borderBottom>
{{partsInfo.typeName}}
</u-form-item>
<u-form-item label="备件单价:" prop="" borderBottom>
{{partsInfo.price}}
</u-form-item>
<u-form-item label="单位:" prop="" borderBottom>
{{partsInfo.unit}}
</u-form-item>
<u-form-item label="存储位置:" prop="" borderBottom>
{{partsInfo.storageLocation}}
</u-form-item>
<u-form-item label="使用设备:" prop="" borderBottom>
{{partsInfo.equip}}
</u-form-item>
</u--form>
</view>
</uni-section>
</view>
</template>
<script>
import {
getPartsDetailsByPartsId
} from "@/api/parts/parts.js"
export default {
data() {
return {
partsId: null,
partsInfo: {},
}
},
onLoad(opts) {
this.partsId = opts.partsId;
},
created() {
this.getPartInfo();
},
methods: {
getPartInfo(){
getPartsDetailsByPartsId(this.partsId).then((res)=>{
this.partsInfo = res.data;
if(this.partsInfo.type === 1){
this.partsInfo.typeName = "关键备件"
}else if(this.partsInfo.type === 2){
this.partsInfo.typeName = "特殊备件"
}else{
this.partsInfo.typeName = "普通备件"
}
})
}
}
}
</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

@ -0,0 +1,235 @@
<template>
<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 partsList" :key="index">
<view class="cu-item shadow" @click="goItem(item.id)">
<view class="cu-list menu-avatar">
<view class="cu-item">
<view class="content flex-sub card-title">
<view>{{item.partsName}}</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.partsNum}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">备件规格型号: {{item.partsSpecifications}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">库存: {{item.quantity}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">安全库存: {{item.safeQuantity}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">单位: {{item.unit}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">使用设备: {{item.equip}}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
getStockList
} from "@/api/parts/parts.js"
import {
getEquipTree
} from "@/api/equip/equip.js"
export default {
data() {
return {
isJump: false,
equipId: null,
equipName: "选择设备",
//
showEquip: false,
//
closeableEquip: true,
ready: false,
expandOnClickNode: false,
//
treeData: [],
//
finished: false,
total: 0,
tipText: "正在加载...",
partsList: [],
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.partsList = [];
this.queryParams = {
pageNum: 1,
pageSize: 10
};
this.getPartsList();
},
onReachBottom() {
const allTotal = this.queryParams.pageNum * this.queryParams.pageSize;
if (allTotal < this.total) {
this.queryParams.pageNum += 1;
this.getPartsList();
} else {
this.finished = true;
this.tipText = "已加载完成";
}
},
methods: {
goItem(id){
this.$tab.navigateTo("/pages/work/parts/detailsParts?partsId=" + id);
},
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.partsList = [];
this.getPartsList();
},
getPartsList() {
this.finished = true;
this.queryParams.equipId = this.equipId;
getStockList(this.queryParams).then((res) => {
this.finished = false;
this.partsList = this.partsList.concat(res.rows);
this.total = res.total;
this.partsList.forEach((item) => {
item.color = "#FFF";
if (item.type === 1) {
item.bgColor = "#1771f7";
item.nameStatus = "关键备件"
} else if (item.type === 2) {
item.bgColor = "#1771f7";
item.nameStatus = "特殊备件"
} else{
item.bgColor = "#1771f7";
item.nameStatus = "普通备件"
}
})
})
}
}
}
</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>