修改权限

This commit is contained in:
jingna 2025-10-30 18:14:08 +08:00
parent 2c68c12fe2
commit 996c13b2e3

View File

@ -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 = []
@ -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() {
<div>
<el-button type="primary" @click="addproject()">新增</el-button>
<el-button type="primary" @click="delprojectArr()" :disabled="tableIdarr.length == 0">删除</el-button>
<el-button type="primary" @click="importproject()">导入</el-button>
<el-button v-if="!standAlone" type="primary" @click="importproject()">导入</el-button>
</div>
</div>
<el-table v-loading="loading" :data="tableData" @selection-change="handleSelectionChange"
@ -606,12 +624,12 @@ function importClose() {
</div>
</template>
</el-table-column>
<el-table-column prop="localStorageId" label="本地存储空间" width="180">
<el-table-column v-if="!standAlone" prop="localStorageId" label="本地存储空间" width="180">
<template #default="scope">
<span>{{ typeName1(localarr, scope.row.localStorageId) }}</span>
</template>
</el-table-column>
<el-table-column prop="backupStorageId" label="备份存储空间" width="180">
<el-table-column v-if="!standAlone" prop="backupStorageId" label="备份存储空间" width="180">
<template #default="scope">
<span>{{ typeName1(minioarr, scope.row.backupStorageId) }}</span>
</template>
@ -624,7 +642,7 @@ function importClose() {
style="cursor: pointer;">
<img src="@/assets/MenuIcon/lbcz_sc.png" alt="" title="删除" @click="delproject(scope.row)"
style="cursor: pointer;">
<img src="@/assets/MenuIcon/lbcz_dc.png" alt="" title="导出" @click="expproject(scope.row)"
<img v-if="standAlone" src="@/assets/MenuIcon/lbcz_dc.png" alt="" title="导出" @click="expproject(scope.row)"
style="cursor: pointer;">
</span>
</template>
@ -703,7 +721,8 @@ function importClose() {
<el-button type="primary" @click="dellable(index)">删除</el-button>
</div>
</el-form-item>
<div v-if="!standAlone" style="width: 100%;display: flex;justify-content: space-between;align-items: center;">
<div v-if="!standAlone"
style="width: 100%;display: flex;justify-content: space-between;align-items: center;">
<el-form-item label="本地存储空间" prop="localStorageId" style="width: 50%;">
<el-select v-model="projectForme.localStorageId" clearable placeholder=" "
:disabled="!shidou">
@ -781,13 +800,13 @@ function importClose() {
<el-input v-model="importForm.fileName" disabled style="margin-right: 15px;" />
<el-upload v-model="fileList" :auto-upload="false" :show-file-list="false" class="upload-demo"
action="" :on-change="fileChange">
<el-button type="primary">导入</el-button>
<el-button type="primary">上传导入文件</el-button>
</el-upload>
</div>
</el-form-item>
</el-form>
<div style="width: 100%;display: flex;justify-content: end;margin-top: 10px;">
<el-button type="primary" @click="importSubmit(importFormRef)">确定</el-button>
<el-button type="primary" @click="importSubmit(importFormRef)">导入</el-button>
</div>
</el-dialog>
</div>