This commit is contained in:
@@ -59,3 +59,12 @@ export function groupUpdate(data: GroupForm) {
|
||||
export function groupRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/Property/group/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节假日数据
|
||||
* @param year
|
||||
*/
|
||||
export async function getHoliday(year: string) {
|
||||
const response = await fetch(`https://timor.tech/api/holiday/year/${year}`);
|
||||
return response.json();
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
import type {PageQuery, BaseEntity} from '#/api/common';
|
||||
|
||||
export interface GroupVO {
|
||||
/**
|
||||
@@ -63,7 +63,16 @@ export interface GroupQuery extends PageQuery {
|
||||
attendanceType?: number;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 假期
|
||||
*/
|
||||
export interface Holiday {
|
||||
holiday: boolean;
|
||||
name: string;
|
||||
date: string;
|
||||
}
|
||||
|
@@ -58,6 +58,8 @@ export interface HouseChargeVO {
|
||||
costItemsVo: CostItemSettingVO;
|
||||
|
||||
chargeStatus: string;
|
||||
|
||||
personId: string;
|
||||
}
|
||||
|
||||
export interface HouseChargeForm extends BaseEntity {
|
||||
|
@@ -2,7 +2,7 @@ import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
import {renderDict} from "#/utils/render";
|
||||
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
@@ -124,6 +124,18 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
rules:'required',
|
||||
defaultValue:'1',
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
fieldName: 'shiftData',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: (formValue) => formValue.attendanceType=='1',
|
||||
triggerFields: ['attendanceType'],
|
||||
},
|
||||
slots:{
|
||||
default:'shiftData'
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '排班周期',
|
||||
fieldName: 'schedulingCycle',
|
||||
@@ -138,32 +150,99 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
defaultValue:'1',
|
||||
rules:'required'
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
fieldName: 'cycleData',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: (formValue) => formValue.attendanceType=='1',
|
||||
triggerFields: ['attendanceType'],
|
||||
},
|
||||
slots:{
|
||||
default:'cycleData'
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const weekdayColumns: VxeGridProps['columns'] = [
|
||||
export const weekdayColumns: TableColumnsType = [
|
||||
{
|
||||
title: '工作日',
|
||||
name: 'label',
|
||||
key: 'label',
|
||||
width:180,
|
||||
align:'center',
|
||||
dataIndex:'label'
|
||||
},
|
||||
{
|
||||
title: '班次',
|
||||
name: 'shift',
|
||||
key: 'shift',
|
||||
minWidth:180,
|
||||
align:'center',
|
||||
dataIndex:'shift'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
name: 'action',
|
||||
key: 'action',
|
||||
dataIndex:'action',
|
||||
width:180,
|
||||
align:'center',
|
||||
slots:{
|
||||
default:'action'
|
||||
},
|
||||
|
||||
},
|
||||
]
|
||||
|
||||
export const noClockingColumns: TableColumnsType = [
|
||||
{
|
||||
title: '无需打卡日期',
|
||||
key: 'label',
|
||||
width:180,
|
||||
align:'center',
|
||||
dataIndex:'label'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
dataIndex:'action',
|
||||
width:180,
|
||||
align:'center',
|
||||
},
|
||||
]
|
||||
|
||||
export const clockingColumns: TableColumnsType = [
|
||||
{
|
||||
title: '必须打卡日期',
|
||||
key: 'label',
|
||||
width:180,
|
||||
align:'center',
|
||||
dataIndex:'label'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
dataIndex:'action',
|
||||
width:180,
|
||||
align:'center',
|
||||
},
|
||||
]
|
||||
|
||||
export const cycleColumns: TableColumnsType = [
|
||||
{
|
||||
title: '天数',
|
||||
key: 'label',
|
||||
width:180,
|
||||
align:'center',
|
||||
dataIndex:'label'
|
||||
},
|
||||
{
|
||||
title: '班次',
|
||||
key: 'label',
|
||||
width:180,
|
||||
align:'center',
|
||||
dataIndex:'label'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
dataIndex:'action',
|
||||
width:180,
|
||||
align:'center',
|
||||
},
|
||||
]
|
||||
|
||||
|
@@ -13,9 +13,16 @@ import {
|
||||
} from '#/api/property/attendanceManagement/attendanceGroupSettings';
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
|
||||
import {modalSchema, weekdayColumns} from './data';
|
||||
import {Tag, Button, Table} from 'ant-design-vue'
|
||||
import {
|
||||
clockingColumns,
|
||||
cycleColumns,
|
||||
modalSchema,
|
||||
noClockingColumns,
|
||||
weekdayColumns
|
||||
} from './data';
|
||||
import {Tag, Button, Table, Checkbox} from 'ant-design-vue'
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
import holidayCalendar from './holiday-calendar.vue'
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -24,7 +31,9 @@ const weekdayData = ref<any[]>([])
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
});
|
||||
|
||||
const settingData = ref<any>({
|
||||
isAutomatic: true,
|
||||
})
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
@@ -50,8 +59,9 @@ const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[70%]',
|
||||
class: 'w-[80%]',
|
||||
fullscreenButton: false,
|
||||
maskClosable:false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
onConfirm: handleConfirm,
|
||||
@@ -66,18 +76,17 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (isUpdate.value && id) {
|
||||
const record = await groupInfo(id);
|
||||
await formApi.setValues(record);
|
||||
}else {
|
||||
weekdayData.value=[]
|
||||
getDictOptions('wy_kqgzr').forEach(item=>{
|
||||
weekdayData.value.push({
|
||||
dayOfWeek:item.value,
|
||||
label:item.label,
|
||||
shift:item.value=='6'||item.value=='7'?'休息':'常规班次:08:00:00~12:00:00 14:00:00~17:00:00'
|
||||
})
|
||||
} else {
|
||||
weekdayData.value = []
|
||||
getDictOptions('wy_kqgzr').forEach(item => {
|
||||
weekdayData.value.push({
|
||||
dayOfWeek: item.value,
|
||||
label: item.label,
|
||||
shift: item.value == '6' || item.value == '7' ? '休息' : '常规班次:08:00:00~12:00:00 14:00:00~17:00:00'
|
||||
})
|
||||
})
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
@@ -106,41 +115,95 @@ async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
|
||||
const [HolidayCalendar, holidayApi] = useVbenModal({
|
||||
connectedComponent: holidayCalendar,
|
||||
});
|
||||
|
||||
/**
|
||||
* 查看法定节假日日历
|
||||
*/
|
||||
async function showHoliday() {
|
||||
holidayApi.open()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm>
|
||||
<template #weekdaySetting>
|
||||
<div style="font-size: 0.875rem;">
|
||||
<div class="item-font">
|
||||
<span>快捷设置班次:</span>
|
||||
<Tag color="processing">常规班次:08:00:00~12:00:00 14:00:00~17:00:00</Tag>
|
||||
<Button type="link">更改班次</Button>
|
||||
</div>
|
||||
</template>
|
||||
<template #settingItem>
|
||||
<Table style="width: 100%" bordered :columns="weekdayColumns" :data-source="weekdayData"
|
||||
size="small" :pagination="false">
|
||||
<!-- <template #headerCell="{ column }">-->
|
||||
<!-- </template>-->
|
||||
<!-- <template #bodyCell="{ column, record }">-->
|
||||
<!-- <template>-->
|
||||
<!-- {{ record[column.field] }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </template>-->
|
||||
<!-- <template #action="{row}">-->
|
||||
<!-- <Button type="link">更改班次</Button>-->
|
||||
<!-- <Button type="link">休息</Button>-->
|
||||
<!-- </template>-->
|
||||
</Table>
|
||||
<div class="item-font" style="width: 100%;">
|
||||
<Table style="width: 100%" bordered :columns="weekdayColumns" :data-source="weekdayData"
|
||||
size="small" :pagination="false">
|
||||
<!-- <template #headerCell="{ column }">-->
|
||||
<!-- </template>-->
|
||||
<!-- <template #bodyCell="{ column, record }">-->
|
||||
<!-- <template>-->
|
||||
<!-- {{ record[column.field] }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </template>-->
|
||||
<!-- <template #action="{row}">-->
|
||||
<!-- <Button type="link">更改班次</Button>-->
|
||||
<!-- <Button type="link">休息</Button>-->
|
||||
<!-- </template>-->
|
||||
</Table>
|
||||
<Checkbox class="item-padding-top" v-model:checked="settingData.isAutomatic">
|
||||
法定节假日自动排休
|
||||
</Checkbox>
|
||||
<!-- https://timor.tech/api/holiday/year/2024 国务院节假日安排API-->
|
||||
<Button type="link" @click="showHoliday">查看法定节假日日历</Button>
|
||||
<p class="item-padding-top item-font-weight">特殊日期:</p>
|
||||
<p class="item-padding">无需打卡日期:</p>
|
||||
<Table style="width: 80%" bordered :columns="noClockingColumns" :data-source="[]"
|
||||
size="small" :pagination="false">
|
||||
</Table>
|
||||
<p class="item-padding">必须打卡日期:</p>
|
||||
<Table style="width: 80%" bordered :columns="clockingColumns" :data-source="[]"
|
||||
size="small" :pagination="false">
|
||||
</Table>
|
||||
</div>
|
||||
</template>
|
||||
<template #attendanceShift>
|
||||
班次
|
||||
<Button size="small">选择班次</Button>
|
||||
</template>
|
||||
<template #shiftData>
|
||||
<Tag closable color="processing">早班</Tag>
|
||||
</template>
|
||||
<template #schedulingCycle>
|
||||
周期
|
||||
<span class="item-font">周期天数4天</span>
|
||||
</template>
|
||||
<template #cycleData>
|
||||
<Table style="width: 100%" bordered :columns="cycleColumns" :data-source="[]"
|
||||
size="small" :pagination="false">
|
||||
</Table>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<HolidayCalendar></HolidayCalendar>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.item-font {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.item-font-weight {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.item-padding-top {
|
||||
padding-top: 1.1rem;
|
||||
}
|
||||
|
||||
.item-padding {
|
||||
padding: 1.1rem 0 0.5rem 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@@ -0,0 +1,78 @@
|
||||
<script setup lang="ts">
|
||||
import {ref, shallowRef} from 'vue';
|
||||
import {useVbenModal} from '@vben/common-ui';
|
||||
|
||||
import dayjs, {type Dayjs} from 'dayjs';
|
||||
import duration from 'dayjs/plugin/duration';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
|
||||
|
||||
dayjs.extend(duration);
|
||||
dayjs.extend(relativeTime);
|
||||
import type {HouseChargeVO} from "#/api/property/costManagement/houseCharge/model";
|
||||
import {getHoliday} from "#/api/property/attendanceManagement/attendanceGroupSettings";
|
||||
import {Calendar, Tag} from 'ant-design-vue'
|
||||
import type {Holiday} from "#/api/property/attendanceManagement/attendanceGroupSettings/model";
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
onOpenChange: handleOpenChange,
|
||||
onClosed() {
|
||||
houseChargeDetail.value = null;
|
||||
},
|
||||
});
|
||||
|
||||
const houseChargeDetail = shallowRef<null | HouseChargeVO>(null);
|
||||
|
||||
const holidayData = ref<any>({})
|
||||
|
||||
async function handleOpenChange(open: boolean) {
|
||||
if (!open) {
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
const res = await getHoliday(new Date().getFullYear());
|
||||
holidayData.value = res.holiday
|
||||
modalApi.modalLoading(false);
|
||||
}
|
||||
|
||||
const day = ref<Holiday>();
|
||||
const getListData = (value: Dayjs) => {
|
||||
const date = value.format('MM-DD');
|
||||
day.value = holidayData.value?.[date] ?? null;
|
||||
return !!day.value;
|
||||
};
|
||||
|
||||
const getMonthData = (value: Dayjs) => {
|
||||
if (value.month() === 8) {
|
||||
return 1394;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :footer="false" :fullscreen-button="false" title="法定节假日日历" class="w-[40%]">
|
||||
<Calendar>
|
||||
<template #dateCellRender="{ current }">
|
||||
<div v-if="getListData(current)" style="height: 50px">
|
||||
<Tag v-if="day.holiday" color="blue">
|
||||
<span style="padding: 0 10px">休</span>
|
||||
</Tag>
|
||||
<Tag v-else color="red">
|
||||
<span style="padding: 0 10px">班</span>
|
||||
</Tag>
|
||||
</div>
|
||||
</template>
|
||||
<template #monthCellRender="{ current }">
|
||||
<div v-if="getMonthData(current)" class="notes-month">
|
||||
<span>Backlog number</span>
|
||||
</div>
|
||||
</template>
|
||||
</Calendar>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
:deep(.ant-picker-calendar.ant-picker-calendar-full .ant-picker-calendar-date-content) {
|
||||
height: 46px !important;
|
||||
}
|
||||
|
||||
</style>
|
@@ -6,13 +6,11 @@ import {cloneDeep} from '@vben/utils';
|
||||
|
||||
import {useVbenForm} from '#/adapter/form';
|
||||
import {
|
||||
houseChargeAdd,
|
||||
houseChargeInfo, houseChargeRefund,
|
||||
houseChargeUpdate
|
||||
} from '#/api/property/costManagement/houseCharge';
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
|
||||
import {modalSchemaRefund, modalSchemaUpdate} from './data';
|
||||
import {modalSchemaRefund} from './data';
|
||||
import {renderDict} from "#/utils/render";
|
||||
import {Descriptions, DescriptionsItem, Divider} from "ant-design-vue";
|
||||
import type {HouseChargeVO} from "#/api/property/costManagement/houseCharge/model";
|
||||
@@ -62,14 +60,15 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
modalApi.modalLoading(true);
|
||||
const {id} = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
record.value = await houseChargeInfo(id);
|
||||
if (record.value) {
|
||||
room.value = record.value.roomVo
|
||||
costItem.value = record.value.costItemsVo
|
||||
if(id){
|
||||
record.value = await houseChargeInfo(id);
|
||||
if (record.value) {
|
||||
room.value = record.value.roomVo
|
||||
costItem.value = record.value.costItemsVo
|
||||
}
|
||||
await formApi.setValues(record.value);
|
||||
}
|
||||
await formApi.setValues(record.value);
|
||||
await markInitialized();
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
@@ -83,8 +82,8 @@ async function handleConfirm() {
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
data.costItemsId = record.value.costItemsId
|
||||
data.personId = record.value.personId
|
||||
data.costItemsId = record.value?.costItemsId
|
||||
data.personId = record.value?.personId
|
||||
await houseChargeRefund(data);
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
@@ -123,7 +122,7 @@ async function handleClosed() {
|
||||
{{ record.startTime }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="房间">
|
||||
{{ room.roomNumber }}
|
||||
{{ room?.roomNumber }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="面积(㎡)">
|
||||
{{ `${room?.area} (套内面积:${room?.insideInArea})` }}
|
||||
|
Reference in New Issue
Block a user