| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- <template>
- <view class="container">
- <!-- 每一个选项区域 -->
- <view class="box">
- <view class="name">
- 规则名称:
- </view>
- <view class="val" @click="goPageRuleName">
- <view class="ele" v-if="ruleName=='未设置'">
- {{ruleName}}
- </view>
- <view class="ele black" v-else>
- {{ruleName}}
- </view>
- <view class="right">
- <img src="../../static/right.png">
- </view>
- </view>
- </view>
- <view class="box">
- <view class="name">
- 考 勤 组:
- </view>
- <view class="val" @click="goPageGroup">
- <view class="ele" v-if="group=='未设置'">
- {{group}}
- </view>
- <view class="ele black" v-else>
- {{group}}
- </view>
- <view class="right">
- <img src="../../static/right.png">
- </view>
- </view>
- </view>
- <view class="box">
- <view class="name">
- 打卡时间:
- </view>
- <view class="val" @click="goPagePunchTime">
- <view class="ele" v-if="time=='未设置'">
- {{time}}
- </view>
- <view class="ele black" v-else>
- <span>{{time}}</span>
- <span v-for="(item,index) in periods" :key="index">
- {{format_time(item.beginTime)}}-{{format_time(item.endTime)}}
- </span>
- </view>
- <view class="right">
- <img src="../../static/right.png">
- </view>
- </view>
- </view>
- <view class="box">
- <view class="name">
- 打卡地点:
- </view>
- <view class="val" @click="goPagePunchLocation">
- <view class="ele" v-if="place=='未设置'">
- {{place}}
- </view>
- <view class="ele black" v-else>
- {{place}}
- </view>
- <view class="right">
- <img src="../../static/right.png">
- </view>
- </view>
- </view>
- <view class="box">
- <view class="name">
- 提前通知:
- </view>
- <picker :value="index" :range="array" @change="changeSelect">
- <view class="val">
- <view class="ele" v-if="value=='未设置'">
- {{value}}
- </view>
- <view class="ele black" v-else>
- {{value}}分钟
- </view>
- <view class="right">
- <img src="../../static/right.png">
- </view>
- </view>
- </picker>
- </view>
- <!-- 确认按钮区域 -->
- <view class="button" @click="handleConfirm">
- 确认
- </view>
- <!-- 删除按钮区域 -->
- <view class="button2" @click="handleDelete">
- 删除
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- info: {},
- // 规则名称
- ruleName: "未设置",
- // 考勤组
- group: "未设置",
- // 打卡时间
- time: "未设置",
- // 打卡地点
- place: "未设置",
- // 提前通知
- value: "未设置",
- // 提前通知选项
- array: ['5分钟', '10分钟', '15分钟', '20分钟'],
- periods: [],
- index: 0,
- id: ""
- };
- },
- onLoad(option) {
- uni.$on('updateRuleName', (data) => {
- this.ruleName = data
- })
- uni.$on('updateGroup', (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) {
- this.ruleName = this.info.name
- this.group = this.info.groups
- this.time = this.info.temList
- this.place = this.info.locations
- this.value = this.info.noticeTime
- this.periods = this.info.periods
- this.id = this.info.id
- let ruleTime = []
- ruleTime.push({
- selectedWeeks: this.time,
- list: this.periods
- })
- uni.setStorageSync("ruleTime", ruleTime)
- }
- },
- methods: {
- // 点击确认按钮回调
- handleConfirm() {
- uni.showModal({
- title: '提示',
- content: '确定修改吗?',
- success: (res) => {
- if (res.confirm) {
- console.log('用户点击确定');
- } else if (res.cancel) {}
- }
- });
- },
- // 点击删除按钮回调
- handleDelete() {
- uni.showModal({
- title: '提示',
- content: '确定删除吗?',
- success: async (res) => {
- if (res.confirm) {
- let res = await this.$myRequest({
- url: "/attendance/api/settings/rule/delete",
- method: "delete",
- data: {
- ids: [this.id]
- }
- })
- // console.log(res);
- if (res.code == 200) {
- uni.showToast({
- title: "删除成功"
- })
- setTimeout(() => {
- uni.navigateBack({
- delta: 1
- })
- }, 1500)
- }
- } else if (res.cancel) {}
- }
- });
- },
- // 提前通知选择框点击回调
- changeSelect(e) {
- let index = e.detail.value
- this.value = this.array[index]
- },
- // 点击规则名称跳转回调
- goPageRuleName() {
- uni.navigateTo({
- url: `/pages/ruleName/ruleName?flag=1`
- })
- },
- // 点击考勤组跳转回调
- goPageGroup() {
- uni.navigateTo({
- url: `/pages/group/group?flag=2&type=edit`
- })
- },
- // 点击打卡时间跳转回调
- goPagePunchTime() {
- uni.navigateTo({
- url: "/pages/punchTime/punchTime"
- })
- },
- // 点击打卡地点跳转回调
- goPagePunchLocation() {
- uni.navigateTo({
- url: "/pages/punchLocation/punchLocation"
- })
- },
- // 格式化时间
- format_time(timestamp) {
- //时间戳为10位需*1000,时间戳为13位的话不需乘1000
- var date = new Date(timestamp);
- var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
- var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
- let strDate = h + m;
- return strDate;
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- height: 100vh;
- background-color: #fff;
- .box {
- display: flex;
- align-items: center;
- margin: 0 30rpx;
- width: 690rpx;
- height: 90rpx;
- font-size: 30rpx;
- border-bottom: 1rpx solid #CCCCCC;
- background-color: #fff;
- .name {
- flex: 1;
- }
- .val {
- flex: 3;
- display: flex;
- align-items: center;
- .ele {
- display: inline-block;
- width: 460rpx;
- text-align: end;
- color: #A6A6A6;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- span {
- margin-right: 10rpx;
- }
- }
- .black {
- color: #000;
- }
- .right {
- margin-left: 20rpx;
- width: 40rpx;
- display: inline-flex;
- justify-content: center;
- align-items: center;
- img {
- width: 16rpx;
- height: 25rpx;
- }
- }
- }
- }
- .button {
- margin: auto;
- margin-top: 52rpx;
- width: 690rpx;
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- font-size: 32rpx;
- font-weight: 500;
- color: #fff;
- border-radius: 16rpx;
- background-color: #3396FB;
- }
- .button2 {
- margin: auto;
- margin-top: 30rpx;
- width: 690rpx;
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- font-size: 32rpx;
- font-weight: 500;
- color: #FF5733;
- border-radius: 16rpx;
- background-color: #fff;
- }
- }
- </style>
|