补卡申请

ZL 2024-04-23 21:54:51 +08:00
parent f6cfa38403
commit 4b78b36b4e
6 changed files with 203 additions and 12 deletions

View File

@ -190,6 +190,12 @@
"style": {
"navigationBarTitleText": "补卡申请"
}
},
{
"path": "detail",
"style": {
"navigationBarTitleText": "补卡审核"
}
}
]
}

View File

@ -1,5 +1,5 @@
<template>
<view class="card-shadow bg-white rounded-19rpx p-base space-y-10rpx">
<view class="card-shadow bg-white rounded-19rpx p-base space-y-10rpx" @click="goPath">
<view class="text-30rpx">补卡申请</view>
<view class="text-24rpx text-hex-999999 flex">
<view class="text-24rpx w-140rpx">补卡原因</view>
@ -13,10 +13,17 @@
<view class="text-24rpx w-140rpx"> 补卡时间</view>
<view class="text-24rpx">{{ valueFormat }}</view>
</view>
<view class="text-30rpx">{{ item.workflow_check.check_status_text }}</view>
<view
:style="{
color: statusFun(item.workflow_check.check_status, 'workflow_check', 'color')
}"
class="text-24rpx"
>{{ statusFun(item.workflow_check.check_status, "workflow_check", "name") }}</view
>
</view>
</template>
<script setup>
import statusFun from "@/utils/status"
import { computed } from "vue"
import { timeFormat } from "@climblee/uv-ui/libs/function/index"
const props = defineProps({
@ -25,4 +32,9 @@ const props = defineProps({
const valueFormat = computed(() => {
return timeFormat(props.item.date, "yyyy-MM-dd hh:mm")
})
const goPath = () => {
uni.navigateTo({
url: `/pages/make-card/detail?id=${props.item.id}`
})
}
</script>

View File

@ -35,7 +35,7 @@
<uv-textarea v-model="form.reason" count placeholder="请输入" :border="`none`" :maxlength="200"></uv-textarea>
</uv-form-item>
<uv-line color="#f5f5f5"></uv-line>
<uv-form-item required label="外勤" prop="isOutSide">
<uv-form-item label="外勤" prop="isOutSide">
<view class="flex flex-1 justify-end">
<uv-switch size="20" v-model="form.isOutSide"></uv-switch>
</view>
@ -63,11 +63,12 @@ import { ref, reactive, computed } from "vue"
import { onLoad } from "@dcloudio/uni-app"
import { http } from "@/utils/request"
import { timeFormat } from "@climblee/uv-ui/libs/function/index"
const columns = [["上班打卡", "下班打卡"]]
const columns = [["上班补卡", "上班补卡"]]
const formRef = ref(null)
const datetimePicker = ref(null)
const pickerRef = ref(null)
const modalRef = ref(null)
// const value = ref(Number(new Date())
const id = ref(0)
const loading = ref(false)
const form = reactive({
@ -97,6 +98,23 @@ const rules = reactive({
})
onLoad(options => {
id.value = options.id
if (id.value) {
http
.request({
url: `/hr/sign-repairs/${options.id}`,
method: "GET",
header: {
Accept: "application/json"
}
})
.then(res => {
form.date = timeFormat(res.date, "yyyy-MM-dd hh:mm")
form.reason = res.reason
form.isOutSide = res.sign_type == 1 ? false : true
form.outside_remarks = res.outside_remarks
form.sign_time = res.sign_time == 1 ? "上班补卡" : "下班补卡"
})
}
})
const submit = () => {
@ -109,17 +127,20 @@ const onSubmit = async () => {
if (loading.value) return
loading.value = true
try {
let url = id.value ? `/hr/sign-repairs/${id.value}` : "/hr/sign-repairs"
let method = id.value ? "PUT" : "POST"
await http.request({
url: `/hr/sign-repairs`,
method: "POST",
url: url,
method: method,
header: {
Accept: "application/json"
},
data: {
date: form.date,
sign_time: form.sign_time == "上班卡" ? 1 : 2,
sign_time: form.sign_time == "上班卡" ? 1 : 2,
reason: form.reason,
outside_remarks: form.outside_remarks
outside_remarks: form.outside_remarks,
sign_type: form.isOutSide ? 2 : 1
}
})
uni.showToast({

View File

@ -0,0 +1,130 @@
<template>
<view class="px-base" v-if="detail">
<CuNavbar title="补卡审核">
<template v-if="!isEdit" #right>
<uv-icon color="white" @click="open" name="more-dot-fill"></uv-icon>
</template>
</CuNavbar>
<view class="mt-30rpx card-shadow bg-white rounded-19rpx px-base text-[#333333] text-27rpx">
<view class="py-20rpx flex items-center justify-between">
<view>申请人</view>
<view class="text-hex-999999">{{ detail.employee.name }}</view>
</view>
<uv-line></uv-line>
<view class="py-20rpx flex items-center justify-between">
<view>所属门店</view>
<view class="text-hex-999999">{{ detail.store.title }}</view>
</view>
<uv-line></uv-line>
<view class="py-20rpx flex items-center justify-between">
<view>电话号码</view>
<view class="text-hex-999999">{{ detail.employee.phone }}</view>
</view>
<uv-line></uv-line>
<view class="py-20rpx flex items-center justify-between">
<view>申请时间</view>
<view class="text-hex-999999">{{ timeFormat(detail.created_at, "yyyy-MM-dd hh:mm") }}</view>
</view>
<uv-line></uv-line>
<view class="py-20rpx flex items-center justify-between">
<view>补卡时间</view>
<view class="text-hex-999999">{{ timeFormat(detail.date, "yyyy-MM-dd hh:mm") }}</view>
</view>
<view class="py-20rpx flex items-center justify-between">
<view>补卡类别</view>
<view class="text-hex-999999">{{ detail.sign_time == 1 ? "上班打卡" : "下班打卡" }}</view>
</view>
<uv-line></uv-line>
<view class="py-20rpx">
<view>补卡原因</view>
<view class="text-hex-999999 mt-20rpx">{{ detail.reason }}</view>
</view>
<uv-line></uv-line>
<view class="py-20rpx flex items-center justify-between">
<view>是否外勤</view>
<view class="text-hex-999999">{{ detail.sign_type == 1 ? "否" : "是" }}</view>
</view>
<template v-if="detail.sign_type == 2">
<uv-line></uv-line>
<view class="py-20rpx">
<view>外勤事由</view>
<view class="text-hex-999999 mt-20rpx">{{ detail.outside_remarks }}</view>
</view>
</template>
<uv-line></uv-line>
</view>
<view class="h-100rpx">
<view class="fixed bottom-0 left-0 right-0 h-120rpx bg-white flex items-center px-base space-x-30rpx">
<view class="flex-1">
<uv-button color="#999999" shape="circle" plain block> 拒绝 </uv-button>
</view>
<view class="flex-1">
<uv-button type="primary" shape="circle" block> 通过 </uv-button>
</view>
</view>
</view>
<uv-picker ref="pickerRef" :columns="columns" @confirm="confirmPicker"></uv-picker>
<uv-modal ref="modalRef" title="提示" content="确定删除吗?" @confirm="onSubmit" :showCancelButton="true"></uv-modal>
</view>
</template>
<script setup>
import CuNavbar from "@/components/cu-navbar/index"
import { http } from "@/utils/request"
import { onLoad } from "@dcloudio/uni-app"
import { ref } from "vue"
import { timeFormat } from "@climblee/uv-ui/libs/function/index"
const modalRef = ref(null)
const columns = [["修改", "删除"]]
const detail = ref()
const pickerRef = ref(null)
const id = ref(0)
const open = () => {
pickerRef.value.open()
}
const confirmPicker = e => {
console.log(e)
if (e.value[0] === "删除") {
modalRef.value.open()
} else {
uni.navigateTo({
url: `/pages/make-card/create?id=${id.value}`
})
}
}
const onSubmit = async () => {
try {
await http.request({
url: `/hr/sign-repairs/${id.value}`,
method: "DELETE",
header: {
Accept: "application/json"
}
})
uni.showToast({
title: "删除成功",
icon: "none"
})
formRef.value.resetFields()
uni.navigateBack()
} catch (error) {
console.log(error)
} finally {
loading.value = false
}
}
onLoad(options => {
id.value = options.id
http
.request({
url: `/hr/sign-repairs/${options.id}`,
method: "GET",
header: {
Accept: "application/json"
}
})
.then(res => {
detail.value = res
})
})
</script>

View File

@ -38,7 +38,7 @@ const tabList = ref([
apiUrl: "/hr/sign-repairs"
},
{
name: "补卡申请"
name: "补卡审核"
}
])
const mescrollItem0 = ref(null)

View File

@ -63,15 +63,37 @@ const data = {
value: 4,
name: '未完成',
color: '#999999'
}]
}],
// 不卡申请
workflow_check: [
{
value: 1,
name: '待提审',
color: '#f56c6c'
}, {
value: 2,
name: '审核中',
color: '#f56c6c'
}, {
value: 3,
name: '已通过',
color: '#3c9cff'
}, {
value: 4,
name: '审核未通过',
color: '#999999'
}, {
value: 5,
name: '已取消',
color: '#999999'
}
]
}
export default function (value, status, key) {
if (!status) {
return value
}
const item = data[status]?.find((item) => item.value === value)
if (item && key) {
return item[key] ?? value
}