perf: 逻辑调整

This commit is contained in:
rd
2025-07-15 11:50:09 +08:00
parent 97dd86cd45
commit dfd71639a2
3 changed files with 58 additions and 24 deletions

View File

@ -60,7 +60,7 @@
</template> </template>
</a-modal> </a-modal>
<SelectSubAccountModal ref="selectSubAccountModalRef" /> <SelectSubAccountModal ref="selectSubAccountModalRef" @confirm="onSelectSubAccounts" />
</template> </template>
<script setup> <script setup>
@ -131,12 +131,14 @@ const getDaysDiffText = (lastSyncedAt) => {
}; };
const open = (accountId, last_synced_at = null) => { const open = (accountId, last_synced_at = null) => {
reset();
id.value = accountId; id.value = accountId;
lastSyncedAt.value = last_synced_at; lastSyncedAt.value = last_synced_at;
visible.value = true; visible.value = true;
}; };
const close = () => { const reset = () => {
formRef.value?.resetFields(); formRef.value?.resetFields();
formRef.value?.clearValidate(); formRef.value?.clearValidate();
@ -152,6 +154,9 @@ const close = () => {
showSyncTip.value = false; showSyncTip.value = false;
clearFakeProgressTimer(); clearFakeProgressTimer();
clearStatusPollingTimer(); clearStatusPollingTimer();
};
const close = () => {
visible.value = false; visible.value = false;
}; };
@ -246,10 +251,21 @@ const handleSyncData = () => {
} }
}; };
const onSelectSubAccounts = (selectedItems) => {
console.log({ selectedItems });
visible.value = true;
isLoading.value = true;
isCompleted.value = false;
progress.value = 0;
startFakeProgressPolling();
startStatusPolling();
};
const handleOk = () => { const handleOk = () => {
close(); // visible.value = false;
selectSubAccountModalRef.value.open(); // selectSubAccountModalRef.value.open();
return; // return;
// n天未同步更新 // n天未同步更新
if (lastSyncedAt.value && lastSyncedAt.value < dayjs().startOf('day').valueOf()) { if (lastSyncedAt.value && lastSyncedAt.value < dayjs().startOf('day').valueOf()) {
handleSyncData(); handleSyncData();

View File

@ -97,7 +97,7 @@
</a-table-column> </a-table-column>
</template> </template>
</a-table> </a-table>
<div v-if="pageInfo.total > 0" class="flex justify-end"> <div v-if="pageInfo.total > 0" class="flex justify-end mt-16px">
<a-pagination <a-pagination
:total="pageInfo.total" :total="pageInfo.total"
size="mini" size="mini"
@ -111,8 +111,13 @@
/> />
</div> </div>
<template #footer> <template #footer>
<a-button class="cancel-btn" size="large" @click="onClose">取消</a-button> <span class="cts color-#3C4043 s1"
<a-button type="primary" class="ml-16px" status="danger" size="large" @click="onDelete">添加已选账户</a-button> >已选<span class="color-#6D4CFE num mx-3px">{{ selectedItems.length }}</span>账户</span
>
<div class="flex items-center">
<a-button class="cancel-btn" size="large" @click="onClose">取消</a-button>
<a-button type="primary" class="ml-16px" status="danger" size="large" @click="onConfirm">添加已选账户</a-button>
</div>
</template> </template>
</a-modal> </a-modal>
</template> </template>
@ -121,8 +126,7 @@
import { INITIAL_FORM, INITIAL_PAGE_INFO, TABLE_COLUMNS } from './constants'; import { INITIAL_FORM, INITIAL_PAGE_INFO, TABLE_COLUMNS } from './constants';
import { formatTableField, formatNumberShow, exactFormatTime } from '@/utils/tools'; import { formatTableField, formatNumberShow, exactFormatTime } from '@/utils/tools';
import icon1 from '@/assets/img/media-account/icon-delete.png'; const emits = defineEmits('confirm');
const update = inject('update'); const update = inject('update');
const visible = ref(false); const visible = ref(false);
@ -130,7 +134,6 @@ const dataSource = ref([]);
const query = ref(cloneDeep(INITIAL_FORM)); const query = ref(cloneDeep(INITIAL_FORM));
const pageInfo = ref(cloneDeep(INITIAL_PAGE_INFO)); const pageInfo = ref(cloneDeep(INITIAL_PAGE_INFO));
const selectedItems = ref([]); const selectedItems = ref([]);
const deleteTaskModalRef = ref(null);
const checkedAll = computed(() => selectedItems.value.length === dataSource.value.length); const checkedAll = computed(() => selectedItems.value.length === dataSource.value.length);
const indeterminate = computed( const indeterminate = computed(
@ -149,17 +152,23 @@ const onClose = () => {
visible.value = false; visible.value = false;
}; };
const onConfirm = () => {
onClose();
emits('confirm', selectedItems);
};
const getData = () => { const getData = () => {
dataSource.value = [ dataSource.value = [
{ {
id: 1832880547948105, id: '1832880547948105',
name: '美团-人设组YSCX-运管-OM运营三部-BT2阿里巴巴国际站-小题-3', name: '美团-人设组YSCX-运管-OM运营三部-BT2阿里巴巴国际站-小题-3',
}, },
{ {
id: 1832880548441993, id: '1832880548441993',
name: 'YSCX-运管-OM运营三部-BT2阿里巴巴国际站-小题', name: 'YSCX-运管-OM运营三部-BT2阿里巴巴国际站-小题',
}, },
]; ];
pageInfo.value.total = 2;
}; };
const reload = () => { const reload = () => {
pageInfo.value.page = 1; pageInfo.value.page = 1;

View File

@ -1,8 +1,18 @@
.select-sub-account-modal { .select-sub-account-modal {
.cts {
color: var(--Text-1, #211f24);
font-family: $font-family-medium;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 22px;
}
.arco-modal-header { .arco-modal-header {
} }
.arco-modal-body { .arco-modal-body {
height: 536px; height: 536px;
display: flex;
flex-direction: column;
.filter-row { .filter-row {
.filter-row-item { .filter-row-item {
&:not(:last-child) { &:not(:last-child) {
@ -16,20 +26,19 @@
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
flex-shrink: 0; flex-shrink: 0;
line-height: 22px; /* 157.143% */ line-height: 22px;
}
:deep(.arco-space-item) {
width: 100%;
} }
} }
} }
.cts {
color: var(--Text-1, #211f24); }
font-family: $font-family-medium; .arco-modal-footer {
font-size: 14px; justify-content: space-between;
font-style: normal; .s1 {
font-weight: 400; font-family: $font-family-regular;
line-height: 22px; .num {
font-family: $font-family-medium;
}
} }
} }
} }