Commit 82fb1eb08e221ff3b943a54c9982b35c41746550

Authored by xingyu
1 parent 4397d47d

fix: fileconfig

yudao-ui-admin-vue3/src/api/infra/fileConfig/index.ts
@@ -42,7 +42,7 @@ export const getFileConfigApi = (id: number) => { @@ -42,7 +42,7 @@ export const getFileConfigApi = (id: number) => {
42 42
43 // 更新文件配置为主配置 43 // 更新文件配置为主配置
44 export const updateFileConfigMasterApi = (id: number) => { 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,12 +35,7 @@
35 @click="handleMaster(row)" 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 <XTextButton 40 <XTextButton
46 preIcon="ep:delete" 41 preIcon="ep:delete"
@@ -164,7 +159,7 @@ @@ -164,7 +159,7 @@
164 </template> 159 </template>
165 <script setup lang="ts" name="FileConfig"> 160 <script setup lang="ts" name="FileConfig">
166 // 全局相关的 import 161 // 全局相关的 import
167 -import { reactive, ref } from 'vue' 162 +import { ref } from 'vue'
168 import { 163 import {
169 ElForm, 164 ElForm,
170 ElFormItem, 165 ElFormItem,
@@ -202,7 +197,7 @@ const dialogVisible = ref(false) // 是否显示弹出层 @@ -202,7 +197,7 @@ const dialogVisible = ref(false) // 是否显示弹出层
202 const dialogTitle = ref('edit') // 弹出层标题 197 const dialogTitle = ref('edit') // 弹出层标题
203 const formRef = ref<FormInstance>() // 表单 Ref 198 const formRef = ref<FormInstance>() // 表单 Ref
204 const detailData = ref() // 详情 Ref 199 const detailData = ref() // 详情 Ref
205 -let form = reactive<FileConfigApi.FileConfigVO>({ 200 +let form = ref<FileConfigApi.FileConfigVO>({
206 id: 0, 201 id: 0,
207 name: '', 202 name: '',
208 storage: 0, 203 storage: 0,
@@ -211,7 +206,7 @@ let form = reactive&lt;FileConfigApi.FileConfigVO&gt;({ @@ -211,7 +206,7 @@ let form = reactive&lt;FileConfigApi.FileConfigVO&gt;({
211 config: { 206 config: {
212 basePath: '', 207 basePath: '',
213 host: '', 208 host: '',
214 - port: '', 209 + port: 0,
215 username: '', 210 username: '',
216 password: '', 211 password: '',
217 mode: '', 212 mode: '',
@@ -222,7 +217,7 @@ let form = reactive&lt;FileConfigApi.FileConfigVO&gt;({ @@ -222,7 +217,7 @@ let form = reactive&lt;FileConfigApi.FileConfigVO&gt;({
222 domain: '' 217 domain: ''
223 }, 218 },
224 remark: '', 219 remark: '',
225 - createTime: '' 220 + createTime: new Date()
226 }) 221 })
227 // 设置标题 222 // 设置标题
228 const setDialogTile = (type: string) => { 223 const setDialogTile = (type: string) => {
@@ -241,7 +236,7 @@ const handleCreate = (formEl: FormInstance | undefined) =&gt; { @@ -241,7 +236,7 @@ const handleCreate = (formEl: FormInstance | undefined) =&gt; {
241 const handleUpdate = async (rowId: number) => { 236 const handleUpdate = async (rowId: number) => {
242 // 设置数据 237 // 设置数据
243 const res = await FileConfigApi.getFileConfigApi(rowId) 238 const res = await FileConfigApi.getFileConfigApi(rowId)
244 - form = res 239 + form.value = res
245 setDialogTile('update') 240 setDialogTile('update')
246 } 241 }
247 242
@@ -263,6 +258,11 @@ const handleMaster = (row: FileConfigApi.FileConfigVO) =&gt; { @@ -263,6 +258,11 @@ const handleMaster = (row: FileConfigApi.FileConfigVO) =&gt; {
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 const handleDelete = async (rowId: number) => { 267 const handleDelete = async (rowId: number) => {
268 await deleteData(xGrid, rowId) 268 await deleteData(xGrid, rowId)
@@ -277,10 +277,10 @@ const submitForm = async (formEl: FormInstance | undefined) =&gt; { @@ -277,10 +277,10 @@ const submitForm = async (formEl: FormInstance | undefined) =&gt; {
277 // 提交请求 277 // 提交请求
278 try { 278 try {
279 if (actionType.value === 'create') { 279 if (actionType.value === 'create') {
280 - await FileConfigApi.createFileConfigApi(form) 280 + await FileConfigApi.createFileConfigApi(form.value)
281 message.success(t('common.createSuccess')) 281 message.success(t('common.createSuccess'))
282 } else { 282 } else {
283 - await FileConfigApi.updateFileConfigApi(form) 283 + await FileConfigApi.updateFileConfigApi(form.value)
284 message.success(t('common.updateSuccess')) 284 message.success(t('common.updateSuccess'))
285 } 285 }
286 dialogVisible.value = false 286 dialogVisible.value = false