This commit is contained in:
lq
2025-09-04 15:48:06 +08:00
parent 835032ad3a
commit e235d36ee7
4 changed files with 41 additions and 64 deletions

View File

@ -84,6 +84,19 @@ const COMPONENTS: AppRouteRecordRaw[] = [
}, },
component: () => import('@/views/property-marketing/assignment-management/index.vue'), component: () => import('@/views/property-marketing/assignment-management/index.vue'),
}, },
{
path: 'management-detail/:id',
name: 'managementDetail',
meta: {
locale: '任务详情',
requiresAuth: true,
requireLogin: true,
roles: ['*'],
hideInMenu: true,
activeMenu: 'MediaAccountAccountDashboard',
},
component: () => import('@/views/property-marketing/assignment-management/managementDetail.vue'),
},
{ {
path: 'detail/:id', path: 'detail/:id',
name: 'MediaAccountAccountDetails', name: 'MediaAccountAccountDetails',

View File

@ -85,6 +85,8 @@ export const MENU_LIST = [
'MediaAccountAccountManagement', 'MediaAccountAccountManagement',
'MediaAccountAccountDashboard', 'MediaAccountAccountDashboard',
'MediaAccountAccountDetails', 'MediaAccountAccountDetails',
'assignmentManagement',
'managementDetail',
], ],
}, },
{ {

View File

@ -349,63 +349,7 @@ class DateUtils {
}; };
} }
/**
* 获取当前日期信息(增强版,包含年月信息)
* @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);
}
/** /**
* 获取指定年份的所有月份信息 * 获取指定年份的所有月份信息

View File

@ -325,6 +325,11 @@
{{ deleteContent }} {{ deleteContent }}
</div> </div>
</a-modal> </a-modal>
<!-- 添加 TimePicker 组件 -->
<a-modal v-model:visible="timePickerVisible" @ok="onTimeConfirm" @cancel="onTimeCancel" title="选择时间">
<TimePicker />
</a-modal>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -344,6 +349,9 @@ import DateUtils from '@/utils/DateUtils';
import TaskDetail from './components/TaskDetail.vue'; import TaskDetail from './components/TaskDetail.vue';
import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination'; import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination';
import emptyIcon from '@/assets/img/media-account/icon-empty.png'; import emptyIcon from '@/assets/img/media-account/icon-empty.png';
import router from '@/router';
import TimePicker from '@/components/TimePicker.vue';
const { const {
dataSource, dataSource,
pageInfo, pageInfo,
@ -406,7 +414,7 @@ const deleteContent = ref('');
const showModal = ref(false); const showModal = ref(false);
const modalVisible = ref(false); const modalVisible = ref(false);
const selectedTask = ref<any>(null); const selectedTask = ref<any>(null);
const timePickerVisible = ref(false);
const choseType = ref('周'); const choseType = ref('周');
const dayModel = ref(new Date()); const dayModel = ref(new Date());
const weekModel = ref(new Date()); const weekModel = ref(new Date());
@ -455,7 +463,7 @@ const handleDelete = (task: any) => {
showModal.value = true; showModal.value = true;
}; };
const handleGoToDetail = (task: any) => { const handleGoToDetail = (task: any) => {
console.log('跳转详情', task); router.push(`/media-account/management-detail/${task.id}`);
}; };
const handleOk = () => { const handleOk = () => {
showModal.value = false; showModal.value = false;
@ -470,12 +478,22 @@ const handleCancel = () => {
const handleAddAccount = () => {}; const handleAddAccount = () => {};
const handleModifyTime = (task: any) => { const handleModifyTime = (task: any) => {
console.log('修改时间', task); selectedTask.value = task;
// modalVisible.value = false; timePickerVisible.value = true;
// // 重新获取数据 };
// getTaskSchedules(query).then((res) => {
// data.value = res.data; const onTimeConfirm = () => {
// }); if (selectedTask.value && selectedTask.value.execution_time) {
// 更新任务的执行时间
selectedTask.value.execution_time = new Date().getTime() / 1000; // 假设时间戳是秒级
// 重新获取数据
handleSearch();
}
timePickerVisible.value = false;
};
const onTimeCancel = () => {
timePickerVisible.value = false;
}; };
// 计算当前日期范围内的所有日期,统一返回 number 数组 // 计算当前日期范围内的所有日期,统一返回 number 数组