Skip to content

Commit

Permalink
fix: 存储管理及菜单管理功能优化 (#6)
Browse files Browse the repository at this point in the history
菜单管理功能优化:
1、建议组件名称tag可点击快捷输入
2、目录类型外链无意义,隐藏
  • Loading branch information
jskils authored Apr 24, 2024
1 parent 9d77732 commit 62d4432
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
18 changes: 11 additions & 7 deletions src/views/system/menu/MenuAddModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<template #extra>
<div v-if="routeName">
<span>建议组件名称:</span>
<a-tag>{{ routeName }}</a-tag>
<a-tag checkable @check="inputRouteName">{{ routeName }}</a-tag>
</div>
</template>
</a-form-item>
Expand All @@ -66,9 +66,9 @@
</a-form-item>
<a-row :gutter="16" v-if="[1, 2].includes(form.type)">
<a-col :xs="12" :sm="12" :md="8" :lg="8" :xl="8" :xxl="8">
<a-form-item label="是否外链" field="isExternalUrl" v-if="[1, 2].includes(form.type)">
<a-form-item label="是否隐藏" field="hidden">
<a-switch
v-model="form.isExternal"
v-model="form.isHidden"
:checked-value="true"
:unchecked-value="false"
checked-text=""
Expand All @@ -78,9 +78,9 @@
</a-form-item>
</a-col>
<a-col :xs="12" :sm="12" :md="8" :lg="8" :xl="8" :xxl="8">
<a-form-item label="是否隐藏" field="hidden">
<a-form-item label="是否缓存" field="keepAlive">
<a-switch
v-model="form.isHidden"
v-model="form.isCache"
:checked-value="true"
:unchecked-value="false"
checked-text=""
Expand All @@ -90,9 +90,9 @@
</a-form-item>
</a-col>
<a-col :xs="12" :sm="12" :md="8" :lg="8" :xl="8" :xxl="8">
<a-form-item label="是否缓存" field="keepAlive">
<a-form-item label="是否外链" field="isExternalUrl" v-if="form.type === 2">
<a-switch
v-model="form.isCache"
v-model="form.isExternal"
:checked-value="true"
:unchecked-value="false"
checked-text=""
Expand Down Expand Up @@ -188,6 +188,10 @@ const formRules = computed(() => {
}
})
const inputRouteName = () => {
form.name = routeName.value
}
// 切换类型清除校验
const onChangeType = () => {
formRef.value?.clearValidate()
Expand Down
12 changes: 3 additions & 9 deletions src/views/system/storage/StorageAddModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ const { width } = useWindowSize()
const { storage_type_enum } = useDict('storage_type_enum')
const dataId = ref('')
const updatedSecretKey = ref(false)
const isUpdate = computed(() => !!dataId.value)
const title = computed(() => (isUpdate.value ? '修改存储' : '新增存储'))
const formRef = ref<FormInstance>()
Expand All @@ -120,7 +119,6 @@ const { form, resetForm } = useForm<StorageReq>({
code: '',
type: 2,
accessKey: undefined,
secretKeyEncrypted: undefined,
secretKey: undefined,
endpoint: undefined,
bucketName: undefined,
Expand Down Expand Up @@ -154,18 +152,14 @@ const onUpdate = async (id: string) => {
visible.value = true
}
const updateSecretKey = () => {
updatedSecretKey.value = true
}
// 保存
const save = async () => {
try {
const isInvalid = await formRef.value?.validate()
if (isInvalid) return false
const data = Object.assign({}, form)
if (data.type === 1) {
data.secretKey = updatedSecretKey.value ? encryptByRsa(form.secretKey) : form.secretKeyEncrypted
const data = {
...form,
secretKey: form.type === 1 && !form.secretKey.includes('*') ? encryptByRsa(form.secretKey) : null
}
if (isUpdate.value) {
await updateStorage(data, dataId.value)
Expand Down
1 change: 0 additions & 1 deletion src/views/system/storage/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export interface StorageReq {
type: number
accessKey: string
secretKey: string
secretKeyEncrypted: string
endpoint: string
bucketName: string
domain: string
Expand Down

0 comments on commit 62d4432

Please sign in to comment.