ihzero 2024-04-24 01:10:50 +08:00
commit 98dca1863c
18 changed files with 1222 additions and 19 deletions

View File

@ -229,35 +229,70 @@
]
},
{
"root": "pages/train-books",
"root": "pages/business",
"pages": [
{
"path": "index",
"path": "list",
"style": {
"navigationBarTitleText": "培训课件"
"navigationBarTitleText": "出差报备"
}
},
{
"path": "create",
"style": {
"navigationBarTitleText": "出差报备"
}
},
{
"path": "detail",
"style": {
"navigationBarTitleText": "培训课件"
"navigationBarTitleText": "出差详情"
}
}
]
},
{
"root": "pages/examination",
"root": "pages/overtime",
"pages": [
{
"path": "index",
"path": "list",
"style": {
"navigationBarTitleText": "培训考试"
"navigationBarTitleText": "加班报备"
}
},
{
"path": "create",
"style": {
"navigationBarTitleText": "加班报备"
}
},
{
"path": "detail",
"style": {
"navigationBarTitleText": "培训考试"
"navigationBarTitleText": "加班详情"
}
}
]
},
{
"root": "pages/contract",
"pages": [
{
"path": "list",
"style": {
"navigationBarTitleText": "加班报备"
}
},
{
"path": "create",
"style": {
"navigationBarTitleText": "加班报备"
}
},
{
"path": "detail",
"style": {
"navigationBarTitleText": "加班详情"
}
}
]

View File

@ -50,12 +50,19 @@
<uv-picker ref="pickerRef" :columns="columns" @confirm="confirmPicker"></uv-picker>
<uv-datetime-picker
placeholder="请选择日期"
v-model="startValue"
ref="dateStartPicker"
mode="datetime"
@confirm="confirmStartDatePicker"
>
</uv-datetime-picker>
<uv-datetime-picker placeholder="请选择日期" ref="dateEndPicker" mode="datetime" @confirm="confirmEndDatePicker">
<uv-datetime-picker
v-model="endValue"
placeholder="请选择日期"
ref="dateEndPicker"
mode="datetime"
@confirm="confirmEndDatePicker"
>
</uv-datetime-picker>
<uv-modal ref="modalRef" title="提示" content="确定提交吗?" @confirm="onSubmit" :showCancelButton="true"></uv-modal>
</view>
@ -73,7 +80,8 @@ const dateStartPicker = ref(null)
const dateEndPicker = ref(null)
const pickerRef = ref(null)
const modalRef = ref(null)
// const value = ref(Number(new Date())
const startValue = ref(Number(new Date()))
const endValue = ref(Number(new Date()))
const id = ref(0)
const loading = ref(false)
const form = reactive({
@ -131,6 +139,8 @@ onLoad(options => {
}
})
.then(res => {
startValue.value = res.start_at * 1000
endValue.value = res.end_at * 1000
form.start_at = timeFormat(res.start_at, "yyyy-mm-dd hh:MM:ss")
form.end_at = timeFormat(res.end_at, "yyyy-mm-dd hh:MM:ss")
form.reason = res.reason

View File

@ -1,6 +1,6 @@
<template>
<view class="px-base" v-if="detail">
<CuNavbar title="补卡审核">
<CuNavbar title="请假详情">
<template v-if="!isEdit" #right>
<uv-icon color="white" @click="open" name="more-dot-fill"></uv-icon>
</template>
@ -95,7 +95,6 @@ const onSubmit = async () => {
title: "删除成功",
icon: "none"
})
formRef.value.resetFields()
uni.navigateBack()
} catch (error) {
console.log(error)

View File

@ -0,0 +1,36 @@
<template>
<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-120rpx text-right mr-20rpx">目的地</view>
<view class="">{{ item.address }}</view>
</view>
<view class="text-24rpx text-hex-999999 flex">
<view class="text-24rpx w-140rpx">出差事由</view>
<view class="">{{ item.reason }}</view>
</view>
<view class="flex items-center text-hex-999999 flex">
<view class="text-24rpx w-140rpx"> 申请时间</view>
<view class="text-24rpx">{{ timeFormat(item.created_at, "yyyy-mm-dd hh:MM:ss") }}</view>
</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 { timeFormat } from "@climblee/uv-ui/libs/function/index"
const props = defineProps({
item: Object
})
const goPath = () => {
uni.navigateTo({
url: `/pages/business/detail?id=${props.item.id}`
})
}
</script>

View File

@ -0,0 +1,174 @@
<template>
<view>
<CuNavbar title="出差申请">
<template #right>
<view class="text-24rpx text-white" @click="submit"></view>
</template>
</CuNavbar>
<view class="card-shadow px-base">
<uv-form labelPosition="left" :model="form" :rules="rules" ref="formRef" errorType="toast" labelWidth="250rpx">
<uv-form-item required label="目的地" prop="address">
<uv-input placeholder="请选择" @click="openPicker" inputAlign="right" :border="`none`" v-model="form.address">
</uv-input>
</uv-form-item>
<uv-line color="#f5f5f5"></uv-line>
<uv-form-item required label="出差开始时间" prop="start_at">
<uv-input
placeholder="请选择日期"
readonly
@click="openStartDatePicker"
inputAlign="right"
:border="`none`"
v-model="form.start_at"
>
</uv-input>
</uv-form-item>
<uv-form-item required label="出差结束时间" prop="end_at">
<uv-input
placeholder="请选择日期"
readonly
@click="openEndDatePicker"
inputAlign="right"
:border="`none`"
v-model="form.end_at"
>
</uv-input>
</uv-form-item>
<uv-line color="#f5f5f5"></uv-line>
<uv-form-item required label="出差事由" prop="reason" labelPosition="top">
<uv-textarea v-model="form.reason" count placeholder="请输入" :border="`none`" :maxlength="200"></uv-textarea>
</uv-form-item>
</uv-form>
</view>
<uv-datetime-picker
placeholder="请选择日期"
v-model="startValue"
ref="dateStartPicker"
mode="datetime"
@confirm="confirmStartDatePicker"
>
</uv-datetime-picker>
<uv-datetime-picker
v-model="endValue"
placeholder="请选择日期"
ref="dateEndPicker"
mode="datetime"
@confirm="confirmEndDatePicker"
>
</uv-datetime-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 { 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 = ref([])
const pickerData = ref([])
const formRef = ref(null)
const dateStartPicker = ref(null)
const dateEndPicker = ref(null)
const modalRef = ref(null)
const startValue = ref(Number(new Date()))
const endValue = ref(Number(new Date()))
const id = ref(0)
const loading = ref(false)
const form = reactive({
start_at: "",
end_at: "",
reason: "",
address: ""
})
const openStartDatePicker = () => {
dateStartPicker.value.open()
}
const openEndDatePicker = () => {
dateEndPicker.value.open()
}
const confirmStartDatePicker = e => {
form.start_at = timeFormat(e.value, "yyyy-mm-dd hh:MM:ss")
}
const confirmEndDatePicker = e => {
form.end_at = timeFormat(e.value, "yyyy-mm-dd hh:MM:ss")
}
const rules = reactive({
start_at: [{ required: true, message: "请选择时间" }],
end_at: [{ required: true, message: "请选择时间" }],
reason: [{ required: true, message: "请输入出差理由" }],
address: [{ required: true, message: "请输入目的地" }]
})
onLoad(options => {
http
.request({
url: `/keywords?parent_key=holiday_type`,
method: "GET",
header: {
Accept: "application/json"
}
})
.then(res => {
let names = res.map(item => item.name)
columns.value = [names]
pickerData.value = res
})
id.value = options.id
if (id.value) {
http
.request({
url: `/hr/offical-bussiness/${options.id}`,
method: "GET",
header: {
Accept: "application/json"
}
})
.then(res => {
startValue.value = res.start_at * 1000
endValue.value = res.end_at * 1000
form.start_at = timeFormat(res.start_at, "yyyy-mm-dd hh:MM:ss")
form.end_at = timeFormat(res.end_at, "yyyy-mm-dd hh:MM:ss")
form.reason = res.reason
form.address = res.address
})
}
})
const submit = () => {
formRef.value.validate().then(res => {
modalRef.value.open()
})
}
const onSubmit = async () => {
if (loading.value) return
loading.value = true
try {
let url = id.value ? `/hr/offical-bussiness/${id.value}` : "/hr/offical-bussiness"
let method = id.value ? "PUT" : "POST"
await http.request({
url: url,
method: method,
header: {
Accept: "application/json"
},
data: {
start_at: form.start_at,
address: form.address,
reason: form.reason,
end_at: form.end_at
}
})
uni.showToast({
title: "提交成功",
icon: "none"
})
formRef.value.resetFields()
uni.navigateBack()
} catch (error) {
console.log(error)
} finally {
loading.value = false
}
}
</script>

View File

@ -0,0 +1,119 @@
<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">{{ detail.address }}</view>
</view>
<view class="py-20rpx flex items-center justify-between">
<view>出差开始时间</view>
<view class="text-hex-999999">{{ timeFormat(detail.start_at, "yyyy-mm-dd hh:MM") }}</view>
</view>
<view class="py-20rpx flex items-center justify-between">
<view>出差结束时间</view>
<view class="text-hex-999999">{{ timeFormat(detail.end_at, "yyyy-mm-dd hh:MM") }}</view>
</view>
<uv-line></uv-line>
<view class="py-20rpx">
<view>出差原因</view>
<view class="text-hex-999999 mt-20rpx">{{ detail.reason }}</view>
</view>
</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/business/create?id=${id.value}`
})
}
}
const onSubmit = async () => {
try {
await http.request({
url: `/hr/offical-bussiness/${id.value}`,
method: "DELETE",
header: {
Accept: "application/json"
}
})
uni.showToast({
title: "删除成功",
icon: "none"
})
uni.navigateBack()
} catch (error) {
console.log(error)
} finally {
loading.value = false
}
}
onLoad(options => {
id.value = options.id
http
.request({
url: `/hr/offical-bussiness/${options.id}`,
method: "GET",
header: {
Accept: "application/json"
}
})
.then(res => {
detail.value = res
})
})
</script>

View File

@ -0,0 +1,58 @@
<template>
<view>
<CuNavbar title="出差申请">
<template #right>
<view @click="goPath('/pages/business/create')" class="text-24rpx text-white">申请</view>
</template>
</CuNavbar>
<uv-sticky bgColor="#fff">
<uv-tabs
:activeStyle="{ color: '#ee2c37' }"
:scrollable="false"
lineColor="#ee2c37"
:list="tabList"
@change="tabChange"
></uv-tabs>
</uv-sticky>
<MescrollItem ref="mescrollItem0" :top="88" :i="0" :index="tabIndex" :apiUrl="tabList[0].apiUrl">
<template v-slot="{ list }">
<view class="space-y-15rpx p-base">
<view v-for="(item, i) in list" :key="i">
<Item :item="item"></Item>
</view>
</view>
</template>
</MescrollItem>
</view>
</template>
<script setup>
import CuNavbar from "@/components/cu-navbar/index"
import { ref } from "vue"
import { onPageScroll, onReachBottom, onShow } from "@dcloudio/uni-app"
import useMescrollMore from "@/uni_modules/mescroll-uni/hooks/useMescrollMore.js"
import MescrollItem from "@/components/mescroll-api/more.vue"
import Item from "./components/item.vue"
const tabList = ref([
{
name: "我的请假",
apiUrl: "/hr/offical-bussiness"
},
{
name: "请假审核"
}
])
const mescrollItem0 = ref(null)
const mescrollItem1 = ref(null)
const mescrollItems = [mescrollItem0, mescrollItem1]
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(mescrollItems, onPageScroll, onReachBottom)
const goPath = url => {
uni.navigateTo({
url
})
}
const tabChange = ({ index }) => {
tabIndex.value = index
scrollToLastY()
}
</script>

View File

@ -0,0 +1,32 @@
<template>
<view class="card-shadow bg-white rounded-19rpx p-base space-y-10rpx" @click.stop="onClick">
<view class="flex items-center justify-between">
<view class="text-30rpx">{{ item.name }}</view>
</view>
<uv-scroll-list>
<view v-for="(item, index) in item.images" :key="index">
<image :src="item" mode="heightFix" class="mr-20rpx" style="height: 200rpx"></image>
</view>
</uv-scroll-list>
<view
:style="{
color: statusFun(item.workflow_check.status, 'workflow_check', 'color')
}"
class="text-24rpx"
>{{ statusFun(item.workflow_check.status, "workflow_check", "name") }}</view
>
</view>
</template>
<script setup>
import statusFun from "@/utils/status"
import { timeFormat } from "@climblee/uv-ui/libs/function/index"
const props = defineProps({
item: Object
})
const onClick = () => {
uni.navigateTo({
url: `/pages/contract/detail?id=${props.item.id}`
})
}
</script>

View File

@ -0,0 +1,153 @@
<template>
<view class="">
<CuNavbar title="合同上传">
<template #right>
<view class="text-24rpx text-white" @click="submit"></view>
</template>
</CuNavbar>
<view class="card-shadow px-base">
<uv-form labelPosition="left" :model="form" :rules="rules" ref="formRef" errorType="toast" labelWidth="150rpx">
<uv-form-item required label="合同名称" prop="name">
<uv-input placeholder="请输入合同名称" inputAlign="right" :border="`none`" v-model="form.name"> </uv-input>
</uv-form-item>
<uv-line color="#f5f5f5"></uv-line>
<uv-form-item label="合同照片" labelPosition="top" prop="images" required>
<view class="w-full mt-15rpx">
<uv-upload
:maxCount="9"
multiple
:fileList="form.images"
@afterRead="afterRead"
@delete="deletePic"
name="images"
></uv-upload>
</view>
</uv-form-item>
</uv-form>
</view>
<uv-modal ref="modalRef" title="提示" content="确定提交吗?" @confirm="onSubmit" :showCancelButton="true"></uv-modal>
</view>
</template>
<script setup>
import CuNavbar from "@/components/cu-navbar/index"
import { ref, reactive, computed } from "vue"
import { onLoad } from "@dcloudio/uni-app"
import { http } from "@/utils/request"
const formRef = ref(null)
const modalRef = ref(null)
const id = ref(0)
const loading = ref(false)
const form = reactive({
name: "",
images: []
})
const rules = reactive({
name: [{ required: true, message: "请输入清洁范围" }],
images: {
type: "array",
required: true,
message: "请上传报销凭证"
}
})
onLoad(options => {
id.value = options.id
if (id.value) {
http
.request({
url: `/agreements/${options.id}`,
method: "GET",
header: {
Accept: "application/json"
}
})
.then(res => {
form.name = res.name
form.images = res.images
})
}
})
const submit = () => {
formRef.value.validate().then(res => {
modalRef.value.open()
})
}
const onSubmit = async () => {
if (loading.value) return
loading.value = true
try {
let url = id.value ? `/agreements/${id.value}` : "/agreements"
let method = id.value ? "PUT" : "POST"
await http.request({
url: url,
method: method,
header: {
Accept: "application/json"
},
data: {
name: form.name,
images: form.images.map(item => item.url)
}
})
uni.showToast({
title: "提交成功",
icon: "none"
})
formRef.value.resetFields()
uni.$emit("task:submit", resData)
uni.navigateBack()
} catch (error) {
console.log(error)
} finally {
loading.value = false
}
}
const afterRead = async event => {
let lists = [].concat(event.file)
let fileListLen = form[event.name].length
lists.map(item => {
form[event.name].push({
...item,
status: "uploading",
message: "上传中"
})
})
for (let i = 0; i < lists.length; i++) {
const result = await uploadFilePromise(lists[i].url)
let item = form[event.name][fileListLen]
form[event.name].splice(
fileListLen,
1,
Object.assign(item, {
status: "success",
message: "",
url: result
})
)
fileListLen++
}
}
const uploadFilePromise = url => {
return new Promise((resolve, reject) => {
http
.upload("/fileupload", {
filePath: url,
name: "file"
})
.then(res => {
resolve(res.url)
})
.catch(err => {
reject(err)
})
})
}
const deletePic = event => {
form[event.name].splice(event.index, 1)
}
</script>

View File

@ -0,0 +1,114 @@
<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">{{ detail.name }}</view>
</view>
<view class="py-20rpx flex items-center justify-between">
<view>合同内容</view>
</view>
<uv-scroll-list>
<view v-for="(item, index) in detail.images" :key="index">
<image :src="item" mode="heightFix" class="mr-20rpx" style="height: 200rpx"></image>
</view>
</uv-scroll-list>
</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/contract/create?id=${id.value}`
})
}
}
const onSubmit = async () => {
try {
await http.request({
url: `/agreements/${id.value}`,
method: "DELETE",
header: {
Accept: "application/json"
}
})
uni.showToast({
title: "删除成功",
icon: "none"
})
uni.navigateBack()
} catch (error) {
console.log(error)
} finally {
loading.value = false
}
}
onLoad(options => {
id.value = options.id
http
.request({
url: `/agreements/${options.id}`,
method: "GET",
header: {
Accept: "application/json"
}
})
.then(res => {
detail.value = res
})
})
</script>

View File

@ -0,0 +1,66 @@
<template>
<view>
<CuNavbar title="我的合同">
<template #right>
<view @click="goPath('/pages/contract/create')" class="text-24rpx text-white">上传</view>
</template>
</CuNavbar>
<uv-sticky bgColor="#fff">
<uv-tabs
height="44"
:activeStyle="{ color: '#ee2c37' }"
:scrollable="false"
:current="tabIndex"
lineColor="#ee2c37"
:list="tabList"
@change="tabChange"
></uv-tabs>
</uv-sticky>
<MescrollItem ref="mescrollItem0" :top="88" :i="0" :index="tabIndex" :apiUrl="tabList[0].apiUrl">
<template v-slot="{ list }">
<view class="space-y-15rpx p-base">
<view v-for="(item, i) in list" :key="i">
<Item :item="item"></Item>
</view>
</view>
</template>
</MescrollItem>
</view>
</template>
<script setup>
import CuNavbar from "@/components/cu-navbar/index"
import { computed, reactive, ref } from "vue"
import Item from "./components/item.vue"
import { onPageScroll, onReachBottom, onShow } from "@dcloudio/uni-app"
import useMescrollMore from "@/uni_modules/mescroll-uni/hooks/useMescrollMore.js"
import MescrollItem from "@/components/mescroll-api/more.vue"
const mescrollItem0 = ref(null)
const mescrollItem1 = ref(null)
const mescrollItems = [mescrollItem0, mescrollItem1]
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(mescrollItems, onPageScroll, onReachBottom)
const tabList = ref([
{
name: "我的合同",
apiUrl: "/agreements"
},
{
name: "合同审核",
apiUrl: "",
params: {
// aaa:111
}
}
])
const goPath = url => {
uni.navigateTo({
url
})
}
const tabChange = ({ index }) => {
tabIndex.value = index
scrollToLastY()
}
</script>

