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