Sfoglia il codice sorgente

森语-请假单-保存校验

jbb 2 anni fa
parent
commit
4f531b0ebe
1 ha cambiato i file con 21 aggiunte e 1 eliminazioni
  1. 21 1
      src/views/activiti/form/demoForm2.vue

+ 21 - 1
src/views/activiti/form/demoForm2.vue

@@ -657,6 +657,7 @@ export default {
                     if (res.success) {
                       //选择姓名获取页面的请假类型和时间间隔
                       that.leave = res.result.nannualNowNum
+                      that.$refs.KFB.setData({leave_remaining: that.leave})
                       var category = that.$refs.KFB.form.getFieldValue('leave_category')
                       var time1 = that.$refs.KFB.form.getFieldValue('start_date')
                       var time2 = that.$refs.KFB.form.getFieldValue('end_date')
@@ -886,10 +887,26 @@ export default {
         },
         // handler
         handleSubmit (e) {
+            
             // return new Promise((resolve)=>{
             // 通过函数获取数据
             this.$refs.KFB.getData()
                 .then(res => {
+                    var addForm = 'no'
+                 if(this.processData.businessTable == 'employee_leave'){
+                    var estimate = this.$refs.KFB.form.getFieldValue('leave_days'),
+                   //   actual = that.$refs.KFB.form.getFieldValue('practical_leave'),
+                    leaveCategory = this.$refs.KFB.form.getFieldValue('leave_category')
+                     debugger
+                    if(leaveCategory=='2' && !estimate){
+                      this.$message.error('请填写预计请假时长!')
+                      addForm = 'yes'
+                     }
+                      if(estimate>this.leave){
+                      this.$message.error('年假天数不足!')
+                      addForm = 'yes'
+                     }
+                     }
                   let formData1 = JSON.parse(JSON.stringify(res))
                   console.log("orl",formData1)
                     // 处理手机端子表数据
@@ -959,7 +976,6 @@ export default {
                     console.log(formData)
                     // 子表数据
                     // 调用保存接口
-                    this.btndisabled = true
                     this.todoManageOperationObject.formData = formData
                     this.todoManageOperationObject.url = url
                     // formData.jsonContent=JSON.stringify(this.jsonData).toString()
@@ -981,6 +997,8 @@ export default {
                     }
                     this.todoManageOperationObject.jsonData = jsonPamats
                     // 非我的待办节点打卡表单界面
+                    if(addForm=='no'){
+                    this.btndisabled = true
                     postFormDataAction(url, formData, { jsonContent: jsonPamats })
                         .then(res => {
                             if (res.success) {
@@ -999,6 +1017,7 @@ export default {
                             this.btndisabled = false
                             // resolve(false);
                         })
+                    }
                 })
                 .catch(err => {
                     console.log(err, '校验失败')
@@ -1008,6 +1027,7 @@ export default {
         },
         // 我的待办点击通过保存专用
         handleSubmit2 (e) {
+            debugger
             // return new Promise((resolve)=>{
             // 通过函数获取数据
             this.$refs.KFB.getData()