Browse Source

增加访问控制增删改查

master
liuchen864 8 months ago
parent
commit
03761ed136
  1. 52
      src/api/base/encodedRule.ts
  2. 53
      src/api/base/linuxAccess.js
  3. 364
      src/views/base/linuxAccess/index.vue

52
src/api/base/encodedRule.ts

@ -1,52 +0,0 @@
import request from '@/utils/request'
// 查询编码规则列表
export function listEncodedRule(query) {
return request({
url: '/base/encodedRule/list',
method: 'get',
params: query
})
}
// 查询编码规则详细
export function getEncodedRule(id) {
return request({
url: '/base/encodedRule/' + id,
method: 'get'
})
}
// 新增编码规则
export function addEncodedRule(data) {
return request({
url: '/base/encodedRule',
method: 'post',
data: data
})
}
// 修改编码规则
export function updateEncodedRule(data) {
return request({
url: '/base/encodedRule',
method: 'put',
data: data
})
}
// 删除编码规则
export function delEncodedRule(id) {
return request({
url: '/base/encodedRule/' + id,
method: 'delete'
})
}
// 导出编码规则
export function exportEncodedRule(query) {
return request({
url: '/base/encodedRule/export',
method: 'get',
params: query
})
}

53
src/api/base/linuxAccess.js

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询访问控制列表
export function listLinuxAccess(query) {
return request({
url: '/base/linuxAccess/list',
method: 'get',
params: query
})
}
// 查询访问控制详细
export function getLinuxAccess(id) {
return request({
url: '/base/linuxAccess/' + id,
method: 'get'
})
}
// 新增访问控制
export function addLinuxAccess(data) {
return request({
url: '/base/linuxAccess',
method: 'post',
data: data
})
}
// 修改访问控制
export function updateLinuxAccess(data) {
return request({
url: '/base/linuxAccess',
method: 'put',
data: data
})
}
// 删除访问控制
export function delLinuxAccess(guid) {
return request({
url: '/base/linuxAccess/' + guid,
method: 'delete'
})
}
// 导出访问控制
export function exportLinuxAccess(query) {
return request({
url: '/base/linuxAccess/export',
method: 'get',
params: query
})
}

364
src/views/base/linuxAccess/index.vue

@ -0,0 +1,364 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="公司编码" prop="companyCode">
<el-input
v-model="queryParams.companyCode"
placeholder="请输入"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="公司名称" prop="companyName">
<el-input
v-model="queryParams.companyName"
placeholder="请输入"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="uri" prop="uri">
<el-input
v-model="queryParams.uri"
placeholder="请输入"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
icon="Plus"
@click="handleAdd"
>新增</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="success"
icon="Edit"
@click="handleUpdate"
>修改</el-button>
</el-col> -->
<el-col :span="1.5">
<el-button
type="success"
icon="Delete"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="Download"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="linuxAccessList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="公司编码" width="100" align="center" prop="companyCode" />
<el-table-column label="公司名称" width="150" align="center" prop="companyName" />
<el-table-column label="服务器编码" width="150" align="center" prop="serverCode" />
<el-table-column label="ip地址" width="150" align="center" prop="ipAddress" />
<el-table-column label="端口" width="150" align="center" prop="port" />
<el-table-column label="用户" width="150" align="center" prop="userName" />
<el-table-column label="密码" width="150" align="center" prop="password" />
<el-table-column label="工作目录" width="180" align="center" prop="workPath" />
<el-table-column label="输入目录" width="180" align="center" prop="inPath" />
<el-table-column label="输出目录" width="180" align="center" prop="outPath" />
<el-table-column label="处理成功目录" width="210" align="center" prop="successPath" />
<el-table-column label="处理错误目录" width="180" align="center" prop="errorPath" />
<el-table-column label="存档目录" width="180" align="center" prop="archivePath" />
<el-table-column label="uri" width="210" align="center" prop="uri" />
<el-table-column label="qad程序编码" width="180" align="center" prop="qadProgramCode" />
<el-table-column label="脚本路径" width="180" align="center" prop="scriptPath" />
<el-table-column label="程序名" width="150" align="center" prop="scriptName" />
<el-table-column label="程序" width="120" align="center" prop="scriptProgram" />
<el-table-column label="操作" width="150" align="center" class-name="small-padding fixed-width" fixed="right">
<template #default="scope">
<el-button
type="text"
icon="Edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
type="text"
icon="Delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改访问控制对话框 -->
<el-dialog :title="title" v-model="open" width="800px" append-to-body>
<el-form ref="linuxAccessRef" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="公司编码" prop="companyCode">
<el-input v-model="form.companyCode" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="公司名称" prop="companyName">
<el-input v-model="form.companyName" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="服务器编码" prop="serverCode">
<el-input v-model="form.serverCode" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="ip地址" prop="ipAddress">
<el-input v-model="form.ipAddress" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="端口" prop="port">
<el-input v-model="form.port" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用户" prop="userName">
<el-input v-model="form.userName" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="密码" prop="password">
<el-input v-model="form.password" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工作目录" prop="workPath">
<el-input v-model="form.workPath" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="输入目录" prop="inPath">
<el-input v-model="form.inPath" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="输出目录" prop="outPath">
<el-input v-model="form.outPath" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="处理成功目录" prop="successPath">
<el-input v-model="form.successPath" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="errorPath" prop="errorPath">
<el-input v-model="form.errorPath" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="archivePath" prop="archivePath">
<el-input v-model="form.archivePath" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="uri" prop="uri">
<el-input v-model="form.uri" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="qad程序编码" prop="qadProgramCode">
<el-input v-model="form.uri" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="脚本路径" prop="scriptPath">
<el-input v-model="form.scriptPath" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="程序名" prop="scriptName">
<el-input v-model="form.scriptName" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="程序" prop="scriptProgram">
<el-input v-model="form.scriptProgram" placeholder="请输入" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="LinuxAccess">
import { listLinuxAccess, getLinuxAccess, delLinuxAccess, addLinuxAccess, updateLinuxAccess } from "@/api/base/linuxAccess";
const { proxy } = getCurrentInstance();
const linuxAccessList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
companyCode: null,
companyName: null,
uri: null,
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询访问控制列表 */
function getList() {
loading.value = true;
listLinuxAccess(queryParams.value).then(response => {
linuxAccessList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
form.value = {
id: null,
companyCode: null,
companyName: null,
serverCode: null,
ipAddress: null,
port: null,
userName: null,
password: null,
workPath: null,
inPath: null,
outPath: null,
successPath: null,
errorPath: null,
archivePath: null,
userId: null,
uri: null,
qadProgramCode: null,
scriptPath: null,
scriptName: null,
scriptProgram: null,
};
proxy.resetForm("linuxAccessRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加访问控制";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getLinuxAccess(_id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改访问控制";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["linuxAccessRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateLinuxAccess(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addLinuxAccess(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除访问控制编号为"' + _ids + '"的数据项?').then(function() {
return delLinuxAccess(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('system/linuxAccess/export', {
...queryParams.value
}, `linuxAccess_${new Date().getTime()}.xlsx`)
}
getList();
</script>
Loading…
Cancel
Save