View File

@ -52,7 +52,13 @@
</uv-form>
</view>
<uv-picker ref="pickerRef" :columns="columns" @confirm="confirmPicker"></uv-picker>
<uv-datetime-picker placeholder="请选择日期" ref="datetimePicker" mode="datetime" @confirm="confirmDatePicker">
<uv-datetime-picker
v-model="value"
placeholder="请选择日期"
ref="datetimePicker"
mode="datetime"
@confirm="confirmDatePicker"
>
</uv-datetime-picker>
<uv-modal ref="modalRef" title="提示" content="确定提交吗?" @confirm="onSubmit" :showCancelButton="true"></uv-modal>
</view>
@ -108,7 +114,7 @@ onLoad(options => {
}
})
.then(res => {
value.value = res.date
value.value = res.date * 1000
form.date = timeFormat(res.date, "yyyy-mm-dd hh:MM")
form.reason = res.reason
form.isOutSide = res.sign_type == 1 ? false : true

View File

@ -1,6 +1,6 @@
<template>
<view class="px-base" v-if="detail">
<CuNavbar title="补卡审核">
<CuNavbar title="加班审核">
<template v-if="!isEdit" #right>
<uv-icon color="white" @click="open" name="more-dot-fill"></uv-icon>
</template>
@ -101,7 +101,6 @@ const onSubmit = async () => {
title: "删除成功",
icon: "none"
})
formRef.value.resetFields()
uni.navigateBack()
} catch (error) {
console.log(error)

View File

@ -77,17 +77,17 @@ const opList = [
{
icon: "setting-fill",
title: "出差报备",
url: ""
url: "/pages/business/list"
},
{
icon: "server-man",
title: "加班报备",
url: ""
url: "/pages/overtime/list"
},
{
icon: "camera",
title: "合同管理",
url: ""
url: "/pages/contract/list"
}
]
},

View File

@ -0,0 +1,39 @@
<template>
<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>
<view class="">{{ timeFormat(item.date, "yyyy-mm-dd") }}</view>
</view>
<view class="flex items-center text-hex-999999 flex">
<view class="text-24rpx w-140rpx"> 加班时间</view>
<view class="text-24rpx"
>{{ timeFormat(item.start_at, "yyyy-mm-dd hh:MM").substring(10) }} -
{{ timeFormat(item.end_at, "yyyy-mm-dd hh:MM").substring(10) }}</view
>
</view>
<view class="text-24rpx text-hex-999999 flex">
<view class="text-24rpx w-140rpx">加班事由</view>
<view class="">{{ item.reason }}</view>
</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 { timeFormat } from "@climblee/uv-ui/libs/function/index"
const props = defineProps({
item: Object
})
const goPath = () => {
uni.navigateTo({
url: `/pages/overtime/detail?id=${props.item.id}`
})
}
</script>

View File

@ -0,0 +1,186 @@
<template>
<view>
<CuNavbar title="加班申请">
<template #right>
<view class="text-24rpx text-white" @click="submit"></view>
</template>
</CuNavbar>
<view class="card-shadow px-base">
<uv-form labelPosition="left" :model="form" :rules="rules" ref="formRef" errorType="toast" labelWidth="250rpx">
<uv-form-item required label="日期" prop="date">
<uv-input
placeholder="请选择"
readonly
@click="openDate"
inputAlign="right"
:border="`none`"
v-model="form.date"
>
</uv-input>
</uv-form-item>
<uv-line color="#f5f5f5"></uv-line>
<uv-form-item required label="加班开始时间" prop="start_at">
<uv-input
placeholder="请选择时间"
readonly
@click="openStartDatePicker"
inputAlign="right"
:border="`none`"
v-model="form.start_at"
>
</uv-input>
</uv-form-item>
<uv-form-item required label="加班结束时间" prop="end_at">
<uv-input
placeholder="请选择时间"
readonly
@click="openEndDatePicker"
inputAlign="right"
:border="`none`"
v-model="form.end_at"
>
</uv-input>
</uv-form-item>
<uv-line color="#f5f5f5"></uv-line>
<uv-form-item required label="出差事由" prop="reason" labelPosition="top">
<uv-textarea v-model="form.reason" count placeholder="请输入" :border="`none`" :maxlength="200"></uv-textarea>
</uv-form-item>
</uv-form>
</view>
<uv-datetime-picker
placeholder="请选择日期"
v-model="dateValue"
ref="datePicker"
mode="date"
@confirm="confirmDatePicker"
>
</uv-datetime-picker>
<uv-datetime-picker
placeholder="请选择时间"
v-model="startValue"
ref="dateStartPicker"
mode="datetime"
@confirm="confirmStartDatePicker"
>
</uv-datetime-picker>
<uv-datetime-picker
v-model="endValue"
placeholder="请选择时间"
ref="dateEndPicker"
mode="datetime"
@confirm="confirmEndDatePicker"
>
</uv-datetime-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 { 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 = ref([])
const pickerData = ref([])
const formRef = ref(null)
const dateStartPicker = ref(null)
const datePicker = ref(null)
const dateEndPicker = ref(null)
const modalRef = ref(null)
const startValue = ref(Number(new Date()))
const dateValue = ref(Number(new Date()))
const endValue = ref(Number(new Date()))
const id = ref(0)
const loading = ref(false)
const form = reactive({
start_at: "",
end_at: "",
reason: "",
date: ""
})
const openDate = () => {
datePicker.value.open()
}
const openStartDatePicker = () => {
dateStartPicker.value.open()
}
const openEndDatePicker = () => {
dateEndPicker.value.open()
}
const confirmDatePicker = e => {
form.date = timeFormat(e.value, "yyyy-mm-dd")
}
const confirmStartDatePicker = e => {
form.start_at = timeFormat(e.value, "yyyy-mm-dd hh:MM:ss")
}
const confirmEndDatePicker = e => {
form.end_at = timeFormat(e.value, "yyyy-mm-dd hh:MM:ss")
}
const rules = reactive({
start_at: [{ required: true, message: "请选择时间" }],
end_at: [{ required: true, message: "请选择时间" }],
reason: [{ required: true, message: "请输入加班理由" }],
date: [{ required: true, message: "请选择日期" }]
})
onLoad(options => {
id.value = options.id
if (id.value) {
http
.request({
url: `/hr/overtimes/${options.id}`,
method: "GET",
header: {
Accept: "application/json"
}
})
.then(res => {
startValue.value = res.start_at * 1000
endValue.value = res.end_at * 1000
dateValue.value = res.date * 1000
form.start_at = timeFormat(res.start_at, "yyyy-mm-dd hh:MM:ss")
form.end_at = timeFormat(res.end_at, "yyyy-mm-dd hh:MM:ss")
form.date = timeFormat(res.date, "yyyy-mm-dd")
form.reason = res.reason
form.address = res.address
})
}
})
const submit = () => {
formRef.value.validate().then(res => {
modalRef.value.open()
})
}
const onSubmit = async () => {
if (loading.value) return
loading.value = true
try {
let url = id.value ? `/hr/overtimes/${id.value}` : "/hr/overtimes"
let method = id.value ? "PUT" : "POST"
await http.request({
url: url,
method: method,
header: {
Accept: "application/json"
},
data: {
start_at: form.start_at,
date: form.date,
reason: form.reason,
end_at: form.end_at
}
})
uni.showToast({
title: "提交成功",
icon: "none"
})
formRef.value.resetFields()
uni.navigateBack()
} catch (error) {
console.log(error)
} finally {
loading.value = false
}
}
</script>

View File

@ -0,0 +1,119 @@
<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") }}</view>
</view>
<view class="py-20rpx flex items-center justify-between">
<view>开始时间</view>
<view class="text-hex-999999">{{ timeFormat(detail.start_at, "yyyy-mm-dd hh:MM").substring(10) }}</view>
</view>
<view class="py-20rpx flex items-center justify-between">
<view>结束时间</view>
<view class="text-hex-999999">{{ timeFormat(detail.end_at, "yyyy-mm-dd hh:MM").substring(10) }}</view>
</view>
<uv-line></uv-line>
<view class="py-20rpx">
<view>加班原因</view>
<view class="text-hex-999999 mt-20rpx">{{ detail.reason }}</view>
</view>
</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/overtime/create?id=${id.value}`
})
}
}
const onSubmit = async () => {
try {
await http.request({
url: `/hr/overtimes/${id.value}`,
method: "DELETE",
header: {
Accept: "application/json"
}
})
uni.showToast({
title: "删除成功",
icon: "none"
})
uni.navigateBack()
} catch (error) {
console.log(error)
} finally {
loading.value = false
}
}
onLoad(options => {
id.value = options.id
http
.request({
url: `/hr/overtimes/${options.id}`,
method: "GET",
header: {
Accept: "application/json"
}
})
.then(res => {
detail.value = res
})
})
</script>

View File

@ -0,0 +1,58 @@
<template>
<view>
<CuNavbar title="加班申请">
<template #right>
<view @click="goPath('/pages/overtime/create')" class="text-24rpx text-white">申请</view>
</template>
</CuNavbar>
<uv-sticky bgColor="#fff">
<uv-tabs
:activeStyle="{ color: '#ee2c37' }"
:scrollable="false"
lineColor="#ee2c37"
:list="tabList"
@change="tabChange"
></uv-tabs>
</uv-sticky>
<MescrollItem ref="mescrollItem0" :top="88" :i="0" :index="tabIndex" :apiUrl="tabList[0].apiUrl">
<template v-slot="{ list }">
<view class="space-y-15rpx p-base">
<view v-for="(item, i) in list" :key="i">
<Item :item="item"></Item>
</view>
</view>
</template>
</MescrollItem>
</view>
</template>
<script setup>
import CuNavbar from "@/components/cu-navbar/index"
import { ref } from "vue"
import { onPageScroll, onReachBottom, onShow } from "@dcloudio/uni-app"
import useMescrollMore from "@/uni_modules/mescroll-uni/hooks/useMescrollMore.js"
import MescrollItem from "@/components/mescroll-api/more.vue"
import Item from "./components/item.vue"
const tabList = ref([
{
name: "我的加班",
apiUrl: "/hr/overtimes"
},
{
name: "加班审核"
}
])
const mescrollItem0 = ref(null)
const mescrollItem1 = ref(null)
const mescrollItems = [mescrollItem0, mescrollItem1]
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(mescrollItems, onPageScroll, onReachBottom)
const goPath = url => {
uni.navigateTo({
url
})
}
const tabChange = ({ index }) => {
tabIndex.value = index
scrollToLastY()
}
</script>