|
|
@@ -132,6 +132,21 @@
|
|
|
};
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
+ uni.removeStorageSync("chooseList_edit")
|
|
|
+ uni.$on('updateRuleName', (data) => {
|
|
|
+ this.ruleName = data
|
|
|
+ })
|
|
|
+
|
|
|
+ uni.$on('updateRuleGroup', (data) => {
|
|
|
+ let temList = []
|
|
|
+ data.forEach((ele) => {
|
|
|
+ temList.push(
|
|
|
+ ele.name
|
|
|
+ )
|
|
|
+ })
|
|
|
+ this.group = temList.join(",")
|
|
|
+ })
|
|
|
+
|
|
|
this.info = JSON.parse(option.info)
|
|
|
console.log(this.info);
|
|
|
if (this.info) {
|
|
|
@@ -153,71 +168,159 @@
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
|
|
- let ruleName = uni.getStorageSync("ruleName")
|
|
|
- if (ruleName) {
|
|
|
- this.ruleName = ruleName
|
|
|
- }
|
|
|
-
|
|
|
- let ruleGroup = uni.getStorageSync("ruleGroup")
|
|
|
- if (ruleGroup) {
|
|
|
+ let rulePlace = uni.getStorageSync("chooseList") || uni.getStorageSync("chooseList_edit")
|
|
|
+ if (rulePlace) {
|
|
|
let temList = []
|
|
|
- this.groupIds = []
|
|
|
- ruleGroup.forEach((ele) => {
|
|
|
+ rulePlace.forEach((ele) => {
|
|
|
temList.push(ele.name)
|
|
|
- this.groupIds.push(ele.id)
|
|
|
})
|
|
|
- this.group = temList.join(",")
|
|
|
+ this.place = temList.join(",")
|
|
|
}
|
|
|
+
|
|
|
+ // let ruleTime = uni.getStorageSync("ruleTime_edit")
|
|
|
+ // console.log(ruleTime);
|
|
|
+ // if (ruleTime) {
|
|
|
+ // this.time = ruleTime
|
|
|
+ // let temList = []
|
|
|
+ // ruleTime.forEach((ele) => {
|
|
|
+ // temList.push({
|
|
|
+ // dayOfWeeks: ele.selectedWeeks,
|
|
|
+ // periods: ele.list
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // temList.forEach((item) => {
|
|
|
+ // item.dayOfWeeks = item.dayOfWeeks.map((element) => {
|
|
|
+ // if (element == '星期一') {
|
|
|
+ // return element = 1
|
|
|
+ // }
|
|
|
+ // if (element == '星期二') {
|
|
|
+ // return element = 2
|
|
|
+ // }
|
|
|
+ // if (element == '星期三') {
|
|
|
+ // return element = 3
|
|
|
+ // }
|
|
|
+ // if (element == '星期四') {
|
|
|
+ // return element = 4
|
|
|
+ // }
|
|
|
+ // if (element == '星期五') {
|
|
|
+ // return element = 5
|
|
|
+ // }
|
|
|
+ // if (element == '星期六') {
|
|
|
+ // return element = 6
|
|
|
+ // }
|
|
|
+ // if (element == '星期天') {
|
|
|
+ // return element = 7
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // this.timeGroups = temList
|
|
|
+ // }
|
|
|
+ // let ruleName = uni.getStorageSync("ruleName")
|
|
|
+ // if (ruleName) {
|
|
|
+ // this.ruleName = ruleName
|
|
|
+ // }
|
|
|
|
|
|
- let ruleTime = uni.getStorageSync("ruleTime")
|
|
|
- let flag = uni.getStorageSync("flag")
|
|
|
- console.log(ruleTime);
|
|
|
- console.log(flag);
|
|
|
- if (ruleTime.length == 0 && flag) {
|
|
|
- this.time = "未设置"
|
|
|
- }
|
|
|
- if (ruleTime.length > 0) {
|
|
|
- this.time = ruleTime[0].selectedWeeks
|
|
|
- this.periods = ruleTime[0].list
|
|
|
- // this.time = ruleTime
|
|
|
- // let temList = []
|
|
|
- // ruleTime.forEach((ele) => {
|
|
|
- // temList.push({
|
|
|
- // dayOfWeeks: ele.selectedWeeks,
|
|
|
- // periods: ele.list
|
|
|
- // })
|
|
|
- // })
|
|
|
- // temList.forEach((item) => {
|
|
|
- // item.dayOfWeeks = item.dayOfWeeks.map((element) => {
|
|
|
- // if (element == '星期一') {
|
|
|
- // return element = 1
|
|
|
- // }
|
|
|
- // if (element == '星期二') {
|
|
|
- // return element = 2
|
|
|
- // }
|
|
|
- // if (element == '星期三') {
|
|
|
- // return element = 3
|
|
|
- // }
|
|
|
- // if (element == '星期四') {
|
|
|
- // return element = 4
|
|
|
- // }
|
|
|
- // if (element == '星期五') {
|
|
|
- // return element = 5
|
|
|
- // }
|
|
|
- // if (element == '星期六') {
|
|
|
- // return element = 6
|
|
|
- // }
|
|
|
- // if (element == '星期天') {
|
|
|
- // return element = 7
|
|
|
- // }
|
|
|
- // })
|
|
|
- // })
|
|
|
- // this.timeGroups = temList
|
|
|
- }
|
|
|
+ // let ruleGroup = uni.getStorageSync("ruleGroup")
|
|
|
+ // if (ruleGroup) {
|
|
|
+ // let temList = []
|
|
|
+ // this.groupIds = []
|
|
|
+ // ruleGroup.forEach((ele) => {
|
|
|
+ // temList.push(ele.name)
|
|
|
+ // this.groupIds.push(ele.id)
|
|
|
+ // })
|
|
|
+ // this.group = temList.join(",")
|
|
|
+ // }
|
|
|
+
|
|
|
+ let ruleTime = uni.getStorageSync("ruleTime")
|
|
|
+ let flag = uni.getStorageSync("flag")
|
|
|
+ console.log(ruleTime);
|
|
|
+ console.log(flag);
|
|
|
+ if (ruleTime.length == 0 && flag) {
|
|
|
+ this.time = "未设置"
|
|
|
+ }
|
|
|
+ if (ruleTime.length > 0) {
|
|
|
+ this.time = ruleTime[0].selectedWeeks
|
|
|
+ this.periods = ruleTime[0].list
|
|
|
+ this.time = ruleTime
|
|
|
+ let temList = []
|
|
|
+ ruleTime.forEach((ele) => {
|
|
|
+ temList.push({
|
|
|
+ dayOfWeeks: ele.selectedWeeks,
|
|
|
+ periods: ele.list
|
|
|
+ })
|
|
|
+ })
|
|
|
+ temList.forEach((item) => {
|
|
|
+ item.dayOfWeeks = item.dayOfWeeks.map((element) => {
|
|
|
+ if (element == '星期一') {
|
|
|
+ return element = 1
|
|
|
+ }
|
|
|
+ if (element == '星期二') {
|
|
|
+ return element = 2
|
|
|
+ }
|
|
|
+ if (element == '星期三') {
|
|
|
+ return element = 3
|
|
|
+ }
|
|
|
+ if (element == '星期四') {
|
|
|
+ return element = 4
|
|
|
+ }
|
|
|
+ if (element == '星期五') {
|
|
|
+ return element = 5
|
|
|
+ }
|
|
|
+ if (element == '星期六') {
|
|
|
+ return element = 6
|
|
|
+ }
|
|
|
+ if (element == '星期天') {
|
|
|
+ return element = 7
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.timeGroups = temList
|
|
|
+ }
|
|
|
+ console.log(this.periods);
|
|
|
+ console.log(this.time);
|
|
|
},
|
|
|
methods: {
|
|
|
// 点击确认按钮回调
|
|
|
handleConfirm() {
|
|
|
+ if (this.ruleName == '未设置') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请设置规则名称",
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.group == '未设置') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请设置考勤组",
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.time == '未设置') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请设置打卡时间",
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.place == '未设置' || this.place == "") {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请设置打卡地点",
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.value == '未设置') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请设置提前通知时间",
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
|
content: '确定修改吗?',
|
|
|
@@ -265,7 +368,6 @@
|
|
|
this.value = this.array[index]
|
|
|
let index2 = this.value.indexOf("分", 0)
|
|
|
this.value = this.value.substring(0, index2);
|
|
|
- uni.setStorageSync("ruleValue", this.value)
|
|
|
},
|
|
|
// 点击规则名称跳转回调
|
|
|
goPageRuleName() {
|
|
|
@@ -285,20 +387,20 @@
|
|
|
let periods = []
|
|
|
let time = []
|
|
|
uni.navigateTo({
|
|
|
- url: `/pages/punchTime/punchTime?time=${time}&periods=${periods}`
|
|
|
+ url: `/pages/punchTime/punchTime?time=${time}&periods=${periods}&type=1`
|
|
|
})
|
|
|
} else {
|
|
|
let periods = JSON.stringify(this.periods)
|
|
|
let time = JSON.stringify(this.time)
|
|
|
uni.navigateTo({
|
|
|
- url: `/pages/punchTime/punchTime?time=${time}&periods=${periods}`
|
|
|
+ url: `/pages/punchTime/punchTime?time=${time}&periods=${periods}&type=1`
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
// 点击打卡地点跳转回调
|
|
|
goPagePunchLocation() {
|
|
|
uni.navigateTo({
|
|
|
- url: "/pages/punchLocation/punchLocation"
|
|
|
+ url: `/pages/punchLocation/punchLocation?id=${this.id}&type=1`
|
|
|
})
|
|
|
},
|
|
|
// 格式化时间
|