Files
daohangye/src/components/deskModule/SystemMonitor/Edit/DiskEditor/index.vue
T
Sun 394c6ce20c 适配多语言
Squashed commit of the following:

commit 632f86c0228c68391c01865c7576f3aa0408c102
Author: Sun <95302870@qq.com>
Date:   Sun Jan 7 14:47:55 2024 +0800

    退出的时候清除appstore

commit b9d805e49a3c6b2ad38bc8d527cb12cc8709012e
Author: Sun <95302870@qq.com>
Date:   Sun Jan 7 13:55:20 2024 +0800

    系统状态监控适配国际化

commit daece99723ec96d210241d2ca4e5a85dc5ae69bd
Author: Sun <95302870@qq.com>
Date:   Sun Jan 7 13:09:46 2024 +0800

    适配添加项目页面的国际化配置还有时钟的星期*

commit 8ea2b2fe951f6266415c96a197cb8d00faef4058
Author: Sun <95302870@qq.com>
Date:   Sun Jan 7 12:01:55 2024 +0800

    完成适配所有apps国际化

commit 21ef54e0d4afb10f560c8cb7aff666374afe0f87
Author: Sun <95302870@qq.com>
Date:   Sat Jan 6 21:36:07 2024 +0800

    增加读取默认浏览器语言

commit 6f710bbebe63ab2800193f27c71e5c0034f11978
Author: Sun <95302870@qq.com>
Date:   Sat Jan 6 21:09:58 2024 +0800

    登录页面增加语言选择选项

commit cb7c4a89a160ed3ef91ad566ec98e75325e7601f
Author: Sun <95302870@qq.com>
Date:   Sat Jan 6 20:37:16 2024 +0800

    首次尝试增加英文语言,并在我的信息设置

commit fb996e17cd11611d30c0e12feee00ddf7b225e32
Author: Sun <95302870@qq.com>
Date:   Sat Jan 6 18:22:40 2024 +0800

    完成基础设置页面的语言国际化适配
2024-01-07 14:53:53 +08:00

134 lines
4.5 KiB
Vue

<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { NColorPicker, NForm, NFormItem, NSelect } from 'naive-ui'
import type { DiskExtendParam } from '../../typings'
import GenericMonitorCard from '../../components/GenericMonitorCard/index.vue'
import GenericProgress from '../../components/GenericProgress/index.vue'
import { PanelPanelConfigStyleEnum } from '@/enums'
import { getDiskMountpoints } from '@/api/system/systemMonitor'
import { defautSwatchesBackground } from '@/utils/defaultData'
interface Emit {
(e: 'update:diskExtendParam', visible: DiskExtendParam): void
}
const props = defineProps<{
diskExtendParam: DiskExtendParam
}>()
const emit = defineEmits<Emit>()
const mountPointList = ref<{
label: string
value: string
}[]>([])
const extendParam = computed({
get: () => props.diskExtendParam,
set: (visible) => {
emit('update:diskExtendParam', visible)
},
})
async function getMountPointList() {
try {
const { data } = await getDiskMountpoints<SystemMonitor.Mountpoint[]>()
mountPointList.value = []
for (let i = 0; i < data.length; i++) {
const element = data[i]
if (i === 0 && !extendParam.value.path)
extendParam.value.path = element.mountpoint
mountPointList.value.push({
label: element.mountpoint,
value: element.mountpoint,
})
}
}
catch (error) {
}
}
onMounted(() => {
getMountPointList()
})
</script>
<template>
<div>
<!-- <div>{{ diskExtendParam }}</div> -->
<div class="flex mb-5 justify-center transparent-grid p-2 rounded-xl border">
<div class="w-[200px]">
<GenericMonitorCard
icon-text-icon-hide-title
:card-type-style="PanelPanelConfigStyleEnum.info"
icon="solar-cpu-bold"
:background-color="extendParam.backgroundColor"
:text-color="extendParam.color"
>
<template #info>
<GenericProgress
:progress-color="extendParam.progressColor"
:progress-rail-color="extendParam.progressRailColor"
:percentage="50"
:progress-height="5"
info-card-left-text="DEMO"
info-card-right-text="TEXT"
:text-color="extendParam.color"
:card-type-style="PanelPanelConfigStyleEnum.info"
/>
</template>
</GenericMonitorCard>
</div>
<div class="w-[80px] ml-2">
<GenericMonitorCard
icon-text-icon-hide-title
:card-type-style="PanelPanelConfigStyleEnum.icon"
icon="solar-cpu-bold"
:background-color="extendParam.backgroundColor"
:icon-text-color="extendParam.color"
>
<template #small>
<GenericProgress
:progress-color="extendParam.progressColor"
:progress-rail-color="extendParam.progressRailColor"
:percentage="50"
:text-color="extendParam.color"
:card-type-style="PanelPanelConfigStyleEnum.icon"
/>
</template>
</GenericMonitorCard>
</div>
</div>
<NForm ref="formRef" v-model="extendParam">
<NFormItem :label="$t('deskModule.systemMonitor.diskMountPoint')">
<NSelect v-model:value="extendParam.path" size="small" :options="mountPointList" />
</NFormItem>
<NFormItem :label="$t('deskModule.systemMonitor.progressColor')">
<NColorPicker v-model:value="extendParam.progressColor" :swatches="defautSwatchesBackground" :modes="['hex']" size="small" />
</NFormItem>
<NFormItem :label="$t('deskModule.systemMonitor.progressRailColor')">
<NColorPicker v-model:value="extendParam.progressRailColor" :swatches="defautSwatchesBackground" :modes="['hex']" size="small" />
</NFormItem>
<NFormItem :label="$t('common.textColor')">
<NColorPicker v-model:value="extendParam.color" :swatches="defautSwatchesBackground" :modes="['hex']" size="small" />
</NFormItem>
<NFormItem :label="$t('common.backgroundColor')">
<NColorPicker v-model:value="extendParam.backgroundColor" :swatches="defautSwatchesBackground" :modes="['hex']" size="small" />
</NFormItem>
</NForm>
</div>
</template>
<style>
.transparent-grid {
background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%),
linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%);
background-size: 16px 16px;
background-position: 0 0, 8px 8px;
background-color: #e2e8f0;
}
</style>