fix: fileconfig

This commit is contained in:
xingyu 2022-12-06 20:51:02 +08:00
parent 4397d47da1
commit 82fb1eb08e
2 changed files with 14 additions and 14 deletions

View File

@ -42,7 +42,7 @@ export const getFileConfigApi = (id: number) => {
// 更新文件配置为主配置
export const updateFileConfigMasterApi = (id: number) => {
return request.get({ url: '/infra/file-config/update-master?id=' + id })
return request.put({ url: '/infra/file-config/update-master?id=' + id })
}
// 新增文件配置

View File

@ -35,12 +35,7 @@
@click="handleMaster(row)"
/>
<!-- 操作测试 -->
<XTextButton
preIcon="ep:share"
:title="t('action.test')"
v-hasPermi="['infra:file-config:update']"
@click="handleUpdate(row.id)"
/>
<XTextButton preIcon="ep:share" :title="t('action.test')" @click="handleTest(row.id)" />
<!-- 操作删除 -->
<XTextButton
preIcon="ep:delete"
@ -164,7 +159,7 @@
</template>
<script setup lang="ts" name="FileConfig">
// import
import { reactive, ref } from 'vue'
import { ref } from 'vue'
import {
ElForm,
ElFormItem,
@ -202,7 +197,7 @@ const dialogVisible = ref(false) // 是否显示弹出层
const dialogTitle = ref('edit') //
const formRef = ref<FormInstance>() // Ref
const detailData = ref() // Ref
let form = reactive<FileConfigApi.FileConfigVO>({
let form = ref<FileConfigApi.FileConfigVO>({
id: 0,
name: '',
storage: 0,
@ -211,7 +206,7 @@ let form = reactive<FileConfigApi.FileConfigVO>({
config: {
basePath: '',
host: '',
port: '',
port: 0,
username: '',
password: '',
mode: '',
@ -222,7 +217,7 @@ let form = reactive<FileConfigApi.FileConfigVO>({
domain: ''
},
remark: '',
createTime: ''
createTime: new Date()
})
//
const setDialogTile = (type: string) => {
@ -241,7 +236,7 @@ const handleCreate = (formEl: FormInstance | undefined) => {
const handleUpdate = async (rowId: number) => {
//
const res = await FileConfigApi.getFileConfigApi(rowId)
form = res
form.value = res
setDialogTile('update')
}
@ -263,6 +258,11 @@ const handleMaster = (row: FileConfigApi.FileConfigVO) => {
})
}
const handleTest = async (rowId: number) => {
const res = await FileConfigApi.testFileConfigApi(rowId)
message.alert('测试通过,上传文件成功!访问地址:' + res)
}
//
const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId)
@ -277,10 +277,10 @@ const submitForm = async (formEl: FormInstance | undefined) => {
//
try {
if (actionType.value === 'create') {
await FileConfigApi.createFileConfigApi(form)
await FileConfigApi.createFileConfigApi(form.value)
message.success(t('common.createSuccess'))
} else {
await FileConfigApi.updateFileConfigApi(form)
await FileConfigApi.updateFileConfigApi(form.value)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false