修改任务管理

This commit is contained in:
lq
2025-09-25 16:33:52 +08:00
parent 80e734136e
commit f4d20eb8e9
3 changed files with 44 additions and 5 deletions

View File

@ -22,9 +22,9 @@
<span>{{ item.label }}</span> <span>{{ item.label }}</span>
</div> </div>
</Option> </Option>
<template #tag="{ label, icon }"> <template #tag="{ label, value }">
<div class="flex items-center"> <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> <span>{{ label }}</span>
</div> </div>
</template> </template>
@ -39,6 +39,11 @@
<script setup> <script setup>
import { Select } from 'ant-design-vue'; import { Select } from 'ant-design-vue';
const { Option } = Select; const { Option } = Select;
// 自定义搜索过滤逻辑
const filterOption = (input, option) => {
return option.label.toLowerCase().includes(input.toLowerCase());
};
import { ref, watch, computed } from 'vue'; import { ref, watch, computed } from 'vue';
const props = defineProps({ const props = defineProps({
@ -93,9 +98,16 @@ const validOptions = computed(() => {
...item, ...item,
value: item.id !== undefined ? item.id : item.value, value: item.id !== undefined ? item.id : item.value,
label: item.name !== undefined ? item.name : item.label, 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( watch(
() => props.modelValue, () => props.modelValue,
(newVal) => { (newVal) => {

View File

@ -492,8 +492,35 @@ const showDrawer = (accountInfo = null, selectedDate = null) => {
showDriwer.value = true; showDriwer.value = true;
if (accountInfo && accountInfo.id) { if (accountInfo && accountInfo.id) {
nextTick(() => { 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 });
}
}
}); });
} }
// 如果传入了日期,则设置为默认日期 // 如果传入了日期,则设置为默认日期

View File

@ -472,7 +472,7 @@ const handleCellClick = (record: any, rowIndex: any, column: any) => {
return; return;
} }
console.log('selectedDate', selectedDate); console.log('selectedDate', selectedDate, accountInfo);
drawerPopupRef.value.showDrawer(accountInfo, selectedDate); drawerPopupRef.value.showDrawer(accountInfo, selectedDate);
}; };