Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
fyy
2025-07-22 19:19:58 +08:00
8 changed files with 444 additions and 89 deletions

View File

@@ -5,7 +5,7 @@ export interface ShiftVO {
/** /**
* 主键id * 主键id
*/ */
id: string | number; id: string;
/** /**
* 班次名称 * 班次名称

View File

@@ -0,0 +1,166 @@
<script setup lang="ts">
import {ref, shallowRef} from 'vue';
import {useVbenModal} from '@vben/common-ui';
import {
Button,
Checkbox,
Descriptions,
DescriptionsItem,
Table,
} from 'ant-design-vue';
import dayjs from 'dayjs';
import duration from 'dayjs/plugin/duration';
import relativeTime from 'dayjs/plugin/relativeTime';
import {renderDict} from "#/utils/render";
import {groupInfo} from "#/api/property/attendanceManagement/attendanceGroupSettings";
import type {GroupVO} from "#/api/property/attendanceManagement/attendanceGroupSettings/model";
import {
infoCycleColumns,
infoClockingColumns,
infoNoClockingColumns,
infoWeekdayColumns
} from "#/views/property/attendanceManagement/attendanceGroupSettings/data";
import holidayCalendar from './holiday-calendar.vue'
dayjs.extend(duration);
dayjs.extend(relativeTime);
const [BasicModal, modalApi] = useVbenModal({
onOpenChange: handleOpenChange,
onClosed() {
groupDetail.value = null;
},
});
const groupDetail = shallowRef<null | GroupVO>(null);
const weekdayData = ref<any[]>([])
const cycleData = ref<any[]>([])
const unCheckInData = ref<any[]>([])
const checkInData = ref<any[]>([])
async function handleOpenChange(open: boolean) {
if (!open) {
return null;
}
modalApi.modalLoading(true);
const {id} = modalApi.getData() as { id: number | string };
groupDetail.value = await groupInfo(id);
modalApi.modalLoading(false);
}
const [HolidayCalendar, holidayApi] = useVbenModal({
connectedComponent: holidayCalendar,
});
/**
* 查看法定节假日日历
*/
async function showHoliday() {
holidayApi.open()
}
</script>
<template>
<BasicModal :footer="false" :fullscreen-button="false" title="考勤组信息" class="w-[70%]">
<div v-if="groupDetail" class="des-container">
<Descriptions size="small" :column="1" :labelStyle="{width:'100px'}">
<DescriptionsItem label="考勤组名称">
{{ groupDetail.groupName }}
</DescriptionsItem>
<DescriptionsItem label="考勤类型">
<component
:is="groupDetail.attendanceType ? renderDict(groupDetail.attendanceType,'wy_kqlx') : ''"
/>
</DescriptionsItem>
<DescriptionsItem label="状态">
<component
:is="renderDict(groupDetail.status,'wy_state')"
/>
</DescriptionsItem>
<DescriptionsItem label="工作日设置" v-if="groupDetail.attendanceType==0">
<div class="item-font" style="width: 100%;">
<Table style="width: 90%" bordered :columns="infoWeekdayColumns"
:data-source="weekdayData"
size="small" :pagination="false">
</Table>
<Checkbox class="item-padding-top" v-model:checked="groupDetail.isAutomatic">
法定节假日自动排休
</Checkbox>
<Button type="link" @click="showHoliday">查看法定节假日日历</Button>
<p class="item-padding-top item-font-weight">特殊日期</p>
<p class="item-padding">无需打卡日期</p>
<Table style="width: 75%" bordered :columns="infoNoClockingColumns"
:data-source="unCheckInData"
size="small" :pagination="false">
<template #bodyCell="{ column,record,index }">
<template v-if="column.dataIndex==='dateTime'">
<span v-if="record.dateType==0">{{ record.startDate }}</span>
<span v-else>{{ record.startDate + '~' + record.endDate }}</span>
</template>
</template>
</Table>
<p class="item-padding">必须打卡日期</p>
<Table style="width: 75%" bordered :columns="infoClockingColumns"
:data-source="checkInData"
size="small" :pagination="false">
<template #bodyCell="{ column,record,index }">
<template v-if="column.dataIndex==='dateTime'">
<span v-if="record.dateType==0">{{ record.startDate }}</span>
<span v-else>{{ record.startDate + '~' + record.endDate }}</span>
</template>
</template>
</Table>
</div>
</DescriptionsItem>
<DescriptionsItem label="排班周期" v-if="groupDetail.attendanceType==1">
<p class="item-font">周期天数
<span class="item-font-weight item-font-color">{{ cycleData.length }}</span>
</p>
<Table style="width: 80%;margin-top: 5px" bordered :columns="infoCycleColumns" :data-source="cycleData"
size="small" :pagination="false">
<template #bodyCell="{ column,record,index }">
<template v-if="column.dataIndex==='day'">
<span>{{ '第' + (index + 1) + '天' }}</span>
</template>
<template v-if="column.dataIndex==='shiftId'">
<!-- {{item.name+'\xa0'}}-->
<!-- <span v-if="item.isRest">{{item.startTime+'~'+item.restStartTime+'\xa0'+item.restEndTime+'~'+item.endTime}}</span>-->
<!-- <span v-else>{{item.startTime+'~'+item.endTime}}</span>-->
</template>
</template>
</Table>
</DescriptionsItem>
</Descriptions>
<HolidayCalendar></HolidayCalendar>
</div>
</BasicModal>
</template>
<style lang="scss" scoped>
.des-container {
.item-font {
font-size: 0.875rem;
}
.item-font-weight {
font-weight: 500;
}
.item-font-color {
color: red;
}
.item-padding-top {
padding-top: 1.1rem;
}
.item-padding {
padding: 1.1rem 0 0.5rem 0;
}
:deep(.ant-descriptions .ant-descriptions-item-container .ant-descriptions-item-content) {
display: block;
}
}
</style>

View File

@@ -14,19 +14,21 @@ const [BasicModal, modalApi] = useVbenModal({
onConfirm: handleConfirm, onConfirm: handleConfirm,
}); });
const emit = defineEmits<{ shiftInfo: [info: ShiftVO], shiftList: [list: ShiftVO[]] }>(); const emit = defineEmits(['shiftInfo', 'shiftList', 'afterValue']);
const handleType = ref<number>(1); const handleType = ref<number>(1);
const tableLoading = ref<boolean>(true);
async function handleConfirm() { async function handleConfirm() {
try { try {
modalApi.lock(true); modalApi.lock(true);
if (state.selectedRowKeys.length) { if (state.selectedRowKeys.length) {
let arr = shiftData.value.filter(item => state.selectedRowKeys.includes(item.id)) let arr = shiftData.value.filter((item: ShiftVO) => state.selectedRowKeys.includes(item.id));
if (handleType.value == 1 && arr.length) { if (handleType.value === 1 && arr.length) {
await emit('shiftInfo', arr[0]); emit('shiftInfo', arr[0]);
} else if (handleType.value == 2 && arr.length) { } else if (handleType.value === 2 && arr.length) {
await emit('shiftList', arr); emit('shiftList', arr);
} else if (handleType.value === 3 && arr.length) {
emit('afterValue', arr[0]);
} }
} }
modalApi.close(); modalApi.close();
@@ -41,10 +43,11 @@ async function handleOpenChange(open: boolean) {
if (!open) { if (!open) {
return null; return null;
} }
state.selectedRowKeys = []
handleType.value = modalApi.getData()?.type;
await queryShiftData()
modalApi.modalLoading(true); modalApi.modalLoading(true);
state.selectedRowKeys = []
const {type} = await modalApi.getData() as {type:number};
handleType.value = type;
await queryShiftData()
modalApi.modalLoading(false); modalApi.modalLoading(false);
} }
@@ -52,7 +55,6 @@ const shiftData = ref<ShiftVO[]>([])
const shiftName = ref<string>('') const shiftName = ref<string>('')
async function queryShiftData() { async function queryShiftData() {
tableLoading.value = true
let params = { let params = {
name: shiftName.value, name: shiftName.value,
pageNum: 1, pageNum: 1,
@@ -60,17 +62,16 @@ async function queryShiftData() {
} }
const res = await shiftList(params) const res = await shiftList(params)
shiftData.value = res.rows shiftData.value = res.rows
tableLoading.value = false
} }
// 行勾选状态 // 行勾选状态
const state = reactive({ const state = reactive({
selectedRowKeys: [], selectedRowKeys: [] as string[],
}); });
// 勾选变化时的回调 // 勾选变化时的回调
const onSelectChange = (selectedRowKeys: string[]) => { const onSelectChange = (selectedRowKeys: string[]) => {
if (selectedRowKeys.length > 1 && handleType.value == 1) { if (selectedRowKeys.length > 1 && (handleType.value == 1||handleType.value == 3)) {
state.selectedRowKeys = selectedRowKeys.slice(-1); state.selectedRowKeys = selectedRowKeys.slice(-1);
} else { } else {
state.selectedRowKeys = selectedRowKeys; state.selectedRowKeys = selectedRowKeys;
@@ -110,7 +111,6 @@ const resetHandle = () => {
:pagination="false" :pagination="false"
rowKey="id" rowKey="id"
:scroll="{ y: 350 }" :scroll="{ y: 350 }"
:loading="tableLoading"
> >
<template #bodyCell="{ column, record,index }"> <template #bodyCell="{ column, record,index }">
<template v-if="column.dataIndex==='id'"> <template v-if="column.dataIndex==='id'">

View File

@@ -1,12 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue'; import {computed, ref} from 'vue';
import { useVbenModal } from '@vben/common-ui'; import {useVbenModal} from '@vben/common-ui';
import { cloneDeep } from '@vben/utils'; import {cloneDeep} from '@vben/utils';
import { useVbenForm } from '#/adapter/form'; import {useVbenForm} from '#/adapter/form';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
import {clockInModalSchema} from './data'; import {clockInModalSchema} from './data';
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits(['checkIn', 'unCheckIn']);
const isClockIn = ref(false); const isClockIn = ref(false);
const title = computed(() => { const title = computed(() => {
@@ -26,7 +26,7 @@ const [BasicForm, formApi] = useVbenForm({
wrapperClass: 'grid-cols-2', wrapperClass: 'grid-cols-2',
}); });
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff( const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
{ {
initializedGetter: defaultFormValueGetter(formApi), initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi), currentGetter: defaultFormValueGetter(formApi),
@@ -44,8 +44,8 @@ const [BasicModal, modalApi] = useVbenModal({
return null; return null;
} }
modalApi.modalLoading(true); modalApi.modalLoading(true);
const { type } = modalApi.getData() as { type?: number }; const {check} = modalApi.getData() as { check?: boolean };
isClockIn.value = !!type; isClockIn.value = check;
await markInitialized(); await markInitialized();
modalApi.modalLoading(false); modalApi.modalLoading(false);
}, },
@@ -54,11 +54,20 @@ const [BasicModal, modalApi] = useVbenModal({
async function handleConfirm() { async function handleConfirm() {
try { try {
modalApi.lock(true); modalApi.lock(true);
const { valid } = await formApi.validate(); const {valid} = await formApi.validate();
if (!valid) { if (!valid) {
return; return;
} }
const data = cloneDeep(await formApi.getValues()); const data = cloneDeep(await formApi.getValues());
if (data.dateType == 1) {
data.startDate = data.timeSlot[0]
data.endDate = data.timeSlot[1]
}
if (isClockIn.value) {
emit('checkIn', data)
} else {
emit('unCheckIn', data)
}
resetInitialized(); resetInitialized();
await modalApi.close(); await modalApi.close();
} catch (error) { } catch (error) {

View File

@@ -72,6 +72,7 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'groupName', fieldName: 'groupName',
component: 'Input', component: 'Input',
rules: 'required', rules: 'required',
formItemClass:'col-span-1'
}, },
{ {
label: '考勤类型',//(0:固定班制,1:排班制) label: '考勤类型',//(0:固定班制,1:排班制)
@@ -82,7 +83,7 @@ export const modalSchema: FormSchemaGetter = () => [
options: getDictOptions('wy_kqlx'), options: getDictOptions('wy_kqlx'),
}, },
rules: 'selectRequired', rules: 'selectRequired',
defaultValue: '0' defaultValue: '0',
}, },
{ {
label: '工作日设置', label: '工作日设置',
@@ -174,10 +175,10 @@ export const weekdayColumns: TableColumnsType = [
}, },
{ {
title: '班次', title: '班次',
key: 'shift', key: 'shiftValue',
minWidth: 180, minWidth: 180,
align: 'center', align: 'center',
dataIndex: 'shift' dataIndex: 'shiftValue'
}, },
{ {
title: '操作', title: '操作',
@@ -191,10 +192,10 @@ export const weekdayColumns: TableColumnsType = [
export const noClockingColumns: TableColumnsType = [ export const noClockingColumns: TableColumnsType = [
{ {
title: '无需打卡日期', title: '无需打卡日期',
key: 'label', key: 'dateTime',
minWidth: 180, minWidth: 180,
align: 'center', align: 'center',
dataIndex: 'label' dataIndex: 'dateTime'
}, },
{ {
title: '操作', title: '操作',
@@ -208,10 +209,10 @@ export const noClockingColumns: TableColumnsType = [
export const clockingColumns: TableColumnsType = [ export const clockingColumns: TableColumnsType = [
{ {
title: '必须打卡日期', title: '必须打卡日期',
key: 'label', key: 'dateTime',
minWidth: 180, minWidth: 180,
align: 'center', align: 'center',
dataIndex: 'label' dataIndex: 'dateTime'
}, },
{ {
title: '操作', title: '操作',
@@ -225,17 +226,17 @@ export const clockingColumns: TableColumnsType = [
export const cycleColumns: TableColumnsType = [ export const cycleColumns: TableColumnsType = [
{ {
title: '天数', title: '天数',
key: 'label', key: 'day',
width: 150, width: 150,
align: 'center', align: 'center',
dataIndex: 'label' dataIndex: 'day'
}, },
{ {
title: '班次', title: '班次',
key: 'label', key: 'shiftId',
minWidth: 180, minWidth: 180,
align: 'center', align: 'center',
dataIndex: 'label' dataIndex: 'shiftId'
}, },
{ {
title: '操作', title: '操作',
@@ -271,24 +272,24 @@ export const shiftColumns = [
]; ];
const typeOptions = [ const typeOptions = [
{label: '单个日期', value: 1}, {label: '单个日期', value: 0},
{label: '时间段', value: 2}, {label: '时间段', value: 1},
]; ];
export const clockInModalSchema: FormSchemaGetter = () => [ export const clockInModalSchema: FormSchemaGetter = () => [
{ {
label: '添加方式', label: '添加方式',
fieldName: 'type', fieldName: 'dateType',
component: 'RadioGroup', component: 'RadioGroup',
componentProps: { componentProps: {
options: typeOptions, options: typeOptions,
buttonStyle: 'solid', buttonStyle: 'solid',
}, },
defaultValue:1, defaultValue:0,
rules: 'required', rules: 'required',
}, },
{ {
label: '日期', label: '日期',
fieldName: 'singleTime', fieldName: 'startDate',
component: 'DatePicker', component: 'DatePicker',
rules: 'required', rules: 'required',
componentProps: { componentProps: {
@@ -296,8 +297,8 @@ export const clockInModalSchema: FormSchemaGetter = () => [
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD',
}, },
dependencies: { dependencies: {
show: (formValue) => formValue.type==1, show: (formValue) => formValue.dateType==0,
triggerFields: ['type'], triggerFields: ['dateType'],
}, },
}, },
{ {
@@ -310,10 +311,64 @@ export const clockInModalSchema: FormSchemaGetter = () => [
}, },
rules: 'required', rules: 'required',
dependencies: { dependencies: {
show: (formValue) => formValue.type==2, show: (formValue) => formValue.dateType==1,
triggerFields: ['type'], triggerFields: ['dateType'],
}, },
}, },
] ]
export const infoWeekdayColumns: TableColumnsType = [
{
title: '工作日',
key: 'label',
width: 120,
align: 'center',
dataIndex: 'label'
},
{
title: '班次',
key: 'shiftValue',
minWidth: 180,
align: 'center',
dataIndex: 'shiftValue'
},
]
export const infoNoClockingColumns: TableColumnsType = [
{
title: '无需打卡日期',
key: 'dateTime',
minWidth: 180,
align: 'center',
dataIndex: 'dateTime'
},
]
export const infoClockingColumns: TableColumnsType = [
{
title: '必须打卡日期',
key: 'dateTime',
minWidth: 180,
align: 'center',
dataIndex: 'dateTime'
},
]
export const infoCycleColumns: TableColumnsType = [
{
title: '天数',
key: 'day',
width: 150,
align: 'center',
dataIndex: 'day'
},
{
title: '班次',
key: 'shiftId',
minWidth: 180,
align: 'center',
dataIndex: 'shiftId'
},
]

View File

@@ -20,7 +20,7 @@ import {
noClockingColumns, noClockingColumns,
weekdayColumns weekdayColumns
} from './data'; } from './data';
import {Tag, Button, Table, Checkbox} from 'ant-design-vue' import {Tag, Button, Table, Checkbox, Select, SelectOption,message} from 'ant-design-vue'
import {getDictOptions} from "#/utils/dict"; import {getDictOptions} from "#/utils/dict";
import holidayCalendar from './holiday-calendar.vue' import holidayCalendar from './holiday-calendar.vue'
import changeShiftSchedule from './change-shift-schedule.vue' import changeShiftSchedule from './change-shift-schedule.vue'
@@ -86,7 +86,9 @@ const [BasicModal, modalApi] = useVbenModal({
weekdayData.value.push({ weekdayData.value.push({
dayOfWeek: item.value, dayOfWeek: item.value,
label: item.label, label: item.label,
shift: item.value == '6' || item.value == '7' ? '休息' : '常规班次08:00:00~12:00:00 14:00:00~17:00:00' shiftValue: '休息',
isRest: true,
shiftId: null,
}) })
}) })
} }
@@ -118,6 +120,9 @@ async function handleConfirm() {
async function handleClosed() { async function handleClosed() {
await formApi.resetForm(); await formApi.resetForm();
resetInitialized(); resetInitialized();
cycleData.value = []
unCheckInData.value = []
checkInData.value = []
} }
const [HolidayCalendar, holidayApi] = useVbenModal({ const [HolidayCalendar, holidayApi] = useVbenModal({
@@ -142,59 +147,122 @@ async function showHoliday() {
* 更改班次 * 更改班次
* @param type 1.设置班次 2.选择班次 * @param type 1.设置班次 2.选择班次
*/ */
async function shiftScheduleHandle(type) { async function shiftScheduleHandle(type: number) {
await shiftApi.open() shiftApi.setData({type})
await shiftApi.setData({type}) shiftApi.open()
}
async function changeShiftHandle(type, index) {
await shiftApi.open()
await shiftApi.setData({type})//3.更改班次
}
async function selectDateHandle(type) {
checkInDateApi.open()
checkInDateApi.setData({type})
} }
const shiftInfo = ref<ShiftVO>() const shiftInfo = ref<ShiftVO>()
const shiftList = ref<ShiftVO[]>([]) const shiftList = ref<ShiftVO[]>([])
const handleShiftInfo = (info) => { const handleShiftInfo = (info: ShiftVO) => {
if (info) {
shiftInfo.value = info; shiftInfo.value = info;
weekdayData.value.forEach(item => {
item.shiftId = info.id
let str = ''
if (info.isRest) {
str = `${info.name}${info.startTime}~${info.restStartTime} ${info.restEndTime}~${info.endTime}`;
} else {
str = `${info.name}${info.startTime}~${info.endTime}`;
}
item.shiftValue = str
item.isRest = false
})
}
}; };
const handleShiftList = (list) => { const handleShiftList = (list: any[]) => {
shiftList.value = list; shiftList.value = list;
}; };
const handleAfterValue = (val) => {
console.log(val, '===val')
};
const cycleData = ref<any[]>([]) const cycleData = ref<any[]>([])
const unCheckInData = ref<any[]>([]) const unCheckInData = ref<any[]>([])
const checkInData = ref<any[]>([]) const checkInData = ref<any[]>([])
async function addCycleHandle() { async function addCycleHandle() {
if(cycleData.value.length<31){
cycleData.value.push({ cycleData.value.push({
shiftId: '', shiftId: '',
}) })
}else {
message.warning('周期天数最多31天');
}
} }
async function deleteCycleHandle(index) { async function deleteCycleHandle(index: number) {
if(cycleData.value.length>2){
cycleData.value.splice(index, 1) cycleData.value.splice(index, 1)
}else {
message.warning('周期天数最少2天。');
}
} }
async function deleteUnCheckInHandle(index) { async function deleteUnCheckInHandle(index: number) {
unCheckInData.value.splice(index, 1) unCheckInData.value.splice(index, 1)
} }
async function deleteCheckInHandle(index) { async function deleteCheckInHandle(index: number) {
checkInData.value.splice(index, 1) checkInData.value.splice(index, 1)
} }
async function restHandle(index){ const tableIndex = ref(-1)
async function changeShiftHandle(type: number, index: number) {
tableIndex.value = index
shiftApi.setData({type})//3.更改班次
shiftApi.open()
}
async function restHandle(index: number) {
weekdayData.value[index].isRest = true
weekdayData.value[index].shiftValue = '休息'
}
const handleAfterValue = (val: ShiftVO) => {
if (tableIndex.value > -1 && val) {
weekdayData.value[tableIndex.value].shiftId = val.id
let str = ''
if (val.isRest) {
str = `${val.name}${val.startTime}~${val.restStartTime} ${val.restEndTime}~${val.endTime}`;
} else {
str = `${val.name}${val.startTime}~${val.endTime}`;
}
weekdayData.value[tableIndex.value].shiftValue = str
weekdayData.value[tableIndex.value].isRest = false
}
};
const closeHandle = (i: number) => {
shiftList.value.splice(i, 1)
};
const checkInIndex = ref(-1)
async function addCheckInHandle(index: number) {
checkInIndex.value = index
checkInDateApi.setData({check: true})
checkInDateApi.open()
}
const getCheckInData = (val: any) => {
if (val) {
checkInData.value.push(val)
}
}
const unCheckInIndex = ref(-1)
async function addUnCheckInHandle(index: number) {
unCheckInIndex.value = index
checkInDateApi.setData({check: false})
checkInDateApi.open()
}
const getUnCheckInData = (val: any) => {
if (val) {
unCheckInData.value.push(val)
}
} }
</script> </script>
@@ -224,8 +292,11 @@ async function restHandle(index){
size="small" :pagination="false"> size="small" :pagination="false">
<template #bodyCell="{ column, record,index }"> <template #bodyCell="{ column, record,index }">
<template v-if="column.dataIndex==='action'"> <template v-if="column.dataIndex==='action'">
<Button type="link" size="small" @click="changeShiftHandle(3)">更改班次</Button> <Button type="link" size="small" @click="changeShiftHandle(3,index)">更改班次
<Button type="link" size="small" @click="restHandle(index)">休息</Button> </Button>
<Button type="link" size="small" @click="restHandle(index)" v-if="!record.isRest">
休息
</Button>
</template> </template>
</template> </template>
</Table> </Table>
@@ -241,17 +312,21 @@ async function restHandle(index){
<template #headerCell="{ column }"> <template #headerCell="{ column }">
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<Button size="small" type="primary" shape="circle" <Button size="small" type="primary" shape="circle"
@click="selectDateHandle" @click="addUnCheckInHandle"
:icon="h(PlusOutlined)"> :icon="h(PlusOutlined)">
</Button> </Button>
</template> </template>
</template> </template>
<template #bodyCell="{ column, record,index }"> <template #bodyCell="{ column,record,index }">
<template v-if="column.dataIndex==='action'"> <template v-if="column.dataIndex==='action'">
<Button size="small" type="primary" shape="circle" <Button size="small" type="primary" shape="circle"
danger :icon="h(MinusOutlined)" @click="deleteUnCheckInHandle(index)"> danger :icon="h(MinusOutlined)" @click="deleteUnCheckInHandle(index)">
</Button> </Button>
</template> </template>
<template v-if="column.dataIndex==='dateTime'">
<span v-if="record.dateType==0">{{ record.startDate }}</span>
<span v-else>{{ record.startDate + '~' + record.endDate }}</span>
</template>
</template> </template>
</Table> </Table>
<p class="item-padding">必须打卡日期</p> <p class="item-padding">必须打卡日期</p>
@@ -260,12 +335,16 @@ async function restHandle(index){
<template #headerCell="{ column }"> <template #headerCell="{ column }">
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<Button size="small" type="primary" shape="circle" <Button size="small" type="primary" shape="circle"
@click="selectDateHandle" @click="addCheckInHandle"
:icon="h(PlusOutlined)"> :icon="h(PlusOutlined)">
</Button> </Button>
</template> </template>
</template> </template>
<template #bodyCell="{ column, record,index }"> <template #bodyCell="{ column,record,index }">
<template v-if="column.dataIndex==='dateTime'">
<span v-if="record.dateType==0">{{ record.startDate }}</span>
<span v-else>{{ record.startDate + '~' + record.endDate }}</span>
</template>
<template v-if="column.dataIndex==='action'"> <template v-if="column.dataIndex==='action'">
<Button size="small" type="primary" shape="circle" <Button size="small" type="primary" shape="circle"
danger :icon="h(MinusOutlined)" @click="deleteCheckInHandle(index)"> danger :icon="h(MinusOutlined)" @click="deleteCheckInHandle(index)">
@@ -280,15 +359,17 @@ async function restHandle(index){
</template> </template>
<template #shiftData> <template #shiftData>
<div v-if="shiftList"> <div v-if="shiftList">
<Tag closable color="processing" v-for="(item,index) in shiftList"> <Tag closable color="processing" v-for="(item,i) in shiftList" @close="closeHandle(i)">
{{ item.name }} {{ item.name }}
</Tag> </Tag>
</div> </div>
</template> </template>
<template #schedulingCycle> <template #schedulingCycle>
<span class="item-font">周期天数 <span class="item-font">周期天数
<span style="font-weight: 500;color: red">{{ cycleData.length }}</span> <span class="item-font-weight item-font-color">{{ cycleData.length }}</span>
</span>
<span style="color:#b2b0b0;">周期最少2天最多31天</span>
</span>
</template> </template>
<template #cycleData> <template #cycleData>
<Table style="width: 80%" bordered :columns="cycleColumns" :data-source="cycleData" <Table style="width: 80%" bordered :columns="cycleColumns" :data-source="cycleData"
@@ -300,12 +381,30 @@ async function restHandle(index){
</Button> </Button>
</template> </template>
</template> </template>
<template #bodyCell="{ column, record,index }"> <template #bodyCell="{ column,record,index }">
<template v-if="column.dataIndex==='action'"> <template v-if="column.dataIndex==='action'">
<Button size="small" type="primary" shape="circle" <Button size="small" type="primary" shape="circle"
danger :icon="h(MinusOutlined)" @click="deleteCycleHandle(index)"> danger :icon="h(MinusOutlined)" @click="deleteCycleHandle(index)">
</Button> </Button>
</template> </template>
<template v-if="column.dataIndex==='day'">
<span>{{ '第' + (index + 1) + '天' }}</span>
</template>
<template v-if="column.dataIndex==='shiftId'">
<Select
ref="select"
style="width: 100%"
v-model:value="record.shiftId"
placeholder="请选择班次"
>
<SelectOption v-for="item in shiftList" :value="item.id">
{{ item.name + '\xa0' }}
<span
v-if="item.isRest">{{ item.startTime + '~' + item.restStartTime + '\xa0' + item.restEndTime + '~' + item.endTime }}</span>
<span v-else>{{ item.startTime + '~' + item.endTime }}</span>
</SelectOption>
</Select>
</template>
</template> </template>
</Table> </Table>
</template> </template>
@@ -315,7 +414,9 @@ async function restHandle(index){
@shiftList="handleShiftList" @shiftList="handleShiftList"
@afterValue="handleAfterValue" @afterValue="handleAfterValue"
></ChangeShiftSchedule> ></ChangeShiftSchedule>
<CheckInDate></CheckInDate> <CheckInDate @checkIn="getCheckInData"
@unCheckIn="getUnCheckInData"
></CheckInDate>
</BasicModal> </BasicModal>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -327,6 +428,10 @@ async function restHandle(index){
font-weight: 500; font-weight: 500;
} }
.item-font-color {
color: red;
}
.item-padding-top { .item-padding-top {
padding-top: 1.1rem; padding-top: 1.1rem;
} }

View File

@@ -20,6 +20,7 @@ import type { GroupForm } from '#/api/property/attendanceManagement/attendanceGr
import { commonDownloadExcel } from '#/utils/file/download'; import { commonDownloadExcel } from '#/utils/file/download';
import groupModal from './group-modal.vue'; import groupModal from './group-modal.vue';
import attendanceGroupDetail from './attendance-group-detail.vue';
import { columns, querySchema } from './data'; import { columns, querySchema } from './data';
import {TableSwitch} from "#/components/table"; import {TableSwitch} from "#/components/table";
import {useAccess} from "@vben/access"; import {useAccess} from "@vben/access";
@@ -77,6 +78,10 @@ const [GroupModal, modalApi] = useVbenModal({
connectedComponent: groupModal, connectedComponent: groupModal,
}); });
const [AttendanceGroupDetail, detailApi] = useVbenModal({
connectedComponent: attendanceGroupDetail,
});
function handleAdd() { function handleAdd() {
modalApi.setData({}); modalApi.setData({});
modalApi.open(); modalApi.open();
@@ -87,6 +92,11 @@ async function handleEdit(row: Required<GroupForm>) {
modalApi.open(); modalApi.open();
} }
async function handleInfo(row: Required<GroupForm>) {
detailApi.setData({ id: row.id });
detailApi.open();
}
async function handleDelete(row: Required<GroupForm>) { async function handleDelete(row: Required<GroupForm>) {
await groupRemove(row.id); await groupRemove(row.id);
await tableApi.query(); await tableApi.query();
@@ -143,6 +153,12 @@ function handleDownloadExcel() {
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<Space> <Space>
<ghost-button
v-access:code="['Property:group:info']"
@click.stop="handleInfo(row)"
>
{{ $t('pages.common.info') }}
</ghost-button>
<ghost-button <ghost-button
v-access:code="['Property:group:edit']" v-access:code="['Property:group:edit']"
@click.stop="handleEdit(row)" @click.stop="handleEdit(row)"
@@ -177,5 +193,6 @@ function handleDownloadExcel() {
</template> </template>
</BasicTable> </BasicTable>
<GroupModal @reload="tableApi.query()" /> <GroupModal @reload="tableApi.query()" />
<AttendanceGroupDetail></AttendanceGroupDetail>
</Page> </Page>
</template> </template>

View File

@@ -147,7 +147,10 @@ export const modalSchema: FormSchemaGetter = () => [
label: '联系电话', label: '联系电话',
fieldName: 'phone', fieldName: 'phone',
component: 'Input', component: 'Input',
rules: z.string().regex(/^1[3-9]\d{9}$/, { message: '格式错误' }), rules:z.union([
z.string().regex(/^1[3-9]\d{9}$/, { message: '手机号格式错误' }),
z.number().int().min(1000000000).max(19999999999, { message: '手机号格式错误' })
]).transform(val => val.toString()),
}, },
{ {
label: '入驻位置', label: '入驻位置',