Browse Source

增加qad访问控制功能

master
liuchen864 8 months ago
parent
commit
8ac2e7aa15
  1. 53
      src/api/base/qadAccess.js
  2. 274
      src/views/base/qadAccess/index.vue

53
src/api/base/qadAccess.js

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询qad访问控制列表
export function listQadAccess(query) {
return request({
url: '/base/qadAccess/list',
method: 'get',
params: query
})
}
// 查询qad访问控制详细
export function getQadAccess(id) {
return request({
url: '/base/qadAccess/' + id,
method: 'get'
})
}
// 新增qad访问控制
export function addQadAccess(data) {
return request({
url: '/base/qadAccess',
method: 'post',
data: data
})
}
// 修改qad访问控制
export function updateQadAccess(data) {
return request({
url: '/base/qadAccess',
method: 'put',
data: data
})
}
// 删除qad访问控制
export function delQadAccess(id) {
return request({
url: '/base/qadAccess/' + id,
method: 'delete'
})
}
// 导出qad访问控制
export function exportQadAccess(query) {
return request({
url: '/base/qadAccess/export',
method: 'get',
params: query
})
}

274
src/views/base/qadAccess/index.vue

@ -0,0 +1,274 @@
<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>
<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="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="qadAccessList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="公司编码" align="center" prop="companyCode" />
<el-table-column label="公司名称" align="center" prop="companyName" />
<el-table-column label="用户" align="center" prop="userName" />
<el-table-column label="密码" align="center" prop="password" />
<el-table-column label="域" align="center" prop="domain" />
<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"
/>
<!-- 添加或修改qad访问控制对话框 -->
<el-dialog :title="title" v-model="open" width="800px" append-to-body>
<el-form ref="qadAccessRef" :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="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="domain">
<el-input v-model="form.domain" 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="QadAccess">
import { listQadAccess, getQadAccess, delQadAccess, addQadAccess, updateQadAccess } from "@/api/base/qadAccess";
const { proxy } = getCurrentInstance();
const qadAccessList = 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,
userName: null,
password: null,
domain: null,
},
rules: {
companyCode: [
{ required: true, message: "公司编码不能为空", trigger: "blur" }
],
companyName: [
{ required: true, message: "公司名称不能为空", trigger: "blur" }
],
userName: [
{ required: true, message: "用户不能为空", trigger: "blur" }
],
password: [
{ required: true, message: "密码不能为空", trigger: "blur" }
],
domain: [
{ required: true, message: "域不能为空", trigger: "blur" }
],
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询qad访问控制列表 */
function getList() {
loading.value = true;
listQadAccess(queryParams.value).then(response => {
qadAccessList.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,
userName: null,
password: null,
domain: null,
deptId: null,
};
proxy.resetForm("qadAccessRef");
}
/** 搜索按钮操作 */
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 = "添加qad访问控制";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getQadAccess(_id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改qad访问控制";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["qadAccessRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateQadAccess(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addQadAccess(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除qad访问控制编号为"' + _ids + '"的数据项?').then(function() {
return delQadAccess(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('system/qadAccess/export', {
...queryParams.value
}, `qadAccess_${new Date().getTime()}.xlsx`)
}
getList();
</script>
Loading…
Cancel
Save