Compare commits
3 Commits
5d3ea6728a
...
master
Author | SHA1 | Date | |
---|---|---|---|
e1219008cc | |||
![]() |
e225586dbc | ||
73f11746ca |
30
src/api/system/whiteList/index.ts
Normal file
30
src/api/system/whiteList/index.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import request from '@/config/axios'
|
||||
export interface WhiteVO {
|
||||
name: string
|
||||
|
||||
}
|
||||
|
||||
// 获取白名单列表
|
||||
export const getAppWhiteListCenter = (params:WhiteVO) => {
|
||||
return request.get({ url: '/exam/white/getAppWhiteListCenter',params })
|
||||
}
|
||||
|
||||
// 新增
|
||||
export const addAppWhite = (data) => {
|
||||
return request.post({ url: '/exam/white/addAppWhite', data })
|
||||
}
|
||||
|
||||
// 修改
|
||||
export const updateAppWhite = (data) => {
|
||||
return request.put({ url: '/exam/white/updateAppWhite', data })
|
||||
}
|
||||
|
||||
// 删除
|
||||
export const delWhite = (id) => {
|
||||
return request.delete({ url: `/exam/white/delWhite/${id}` })
|
||||
}
|
||||
|
||||
// 获取详情
|
||||
export const getWhite = (id) => {
|
||||
return request.get({ url: '/exam/white/getWhite', params: { id } })
|
||||
}
|
@@ -110,7 +110,6 @@
|
||||
<el-table-column :width="300" align="center" label="操作">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-hasPermi="['system:role:update']"
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
@@ -118,7 +117,6 @@
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['system:permission:assign-role-menu']"
|
||||
link
|
||||
preIcon="ep:basketball"
|
||||
title="菜单权限"
|
||||
@@ -138,7 +136,6 @@
|
||||
数据权限
|
||||
</el-button> -->
|
||||
<el-button
|
||||
v-hasPermi="['system:role:delete']"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
|
@@ -100,7 +100,7 @@
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="学校用户编号" align="center" prop="id" />
|
||||
<el-table-column label="学校用户名" align="center" prop="name" />
|
||||
<el-table-column label="学校名称" align="center" prop="name" />
|
||||
<el-table-column label="学校用户权限" align="center" prop="packageId">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.packageId === 0" type="danger">中心服务器</el-tag>
|
||||
|
125
src/views/system/white/index.vue
Normal file
125
src/views/system/white/index.vue
Normal file
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索栏 -->
|
||||
<el-form :inline="true" :model="queryParams" class="mb-4">
|
||||
<el-form-item label="名称"> <el-input v-model="queryParams.name" placeholder="请输入白名单名称" clearable class="!w-240px" @keyup.enter="getList" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getList">
|
||||
<Icon icon="ep:search" /> 搜索
|
||||
</el-button>
|
||||
<el-button @click="resetQuery">
|
||||
<Icon icon="ep:refresh" /> 重置
|
||||
</el-button>
|
||||
<el-button type="success" plain @click="openForm('create')">
|
||||
<Icon icon="ep:plus" />
|
||||
新增 </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 表格区域 -->
|
||||
<el-table :data="list" v-loading="loading" border stripe>
|
||||
<el-table-column prop="id" label="ID" align="center" width="80" />
|
||||
<el-table-column prop="name" label="名称" align="center" />
|
||||
<el-table-column label="操作" align="center" width="180">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link @click="openForm('update', scope.row.id)">
|
||||
<Icon icon="ep:edit" /> 修改
|
||||
</el-button>
|
||||
<el-button type="danger" link @click="handleDelete(scope.row.id)">
|
||||
<Icon icon="ep:delete" /> 删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 新增/修改弹窗 -->
|
||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="500px">
|
||||
<el-form ref="formRef" :model="form" label-width="80px">
|
||||
<el-form-item label="名称" prop="name" required>
|
||||
<el-input v-model="form.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
</ContentWrap> </template> <script lang="ts" setup> import { ref, reactive } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import * as WhiteApi from '@/api/system/whiteList'
|
||||
// 你可以把 API 封装在这个文件里 // 数据
|
||||
const loading = ref(false)
|
||||
const list = ref([])
|
||||
const total = ref(0)
|
||||
const queryParams = reactive({ pageNo: 1, pageSize: 10, name: '' })
|
||||
// 弹窗相关
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formRef = ref()
|
||||
const form = reactive({ id: '', name: '', path: '', remark: '' })
|
||||
// 获取列表
|
||||
const getList = async () => { loading.value = true
|
||||
const params = {
|
||||
...queryParams,
|
||||
|
||||
}
|
||||
try { const res = await WhiteApi.getAppWhiteListCenter(params)
|
||||
list.value = res.list
|
||||
total.value = res.total
|
||||
|
||||
} finally
|
||||
{
|
||||
loading.value = false
|
||||
} }
|
||||
// 重置
|
||||
const resetQuery = () => {
|
||||
queryParams.name = ''
|
||||
getList()
|
||||
}
|
||||
// 打开弹窗
|
||||
const openForm = async (type: string, id?: string) => {
|
||||
dialogVisible.value = true
|
||||
if (type === 'create') {
|
||||
dialogTitle.value = '新增白名单'
|
||||
Object.assign(form, { id: '', name: '', path: '', remark: '' })
|
||||
} else {
|
||||
dialogTitle.value = '修改白名单'
|
||||
const data = await WhiteApi.getWhite(id)
|
||||
Object.assign(form, data) }
|
||||
} // 提交
|
||||
const submitForm = async () => {
|
||||
if (!form.name) {
|
||||
ElMessage.warning('请输入名称')
|
||||
return
|
||||
}
|
||||
if (form.id) {
|
||||
await WhiteApi.updateAppWhite(form)
|
||||
ElMessage.success('修改成功')
|
||||
} else {
|
||||
await WhiteApi.addAppWhite(form)
|
||||
ElMessage.success('新增成功')
|
||||
}
|
||||
dialogVisible.value = false
|
||||
getList()
|
||||
}
|
||||
// 删除
|
||||
const handleDelete = async (id: string) => {
|
||||
ElMessageBox.confirm('确认删除该白名单?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
await WhiteApi.delWhite(id)
|
||||
ElMessage.success('删除成功')
|
||||
getList() }) }
|
||||
// 初始化
|
||||
getList()
|
||||
</script>
|
@@ -346,27 +346,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- ✅ 软件白名单 -->
|
||||
<div style="margin-top: 20px" >
|
||||
<h4>软件白名单</h4>
|
||||
<el-input
|
||||
v-model="newWhiteItem"
|
||||
placeholder="请输入允许的软件名称"
|
||||
style="width: 300px; margin-right: 10px"
|
||||
/>
|
||||
<el-button type="success" @click="addWhiteItem" class="block" @blur.capture="handleFormChange">添加</el-button>
|
||||
|
||||
<el-table :data="form.whiteList" style="width: 100%; margin-top: 10px">
|
||||
<el-table-column prop="name" label="软件名称" align="center" />
|
||||
<el-table-column label="操作" align="center" width="100px">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link @click="removeWhiteItem(scope.row)">
|
||||
<Icon icon="ep:delete" />删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -381,25 +360,6 @@ import { CommonStatusEnum } from '@/utils/constants'
|
||||
import AppAdd from './components/app-add.vue'
|
||||
import * as AppApi from '@/api/exam/app'
|
||||
import { time } from 'console'
|
||||
// 白名单数据
|
||||
interface WhiteItem {
|
||||
name: string;
|
||||
}
|
||||
const newWhiteItem = ref('')
|
||||
|
||||
const addWhiteItem = () => {
|
||||
const name = newWhiteItem.value.trim()
|
||||
if (!name) return
|
||||
if (form.value.whiteList.some(item => item.name === name)) return // 防止重复
|
||||
form.value.whiteList.push({ name })
|
||||
newWhiteItem.value = ''
|
||||
handleFormChange();
|
||||
}
|
||||
|
||||
const removeWhiteItem = (row) => {
|
||||
form.value.whiteList = form.value.whiteList.filter(item => item.name !== row.name)
|
||||
handleFormChange();
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
taskId: {
|
||||
@@ -431,8 +391,7 @@ const form = ref({
|
||||
warn: '',
|
||||
isScore: '',
|
||||
isScoreDetail: '',
|
||||
isDelete: '',
|
||||
whiteList: [] as WhiteItem[], // 明确类型
|
||||
isDelete: ''
|
||||
})
|
||||
const tableData = ref([]) // 列表的数
|
||||
const showAdd = ref(false)
|
||||
|
@@ -346,27 +346,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- ✅ 软件白名单 -->
|
||||
<div style="margin-top: 20px" >
|
||||
<h4>软件白名单</h4>
|
||||
<el-input
|
||||
v-model="newWhiteItem"
|
||||
placeholder="请输入允许的软件名称"
|
||||
style="width: 300px; margin-right: 10px"
|
||||
/>
|
||||
<el-button type="success" @click="addWhiteItem" class="block" @blur.capture="handleFormChange">添加</el-button>
|
||||
|
||||
<el-table :data="form.whiteList" style="width: 100%; margin-top: 10px">
|
||||
<el-table-column prop="name" label="软件名称" align="center" />
|
||||
<el-table-column label="操作" align="center" width="100px">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link @click="removeWhiteItem(scope.row)">
|
||||
<Icon icon="ep:delete" />删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -381,25 +360,7 @@ import { CommonStatusEnum } from '@/utils/constants'
|
||||
import AppAdd from './components/app-add.vue'
|
||||
import * as AppApi from '@/api/exam/app'
|
||||
import { time } from 'console'
|
||||
// 白名单数据
|
||||
interface WhiteItem {
|
||||
name: string;
|
||||
}
|
||||
const newWhiteItem = ref('')
|
||||
|
||||
const addWhiteItem = () => {
|
||||
const name = newWhiteItem.value.trim()
|
||||
if (!name) return
|
||||
if (form.value.whiteList.some(item => item.name === name)) return // 防止重复
|
||||
form.value.whiteList.push({ name })
|
||||
newWhiteItem.value = ''
|
||||
handleFormChange();
|
||||
}
|
||||
|
||||
const removeWhiteItem = (row) => {
|
||||
form.value.whiteList = form.value.whiteList.filter(item => item.name !== row.name)
|
||||
handleFormChange();
|
||||
}
|
||||
const props = defineProps({
|
||||
taskId: {
|
||||
type: String,
|
||||
@@ -430,8 +391,7 @@ const form = ref({
|
||||
warn: '',
|
||||
isScore: '',
|
||||
isScoreDetail: '',
|
||||
isDelete: '',
|
||||
whiteList: [] as WhiteItem[], // 明确类型
|
||||
isDelete: ''
|
||||
})
|
||||
const tableData = ref([]) // 列表的数
|
||||
const showAdd = ref(false)
|
||||
|
@@ -346,27 +346,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- ✅ 软件白名单 -->
|
||||
<div style="margin-top: 20px" >
|
||||
<h4>软件白名单</h4>
|
||||
<el-input
|
||||
v-model="newWhiteItem"
|
||||
placeholder="请输入允许的软件名称"
|
||||
style="width: 300px; margin-right: 10px"
|
||||
/>
|
||||
<el-button type="success" @click="addWhiteItem" class="block" @blur.capture="handleFormChange">添加</el-button>
|
||||
|
||||
<el-table :data="form.whiteList" style="width: 100%; margin-top: 10px">
|
||||
<el-table-column prop="name" label="软件名称" align="center" />
|
||||
<el-table-column label="操作" align="center" width="100px">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link @click="removeWhiteItem(scope.row)">
|
||||
<Icon icon="ep:delete" />删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -381,25 +360,7 @@ import { CommonStatusEnum } from '@/utils/constants'
|
||||
import AppAdd from './components/app-add.vue'
|
||||
import * as AppApi from '@/api/exam/app'
|
||||
import { time } from 'console'
|
||||
// 白名单数据
|
||||
interface WhiteItem {
|
||||
name: string;
|
||||
}
|
||||
const newWhiteItem = ref('')
|
||||
|
||||
const addWhiteItem = () => {
|
||||
const name = newWhiteItem.value.trim()
|
||||
if (!name) return
|
||||
if (form.value.whiteList.some(item => item.name === name)) return // 防止重复
|
||||
form.value.whiteList.push({ name })
|
||||
newWhiteItem.value = ''
|
||||
handleFormChange();
|
||||
}
|
||||
|
||||
const removeWhiteItem = (row) => {
|
||||
form.value.whiteList = form.value.whiteList.filter(item => item.name !== row.name)
|
||||
handleFormChange();
|
||||
}
|
||||
const props = defineProps({
|
||||
taskId: {
|
||||
type: String,
|
||||
@@ -430,8 +391,7 @@ const form = ref({
|
||||
warn: '',
|
||||
isScore: '',
|
||||
isScoreDetail: '',
|
||||
isDelete: '',
|
||||
whiteList: [] as WhiteItem[], // 明确类型
|
||||
isDelete: ''
|
||||
})
|
||||
const tableData = ref([]) // 列表的数
|
||||
const showAdd = ref(false)
|
||||
|
@@ -346,27 +346,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- ✅ 软件白名单 -->
|
||||
<div style="margin-top: 20px" >
|
||||
<h4>软件白名单</h4>
|
||||
<el-input
|
||||
v-model="newWhiteItem"
|
||||
placeholder="请输入允许的软件名称"
|
||||
style="width: 300px; margin-right: 10px"
|
||||
/>
|
||||
<el-button type="success" @click="addWhiteItem" class="block" @blur.capture="handleFormChange">添加</el-button>
|
||||
|
||||
<el-table :data="form.whiteList" style="width: 100%; margin-top: 10px">
|
||||
<el-table-column prop="name" label="软件名称" align="center" />
|
||||
<el-table-column label="操作" align="center" width="100px">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link @click="removeWhiteItem(scope.row)">
|
||||
<Icon icon="ep:delete" />删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -381,25 +360,7 @@ import { CommonStatusEnum } from '@/utils/constants'
|
||||
import AppAdd from './components/app-add.vue'
|
||||
import * as AppApi from '@/api/exam/app'
|
||||
import { time } from 'console'
|
||||
// 白名单数据
|
||||
interface WhiteItem {
|
||||
name: string;
|
||||
}
|
||||
const newWhiteItem = ref('')
|
||||
|
||||
const addWhiteItem = () => {
|
||||
const name = newWhiteItem.value.trim()
|
||||
if (!name) return
|
||||
if (form.value.whiteList.some(item => item.name === name)) return // 防止重复
|
||||
form.value.whiteList.push({ name })
|
||||
newWhiteItem.value = ''
|
||||
handleFormChange();
|
||||
}
|
||||
|
||||
const removeWhiteItem = (row) => {
|
||||
form.value.whiteList = form.value.whiteList.filter(item => item.name !== row.name)
|
||||
handleFormChange();
|
||||
}
|
||||
const props = defineProps({
|
||||
taskId: {
|
||||
type: String,
|
||||
@@ -430,8 +391,7 @@ const form = ref({
|
||||
warn: '',
|
||||
isScore: '',
|
||||
isScoreDetail: '',
|
||||
isDelete: '',
|
||||
whiteList: [] as WhiteItem[], // 明确类型
|
||||
isDelete: ''
|
||||
})
|
||||
const tableData = ref([]) // 列表的数
|
||||
const showAdd = ref(false)
|
||||
|
@@ -346,27 +346,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- ✅ 软件白名单 -->
|
||||
<div style="margin-top: 20px" >
|
||||
<h4>软件白名单</h4>
|
||||
<el-input
|
||||
v-model="newWhiteItem"
|
||||
placeholder="请输入允许的软件名称"
|
||||
style="width: 300px; margin-right: 10px"
|
||||
/>
|
||||
<el-button type="success" @click="addWhiteItem" class="block" @blur.capture="handleFormChange">添加</el-button>
|
||||
|
||||
<el-table :data="form.whiteList" style="width: 100%; margin-top: 10px">
|
||||
<el-table-column prop="name" label="软件名称" align="center" />
|
||||
<el-table-column label="操作" align="center" width="100px">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link @click="removeWhiteItem(scope.row)">
|
||||
<Icon icon="ep:delete" />删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -381,25 +360,7 @@ import { CommonStatusEnum } from '@/utils/constants'
|
||||
import AppAdd from './components/app-add.vue'
|
||||
import * as AppApi from '@/api/exam/app'
|
||||
import { time } from 'console'
|
||||
// 白名单数据
|
||||
interface WhiteItem {
|
||||
name: string;
|
||||
}
|
||||
const newWhiteItem = ref('')
|
||||
|
||||
const addWhiteItem = () => {
|
||||
const name = newWhiteItem.value.trim()
|
||||
if (!name) return
|
||||
if (form.value.whiteList.some(item => item.name === name)) return // 防止重复
|
||||
form.value.whiteList.push({ name })
|
||||
newWhiteItem.value = ''
|
||||
handleFormChange();
|
||||
}
|
||||
|
||||
const removeWhiteItem = (row) => {
|
||||
form.value.whiteList = form.value.whiteList.filter(item => item.name !== row.name)
|
||||
handleFormChange();
|
||||
}
|
||||
const props = defineProps({
|
||||
taskId: {
|
||||
type: String,
|
||||
@@ -430,8 +391,7 @@ const form = ref({
|
||||
warn: '',
|
||||
isScore: '',
|
||||
isScoreDetail: '',
|
||||
isDelete: '',
|
||||
whiteList: [] as WhiteItem[], // 明确类型
|
||||
isDelete: ''
|
||||
})
|
||||
const tableData = ref([]) // 列表的数
|
||||
const showAdd = ref(false)
|
||||
|
@@ -346,27 +346,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- ✅ 软件白名单 -->
|
||||
<div style="margin-top: 20px" >
|
||||
<h4>软件白名单</h4>
|
||||
<el-input
|
||||
v-model="newWhiteItem"
|
||||
placeholder="请输入允许的软件名称"
|
||||
style="width: 300px; margin-right: 10px"
|
||||
/>
|
||||
<el-button type="success" @click="addWhiteItem" class="block" @blur.capture="handleFormChange">添加</el-button>
|
||||
|
||||
<el-table :data="form.whiteList" style="width: 100%; margin-top: 10px">
|
||||
<el-table-column prop="name" label="软件名称" align="center" />
|
||||
<el-table-column label="操作" align="center" width="100px">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link @click="removeWhiteItem(scope.row)">
|
||||
<Icon icon="ep:delete" />删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -381,25 +360,6 @@ import { CommonStatusEnum } from '@/utils/constants'
|
||||
import AppAdd from './components/app-add.vue'
|
||||
import * as AppApi from '@/api/exam/app'
|
||||
import { time } from 'console'
|
||||
// 白名单数据
|
||||
interface WhiteItem {
|
||||
name: string;
|
||||
}
|
||||
const newWhiteItem = ref('')
|
||||
|
||||
const addWhiteItem = () => {
|
||||
const name = newWhiteItem.value.trim()
|
||||
if (!name) return
|
||||
if (form.value.whiteList.some(item => item.name === name)) return // 防止重复
|
||||
form.value.whiteList.push({ name })
|
||||
newWhiteItem.value = ''
|
||||
handleFormChange();
|
||||
}
|
||||
|
||||
const removeWhiteItem = (row) => {
|
||||
form.value.whiteList = form.value.whiteList.filter(item => item.name !== row.name)
|
||||
handleFormChange();
|
||||
}
|
||||
const props = defineProps({
|
||||
taskId: {
|
||||
type: String,
|
||||
@@ -430,8 +390,7 @@ const form = ref({
|
||||
warn: '',
|
||||
isScore: '',
|
||||
isScoreDetail: '',
|
||||
isDelete: '',
|
||||
whiteList: [] as WhiteItem[], // 明确类型
|
||||
isDelete: ''
|
||||
})
|
||||
const tableData = ref([]) // 列表的数
|
||||
const showAdd = ref(false)
|
||||
|
Reference in New Issue
Block a user