Commit c4409bc792907b7dad17413b5ed7c1228e5a6ffe
1 parent
7da61cdb
养护计划
Showing
1 changed file
with
37 additions
and
37 deletions
pages-sub/daily/maintain-manage/add-record.vue
| @@ -924,7 +924,7 @@ export default { | @@ -924,7 +924,7 @@ export default { | ||
| 924 | }, | 924 | }, |
| 925 | 925 | ||
| 926 | async submitAndFinish() { | 926 | async submitAndFinish() { |
| 927 | - | 927 | + if (this.submitting) return |
| 928 | try { | 928 | try { |
| 929 | await this.$refs.inspectFormRef.validate() | 929 | await this.$refs.inspectFormRef.validate() |
| 930 | const dynamicValues = this.buildDynamicFields() | 930 | const dynamicValues = this.buildDynamicFields() |
| @@ -932,35 +932,34 @@ export default { | @@ -932,35 +932,34 @@ export default { | ||
| 932 | this.clientSeq = this.genClientSeq() | 932 | this.clientSeq = this.genClientSeq() |
| 933 | } | 933 | } |
| 934 | uni.showLoading({ title: '提交中...' }) | 934 | uni.showLoading({ title: '提交中...' }) |
| 935 | - console.log('dsahdjashj') | ||
| 936 | - // this.submitting = true | 935 | + this.submitting = true |
| 937 | 936 | ||
| 938 | - // if (!this.commitId) { | ||
| 939 | - // const submitData = { | ||
| 940 | - // planNo: this.paramsOptins.planNo, | ||
| 941 | - // imgHost: this.getImgUrlList(this.imagesList), | ||
| 942 | - // commonUserList: [], | ||
| 943 | - // remark: this.inspectForm.remark.trim(), | ||
| 944 | - // } | ||
| 945 | - // const commitRes: any = await maintainCreate(submitData) | ||
| 946 | - // this.commitId = commitRes && typeof commitRes === 'object' ? commitRes.id : commitRes | ||
| 947 | - // } | 937 | + if (!this.commitId) { |
| 938 | + const submitData = { | ||
| 939 | + planNo: this.paramsOptins.planNo, | ||
| 940 | + imgHost: this.getImgUrlList(this.imagesList), | ||
| 941 | + commonUserList: [], | ||
| 942 | + remark: this.inspectForm.remark.trim(), | ||
| 943 | + } | ||
| 944 | + const commitRes: any = await maintainCreate(submitData) | ||
| 945 | + this.commitId = commitRes && typeof commitRes === 'object' ? commitRes.id : commitRes | ||
| 946 | + } | ||
| 948 | 947 | ||
| 949 | - // if (dynamicValues.length > 0 && this.commitId) { | ||
| 950 | - // await workRecordSubmit({ | ||
| 951 | - // businessType: this.paramsOptins.businessType, | ||
| 952 | - // bizType: 3, | ||
| 953 | - // bizId: this.commitId, | ||
| 954 | - // workTypeId: Number(this.paramsOptins.planTypeId), | ||
| 955 | - // clientSeq: this.clientSeq, | ||
| 956 | - // remark: this.inspectForm.remark.trim(), | ||
| 957 | - // fields: dynamicValues | ||
| 958 | - // }) | ||
| 959 | - // } | 948 | + if (dynamicValues.length > 0 && this.commitId) { |
| 949 | + await workRecordSubmit({ | ||
| 950 | + businessType: this.paramsOptins.businessType, | ||
| 951 | + bizType: 3, | ||
| 952 | + bizId: this.commitId, | ||
| 953 | + workTypeId: Number(this.paramsOptins.planTypeId), | ||
| 954 | + clientSeq: this.clientSeq, | ||
| 955 | + remark: this.inspectForm.remark.trim(), | ||
| 956 | + fields: dynamicValues | ||
| 957 | + }) | ||
| 958 | + } | ||
| 960 | 959 | ||
| 961 | // 新增:调用【提交并结束】接口 | 960 | // 新增:调用【提交并结束】接口 |
| 962 | await maintainCreateFinish({ | 961 | await maintainCreateFinish({ |
| 963 | - submitData | 962 | + id: this.commitId |
| 964 | }) | 963 | }) |
| 965 | 964 | ||
| 966 | uni.hideLoading() | 965 | uni.hideLoading() |
| @@ -970,19 +969,19 @@ export default { | @@ -970,19 +969,19 @@ export default { | ||
| 970 | }, 1000) | 969 | }, 1000) |
| 971 | } catch (error) { | 970 | } catch (error) { |
| 972 | uni.hideLoading() | 971 | uni.hideLoading() |
| 973 | - // if (Array.isArray(error)) return | ||
| 974 | - // console.error('提交并结束失败', error) | ||
| 975 | - // const backendMsg = error && error.msg | ||
| 976 | - // if (this.commitId) { | ||
| 977 | - // uni.showToast({ | ||
| 978 | - // title: backendMsg ? `养护记录已提交:${backendMsg}` : '养护记录已提交,结束任务接口失败', | ||
| 979 | - // icon: 'none', duration: 2500 | ||
| 980 | - // }) | ||
| 981 | - // } else if (!backendMsg) { | ||
| 982 | - // uni.showToast({ title: '提交失败,请重试', icon: 'none', duration: 2000 }) | ||
| 983 | - // } | 972 | + if (Array.isArray(error)) return |
| 973 | + console.error('提交并结束失败', error) | ||
| 974 | + const backendMsg = error && error.msg | ||
| 975 | + if (this.commitId) { | ||
| 976 | + uni.showToast({ | ||
| 977 | + title: backendMsg ? `养护记录已提交:${backendMsg}` : '养护记录已提交,结束任务接口失败', | ||
| 978 | + icon: 'none', duration: 2500 | ||
| 979 | + }) | ||
| 980 | + } else if (!backendMsg) { | ||
| 981 | + uni.showToast({ title: '提交失败,请重试', icon: 'none', duration: 2000 }) | ||
| 982 | + } | ||
| 984 | } finally { | 983 | } finally { |
| 985 | - // this.submitting = false | 984 | + this.submitting = false |
| 986 | } | 985 | } |
| 987 | }, | 986 | }, |
| 988 | 987 | ||
| @@ -1188,6 +1187,7 @@ export default { | @@ -1188,6 +1187,7 @@ export default { | ||
| 1188 | .btn-item { | 1187 | .btn-item { |
| 1189 | flex: 1; | 1188 | flex: 1; |
| 1190 | height: 88rpx; | 1189 | height: 88rpx; |
| 1190 | + | ||
| 1191 | display: flex; | 1191 | display: flex; |
| 1192 | align-items: center; | 1192 | align-items: center; |
| 1193 | justify-content: center; | 1193 | justify-content: center; |