点击选择账号

This commit is contained in:
lq
2025-09-19 18:36:20 +08:00
parent 77cd789d4a
commit c70b44022b
2 changed files with 39 additions and 2 deletions

View File

@ -149,7 +149,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, onMounted, watch } from 'vue'; import { ref, reactive, onMounted, nextTick } from 'vue';
import aiIcon from '@/assets/img/media-account/icon-AI.png'; import aiIcon from '@/assets/img/media-account/icon-AI.png';
import { Checkbox, Button, Space, Pagination, notification, DatePicker, TimePicker } from 'ant-design-vue'; import { Checkbox, Button, Space, Pagination, notification, DatePicker, TimePicker } from 'ant-design-vue';
import { TABS_LIST, ORIGIN_LIST, RawMaterialType } from '@/views/material-center/components/raw-material/constants'; import { TABS_LIST, ORIGIN_LIST, RawMaterialType } from '@/views/material-center/components/raw-material/constants';
@ -263,8 +263,15 @@ const handleAddMaterial = () => {
}; };
const handleDateChange = (date) => {}; const handleDateChange = (date) => {};
// 暴露方法给父组件 // 暴露方法给父组件
const showDrawer = () => { const showDrawer = (accountInfo = null) => {
showDriwer.value = true; showDriwer.value = true;
// 如果传入了账号信息,则设置为默认选中
if (accountInfo && accountInfo.id) {
// 使用 nextTick 确保在 DOM 更新后设置默认值
nextTick(() => {
localQuery.value.accounts = [accountInfo.name];
});
}
}; };
const showDriwerChange = (visible: boolean) => { const showDriwerChange = (visible: boolean) => {

View File

@ -29,6 +29,7 @@
style="width: 100%" style="width: 100%"
:pagination="false" :pagination="false"
@change="handleTableChange" @change="handleTableChange"
@row-click="handleRowClick"
> >
<!-- 空数据显示 --> <!-- 空数据显示 -->
<template #empty> <template #empty>
@ -465,6 +466,35 @@ const handleTableChange = (pagination: any, sorter: any) => {
handleSearch(); handleSearch();
}; };
// 处理表格行单击事件(用于调试)
const handleRowClick = (record: any, index: number, event: Event) => {
console.log('单击行:', record);
console.log('行索引:', index);
console.log('事件对象:', event);
const accountInfo = {
id: record.id,
name: record.name,
platform: record.platform,
};
drawerPopupRef.value.showDrawer(accountInfo);
};
// 处理表格行双击事件
const handleRowDblClick = (record: any, index: number, event: Event) => {
console.log('双击行:', record);
console.log('行索引:', index);
console.log('事件对象:', event);
// 双击行时打开创建任务弹窗并传递账号信息
if (drawerPopupRef.value) {
const accountInfo = {
id: record.id,
name: record.name,
platform: record.platform
};
drawerPopupRef.value.showDrawer(accountInfo);
}
};
// 任务操作处理 // 任务操作处理
const handleTaskAction = (action: string, task: any, ...args: any[]) => { const handleTaskAction = (action: string, task: any, ...args: any[]) => {
switch (action) { switch (action) {