|
@@ -109,15 +109,89 @@ Page({
|
|
|
})
|
|
})
|
|
|
this.updateNode()
|
|
this.updateNode()
|
|
|
},
|
|
},
|
|
|
|
|
+ // 校验必填项
|
|
|
|
|
+ validateRequiredFields() {
|
|
|
|
|
+ const workpreset = this.data.mainData.workpresetjson
|
|
|
|
|
+ const errors = []
|
|
|
|
|
+
|
|
|
|
|
+ if (workpreset.confirm == 11 && !this.data.form.confirm_value) {
|
|
|
|
|
+ errors.push('是否确认')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (workpreset.fileupload == 11) {
|
|
|
|
|
+ const uploadComponent = this.selectComponent('#fileUpload')
|
|
|
|
|
+ if (uploadComponent && (!uploadComponent.data.originFiles || uploadComponent.data.originFiles.length === 0)) {
|
|
|
|
|
+ errors.push('上传附件')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (workpreset.textedit == 11 && !this.data.form.textcontent) {
|
|
|
|
|
+ errors.push('文本信息')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (workpreset.contractupload == 11) {
|
|
|
|
|
+ const contractUploadComponent = this.selectComponent('#contractUpload')
|
|
|
|
|
+ if (contractUploadComponent && (!contractUploadComponent.data.originFiles || contractUploadComponent.data.originFiles.length === 0)) {
|
|
|
|
|
+ errors.push('上传合同')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (workpreset.amountpay == 11 && (!this.data.form.amount || this.data.form.amount == 0)) {
|
|
|
|
|
+ errors.push('是否有偿')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (workpreset.signature == 11) {
|
|
|
|
|
+ const signNameComponent = this.selectComponent('#signName')
|
|
|
|
|
+ if (signNameComponent && (!signNameComponent.data.originFiles || signNameComponent.data.originFiles.length === 0)) {
|
|
|
|
|
+ errors.push('客户签字')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (workpreset.addperson == 11 && (!this.data.mainData.trainers || this.data.mainData.trainers.length === 0)) {
|
|
|
|
|
+ errors.push('培训人员')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (workpreset.additem == 11 && (!this.data.titems || this.data.titems.length === 0)) {
|
|
|
|
|
+ errors.push('工单物料')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return errors
|
|
|
|
|
+ },
|
|
|
confirmBill() {
|
|
confirmBill() {
|
|
|
|
|
+ const errors = this.validateRequiredFields()
|
|
|
|
|
+ if (errors.length > 0) {
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '必填信息未完善',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration: 2000
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
this.data.form.isconfirm = 1
|
|
this.data.form.isconfirm = 1
|
|
|
this.setData({
|
|
this.setData({
|
|
|
form: this.data.form
|
|
form: this.data.form
|
|
|
})
|
|
})
|
|
|
this.updateNode()
|
|
this.updateNode()
|
|
|
},
|
|
},
|
|
|
|
|
+ // 保存节点(不校验)
|
|
|
|
|
+ saveNode(e) {
|
|
|
|
|
+ this.updateNode(false, e)
|
|
|
|
|
+ },
|
|
|
// 更新节点
|
|
// 更新节点
|
|
|
- async updateNode(e) {
|
|
|
|
|
|
|
+ async updateNode(needValidate = false, e) {
|
|
|
|
|
+ if (needValidate) {
|
|
|
|
|
+ const errors = this.validateRequiredFields()
|
|
|
|
|
+ if (errors.length > 0) {
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '必填信息未完善',
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration: 2000
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
this.data.form.traintitem = this.data.titems
|
|
this.data.form.traintitem = this.data.titems
|
|
|
this.data.form.sa_workorderid = this.data.sa_workorderid
|
|
this.data.form.sa_workorderid = this.data.sa_workorderid
|
|
|
this.data.form.sa_workorder_nodeid = this.data.sa_workorder_nodeid
|
|
this.data.form.sa_workorder_nodeid = this.data.sa_workorder_nodeid
|
|
@@ -132,7 +206,7 @@ Page({
|
|
|
})
|
|
})
|
|
|
this.addUser(false);
|
|
this.addUser(false);
|
|
|
}
|
|
}
|
|
|
- if (e && e.currentTarget.dataset.info === 'needBack') {
|
|
|
|
|
|
|
+ if (e && e.currentTarget && e.currentTarget.dataset.info === 'needBack') {
|
|
|
wx.navigateBack()
|
|
wx.navigateBack()
|
|
|
} else {
|
|
} else {
|
|
|
this.nodeDetail()
|
|
this.nodeDetail()
|