Procházet zdrojové kódy

增加全天时间段处理,处理无考勤提示,修改补卡审批人问题

cyy před 1 rokem
rodič
revize
3b748e37f8

+ 3 - 2
src/views/platform/bpmn/my-reissue/components/reissueDialog.vue

@@ -231,7 +231,7 @@ export default {
       maxDate: new Date(),
       minTime: new Date(),
       maxTime: new Date(),
-      approver: ''
+      approver: []
     }
   },
   computed: {
@@ -297,7 +297,7 @@ export default {
               })
             } else {
               const midObj = this.isValidJSON(item.config_) ? JSON.parse(item.config_).scheduleShift.find(d => d.alias === dateArr[0]) : ''
-              const approver = this.isValidJSON(item.config_) ? JSON.parse(item.config_).approver : ''
+              const approver = this.isValidJSON(item.config_) ? JSON.parse(item.config_).approver : []
               midData.push({ name: dateArr[0], config: midObj, approver: approver })
               this.list.push({ text: dateArr[0], config: midObj, approver: approver })
             }
@@ -451,6 +451,7 @@ export default {
         // this.form.buKaShiJian = this.$methCommon.time(16)
         // this.xuanzeTime = new Date()
         this.xuanzeDate = new Date(this.selectDate)
+        this.approver = this.reissueData.approver
         const midStr = this.$common.getFormatDate('string', 10, this.xuanzeDate)
         const midDate = new Date(midStr)
         const midMax = this.$common.getFormatDate('string', 10, midDate.setDate(midDate.getDate() + 1))

+ 51 - 17
src/views/platform/bpmn/my-schedule/index.vue

@@ -89,7 +89,8 @@
               <div class="timeLine">
                 <div v-for="(m,n) in item.config.dateRange" :key="'time'+n">
                   <!-- {{ item.state && item.state.data }} -->
-                  <p>{{m.startTime}} — {{m.isSecondDay==='Y'?'第二天':''}}{{ m.endTime }}</p>
+                  <p v-if="m.type === 'range'">{{m.startTime}} — {{m.isSecondDay==='Y'?'第二天':''}}{{ m.endTime }}</p>
+                  <p v-else-if="m.type === 'allday'">全天</p>
                 </div>
               </div>
             </div>
@@ -160,7 +161,7 @@ export default {
       visibleShow: false,
       dialogData: {},
       clockTypeList: meth.clockTypeList,
-      reissueData: { clock: {}, config: {}, fid: '', name: '', state: {}},
+      reissueData: { clock: {}, config: {}, fid: '', name: '', state: {}, approver: [] },
       selectDate: '',
       reissueType: ''
     }
@@ -232,7 +233,7 @@ export default {
 
         this.schedule().then(res => {
           if (res.length > 0) {
-            let ind = 0
+            // const ind = 0
             const objArr = {}
             res.forEach((item, i) => {
               const dArr = this.generationDate(item.start_date_, item.end_date_)
@@ -242,9 +243,9 @@ export default {
                 const midReissueArr = reissueDataIn.filter(y => y.bu_ka_ri_qi_ === t && y.pai_ban_id_ === item.fid) || []
                 const isAbnormal = midClockArr.length > 0 ? midClockArr.filter(y => y.kao_qin_zhuang_ta === '异常' || !y.hasOwnProperty('da_ka_shi_jian_1_') || !y.hasOwnProperty('da_ka_shi_jian_2_')).length > 0 : true
                 const clockDataAll = { isAbnormal: isAbnormal, data: midClockArr }
-                if (midClockArr.length === 0) {
-                  ind = 1
-                }
+                // if (midClockArr.length === 0) {
+                //   ind = 1
+                // }
                 if (objArr.hasOwnProperty(t)) {
                   // const strArr = objArr[t].name.split(',')
                   // if (strArr.findIndex(e => e === (item['d' + (n + 1) + '_'] ? item['d' + (n + 1) + '_'] : '')) === -1) {
@@ -252,20 +253,30 @@ export default {
                   objArr[t].name = objArr[t].name + (item['d' + (n + 1) + '_'] !== '' && objArr[t].name !== '' ? ',' : '') + mid
                   // objArr[t].data.push({ name: mid, config: JSON.parse(item.config_) })
                   if (mid !== '' && mid.split(',').length === 1) {
-                    const midObj = this.isValidJSON(item.config_) ? JSON.parse(item.config_).scheduleShift.find(d => d.alias === mid) : ''
+                    const midObj = this.isValidJSON(item.config_) ? JSON.parse(item.config_).scheduleShift.find(d => d.alias === mid) : {}
+                    if (Object.keys(midObj).length > 0 && midObj.dateRange[0].type === 'allday') {
+                      midObj.dateRange[0].startTime = '00:00'
+                      midObj.dateRange[0].endTime = '24:00'
+                    }
+                    const approver = this.isValidJSON(item.config_) ? JSON.parse(item.config_).approver : []
                     const clockState = midClockArr.length > 0 ? this.judgeClockState(midClockArr, mid) : {}
                     const midUp = midReissueArr.filter(y => y.bu_ka_ban_ci_.includes(mid) && y.bu_ka_ban_ci_.includes('上班')) || []
                     const midDown = midReissueArr.filter(y => y.bu_ka_ban_ci_.includes(mid) && y.bu_ka_ban_ci_.includes('下班')) || []
 
-                    objArr[t].data.push({ name: mid, fid: item.fid, config: midObj, clock: clockDataAll, state: clockState, reissue: { up: midUp.length > 0, down: midDown.length > 0 }})
+                    objArr[t].data.push({ name: mid, fid: item.fid, config: midObj, clock: clockDataAll, state: clockState, reissue: { up: midUp.length > 0, down: midDown.length > 0 }, approver: approver })
                   } else if (mid !== '' && mid.split(',').length > 1) {
                     mid.split(',').forEach((x, y) => {
-                      const midObj = this.isValidJSON(item.config_) ? JSON.parse(item.config_).scheduleShift.find(d => d.alias === x) : ''
+                      const midObj = this.isValidJSON(item.config_) ? JSON.parse(item.config_).scheduleShift.find(d => d.alias === x) : {}
+                      if (Object.keys(midObj).length > 0 && midObj.dateRange[0].type === 'allday') {
+                        midObj.dateRange[0].startTime = '00:00'
+                        midObj.dateRange[0].endTime = '24:00'
+                      }
+                      const approver = this.isValidJSON(item.config_) ? JSON.parse(item.config_).approver : []
                       const clockState = midClockArr.length > 0 ? this.judgeClockState(midClockArr, x) : {}
                       const midUp = midReissueArr.filter(y => y.bu_ka_ban_ci_.includes(x) && y.bu_ka_ban_ci_.includes('上班')) || []
                       const midDown = midReissueArr.filter(y => y.bu_ka_ban_ci_.includes(x) && y.bu_ka_ban_ci_.includes('下班')) || []
 
-                      objArr[t].data.push({ name: x, fid: item.fid, config: midObj, clock: clockDataAll, state: clockState, reissue: { up: midUp.length > 0, down: midDown.length > 0 }})
+                      objArr[t].data.push({ name: x, fid: item.fid, config: midObj, clock: clockDataAll, state: clockState, reissue: { up: midUp.length > 0, down: midDown.length > 0 }, approver: approver })
                     })
                   }
                   // }
@@ -274,28 +285,38 @@ export default {
                   objArr[t] = { name: item['d' + (n + 1) + '_'] ? item['d' + (n + 1) + '_'] : '' }
                   objArr[t].data = []
                   if (objArr[t].name !== '' && objArr[t].name.split(',').length === 1) {
-                    const midObj = this.isValidJSON(item.config_) ? JSON.parse(item.config_).scheduleShift.find(d => d.alias === objArr[t].name) : ''
+                    const midObj = this.isValidJSON(item.config_) ? JSON.parse(item.config_).scheduleShift.find(d => d.alias === objArr[t].name) : {}
+                    if (Object.keys(midObj).length > 0 && midObj.dateRange[0].type === 'allday') {
+                      midObj.dateRange[0].startTime = '00:00'
+                      midObj.dateRange[0].endTime = '24:00'
+                    }
+                    const approver = this.isValidJSON(item.config_) ? JSON.parse(item.config_).approver : []
                     const clockState = midClockArr.length > 0 ? this.judgeClockState(midClockArr, objArr[t].name) : {}
                     const midUp = midReissueArr.filter(y => y.bu_ka_ban_ci_.includes(objArr[t].name) && y.bu_ka_ban_ci_.includes('上班')) || []
                     const midDown = midReissueArr.filter(y => y.bu_ka_ban_ci_.includes(objArr[t].name) && y.bu_ka_ban_ci_.includes('下班')) || []
 
-                    objArr[t].data = [{ name: objArr[t].name, fid: item.fid, config: midObj, clock: clockDataAll, state: clockState, reissue: { up: midUp.length > 0, down: midDown.length > 0 }}]
+                    objArr[t].data = [{ name: objArr[t].name, fid: item.fid, config: midObj, clock: clockDataAll, state: clockState, reissue: { up: midUp.length > 0, down: midDown.length > 0 }, approver: approver }]
                   } else if (objArr[t].name !== '' && objArr[t].name.split(',').length > 1) {
                     objArr[t].name.split(',').forEach((x, y) => {
-                      const midObj = this.isValidJSON(item.config_) ? JSON.parse(item.config_).scheduleShift.find(d => d.alias === x) : ''
+                      const midObj = this.isValidJSON(item.config_) ? JSON.parse(item.config_).scheduleShift.find(d => d.alias === x) : {}
+                      if (Object.keys(midObj).length > 0 && midObj.dateRange[0].type === 'allday') {
+                        midObj.dateRange[0].startTime = '00:00'
+                        midObj.dateRange[0].endTime = '24:00'
+                      }
+                      const approver = this.isValidJSON(item.config_) ? JSON.parse(item.config_).approver : []
                       const clockState = midClockArr.length > 0 ? this.judgeClockState(midClockArr, x) : {}
                       const midUp = midReissueArr.filter(y => y.bu_ka_ban_ci_.includes(x) && y.bu_ka_ban_ci_.includes('上班')) || []
                       const midDown = midReissueArr.filter(y => y.bu_ka_ban_ci_.includes(x) && y.bu_ka_ban_ci_.includes('下班')) || []
-                      objArr[t].data.push({ name: x, fid: item.fid, config: midObj, clock: clockDataAll, state: clockState, reissue: { up: midUp.length > 0, down: midDown.length > 0 }})
+                      objArr[t].data.push({ name: x, fid: item.fid, config: midObj, clock: clockDataAll, state: clockState, reissue: { up: midUp.length > 0, down: midDown.length > 0 }, approver: approver })
                     })
                   }
                 }
               })
             })
             console.log(objArr)
-            if (ind === 1) {
-              this.$toast('没有相应的考勤记录表数据,请联系开发人员!')
-            }
+            // if (ind === 1) {
+            //   this.$toast('没有相应的考勤记录表数据,请联系开发人员!')
+            // }
             this.homologousDate(this.dateArr, objArr)
           }
         })
@@ -317,6 +338,19 @@ export default {
             m.config['isSecondDayAll'] = mid.length > 0
           })
         }
+        if (this.showDateArr[selectDate]) {
+          let ind = 0
+          // console.log(this.showDateArr[selectDate].data, Object.keys(this.showDateArr[selectDate].data.state))
+          this.showDateArr[selectDate].data.forEach((item, i) => {
+            if (Object.keys(item.state).length === 0 || (item.state.data && Object.keys(item.state.data).length === 0)) {
+              ind = 1
+            }
+          })
+
+          if (ind === 1) {
+            this.$toast('没有相应的考勤记录表数据,请联系开发人员!')
+          }
+        }
         this.showInfo = true
       } else {
         this.showInfo = false