修改任务管理
This commit is contained in:
@ -22,9 +22,9 @@
|
||||
<span>{{ item.label }}</span>
|
||||
</div>
|
||||
</Option>
|
||||
<template #tag="{ label, icon }">
|
||||
<template #tag="{ label, value }">
|
||||
<div class="flex items-center">
|
||||
<img v-if="icon" :src="icon" class="w-16px h-16px mr-4px rounded-4px" />
|
||||
<img v-if="getIconByValue(value)" :src="getIconByValue(value)" class="w-16px h-16px mr-4px rounded-4px" />
|
||||
<span>{{ label }}</span>
|
||||
</div>
|
||||
</template>
|
||||
@ -39,6 +39,11 @@
|
||||
<script setup>
|
||||
import { Select } from 'ant-design-vue';
|
||||
const { Option } = Select;
|
||||
|
||||
// 自定义搜索过滤逻辑
|
||||
const filterOption = (input, option) => {
|
||||
return option.label.toLowerCase().includes(input.toLowerCase());
|
||||
};
|
||||
import { ref, watch, computed } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
@ -93,9 +98,16 @@ const validOptions = computed(() => {
|
||||
...item,
|
||||
value: item.id !== undefined ? item.id : item.value,
|
||||
label: item.name !== undefined ? item.name : item.label,
|
||||
icon: item.icon, // 添加icon属性的映射
|
||||
}));
|
||||
});
|
||||
|
||||
// 根据value获取对应的图标
|
||||
const getIconByValue = (value) => {
|
||||
const option = validOptions.value.find(option => option.value === value);
|
||||
return option ? option.icon : undefined;
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
|
||||
@ -492,8 +492,35 @@ const showDrawer = (accountInfo = null, selectedDate = null) => {
|
||||
showDriwer.value = true;
|
||||
if (accountInfo && accountInfo.id) {
|
||||
nextTick(() => {
|
||||
localQuery.value.accounts = [accountInfo.name];
|
||||
localQuery.value.ids = [accountInfo.id];
|
||||
// 查找账号列表中匹配的账号,包含平台信息和图标
|
||||
const matchedAccount = accountList.value.find(account => account.value === accountInfo.id);
|
||||
if (matchedAccount) {
|
||||
localQuery.value.accounts = [matchedAccount.name];
|
||||
localQuery.value.ids = [accountInfo.id];
|
||||
} else {
|
||||
// 如果没有找到匹配项,检查账号列表是否已加载
|
||||
if (accountList.value.length > 0) {
|
||||
// 账号列表已加载但未找到匹配项,回退到原来的方式
|
||||
localQuery.value.accounts = [`${accountInfo.name}(${getPlatformName(accountInfo.platform)})`];
|
||||
localQuery.value.ids = [accountInfo.id];
|
||||
} else {
|
||||
// 账号列表尚未加载,等待加载完成后再设置
|
||||
const unwatch = watch(accountList, (newAccountList) => {
|
||||
if (newAccountList.length > 0) {
|
||||
const matched = newAccountList.find(account => account.value === accountInfo.id);
|
||||
if (matched) {
|
||||
localQuery.value.accounts = [matched.name];
|
||||
localQuery.value.ids = [accountInfo.id];
|
||||
} else {
|
||||
localQuery.value.accounts = [`${accountInfo.name}(${getPlatformName(accountInfo.platform)})`];
|
||||
localQuery.value.ids = [accountInfo.id];
|
||||
}
|
||||
// 取消监听
|
||||
unwatch();
|
||||
}
|
||||
}, { immediate: true });
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// 如果传入了日期,则设置为默认日期
|
||||
|
||||
@ -472,7 +472,7 @@ const handleCellClick = (record: any, rowIndex: any, column: any) => {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('selectedDate', selectedDate);
|
||||
console.log('selectedDate', selectedDate, accountInfo);
|
||||
drawerPopupRef.value.showDrawer(accountInfo, selectedDate);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user