Prechádzať zdrojové kódy

移动端提价工作事项的必填项

Lijy 1 rok pred
rodič
commit
4f0744036a

+ 41 - 2
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/weekEdit.vue

@@ -1633,10 +1633,10 @@
             // 提交日报
             submitReport() {
                 this.form[this.inbtn] = this.currentForm
+                const { allday, workContentState } = this.user.timeType // 系统设置的每日工作时间
 
                 // 针对物奇做的判断
                 if(this.user.timeType.enableNewWeeklyfill == 1){
-                    const { allday } = this.user.timeType // 系统设置的每日工作时间
                     const { next, error, group } = this.judgeStrange(this.form)
                     if(!next){
                         if(error.length > 0) {
@@ -1648,7 +1648,16 @@
                         return
                     }
                 }
-
+                console.log(workContentState)
+                // 判断工作事项是否为必填
+                if(workContentState == '1') {
+                    const { error, next } = this.judgeWorkContent(this.form)
+                    if(!next) {
+                        this.$toast(`【${error.join('、')}】请工作事项`)
+                        return
+                    }
+                }
+                
                 //检查子项目
                 if (this.user.timeType.subProMustFill == 1) {
                     for(let i in this.form){
@@ -2133,6 +2142,36 @@
                     }
                 }
             },
+            // 提交数据,工作事项的判断
+            judgeWorkContent(from) {
+                console.log(from, '<======== 要判断的fom表单')
+                const newFrom = JSON.parse(JSON.stringify(from))
+                const arrList = []
+                for(var i in newFrom) {
+                    const { domains, createDate } = newFrom[i]
+                    for(var j in domains) {
+                        if(domains[j].projectId && !domains[j].content) {
+                            arrList.push({
+                                dateTime: createDate,
+                                projectName: domains[j].projectName,
+                                weeks: this.getNewWeek(createDate)
+                            })
+                        }
+                    }
+                }
+                console.log(arrList.map(item => `【${item.dateTime} ${item.weeks} 中的 (${item.projectName})项目】`), '查看对象')
+                if(arrList.length > 0) {
+                    return {
+                        next: false,
+                        error: arrList.map(item => `【${item.dateTime} ${item.weeks} 中的 (${item.projectName})项目】`),
+                    }
+                } else {
+                    return {
+                        next: true,
+                        error: [],
+                    }
+                }
+            },
             // 判断是否小于系统设置的每日工作时间
             judgmentData(data) {
                 const { allday } = this.user.timeType // 系统设置的每日工作时间