<template>
|
<view class="container">
|
<cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask">
|
<block slot="backText">返回</block>
|
<block slot="content">详情</block>
|
</cu-custom>
|
<view class="container">
|
|
|
<uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext">
|
<uni-group top="1">
|
<view class="text-gray margin-bottom-lg">—————————— 基本信息 ——————————</view>
|
<uni-forms-item name="num" :label-width="80" label="工单号:">
|
<uni-easyinput v-model="formData.orderNum" :disabled="true" />
|
</uni-forms-item>
|
<uni-forms-item required name="num" :label-width="80" label="设备编号:">
|
<uni-data-select v-model="formData.num" :localdata="equipmentList" @change="changeEquipmentList"
|
placeholder="请选择" :disabled="true" />
|
</uni-forms-item>
|
<uni-forms-item name="maintenanceDate" :label-width="80" label="保养日期:">
|
<uni-easyinput v-model="formData.maintenanceDate" :disabled="true" />
|
</uni-forms-item>
|
<uni-forms-item name="outNum" :label-width="80" label="保养人:">
|
<uni-easyinput v-model="formData.operator_dictText" :disabled="true" />
|
</uni-forms-item>
|
<uni-forms-item name="outNum" :label-width="80" label="备注">
|
<uni-easyinput type="textarea" v-model="formData.remark" :disabled="true" />
|
</uni-forms-item>
|
<uni-forms-item name="outNum" :label-width="80" label="保养图片:">
|
<view class="grid col-4 grid-square flex-sub">
|
<view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage"
|
:data-url="imgList[index]">
|
<image :src="imgList[index]" mode="aspectFill"></image>
|
<view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index">
|
<text class='cuIcon-close'></text>
|
</view>
|
</view>
|
<view class="solids" v-if="imgList.length<1">
|
<text class='cuIcon-cameraadd'></text>
|
</view>
|
</view>
|
</uni-forms-item>
|
</uni-group>
|
</uni-forms>
|
<view class="text-gray margin-bottom-lg">—————————— 保养项信息 ——————————</view>
|
<uni-card margin="10px" spacing="1px" v-for="(item,index) in partTakeAdviceDetailList" :key="index">
|
|
|
<view class="flex">
|
<view class="flex-sub text-light bg-white padding-xs margin-xs radius">行号:</view>
|
<view class="flex-sub bg-white padding-xs margin-xs radius text-right">{{index+1}}
|
</view>
|
</view>
|
<view class="flex">
|
<view class="flex-sub text-light bg-white padding-xs margin-xs radius">保养项:</view>
|
<view class="flex-sub bg-white padding-xs margin-xs text-bold radius text-right">
|
{{item.itemName}}
|
</view>
|
</view>
|
<view class="flex">
|
<view class="flex-sub text-light bg-white padding-xs margin-xs radius">子保养项:</view>
|
<view class="flex-sub bg-white padding-xs margin-xs radius text-right"
|
v-if="item.subItemName!=null && item.subItemName.length>10">
|
{{(item.subItemName).toString().substr(0,10)+'...'}}
|
</view>
|
|
<view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else>
|
{{item.subItemName}}
|
</view>
|
</view>
|
<view class="flex">
|
<view class="flex-sub text-light bg-white padding-xs margin-xs radius">保养要求:</view>
|
<view class="flex-sub bg-white padding-xs margin-xs radius text-right"
|
v-if="item.itemDemand!=null && item.itemDemand.length>10">
|
{{(item.itemDemand).toString().substr(0,10)+'...'}}
|
</view>
|
|
<view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else>
|
{{item.itemDemand}}
|
</view>
|
</view>
|
|
<view class="flex">
|
<view class="flex-sub text-light bg-white padding-xs margin-xs radius">保养结果:</view>
|
<uni-data-select :localdata="restle" v-model="item.maintenanceResult" @change="handleCode()"
|
:clear="true" :disabled="true" />
|
|
</view>
|
|
<view class="flex">
|
<view class="flex-sub text-light bg-white padding-xs margin-xs radius">异常描述:</view>
|
<view class="flex-sub bg-white padding-xs text-right margin-xs radius">
|
<uni-easyinput v-model="item.exceptionDescription" :disabled="true" />
|
</view>
|
</view>
|
|
<view class="flex">
|
<view class="flex-sub text-light bg-white padding-xs margin-xs radius">是否报修:</view>
|
<view class="flex-sub bg-white padding-xs text-right margin-xs radius">
|
<uni-data-select :localdata="item.type" v-model="item.reportFlag" :disabled="true" />
|
</view>
|
</view>
|
</uni-card>
|
|
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
import configService from '@/common/service/config.service.js';
|
export default {
|
mixins: [MescrollMixin], // 使用mixin
|
data() {
|
return {
|
ipAndPort:configService.staticURL,
|
scrollLeft: 0,
|
searchValue: '',
|
imgList: [],
|
equipmentList: [],
|
restle: [],
|
uploadUrl: "/sys/common/upload",
|
formData: {
|
num: '',
|
avatar:[],
|
remark: '',
|
inspectionDate: '',
|
},
|
partTakeAdviceDetailList: [],
|
NavBarColor: this.NavBarColor,
|
url: {
|
upload: "/eam/sysFiles/batch_upload",
|
stallList: "/eam/weekMaintenanceOrder/queryById",
|
getEquipmentList:'eam/equipment/list',
|
// getEquipmentList: "eam/equipment/asyncLoadEquipment",
|
BaoList: '/eam/weekMaintenanceOrderDetail/queryList'
|
},
|
id: '',
|
inspectionResult: '',
|
upOption: {
|
page: {
|
num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
|
size: 10 // 每页数据的数量
|
},
|
noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
|
empty: {
|
tip: '~ 暂无数据 ~', // 提示
|
},
|
loading: '',
|
text: '全部',
|
isShowNoMore: false,
|
textNoMore: '我是有底线的 >_<'
|
},
|
styles: {
|
color: '#2979FF',
|
borderColor: '#2979FF'
|
},
|
msg1Count: 0,
|
msg2Count: 0,
|
msg1Title: ""
|
}
|
},
|
computed: {
|
top() {
|
return this.CustomBar * 2 + 50
|
},
|
style() {
|
var StatusBar = this.StatusBar;
|
var CustomBar = this.CustomBar;
|
var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
|
return style
|
},
|
},
|
onLoad(options) {
|
const annItem = JSON.parse(decodeURIComponent(options.item));
|
this.id = annItem.id
|
},
|
created() {
|
this.upCallback();
|
this.getEquipment();
|
this.getList();
|
|
},
|
methods: {
|
changeEquipmentList(e) {
|
this.formData.num = e;
|
},
|
handleCode(e) {
|
this.inspectionResult = e;
|
},
|
// getEquipment() {
|
// this.$http.get(this.url.getEquipmentList).then(res => {
|
// //设置列表数据
|
// if (res.data.success) {
|
// this.equipmentList = res.data.result
|
// } else {
|
// uni.showToast({
|
// icon: "error",
|
// title: res.data.message,
|
// duration: 2000
|
// });
|
|
// }
|
// }).catch(() => {
|
// this.$tip.error("联网失败")
|
// })
|
// },
|
getEquipment() {
|
this.$http.get(this.url.getEquipmentList, {
|
params: {
|
pageNo: 1,
|
pageSize: 9999,
|
order: 'desc',
|
column: 'createTime'
|
},
|
|
}).then(res => {
|
//设置列表数据
|
if (res.data.success) {
|
this.equipmentList = res.data.result.records
|
} else {
|
uni.showToast({
|
icon: "error",
|
title: res.data.message,
|
duration: 2000
|
});
|
|
}
|
}).catch(() => {
|
this.$tip.error("联网失败")
|
})
|
},
|
getList() {
|
this.$http.get(this.url.BaoList, {
|
params: {
|
orderId: this.id
|
},
|
|
}).then(res => {
|
this.partTakeAdviceDetailList = res.data.result
|
console.log("url", res)
|
//设置列表数据
|
if (res.data.success) {
|
console.log("res", res.data.result)
|
|
}
|
}).catch(() => {
|
//联网失败, 结束加载
|
})
|
},
|
ChooseImage() {
|
var that = this;
|
uni.chooseImage({
|
count: 4,
|
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
sourceType: ['album'], // 从相册选择
|
success: (res) => {
|
// 存储选择的图片路径
|
that.imgList = res.tempFilePaths;
|
|
// 初始化 formData.avatar 为空字符串
|
that.formData.avatar = '';
|
|
// 创建上传任务的 Promise 数组
|
const uploadPromises = res.tempFilePaths.map((filePath, index) => {
|
return new Promise((resolve, reject) => {
|
that.$http.upload(that.url.upload, {
|
filePath: filePath,
|
name: 'file'
|
})
|
.then(uploadRes => {
|
// 假设服务器返回的结果中包含文件路径
|
const filePath = uploadRes.data.result[0];
|
// 追加到 formData.avatar 中,并用逗号分隔
|
this.formData.avatar.push(filePath);
|
resolve(filePath);
|
})
|
.catch(err => {
|
console.error('图片' + index + '上传失败:', err);
|
reject(err);
|
});
|
});
|
});
|
|
// 并发执行所有上传任务
|
Promise.all(uploadPromises)
|
.then((uploadedFilePaths) => {
|
console.log('所有图片上传成功:', that.formData.avatar);
|
})
|
.catch((err) => {
|
console.error('图片上传失败:', err);
|
that.$tip.error('图片上传失败');
|
});
|
}
|
});
|
},
|
ViewImage(e) {
|
uni.previewImage({
|
urls: this.imgList,
|
current: e.currentTarget.dataset.url
|
});
|
},
|
DelImg(e) {
|
uni.showModal({
|
title: '提示',
|
content: '确定要删除这段回忆吗?',
|
cancelText: '再看看',
|
confirmText: '再见',
|
success: res => {
|
if (res.confirm) {
|
this.imgList.splice(e.currentTarget.dataset.index, 1)
|
}
|
}
|
})
|
},
|
|
upCallback() {
|
this.$http.get(this.url.stallList, {
|
params: {
|
id: this.id
|
},
|
}).then(res => {
|
this.announcement1 = res.data.result
|
console.log("url", res)
|
//设置列表数据
|
if (res.data.success) {
|
console.log("res", res.data.result.equipmentCode)
|
this.formData.num = this.announcement1.equipmentId,
|
this.formData.orderNum = this.announcement1.orderNum,
|
this.formData.maintenanceDate = this.announcement1.maintenanceDate,
|
this.formData.operator = this.announcement1.operator,
|
this.formData.remark = this.announcement1.remark,
|
this.formData.avatar = this.announcement1.imageFiles
|
const imageObjects = JSON.parse(this.formData.avatar);
|
// 提取 filePath 并拼接 IP 和端口
|
this.imgList = imageObjects.map(imageObj => {
|
return `${this.ipAndPort}${imageObj.filePath}`;
|
});
|
}
|
}).catch(() => {
|
//联网失败, 结束加载
|
})
|
},
|
|
|
|
/* 检索 */
|
getSera(res) {
|
this.msgList = [];
|
if (keyword == 0) {
|
this.$http.get(this.url.stallList, {
|
params: {
|
pageNo: 1,
|
pageSize: 999,
|
order: "desc",
|
column: "createTime",
|
equipmentCode: res
|
}
|
}).then(res => {
|
//联网成功的回调,隐藏下拉刷新和上拉加载的状态;
|
|
this.announcement1 = res.data.result.records
|
this.mescroll.endSuccess(this.announcement1.length);
|
console.log("url", res)
|
//设置列表数据
|
if (res.data.success) {
|
console.log("res", res.data)
|
this.msg1Count = res.data.result.total
|
this.msg1Title = "通知(" + res.data.result.total + ")";
|
for (let annItem of this.announcement1) {
|
this.msgList.push(annItem)
|
}
|
}
|
if (page.num == 1) {
|
this.msgList = []; //如果是第一页需手动制空列表
|
this.msgList = this.msgList.concat(this.announcement1); //追加新数据
|
}
|
|
}).catch(() => {
|
//联网失败, 结束加载
|
this.mescroll.endErr();
|
})
|
}
|
},
|
|
mescrollInit(mescroll) {
|
console.log('mescrollInit')
|
this.mescroll = mescroll;
|
},
|
},
|
|
}
|
</script>
|
|
<style>
|
.is-hover {
|
color: rgba(255, 255, 255, 0.6);
|
background-color: #55aaff;
|
border-color: #55aaff;
|
}
|
|
|
|
.content {
|
margin-top: 5px;
|
}
|
|
.content scroll-view {
|
scrollIndicator: "none"
|
}
|
|
.popupView {
|
margin-top: 85px;
|
height: auto;
|
}
|
</style>
|