| | |
| | | } from "@/api/place/place.js" |
| | | |
| | | import { |
| | | savePlaceCheck |
| | | savePlaceCheck, |
| | | getPlaceCheckDetail, |
| | | updatePlaceCheck |
| | | } from "@/api/reporting/reporting.js" |
| | | |
| | | export default { |
| | |
| | | ], |
| | | time: Number(new Date()), |
| | | showSelectDate: false, |
| | | dangerCount: 0 //隐患项数量 |
| | | dangerCount: 0, //隐患项数量 |
| | | isEdit: false |
| | | |
| | | } |
| | | }, |
| | | onLoad(option) { |
| | | this.info.houseCode = uni.getStorageSync("siteInfo").houseCode; |
| | | this.info.placeName = uni.getStorageSync("siteInfo").name; |
| | | this.getItem(); |
| | | async onLoad(option) { |
| | | await this.getItem(); |
| | | if (option.taskId) { |
| | | this.isEdit = true; |
| | | this.getDetail(option.taskId) |
| | | } else { |
| | | this.info.houseCode = uni.getStorageSync("siteInfo").houseCode; |
| | | this.info.placeName = uni.getStorageSync("siteInfo").name; |
| | | } |
| | | |
| | | |
| | | |
| | | }, |
| | | |
| | | methods: { |
| | | |
| | | getDetail(id) { |
| | | getPlaceCheckDetail({ |
| | | taskId: id |
| | | }).then(res => { |
| | | let data = res.data; |
| | | for (let i = 0, ii = this.questionList.length; i < ii; i++) { |
| | | for (let k = 0, kk = this.questionList[i].children.length; k < kk; k++) { |
| | | for (let j = 0, jj = data.taskPlaceRecordVOList.length; j < jj; j++) { |
| | | if (this.questionList[i].children[k].id == data.taskPlaceRecordVOList[j].itemId) { |
| | | let children = this.questionList[i] |
| | | children.children[k].state = data.taskPlaceRecordVOList[j].state; |
| | | if (data.taskPlaceRecordVOList[j].imageUrls) { |
| | | children.children[k].urls = this.$setImageUrl(data.taskPlaceRecordVOList[j] |
| | | .imageUrls, 2); |
| | | } |
| | | children.children[k].remark = data.taskPlaceRecordVOList[j].remark || ""; |
| | | this.$set(this.questionList, i, children) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | this.info.remark = data.remark; |
| | | if (data.signaturePath) { |
| | | this.signatureUrl = this.$setFullUrl(data.signaturePath); |
| | | this.info.signaturePath = data.signaturePath; |
| | | } |
| | | this.form.images = this.$setImageUrl(data.imageUrls, 2) |
| | | |
| | | }) |
| | | }, |
| | | |
| | | |
| | | getItem() { |
| | | getPlaceCheckItem().then(res => { |
| | | let data = res.data; |
| | |
| | | |
| | | this.info.taskPlaceRecordVOList = this.getSelected() |
| | | this.info.status = 1; |
| | | savePlaceCheck(this.info).then(res => { |
| | | uni.hideLoading(); |
| | | uni.showToast({ |
| | | icon: 'success', |
| | | title: '提交成功', |
| | | success() { |
| | | setTimeout(() => { |
| | | uni.navigateBack(); |
| | | }, 300) |
| | | } |
| | | |
| | | if (this.isEdit) { |
| | | updatePlaceCheck(this.info).then(res => { |
| | | uni.hideLoading(); |
| | | uni.showToast({ |
| | | icon: 'success', |
| | | title: '提交成功', |
| | | success() { |
| | | setTimeout(() => { |
| | | uni.navigateBack(); |
| | | }, 300) |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | } else { |
| | | savePlaceCheck(this.info).then(res => { |
| | | uni.hideLoading(); |
| | | uni.showToast({ |
| | | icon: 'success', |
| | | title: '提交成功', |
| | | success() { |
| | | setTimeout(() => { |
| | | uni.navigateBack(); |
| | | }, 300) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | previewImg() { |