Commit 82fb1eb08e221ff3b943a54c9982b35c41746550
1 parent
4397d47d
fix: fileconfig
Showing
2 changed files
with
14 additions
and
14 deletions
yudao-ui-admin-vue3/src/api/infra/fileConfig/index.ts
| ... | ... | @@ -42,7 +42,7 @@ export const getFileConfigApi = (id: number) => { |
| 42 | 42 | |
| 43 | 43 | // 更新文件配置为主配置 |
| 44 | 44 | export const updateFileConfigMasterApi = (id: number) => { |
| 45 | - return request.get({ url: '/infra/file-config/update-master?id=' + id }) | |
| 45 | + return request.put({ url: '/infra/file-config/update-master?id=' + id }) | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // 新增文件配置 | ... | ... |
yudao-ui-admin-vue3/src/views/infra/fileConfig/index.vue
| ... | ... | @@ -35,12 +35,7 @@ |
| 35 | 35 | @click="handleMaster(row)" |
| 36 | 36 | /> |
| 37 | 37 | <!-- 操作:测试 --> |
| 38 | - <XTextButton | |
| 39 | - preIcon="ep:share" | |
| 40 | - :title="t('action.test')" | |
| 41 | - v-hasPermi="['infra:file-config:update']" | |
| 42 | - @click="handleUpdate(row.id)" | |
| 43 | - /> | |
| 38 | + <XTextButton preIcon="ep:share" :title="t('action.test')" @click="handleTest(row.id)" /> | |
| 44 | 39 | <!-- 操作:删除 --> |
| 45 | 40 | <XTextButton |
| 46 | 41 | preIcon="ep:delete" |
| ... | ... | @@ -164,7 +159,7 @@ |
| 164 | 159 | </template> |
| 165 | 160 | <script setup lang="ts" name="FileConfig"> |
| 166 | 161 | // 全局相关的 import |
| 167 | -import { reactive, ref } from 'vue' | |
| 162 | +import { ref } from 'vue' | |
| 168 | 163 | import { |
| 169 | 164 | ElForm, |
| 170 | 165 | ElFormItem, |
| ... | ... | @@ -202,7 +197,7 @@ const dialogVisible = ref(false) // 是否显示弹出层 |
| 202 | 197 | const dialogTitle = ref('edit') // 弹出层标题 |
| 203 | 198 | const formRef = ref<FormInstance>() // 表单 Ref |
| 204 | 199 | const detailData = ref() // 详情 Ref |
| 205 | -let form = reactive<FileConfigApi.FileConfigVO>({ | |
| 200 | +let form = ref<FileConfigApi.FileConfigVO>({ | |
| 206 | 201 | id: 0, |
| 207 | 202 | name: '', |
| 208 | 203 | storage: 0, |
| ... | ... | @@ -211,7 +206,7 @@ let form = reactive<FileConfigApi.FileConfigVO>({ |
| 211 | 206 | config: { |
| 212 | 207 | basePath: '', |
| 213 | 208 | host: '', |
| 214 | - port: '', | |
| 209 | + port: 0, | |
| 215 | 210 | username: '', |
| 216 | 211 | password: '', |
| 217 | 212 | mode: '', |
| ... | ... | @@ -222,7 +217,7 @@ let form = reactive<FileConfigApi.FileConfigVO>({ |
| 222 | 217 | domain: '' |
| 223 | 218 | }, |
| 224 | 219 | remark: '', |
| 225 | - createTime: '' | |
| 220 | + createTime: new Date() | |
| 226 | 221 | }) |
| 227 | 222 | // 设置标题 |
| 228 | 223 | const setDialogTile = (type: string) => { |
| ... | ... | @@ -241,7 +236,7 @@ const handleCreate = (formEl: FormInstance | undefined) => { |
| 241 | 236 | const handleUpdate = async (rowId: number) => { |
| 242 | 237 | // 设置数据 |
| 243 | 238 | const res = await FileConfigApi.getFileConfigApi(rowId) |
| 244 | - form = res | |
| 239 | + form.value = res | |
| 245 | 240 | setDialogTile('update') |
| 246 | 241 | } |
| 247 | 242 | |
| ... | ... | @@ -263,6 +258,11 @@ const handleMaster = (row: FileConfigApi.FileConfigVO) => { |
| 263 | 258 | }) |
| 264 | 259 | } |
| 265 | 260 | |
| 261 | +const handleTest = async (rowId: number) => { | |
| 262 | + const res = await FileConfigApi.testFileConfigApi(rowId) | |
| 263 | + message.alert('测试通过,上传文件成功!访问地址:' + res) | |
| 264 | +} | |
| 265 | + | |
| 266 | 266 | // 删除操作 |
| 267 | 267 | const handleDelete = async (rowId: number) => { |
| 268 | 268 | await deleteData(xGrid, rowId) |
| ... | ... | @@ -277,10 +277,10 @@ const submitForm = async (formEl: FormInstance | undefined) => { |
| 277 | 277 | // 提交请求 |
| 278 | 278 | try { |
| 279 | 279 | if (actionType.value === 'create') { |
| 280 | - await FileConfigApi.createFileConfigApi(form) | |
| 280 | + await FileConfigApi.createFileConfigApi(form.value) | |
| 281 | 281 | message.success(t('common.createSuccess')) |
| 282 | 282 | } else { |
| 283 | - await FileConfigApi.updateFileConfigApi(form) | |
| 283 | + await FileConfigApi.updateFileConfigApi(form.value) | |
| 284 | 284 | message.success(t('common.updateSuccess')) |
| 285 | 285 | } |
| 286 | 286 | dialogVisible.value = false | ... | ... |