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

View File

@@ -42,6 +42,18 @@ const notificationTypeNames: { [key: string]: string } = {
webpush: 'WebPush',
}
// 消息类型下拉字典
const notificationTypes = [
{ value: '资源下载', title: '资源下载' },
{ value: '整理入库', title: '整理入库' },
{ value: '订阅', title: '订阅' },
{ value: '站点', title: '站点' },
{ value: '媒体服务器', title: '媒体服务器' },
{ value: '手动处理', title: '手动处理' },
{ value: '插件', title: '插件' },
{ value: '其它', title: '其它' },
]
// 打开详情弹窗
function openNotificationInfoDialog() {
notificationInfo.value = props.notification
@@ -106,6 +118,17 @@ function onClose() {
<VCol cols="12" md="6">
<VSwitch v-model="notificationInfo.enabled" label="启用通知" />
</VCol>
<VCol cols="12">
<VSelect
v-model="notificationInfo.switchs"
:items="notificationTypes"
label="消息类型"
hint="开启通知的消息类型"
multiple
chips
persistent-hint
/>
</VCol>
</VRow>
<VRow v-if="notificationInfo.type == 'wechat'">
<VCol cols="12" md="6">

View File

@@ -27,21 +27,24 @@ const treeItems = ref<FileItem[]>([
name: '/',
path: props.root,
children: [],
type: '',
type: 'dir',
basename: props.root,
extension: '',
size: 0,
modify_time: 0,
fileid: '',
parent_fileid: '',
storage: 'local',
},
])
// 拉取子目录
async function fetchDirs(item: any) {
return api
.get('/local/listdir?path=' + item.path)
.post('/storage/list', item)
.then((data: any) => {
// 只添加目录到子目录
data = data.filter((i: any) => i.type === 'dir')
item.children.push(...data)
})
.catch(err => console.warn(err))

View File

@@ -177,7 +177,7 @@
}
.grid-customrule-card {
grid-template-columns: repeat(auto-fill, minmax(1rem, 1fr));
grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
padding-block-end: 1rem;
}

View File

@@ -80,6 +80,8 @@ function addDirectory() {
download_path: '',
priority: -1,
monitor_type: '',
media_type: '',
media_category: '',
})
orderDirectoryCards()
}

View File

@@ -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>

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

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="优先级规则组"