style: Update grid-customrule-card to use larger minimum width for columns

This commit is contained in:
jxxghp
2024-08-15 11:45:45 +08:00
parent c129a37ccf
commit 94ba3c4514
7 changed files with 164 additions and 12 deletions
@@ -80,6 +80,8 @@ function addDirectory() {
download_path: '',
priority: -1,
monitor_type: '',
media_type: '',
media_category: '',
})
orderDirectoryCards()
}
@@ -2,7 +2,7 @@
import { useToast } from 'vue-toast-notification'
import api from '@/api'
import draggable from 'vuedraggable'
import type { NotificationConf } from '@/api/types'
import type { NotificationConf, NotificationSwitchConf } from '@/api/types'
import NotificationChannelCard from '@/components/cards/NotificationChannelCard.vue'
// 所有消息渠道
@@ -11,6 +11,42 @@ const notifications = ref<NotificationConf[]>([])
// 提示框
const $toast = useToast()
// 消息类型开关
const notificationSwitchs = ref<NotificationSwitchConf[]>([
{
type: '资源下载',
action: 'all',
},
{
type: '整理入库',
action: 'all',
},
{
type: '订阅',
action: 'all',
},
{
type: '站点',
action: 'admin',
},
{
type: '媒体服务器',
action: 'admin',
},
{
type: '手动处理',
action: 'admin',
},
{
type: '插件',
action: 'admin',
},
{
type: '其它',
action: 'admin',
},
])
// 添加媒体服务器
function addNotification(notification: string) {
notifications.value.push({
@@ -48,9 +84,34 @@ async function saveNotificationSetting() {
}
}
// 加载消息类型开关
async function loadNotificationSwitchs() {
try {
const result: { [key: string]: any } = await api.get('system/setting/NotificationSwitchs')
notificationSwitchs.value = result.data?.value ?? []
} catch (error) {
console.log(error)
}
}
// 保存消息类型开关
async function saveNotificationSwitchs() {
try {
const result: { [key: string]: any } = await api.post(
'system/setting/NotificationSwitchs',
notificationSwitchs.value,
)
if (result.success) $toast.success('消息类型开关保存成功')
else $toast.error('消息类型开关保存失败!')
} catch (error) {
console.log(error)
}
}
// 加载数据
onMounted(() => {
loadNotificationSetting()
loadNotificationSwitchs()
})
</script>
@@ -117,11 +178,33 @@ onMounted(() => {
<VCardTitle>通知发送范围</VCardTitle>
<VCardSubtitle>对应消息类型只会发送给设定的用户</VCardSubtitle>
</VCardItem>
<VTable class="text-no-wrap">
<thead>
<tr>
<th scope="col">消息类型</th>
<th scope="col">范围</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in notificationSwitchs" :key="index">
<td>
{{ item.type }}
</td>
<td>
<VRadioGroup v-model="item.action" inline>
<VRadio value="user" label="仅操作用户" />
<VRadio value="admin" label="仅管理员" />
<VRadio value="all" label="所有用户" />
</VRadioGroup>
</td>
</tr>
</tbody>
</VTable>
<VDivider />
<VCardText>
<VForm @submit.prevent="() => {}">
<div class="d-flex flex-wrap gap-4 mt-4">
<VBtn mtype="submit" @click=""> 保存 </VBtn>
<VBtn mtype="submit" @click="saveNotificationSwitchs"> 保存 </VBtn>
</div>
</VForm>
</VCardText>
+23 -4
View File
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { useToast } from 'vue-toast-notification'
import api from '@/api'
import type { Site } from '@/api/types'
import type { FilterRuleGroup, Site } from '@/api/types'
// 提示框
const $toast = useToast()
@@ -42,8 +42,16 @@ const selectedMediaSource = ref([])
// 当前选中的过滤规则组
const selectedFilterGroup = ref([])
// 保存用户设置的规则
async function saveCustomFilters() {}
// 过滤规则组选择项
const filterRuleGroupOptions = computed(() => {
return filterRuleGroups.value.map(item => ({
title: item.name,
value: item.name,
}))
})
// 所有规则组列表
const filterRuleGroups = ref<FilterRuleGroup[]>([])
// 查询所有站点
async function querySites() {
@@ -110,9 +118,20 @@ async function saveSearchSetting() {
}
}
// 加载规则组
async function queryFilterRuleGroups() {
try {
const result: { [key: string]: any } = await api.get('system/setting/UserFilterRuleGroups')
filterRuleGroups.value = result.data?.value ?? []
} catch (error) {
console.log(error)
}
}
onMounted(() => {
querySites()
loadSearchSetting()
queryFilterRuleGroups()
})
</script>
@@ -142,7 +161,7 @@ onMounted(() => {
v-model="selectedFilterGroup"
multiple
chips
:items="[]"
:items="filterRuleGroupOptions"
label="过滤规则组"
hint="搜索媒体信息时按选定的过滤规则组对结果进行过滤"
persistent-hint
+24 -2
View File
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { useToast } from 'vue-toast-notification'
import api from '@/api'
import type { Site } from '@/api/types'
import type { FilterRuleGroup, Site } from '@/api/types'
// 提示框
const $toast = useToast()
@@ -37,6 +37,17 @@ const subscribeModeItems = [
// 选择的订阅模式
const selectedSubscribeMode = ref('spider')
// 所有规则组列表
const filterRuleGroups = ref<FilterRuleGroup[]>([])
// 过滤规则组选择项
const filterRuleGroupOptions = computed(() => {
return filterRuleGroups.value.map(item => ({
title: item.name,
value: item.name,
}))
})
// RSS运行周期选择项
const rssIntervalItems = [
{ title: '5分钟', value: 5 },
@@ -109,8 +120,19 @@ async function querySites() {
}
}
// 加载规则组
async function queryFilterRuleGroups() {
try {
const result: { [key: string]: any } = await api.get('system/setting/UserFilterRuleGroups')
filterRuleGroups.value = result.data?.value ?? []
} catch (error) {
console.log(error)
}
}
onMounted(() => {
querySites()
queryFilterRuleGroups()
})
</script>
@@ -146,7 +168,7 @@ onMounted(() => {
<VCol cols="12" md="12">
<VSelect
v-model="selectedFilterRuleGroup"
:items="[]"
:items="filterRuleGroupOptions"
chips
multiple
label="优先级规则组"