Skip to content

Commit

Permalink
[bug] fix table change data isActive fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiram committed Nov 10, 2024
1 parent 138a730 commit 6ecc44a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/renderer/src/pages/setting/components/analyze/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</t-tag>
</template>
<template #isActive="{ row }">
<t-switch v-model="row.isActive" @change="handleOpChange(!row.isActive ? 'disable' : 'enable', [row.id])" />
<t-switch v-model="row.isActive" :disabled="row.key === 'debug'" @change="handleOpDefault(row.id)" />
</template>
<template #ext="{ row }">
<span v-for="item in row.ext" :key="item.id">{{ item }}</span>
Expand Down Expand Up @@ -239,6 +239,11 @@ const reqDel = async (index) => {
}
};
const handleOpDefault = async (id) => {
const item: any = tableConfig.value.data.find((item: any) => item.id === id);
handleOpChange(item.isActive ? 'enable' : 'disable', [id]);
};
const handleOpChange = async (type, doc) => {
if (doc.length === 0 && ['enable', 'disable', 'delete'].includes(type)) {
MessagePlugin.warning(t('pages.setting.message.noSelectData'));
Expand Down
7 changes: 6 additions & 1 deletion src/renderer/src/pages/setting/components/drive/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<span v-else>{{ row.name }}</span>
</template>
<template #isActive="{ row }">
<t-switch v-model="row.isActive" @change="handleOpChange(!row.isActive ? 'disable' : 'enable', [row.id])" />
<t-switch v-model="row.isActive" :disabled="row.key === 'debug'" @change="handleOpDefault(row.id)" />
</template>
<template #op="slotProps">
<t-space>
Expand Down Expand Up @@ -203,6 +203,11 @@ const reqDel = async (index) => {
}
};
const handleOpDefault = async (id) => {
const item: any = tableConfig.value.data.find((item: any) => item.id === id);
handleOpChange(item.isActive ? 'enable' : 'disable', [id]);
};
const handleOpChange = async (type, doc) => {
if (doc.length === 0 && ['enable', 'disable', 'delete'].includes(type)) {
MessagePlugin.warning(t('pages.setting.message.noSelectData'));
Expand Down
7 changes: 6 additions & 1 deletion src/renderer/src/pages/setting/components/iptv/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</t-tag>
</template>
<template #isActive="{ row }">
<t-switch v-model="row.isActive" @change="handleOpChange(!row.isActive ? 'disable' : 'enable', [row.id])" />
<t-switch v-model="row.isActive" :disabled="row.key === 'debug'" @change="handleOpDefault(row.id)" />
</template>
<template #op="slotProps">
<t-space>
Expand Down Expand Up @@ -214,6 +214,11 @@ const reqDel = async (index) => {
}
};
const handleOpDefault = async (id) => {
const item: any = tableConfig.value.data.find((item: any) => item.id === id);
handleOpChange(item.isActive ? 'enable' : 'disable', [id]);
};
const handleOpChange = async (type, doc) => {
if (doc.length === 0 && ['enable', 'disable', 'delete'].includes(type)) {
MessagePlugin.warning(t('pages.setting.message.noSelectData'));
Expand Down
7 changes: 6 additions & 1 deletion src/renderer/src/pages/setting/components/site/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<span v-else>{{ row.name }}</span>
</template>
<template #isActive="{ row }">
<t-switch v-model="row.isActive" :disabled="row.key === 'debug'" @change="handleOpChange(!row.isActive ? 'disable' : 'enable', [row.id])" />
<t-switch v-model="row.isActive" :disabled="row.key === 'debug'" @change="handleOpDefault(row.id)" />
</template>
<template #type="{ row }">
<span v-if="row.type === 0">T0[xml]</span>
Expand Down Expand Up @@ -221,6 +221,11 @@ const reqDel = async (index) => {
}
};
const handleOpDefault = async (id) => {
const item: any = tableConfig.value.data.find((item: any) => item.id === id);
handleOpChange(item.isActive ? 'enable' : 'disable', [id]);
};
const handleOpChange = async (type, doc) => {
if (doc.length === 0 && ['enable', 'disable', 'delete'].includes(type)) {
MessagePlugin.warning(t('pages.setting.message.noSelectData'));
Expand Down

0 comments on commit 6ecc44a

Please sign in to comment.