设备保养
This commit is contained in:
parent
d2a7a36c08
commit
fe35350698
16
api/maintenance/maintenance.js
Normal file
16
api/maintenance/maintenance.js
Normal file
@ -0,0 +1,16 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export function listMaintenance(query) {
|
||||
return request({
|
||||
url: "/upkeep/record/list",
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
export function getMaintenanceById(id) {
|
||||
return request({
|
||||
url: "/upkeep/report/" + id,
|
||||
method: "get"
|
||||
});
|
||||
}
|
@ -1,22 +1,192 @@
|
||||
<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="maintenanceInfo" label-width="100px">
|
||||
<u-form-item label="保养计划编号:" prop="" borderBottom>
|
||||
{{planNum}}
|
||||
</u-form-item>
|
||||
<u-form-item label="计划开始时间:" prop="" borderBottom>
|
||||
{{planStartTime}}
|
||||
</u-form-item>
|
||||
<u-form-item label="计划完成时间:" prop="" borderBottom>
|
||||
{{planEndTime}}
|
||||
</u-form-item>
|
||||
<u-form-item label="执行人:" prop="" borderBottom>
|
||||
{{maintainerName}}
|
||||
</u-form-item>
|
||||
<u-form-item label="保养内容:" prop="" borderBottom>
|
||||
{{planContent}}
|
||||
</u-form-item>
|
||||
<u-form-item label="备件出库单号:" prop="" borderBottom>
|
||||
{{maintenanceInfo.sparePartsOutboundNum}}
|
||||
</u-form-item>
|
||||
<u-form-item label="使用备件名:" prop="" borderBottom>
|
||||
{{maintenanceInfo.sparePartsName}}
|
||||
</u-form-item>
|
||||
<u-form-item label="使用备件数量:" prop="" borderBottom>
|
||||
{{maintenanceInfo.outboundQuantity}}
|
||||
</u-form-item>
|
||||
<u-form-item label="保养报告内容:" prop="" borderBottom>
|
||||
<view><mp-html :content="maintenanceInfo.reportContent" /></view>
|
||||
</u-form-item>
|
||||
<u-form-item label="照片:" prop="" borderBottom>
|
||||
<u--image :showLoading="true" :src="maintenanceInfo.photoPath" width="80px" height="80px"
|
||||
@click="lookImage(maintenanceInfo.photoPath)"></u--image>
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
</view>
|
||||
</uni-section>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getMaintenanceById
|
||||
} from "@/api/maintenance/maintenance.js"
|
||||
|
||||
import config from '@/config'
|
||||
const baseUrl = config.baseUrl
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
id: null,
|
||||
planStartTime: null,
|
||||
planEndTime: null,
|
||||
maintainerName: null,
|
||||
planContent: null,
|
||||
planNum: null,
|
||||
maintenanceInfo: {},
|
||||
}
|
||||
},
|
||||
onLoad(opts) {
|
||||
this.id = opts.id;
|
||||
if ("null" != opts.planStartTime) {
|
||||
this.planStartTime = opts.planStartTime;
|
||||
}
|
||||
if ("null" != opts.planEndTime) {
|
||||
this.planEndTime = opts.planEndTime;
|
||||
}
|
||||
if ("null" != opts.maintainerName) {
|
||||
this.maintainerName = opts.maintainerName;
|
||||
}
|
||||
if ("null" != opts.planContent) {
|
||||
this.planContent = opts.planContent;
|
||||
}
|
||||
if ("null" != opts.planNum) {
|
||||
this.planNum = opts.planNum;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getMaintenanceInfo();
|
||||
},
|
||||
methods: {
|
||||
|
||||
lookImage(url) {
|
||||
// 预览图片
|
||||
let urls = [];
|
||||
urls.push(url)
|
||||
uni.previewImage({
|
||||
urls: urls
|
||||
});
|
||||
},
|
||||
getMaintenanceInfo() {
|
||||
getMaintenanceById(this.id).then((res) => {
|
||||
this.maintenanceInfo = res.data
|
||||
let photoPath = this.maintenanceInfo.photoPath;
|
||||
if (photoPath != null && photoPath != '') {
|
||||
this.maintenanceInfo.photoPath = baseUrl + photoPath;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</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>
|
@ -1,22 +1,251 @@
|
||||
<template>
|
||||
<view>
|
||||
1
|
||||
<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 maintenanceList" :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.planNum}}</text>
|
||||
</view>
|
||||
<view class="text-content">
|
||||
<text class="iconfont "></text>
|
||||
<text class="text-description">预期保养部件: {{item.planComponent}}</text>
|
||||
</view>
|
||||
<view class="text-content">
|
||||
<text class="iconfont "></text>
|
||||
<text class="text-description">预期保养内容: {{item.planContent}}</text>
|
||||
</view>
|
||||
<view class="text-content">
|
||||
<text class="iconfont "></text>
|
||||
<text class="text-description">计划开始时间: {{item.planStartTime}}</text>
|
||||
</view>
|
||||
<view class="text-content">
|
||||
<text class="iconfont "></text>
|
||||
<text class="text-description">计划完成时间: {{item.planEndTime}}</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.maintainerName}}</text>
|
||||
</view>
|
||||
<view class="text-content">
|
||||
<text class="iconfont "></text>
|
||||
<text class="text-description">保养计划监管人: {{item.supervisorName}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listMaintenance
|
||||
} from "@/api/maintenance/maintenance.js"
|
||||
|
||||
import {
|
||||
getEquipTree
|
||||
} from "@/api/equip/equip.js"
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
maintenanceList: [],
|
||||
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.partsList = [];
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
};
|
||||
this.getMaintenanceList();
|
||||
},
|
||||
onReachBottom() {
|
||||
const allTotal = this.queryParams.pageNum * this.queryParams.pageSize;
|
||||
if (allTotal < this.total) {
|
||||
this.queryParams.pageNum += 1;
|
||||
this.getMaintenanceList();
|
||||
} else {
|
||||
this.finished = true;
|
||||
this.tipText = "已加载完成";
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
goItem(item) {
|
||||
this.$tab.navigateTo("/pages/work/maintenance/detailsMaintenance?id=" + item.id + "&planStartTime=" + item
|
||||
.planStartTime + "&planEndTime=" + item.planEndTime + "&maintainerName=" + item.maintainerName +
|
||||
"&planContent=" + item.planContent + "&planNum=" + item.planNum);
|
||||
},
|
||||
getMaintenanceList() {
|
||||
this.finished = true;
|
||||
this.queryParams.equipId = this.equipId;
|
||||
listMaintenance(this.queryParams).then((res) => {
|
||||
this.finished = false;
|
||||
this.maintenanceList = this.maintenanceList.concat(res.rows);
|
||||
this.total = res.total;
|
||||
this.maintenanceList.forEach((item) => {
|
||||
item.color = "#FFF";
|
||||
if (item.status === "1") {
|
||||
item.bgColor = "#13ce66";
|
||||
item.nameStatus = "已完成"
|
||||
} else if (item.status === "2") {
|
||||
item.bgColor = "#225aa4";
|
||||
item.nameStatus = "执行中"
|
||||
} else if (item.status === "3") {
|
||||
item.bgColor = "#ff4949";
|
||||
item.nameStatus = "已超期"
|
||||
} else if (item.status === "4") {
|
||||
item.bgColor = "#ffba00";
|
||||
item.nameStatus = "超期完成"
|
||||
} else {
|
||||
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.maintenanceList = [];
|
||||
this.getMaintenanceList();
|
||||
},
|
||||
}
|
||||
}
|
||||
</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>
|
Loading…
Reference in New Issue
Block a user