From 996c13b2e3e189db6cef311395d71ab5d39faf23 Mon Sep 17 00:00:00 2001 From: jingna <1264204245@qq.com> Date: Thu, 30 Oct 2025 18:14:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/views/testdata/testtask/index.vue | 47 ++++++++++++++++------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/web/src/views/testdata/testtask/index.vue b/web/src/views/testdata/testtask/index.vue index 10bfe6a..48dae66 100644 --- a/web/src/views/testdata/testtask/index.vue +++ b/web/src/views/testdata/testtask/index.vue @@ -15,6 +15,7 @@ import { } from "@/api/testtask"; import { storagesBytype } from "@/api/storage"; import { getDict } from '@/api/dict' +import { getUserInfo } from '@/api/user'; /////// let result2 = ref([]) let result1 = ref([ @@ -53,7 +54,7 @@ const importRules: any = ref({ const fileList = ref([]) const importFormRef = ref() // 是否单机 -const standAlone = ref(true) +const standAlone = ref(false) //转化时间格式 function zhuandata(dateString: any) { // 创建Date对象 @@ -69,7 +70,6 @@ function zhuandata(dateString: any) { const loading = ref(false) //获取表格数据 function getdata() { - loading.value = true if (dataduan.value && dataduan.value.length > 0) { const dataArr = [] @@ -161,9 +161,9 @@ function addproject() { localStorageId: '', backupStorageId: '' } - if(standAlone){ - projectForme.value.localStorageId = 1 - projectForme.value.backupStorageId = -1 + if (standAlone) { + projectForme.value.localStorageId = 1 + projectForme.value.backupStorageId = -1 } console.log(projectForme.value) // formitemarr.value.length = 0 @@ -369,6 +369,13 @@ const moderules = ref({ backupStorageId: [{ required: true, message: "请选择minio存储空间", trigger: "change" }], }); onMounted(() => { + getUserInfo().then((res: any) => { + const roles = res.data.roles + const hasSingleMachineUser = roles.some(name => name === '单机用户'); + if (hasSingleMachineUser) { + standAlone.value = true + } + }) getdata() getDictOne() }); @@ -490,16 +497,27 @@ function importSubmit(formEl: any) { formEl.validate((valid: any, fields: any) => { if (valid) { if (fileList.value.length == 0) { - return ElMessage.warning('请选择导入的文件!') + return ElMessage.warning('请上传导入文件!') + } + if (isconnect) { + return } const formData = new FormData() formData.append('file', fileList.value[0]) formData.append('taskCode', importForm.value.taskCode) formData.append('localStorageId', importForm.value.localStorageId) formData.append('backupStorageId', importForm.value.backupStorageId) + isconnect.value = true importTaskSql(formData).then((res: any) => { - if (res) { + if (res.code == '0') { + isconnect.value = false + importDialog.value = false ElMessage.success('上传成功') + getdata() + } else { + isconnect.value = false + importDialog.value = false + ElMessage.error(res.msg) } }) } @@ -561,7 +579,7 @@ function importClose() {