【新增】 新增试卷任务第三步添加白名单功能
This commit is contained in:
@@ -347,6 +347,33 @@
|
||||
</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>
|
||||
</div>
|
||||
@@ -360,6 +387,25 @@ 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: {
|
||||
@@ -369,7 +415,7 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
// 字段初始值设置为空或空字符串
|
||||
const form = ref({
|
||||
const form = ref<any>({
|
||||
isAnswerId: '',
|
||||
isContent: '',
|
||||
isNumber: '',
|
||||
@@ -391,7 +437,8 @@ const form = ref({
|
||||
warn: '',
|
||||
isScore: '',
|
||||
isScoreDetail: '',
|
||||
isDelete: ''
|
||||
isDelete: '',
|
||||
whiteList: [] as WhiteItem[] // 明确类型
|
||||
})
|
||||
const tableData = ref([]) // 列表的数
|
||||
const showAdd = ref(false)
|
||||
|
||||
Reference in New Issue
Block a user