Commit 3cb3c08a by wanglizhen

密钥管理

parent 1a184233
<template> <template>
<div class="key-management-wrapper"> <div class="app-container scroller">
<div class="key-management"> <div class="app-container__body">
<!-- 标题 --> <!-- 标题 -->
<div class="title"> <div class="pageTitle">
<i class="el-icon-lock"></i> <img class="icon" src="@/assets/images/ruleConfig/keyManagementPage.png" alt="">
密钥管理 <span>密钥管理</span>
</div> </div>
<!-- 密管选择区域 --> <!-- 密管选择区域 -->
<div class="section-card">
<div class="section-title">密管选择区域:</div>
<div class="section-content"> <div class="section-content">
<div class="form-item"> <div class="form-item">
<span class="label">密管方式</span> <span class="label">密管方式</span>
<el-select <el-select v-model="keyManageType" placeholder="请选择" style="width: 300px;height: 40px;margin-right: 27px;"
v-model="keyManageType"
placeholder="请选择"
style="width: 200px;padding-right: 10px;"
@change="handleKeyManageChange"> @change="handleKeyManageChange">
<el-option <el-option v-for="item in keyManageData" :key="item.typeid" :label="item.typename" :value="item.typeid">
v-for="item in keyManageData"
:key="item.typeid"
:label="item.typename"
:value="item.typeid">
</el-option> </el-option>
</el-select> </el-select>
<el-checkbox v-model="isEnabled" @change="handleEnableChange">是否启用</el-checkbox> <el-checkbox v-model="isEnabled" @change="handleEnableChange">是否启用</el-checkbox>
...@@ -31,64 +22,46 @@ ...@@ -31,64 +22,46 @@
</span> </span>
</div> </div>
</div> </div>
</div>
<!-- 参数配置区域 --> <!-- 参数配置区域 -->
<div class="section-card"> <div class="section-card">
<div class="section-title">参数配置区域:</div> <div class="line"></div>
<div class="section-content"> <div class="section-content">
<params-config <params-config v-model="configParams" :type="getConfigType" :editable="isEditing"
v-model="configParams" @download-template="handleDownloadTemplate" @upload-config="handleUploadConfig"
:type="getConfigType" @upload-cert="handleUploadCert" @generate-params="generateParams" />
:editable="isEditing"
@download-template="handleDownloadTemplate"
@upload-config="handleUploadConfig"
@upload-cert="handleUploadCert"
@generate-params="generateParams"
/>
</div>
</div> </div>
<!-- 底部按钮 --> <!-- 底部按钮 -->
<div class="footer"> <div class="footer">
<template v-if="isEditing"> <template v-if="isEditing">
<el-button @click="handleCancel">取消</el-button> <el-button style="width: 80px;" @click="handleCancel">取消</el-button>
<el-button @click="handleTest">测试</el-button> <el-button style="width: 80px;" type="primary" @click="handleConfirm">确定</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button> <el-button style="width: 80px;background: rgba(255, 141, 26, 1);border: 1px solid rgba(255, 141, 26, 1);" type="primary" @click="handleTest">测试</el-button>
</template> </template>
<template v-else> <template v-else>
<el-button type="primary" @click="isEditing = true">编辑</el-button> <el-button type="primary" style="width: 80px;" @click="isEditing = true">编辑</el-button>
</template> </template>
</div> </div>
</div> </div>
</div>
<!-- 上传配置文件弹层组件 --> <!-- 上传配置文件弹层组件 -->
<UploadDialog <UploadDialog v-model:visible="uploadDialogVisible" :title="'上传配置文件'" :loading="uploadLoading"
v-model:visible="uploadDialogVisible" :fileList="uploadFileList" @file-change="handleFileChange" @confirm="handleUploadConfirm"
:title="'上传配置文件'" @cancel="handleUploadCancel" />
:loading="uploadLoading"
:fileList="uploadFileList"
@file-change="handleFileChange"
@confirm="handleUploadConfirm"
@cancel="handleUploadCancel"
/>
<!-- 上传证书弹层组件 --> <!-- 上传证书弹层组件 -->
<UploadDialog <UploadDialog v-model:visible="uploadCertDialogVisible" :title="'上传证书'" :loading="uploadCertLoading"
v-model:visible="uploadCertDialogVisible" :fileList="uploadCertFileList" @file-change="handleCertFileChange" @confirm="handleCertUploadConfirm"
:title="'上传证书'" @cancel="handleCertUploadCancel" />
:loading="uploadCertLoading"
:fileList="uploadCertFileList"
@file-change="handleCertFileChange"
@confirm="handleCertUploadConfirm"
@cancel="handleCertUploadCancel"
/>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, reactive, computed, onMounted } from 'vue'; import { ref, reactive, computed, onMounted } from 'vue';
import { queryKeys, showKeyParams, editIsUse, testCallKey, saveKeyParams, uploadHsmConfig, createParam, import {
downloadHsmConfig, downloadCloudHsmConfig, downloadSanWeiConfig, downloadZdxlzjceConfig, uploadSanWeiConfig } from '@/api/ruleConfig/keyManagement.js'; queryKeys, showKeyParams, editIsUse, testCallKey, saveKeyParams, uploadHsmConfig, createParam,
downloadHsmConfig, downloadCloudHsmConfig, downloadSanWeiConfig, downloadZdxlzjceConfig, uploadSanWeiConfig
} from '@/api/ruleConfig/keyManagement.js';
import ParamsConfig from './components/ParamsConfig.vue'; import ParamsConfig from './components/ParamsConfig.vue';
import UploadDialog from './components/UploadDialog.vue'; import UploadDialog from './components/UploadDialog.vue';
import { testData } from '@/constants/keyConfigDefaultData.js'; import { testData } from '@/constants/keyConfigDefaultData.js';
...@@ -311,9 +284,9 @@ const handleUploadConfirm = async () => { ...@@ -311,9 +284,9 @@ const handleUploadConfirm = async () => {
} }
//如果量子加密机配置 //如果量子加密机配置
if (keyManageType.value === '9'){ if (keyManageType.value === '9') {
formData.append('filePath', configParams.value.zdxlzjcedir); formData.append('filePath', configParams.value.zdxlzjcedir);
}else{ } else {
// 如果是其他类型的密管配置 // 如果是其他类型的密管配置
formData.append('filePath', configParams.value.hsmfiledir); formData.append('filePath', configParams.value.hsmfiledir);
} }
...@@ -386,7 +359,7 @@ const handleDownloadTemplate = async () => { ...@@ -386,7 +359,7 @@ const handleDownloadTemplate = async () => {
}); });
return; return;
} }
if(keyManageType.value === '2'){ if (keyManageType.value === '2') {
// 加密机的模版 // 加密机的模版
const res = await downloadHsmConfig(); const res = await downloadHsmConfig();
const blob = new Blob([res], { type: 'application/octet-stream' }); const blob = new Blob([res], { type: 'application/octet-stream' });
...@@ -400,7 +373,7 @@ const handleDownloadTemplate = async () => { ...@@ -400,7 +373,7 @@ const handleDownloadTemplate = async () => {
} }
// 云加密机的模版 // 云加密机的模版
if(keyManageType.value === '3'){ if (keyManageType.value === '3') {
const res = await downloadCloudHsmConfig(); const res = await downloadCloudHsmConfig();
const blob = new Blob([res], { type: 'application/octet-stream' }); const blob = new Blob([res], { type: 'application/octet-stream' });
const link = document.createElement('a'); const link = document.createElement('a');
...@@ -414,7 +387,7 @@ const handleDownloadTemplate = async () => { ...@@ -414,7 +387,7 @@ const handleDownloadTemplate = async () => {
// 三未加密机的模版 // 三未加密机的模版
if(keyManageType.value === '8'){ if (keyManageType.value === '8') {
const res = await downloadSanWeiConfig(); const res = await downloadSanWeiConfig();
const blob = new Blob([res], { type: 'application/octet-stream' }); const blob = new Blob([res], { type: 'application/octet-stream' });
const link = document.createElement('a'); const link = document.createElement('a');
...@@ -427,7 +400,7 @@ const handleDownloadTemplate = async () => { ...@@ -427,7 +400,7 @@ const handleDownloadTemplate = async () => {
} }
// 中电信密管的模版 // 中电信密管的模版
if(keyManageType.value === '9'){ if (keyManageType.value === '9') {
const res = await downloadZdxlzjceConfig(); const res = await downloadZdxlzjceConfig();
const blob = new Blob([res], { type: 'application/octet-stream' }); const blob = new Blob([res], { type: 'application/octet-stream' });
const link = document.createElement('a'); const link = document.createElement('a');
...@@ -533,60 +506,48 @@ onMounted(() => { ...@@ -533,60 +506,48 @@ onMounted(() => {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.key-management-wrapper { .app-container__body {
.key-management { padding: 20px 0 0 0;
padding: 20px; .pageTitle {
.title {
font-size: 18px;
color: #333;
margin-bottom: 20px;
i {
color: #409EFF;
margin-right: 8px;
}
}
.section-card {
background: #fff;
border-radius: 4px;
padding: 20px;
margin-bottom: 20px; margin-bottom: 20px;
box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1); display: flex;
align-items: center;
.section-title { font-size: 16px;
color: #409EFF; font-weight: 500;
font-size: 14px; letter-spacing: 0px;
margin-bottom: 20px; line-height: 22px;
position: relative; color: rgba(53, 64, 79, 1);
padding-left: 12px;
&:before { .icon {
content: ''; margin-right: 6px;
width: 4px; width: 16px;
height: 14px; height: 16px;
background: #409EFF;
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
} }
} }
.section-content { .section-content {
margin-bottom: 20px;
.form-item { .form-item {
display: flex; display: flex;
align-items: center; align-items: center;
:deep(.el-select__wrapper){
height: 40px;
}
.label { .label {
width: 100px; width: 100px;
margin-right: 10px; margin-right: 10px;
font-size: 14px;
color: rgba(53, 64, 79, 1);
} }
.tip { .tip {
color: #f56c6c; margin-left: 34px;
margin-left: 10px; font-size: 14px;
font-size: 12px; font-weight: 400;
letter-spacing: 0px;
line-height: 22px;
color: rgba(253, 84, 81, 1);
} }
} }
...@@ -596,12 +557,30 @@ onMounted(() => { ...@@ -596,12 +557,30 @@ onMounted(() => {
} }
} }
} }
.section-card{
flex: 1;
border-radius: 3px;
background: rgba(255, 255, 255, 1);
.line {
width: 100%;
height: 2px;
border-radius: 5px 5px 0px 0px;
background: linear-gradient(
90deg,
rgba(33, 103, 217, 1) 0%,
rgba(17, 200, 250, 1) 34.03%,
rgba(33, 103, 217, 1) 64.58%,
rgba(48, 128, 255, 1) 100%
);
}
.section-content{
padding: 48px 96px 0 96px;
}
} }
.footer { .footer {
text-align: center; text-align: center;
margin-top: 20px; margin-top: 20px;
} }
}
} }
</style> </style>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论