库函数增加修改日志记录,增加函数修改授权,展示优化

This commit is contained in:
暮光:城中城
2021-04-27 23:24:21 +08:00
parent 744e877309
commit 58976dc829
22 changed files with 517 additions and 57 deletions

View File

@@ -83,7 +83,7 @@
<span style="margin-left: 10px;color: #999;font-size: 12px;"><i class="el-icon-info"></i> 添加删除或编辑之后记得点击保存哦~</span>
</span>
<el-row>
<el-select v-model="dbSourceAuthNewUser" filterable remote reserve-keyword
<el-select v-model="dbSourceAuthNewUser" filterable remote reserve-keyword autoComplete="new-password"
placeholder="请输入名字、邮箱、账号搜索用户" :remote-method="getSearchUserList"
:loading="dbSourceAuthUserLoading" style="width: 750px;margin-right: 10px;">
<el-option v-for="item in searchUserList" :key="item.id" :label="item.userName" :value="item.id"></el-option>
@@ -94,11 +94,14 @@
<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-select v-model="scope.row.executeAuth" placeholder="选择权限" style="width: 150px;margin-right: 10px;">
<el-option value="">无权限</el-option>
<el-option :value="1" label="库表查看权"></el-option>
<el-option :value="2" label="数据查询权"></el-option>
<el-option :value="3" label="所有权限"></el-option>
</el-select>
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.descEditAuth">表字段注释修改权</el-checkbox>
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.procEditAuth">函数修改权</el-checkbox>
</template>
</el-table-column>
<el-table-column label="操作" width="80">
@@ -201,8 +204,9 @@
this.dbSourceAuthUserList.push({
userName: userName,
userId: this.dbSourceAuthNewUser,
executeAuth: 0,
executeAuth: '',
descEditAuth: 0,
procEditAuth: 0,
});
this.dbSourceAuthNewUser = "";
},
@@ -292,6 +296,8 @@
setTimeout(() => {
this.loadDataListLoading = false;
}, 800);
}).catch(() => {
this.loadDataListLoading = false;
});
},
getDatasourceGroupList() {

View File

@@ -55,11 +55,11 @@
</div>
<div style="padding: 10px;" v-loading="columnListLoading">
<el-table :data="columnList" stripe border style="width: 100%; margin-bottom: 5px;">
<el-table-column prop="name" label="字段名" width="200"></el-table-column>
<el-table-column prop="name" label="字段名" width="220"></el-table-column>
<el-table-column label="自增" width="50">
<template slot-scope="scope">{{scope.row.isidentity ? '是' : '否'}}</template>
</el-table-column>
<el-table-column prop="type" label="类型" width="150"></el-table-column>
<el-table-column prop="type" label="类型" width="180"></el-table-column>
<el-table-column prop="length" label="长度" width="80"></el-table-column>
<el-table-column prop="nullable" label="空值" width="80"></el-table-column>
<el-table-column label="主键" width="50">

View File

@@ -128,6 +128,8 @@
}
this.procedureList = json.data || [];
this.procedureListLoading = false;
}).catch(() => {
this.procedureListLoading = false;
});
},
doEditProc(item) {

View File

@@ -12,7 +12,8 @@
<el-card style="margin: 10px;" shadow="never" v-loading="procedureInfoLoading">
<div slot="header" class="clearfix">
<span style="margin-right: 20px;">编辑函数</span>
<el-button type="" @click="saveProcedure" icon="el-icon-document-checked" size="mini">保存</el-button>
<el-button type="primary" @click="saveProcedure" icon="el-icon-document-checked" size="mini">保存</el-button>
<el-button type="" @click="showProcedureLog" icon="el-icon-document" size="mini">修改日志</el-button>
<!-- <el-button type="" @click="" icon="el-icon-video-play" size="mini">运行</el-button>-->
<!-- <el-button type="" @click="" icon="el-icon-video-pause" size="mini">停止</el-button>-->
</div>
@@ -24,6 +25,36 @@
<pre>{{saveProcedureErrInfo}}</pre>
</div>
</el-dialog>
<!--函数修改日志弹窗-->
<el-dialog title="函数修改日志" :visible.sync="procLogVisible" :footer="null">
<el-table :data="procLogList" stripe border style="width: 100%;" height="400">
<el-table-column prop="id" label="ID" width="100"></el-table-column>
<el-table-column prop="createUserName" label="修改人"></el-table-column>
<el-table-column prop="createTime" label="修改时间"></el-table-column>
<el-table-column prop="status" label="状态">
<template slot-scope="scope">
<el-tag type="success" v-if="scope.row.status==1">保存成功</el-tag>
<el-tag type="danger" v-else-if="scope.row.status==2">保存失败</el-tag>
<el-tag type="danger" v-else>-</el-tag>
</template>
</el-table-column>
<el-table-column prop="action" label="操作" width="130">
<template slot-scope="scope">
<el-button type="" @click="reEditProc(scope.row.id)">重新编辑</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
style="margin-top: 10px;"
@size-change="handlePageSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 30, 50]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="tableTotalCount">
</el-pagination>
</el-dialog>
</div>
</template>
@@ -44,6 +75,12 @@
sqlExecutorEditor: {},
saveProcedureErrInfo: '',
saveProcedureErrVisible: false,
// 日志列表
procLogVisible: false,
procLogList: [],
pageSize: 30,
currentPage: 1,
tableTotalCount: 0,
};
},
mounted: function () {
@@ -74,12 +111,43 @@
let newName = {key: this.$route.fullPath, val: '编辑函数-' + this.vueQueryParam.procName};
this.$store.commit('global/addTableName', newName);
},
handleCurrentChange(to) {
this.currentPage = to;
this.searchProcedureLogList();
},
handlePageSizeChange(to) {
this.pageSize = to;
this.searchProcedureLogList();
},
showProcedureLog() {
this.currentPage = 1;
this.procLogVisible = true;
this.searchProcedureLogList();
},
searchProcedureLogList() {
let param = {...this.vueQueryParam, ...this.searchParam, pageNum: this.currentPage, pageSize: this.pageSize};
datasourceApi.procedureLogList(param).then(json => {
if (this.currentPage == 1) {
this.tableTotalCount = json.total || 0;
}
this.procLogList = json.data || [];
});
},
reEditProc(id) {
datasourceApi.procedureLogDetail({logId: id}).then(json => {
let procedureLog = json.data || {};
this.sqlExecutorEditor.setValue(procedureLog.procBody, 1);
this.procLogVisible = false;
});
},
searchProcedureDetail() {
this.procedureInfoLoading = true;
datasourceApi.procedureDetail(this.vueQueryParam).then(json => {
this.procedureInfo = json.data || {};
this.procedureInfoLoading = false;
this.sqlExecutorEditor.setValue(this.procedureInfo.body, 1);
}).catch(() => {
this.procedureInfoLoading = false;
});
},
saveProcedure() {
@@ -94,6 +162,8 @@
} else {
this.$message.success("保存成功!");
}
}).catch(() => {
this.procedureInfoLoading = false;
});
},
doDeleteProc(item) {