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