添加任务-从原料库中添加

This commit is contained in:
lq
2025-09-23 17:11:51 +08:00
parent ab31959733
commit 288d4ffddf
4 changed files with 90 additions and 20 deletions

View File

@ -29,7 +29,7 @@
style="width: 100%"
:pagination="false"
@change="handleTableChange"
@row-click="handleRowClick"
@cell-click="handleCellClick"
>
<!-- 空数据显示 -->
<template #empty>
@ -113,7 +113,7 @@
<template #title>{{ deleteTitle }}</template>
<div>{{ deleteContent }}</div>
</a-modal>
<DrowPopup ref="drawerPopupRef" />
<DrowPopup ref="drawerPopupRef" @create-task="handleCreateTask" />
</template>
<script lang="ts" setup>
@ -128,7 +128,7 @@ import FilterPopup from './components/filter-popup.vue';
import DrowPopup from './components/draw-popup.vue';
import TaskItem from './components/task-item.vue';
// API引入
import { getTaskSchedules, delTaskSchedules, editTaskSchedules } from '@/api/all/assignment-management';
import { getTaskSchedules, delTaskSchedules, editTaskSchedules, createTask } from '@/api/all/assignment-management';
import { fetchAccountOperators, getMediaAccountList } from '@/api/all/propertyMarketing';
// 工具引入
import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination';
@ -246,6 +246,12 @@ const handleAddTask = () => {
drawerPopupRef.value?.showDrawer();
};
const handleCreateTask = async (value) => {
console.log('handleCreateTask', value);
const res = await createTask(value);
console.log('res', res);
};
// 添加对DrowPopup组件的引用
const drawerPopupRef = ref();
@ -366,7 +372,6 @@ const handleSearch = () => {
// 添加一个标志位来避免死循环
let isDateSelectorUpdating = false;
// 日期选择器变化处理
const handleDateSelectorChange = (value: any) => {
// 如果正在更新中,则跳过
@ -439,17 +444,27 @@ const handleTableChange = (pagination: any, sorter: any) => {
handleSearch();
};
// 处理表格行单击事件(用于调试)
const handleRowClick = (record: any, index: number, event: Event) => {
console.log('单击行:', record);
console.log('行索引:', index);
console.log('事件对象:', event);
const handleCellClick = (record: any, rowIndex: any, column: any) => {
const accountInfo = {
id: record.id,
name: record.name,
platform: record.platform,
};
drawerPopupRef.value.showDrawer(accountInfo);
const selectedDate = rowIndex.date;
// 检查选中的日期是否小于今天,如果是则不处理
const today = new Date();
today.setHours(0, 0, 0, 0);
const selectedDateTime = new Date(selectedDate);
selectedDateTime.setHours(0, 0, 0, 0);
if (selectedDateTime < today) {
console.log('选择的日期已过去,不打开抽屉');
return;
}
console.log('selectedDate', selectedDate);
drawerPopupRef.value.showDrawer(accountInfo, selectedDate);
};
// 任务操作处理