mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-04 23:18:44 +08:00
feat(rule): add deleteAllRules Btn.
This commit is contained in:
@@ -8,6 +8,7 @@ import { CustomRule, FilterRuleGroup } from '@/api/types'
|
|||||||
import CustomerRuleCard from '@/components/cards/CustomRuleCard.vue'
|
import CustomerRuleCard from '@/components/cards/CustomRuleCard.vue'
|
||||||
import FilterRuleGroupCard from '@/components/cards/FilterRuleGroupCard.vue'
|
import FilterRuleGroupCard from '@/components/cards/FilterRuleGroupCard.vue'
|
||||||
import ImportCodeDialog from '@/components/dialog/ImportCodeDialog.vue'
|
import ImportCodeDialog from '@/components/dialog/ImportCodeDialog.vue'
|
||||||
|
import { VCard, VDialog } from 'vuetify/lib/components/index.mjs'
|
||||||
|
|
||||||
// 自定义规则列表
|
// 自定义规则列表
|
||||||
const customRules = ref<CustomRule[]>([])
|
const customRules = ref<CustomRule[]>([])
|
||||||
@@ -27,6 +28,12 @@ const importCodeDialog = ref(false)
|
|||||||
// 导入代码类型
|
// 导入代码类型
|
||||||
const importCodeType = ref('')
|
const importCodeType = ref('')
|
||||||
|
|
||||||
|
// 统一删除弹窗
|
||||||
|
const deleteAllDateDialog = ref(false)
|
||||||
|
|
||||||
|
// 统一删除弹窗的代码类型
|
||||||
|
const deleteAllDateDialogType = ref('')
|
||||||
|
|
||||||
// 提示框
|
// 提示框
|
||||||
const $toast = useToast()
|
const $toast = useToast()
|
||||||
|
|
||||||
@@ -271,6 +278,18 @@ function checkValueValidity(values: any, type: string): boolean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 清空规则(组)
|
||||||
|
function deleteAllRules(dateType: string) {
|
||||||
|
if (!dateType) return
|
||||||
|
if (dateType === 'custom') {
|
||||||
|
customRules.value = []
|
||||||
|
} else if (dateType === 'group') {
|
||||||
|
filterRuleGroups.value = []
|
||||||
|
} else {
|
||||||
|
console.error(`传入了不支持的类型!`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 规则变化时赋值
|
// 规则变化时赋值
|
||||||
function onRuleChange(rule: CustomRule, id: string) {
|
function onRuleChange(rule: CustomRule, id: string) {
|
||||||
const index = customRules.value.findIndex(item => item.id === id)
|
const index = customRules.value.findIndex(item => item.id === id)
|
||||||
@@ -367,12 +386,15 @@ onMounted(() => {
|
|||||||
<VBtn color="success" variant="tonal" @click="addCustomRule">
|
<VBtn color="success" variant="tonal" @click="addCustomRule">
|
||||||
<VIcon icon="mdi-plus" />
|
<VIcon icon="mdi-plus" />
|
||||||
</VBtn>
|
</VBtn>
|
||||||
<VBtn color="info" variant="tonal" @click="importRules('custom')">
|
<VBtn color="primary" variant="tonal" @click="importRules('custom')">
|
||||||
<VIcon icon="mdi-import" />
|
<VIcon icon="mdi-import" />
|
||||||
</VBtn>
|
</VBtn>
|
||||||
<VBtn color="info" variant="tonal" @click="shareRules(customRules)">
|
<VBtn color="info" variant="tonal" @click="shareRules(customRules)">
|
||||||
<VIcon icon="mdi-share" />
|
<VIcon icon="mdi-share" />
|
||||||
</VBtn>
|
</VBtn>
|
||||||
|
<VBtn color="error" variant="tonal" @click="deleteAllRules('custom')">
|
||||||
|
<VIcon icon="mdi-delete" />
|
||||||
|
</VBtn>
|
||||||
</VBtnGroup>
|
</VBtnGroup>
|
||||||
</div>
|
</div>
|
||||||
</VForm>
|
</VForm>
|
||||||
@@ -415,12 +437,15 @@ onMounted(() => {
|
|||||||
<VBtn color="success" variant="tonal" @click="addFilterRuleGroup">
|
<VBtn color="success" variant="tonal" @click="addFilterRuleGroup">
|
||||||
<VIcon icon="mdi-plus" />
|
<VIcon icon="mdi-plus" />
|
||||||
</VBtn>
|
</VBtn>
|
||||||
<VBtn color="info" variant="tonal" @click="importRules('group')">
|
<VBtn color="primary" variant="tonal" @click="importRules('group')">
|
||||||
<VIcon icon="mdi-import" />
|
<VIcon icon="mdi-import" />
|
||||||
</VBtn>
|
</VBtn>
|
||||||
<VBtn color="info" variant="tonal" @click="shareRules(filterRuleGroups)">
|
<VBtn color="info" variant="tonal" @click="shareRules(filterRuleGroups)">
|
||||||
<VIcon icon="mdi-share" />
|
<VIcon icon="mdi-share" />
|
||||||
</VBtn>
|
</VBtn>
|
||||||
|
<VBtn color="error" variant="tonal" @click="deleteAllRules('group')">
|
||||||
|
<VIcon icon="mdi-delete" />
|
||||||
|
</VBtn>
|
||||||
</VBtnGroup>
|
</VBtnGroup>
|
||||||
</div>
|
</div>
|
||||||
</VForm>
|
</VForm>
|
||||||
|
|||||||
Reference in New Issue
Block a user