添加项目权限管理

This commit is contained in:
limengnan 2026-04-03 09:09:59 +08:00
parent 674c32af90
commit b1ee7c5f61
3 changed files with 58 additions and 3 deletions

View File

@ -56,6 +56,14 @@ export function deleteBatchProjects (queryParams:any){
});
}
//单个删除项目
export function visibilityProjects (queryParams:any){
return request({
url:'/projects/'+queryParams.projectId+'/visibility' ,
method: 'put',
data: queryParams
});
}
export function topologyDevicesLsit(queryParams:any){

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

View File

@ -7,7 +7,7 @@ export default {
<script setup lang="ts">
import { onMounted, ref, nextTick } from "vue";
import { ElForm, ElMessage, ElMessageBox } from "element-plus";
import { searchProjectsLsit,addProjects,updateProjects,deleteProjects,deleteBatchProjects} from "@/api/business/project";
import { searchProjectsLsit,addProjects,updateProjects,deleteProjects,deleteBatchProjects,visibilityProjects} from "@/api/business/project";
import Page from '@/components/Pagination/page.vue'
import ScenarioModel from '@/views/component/scenario/index.vue'
import Antvx6 from '@/components/antvx6/index.vue'
@ -79,7 +79,6 @@ function addClick() {
}
//-/
function confirmClick(formEl: any) {
console.log(info.value)
formEl.validate((valid: any) => {
if (valid) {
@ -110,11 +109,27 @@ function confirmClick(formEl: any) {
}
});
}
function confirmVisibilityClick() {
const params = {
projectId: info.value.projectId,
visibility: info.value.visibility,
}
visibilityProjects(params).then((res:any) => {
if(res == true){
ElMessage({
type: "success",
message: "操作成功",
});
}
gettableData();
dialogPermissionVisible.value = false;
});
}
//
function handleClose() {
dialogVisible.value = false;
isScenario.value = false;
dialogPermissionVisible.value = false;
if (infoForm.value != null) infoForm.value.resetFields();
}
//
@ -128,6 +143,11 @@ function editClick(row: any) { // 打开修改项目弹窗
info.value = JSON.parse(JSON.stringify(row));
dialogVisible.value = true;
}
const dialogPermissionVisible = ref(false);
function permissionClick(row: any) { //
info.value = JSON.parse(JSON.stringify(row));
dialogPermissionVisible.value = true;
}
function designClick(row: any) { //
info.value = JSON.parse(JSON.stringify(row));
isShowAntvx6.value = true;
@ -254,6 +274,10 @@ function closeAntvx6() {
<img src="@/assets/table/simulation.png" alt="" title="模拟分析"
@click="simulationClick(scope.row)"
style="cursor: pointer; ">
<img src="@/assets/table/permission.png" alt="" title="权限设置"
style="cursor: pointer; " @click="permissionClick(scope.row)">
<a :href=" apiUrl + '/projects/' + scope.row.projectId + '/exportProject'" target="_blank" rel="noopener noreferrer">
<img src="@/assets/table/export.png" alt="" title="导出项目工程"
style="cursor: pointer; ">
@ -289,6 +313,29 @@ function closeAntvx6() {
</el-form>
</el-dialog>
<el-dialog v-model="dialogPermissionVisible" :close-on-click-modal="false"
:modal="false" draggable :before-close="handleClose" :title="'权限管理'"
append-to-body width="620px" height="600px">
<el-form ref="infoForm" :model="info" :rules="rules" label-width="100px">
<el-form-item label="项目名称:" prop="name">
<el-input v-model="info.name" style="width: 100%" placeholder="输入项目名称" :disabled="true"></el-input>
</el-form-item>
<el-form-item label="权限类型:" prop="visibility">
<el-radio-group v-model="info.visibility" style="display: flex;">
<el-radio label="PRIVATE">私有</el-radio>
<el-radio label="PUBLIC">公开</el-radio>
<el-radio label="READONLY">只读</el-radio>
</el-radio-group>
</el-form-item>
<span class="dialog-footer"
style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;">
<el-button @click="handleClose"> </el-button>
<el-button type="primary" @click="confirmVisibilityClick" v-if="username == 'admin' || 'PUBLIC' == info.visibility
|| title == '新增项目'"> </el-button>
</span>
</el-form>
</el-dialog>
<el-dialog v-model="isScenario" :close-on-click-modal="false"
:modal="false" draggable :before-close="handleClose" title="历史模拟分析"
append-to-body width="1142px">