feat: 账号批量操作
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
>
|
||||
<div class="flex items-center">
|
||||
<img :src="icon1" width="20" height="20" class="mr-12px" />
|
||||
<span>确认删除 {{ accountName || '-' }} 这个账号吗?</span>
|
||||
<span>确认删除 {{ accountName }} 这个账号吗?</span>
|
||||
</div>
|
||||
<template #footer>
|
||||
<a-button class="cancel-btn" size="large" @click="onClose">取消</a-button>
|
||||
@ -51,7 +51,7 @@ const open = (record) => {
|
||||
const { id = null, name = '' } = record;
|
||||
accountId.value = id;
|
||||
accountName.value = name;
|
||||
|
||||
console.log({ name });
|
||||
visible.value = true;
|
||||
};
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="label">平台</span>
|
||||
<img :src="item.platform === 0 ? icon1 : icon2" width="20" height="19" />
|
||||
<img :src="item.platform === 0 ? icon1 : icon2" width="16" height="16" />
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="label">账号ID</span>
|
||||
@ -41,7 +41,8 @@
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="label">标签</span>
|
||||
<div class="flex items-center">
|
||||
<span v-if="!item.tags.length" class="cts">-</span>
|
||||
<div v-else class="flex items-center">
|
||||
<a-tooltip
|
||||
v-if="item.tags.length > 2"
|
||||
position="bottom"
|
||||
|
||||
@ -39,7 +39,11 @@
|
||||
<template v-if="editType === 'each'">
|
||||
<a-table :data="accountGroupList" :pagination="false" row-key="id" class="w-100%">
|
||||
<template #columns>
|
||||
<a-table-column title="账号名称" data-index="name" width="200" />
|
||||
<a-table-column title="账号名称" data-index="name" width="200">
|
||||
<template #cell="{ record }">
|
||||
<span>{{ record.name || '-' }}</span>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="选择分组" data-index="group_id">
|
||||
<template #cell="{ record }">
|
||||
<div class="flex items-center w-100%">
|
||||
@ -75,33 +79,20 @@ const form = reactive({
|
||||
group_id: null,
|
||||
});
|
||||
|
||||
const accountGroupList = ref([]); // [{id, name, group_id: null}]
|
||||
const accountGroupList = ref([]);
|
||||
const isAllEdit = computed(() => editType.value === 'all');
|
||||
|
||||
const open = (accountList = []) => {
|
||||
editType.value = 'all';
|
||||
groupOptions.value = [];
|
||||
form.group_id = null;
|
||||
accountGroupList.value = accountList.map((acc) => ({
|
||||
...acc,
|
||||
group_id: null,
|
||||
}));
|
||||
accountGroupList.value = accountList;
|
||||
|
||||
visible.value = true;
|
||||
getTags();
|
||||
};
|
||||
|
||||
const getTags = async () => {
|
||||
groupOptions.value = [
|
||||
{
|
||||
label: '测试',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: 'ceshi2',
|
||||
value: 2,
|
||||
},
|
||||
];
|
||||
const { code, data } = await fetchAccountGroups();
|
||||
if (code === 200) {
|
||||
groupOptions.value = data.map((item) => ({
|
||||
|
||||
@ -49,7 +49,11 @@
|
||||
<template v-if="editType === 'each'">
|
||||
<a-table :data="accountTagList" :pagination="false" row-key="id" class="w-100%">
|
||||
<template #columns>
|
||||
<a-table-column title="账号名称" data-index="name" width="200" />
|
||||
<a-table-column title="账号名称" data-index="name" width="200">
|
||||
<template #cell="{ record }">
|
||||
<span>{{ record.name || '-' }}</span>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="选择标签" data-index="tags">
|
||||
<template #cell="{ record, rowIndex }">
|
||||
<div class="flex items-center w-100%">
|
||||
@ -103,7 +107,7 @@ const open = (accountList = []) => {
|
||||
form.tags = [];
|
||||
accountTagList.value = accountList.map((acc) => ({
|
||||
...acc,
|
||||
tags: [],
|
||||
tags: acc.tags.map((tag) => tag.name),
|
||||
}));
|
||||
|
||||
visible.value = true;
|
||||
@ -111,16 +115,6 @@ const open = (accountList = []) => {
|
||||
};
|
||||
|
||||
const getTags = async () => {
|
||||
tagOptions.value = [
|
||||
{
|
||||
label: '测试1',
|
||||
value: '测试1',
|
||||
},
|
||||
{
|
||||
label: '测试2',
|
||||
value: '测试2',
|
||||
},
|
||||
];
|
||||
const { code, data } = await fetchAccountTags();
|
||||
if (code === 200) {
|
||||
tagOptions.value = data.map((item) => ({
|
||||
|
||||
@ -221,12 +221,12 @@ const handleChangeAll = (val) => {
|
||||
};
|
||||
const handleBatchDelete = () => {
|
||||
const ids = selectedItems.value.map((item) => item.id);
|
||||
const names = selectedItems.value.map((item) => `"${item.name}"`).join(',');
|
||||
const names = selectedItems.value.map((item) => `“${item.name || '-'}”`).join(',');
|
||||
deleteAccountRef.value?.open({ id: ids, name: names });
|
||||
};
|
||||
const handleDelete = (item) => {
|
||||
const { id, name } = item;
|
||||
deleteAccountRef.value?.open({ id, name: `"${name}"` });
|
||||
deleteAccountRef.value?.open({ id, name: `“${name || '-'}”` });
|
||||
};
|
||||
const handleCloseTip = () => {
|
||||
selectedItems.value = [];
|
||||
|
||||
Reference in New Issue
Block a user