chore: 密钥管理 功能提交
This commit is contained in:
parent
fc7e4658a4
commit
6db7e7bb8c
|
@ -0,0 +1,53 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询api密钥列表
|
||||||
|
export function listSecret(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/secret/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询api密钥详细
|
||||||
|
export function getSecret(recordId) {
|
||||||
|
return request({
|
||||||
|
url: '/system/secret/' + recordId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增api密钥
|
||||||
|
export function addSecret(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/secret',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改api密钥
|
||||||
|
export function updateSecret(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/secret',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除api密钥
|
||||||
|
export function delSecret(recordId) {
|
||||||
|
return request({
|
||||||
|
url: '/system/secret/' + recordId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出api密钥
|
||||||
|
export function exportSecret(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/secret/export',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
|
@ -0,0 +1,381 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="密钥" prop="appId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.appId"
|
||||||
|
placeholder="请输入密钥"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="密钥值" prop="appSecret">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.appSecret"
|
||||||
|
placeholder="请输入密钥值"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
size="mini"
|
||||||
|
@click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:secret:add']"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:secret:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
>导出</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="secretList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
|
<el-table-column
|
||||||
|
v-if="isIndex"
|
||||||
|
type="index"
|
||||||
|
label="序号"
|
||||||
|
align="center"
|
||||||
|
:index="
|
||||||
|
(val) => {
|
||||||
|
return (
|
||||||
|
val + 1 + (queryParams.pageNum - 1) * this.queryParams.pageSize
|
||||||
|
);
|
||||||
|
}
|
||||||
|
"
|
||||||
|
width="80px"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column label="密钥" align="left" prop="appId">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.appId">
|
||||||
|
{{ scope.row.appId }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="密钥值" align="left" prop="appSecret">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.appSecret">
|
||||||
|
{{ scope.row.appSecret }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="状态"
|
||||||
|
align="center"
|
||||||
|
prop="status"
|
||||||
|
width="120"
|
||||||
|
:formatter="statusFormat"
|
||||||
|
/>
|
||||||
|
<el-table-column label="备注" align="left" prop="remark">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.remark">
|
||||||
|
{{ scope.row.remark }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
width="200px"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:secret:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:secret:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改api密钥对话框 -->
|
||||||
|
<dialog-template :title="title" :visible="open" @close="open = false" width="500px">
|
||||||
|
<el-form ref="form" slot="dialog-center" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="密钥" prop="appId" v-if="form.recordId">
|
||||||
|
<el-input
|
||||||
|
v-model="form.appId"
|
||||||
|
:disabled="true"
|
||||||
|
placeholder="请输入密钥"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="密钥值" prop="appSecret" v-if="form.recordId">
|
||||||
|
<el-input
|
||||||
|
v-model="form.appSecret"
|
||||||
|
:disabled="true"
|
||||||
|
placeholder="请输入密钥值"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input
|
||||||
|
v-model="form.remark"
|
||||||
|
type="textarea"
|
||||||
|
:rows="4"
|
||||||
|
maxlength="200"
|
||||||
|
placeholder="请输入备注"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="启用状态">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio :label="dict.dictValue" v-for="dict in statusOptions" :key="dict.dictValue">{{ dict.dictLabel }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="dialog-footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" size="mini" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel" size="mini">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</dialog-template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
listSecret,
|
||||||
|
getSecret,
|
||||||
|
delSecret,
|
||||||
|
addSecret,
|
||||||
|
updateSecret,
|
||||||
|
exportSecret,
|
||||||
|
} from "@/api/system/apiSecret";
|
||||||
|
import DialogTemplate from "@/components/DialogTemplate";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Secret",
|
||||||
|
components: {DialogTemplate},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// api密钥表格数据
|
||||||
|
secretList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
recordId: null,
|
||||||
|
recordStatus: null,
|
||||||
|
appId: null,
|
||||||
|
appSecret: null,
|
||||||
|
tenantId: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
statusOptions: [],
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
status: [
|
||||||
|
{ required: true, message: "启用状态不能为空", trigger: "blur" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getDicts("api_status_type").then((response) => {
|
||||||
|
this.statusOptions = response.data;
|
||||||
|
});
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 执行状态字典翻译
|
||||||
|
statusFormat(row, column) {
|
||||||
|
return this.selectDictLabel(this.statusOptions, row.status);
|
||||||
|
},
|
||||||
|
/** 查询api密钥列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listSecret(this.queryParams).then((response) => {
|
||||||
|
this.secretList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
recordId: null,
|
||||||
|
recordStatus: 0,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
appId: null,
|
||||||
|
appSecret: null,
|
||||||
|
tenantId: null,
|
||||||
|
remark: null,
|
||||||
|
status: '0',
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map((item) => item.recordId);
|
||||||
|
this.single = selection.length !== 1;
|
||||||
|
this.multiple = !selection.length;
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加api密钥";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const recordId = row.recordId || this.ids;
|
||||||
|
getSecret(recordId).then((response) => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改api密钥";
|
||||||
|
this.form.status = this.form.status.toString();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.recordId != null) {
|
||||||
|
updateSecret(this.form).then((response) => {
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addSecret(this.form).then((response) => {
|
||||||
|
this.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const recordIds = row.recordId || this.ids;
|
||||||
|
this.$confirm("是否删除该选项?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
return delSecret(recordIds);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
const queryParams = this.queryParams;
|
||||||
|
this.$confirm("是否确认导出所有api密钥数据项?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
return exportSecret(queryParams);
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
this.download(response.msg);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -114,36 +114,37 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="trigger-dialog">
|
||||||
<dialog-template
|
<el-dialog
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
:close-on-click-modal="false"
|
||||||
title="触发器详情"
|
title="触发器详情"
|
||||||
width="40%"
|
width="40%"
|
||||||
:visible="triggerDetailsDialog"
|
:visible.sync="triggerDetailsDialog"
|
||||||
@close="triggerDetailsDialog = false"
|
@close="triggerDetailsDialog = false"
|
||||||
top="5vh"
|
top="5vh"
|
||||||
>
|
>
|
||||||
<!-- <triggerDetails slot="dialog-center" v-if="triggerDetailsDialog === true" :triggerId="tempModel.triggerId"></triggerDetails> -->
|
<!-- <triggerDetails slot="dialog-center" v-if="triggerDetailsDialog === true" :triggerId="tempModel.triggerId"></triggerDetails> -->
|
||||||
</dialog-template>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 新增触发器dialog -->
|
<!-- 新增触发器dialog -->
|
||||||
<dialog-template
|
<el-dialog
|
||||||
class="trigger-d-dialog"
|
class="trigger-d-dialog"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
title="新增触发器"
|
title="新增触发器"
|
||||||
width="900px"
|
width="900px"
|
||||||
:visible="outerVisible"
|
:visible.sync="outerVisible"
|
||||||
@close="outerVisible = false"
|
@close="outerVisible = false"
|
||||||
append-to-body
|
append-to-body
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
slot="dialog-center"
|
|
||||||
v-if="outerVisible"
|
v-if="outerVisible"
|
||||||
:is="componectVal"
|
:is="componectVal"
|
||||||
:type="childOpt.type"
|
:type="childOpt.type"
|
||||||
:triggerId="childOpt.triggerId"
|
:triggerId="childOpt.triggerId"
|
||||||
@recover="dialogRecover"
|
@recover="dialogRecover"
|
||||||
></component>
|
></component>
|
||||||
</dialog-template>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div
|
<!-- <div
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container iot-project">
|
<div class="app-container iot-project">
|
||||||
<component :is="componectVal" :sourceId="sourceId"></component>
|
<component :is="componectVal" :sourceId="sourceId" @linkToTable="toTableClick"></component>
|
||||||
|
|
||||||
<div v-show="componectVal === ''">
|
<div v-show="componectVal === ''">
|
||||||
<el-form
|
<el-form
|
||||||
|
@ -92,9 +92,9 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="to-home-wrap2" @click="toTableClick" v-show="componectVal !== ''">
|
<!-- <div class="to-home-wrap2" @click="toTableClick" v-show="componectVal !== ''">
|
||||||
<el-button icon="el-icon-d-arrow-left" title="返回列表" circle>返回列表</el-button>
|
<el-button icon="el-icon-d-arrow-left" title="返回列表" circle>返回列表</el-button>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue