crm_second_opening_mini/pagesA/punchclock/clockrules/addClocktime.js

1 line
6.5 KiB
JavaScript
Raw Normal View History

2023-03-13 01:13:08 +00:00
require('../../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pagesA/punchclock/clockrules/addClocktime"],{"19b3":function(t,e,n){"use strict";(function(t,e){var i=n("4ea4");n("8886");i(n("66fd"));var s=i(n("6bdf"));t.__webpack_require_UNI_MP_PLUGIN__=n,e(s.default)}).call(this,n("bc2e")["default"],n("543d")["createPage"])},"47fe":function(t,e,n){"use strict";var i=n("5c8f"),s=n.n(i);s.a},"555b":function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n("0c59"),s=n("dc92"),r={data:function(){return{noClick:!0,BASE_IMG_URL:i.BASE_IMG_URL,arr:[{name:"一",isSet:!1,select:!0,en:"monday"},{name:"二",isSet:!1,select:!0,en:"tuesday"},{name:"三",isSet:!1,select:!0,en:"wednesday"},{name:"四",isSet:!1,select:!0,en:"thursday"},{name:"五",isSet:!1,select:!0,en:"friday"},{name:"六",isSet:!1,select:!1,en:"saturday"},{name:"日",isSet:!1,select:!1,en:"weekday"}],timeArr:[{start_time:"09:00",ustart_time:"07:59",uend_time:"08:59",start_next:0,start_status:0,end_time:"17:00",dstart_time:"17:01",dend_time:"17:59",end_next:0,end_status:0}],isProblem:!1,problemTit:"",number:null}},onLoad:function(e){e.number&&(this.number=e.number),t.removeStorageSync("timeArr"),this.getData()},onShow:function(){t.getStorageSync("timeArr")&&(this.timeArr=t.getStorageSync("timeArr"))},methods:{getDetail:function(){var t=this;(0,s.netTimeSlotDetail)({number:this.number}).then((function(e){e=e.data,t.timeArr=e.time;var n=t.arr;n.forEach((function(t){1==e[t.en]&&t.isSet&&(t.isSet=!1,t.select=!0)})),t.arr=n}))},getData:function(){var t=this;(0,s.netisSetTimeslot)().then((function(e){e=e.data;var n=t.arr,i=function(t){n.forEach((function(n,i){n.en==t&&(n.isSet=1==e[t]),n.select=!1}))};for(var s in e)i(s);t.arr=n,t.number&&t.getDetail()}))},selectWeek:function(t){var e=this.arr[t];e.isSet||(e.select=!e.select,this.$set(this.arr,t,e))},toAddClock:function(){var t,e,n,i,s=this.timeArr[this.timeArr.length-1],r=Number(s.end_time.substring(0,2)),a=null,o=null,l=0,c=0;23==r?(a="00",o="01",l=1,c=1,t="22:59",e="01:59",n="01:01",i="01:59"):a<23&&0==s.end_next?(a=this.handleTime(r+1),o=this.handleTime(r+2),t=this.handleTime(r-1)+":59",e=this.handleTime(r)+":59",n=this.handleTime(r+2)+":01",i=this.handleTime(r+2)+":59"):a<23&&1==s.end_next&&(a=this.handleTime(r+1),o=this.handleTime(r+2),l=1,c=1,t=this.handleTime(r-1)+":59",e=this.handleTime(r)+":59",n=this.handleTime(r+2)+":01",i=this.handleTime(r+2)+":59");var m={start_time:a+":00",start_next:l,ustart_time:t,uend_time:e,end_time:o+":00",dstart_time:n,dend_time:i,end_next:c,start_status:0,end_status:0};this.timeArr.push(m)},delClock:function(t){this.timeArr.splice(t,1)},changeGoto:function(e,n){var i=e.detail.value,s=this.timeArr[n];if(s.start_time=i,1!=s.end_next){var r=s.start_time.split(":"),a=s.end_time.split(":"),o=new Date;if(o.setHours(r[0],r[1])>o.setHours(a[0],a[1])?(t.showToast({title:"上班时间应该早于下班时间",icon:"none"}),this.isProblem=!0,this.problemTit="上班时间应该早于下班时间"):(this.isProblem=!1,this.problemTit=""),0!=n){var l=this.timeArr[n-1];i<l.end_time&&(s.start_next=1,s.end_next=1)}}else if(1==s.end_next&&n>0){var c=this.timeArr[n-1],m=s.start_time.split(":"),u=c.end_time.split(":"),h=new Date;h.setHours(m[0],m[1])<h.setHours(u[0],u[1])?(t.showToast({title:"上班时间应该大于上一段的下班时间",icon:"none"}),this.isProblem=!0,this.problemTit="上班时间应该大于上一段的下班时间"):(s.start_next=0,this.isProblem=!0,this.problemTit="")}this.$set(this.timeArr,n,s)},changeGoOff:function(e,n){var i=this,s=e.detail.value,r=this.timeArr[n];r.end_time=s;var a=r.start_time.split(":"),o=r.end_time.split(":"),l=new Date;if(0==r.start_next&&0==r.end_next&&l.setHours(a[0],a[1])>l.setHours(o[0],o[1])&&(r.end_next=1),(1==r.start_next&&1==r.end_next||0==r.start_next&&0==r.end_next)&&(l.setHours(a[0],a[1])>l.setHours(o[0],o[1])?(t.showToast({title:"上班时间应该早于下班时间",icon:"none"}),this.isProblem=!0,this.problemTit="上班时间应该早于下班时间"):(thi