diff --git a/pages-sub/daily/maintain-manage/add-record.vue b/pages-sub/daily/maintain-manage/add-record.vue index 1de49f5..713cab2 100644 --- a/pages-sub/daily/maintain-manage/add-record.vue +++ b/pages-sub/daily/maintain-manage/add-record.vue @@ -924,7 +924,7 @@ export default { }, async submitAndFinish() { - + if (this.submitting) return try { await this.$refs.inspectFormRef.validate() const dynamicValues = this.buildDynamicFields() @@ -932,35 +932,34 @@ export default { this.clientSeq = this.genClientSeq() } uni.showLoading({ title: '提交中...' }) - console.log('dsahdjashj') - // this.submitting = true + this.submitting = true - // if (!this.commitId) { - // const submitData = { - // planNo: this.paramsOptins.planNo, - // imgHost: this.getImgUrlList(this.imagesList), - // commonUserList: [], - // remark: this.inspectForm.remark.trim(), - // } - // const commitRes: any = await maintainCreate(submitData) - // this.commitId = commitRes && typeof commitRes === 'object' ? commitRes.id : commitRes - // } + if (!this.commitId) { + const submitData = { + planNo: this.paramsOptins.planNo, + imgHost: this.getImgUrlList(this.imagesList), + commonUserList: [], + remark: this.inspectForm.remark.trim(), + } + const commitRes: any = await maintainCreate(submitData) + this.commitId = commitRes && typeof commitRes === 'object' ? commitRes.id : commitRes + } - // if (dynamicValues.length > 0 && this.commitId) { - // await workRecordSubmit({ - // businessType: this.paramsOptins.businessType, - // bizType: 3, - // bizId: this.commitId, - // workTypeId: Number(this.paramsOptins.planTypeId), - // clientSeq: this.clientSeq, - // remark: this.inspectForm.remark.trim(), - // fields: dynamicValues - // }) - // } + if (dynamicValues.length > 0 && this.commitId) { + await workRecordSubmit({ + businessType: this.paramsOptins.businessType, + bizType: 3, + bizId: this.commitId, + workTypeId: Number(this.paramsOptins.planTypeId), + clientSeq: this.clientSeq, + remark: this.inspectForm.remark.trim(), + fields: dynamicValues + }) + } // 新增:调用【提交并结束】接口 await maintainCreateFinish({ - submitData + id: this.commitId }) uni.hideLoading() @@ -970,19 +969,19 @@ export default { }, 1000) } catch (error) { uni.hideLoading() - // if (Array.isArray(error)) return - // console.error('提交并结束失败', error) - // const backendMsg = error && error.msg - // if (this.commitId) { - // uni.showToast({ - // title: backendMsg ? `养护记录已提交:${backendMsg}` : '养护记录已提交,结束任务接口失败', - // icon: 'none', duration: 2500 - // }) - // } else if (!backendMsg) { - // uni.showToast({ title: '提交失败,请重试', icon: 'none', duration: 2000 }) - // } + if (Array.isArray(error)) return + console.error('提交并结束失败', error) + const backendMsg = error && error.msg + if (this.commitId) { + uni.showToast({ + title: backendMsg ? `养护记录已提交:${backendMsg}` : '养护记录已提交,结束任务接口失败', + icon: 'none', duration: 2500 + }) + } else if (!backendMsg) { + uni.showToast({ title: '提交失败,请重试', icon: 'none', duration: 2000 }) + } } finally { - // this.submitting = false + this.submitting = false } }, @@ -1188,6 +1187,7 @@ export default { .btn-item { flex: 1; height: 88rpx; + display: flex; align-items: center; justify-content: center;