白名单配置
This commit is contained in:
parent
0b483b2c7f
commit
4c6f3ecf81
|
|
@ -0,0 +1,37 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 新增白名单
|
||||
export function addWhiteAPI(data) {
|
||||
return request({
|
||||
url: '/smartArchives/whitelist/add',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 修改白名单
|
||||
export function updateWhiteAPI(data) {
|
||||
return request({
|
||||
url: '/smartArchives/whitelist/edit',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 删除白名单
|
||||
export function deleteWhiteAPI(data) {
|
||||
return request({
|
||||
url: '/smartArchives/whitelist/data',
|
||||
method: 'POST',
|
||||
// data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 白名单列表
|
||||
export function getWhiteListAPI(data) {
|
||||
return request({
|
||||
url: '/smartArchives/whitelist/list',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
|
@ -95,6 +95,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item v-if="showBtnCrews">
|
||||
<el-button
|
||||
v-if="showQueryButtons"
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
|
|
@ -103,6 +104,7 @@
|
|||
查询
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="showQueryButtons"
|
||||
plain
|
||||
size="mini"
|
||||
type="warning"
|
||||
|
|
@ -234,6 +236,11 @@ export default {
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
// 是否显示查询/重置按钮(不影响插槽按钮) 默认显示
|
||||
showQueryButtons: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
// 级联选择
|
||||
cascadeFunc: {
|
||||
type: Function,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ export const formLabel = [
|
|||
f_type: 'ipt',
|
||||
f_label: '数据类型名称',
|
||||
f_model: 'dataTypeName',
|
||||
f_max: 32,
|
||||
},
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ export const formLabel = [
|
|||
f_type: 'ipt',
|
||||
f_label: '数据加密名称',
|
||||
f_model: 'encryptName',
|
||||
f_max: 20,
|
||||
},
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
export const formLabel = [
|
||||
/* {
|
||||
isShow: false, // 是否展示label
|
||||
f_type: 'ipt',
|
||||
f_label: '数据加密名称',
|
||||
f_model: 'encryptName',
|
||||
f_max: 20,
|
||||
}, */
|
||||
]
|
||||
|
||||
export const columnsList = [
|
||||
{ t_props: 'ipAddress', t_label: '单个IP地址' },
|
||||
{ t_props: 'ipRangeStart', t_label: 'IP网段起始地址' },
|
||||
{ t_props: 'ipRangeEnd', t_label: 'IP网段结束地址' },
|
||||
{ t_props: 'accessStartTime', t_label: '允许访问的开始时间' },
|
||||
{ t_props: 'accessEndTime', t_label: '允许访问的结束时间' },
|
||||
{ t_props: 'updatedAt', t_label: '更新时间' }
|
||||
]
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
<template>
|
||||
<!-- 白名单配置 -->
|
||||
<div class="app-container">
|
||||
<TableModel :formLabel="formLabel" :showQueryButtons="false" :showOperation="true" :showRightTools="true" ref="whiteTableRef"
|
||||
:columnsList="columnsList" :request-api="getWhiteListAPI">
|
||||
<template slot="btn">
|
||||
<el-button plain size="mini" type="primary" icon="el-icon-plus" v-hasPermi="['system:whitelist:add']"
|
||||
@click="handleAdd">
|
||||
新增
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<template slot="handle" slot-scope="{ data }">
|
||||
<el-button plain size="mini" type="primary" icon="el-icon-edit" v-hasPermi="['system:whitelist:edit']"
|
||||
@click="handleUpdate(data)">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button plain size="mini" type="danger" icon="el-icon-delete" v-hasPermi="['system:whitelist:remove']"
|
||||
@click="handleDelete(data)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</TableModel>
|
||||
<!-- 新增/编辑 -->
|
||||
<WhiteForm v-if="isflag" :isAdd="isAdd" :rowData="row" @handleQuery="handleQuery" :title="title"
|
||||
@closeDialog="closeDialog" @showColose="showColose" :dataForm="row" :disabled="loading" :width="600" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TableModel from '@/components/TableModel'
|
||||
import { columnsList, formLabel } from './config'
|
||||
import {
|
||||
deleteWhiteAPI,
|
||||
getWhiteListAPI,
|
||||
} from '@/api/system/white'
|
||||
import WhiteForm from './prop/whiteForm'
|
||||
|
||||
|
||||
export default {
|
||||
name: 'White',
|
||||
components: {
|
||||
TableModel,
|
||||
WhiteForm
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formLabel,
|
||||
columnsList,
|
||||
getWhiteListAPI,
|
||||
title: "",
|
||||
isflag: false,
|
||||
isAdd: '',
|
||||
row: {},
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.title = "新增";
|
||||
this.isAdd = 'add';
|
||||
this.isflag = true;
|
||||
},
|
||||
closeDialog() {
|
||||
this.isflag = false;
|
||||
},
|
||||
showColose() {
|
||||
this.isflag = false;
|
||||
},
|
||||
/** 修改操作 */
|
||||
handleUpdate(row) {
|
||||
this.title = "修改";
|
||||
this.isAdd = 'edit';
|
||||
this.row = row;
|
||||
this.isflag = true;
|
||||
},
|
||||
/* 搜索操作 */
|
||||
handleQuery() {
|
||||
this.$refs.whiteTableRef.getTableList()
|
||||
},
|
||||
/** 删除操作 */
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm(`是否确认删除数据类型名称为"${row.dataTypeName}"的数据项?`).then(() => {
|
||||
// 显示加载遮罩
|
||||
this.$modal.loading("正在删除,请稍候...");
|
||||
deleteWhiteAPI([row.id]).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
if (res.code === 200) {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.handleQuery();
|
||||
} else {
|
||||
this.$modal.msgError(res.msg);
|
||||
}
|
||||
}).catch(error => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgError("删除失败,请重试");
|
||||
console.error('删除失败:', error);
|
||||
});
|
||||
}).catch(() => {
|
||||
// 用户取消删除,不需要处理
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,196 @@
|
|||
<template>
|
||||
<!-- 小型弹窗,用于完成,删除,保存等操作 -->
|
||||
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
|
||||
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
|
||||
<div>
|
||||
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="110px">
|
||||
<el-form-item label="档案加密名称" prop="encryptName">
|
||||
<el-input class="form-item" v-model="form.encryptName" clearable show-word-limit
|
||||
placeholder="请输入档案加密名称" maxlength="20"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="档案加密类型" prop="encryptType" style="width: 100%;">
|
||||
<el-select class="form-item" v-model="form.encryptType" filterable clearable
|
||||
placeholder="请选择档案加密类型">
|
||||
<el-option v-for="item in dict.type.file_encryption_type" :key="item.value" :label="item.label"
|
||||
:value="item.label"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="档案加密参数" prop="encryptParams">
|
||||
<el-input class="form-item" v-model="form.encryptParams" clearable show-word-limit
|
||||
placeholder="请输入档案加密参数" maxlength="32"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button class="clear-btn" @click="handleClose" :disabled="disabled">取消</el-button>
|
||||
<el-button type="primary" class="search-btn" :disabled="disabled"
|
||||
@click="submitForm('ruleForm')">确认</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import _ from 'lodash'
|
||||
import {
|
||||
addWhiteAPI,
|
||||
updateWhiteAPI,
|
||||
} from '@/api/system/white'
|
||||
export default {
|
||||
name: "WhiteForm",
|
||||
dicts: ['file_encryption_type'],
|
||||
props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData"],
|
||||
data() {
|
||||
return {
|
||||
lDialog: this.width > 500 ? "w700" : "w500",
|
||||
dialogVisible: true,
|
||||
isDisabled: true,
|
||||
form: {
|
||||
encryptName: '',
|
||||
encryptType: null,
|
||||
encryptParams: '',
|
||||
},
|
||||
loading: null,
|
||||
rules: {
|
||||
encryptName: [
|
||||
{ required: true, message: '档案加密名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
encryptType: [
|
||||
{ required: true, message: '档案加密类型不能为空', trigger: 'change' }
|
||||
],
|
||||
encryptParams: [
|
||||
{ required: true, message: '档案加密参数不能为空', trigger: 'blur' }
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.initFormData();
|
||||
},
|
||||
methods: {
|
||||
/** 初始化表单数据 */
|
||||
initFormData() {
|
||||
if (this.isAdd === 'edit' && this.rowData) {
|
||||
// 编辑模式:填充表单数据
|
||||
this.form = {
|
||||
id: this.rowData.id,
|
||||
encryptName: this.rowData.encryptName || '',
|
||||
encryptType: this.rowData.encryptType || null,
|
||||
encryptParams: this.rowData.encryptParams || '',
|
||||
};
|
||||
} else {
|
||||
// 新增模式:重置表单
|
||||
this.form = {
|
||||
encryptName: '',
|
||||
encryptType: null,
|
||||
encryptParams: '',
|
||||
};
|
||||
}
|
||||
},
|
||||
/*关闭弹窗 */
|
||||
handleClose() {
|
||||
this.dialogVisible = false;
|
||||
this.$emit("closeDialog");
|
||||
setTimeout(() => {
|
||||
this.dialogVisible = true;
|
||||
});
|
||||
},
|
||||
/**确认弹窗 */
|
||||
sureBtnClick() {
|
||||
this.dialogVisible = false;
|
||||
this.$emit("closeDialog");
|
||||
setTimeout(() => {
|
||||
this.dialogVisible = true;
|
||||
});
|
||||
},
|
||||
/**重置表单*/
|
||||
reset() {
|
||||
this.form = {
|
||||
encryptName: '',
|
||||
encryptType: null,
|
||||
encryptParams: '',
|
||||
};
|
||||
this.resetForm("ruleForm");
|
||||
},
|
||||
handleReuslt(res) {
|
||||
this.$modal.msgSuccess(res.msg);
|
||||
this.reset();
|
||||
this.$emit('handleQuery');
|
||||
this.handleClose();
|
||||
},
|
||||
/**验证 */
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate(valid => {
|
||||
if (valid) {
|
||||
// 显示遮罩层
|
||||
this.loading = this.$loading({
|
||||
lock: true,
|
||||
text: "数据提交中,请稍候...",
|
||||
background: 'rgba(0,0,0,0.5)',
|
||||
target: this.$el.querySelector('.el-dialog') || document.body
|
||||
})
|
||||
let params = _.cloneDeep(this.form);
|
||||
if (this.isAdd === 'add') {
|
||||
addWhiteAPI(params).then(res => {
|
||||
this.loading.close();
|
||||
if (res.code === 200) {
|
||||
this.handleReuslt(res);
|
||||
} else {
|
||||
this.$modal.msgError(res.msg);
|
||||
}
|
||||
}).catch(error => {
|
||||
this.loading.close();
|
||||
// this.$modal.msgError('提交失败,请重试');
|
||||
});
|
||||
} else {
|
||||
updateWhiteAPI(params).then(res => {
|
||||
this.loading.close();
|
||||
if (res.code === 200) {
|
||||
this.handleReuslt(res);
|
||||
} else {
|
||||
this.$modal.msgError(res.msg);
|
||||
}
|
||||
}).catch(error => {
|
||||
this.loading.close();
|
||||
// this.$modal.msgError('提交失败,请重试');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.w700 .el-dialog {
|
||||
width: 700px;
|
||||
}
|
||||
|
||||
.w500 .el-dialog {
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
.w500 .el-dialog__header,
|
||||
.w700 .el-dialog__header {
|
||||
// background: #eeeeee;
|
||||
|
||||
.el-dialog__title {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.yxq .el-range-separator {
|
||||
margin-right: 7px !important;
|
||||
}
|
||||
|
||||
.el-date-editor--daterange.el-input__inner {
|
||||
width: 260px;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.select-style {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue