Merge branch 'develop' of http://123.57.20.168:4000/admin/ys-app into develop
This commit is contained in:
@@ -211,3 +211,84 @@ export function addMapForReport(data) {
|
||||
isTransformResponse:false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//新增请假申请
|
||||
export function addLeaveApply(data) {
|
||||
return request.post({
|
||||
url: "/crm/jys/app/appLeaveApply/add",
|
||||
data,
|
||||
},{
|
||||
isTransformResponse:false
|
||||
});
|
||||
}
|
||||
|
||||
//我的表单
|
||||
export function getLeaveApplyList(data) {
|
||||
return request.get({
|
||||
url: "/crm/jys/app/appLeaveApply/list",
|
||||
data
|
||||
},{
|
||||
isTransformResponse:false
|
||||
});
|
||||
}
|
||||
|
||||
//可销假表单
|
||||
export function getBackList(data) {
|
||||
return request.get({
|
||||
url: "/crm/jys/app/appLeaveApply/getBackList",
|
||||
data
|
||||
},{
|
||||
isTransformResponse:false
|
||||
});
|
||||
}
|
||||
|
||||
//我的审批
|
||||
export function getMyReviewList(data) {
|
||||
return request.get({
|
||||
url: "/crm/jys/app/appLeaveApply/myReview",
|
||||
data
|
||||
},{
|
||||
isTransformResponse:false
|
||||
});
|
||||
}
|
||||
|
||||
//可销假表单
|
||||
export function getBackLeaveList(data) {
|
||||
return request.get({
|
||||
url: "/crm/jys/app/appLeaveApply/myBackLeave",
|
||||
data
|
||||
},{
|
||||
isTransformResponse:false
|
||||
});
|
||||
}
|
||||
|
||||
//提交审批
|
||||
export function addReviewLeave(data) {
|
||||
return request.post({
|
||||
url: "/crm/jys/app/appLeaveApply/addReview",
|
||||
data,
|
||||
},{
|
||||
isTransformResponse:false
|
||||
});
|
||||
}
|
||||
|
||||
//新增销假申请
|
||||
export function addBackApply(data) {
|
||||
return request.post({
|
||||
url: "/crm/jys/app/appLeaveApply/addBackApply",
|
||||
data,
|
||||
},{
|
||||
isTransformResponse:false
|
||||
});
|
||||
}
|
||||
|
||||
//可销假表单
|
||||
export function getDelLeaveApply(data) {
|
||||
return request.get({
|
||||
url: "/crm/jys/app/appLeaveApply/delLeaveApply",
|
||||
data
|
||||
},{
|
||||
isTransformResponse:false
|
||||
});
|
||||
}
|
||||
|
||||
@@ -665,6 +665,71 @@
|
||||
},
|
||||
{
|
||||
"path": "pages/business/polling/nfcTest/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
//************************考勤管理请假功能
|
||||
//请假申请
|
||||
{
|
||||
"path": "pages/business/CRM/leave/askLeave",
|
||||
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
//添加请假申请
|
||||
{
|
||||
"path": "pages/business/CRM/leave/addApply",
|
||||
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
//我的申请表单
|
||||
{
|
||||
"path": "pages/business/CRM/leave/myApply",
|
||||
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
//我的申请表单详情
|
||||
{
|
||||
"path": "pages/business/CRM/leave/myApplyDetail",
|
||||
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
//可销假列表
|
||||
{
|
||||
"path": "pages/business/CRM/leave/backApply",
|
||||
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
//添加销假申请
|
||||
{
|
||||
"path": "pages/business/CRM/leave/addBackApply",
|
||||
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
//请假审批
|
||||
{
|
||||
"path": "pages/business/CRM/leave/reviewLeave",
|
||||
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
//审批详情
|
||||
{
|
||||
"path": "pages/business/CRM/leave/reviewDetail",
|
||||
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
|
||||
255
src/pages/business/CRM/leave/addApply.vue
Normal file
255
src/pages/business/CRM/leave/addApply.vue
Normal file
@@ -0,0 +1,255 @@
|
||||
<template>
|
||||
<view class="con-body">
|
||||
<view class="con-bg">
|
||||
<customHeader ref="customHeaderRef" :title="'请假申请'" :leftFlag="true">
|
||||
</customHeader>
|
||||
<!-- #ifdef H5 -->
|
||||
<view style="height:30rpx"></view>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height"></view>
|
||||
|
||||
<view class="white-bg">
|
||||
<view class="example">
|
||||
<uni-forms ref="baseForm" :modelValue="baseFormData" :label-width="80">
|
||||
<uni-forms-item label="请假模式">
|
||||
<uni-data-select v-model="baseFormData.typeval" :localdata="range"
|
||||
@change="change" :clear="false"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="开始日期">
|
||||
<uni-datetime-picker type="date" :clear-icon="false"
|
||||
placeholder="请输入开始日期" v-model="baseFormData.startDate"
|
||||
@change="change" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item v-show="baseFormData.typeval=='1'" label="结束日期">
|
||||
<uni-datetime-picker type="date" :clear-icon="false"
|
||||
placeholder="请输入结束日期" v-model="baseFormData.endDate"
|
||||
@change="change" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="开始时间" v-show="baseFormData.typeval!='1'">
|
||||
<input type="text" class="inputborder" style="text-align: center;"
|
||||
v-model="baseFormData.startTime" :disabled="true" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="结束时间" v-show="baseFormData.typeval!='1'">
|
||||
<input type="text" class="inputborder" style="text-align: center;"
|
||||
v-model="baseFormData.endTime" :disabled="true" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="请假天数">
|
||||
<input type="text" class="inputborder" style="text-align: center;"
|
||||
v-model="baseFormData.days" :disabled="true" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="详细说明" class="custom-label-height">
|
||||
<uni-easyinput type="textarea" v-model="baseFormData.reason"
|
||||
placeholder="请输入详细说明" />
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
<view>
|
||||
<button type="primary" @click="submit()">提交</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
reactive
|
||||
} from 'vue'
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import {
|
||||
getNavBarPaddingTop
|
||||
} from '@/utils/system.js'
|
||||
|
||||
import {
|
||||
addLeaveApply
|
||||
} from '@/api/crm/activity/activity';
|
||||
|
||||
// 获取导航栏高度用于内容区域padding
|
||||
const navBarPaddingTop = ref(0);
|
||||
onMounted(() => {
|
||||
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
|
||||
})
|
||||
|
||||
// 表单ref
|
||||
const baseForm = ref(null);
|
||||
|
||||
const baseFormData = reactive({
|
||||
typeval: 1,
|
||||
startDate: getDate(Date.now()),
|
||||
endDate: getDate(Date.now()),
|
||||
days: 1,
|
||||
reason: '',
|
||||
startTime: '08:30',
|
||||
endTime: '12:30',
|
||||
});
|
||||
|
||||
const range = ref([{
|
||||
"value": 1,
|
||||
"text": "全天"
|
||||
}, {
|
||||
"value": 2,
|
||||
"text": "前半个班次"
|
||||
}, {
|
||||
"value": 3,
|
||||
"text": "后半个班次"
|
||||
}]);
|
||||
|
||||
const submit = async () => {
|
||||
try {
|
||||
|
||||
|
||||
if (baseFormData.reason == null || baseFormData.reason == "") {
|
||||
uni.showToast({
|
||||
title: '请填写详细说明',
|
||||
icon: 'error'
|
||||
});
|
||||
} else if (baseFormData.days == 0 || baseFormData.startDate < getDate(Date.now()) || baseFormData.endDate < getDate(Date.now())) {
|
||||
uni.showToast({
|
||||
title: '请确认日期',
|
||||
icon: 'error'
|
||||
});
|
||||
} else {
|
||||
if (baseFormData.typeval != 1) {
|
||||
baseFormData.endDate = baseFormData.startDate
|
||||
}
|
||||
// 验证表单
|
||||
await baseForm.value.validate();
|
||||
// 验证通过后的操作
|
||||
uni.showToast({
|
||||
title: '验证通过',
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
addLeaveApply(baseFormData).then(
|
||||
res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(function() {
|
||||
uni.navigateBack({
|
||||
success: () => {}
|
||||
})
|
||||
}, 500);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
} catch (err) {
|
||||
console.log('表单验证失败:', err);
|
||||
}
|
||||
};
|
||||
|
||||
let change = () => {
|
||||
if (baseFormData.typeval != 1) {
|
||||
if (baseFormData.typeval == 2) {
|
||||
baseFormData.startTime = '08:30'
|
||||
baseFormData.endTime = '12:30'
|
||||
} else {
|
||||
baseFormData.startTime = '13:00'
|
||||
baseFormData.endTime = '17:00'
|
||||
}
|
||||
|
||||
baseFormData.days = 0.5
|
||||
} else {
|
||||
let start = baseFormData.startDate
|
||||
let end = baseFormData.endDate
|
||||
baseFormData.days = getDayDiff(start, end);
|
||||
}
|
||||
}
|
||||
|
||||
function getDate(dateval) {
|
||||
const date = new Date(dateval)
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
return `${year}-${addZero(month)}-${addZero(day)}`
|
||||
}
|
||||
|
||||
function addZero(num) {
|
||||
if (num < 10) {
|
||||
num = `0${num}`
|
||||
}
|
||||
return num
|
||||
}
|
||||
|
||||
// 计算两个日期的天数差
|
||||
function getDayDiff(startDate, endDate) {
|
||||
// 处理日期格式(兼容iOS)
|
||||
const start = startDate.replace(/-/g, '/');
|
||||
const end = endDate.replace(/-/g, '/');
|
||||
|
||||
const date1 = new Date(start).getTime();
|
||||
const date2 = new Date(end).getTime();
|
||||
|
||||
if (date2 < date1) {
|
||||
return 0
|
||||
}
|
||||
|
||||
// 计算天数差(含边界值+1天)
|
||||
return Math.floor(Math.abs(date2 - date1) / (24 * 3600 * 1000)) + 1;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.example {
|
||||
padding: 15px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.segmented-control {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.button-group {
|
||||
margin-top: 15px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 35px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.inputborder {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
:deep(.uni-forms-item__label) {
|
||||
padding: 0 20rpx;
|
||||
background-color: rgba(103, 194, 58, 0.2);
|
||||
}
|
||||
|
||||
:deep(.custom-label-height .uni-forms-item__label) {
|
||||
height: 190rpx;
|
||||
}
|
||||
|
||||
::v-deep .uni-easyinput__content-textarea {
|
||||
height: 152rpx !important;
|
||||
}
|
||||
</style>
|
||||
316
src/pages/business/CRM/leave/addBackApply.vue
Normal file
316
src/pages/business/CRM/leave/addBackApply.vue
Normal file
@@ -0,0 +1,316 @@
|
||||
<template>
|
||||
<view class="con-body">
|
||||
<view class="con-bg">
|
||||
<!-- 头部 -->
|
||||
<customHeader ref="customHeaderRef" :title="'销假申请'" :leftFlag="true" :rightFlag="false">
|
||||
</customHeader>
|
||||
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height"></view>
|
||||
|
||||
<view class="white-bg">
|
||||
<view class="example">
|
||||
<view class="r-list" style="display: flex;font-size: 14px;padding-top: 32rpx;
|
||||
background-color: #03aa0315;height: 76rpx;">
|
||||
<view class="r-left">
|
||||
<label style="color: #03aa03;font-size: 34rpx;
|
||||
padding: 32rpx;background-color: #dcd8d933;">
|
||||
{{ applyData.days.replace('.0','')}} 天</label>
|
||||
</view>
|
||||
<view style="margin-top: -20rpx;">
|
||||
|
||||
<view class="r-right" style="margin-left: 30rpx;">
|
||||
{{ applyData.startDate }}
|
||||
至
|
||||
{{ applyData.endDate }}
|
||||
</view>
|
||||
<view class="r-right" style="margin-left: 30rpx;color: #00000095;">
|
||||
{{ applyData.reason }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-forms ref="baseForm" :modelValue="baseFormData" :label-width="80"
|
||||
style="margin-top: 20rpx;">
|
||||
<uni-forms-item label="销假模式">
|
||||
<uni-data-select v-model="baseFormData.typeval" :localdata="range"
|
||||
@change="change" :clear="false"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="开始日期">
|
||||
<uni-datetime-picker type="date" :clear-icon="false"
|
||||
placeholder="请输入开始日期" v-model="baseFormData.startDate"
|
||||
@change="change" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item v-show="baseFormData.typeval==1" label="结束日期">
|
||||
<uni-datetime-picker type="date" :clear-icon="false"
|
||||
placeholder="请输入结束日期" v-model="baseFormData.endDate"
|
||||
@change="change" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="开始时间" v-show="baseFormData.typeval!='1'">
|
||||
<uni-easyinput v-model="baseFormData.startTime" class="inputborder"
|
||||
:disabled="true" style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="结束时间" v-show="baseFormData.typeval!='1'">
|
||||
<uni-easyinput v-model="baseFormData.endTime" class="inputborder"
|
||||
:disabled="true" style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="销假天数">
|
||||
<uni-easyinput v-model="baseFormData.days" class="inputborder"
|
||||
:disabled="true" style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="详细说明" class="custom-label-height">
|
||||
<uni-easyinput type="textarea" v-model="baseFormData.reason" />
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
<view>
|
||||
<button type="primary" @click="submit()">提交</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
reactive
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import {
|
||||
addBackApply
|
||||
} from '@/api/crm/activity/activity';
|
||||
|
||||
// 表单ref
|
||||
let baseForm = ref(null);
|
||||
|
||||
const range = ref([{
|
||||
"value": 1,
|
||||
"text": "全天"
|
||||
}, {
|
||||
"value": 2,
|
||||
"text": "前半个班次"
|
||||
}, {
|
||||
"value": 3,
|
||||
"text": "后半个班次"
|
||||
}]);
|
||||
|
||||
let baseFormData = reactive({
|
||||
typeName: "全天",
|
||||
typeval: 1,
|
||||
startDate: getDate(Date.now()),
|
||||
endDate: getDate(Date.now()),
|
||||
days: 1,
|
||||
reason: '',
|
||||
startTime: '08:30',
|
||||
endTime: '12:30',
|
||||
});
|
||||
|
||||
let leaveId = ref(null);
|
||||
let applyData = ref(null);
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.data) {
|
||||
applyData.value = JSON.parse(decodeURIComponent(options.data))
|
||||
leaveId.value = applyData.value.leaveId
|
||||
}
|
||||
})
|
||||
|
||||
// 查询详情
|
||||
let item = ref({});
|
||||
const submit = async () => {
|
||||
try {
|
||||
if (baseFormData.days == 0 ||
|
||||
(baseFormData.typeval == 1 &&
|
||||
(applyData.value.endDate < baseFormData.endDate ||
|
||||
applyData.value.startDate > baseFormData.endDate)) ||
|
||||
applyData.value.endDate < baseFormData.startDate ||
|
||||
applyData.value.startDate > baseFormData.startDate ||
|
||||
baseFormData.startDate < getDate(Date.now()) ||
|
||||
parseFloat(baseFormData.days) > parseFloat(applyData.value.days) ||
|
||||
(parseFloat(applyData.value.days) == 0.5 && baseFormData.typeval != applyData
|
||||
.value.typeval)) {
|
||||
uni.showToast({
|
||||
title: '请确认日期',
|
||||
icon: 'error'
|
||||
});
|
||||
} else {
|
||||
if (baseFormData.typeval != 1) {
|
||||
baseFormData.endDate = baseFormData.startDate
|
||||
}
|
||||
// 验证表单
|
||||
await baseForm.value.validate();
|
||||
// 验证通过后的操作
|
||||
uni.showToast({
|
||||
title: '验证通过',
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
baseFormData.leaveId = leaveId.value
|
||||
|
||||
addBackApply(baseFormData).then(
|
||||
res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(function() {
|
||||
uni.navigateBack({
|
||||
success: () => {
|
||||
uni.$emit('isRefresh');
|
||||
}
|
||||
})
|
||||
}, 500);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
} catch (err) {
|
||||
console.log('表单验证失败:', err);
|
||||
}
|
||||
}
|
||||
|
||||
function getDate(dateval) {
|
||||
const date = new Date(dateval)
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
return `${year}-${addZero(month)}-${addZero(day)}`
|
||||
}
|
||||
|
||||
function addZero(num) {
|
||||
if (num < 10) {
|
||||
num = `0${num}`
|
||||
}
|
||||
return num
|
||||
}
|
||||
|
||||
let change = () => {
|
||||
if (baseFormData.typeval != 1) {
|
||||
if (baseFormData.typeval == 2) {
|
||||
baseFormData.startTime = '08:30'
|
||||
baseFormData.endTime = '12:30'
|
||||
} else {
|
||||
baseFormData.startTime = '13:00'
|
||||
baseFormData.endTime = '17:00'
|
||||
}
|
||||
|
||||
baseFormData.days = 0.5
|
||||
} else {
|
||||
let start = baseFormData.startDate
|
||||
let end = baseFormData.endDate
|
||||
baseFormData.days = getDayDiff(start, end);
|
||||
}
|
||||
|
||||
baseFormData.days = baseFormData.days.toString()
|
||||
}
|
||||
|
||||
// 计算两个日期的天数差
|
||||
function getDayDiff(startDate, endDate) {
|
||||
// 处理日期格式(兼容iOS)
|
||||
const start = startDate.replace(/-/g, '/');
|
||||
const end = endDate.replace(/-/g, '/');
|
||||
|
||||
const date1 = new Date(start).getTime();
|
||||
const date2 = new Date(end).getTime();
|
||||
|
||||
if (date2 < date1) {
|
||||
return 0
|
||||
}
|
||||
|
||||
// 计算天数差(含边界值+1天)
|
||||
return Math.floor(Math.abs(date2 - date1) / (24 * 3600 * 1000)) + 1;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.white-bg {
|
||||
width: 690rpx;
|
||||
margin: 0;
|
||||
border-radius: 8px 8px 0 0;
|
||||
}
|
||||
|
||||
.white-bg.white-bg-2 {
|
||||
border-radius: 0;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
:deep(.tabs-header) {
|
||||
/* background: none !important; */
|
||||
border-bottom: none !important;
|
||||
margin: 0 auto;
|
||||
gap: 5rpx;
|
||||
}
|
||||
|
||||
:deep(.tab-item) {
|
||||
color: #919191;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
/* flex:none; */
|
||||
/* margin: 0 -50rpx; */
|
||||
/* padding: 0 50rpx; */
|
||||
}
|
||||
|
||||
:deep(.tab-item:first-child) {
|
||||
text-align: right;
|
||||
margin-left: 230rpx;
|
||||
}
|
||||
|
||||
:deep(.tab-item:last-child) {
|
||||
text-align: left;
|
||||
margin-right: 230rpx;
|
||||
}
|
||||
|
||||
:deep(.tab-item.active) {
|
||||
color: #3384DF;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
:deep(.tab-item.active::after) {
|
||||
width: 100rpx;
|
||||
height: 8rpx;
|
||||
}
|
||||
|
||||
:deep(.is-disabled) {
|
||||
background-color: rgba(255, 255, 255, 1) !important;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
background-color: #67c23a;
|
||||
border: 1rpx solid #67c23a;
|
||||
color: #fff;
|
||||
/* padding: 0rpx 60rpx; */
|
||||
}
|
||||
|
||||
.btn-warning {
|
||||
background-color: #e6a23c;
|
||||
border: 1rpx solid #e6a23c;
|
||||
color: #fff;
|
||||
/* padding: 0rpx 60rpx; */
|
||||
}
|
||||
|
||||
:deep(.uni-forms-item__label) {
|
||||
padding: 0 20rpx;
|
||||
background-color: rgba(230, 162, 60, 0.2);
|
||||
}
|
||||
|
||||
:deep(.custom-label-height .uni-forms-item__label) {
|
||||
height: 190rpx;
|
||||
}
|
||||
|
||||
::v-deep .uni-easyinput__content-textarea {
|
||||
height: 152rpx !important;
|
||||
}
|
||||
</style>
|
||||
58
src/pages/business/CRM/leave/askLeave.vue
Normal file
58
src/pages/business/CRM/leave/askLeave.vue
Normal file
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<view class="con-body">
|
||||
<view class="con-bg">
|
||||
<customHeader ref="customHeaderRef" :title="'请假销假'" :leftFlag="true">
|
||||
</customHeader>
|
||||
<!-- #ifdef H5 -->
|
||||
<view style="height:50rpx"></view>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height"></view>
|
||||
|
||||
<view class="white-bg">
|
||||
<view class="logo-list">
|
||||
<view class="l-l-item" @click="handleJump('addApply')">
|
||||
<img :src="'static/images/business/icon-xxck.png'" />
|
||||
<text class="font-gray">请假申请</text>
|
||||
</view>
|
||||
<view class="l-l-item" @click="handleJump('backApply')">
|
||||
<img :src="'static/images/business/icon-xxtj.png'" />
|
||||
<text class="font-gray">销假申请</text>
|
||||
</view>
|
||||
<view class="l-l-item" @click="handleJump('myApply')">
|
||||
<img :src="'static/images/business/icon-zfbg.png'" />
|
||||
<text class="font-gray">我的表单</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted
|
||||
} from 'vue'
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import {
|
||||
getNavBarPaddingTop
|
||||
} from '@/utils/system.js'
|
||||
// 获取导航栏高度用于内容区域padding
|
||||
const navBarPaddingTop = ref(0);
|
||||
onMounted(() => {
|
||||
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
|
||||
})
|
||||
|
||||
// 跳转
|
||||
let handleJump=(url)=>{
|
||||
if(url){
|
||||
uni.navigateTo({ url })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
159
src/pages/business/CRM/leave/backApply.vue
Normal file
159
src/pages/business/CRM/leave/backApply.vue
Normal file
@@ -0,0 +1,159 @@
|
||||
<template>
|
||||
<view class="con-body">
|
||||
<view class="con-bg">
|
||||
<!-- 头部 -->
|
||||
<customHeader ref="customHeaderRef" :title="'销假申请'" :leftFlag="true" :rightFlag="true">
|
||||
</customHeader>
|
||||
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height" :style="{ paddingTop: navBarPaddingTop + 'px' }"></view>
|
||||
|
||||
<!-- 正文内容 -->
|
||||
<view class="white-bg">
|
||||
<view class="tabs-container">
|
||||
<view class="white-bg-2" v-for="(item, index) in list" :key="index" @click="handleDetail(item)">
|
||||
<view class="report-list">
|
||||
|
||||
<view class="title" style="margin-top: 10rpx;font-size: 30rpx">
|
||||
{{ item.typeval == '1' ? '全天' : item.typeval == '2' ? '前半个班次' : '后半个班次' }}
|
||||
|
||||
<label v-if="item.applyType == '请假'" style="float: right;color: #03aa03;">
|
||||
{{ item.applyType }}</label>
|
||||
<label v-if="item.applyType == '销假'" style="float: right;color: #aa9303;">
|
||||
{{ item.applyType }}</label>
|
||||
</view>
|
||||
<view class="apply-row" style="margin-top: 10px;">
|
||||
<view class="r-left" style="font-size: 15px;font-weight: 500;">
|
||||
申请日期 {{ item.applyDate }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="r-list">
|
||||
<view class="r-left">休假日期</view>
|
||||
<view class="r-right">{{ item.startDate }} 至 {{ item.endDate }}
|
||||
( <label style="color: #03aa03;">
|
||||
{{ item.days.replace('.0', '') }}天</label> )
|
||||
</view>
|
||||
</view>
|
||||
<view class="r-list">
|
||||
<view class="r-left">详细说明</view>
|
||||
<view v-if="item.reason && item.reason.length <= 18" class="r-right">{{ item.reason }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="r-list" style="margin-top: -30rpx;"
|
||||
v-if="item.reason && item.reason.length > 18">
|
||||
<view class="r-right">{{ item.reason }}</view>
|
||||
</view>
|
||||
<view class="border-bottom" style="margin: 20rpx 0;"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted
|
||||
} from 'vue'
|
||||
import {
|
||||
onShow
|
||||
} from '@dcloudio/uni-app'
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import {
|
||||
getNavBarPaddingTop
|
||||
} from '@/utils/system.js'
|
||||
import {
|
||||
getBackLeaveList
|
||||
} from '@/api/crm/activity/activity'
|
||||
|
||||
let list = ref([]);
|
||||
// 获取导航栏高度用于内容区域padding
|
||||
const navBarPaddingTop = ref(0);
|
||||
onMounted(() => {
|
||||
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
|
||||
getApplyList();
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
uni.$on('isRefresh', function () {
|
||||
getApplyList();
|
||||
})
|
||||
})
|
||||
|
||||
async function getApplyList() {
|
||||
let param = {
|
||||
num: 0,
|
||||
size: 10
|
||||
}
|
||||
let res = await getBackLeaveList(param);
|
||||
list.value = res.rows;
|
||||
}
|
||||
|
||||
// 跳转到添加申请
|
||||
let handleDetail = (item) => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/business/CRM/leave/addBackApply?data=" + encodeURIComponent(JSON
|
||||
.stringify(item))
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.all-body {
|
||||
/* #ifdef APP-PLUS */
|
||||
top: 150rpx;
|
||||
height: calc(100vh - 75px);
|
||||
/* #endif */
|
||||
/* #ifndef APP-PLUS */
|
||||
top: 120rpx;
|
||||
height: calc(100vh);
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.search {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.search .btn-search {
|
||||
border: none;
|
||||
background: none;
|
||||
line-height: normal;
|
||||
color: #fff;
|
||||
line-height: 56rpx !important;
|
||||
padding: 10rpx 0 0;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.search .btn-search::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.search .custom-search {
|
||||
width: 80%;
|
||||
|
||||
}
|
||||
|
||||
.search .custom-search.uni-searchbar {
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
|
||||
.scroll-h {
|
||||
/* #ifdef APP-PLUS */
|
||||
height: calc(100vh - 120px);
|
||||
/* #endif */
|
||||
/* #ifndef APP-PLUS */
|
||||
height: calc(100vh - 110px);
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.white-bg {
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
|
||||
:deep(.report-list .r-list) {
|
||||
padding: 0.5rem 0;
|
||||
}
|
||||
</style>
|
||||
237
src/pages/business/CRM/leave/myApply.vue
Normal file
237
src/pages/business/CRM/leave/myApply.vue
Normal file
@@ -0,0 +1,237 @@
|
||||
<template>
|
||||
<view class="con-body">
|
||||
<view class="con-bg">
|
||||
<customHeader ref="customHeaderRef" :title="'我的表单'" :leftFlag="true">
|
||||
</customHeader>
|
||||
<!-- #ifdef H5 -->
|
||||
<view style="height:50rpx"></view>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height"></view>
|
||||
|
||||
<view class="white-bg">
|
||||
<view class="tabs-container">
|
||||
<view class="tabs-scorll">
|
||||
<view class="tabs-header">
|
||||
<view v-for="(tab, index) in tabList" :key="index"
|
||||
:class="['tab-item', { 'active': activeTab === index }]"
|
||||
@click="switchTab(index)">
|
||||
{{ tab }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="white-bg-2" v-for="item in detailList">
|
||||
<view class="report-list" @click="showDetail(item)">
|
||||
<view class="title" style="margin-top: 20rpx;font-size: 30rpx">
|
||||
{{ item.typeval=="1"?'全天':item.typeval=="2"?'前半个班次':'后半个班次' }}
|
||||
<label v-if="item.applyType=='请假'"
|
||||
style="float: right;color: #03ca03;">
|
||||
{{ item.applyType}}</label>
|
||||
<label v-if="item.applyType=='销假'"
|
||||
style="float: right;color: #eaa303;">
|
||||
{{ item.applyType}}</label>
|
||||
</view>
|
||||
<view class="r-list">
|
||||
<view class="r-left" style="font-size: 30rpx;font-weight: 500;">
|
||||
申请日期:{{ item.applyDate }}
|
||||
( <label v-if="item.status=='待审批'"
|
||||
style="color: #03ca03;">{{ item.reviewStatus }}</label>
|
||||
<label v-if="item.status=='审批中'"
|
||||
style="color: #03ca03;">{{ item.reviewStatus }}</label>
|
||||
<label v-if="item.status=='驳回'"
|
||||
style="color: #fa3303;">{{ item.reviewStatus }}</label>
|
||||
<label v-if="item.status=='完成'"
|
||||
style="color: #03aaf3;">{{ item.reviewStatus }}</label>)
|
||||
</view>
|
||||
</view>
|
||||
<view class="r-list">
|
||||
<view class="r-left">休假日期</view>
|
||||
<view class="r-right">{{ item.startDate }} 至 {{ item.endDate }}
|
||||
( <label v-if="item.applyType=='请假'" style="color: #03ca03;">
|
||||
{{ item.days.replace('.0','')}}天</label>
|
||||
<label v-if="item.applyType=='销假'" style="color: #eaa303;">
|
||||
{{ item.days.replace('.0','')}}天</label> )
|
||||
</view>
|
||||
</view>
|
||||
<view class="r-list">
|
||||
<view class="r-left">详细说明</view>
|
||||
<view v-if="item.reason && item.reason.length <= 18"
|
||||
class="r-right">{{ item.reason }}</view>
|
||||
</view>
|
||||
<view class="border-bottom" style="margin: 20rpx 0;"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="uni-pagination-box"><uni-pagination show-icon :page-size="pageSize"
|
||||
:current="pageCurrent" :total="total" @change="change" /></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
reactive
|
||||
} from 'vue'
|
||||
import {
|
||||
onShow
|
||||
} from '@dcloudio/uni-app'
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import {
|
||||
getNavBarPaddingTop
|
||||
} from '@/utils/system.js'
|
||||
|
||||
import {
|
||||
getLeaveApplyList
|
||||
} from '@/api/crm/activity/activity';
|
||||
|
||||
// 获取导航栏高度用于内容区域padding
|
||||
const navBarPaddingTop = ref(0);
|
||||
onMounted(() => {
|
||||
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
|
||||
getlist();
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
uni.$on('isRefresh', function() {
|
||||
getlist();
|
||||
})
|
||||
})
|
||||
|
||||
const pageSize = ref(4);
|
||||
const pageCurrent = ref(1);
|
||||
const loading = ref(false);
|
||||
let tabList = ref([])
|
||||
|
||||
let total = ref(0);
|
||||
const totalAll = ref(0);
|
||||
const totalReview = ref(0);
|
||||
const totalReject = ref(0);
|
||||
const totalPass = ref(0);
|
||||
|
||||
|
||||
let activeTab = ref(0);
|
||||
|
||||
let detailList = ref([])
|
||||
let detailLists = ref([])
|
||||
|
||||
let reviewList = ref([])
|
||||
let rejectList = ref([])
|
||||
let passList = ref([])
|
||||
|
||||
const getlist = async () => {
|
||||
loading.value = true
|
||||
|
||||
let res = await getLeaveApplyList();
|
||||
detailLists.value = res.rows;
|
||||
reviewList.value = res.rows.filter(t => t.status == '待审批' || t.status == '审批中')
|
||||
rejectList.value = res.rows.filter(t => t.status == '驳回')
|
||||
passList.value = res.rows.filter(t => t.status == '完成')
|
||||
|
||||
total.value = res.total
|
||||
totalAll.value = res.total
|
||||
totalReview.value = reviewList.value.length
|
||||
totalReject.value = rejectList.value.length
|
||||
totalPass.value = passList.value.length
|
||||
|
||||
change({
|
||||
current: 1
|
||||
})
|
||||
loading.value = false
|
||||
|
||||
let all = '全部(' + totalAll.value + ')'
|
||||
let review = '审核中(' + totalReview.value + ')'
|
||||
let reject = '已驳回(' + totalReject.value + ')'
|
||||
let pass = '已通过(' + totalPass.value + ')'
|
||||
|
||||
tabList.value = [all, review, reject, pass]
|
||||
}
|
||||
|
||||
const switchTab = (index) => {
|
||||
activeTab.value = index
|
||||
|
||||
change({
|
||||
current: 1
|
||||
})
|
||||
}
|
||||
|
||||
// 分页触发
|
||||
let change = (e) => {
|
||||
pageCurrent.value = e.current
|
||||
|
||||
let end = pageSize.value * e.current
|
||||
let start = end - pageSize.value
|
||||
|
||||
if (activeTab.value == 0) {
|
||||
detailList.value = detailLists.value.slice(start, end)
|
||||
total.value = totalAll.value
|
||||
} else if (activeTab.value == 1) {
|
||||
detailList.value = reviewList.value.slice(start, end)
|
||||
total.value = totalReview.value
|
||||
} else if (activeTab.value == 2) {
|
||||
detailList.value = rejectList.value.slice(start, end)
|
||||
total.value = totalReject.value
|
||||
} else if (activeTab.value == 3) {
|
||||
detailList.value = passList.value.slice(start, end)
|
||||
total.value = totalPass.value
|
||||
}
|
||||
}
|
||||
|
||||
// 跳转
|
||||
let showDetail = (item) => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/business/CRM/leave/myApplyDetail?data=" + encodeURIComponent(JSON
|
||||
.stringify(item))
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.apply-row {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
margin: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tabs-header {
|
||||
display: flex;
|
||||
height: 80rpx;
|
||||
background: #fff;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.tab-item.active {
|
||||
color: #007AFF;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tab-item.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 150rpx;
|
||||
height: 4rpx;
|
||||
background-color: #007AFF;
|
||||
}
|
||||
|
||||
:deep(.report-list .r-list) {
|
||||
padding: 0.5rem 0;
|
||||
}
|
||||
</style>
|
||||
313
src/pages/business/CRM/leave/myApplyDetail.vue
Normal file
313
src/pages/business/CRM/leave/myApplyDetail.vue
Normal file
@@ -0,0 +1,313 @@
|
||||
<template>
|
||||
<view class="con-body">
|
||||
<view class="con-bg">
|
||||
<!-- 头部 -->
|
||||
<customHeader ref="customHeaderRef" :title="'表单详情'" :leftFlag="true" :rightFlag="false">
|
||||
</customHeader>
|
||||
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height"></view>
|
||||
<view class="white-bg">
|
||||
<view class="example">
|
||||
<uni-forms ref="baseForm" :modelValue="baseFormData" :label-width="80">
|
||||
<uni-forms-item :label="baseFormData.applyType == '请假' ? '请假模式' : '销假模式'"
|
||||
:class="baseFormData.applyType == '请假' ? 'leaveApple' : 'backLeave'">
|
||||
<uni-easyinput v-model="baseFormData.typeName" class="inputborder"
|
||||
:disabled="true" style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="开始日期"
|
||||
:class="baseFormData.applyType == '请假' ? 'leaveApple' : 'backLeave'">
|
||||
<uni-easyinput v-model="baseFormData.startDate" class="inputborder"
|
||||
:disabled="true" style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item v-show="baseFormData.typeval == '1'" label="结束日期"
|
||||
:class="baseFormData.applyType == '请假' ? 'leaveApple' : 'backLeave'">
|
||||
<uni-easyinput v-model="baseFormData.endDate" class="inputborder"
|
||||
:disabled="true" style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="开始时间" v-show="baseFormData.typeval != '1'"
|
||||
:class="baseFormData.applyType == '请假' ? 'leaveApple' : 'backLeave'">
|
||||
<uni-easyinput v-model="baseFormData.startTime" class="inputborder"
|
||||
:disabled="true" style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="结束时间" v-show="baseFormData.typeval != '1'"
|
||||
:class="baseFormData.applyType == '请假' ? 'leaveApple' : 'backLeave'">
|
||||
<uni-easyinput v-model="baseFormData.endTime" class="inputborder"
|
||||
:disabled="true" style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item :label="baseFormData.applyType == '请假' ? '请假天数' : '销假天数'"
|
||||
:class="baseFormData.applyType == '请假' ? 'leaveApple' : 'backLeave'">
|
||||
<uni-easyinput v-model="baseFormData.days" class="inputborder"
|
||||
:disabled="true" style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="详细说明"
|
||||
:class="baseFormData.applyType == '请假' ? 'leaveApple custom-label-height' : 'backLeave custom-label-height'">
|
||||
<uni-easyinput type="textarea" v-model="baseFormData.reason"
|
||||
:disabled="true" />
|
||||
</uni-forms-item>
|
||||
|
||||
<view v-if="baseFormData.reviewList.length > 0" class="reviewContent">
|
||||
<view style="display: flex;margin-top: 10rpx;"
|
||||
v-for="(item, index) in baseFormData.reviewList" :key="index">
|
||||
<label style="width: 150rpx;">{{ item.userName }}:</label>
|
||||
<label style="width: 100rpx;color: #03aa03;"
|
||||
v-if="item.reviewResult == '通过'">{{
|
||||
item.reviewResult }}</label>
|
||||
<label style="width: 100rpx;color: #fa3303;"
|
||||
v-if="item.reviewResult == '驳回'">{{
|
||||
item.reviewResult }}</label>
|
||||
<view style="max-width: 400rpx; overflow-y: auto;">
|
||||
{{ item.rejectReason }}
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="footer-con" style="margin-top: 20rpx;"
|
||||
v-if="baseFormData.status == '待审批' || baseFormData.status == '审批中'">
|
||||
<button class="btn-warning" @click="cancelApply()">撤销</button>
|
||||
</view>
|
||||
</uni-forms>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
reactive
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import customTabs from '@/components/customTabs.vue';
|
||||
import {
|
||||
getDelLeaveApply
|
||||
} from '@/api/crm/activity/activity';
|
||||
|
||||
// 表单ref
|
||||
let baseForm = ref(null);
|
||||
|
||||
let baseFormData = reactive({
|
||||
typeName: "全天",
|
||||
typeval: 1,
|
||||
startDate: getDate(Date.now()),
|
||||
endDate: getDate(Date.now()),
|
||||
days: 1,
|
||||
reason: '',
|
||||
startTime: '08:30',
|
||||
endTime: '12:30',
|
||||
reviewList: []
|
||||
});
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.data) {
|
||||
baseFormData = JSON.parse(decodeURIComponent(options.data))
|
||||
change()
|
||||
|
||||
baseFormData.days = baseFormData.days.toString()
|
||||
}
|
||||
})
|
||||
|
||||
const cancelApply = async () => {
|
||||
try {
|
||||
uni.showModal({
|
||||
title: '',
|
||||
content: '您确定要撤销申请吗?',
|
||||
confirmColor: '#007AFF',
|
||||
cancelColor: '#999999',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
getDelLeaveApply({
|
||||
leaveId: baseFormData.leaveId,
|
||||
backId: baseFormData.backId,
|
||||
applyType: baseFormData.applyType
|
||||
}).then(
|
||||
res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '撤销成功',
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(function() {
|
||||
uni.navigateBack({
|
||||
success: () => {
|
||||
uni.$emit('isRefresh');
|
||||
}
|
||||
})
|
||||
}, 500);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
} else if (res.cancel) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} catch (err) {
|
||||
console.log('表单验证失败:', err);
|
||||
}
|
||||
};
|
||||
|
||||
function getDate(dateval) {
|
||||
const date = new Date(dateval)
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
return `${year}-${addZero(month)}-${addZero(day)}`
|
||||
}
|
||||
|
||||
function addZero(num) {
|
||||
if (num < 10) {
|
||||
num = `0${num}`
|
||||
}
|
||||
return num
|
||||
}
|
||||
|
||||
let change = () => {
|
||||
if (baseFormData.typeval != 1) {
|
||||
if (baseFormData.typeval == 2) {
|
||||
baseFormData.startTime = '08:30'
|
||||
baseFormData.endTime = '12:30'
|
||||
|
||||
baseFormData.typeName = '前半个班次'
|
||||
} else {
|
||||
baseFormData.startTime = '13:00'
|
||||
baseFormData.endTime = '17:00'
|
||||
|
||||
baseFormData.typeName = '后半个班次'
|
||||
}
|
||||
|
||||
baseFormData.days = 0.5
|
||||
} else {
|
||||
let start = baseFormData.startDate
|
||||
let end = baseFormData.endDate
|
||||
baseFormData.days = getDayDiff(start, end);
|
||||
|
||||
baseFormData.typeName = '全天'
|
||||
}
|
||||
|
||||
baseFormData.days = baseFormData.days.toString()
|
||||
}
|
||||
|
||||
// 计算两个日期的天数差
|
||||
function getDayDiff(startDate, endDate) {
|
||||
// 处理日期格式(兼容iOS)
|
||||
const start = startDate.replace(/-/g, '/');
|
||||
const end = endDate.replace(/-/g, '/');
|
||||
|
||||
const date1 = new Date(start).getTime();
|
||||
const date2 = new Date(end).getTime();
|
||||
|
||||
if (date2 < date1) {
|
||||
return 0
|
||||
}
|
||||
|
||||
// 计算天数差(含边界值+1天)
|
||||
return Math.floor(Math.abs(date2 - date1) / (24 * 3600 * 1000)) + 1;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.white-bg {
|
||||
width: 690rpx;
|
||||
margin: 0;
|
||||
border-radius: 8px 8px 0 0;
|
||||
}
|
||||
|
||||
.white-bg.white-bg-2 {
|
||||
border-radius: 0;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
:deep(.tabs-header) {
|
||||
/* background: none !important; */
|
||||
border-bottom: none !important;
|
||||
margin: 0 auto;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
:deep(.tab-item) {
|
||||
color: #919191;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
/* flex:none; */
|
||||
/* margin: 0 -50rpx; */
|
||||
/* padding: 0 50rpx; */
|
||||
}
|
||||
|
||||
:deep(.tab-item:first-child) {
|
||||
text-align: right;
|
||||
margin-left: 230rpx;
|
||||
}
|
||||
|
||||
:deep(.tab-item:last-child) {
|
||||
text-align: left;
|
||||
margin-right: 230rpx;
|
||||
}
|
||||
|
||||
:deep(.tab-item.active) {
|
||||
color: #3384DF;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
:deep(.tab-item.active::after) {
|
||||
width: 100rpx;
|
||||
height: 8rpx;
|
||||
}
|
||||
|
||||
:deep(.is-disabled) {
|
||||
background-color: rgba(255, 255, 255, 1) !important;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
background-color: #67c23a;
|
||||
border: 1px solid #67c23a;
|
||||
color: #fff;
|
||||
/* padding: 0rpx 60rpx; */
|
||||
}
|
||||
|
||||
.btn-warning {
|
||||
background-color: #f6b23c;
|
||||
border: 1px solid #f6b23c;
|
||||
color: #fff;
|
||||
/* padding: 0rpx 60rpx; */
|
||||
}
|
||||
|
||||
.leaveApple {
|
||||
background-color: rgba(103, 194, 58, 0.2);
|
||||
}
|
||||
|
||||
.backLeave {
|
||||
background-color: rgba(230, 162, 60, 0.2);
|
||||
}
|
||||
|
||||
:deep(.uni-forms-item__label) {
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
:deep(.custom-label-height .uni-forms-item__label) {
|
||||
height: 190rpx;
|
||||
}
|
||||
|
||||
::v-deep .uni-easyinput__content-textarea {
|
||||
height: 166rpx !important;
|
||||
}
|
||||
|
||||
.reviewContent {
|
||||
border: 1px solid #dcdfe6;
|
||||
padding: 20rpx;
|
||||
}
|
||||
</style>
|
||||
318
src/pages/business/CRM/leave/reviewDetail.vue
Normal file
318
src/pages/business/CRM/leave/reviewDetail.vue
Normal file
@@ -0,0 +1,318 @@
|
||||
<template>
|
||||
<view class="con-body">
|
||||
<view class="con-bg">
|
||||
<!-- 头部 -->
|
||||
<customHeader ref="customHeaderRef" :title="'审批详情'" :leftFlag="true" :rightFlag="false">
|
||||
</customHeader>
|
||||
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height"></view>
|
||||
|
||||
<view class="white-bg">
|
||||
<view class="example">
|
||||
<view v-if="baseFormData.applyType != '请假'" style="display: flex;font-size: 14px;padding-top: 32rpx;
|
||||
background-color: #03aa0315;height: 76rpx;">
|
||||
<view class="r-left">
|
||||
<label style="color: #03aa03;font-size: 34rpx;
|
||||
padding: 32rpx;background-color: #dcd8d933;">
|
||||
{{ baseFormData.days.replace('.0', '') }} 天</label>
|
||||
</view>
|
||||
<view style="margin-top: -20rpx;">
|
||||
<view class="r-right" style="margin-left: 30rpx;">
|
||||
{{ baseFormData.startDate }}
|
||||
至
|
||||
{{ baseFormData.endDate }}
|
||||
</view>
|
||||
<view class="r-right" style="margin-left: 30rpx;color: #00000095;">
|
||||
{{ baseFormData.reason }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<uni-forms ref="baseForm" :modelValue="baseFormData" :label-width="80" style="margin-top: 10rpx;">
|
||||
<uni-forms-item :label="baseFormData.applyType == '请假' ? '请假模式' : '销假模式'"
|
||||
:class="baseFormData.applyType == '请假' ? 'leaveApple' : 'backLeave'">
|
||||
<uni-easyinput v-model="baseFormData.typeName" class="inputborder" :disabled="true"
|
||||
style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="开始日期" :class="baseFormData.applyType == '请假' ? 'leaveApple' : 'backLeave'">
|
||||
<uni-easyinput v-model="baseFormData.startDate" class="inputborder" :disabled="true"
|
||||
style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item v-show="baseFormData.typeval == '1'" label="结束日期"
|
||||
:class="baseFormData.applyType == '请假' ? 'leaveApple' : 'backLeave'">
|
||||
<uni-easyinput v-model="baseFormData.endDate" class="inputborder" :disabled="true"
|
||||
style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="开始时间" v-show="baseFormData.typeval != '1'"
|
||||
:class="baseFormData.applyType == '请假' ? 'leaveApple' : 'backLeave'">
|
||||
<uni-easyinput v-model="baseFormData.startTime" class="inputborder" :disabled="true"
|
||||
style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="结束时间" v-show="baseFormData.typeval != '1'"
|
||||
:class="baseFormData.applyType == '请假' ? 'leaveApple' : 'backLeave'">
|
||||
<uni-easyinput v-model="baseFormData.endTime" class="inputborder" :disabled="true"
|
||||
style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item :label="baseFormData.applyType == '请假' ? '请假天数' : '销假天数'"
|
||||
:class="baseFormData.applyType == '请假' ? 'leaveApple' : 'backLeave'">
|
||||
<uni-easyinput v-model="baseFormData.days" class="inputborder" :disabled="true"
|
||||
style="text-align: center;" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="详细说明"
|
||||
:class="baseFormData.applyType == '请假' ? 'leaveApple custom-label-height' : 'backLeave custom-label-height'">
|
||||
<uni-easyinput type="textarea" v-model="baseFormData.reason" :disabled="true" />
|
||||
</uni-forms-item>
|
||||
<view class="border-bottom" style="width: 100%;"></view>
|
||||
<view style="margin-top: 20rpx;">
|
||||
<uni-forms-item label="审核意见" class="custom-label-height">
|
||||
<uni-easyinput type="textarea" v-model="rejectReason" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
</uni-forms>
|
||||
</view>
|
||||
<view class="footer-con" style="display: flex;" v-if="baseFormData.reviewerId != 0">
|
||||
<button class="btn-warning" type="warning" @click="submit('驳回')" size="mini">驳回</button>
|
||||
<button class="btn-success" type="success" @click="submit('同意')" size="mini">同意</button>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
reactive
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import customTabs from '@/components/customTabs.vue';
|
||||
import {
|
||||
addReviewLeave
|
||||
} from '@/api/crm/activity/activity';
|
||||
|
||||
// 表单ref
|
||||
let baseForm = ref(null);
|
||||
|
||||
let rejectReason = ref(null);
|
||||
|
||||
let baseFormData = reactive({
|
||||
typeName: "全天",
|
||||
typeval: 1,
|
||||
startDate: getDate(Date.now()),
|
||||
endDate: getDate(Date.now()),
|
||||
days: 1,
|
||||
reason: '',
|
||||
startTime: '08:30',
|
||||
endTime: '12:30',
|
||||
});
|
||||
|
||||
onLoad((options) => {
|
||||
rejectReason.value = ""
|
||||
if (options.data) {
|
||||
baseFormData = JSON.parse(decodeURIComponent(options.data))
|
||||
change()
|
||||
|
||||
baseFormData.days = baseFormData.days.toString()
|
||||
baseFormData.leaveDays = baseFormData.leaveDays.replace('.0', '')
|
||||
|
||||
if (baseFormData.reviewerIdR != null) {
|
||||
rejectReason.value = baseFormData.rejectReason
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// 查询详情
|
||||
let item = ref({});
|
||||
const submit = async (status) => {
|
||||
if (status == '驳回' && (rejectReason.value == null || rejectReason.value == "")) {
|
||||
uni.showToast({
|
||||
title: '请填写驳回原因',
|
||||
duration: 2000
|
||||
});
|
||||
} else {
|
||||
let param = {
|
||||
reviewStatus: status == '同意' ? '完成' : '驳回',
|
||||
reviewResult: status == '同意' ? '通过' : '驳回',
|
||||
rejectReason: rejectReason.value,
|
||||
applyType: baseFormData.applyType,
|
||||
leaveId: baseFormData.leaveId,
|
||||
backId: baseFormData.backId,
|
||||
days: baseFormData.days,
|
||||
}
|
||||
addReviewLeave(param).then(
|
||||
res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(function () {
|
||||
uni.navigateBack({
|
||||
success: () => {
|
||||
uni.$emit('isRefresh');
|
||||
}
|
||||
})
|
||||
}, 500);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function getDate(dateval) {
|
||||
const date = new Date(dateval)
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
return `${year}-${addZero(month)}-${addZero(day)}`
|
||||
}
|
||||
|
||||
function addZero(num) {
|
||||
if (num < 10) {
|
||||
num = `0${num}`
|
||||
}
|
||||
return num
|
||||
}
|
||||
|
||||
let change = () => {
|
||||
if (baseFormData.typeval != 1) {
|
||||
if (baseFormData.typeval == 2) {
|
||||
baseFormData.startTime = '08:30'
|
||||
baseFormData.endTime = '12:30'
|
||||
|
||||
baseFormData.typeName = '前半个班次'
|
||||
} else {
|
||||
baseFormData.startTime = '13:00'
|
||||
baseFormData.endTime = '17:00'
|
||||
|
||||
baseFormData.typeName = '后半个班次'
|
||||
}
|
||||
|
||||
baseFormData.days = 0.5
|
||||
} else {
|
||||
let start = baseFormData.startDate
|
||||
let end = baseFormData.endDate
|
||||
baseFormData.days = getDayDiff(start, end);
|
||||
|
||||
baseFormData.typeName = '全天'
|
||||
}
|
||||
|
||||
baseFormData.days = baseFormData.days.toString()
|
||||
}
|
||||
|
||||
// 计算两个日期的天数差
|
||||
function getDayDiff(startDate, endDate) {
|
||||
// 处理日期格式(兼容iOS)
|
||||
const start = startDate.replace(/-/g, '/');
|
||||
const end = endDate.replace(/-/g, '/');
|
||||
|
||||
const date1 = new Date(start).getTime();
|
||||
const date2 = new Date(end).getTime();
|
||||
|
||||
if (date2 < date1) {
|
||||
return 0
|
||||
}
|
||||
|
||||
// 计算天数差(含边界值+1天)
|
||||
return Math.floor(Math.abs(date2 - date1) / (24 * 3600 * 1000)) + 1;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.white-bg {
|
||||
width: 690rpx;
|
||||
margin: 0;
|
||||
border-radius: 8px 8px 0 0;
|
||||
}
|
||||
|
||||
.white-bg.white-bg-2 {
|
||||
border-radius: 0;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
:deep(.tabs-header) {
|
||||
/* background: none !important; */
|
||||
border-bottom: none !important;
|
||||
margin: 0 auto;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
:deep(.tab-item) {
|
||||
color: #919191;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
/* flex:none; */
|
||||
/* margin: 0 -50rpx; */
|
||||
/* padding: 0 50rpx; */
|
||||
}
|
||||
|
||||
:deep(.tab-item:first-child) {
|
||||
text-align: right;
|
||||
margin-left: 230rpx;
|
||||
}
|
||||
|
||||
:deep(.tab-item:last-child) {
|
||||
text-align: left;
|
||||
margin-right: 230rpx;
|
||||
}
|
||||
|
||||
:deep(.tab-item.active) {
|
||||
color: #3384DF;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
:deep(.tab-item.active::after) {
|
||||
width: 100rpx;
|
||||
height: 8rpx;
|
||||
}
|
||||
|
||||
:deep(.is-disabled) {
|
||||
background-color: rgba(255, 255, 255, 1) !important;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
background-color: #67d23a;
|
||||
border: 1px solid #67d23a;
|
||||
color: #fff;
|
||||
/* padding: 0rpx 60rpx; */
|
||||
}
|
||||
|
||||
.btn-warning {
|
||||
background-color: #f6b23c;
|
||||
border: 1px solid #f6b23c;
|
||||
color: #fff;
|
||||
/* padding: 0rpx 60rpx; */
|
||||
}
|
||||
|
||||
.leaveApple {
|
||||
background-color: rgba(103, 194, 58, 0.2);
|
||||
}
|
||||
|
||||
.backLeave {
|
||||
background-color: rgba(230, 162, 60, 0.2);
|
||||
}
|
||||
|
||||
:deep(.uni-forms-item__label) {
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
:deep(.custom-label-height .uni-forms-item__label) {
|
||||
height: 190rpx;
|
||||
}
|
||||
|
||||
::v-deep .uni-easyinput__content-textarea {
|
||||
height: 166rpx !important;
|
||||
}
|
||||
</style>
|
||||
376
src/pages/business/CRM/leave/reviewLeave.vue
Normal file
376
src/pages/business/CRM/leave/reviewLeave.vue
Normal file
@@ -0,0 +1,376 @@
|
||||
<template>
|
||||
<view class="con-body">
|
||||
<view class="con-bg">
|
||||
<customHeader ref="customHeaderRef" :title="'我的审批'" :leftFlag="true">
|
||||
</customHeader>
|
||||
<!-- #ifdef H5 -->
|
||||
<view style="height:50rpx"></view>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height"></view>
|
||||
|
||||
<view class="white-bg">
|
||||
<view class="tabs-container">
|
||||
<view class="search">
|
||||
<uni-search-bar class="custom-search" radius="28" placeholder="姓名" clearButton="auto"
|
||||
cancelButton="none" bgColor="#6FA2F8" textColor="#ffffff" v-model="searchValue" />
|
||||
<button type="default" @click="handleSearch" size="mini" class="btn-search">查询</button>
|
||||
</view>
|
||||
|
||||
<view class="tabs-scorll">
|
||||
<view class="tabs-header">
|
||||
<view v-for="(tab, index) in tabHeaderList" :key="index"
|
||||
:class="['tab-item-main', { 'active': activeTabHeader === index }]"
|
||||
@click="switchTabHeader(index)">
|
||||
{{ tab }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tabs-scorll">
|
||||
<view class="tabs-header">
|
||||
<view v-for="(tab, index) in tabList" :key="index"
|
||||
:class="['tab-item', { 'active': activeTab === index }]" @click="switchTab(index)">
|
||||
{{ tab }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="white-bg-2" v-for="item in detailList">
|
||||
<view class="report-list" @click="showDetail(item)">
|
||||
<view class="report-list">
|
||||
<view class="title" style="font-size: 30rpx;margin-top: 20rpx;">
|
||||
{{ item.typeval == '1' ? '全天' : item.typeval == '2' ? '前半个班次' : '后半个班次' }}
|
||||
|
||||
<label v-if="item.applyType == '请假'" style="float: right;color: #03ca03;">
|
||||
{{ item.applyType }}</label>
|
||||
<label v-if="item.applyType == '销假'" style="float: right;color: #eaa303;">
|
||||
{{ item.applyType }}</label>
|
||||
</view>
|
||||
<view class="r-list">
|
||||
<view class="r-left">姓名</view>
|
||||
<view class="r-right">{{ item.applyUserName }} </view>
|
||||
</view>
|
||||
<view class="r-list">
|
||||
<view class="r-left">{{ item.applyType }}日期</view>
|
||||
<view class="r-right">{{ item.startDate }} 至 {{ item.endDate }}
|
||||
( <label v-if="item.applyType == '请假'" style="color: #03ca03;">
|
||||
{{ item.days.replace('.0', '') }}天</label>
|
||||
<label v-if="item.applyType == '销假'" style="color: #eaa303;">
|
||||
{{ item.days.replace('.0', '') }}天</label> )
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="r-list">
|
||||
<view class="r-left">详细说明</view>
|
||||
<view v-if="item.reason && item.reason.length <= 18" class="r-right">{{ item.reason
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="r-list" style="margin-top: -30rpx;"
|
||||
v-if="item.reason && item.reason.length > 18">
|
||||
<view class="r-right">{{ item.reason }}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="border-bottom" style="margin: 20rpx 0;"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="uni-pagination-box"><uni-pagination show-icon :page-size="pageSize"
|
||||
:current="pageCurrent" :total="total" @change="change" /></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
reactive
|
||||
} from 'vue'
|
||||
import {
|
||||
onShow
|
||||
} from '@dcloudio/uni-app'
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import {
|
||||
getNavBarPaddingTop
|
||||
} from '@/utils/system.js'
|
||||
|
||||
import {
|
||||
getMyReviewList
|
||||
} from '@/api/crm/activity/activity';
|
||||
|
||||
// 获取导航栏高度用于内容区域padding
|
||||
const navBarPaddingTop = ref(0);
|
||||
onMounted(() => {
|
||||
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
|
||||
getlist();
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
uni.$on('isRefresh', function () {
|
||||
isRefresh.value = true
|
||||
getApplyList();
|
||||
})
|
||||
})
|
||||
|
||||
function getApplyList() {
|
||||
getlist({
|
||||
applyUserName: searchValue.value
|
||||
})
|
||||
}
|
||||
|
||||
let isRefresh = ref(false)
|
||||
|
||||
let searchValue = ref(null)
|
||||
// 查询搜索跳转
|
||||
let handleSearch = () => {
|
||||
isRefresh.value = true
|
||||
getApplyList();
|
||||
}
|
||||
|
||||
const pageSize = ref(4);
|
||||
const pageCurrent = ref(1);
|
||||
const loading = ref(false);
|
||||
let tabList = ref([])
|
||||
let tabHeaderList = ref(['待审核', '已审核'])
|
||||
|
||||
let total = ref(0);
|
||||
const totalAll = ref(0);
|
||||
const totalReview = ref(0);
|
||||
const totalReviewA = ref(0);
|
||||
const totalReviewB = ref(0);
|
||||
const totalReject = ref(0);
|
||||
const totalPass = ref(0);
|
||||
|
||||
|
||||
let activeTab = ref(0);
|
||||
let activeTabHeader = ref(0);
|
||||
|
||||
let detailList = ref([])
|
||||
let detailLists = ref([])
|
||||
|
||||
//请假
|
||||
let reviewListA = ref([])
|
||||
//销假
|
||||
let reviewListB = ref([])
|
||||
//驳回
|
||||
let rejectList = ref([])
|
||||
//通过
|
||||
let passList = ref([])
|
||||
//已审批
|
||||
let reviewList = ref([])
|
||||
|
||||
const getlist = async (param) => {
|
||||
loading.value = true
|
||||
|
||||
let res = await getMyReviewList(param);
|
||||
detailLists.value = res.rows;
|
||||
reviewListA.value = res.rows.filter(t => (t.status == '待审批' || t.status == '审批中') && t
|
||||
.applyType == '请假' && t.reviewerIdR == null)
|
||||
reviewListB.value = res.rows.filter(t => (t.status == '待审批' || t.status == '审批中') && t
|
||||
.applyType == '销假' && t.reviewerIdR == null)
|
||||
|
||||
rejectList.value = res.rows.filter(t => t.status == '驳回' && t.reviewerIdR != null)
|
||||
passList.value = res.rows.filter(t => t.status != '驳回' && t.reviewerIdR != null)
|
||||
|
||||
reviewList.value = res.rows.filter(t => t.reviewerIdR != null)
|
||||
|
||||
total.value = res.total
|
||||
|
||||
totalReviewA.value = reviewListA.value.length
|
||||
totalReviewB.value = reviewListB.value.length
|
||||
|
||||
totalReview.value = totalReviewA.value + totalReviewB.value
|
||||
totalReject.value = rejectList.value.length
|
||||
totalPass.value = passList.value.length
|
||||
|
||||
totalAll.value = reviewList.value.length
|
||||
|
||||
if (isRefresh.value == false) {
|
||||
switchTabHeader(0)
|
||||
switchTab(0)
|
||||
}
|
||||
|
||||
if (activeTabHeader.value == 0) {
|
||||
tabList.value = ['请假(' + totalReviewA.value + ')', '销假(' + totalReviewB.value + ')']
|
||||
} else if (activeTabHeader.value == 1) {
|
||||
let all = '全部(' + totalAll.value + ')'
|
||||
let pass = '已批准(' + totalPass.value + ')'
|
||||
let reject = '已驳回(' + totalReject.value + ')'
|
||||
|
||||
tabList.value = [all, pass, reject]
|
||||
}
|
||||
|
||||
change({
|
||||
current: 1
|
||||
})
|
||||
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
const switchTab = (index) => {
|
||||
isRefresh.value = false
|
||||
activeTab.value = index
|
||||
|
||||
change({
|
||||
current: 1
|
||||
})
|
||||
}
|
||||
|
||||
const switchTabHeader = (index) => {
|
||||
isRefresh.value = false
|
||||
tabList.value = []
|
||||
activeTabHeader.value = index
|
||||
|
||||
if (activeTabHeader.value == 0) {
|
||||
tabList.value = ['请假(' + totalReviewA.value + ')', '销假(' + totalReviewB.value + ')']
|
||||
} else if (activeTabHeader.value == 1) {
|
||||
let all = '全部(' + totalAll.value + ')'
|
||||
let pass = '已批准(' + totalPass.value + ')'
|
||||
let reject = '已驳回(' + totalReject.value + ')'
|
||||
|
||||
tabList.value = [all, pass, reject]
|
||||
}
|
||||
|
||||
switchTab(0)
|
||||
}
|
||||
|
||||
// 分页触发
|
||||
let change = (e) => {
|
||||
pageCurrent.value = e.current
|
||||
|
||||
let end = pageSize.value * e.current
|
||||
let start = end - pageSize.value
|
||||
|
||||
if (activeTabHeader.value == 0) {
|
||||
if (activeTab.value == 0) {
|
||||
detailList.value = reviewListA.value.slice(start, end)
|
||||
total.value = totalReviewA.value
|
||||
} else if (activeTab.value == 1) {
|
||||
detailList.value = reviewListB.value.slice(start, end)
|
||||
total.value = totalReviewB.value
|
||||
}
|
||||
} else if (activeTabHeader.value == 1) {
|
||||
if (activeTab.value == 0) {
|
||||
detailList.value = reviewList.value.slice(start, end)
|
||||
total.value = totalAll.value
|
||||
} else if (activeTab.value == 1) {
|
||||
detailList.value = passList.value.slice(start, end)
|
||||
total.value = totalPass.value
|
||||
} else if (activeTab.value == 2) {
|
||||
detailList.value = rejectList.value.slice(start, end)
|
||||
total.value = totalReject.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 跳转
|
||||
let showDetail = (item) => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/business/CRM/leave/reviewDetail?data=" + encodeURIComponent(JSON
|
||||
.stringify(item))
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.apply-row {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
margin: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tabs-header {
|
||||
display: flex;
|
||||
height: 80rpx;
|
||||
background: #fff;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.tab-item.active {
|
||||
color: #007AFF;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tab-item.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 200rpx;
|
||||
height: 4rpx;
|
||||
background-color: #007AFF;
|
||||
}
|
||||
|
||||
.tab-item-main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 30rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.tab-item-main.active {
|
||||
color: #007AFF;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tab-item-main.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 300rpx;
|
||||
height: 4rpx;
|
||||
background-color: #007AFF;
|
||||
}
|
||||
|
||||
:deep(.report-list .r-list) {
|
||||
padding: 0.5rem 0;
|
||||
}
|
||||
|
||||
.search {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.search .btn-search {
|
||||
border: none;
|
||||
background: none;
|
||||
line-height: normal;
|
||||
color: #666;
|
||||
line-height: 56rpx !important;
|
||||
padding: 10rpx 0 0;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.search .btn-search::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.search .custom-search {
|
||||
width: 80%;
|
||||
|
||||
}
|
||||
|
||||
.search .custom-search.uni-searchbar {
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user