You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

431 lines
12 KiB

<template>
<view class="sheBeiSheShiDetail-container">
<u-navbar bgColor="#ffffff" :placeholder="true" titleStyle="font-weight:600" title="设施巡检" :autoBack="true">
</u-navbar>
<u-swiper indicator class="swiper-top" :list="swiperList" height="150" circular :autoplay="false" radius="5"
bgColor="#ffffff"></u-swiper>
<view class="detail-info">
<view class="detail-info-title">
<image style="width: 36rpx; height: 36rpx; margin-right: 22rpx"
src="../../../../static/images/implement/detailInfo.png" mode="scaleToFill" />
<text>详细信息</text>
</view>
<view class="detail-info-item" style="margin-top: 30rpx; background-color: #f8f9fb">
<view class="info-item-title">设施名称</view>
<view class="info-item-content">{{ inspectionPlanInfoData.facilitiesName }}</view>
</view>
<view class="detail-info-item">
<view class="info-item-title">设施编号</view>
<view class="info-item-content">{{ inspectionPlanInfoData.code }}</view>
</view>
<view class="detail-info-item" style="background-color: #f8f9fb">
<view class="info-item-title">地点位置</view>
<view class="info-item-content">{{ inspectionPlanInfoData.address }}</view>
</view>
<view class="detail-info-item">
<view class="info-item-title">上次巡检时间</view>
<view class="info-item-content">{{ inspectionPlanInfoData.year }}- {{ inspectionPlanInfoData.month }}-
{{ inspectionPlanInfoData.day }}
</view>
</view>
<view class="detail-info-item" style="background-color: #f8f9fb">
<view class="info-item-title">二级单位</view>
<view class="info-item-content">{{ inspectionPlanInfoData.secUnitName }}</view>
</view>
<view class="detail-info-item">
<view class="info-item-title">所属部门</view>
<view class="info-item-content">{{ inspectionPlanInfoData.plantName }}</view>
</view>
<view class="detail-info-item" style="background-color: #f8f9fb">
<view class="info-item-title">巡查人</view>
<view class="info-item-content">{{ inspectionPlanInfoData.userName }}</view>
</view>
<!-- <view class="detail-info-item">
<view class="info-item-title">年度出现问题次数</view>
<view class="info-item-content">{{ inspectionPlanInfoData.inspectionRule }}</view>
</view> -->
<u-line color="#EEEEEE"></u-line>
<!-- <view class="detail-info-title" style="margin-top: 44rpx">
<image style="width: 36rpx; height: 36rpx; margin-right: 22rpx"
src="../../../../static/images/implement/baoxiu.png" mode="scaleToFill" />
<text>上次巡检出现的问题</text>
</view> -->
<!-- <u-collapse accordion :border="false" style="margin-top: 30rpx" v-for="(item, index) in facilitiesRepair"
:key="index">
<u-collapse-item :title="item.question" class="collapse-item">
<u-icon slot="icon" size="20" name="../../../../static/images/polling/wenti.png"></u-icon>
<view slot="value" class="u-page__item__title__slot-title">
<text slot="value" class="u-page__item__title__slot-title">自定义内容</text>
<view v-if="item.status == '0'"
style="display: flex;justify-content: center;align-items: center;">
<image style="margin-right: 14rpx;width: 30rpx;height: 30rpx;"
src="../../../../static/images/implement/weijiejue.png" mode="scaleToFill" />
<text style="color: #f54547">未解决</text>
</view>
<view v-else style="display: flex;justify-content: center;align-items: center;">
<image style="margin-right: 14rpx;width: 30rpx;height: 30rpx;"
src="../../../../static/images/implement/yijiejue.png" mode="scaleToFill" />
<text style="color: #2acc45">已解决</text>
</view>
</view>
<view v-show="isType != '0'" style="height: 100rpx"></view>
<view class="u-collapse-content">
<view class="detail-info-title" style="margin-top: 44rpx" v-show="isType == '0'">
<image style="width: 36rpx; height: 36rpx; margin-right: 22rpx"
src="../../../../static/images/implement/baoxiu.png" mode="scaleToFill" />
<text>问题详情</text>
</view>
<view class="collapse-lsit" v-show="isType == '0'">
<view class="collapse-type">
<view class="collapse-type-left">是否异常</view>
<view class="collapse-type-right">
<u-radio-group v-model="radioValue" placement="row" disabled>
<u-radio label="是" name="0" style="margin-right: 56rpx"></u-radio>
<u-radio label="否" name="1"></u-radio>
</u-radio-group>
</view>
</view>
<view class="collapse-type-input" style="margin-top: 0; background-color: #fff">
<view class="top-search">
<view class="top-search-prefix">巡检结论</view>
<u-textarea autoHeight ref="input" clearable v-model.trim="resultValue"
fontSize="13px" disabled></u-textarea>
</view>
</view>
<view class="collapse-type" style="margin-top: 0">
<view class="collapse-type-left">问题图片</view>
</view>
<view class="collapse-upload-img">
<u-upload :fileList="fileList" auto-upload @delete="deletePic" @afterRead="getImage">
</u-upload>
</view>
</view>
</view>
</u-collapse-item>
</u-collapse> -->
<view class="detail-bottom" v-show="isType == '0'">
<u-button class="detail-bottom-btn" shape="circle" text="我要报修" @click="goToBaoXiu"></u-button>
<u-button class="detail-bottom-btn" shape="circle" text="巡检结束" @click="goDone"></u-button>
</view>
</view>
</view>
</template>
<script>
import {
inspectionPlanInfo,
setInspectionPlan
} from '@/api/indexpage/polling/index.js';
import {
facilitiesRepairList
} from '@/api/indexpage/implement/index.js';
import config from '@/config.js';
import {
getToken
} from '@/utils/auth.js';
export default {
data() {
return {
swiperList: [],
ssId: '',
isType: '0',
inspectionPlanInfoData: {},
facilitiesRepair: [],
radioValue: 'N',
fileList: [],
resultValue: '',
xxId: ''
};
},
watch: {},
onLoad(options) {
this.xxId = options.xxId;
this.ssId = options.ssId;
this.isType = options.isType;
},
onShow() {
this.getInspectionPlanInfo();
this.getFacilitiesRepairList();
},
methods: {
getFacilitiesRepairList() {
facilitiesRepairList(this.ssId).then(res => {
this.facilitiesRepair = res.rows;
console.log(this.facilitiesRepair, "this.facilitiesRepair ");
});
},
async goDone() {
let picList = this.fileList
.map(item => {
return item.id;
})
.join(',');
let params = {
pic: picList,
conclusion: this.resultValue,
isError: this.radioValue,
facilitiesId: this.ssId,
id: this.xxId,
isOver: '1',
status: '2',
};
let result = await setInspectionPlan(params);
if (result.code == 200) {
//返回上一页
uni.navigateBack({
delta: 1
});
}
},
goToBaoXiu() {
//携带设备id
this.$tab.navigateTo(`/pages/indexpage/sheBeiSheShi/myBaoXiu/myBaoXiu?ssId=${this.ssId}`);
},
async getInspectionPlanInfo() {
let result = await inspectionPlanInfo(this.xxId);
if (result.code == 200) {
this.inspectionPlanInfoData = result.data;
// console.log(this.inspectionPlanInfoData, "this.inspectionPlanInfoData");
this.swiperList = result.data.pic ?? [];
}
},
// 删除图片
deletePic(event) {
//删除本地
this[`fileList${event.name}`].splice(event.index, 1);
},
// 图片上传结果
async getImage(event) {
console.log('event', event);
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file);
let fileListLen = this[`fileList${event.name}`].length;
lists.map(item => {
this[`fileList${event.name}`].push({
...item,
status: 'uploading',
message: '上传中'
});
});
for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i].url);
let item = this[`fileList${event.name}`][fileListLen];
this[`fileList${event.name}`].splice(
fileListLen,
1,
Object.assign(item, {
status: 'success',
message: '',
id: result
})
);
fileListLen++;
}
},
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: `${config.baseUrlImg}/filemanage/upload1`, // 仅为示例,非真实的接口地址
filePath: url,
name: 'file',
header: {
Authorization: 'Bearer ' + getToken()
},
formData: {
isFullDir: false,
classify: '1',
dir: '/inspectionPic'
},
success: res => {
let result = JSON.parse(res.data);
console.log('result', result);
setTimeout(() => {
resolve(result.data.id);
}, 1000);
}
});
});
}
}
};
</script>
<style lang="scss" scoped>
.sheBeiSheShiDetail-container {
background-color: #fff;
font-family: Noto Sans S Chinese;
.swiper-top {
height: 300rpx !important;
background: #ffffff;
box-sizing: border-box;
width: calc(100% - 60rpx);
margin: 0 auto;
box-shadow: 0px 3px 4px 0px rgba(190, 207, 228, 0.4);
border: 1px solid #e6e6e6;
}
.detail-info {
box-sizing: border-box;
padding: 40rpx 30rpx 0 30rpx;
overflow: hidden;
.detail-info-title {
width: 100%;
height: 40rpx;
display: flex;
align-items: center;
font-weight: 500;
font-size: 16px;
color: #333333;
}
.detail-info-item {
box-sizing: border-box;
padding: 0 30rpx;
font-size: 14px;
display: flex;
align-items: center;
justify-content: space-between;
height: 84rpx;
font-weight: 400;
.info-item-title {
width: 240rpx;
color: #333333;
}
.info-item-content {
display: flex;
flex: 1;
justify-content: end;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: #666666;
}
}
.u-collapse {
::v-deep .u-cell__body {
background-color: #f8f9fb;
height: 84rpx;
}
}
.collapse-lsit {
.collapse-type {
height: 84rpx;
background-color: #f8f9fb;
margin-top: 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 0 30rpx;
.collapse-type-left {
display: flex;
align-items: center;
font-size: 14px;
color: #333333;
image {
width: 30rpx;
height: 28rpx;
margin-right: 20rpx;
}
}
.collapse-type-right {
display: flex;
align-items: center;
height: 100%;
font-size: 14px;
color: #666666;
view {
display: flex;
align-items: center;
}
image {
width: 40rpx;
height: 40rpx;
}
}
}
.collapse-type-input {
min-height: 84rpx;
background-color: #f8f9fb;
margin-top: 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 0 30rpx;
.top-search {
height: 100%;
width: 100%;
display: flex;
align-items: center;
/deep/ .uni-textarea-placeholder {
text-align: right;
}
::v-deep .u-textarea {
height: 100%;
border-radius: 9px;
background-color: #fff;
border: none;
padding: 10rpx !important;
}
.top-search-prefix {
font-weight: 400;
font-size: 14px;
color: #333333;
width: 150rpx;
}
}
}
.collapse-upload-img {
margin-top: 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
}
}
.detail-bottom {
margin-top: 50rpx;
margin-bottom: 80rpx;
display: flex;
align-items: center;
& .detail-bottom-btn:nth-child(1) {
width: 260rpx;
height: 74rpx;
color: #fff;
background: #ff9e49;
}
& .detail-bottom-btn:nth-child(2) {
width: 260rpx;
height: 74rpx;
color: #fff;
background: #4996ff;
}
}
}
}
</style>