Browse Source

提交 h5 的添加项目控制

Lijy 2 weeks ago
parent
commit
c266ba8944
1 changed files with 23 additions and 2 deletions
  1. 23 2
      fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

+ 23 - 2
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

@@ -505,7 +505,7 @@
                 </van-cell-group>
 
             </div>
-            <div style="text-align:center;" v-if="canEdit">
+            <div style="text-align:center;" v-if="showAddMore">
                 <van-tag size="large"
                     style="text-align:center;margin:10px;padding:12px;margin-bottom:120px;border: 1px solid #20a0ff;"
                     @click="addNewPro" icon="plus" color="#ffffff"><span
@@ -729,7 +729,9 @@ export default {
             }, //  代填人员信息
 
             userReportDeptList: [], // 可选部门
-            showSelectDeptPopup: false
+            showSelectDeptPopup: false,
+
+            showAddMore: false
         };
     },
 
@@ -1586,6 +1588,9 @@ export default {
                     if (res.code == "ok") {
                         var t = res.data;
                         this.reportTimeType = t;
+                        if (this.reportTimeType.type > 0) {
+                            this.showAddMore = true;
+                        }
                         //转化时间格式
                         if (t.allday != null) {
                             this.timeType.push({ value: 0, label: '全天 - ' + t.allday + '小时', hours: t.allday });
@@ -2427,6 +2432,14 @@ export default {
             }
 
             this.form.domains.push(item)
+            if (this.reportTimeType.type == 0) {
+                //全天上下午模式下,检测时间段数量,达到2个,不能再加了
+                var length =  this.form.domains.length;
+                if (length == 2) {
+                    this.showAddMore = false;
+                }
+            }
+
             //重新计算总时长
             this.setTotalReportHours();
             this.canEdit = true
@@ -2440,6 +2453,14 @@ export default {
                 message: '是否移除当前项目'
             }).then(() => {
                 this.form.domains.splice(i, 1);
+                //检测当前剩下的一个,时间类型是否是全天
+                if (this.reportTimeType.type == 0) {
+                    if (this.form.domains[0].timeType == 0) {
+                        this.showAddMore = false;
+                    } else {
+                        this.showAddMore = true;
+                    }
+                }
                 //重新计算总时长
                 this.setTotalReportHours();
             }).catch(() => {