diff --git a/src/api/renyuan/paiban/index.ts b/src/api/renyuan/paiban/index.ts index 9c0a83d..f279452 100644 --- a/src/api/renyuan/paiban/index.ts +++ b/src/api/renyuan/paiban/index.ts @@ -1,5 +1,6 @@ import request from '@/utils/request'; import { AxiosPromise } from 'axios'; +import { SchedulingVO } from './types'; /** @@ -16,11 +17,63 @@ export function getPaibanRenYuanList(deptId:string | number): AxiosPromise /** * 查询运维-人员排班列表 - * @param deptId */ -export function getPaibanRiLiList(deptId:string | number): AxiosPromise { +export function getPaibanRiLiList(query?: SchedulingVO): AxiosPromise { return request({ - url: `/ops/personnel/scheduling/getRiLiList/`+deptId, + url: `/ops/personnel/scheduling/getRiLiList`, method: 'get', + params: query + }); +} + +/** + * 运维-人员排班-查询排班列表 + */ +export function getPaibanListPage(query?: SchedulingVO): AxiosPromise { + return request({ + url: `/ops/personnel/scheduling/list`, + method: 'get', + params: query + }); +} +/** + * 运维-人员排班-安排排班 + */ +export function savePaiban(data: any): AxiosPromise { + return request({ + url: `/ops/personnel/scheduling/all`, + method: 'post', + data: data + }); +} + +/** + * 运维-人员排班-修改排班 + */ +export function updatePaiban(data:any): AxiosPromise { + return request({ + url: `/ops/personnel/scheduling`, + method: 'put', + data: data + }); +} + +/** + * 运维-人员排班-批量修改排班 + */ +export function updateAllPaiban(): AxiosPromise { + return request({ + url: `/ops/personnel/scheduling/all`, + method: 'put', + }); +} + +/** + * 运维-人员排班-删除排班 + */ +export function deletePaiban(ids: string): AxiosPromise { + return request({ + url: `/ops/personnel/scheduling/${ids}`, + method: 'delete', }); } diff --git a/src/api/renyuan/paiban/types.ts b/src/api/renyuan/paiban/types.ts index e69de29..76d0b6e 100644 --- a/src/api/renyuan/paiban/types.ts +++ b/src/api/renyuan/paiban/types.ts @@ -0,0 +1,39 @@ +export interface SchedulingVO { + /** + * 开始时间 + */ + schedulingStartDate: string; + + /** + * 结束时间 + */ + schedulingEndDate: string; + + /** + * 部门ID + */ + projectId?: string | number; + +} + + +// export interface SchedulingQuery extends PageQuery { + +// /** +// * 开始时间 +// */ +// schedulingStartDate: string; + +// /** +// * 结束时间 +// */ +// schedulingEndDate: string; + +// /** +// * 部门ID +// */ +// projectId?: string | number; +// } + + + diff --git a/src/utils/getDate.ts b/src/utils/getDate.ts new file mode 100644 index 0000000..b937589 --- /dev/null +++ b/src/utils/getDate.ts @@ -0,0 +1,70 @@ +// 获取指定月份的日期信息 +export interface DateInfo { + date: number; + weekDay: string; + fullDate: string; +} + +/** + * 获取当前月份的日期信息 + * @returns 包含当月所有日期信息的数组 + */ +export const getCurrentMonthDates = (): DateInfo[] => { + const today = new Date(); + const year = today.getFullYear(); + const month = today.getMonth(); // 0-11 + + // 获取当月第一天 + const firstDay = new Date(year, month, 1); + // 获取当月最后一天 + const lastDay = new Date(year, month + 1, 0); + // 当月总天数 + const daysInMonth = lastDay.getDate(); + + const weekdays = ['日', '一', '二', '三', '四', '五', '六']; + const dates: DateInfo[] = []; + + // 生成当月所有日期信息 + for (let i = 1; i <= daysInMonth; i++) { + const date = new Date(year, month, i); + const weekDayIndex = date.getDay(); // 0-6,0表示星期日 + dates.push({ + date: i, + weekDay: weekdays[weekDayIndex], + fullDate: `${year}-${String(month + 1).padStart(2, '0')}-${String(i).padStart(2, '0')}` + }); + } + + return dates; +}; + +/** + * 获取指定月份的日期信息 + * @param year 年份 + * @param month 月份(0-11) + * @returns 包含指定月份所有日期信息的数组 + */ +export const getMonthDates = (year: number, month: number): DateInfo[] => { + // 获取当月第一天 + const firstDay = new Date(year, month, 1); + // 获取当月最后一天 + const lastDay = new Date(year, month + 1, 0); + // 当月总天数 + const daysInMonth = lastDay.getDate(); + + const weekdays = ['日', '一', '二', '三', '四', '五', '六']; + const dates: DateInfo[] = []; + + // 生成当月所有日期信息 + for (let i = 1; i <= daysInMonth; i++) { + const date = new Date(year, month, i); + const weekDayIndex = date.getDay(); // 0-6,0表示星期日 + dates.push({ + date: i, + weekDay: weekdays[weekDayIndex], + fullDate: `${year}-${String(month + 1).padStart(2, '0')}-${String(i).padStart(2, '0')}` + }); + } + + return dates; +}; \ No newline at end of file diff --git a/src/views/integratedManage/attendManage/components/renyuanguanliDialog.vue b/src/views/integratedManage/attendManage/components/renyuanguanliDialog.vue index 88aa71a..5aae012 100644 --- a/src/views/integratedManage/attendManage/components/renyuanguanliDialog.vue +++ b/src/views/integratedManage/attendManage/components/renyuanguanliDialog.vue @@ -1,88 +1,69 @@