任务管理
This commit is contained in:
@ -117,6 +117,7 @@
|
|||||||
:options="operators"
|
:options="operators"
|
||||||
v-model="query.operator_id"
|
v-model="query.operator_id"
|
||||||
@change="handleSearch"
|
@change="handleSearch"
|
||||||
|
class="!w-200px"
|
||||||
/>
|
/>
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
@ -128,6 +129,7 @@
|
|||||||
:options="platformOptions"
|
:options="platformOptions"
|
||||||
v-model="query.platform"
|
v-model="query.platform"
|
||||||
@change="handleSearch"
|
@change="handleSearch"
|
||||||
|
class="!w-200px"
|
||||||
/>
|
/>
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
@ -215,7 +217,7 @@ import icon7 from '@/assets/img/platform/icon-ks.png';
|
|||||||
import icon8 from '@/assets/img/platform/icon-bilibili.png';
|
import icon8 from '@/assets/img/platform/icon-bilibili.png';
|
||||||
import DateUtils from '@/utils/DateUtils';
|
import DateUtils from '@/utils/DateUtils';
|
||||||
|
|
||||||
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());
|
||||||
const monthModel = ref(new Date());
|
const monthModel = ref(new Date());
|
||||||
@ -251,6 +253,7 @@ const query = reactive({
|
|||||||
execution_time: [] as string[],
|
execution_time: [] as string[],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 显示所有的
|
||||||
const handleMore = (record: any, column: any) => {
|
const handleMore = (record: any, column: any) => {
|
||||||
console.log('record', record);
|
console.log('record', record);
|
||||||
console.log('column', column);
|
console.log('column', column);
|
||||||
@ -290,7 +293,6 @@ const getPlatformIcon = (platform: number) => {
|
|||||||
|
|
||||||
// 获取任务颜色
|
// 获取任务颜色
|
||||||
const getTaskColor = (taskType: number) => {
|
const getTaskColor = (taskType: number) => {
|
||||||
console.log('taskType', taskType);
|
|
||||||
// 根据API文档,type: 0=选题,1=内容稿件
|
// 根据API文档,type: 0=选题,1=内容稿件
|
||||||
return taskType === 0 ? '#6d4cfe' : '#ffae00';
|
return taskType === 0 ? '#6d4cfe' : '#ffae00';
|
||||||
};
|
};
|
||||||
@ -339,19 +341,14 @@ const processTableData = (apiData: any[]) => {
|
|||||||
if (account.task_schedules && account.task_schedules.length > 0) {
|
if (account.task_schedules && account.task_schedules.length > 0) {
|
||||||
account.task_schedules.forEach((task: any) => {
|
account.task_schedules.forEach((task: any) => {
|
||||||
const taskDay = timestampToDayNumber(task.execution_time);
|
const taskDay = timestampToDayNumber(task.execution_time);
|
||||||
console.log('taskDay', taskDay, typeof taskDay);
|
|
||||||
console.log('currentDateHeaders', currentDateHeaders.value);
|
|
||||||
console.log('rowData', currentDateHeaders.value.includes(taskDay));
|
|
||||||
// 如果这个日期在当前表头中,则添加到对应列
|
// 如果这个日期在当前表头中,则添加到对应列
|
||||||
if (currentDateHeaders.value.includes(taskDay)) {
|
if (currentDateHeaders.value.includes(taskDay)) {
|
||||||
console.log('taskDay', task);
|
|
||||||
rowData[taskDay].push({
|
rowData[taskDay].push({
|
||||||
id: task.id,
|
id: task.id,
|
||||||
name: task.name,
|
name: task.name,
|
||||||
type: task.type,
|
type: task.type,
|
||||||
execution_time: task.execution_time,
|
execution_time: task.execution_time,
|
||||||
});
|
});
|
||||||
console.log('taskDay', rowData[taskDay]);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -393,7 +390,8 @@ const setTableSpecific = () => {
|
|||||||
title: '账号与发布平台',
|
title: '账号与发布平台',
|
||||||
slotName: 'name',
|
slotName: 'name',
|
||||||
width: 150,
|
width: 150,
|
||||||
fixed: 'left',
|
ellipsis: true,
|
||||||
|
tooltip: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -405,17 +403,27 @@ const setTableSpecific = () => {
|
|||||||
} else if (choseType.value === '月') {
|
} else if (choseType.value === '月') {
|
||||||
const date = new Date(monthModel.value);
|
const date = new Date(monthModel.value);
|
||||||
const tabTitle = DateUtils.getDaysAndWeekdays(date.getFullYear(), date.getMonth());
|
const tabTitle = DateUtils.getDaysAndWeekdays(date.getFullYear(), date.getMonth());
|
||||||
dateHeaders = tabTitle;
|
// 为月视图添加日期对象,以便后续判断是否为周末
|
||||||
|
dateHeaders = tabTitle.map((item) => {
|
||||||
|
const dayDate = new Date(date.getFullYear(), date.getMonth(), item.day);
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
date: dayDate,
|
||||||
|
};
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// 日维度
|
// 日维度
|
||||||
const date = new Date(dayModel.value);
|
const date = new Date(dayModel.value);
|
||||||
const day = date.getDate();
|
const day = date.getDate();
|
||||||
const weekday = DateUtils.formatDateToWeekdayDay(date);
|
const weekday = DateUtils.formatDateToWeekdayDay(date);
|
||||||
dateHeaders = [{ day: day, weekday, date: DateUtils.formatDate(date) }];
|
dateHeaders = [{ day: day, weekday, date: date }];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加日期列
|
// 添加日期列
|
||||||
dateHeaders.forEach((item) => {
|
dateHeaders.forEach((item) => {
|
||||||
|
// 检查是否为周末(周日为0,周六为6)
|
||||||
|
const isWeekend = item.date ? item.date.getDay() === 0 || item.date.getDay() === 6 : false;
|
||||||
|
|
||||||
columns.value.push({
|
columns.value.push({
|
||||||
title: `${item.weekday}`,
|
title: `${item.weekday}`,
|
||||||
dataIndex: item.day, // 使用日期数字作为dataIndex
|
dataIndex: item.day, // 使用日期数字作为dataIndex
|
||||||
@ -424,6 +432,8 @@ const setTableSpecific = () => {
|
|||||||
sortable: {
|
sortable: {
|
||||||
sortDirections: ['ascend', 'descend'],
|
sortDirections: ['ascend', 'descend'],
|
||||||
},
|
},
|
||||||
|
// 如果是周末,添加自定义样式
|
||||||
|
cellClass: isWeekend ? 'weekend-column' : '',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -448,7 +458,6 @@ const onChangeDate = (val: any) => {
|
|||||||
|
|
||||||
// 日期变化处理(周维度)
|
// 日期变化处理(周维度)
|
||||||
const onChangeWeek = (val: any) => {
|
const onChangeWeek = (val: any) => {
|
||||||
console.log('onChangeWeek val', val);
|
|
||||||
if (val) {
|
if (val) {
|
||||||
// 确保val是Date对象
|
// 确保val是Date对象
|
||||||
const selectedDate = val instanceof Date ? val : new Date(val);
|
const selectedDate = val instanceof Date ? val : new Date(val);
|
||||||
@ -468,9 +477,7 @@ const onChangeWeek = (val: any) => {
|
|||||||
const onChangeMonth = (val: any) => {
|
const onChangeMonth = (val: any) => {
|
||||||
if (typeof val === 'string') {
|
if (typeof val === 'string') {
|
||||||
val = DateUtils.MonthStrToDate(val);
|
val = DateUtils.MonthStrToDate(val);
|
||||||
console.log('onChangeMonth val', val);
|
|
||||||
}
|
}
|
||||||
console.log('onChangeMonth val', val);
|
|
||||||
if (val) {
|
if (val) {
|
||||||
// 确保val是Date对象
|
// 确保val是Date对象
|
||||||
const selectedDate = val instanceof Date ? val : new Date(val);
|
const selectedDate = val instanceof Date ? val : new Date(val);
|
||||||
@ -548,7 +555,6 @@ const handleToday = () => {
|
|||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
query.page = pageInfo.page;
|
query.page = pageInfo.page;
|
||||||
query.page_size = pageInfo.page_size;
|
query.page_size = pageInfo.page_size;
|
||||||
console.log('query', query);
|
|
||||||
getTaskSchedules(query)
|
getTaskSchedules(query)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
@ -559,7 +565,6 @@ const handleSearch = () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('获取任务排期数据失败:', error);
|
|
||||||
data.value = [];
|
data.value = [];
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -571,8 +576,9 @@ const getOperators = async () => {
|
|||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
operators.value = operatorsData.map((op: any) => ({
|
operators.value = operatorsData.map((op: any) => ({
|
||||||
value: op.id,
|
value: op.id,
|
||||||
label: op.name,
|
name: op.name,
|
||||||
}));
|
}));
|
||||||
|
console.log('operatorsData:', operators.value);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取运营人员数据失败:', error);
|
console.error('获取运营人员数据失败:', error);
|
||||||
@ -620,42 +626,33 @@ onMounted(() => {
|
|||||||
.task-container {
|
.task-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 4px;
|
height: 100%;
|
||||||
padding: 4px 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-item {
|
.task-item {
|
||||||
padding: 4px 8px;
|
|
||||||
border-radius: 4px;
|
|
||||||
color: white;
|
|
||||||
line-height: 1.4;
|
|
||||||
word-break: break-word;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: opacity 0.2s;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-item:hover {
|
.task-more {
|
||||||
opacity: 0.8;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-task {
|
.no-task {
|
||||||
color: #999;
|
height: 30px;
|
||||||
font-style: italic;
|
display: flex;
|
||||||
text-align: center;
|
align-items: center;
|
||||||
padding: 8px 0;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
.tip-trigger {
|
|
||||||
background-color: #ffffff;
|
/* 周末列背景色 */
|
||||||
border: 1px solid #d9d9d9;
|
:deep(.weekend-column) {
|
||||||
border-radius: 4px;
|
background-color: #fbfaff !important;
|
||||||
padding: 4px 8px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background-color 0.3s;
|
|
||||||
width: 100px;
|
|
||||||
height: 80px;
|
|
||||||
}
|
|
||||||
.tip-trigger:hover {
|
|
||||||
background-color: #f0f0f0;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -40,8 +40,8 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
|||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||||
// 目标地址
|
// 目标地址
|
||||||
// target: 'https://lingjiapi.lvfunai.com/api',
|
target: 'https://lingjiapi.lvfunai.com/api',
|
||||||
target: 'http://192.168.40.7/api',
|
// target: 'http://192.168.40.7/api',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user