sql执行器开发,增加权限
This commit is contained in:
@@ -13,10 +13,11 @@
|
||||
<el-table-column prop="sourceUrl" label="数据源URL"></el-table-column>
|
||||
<el-table-column prop="sourceName" label="账号"></el-table-column>
|
||||
<el-table-column prop="sourcePassword" label="密码"></el-table-column>
|
||||
<el-table-column label="操作" width="150">
|
||||
<el-table-column label="操作" width="220">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-on:click="editDatasource(scope.row)" type="primary" size="small">修改</el-button>
|
||||
<el-button v-on:click="deleteDatasource(scope.row)" type="danger" size="small">删除</el-button>
|
||||
<el-button v-on:click="editDatasource(scope.row)" type="primary" size="mini">修改</el-button>
|
||||
<el-button v-on:click="editDbAuth(scope.row)" type="success" size="mini">权限</el-button>
|
||||
<el-button v-on:click="deleteDatasource(scope.row)" type="danger" size="mini">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -55,6 +56,37 @@
|
||||
<el-button v-on:click="datasourceDialogVisible=false" plain>取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--人员权限弹窗-->
|
||||
<el-dialog title="权限编辑" :visible.sync="dbSourceAuthDialogVisible" width="900px">
|
||||
<el-row>
|
||||
<el-select v-model="dbSourceAuthNewUser" filterable remote reserve-keyword
|
||||
placeholder="请输入名字、邮箱、账号搜索用户" :remote-method="getSearchUserList"
|
||||
:loading="dbSourceAuthUserLoading" style="width: 750px;">
|
||||
<el-option v-for="item in searchUserList" :key="item.id" :label="item.userName" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-button v-on:click="addDbSourceAuthUser">添加</el-button>
|
||||
</el-row>
|
||||
<el-table :data="dbSourceAuthUserList" border style="width: 100%; margin: 10px 0;">
|
||||
<el-table-column prop="userName" label="用户" width="150"></el-table-column>
|
||||
<el-table-column label="权限">
|
||||
<template slot-scope="scope">
|
||||
<el-radio v-model="scope.row.executeAuth" :label="0">无权限</el-radio>
|
||||
<el-radio v-model="scope.row.executeAuth" :label="1">库表查看权</el-radio>
|
||||
<el-radio v-model="scope.row.executeAuth" :label="2">数据查询权</el-radio>
|
||||
<el-radio v-model="scope.row.executeAuth" :label="3">所有权限</el-radio>
|
||||
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.descEditAuth">表字段注释修改权</el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="small" type="danger" plain v-on:click="deleteUserDbSourceAuth(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div>
|
||||
<el-button type="primary" v-on:click="saveUserDbSourceAuth">保存配置</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -72,6 +104,12 @@
|
||||
datasourceList: [],
|
||||
newDatasource: {},
|
||||
urlPlaceholder: "数据源URL",
|
||||
|
||||
dbSourceAuthDialogVisible: false,
|
||||
dbSourceAuthUserList: [],
|
||||
dbSourceAuthUserLoading: false,
|
||||
searchUserList: [],
|
||||
dbSourceAuthNewUser: "",
|
||||
};
|
||||
},
|
||||
mounted: function () {
|
||||
@@ -79,6 +117,64 @@
|
||||
this.getDatasourceList();
|
||||
},
|
||||
methods: {
|
||||
editDbAuth(row) {
|
||||
this.newDatasource = JSON.parse(JSON.stringify(row));
|
||||
app.dbSourceAuthNewUser = [];
|
||||
app.dbSourceAuthUserList = [];
|
||||
app.dbSourceAuthDialogVisible = true;
|
||||
var param = {sourceId: app.newDatasource.id};
|
||||
this.common.post(this.apilist1.dbUserAuthList, param, function (json) {
|
||||
app.dbSourceAuthUserList = json.data || [];
|
||||
app.dbSourceAuthDialogVisible = true;
|
||||
});
|
||||
},
|
||||
saveUserDbSourceAuth() {
|
||||
var param = {sourceId: app.newDatasource.id, authList: JSON.stringify(app.dbSourceAuthUserList)};
|
||||
this.common.post(this.apilist1.assignDbUserAuth, param, function (json) {
|
||||
toast.success("保存成功!");
|
||||
});
|
||||
},
|
||||
deleteUserDbSourceAuth(row) {
|
||||
var dbSourceAuthUserList = [];
|
||||
for (var i = 0; i < this.dbSourceAuthUserList.length; i++) {
|
||||
var item = this.dbSourceAuthUserList[i];
|
||||
if (item.userId != row.userId) {
|
||||
dbSourceAuthUserList.push(this.dbSourceAuthUserList[i]);
|
||||
}
|
||||
}
|
||||
this.dbSourceAuthUserList = dbSourceAuthUserList;
|
||||
},
|
||||
addDbSourceAuthUser() {
|
||||
if (this.dbSourceAuthNewUser.length <= 0) {
|
||||
toast.warn("请先选择用户");
|
||||
return;
|
||||
}
|
||||
var userName = "";
|
||||
for (var i = 0; i < this.searchUserList.length; i++) {
|
||||
if (this.dbSourceAuthNewUser == this.searchUserList[i].id) {
|
||||
userName = this.searchUserList[i].userName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.dbSourceAuthUserList.push({
|
||||
userName: userName,
|
||||
userId: this.dbSourceAuthNewUser,
|
||||
executeAuth: 0,
|
||||
descEditAuth: 0,
|
||||
});
|
||||
this.dbSourceAuthNewUser = "";
|
||||
},
|
||||
getSearchUserList(query) {
|
||||
if (query == '') {
|
||||
return;
|
||||
}
|
||||
this.dbSourceAuthUserLoading = true;
|
||||
var param = {search: query};
|
||||
this.common.post(this.apilist1.getUserBaseInfo, param, function (json) {
|
||||
app.searchUserList = json.data || [];
|
||||
app.dbSourceAuthUserLoading = false;
|
||||
});
|
||||
},
|
||||
addDatasource() {
|
||||
this.datasourceDialogVisible = true;
|
||||
this.newDatasource = {name: "", driverClassName: "", sourceUrl: "", sourceName: "", sourcePassword: ""};
|
||||
|
||||
Reference in New Issue
Block a user