From c082aa926c1fbcd5b442d13eee515d34fb993b74 Mon Sep 17 00:00:00 2001 From: lq <121091329@qq.com> Date: Fri, 29 Aug 2025 14:05:27 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/all/assignment-management.ts | 6 + .../routes/modules/propertyMarketing.ts | 15 +- src/utils/DateUtils.ts | 430 ++++++++++++ .../assignment-management/index.vue | 628 ++++++++++++++++++ vite.config.ts | 3 +- 5 files changed, 1079 insertions(+), 3 deletions(-) create mode 100644 src/api/all/assignment-management.ts create mode 100644 src/utils/DateUtils.ts create mode 100644 src/views/property-marketing/assignment-management/index.vue diff --git a/src/api/all/assignment-management.ts b/src/api/all/assignment-management.ts new file mode 100644 index 0000000..72f9870 --- /dev/null +++ b/src/api/all/assignment-management.ts @@ -0,0 +1,6 @@ +import Http from '@/api'; + +// 获取用户自定义列 +export const getTaskSchedules = (params = {}) => { + return Http.get('/v1/media-accounts/task-schedules', params); +}; diff --git a/src/router/routes/modules/propertyMarketing.ts b/src/router/routes/modules/propertyMarketing.ts index ba8af63..eab2175 100644 --- a/src/router/routes/modules/propertyMarketing.ts +++ b/src/router/routes/modules/propertyMarketing.ts @@ -71,7 +71,18 @@ const COMPONENTS: AppRouteRecordRaw[] = [ requireLogin: true, roles: ['*'], }, - component: () => import('@/views/property-marketing/media-account/account-dashboard/index.vue'), + component: () => import('@/views/property-marketing/media-account/account-dashboard/index.vue'), + }, + { + path: 'management', + name: 'assignmentManagement', + meta: { + locale: '任务管理', + // requiresAuth: true, + // requireLogin: true, + // roles: ['*'], + }, + component: () => import('@/views/property-marketing/assignment-management/index.vue'), }, { path: 'detail/:id', @@ -121,7 +132,7 @@ const COMPONENTS: AppRouteRecordRaw[] = [ requireLogin: true, roles: ['*'], }, - component: () => import('@/views/property-marketing/put-account/account-data/index.vue'), + component: () => import('@/views/property-marketing/put-account/account-data/index.vue'), }, { path: 'account-dashboard', diff --git a/src/utils/DateUtils.ts b/src/utils/DateUtils.ts new file mode 100644 index 0000000..1f51f0b --- /dev/null +++ b/src/utils/DateUtils.ts @@ -0,0 +1,430 @@ +/** + * 日期工具类 + * 提供月维度和周维度的开始结束日期获取功能 + * 周以星期日开始,星期六结束 + * 只返回日期部分,不包含时间 + */ +class DateUtils { + /** + * 获取当前时间的月开始日期和结束日期 + * @returns 包含开始和结束日期的对象 + */ + static getMonthRange(): { + start: Date; + end: Date; + startFormatted: string; + endFormatted: string; + } { + const now = new Date(); + + // 月开始日期(当月第一天) + const start = new Date(now.getFullYear(), now.getMonth(), 1); + start.setHours(0, 0, 0, 0); + + // 月结束日期(当月最后一天) + const end = new Date(now.getFullYear(), now.getMonth() + 1, 0); + end.setHours(0, 0, 0, 0); + + return { + start, + end, + startFormatted: this.formatDate(start), + endFormatted: this.formatDate(end), + }; + } + + /** + * 获取指定年份和月的范围 + * @param year 年份 + * @param month 月份(1-12) + */ + static getMonthRangeByYearMonth( + year: number, + month: number, + ): { + start: Date; + end: Date; + startFormatted: string; + endFormatted: string; + } { + // 月开始日期 + const start = new Date(year, month - 1, 1); + start.setHours(0, 0, 0, 0); + + // 月结束日期 + const end = new Date(year, month, 0); + end.setHours(0, 0, 0, 0); + + return { + start, + end, + startFormatted: this.formatDate(start), + endFormatted: this.formatDate(end), + }; + } + + /** + * 获取当前时间的周范围(以星期日开始) + * @returns 包含开始和结束日期的对象 + */ + static getWeekRange(): { + start: Date; + end: Date; + startFormatted: string; + endFormatted: string; + } { + const today = new Date(); + today.setHours(0, 0, 0, 0); + const dayOfWeek = today.getDay(); // 0是周日,1是周一,...,6是周六 + + // 周开始日期(周日) + const start = new Date(today); + start.setDate(today.getDate() - dayOfWeek); + start.setHours(0, 0, 0, 0); + + // 周结束日期(周六) + const end = new Date(start); + end.setDate(start.getDate() + 6); + end.setHours(0, 0, 0, 0); + + return { + start, + end, + startFormatted: this.formatDate(start), + endFormatted: this.formatDate(end), + }; + } + + /** + * 获取指定日期的周范围 + * @param date 指定日期 + */ + static getWeekRangeByDate(date: Date): { + start: Date; + end: Date; + startFormatted: string; + endFormatted: string; + } { + const inputDate = new Date(date); + inputDate.setHours(0, 0, 0, 0); + const dayOfWeek = inputDate.getDay(); + + // 周开始日期(周日) + const start = new Date(inputDate); + start.setDate(inputDate.getDate() - dayOfWeek); + start.setHours(0, 0, 0, 0); + + // 周结束日期(周六) + const end = new Date(start); + end.setDate(start.getDate() + 6); + end.setHours(0, 0, 0, 0); + + return { + start, + end, + startFormatted: this.formatDate(start), + endFormatted: this.formatDate(end), + }; + } + + /** + * 格式化日期(只返回日期部分) + * @param date 日期对象 + * @returns 格式化后的日期字符串 (YYYY-MM-DD) + */ + static formatDate(date: Date): string { + const year = date.getFullYear(); + const month = (date.getMonth() + 1).toString().padStart(2, '0'); + const day = date.getDate().toString().padStart(2, '0'); + + return `${year}-${month}-${day}`; + } + + /** + * 获取当前日期信息 + * @returns 包含各种格式的当前日期信息 + */ + static getCurrentDateInfo() { + const now = new Date(); + now.setHours(0, 0, 0, 0); + + const monthRange = this.getMonthRange(); + const weekRange = this.getWeekRange(); + + return { + current: { + date: now, + formatted: this.formatDate(now), + dayOfWeek: this.getChineseDayOfWeek(now), + }, + month: { + start: monthRange.start, + end: monthRange.end, + startFormatted: monthRange.startFormatted, + endFormatted: monthRange.endFormatted, + totalDays: this.getDaysInMonth(now.getFullYear(), now.getMonth() + 1), + }, + week: { + start: weekRange.start, + end: weekRange.end, + startFormatted: weekRange.startFormatted, + endFormatted: weekRange.endFormatted, + }, + }; + } + + /** + * 获取指定月份的天数 + * @param year 年份 + * @param month 月份(1-12) + * @returns 该月的天数 + */ + static getDaysInMonth(year: number, month: number): number { + return new Date(year, month, 0).getDate(); + } + + /** + * 获取中文星期几 + * @param date 日期对象 + * @returns 中文星期几 + */ + static getChineseDayOfWeek(date: Date): string { + const days = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; + return days[date.getDay()]; + } + + /** + * 获取中文月份名称 + * @param month 月份(1-12) + * @returns 中文月份名称 + */ + static getChineseMonthName(month: number): string { + const months = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']; + return months[month - 1] || ''; + } + + /** + * 判断是否为同一天 + * @param date1 日期1 + * @param date2 日期2 + * @returns 是否为同一天 + */ + static isSameDay(date1: Date, date2: Date): boolean { + return this.formatDate(date1) === this.formatDate(date2); + } + + /** + * 获取日期差(天数) + * @param date1 日期1 + * @param date2 日期2 + * @returns 相差的天数 + */ + static getDaysDifference(date1: Date, date2: Date): number { + const d1 = new Date(date1); + const d2 = new Date(date2); + d1.setHours(0, 0, 0, 0); + d2.setHours(0, 0, 0, 0); + + const diffTime = Math.abs(d2.getTime() - d1.getTime()); + return Math.ceil(diffTime / (1000 * 60 * 60 * 24)); + } + /** + * 获取当前周的所有日期及星期几 + * @param startDay 周起始日(0-6,0表示周日,默认1表示周一) + * @returns 当前周的日期数组 + */ + static getWeekDaysByDate(targetDate: Date, startDay: number = 1) { + const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; + const currentDay = targetDate.getDay(); + const firstDayOffset = (currentDay - startDay + 7) % 7; + const firstDayOfWeek = new Date(targetDate); + firstDayOfWeek.setDate(targetDate.getDate() - firstDayOffset); + return Array.from({ length: 7 }).map((_, i) => { + const date = new Date(firstDayOfWeek); + date.setDate(firstDayOfWeek.getDate() + i); + return { + date, + day: date.getDate(), + weekday: weekdays[date.getDay()] + ' ' + date.getDate(), + month: date.getMonth() + 1, // 添加月份信息(1-12) + year: date.getFullYear(), + }; + }); + } + + // 获取某个月每一天的星期几 + static getDaysAndWeekdays(year: number, month: number): Array<{ day: number; weekday: string }> { + const daysInMonth = new Date(year, month + 1, 0).getDate(); // 获取当月总天数 + const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; // 中文星期数组 + const days: Array<{ day: number; weekday: string }> = []; // 结果数组 + + for (let day = 1; day <= daysInMonth; day++) { + const date = new Date(year, month, day); + const weekdayIndex = date.getDay(); // 获取星期几的索引(0-6) + days.push({ + day, + weekday: weekdays[weekdayIndex] + ' ' + day, + }); + } + + return days; + } + /** + * 获取当前的年份 + * @returns 当前年份 + */ + static getCurrentYear(): number { + return new Date().getFullYear(); + } + + /** + * 获取当前的月份 + * @returns 当前月份 (1-12) + */ + static getCurrentMonth(): number { + return new Date().getMonth() + 1; + } + + /** + * 获取当前的年份和月份 + * @returns 包含当前年份和月份的对象 + */ + static getCurrentYearMonth(): { year: number; month: number } { + const now = new Date(); + return { + year: now.getFullYear(), + month: now.getMonth() + 1, + }; + } + + /** + * 获取格式化的当前年月字符串 + * @param separator 分隔符,默认为 '-' + * @returns 格式化的年月字符串 (YYYY-MM) + */ + static getFormattedYearMonth(separator: string = '-'): string { + const now = new Date(); + const year = now.getFullYear(); + const month = (now.getMonth() + 1).toString().padStart(2, '0'); + return `${year}${separator}${month}`; + } + + /** + * 获取中文格式的当前年月 + * @returns 中文年月字符串 (YYYY年MM月) + */ + static getChineseYearMonth(): string { + const now = new Date(); + const year = now.getFullYear(); + const month = (now.getMonth() + 1).toString().padStart(2, '0'); + return `${year}年${month}月`; + } + + /** + * 获取当前季度 + * @returns 当前季度 (1-4) + */ + static getCurrentQuarter(): number { + const month = new Date().getMonth() + 1; + return Math.ceil(month / 3); + } + + /** + * 获取当前季度的开始和结束月份 + * @returns 包含季度开始和结束月份的对象 + */ + static getCurrentQuarterRange(): { startMonth: number; endMonth: number } { + const quarter = this.getCurrentQuarter(); + return { + startMonth: (quarter - 1) * 3 + 1, + endMonth: quarter * 3, + }; + } + + /** + * 获取当前日期信息(增强版,包含年月信息) + * @returns 包含各种格式的当前日期信息 + */ + static getCurrentDateInfo() { + const now = new Date(); + now.setHours(0, 0, 0, 0); + + const monthRange = this.getMonthRange(); + const weekRange = this.getWeekRange(); + const yearMonth = this.getCurrentYearMonth(); + + return { + current: { + date: now, + formatted: this.formatDate(now), + dayOfWeek: this.getChineseDayOfWeek(now), + day: now.getDate(), + month: yearMonth.month, + year: yearMonth.year, + }, + month: { + start: monthRange.start, + end: monthRange.end, + startFormatted: monthRange.startFormatted, + endFormatted: monthRange.endFormatted, + totalDays: this.getDaysInMonth(now.getFullYear(), now.getMonth() + 1), + month: yearMonth.month, + year: yearMonth.year, + formatted: this.getFormattedYearMonth(), + chinese: this.getChineseYearMonth(), + }, + week: { + start: weekRange.start, + end: weekRange.end, + startFormatted: weekRange.startFormatted, + endFormatted: weekRange.endFormatted, + weekNumber: this.getWeekNumber(now), + }, + year: yearMonth.year, + quarter: { + number: this.getCurrentQuarter(), + range: this.getCurrentQuarterRange(), + }, + }; + } + + /** + * 获取指定日期所在的周数 + * @param date 日期对象 + * @returns 周数 (1-53) + */ + static getWeekNumber(date: Date): number { + const firstDayOfYear = new Date(date.getFullYear(), 0, 1); + const pastDaysOfYear = (date.getTime() - firstDayOfYear.getTime()) / 86400000; + return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7); + } + + /** + * 获取指定年份的所有月份信息 + * @param year 年份 + * @returns 包含所有月份信息的数组 + */ + static getYearMonths(year: number): Array<{ + month: number; + name: string; + days: number; + formatted: string; + }> { + return Array.from({ length: 12 }, (_, i) => { + const month = i + 1; + return { + month, + name: this.getChineseMonthName(month), + days: this.getDaysInMonth(year, month), + formatted: `${year}-${month.toString().padStart(2, '0')}`, + }; + }); + } + static formatDateToWeekdayDay(date: Date): string { + const day = date.getDate(); + const weekday = this.getChineseDayOfWeek(date).replace('星期', '周'); + return `${weekday} ${day}`; + } +} + +export default DateUtils; diff --git a/src/views/property-marketing/assignment-management/index.vue b/src/views/property-marketing/assignment-management/index.vue new file mode 100644 index 0000000..2200bd9 --- /dev/null +++ b/src/views/property-marketing/assignment-management/index.vue @@ -0,0 +1,628 @@ + + + + + diff --git a/vite.config.ts b/vite.config.ts index 3ff6cce..d44942f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -40,7 +40,8 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, ''), // 目标地址 - target: 'https://lingjiapi.lvfunai.com/api', + // target: 'https://lingjiapi.lvfunai.com/api', + target: 'http://192.168.40.7/api', }, }, }, From 37ac8662ecf12dad8c1054c5b4a02a98156bf697 Mon Sep 17 00:00:00 2001 From: lq <121091329@qq.com> Date: Fri, 29 Aug 2025 16:39:14 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=9A=84=E5=88=87?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/DateUtils.ts | 8 + .../assignment-management/index.vue | 147 +++++++++++------- 2 files changed, 98 insertions(+), 57 deletions(-) diff --git a/src/utils/DateUtils.ts b/src/utils/DateUtils.ts index 1f51f0b..9b2a237 100644 --- a/src/utils/DateUtils.ts +++ b/src/utils/DateUtils.ts @@ -33,6 +33,14 @@ class DateUtils { }; } + static MonthStrToDate(dateStr: string): Date { + const year = parseInt(dateStr.split('年')[0]); + const month = parseInt(dateStr.split('年')[1].split('月')[0]) - 1; // 月份从0开始 + + const date = new Date(year, month, 1); + return date; + } + /** * 获取指定年份和月的范围 * @param year 年份 diff --git a/src/views/property-marketing/assignment-management/index.vue b/src/views/property-marketing/assignment-management/index.vue index 2200bd9..9cd4f3e 100644 --- a/src/views/property-marketing/assignment-management/index.vue +++ b/src/views/property-marketing/assignment-management/index.vue @@ -15,6 +15,7 @@ v-else-if="choseType === '周'" @change="onChangeWeek" v-model="weekModel" + format="YYYY年MM月DD日" /> + + \ No newline at end of file diff --git a/src/views/property-marketing/assignment-management/index.vue b/src/views/property-marketing/assignment-management/index.vue index 0cdff28..eede732 100644 --- a/src/views/property-marketing/assignment-management/index.vue +++ b/src/views/property-marketing/assignment-management/index.vue @@ -135,12 +135,7 @@
账号名称
- +
@@ -187,25 +182,14 @@ @@ -229,29 +213,14 @@ @@ -273,23 +242,13 @@ @@ -299,12 +258,18 @@ + + +
+ {{ deleteContent }} +
+
\ No newline at end of file + diff --git a/src/views/property-marketing/assignment-management/index.vue b/src/views/property-marketing/assignment-management/index.vue index eede732..2909443 100644 --- a/src/views/property-marketing/assignment-management/index.vue +++ b/src/views/property-marketing/assignment-management/index.vue @@ -88,174 +88,167 @@ - - - - - - - - @@ -68,4 +71,4 @@ const handleChange = (value) => { selectedValues.value = value; emits('change', value); }; - + \ No newline at end of file diff --git a/src/views/property-marketing/assignment-management/index.vue b/src/views/property-marketing/assignment-management/index.vue index b4519bf..135961e 100644 --- a/src/views/property-marketing/assignment-management/index.vue +++ b/src/views/property-marketing/assignment-management/index.vue @@ -148,6 +148,7 @@ + + + + From 4864652d10504f98c67b8f7f6edf3c6a1a56256c Mon Sep 17 00:00:00 2001 From: lq <121091329@qq.com> Date: Thu, 4 Sep 2025 20:29:31 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/all/assignment-management.ts | 4 +- .../components/TaskDetail.vue | 66 ++++++++----------- .../assignment-management/index.vue | 18 ++--- 3 files changed, 35 insertions(+), 53 deletions(-) diff --git a/src/api/all/assignment-management.ts b/src/api/all/assignment-management.ts index d23ae94..2d7834f 100644 --- a/src/api/all/assignment-management.ts +++ b/src/api/all/assignment-management.ts @@ -12,9 +12,9 @@ export const delTaskSchedules = (id: string) => { }; // 任务管理-修改 -export const editTaskSchedules = (id: string) => { +export const editTaskSchedules = (id: string, params = {}) => { console.log('id', id); - return Http.put(`/v1/task-schedules/${id}`); + return Http.put(`/v1/task-schedules/${id}`,params); }; // 任务管理-详情 diff --git a/src/views/property-marketing/assignment-management/components/TaskDetail.vue b/src/views/property-marketing/assignment-management/components/TaskDetail.vue index 99aca43..0d3499c 100644 --- a/src/views/property-marketing/assignment-management/components/TaskDetail.vue +++ b/src/views/property-marketing/assignment-management/components/TaskDetail.vue @@ -1,36 +1,28 @@