<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">
|
|
|
<uni-forms-item :label-width="100" name="andonAlertMessage" label="安灯描述:">
|
<uni-easyinput type="textarea" v-model="formData.andonAlertMessage" />
|
</uni-forms-item>
|
|
<uni-forms-item :label-width="100" name="outNum" label="安灯图片:">
|
<uni-file-picker limit="9" :value="fileList" :image-styles="imageStyles" @select="select"
|
:sourceType="sourceType" @progress="progress" @success="success" @fail="fail"
|
@delete="deletea" :readonly="readonly" />
|
</uni-forms-item>
|
<uni-forms-item :label-width="100" name="andonhandle" label="处理方式描述:">
|
<uni-easyinput type="textarea" v-model="formData.andonhandle" />
|
</uni-forms-item>
|
</uni-group>
|
</uni-forms>
|
|
|
<view v-show="isSHowBtn" class="padding flex flex-direction">
|
<view class="flex-sub bg-blue padding-sm margin-xl radius text-sm text-center text-white"
|
@click.stop="ProductionTask()" hover-class="is-hover">确定</view>
|
</view>
|
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
import configService from "@/common/service/config.service";
|
export default {
|
mixins: [MescrollMixin], // 使用mixin
|
data() {
|
return {
|
// 图片回显
|
fileLists: [],
|
// 上传图片的样式
|
imageStyles: {
|
width: 90,
|
height: 90,
|
},
|
sourceType: ['album', 'camera'],
|
ipAndPort: configService.staticURL,
|
scrollLeft: 0,
|
uploadUrl: "/sys/common/upload",
|
formData: {
|
andonAlertMessage: '',
|
andonhandle: '',
|
avatar: []
|
},
|
|
|
NavBarColor: this.NavBarColor,
|
url: {
|
upload: "/eam/sysFiles/batch_upload",
|
stallList: "/eam/eamRepairOrder/queryById",
|
getEquipmentList: 'eam/equipment/list',
|
approval: '/eam/eamRepairOrder/perform'
|
},
|
|
styles: {
|
color: '#2979FF',
|
borderColor: '#2979FF'
|
},
|
msg1Count: 0,
|
msg2Count: 0,
|
msg1Title: ""
|
}
|
},
|
computed: {
|
top() {
|
return this.CustomBar * 2 + 160
|
},
|
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));
|
},
|
created() {
|
|
|
},
|
|
methods: {
|
select(e) {
|
const tempFilePaths = e.tempFilePaths;
|
uni.showLoading({
|
title: '上传中...'
|
});
|
const uploadPromises = tempFilePaths.map((filePath, index) => {
|
return new Promise((resolve, reject) => {
|
this.$http.upload(this.url.upload, {
|
filePath: filePath,
|
name: 'file'
|
})
|
.then(uploadRes => {
|
// 假设服务器返回的结果中包含文件路径
|
const serverFilePath = uploadRes.data.result[0];
|
this.formData.avatar.push(serverFilePath);
|
resolve(uploadRes); // 返回结果给 Promise.all
|
})
|
.catch(err => {
|
console.error(`图片 ${index + 1} 上传失败:`, err);
|
reject(err);
|
});
|
});
|
});
|
|
Promise.all(uploadPromises)
|
.then(() => {
|
uni.hideLoading();
|
uni.showToast({
|
title: '全部上传成功'
|
});
|
})
|
.catch(err => {
|
uni.hideLoading();
|
uni.showToast({
|
title: '部分上传失败',
|
icon: 'none'
|
});
|
console.error('上传异常:', err);
|
});
|
},
|
// 删除
|
deletea(e) {
|
console.log('删除图片', e);
|
},
|
ProductionTask() {
|
|
uni.showLoading({
|
mask: true,
|
title: "加载中....",
|
})
|
this.$http.post(this.url.approval, {
|
sparePartDescription: this.ScanData.sparePartDescription,
|
dataId: this.id,
|
equipmentId: this.formData.num,
|
faultReason: this.formData.faultReason,
|
id: this.id,
|
imageFilesResult: this.formData.avatar,
|
instanceId: this.procInstId,
|
isUseSpare: this.formData.isSpare,
|
repairDescription: this.formData.repairDescription,
|
taskId: this.taskId
|
}).then(res => {
|
uni.hideLoading()
|
if (res.data.success) {
|
uni.showToast({
|
icon: "success",
|
title: '提交成功',
|
duration: 2000
|
});
|
this.$Router.replaceAll({
|
name: 'ToDoList'
|
})
|
} else {
|
|
uni.showModal({
|
title: "提示",
|
content: res.data.message,
|
confirmText: '确定',
|
showCancel: false,
|
})
|
}
|
}).catch(() => {
|
this.$tip.loaded();
|
uni.showToast({
|
icon: "error",
|
title: res.data.message,
|
duration: 2000
|
});
|
});
|
},
|
|
changeEquipmentList(e) {
|
this.formData.num = e;
|
},
|
|
|
|
|
|
|
upCallback() {
|
this.$http.get(this.url.stallList, {
|
params: {
|
id: this.id
|
},
|
|
}).then(res => {
|
this.announcement1 = res.data.result
|
console.log("url", res.data.result.reportStatus)
|
//设置列表数据
|
if (res.data.success) {
|
// if (this.announcement1.imageFiles) {
|
// try {
|
// const parsedDataIn = JSON.parse(this.announcement1.imageFiles);
|
// this.imageAvatarTwo = parsedDataIn;
|
// this.imgTwoList = parsedDataIn.map(imageObj => {
|
// return `${this.ipAndPort}${imageObj.filePath}`;
|
// });
|
|
// this.fileLists = this.imgTwoList.map(url => ({
|
// url: url,
|
// extname: 'png',
|
// name: 'eam'
|
// }));
|
// } catch (error) {
|
// console.error('JSON 解析失败:', error);
|
// this.imageAvatarTwo = [];
|
// this.imgTwoList = [];
|
// this.fileLists = [];
|
// }
|
// }
|
}
|
}).catch(() => {
|
//联网失败, 结束加载
|
})
|
},
|
},
|
|
}
|
</script>
|
|
<style>
|
.is-hover {
|
color: rgba(255, 255, 255, 0.6);
|
background-color: #55aaff;
|
border-color: #55aaff;
|
}
|
|
.divider {
|
display: flex;
|
align-items: center;
|
text-align: center;
|
color: gray;
|
/* 文字颜色 */
|
margin: 20px 0;
|
/* 上下间距 */
|
}
|
|
.divider::before,
|
.divider::after {
|
content: '';
|
flex: 1;
|
border-bottom: 1px solid gray;
|
/* 横线颜色 */
|
margin: 0 16px;
|
/* 横线与文字之间的间距 */
|
}
|
|
.divider text {
|
white-space: nowrap;
|
/* 防止文字换行 */
|
}
|
|
.content {
|
margin-top: 5px;
|
}
|
|
.content scroll-view {
|
scrollIndicator: "none"
|
}
|
|
.popupView {
|
margin-top: 45px;
|
height: auto;
|
}
|
</style>
|