|
|
|
@ -2,7 +2,7 @@ |
|
|
|
|
<div> |
|
|
|
|
<el-form :model="searchForm" inline label-width="0"> |
|
|
|
|
<el-form-item> |
|
|
|
|
<el-input v-model="searchForm.name" placeholder="考场名称" /> |
|
|
|
|
<el-input v-model="searchForm.placeName" placeholder="考场名称" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item> |
|
|
|
|
<el-button type="primary" @click="handleQuery">搜 索</el-button> |
|
|
|
@ -12,27 +12,37 @@ |
|
|
|
|
|
|
|
|
|
<el-table :data="tableList" border stripe> |
|
|
|
|
<el-table-column type="index" width="50" /> |
|
|
|
|
<el-table-column prop="name" label="考点名称" min-width="200px" /> |
|
|
|
|
<el-table-column prop="username" label="负责人" width="100px" /> |
|
|
|
|
<el-table-column prop="userPhone" label="负责人电话" width="100px" /> |
|
|
|
|
<el-table-column prop="contactName" label="联系人" width="100px" /> |
|
|
|
|
<el-table-column prop="placeName" label="考点名称" min-width="200px" /> |
|
|
|
|
<el-table-column prop="leader" label="负责人" width="100px" /> |
|
|
|
|
<el-table-column prop="leaderPhone" label="负责人电话" width="100px" /> |
|
|
|
|
<el-table-column prop="contacts" label="联系人" width="100px" /> |
|
|
|
|
<el-table-column prop="contactPhone" label="联系人电话" width="100px" /> |
|
|
|
|
<el-table-column prop="address" label="地址" min-width="200px" /> |
|
|
|
|
<el-table-column label="理论" align="center"> |
|
|
|
|
<el-table-column prop="lilunTime" label="时间" width="100px" align="center"> |
|
|
|
|
<el-table-column label="时间" width="100px" align="center"> |
|
|
|
|
<template #default="{ row }"> |
|
|
|
|
{{ row.lilunTime.map((item) => `每月${item}号`).join(',') }} |
|
|
|
|
{{ |
|
|
|
|
row.theoryExamDate |
|
|
|
|
.split(',') |
|
|
|
|
.map((item) => `每月${item}号`) |
|
|
|
|
.join(',') |
|
|
|
|
}} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="lilunAddress" label="地址" min-width="200px" align="center" /> |
|
|
|
|
<el-table-column prop="theoryExamAddress" label="地址" min-width="200px" align="center" /> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="实践" align="center"> |
|
|
|
|
<el-table-column prop="shijianTime" label="时间" width="100px" align="center"> |
|
|
|
|
<el-table-column label="时间" width="100px" align="center"> |
|
|
|
|
<template #default="{ row }"> |
|
|
|
|
{{ row.shijianTime.map((item) => `每月${item}号`).join(',') }} |
|
|
|
|
{{ |
|
|
|
|
row.practiceExamDate |
|
|
|
|
.split(',') |
|
|
|
|
.map((item) => `每月${item}号`) |
|
|
|
|
.join(',') |
|
|
|
|
}} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="shijianAddress" label="地址" min-width="200px" align="center" /> |
|
|
|
|
<el-table-column prop="practiceExamAddress" label="地址" min-width="200px" align="center" /> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" fixed="right" width="150"> |
|
|
|
|
<template #default="{ row }"> |
|
|
|
@ -66,23 +76,23 @@ |
|
|
|
|
<el-form :model="form" ref="formRef" :rules="rules" label-width="100px"> |
|
|
|
|
<el-row :gutter="20"> |
|
|
|
|
<el-col :span="24" :offset="0"> |
|
|
|
|
<el-form-item label="考点名称" prop="name"> |
|
|
|
|
<el-input v-model="form.name" placeholder="请输入" /> |
|
|
|
|
<el-form-item label="考点名称" prop="placeName"> |
|
|
|
|
<el-input v-model="form.placeName" placeholder="请输入" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12" :offset="0"> |
|
|
|
|
<el-form-item label="负责人" prop="username"> |
|
|
|
|
<el-input v-model="form.username" placeholder="请输入" /> |
|
|
|
|
<el-form-item label="负责人" prop="leader"> |
|
|
|
|
<el-input v-model="form.leader" placeholder="请输入" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12" :offset="0"> |
|
|
|
|
<el-form-item label="负责人电话" prop="userPhone"> |
|
|
|
|
<el-input v-model="form.userPhone" placeholder="请输入" /> |
|
|
|
|
<el-form-item label="负责人电话" prop="leaderPhone"> |
|
|
|
|
<el-input v-model="form.leaderPhone" placeholder="请输入" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12" :offset="0"> |
|
|
|
|
<el-form-item label="联系人" prop="contactName"> |
|
|
|
|
<el-input v-model="form.contactName" placeholder="请输入" /> |
|
|
|
|
<el-form-item label="联系人" prop="contacts"> |
|
|
|
|
<el-input v-model="form.contacts" placeholder="请输入" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12" :offset="0"> |
|
|
|
@ -104,9 +114,9 @@ |
|
|
|
|
<el-divider direction="horizontal" content-position="left">理论</el-divider> |
|
|
|
|
<el-row :gutter="20"> |
|
|
|
|
<el-col :span="24" :offset="0"> |
|
|
|
|
<el-form-item label="理论地址" prop="lilunAddress"> |
|
|
|
|
<el-form-item label="理论地址" prop="theoryExamAddress"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="form.lilunAddress" |
|
|
|
|
v-model="form.theoryExamAddress" |
|
|
|
|
type="textarea" |
|
|
|
|
:autosize="{ minRows: 2 }" |
|
|
|
|
placeholder="请输入" |
|
|
|
@ -117,15 +127,15 @@ |
|
|
|
|
<el-form-item label="理论时间"> |
|
|
|
|
<el-input |
|
|
|
|
class="mr-2 mb-2" |
|
|
|
|
v-for="(item, index) in form.lilunTime" |
|
|
|
|
v-for="(item, index) in form.theoryExamDate" |
|
|
|
|
:key="index" |
|
|
|
|
v-model="form.lilunTime[index]" |
|
|
|
|
v-model="form.theoryExamDate[index]" |
|
|
|
|
style="width: 180px" |
|
|
|
|
> |
|
|
|
|
<template #prepend>每月</template> |
|
|
|
|
<template #append>日</template> |
|
|
|
|
</el-input> |
|
|
|
|
<el-button type="primary" @click="form.lilunTime.push(undefined)"> |
|
|
|
|
<el-button type="primary" @click="form.theoryExamDate.push(undefined)"> |
|
|
|
|
新增考试时间 |
|
|
|
|
</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
@ -134,9 +144,9 @@ |
|
|
|
|
<el-divider direction="horizontal" content-position="left">实践</el-divider> |
|
|
|
|
<el-row :gutter="20"> |
|
|
|
|
<el-col :span="24" :offset="0"> |
|
|
|
|
<el-form-item label="实践地址" prop="lilunAddress"> |
|
|
|
|
<el-form-item label="实践地址" prop="theoryExamAddress"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="form.shijianAddress" |
|
|
|
|
v-model="form.practiceExamAddress" |
|
|
|
|
type="textarea" |
|
|
|
|
:autosize="{ minRows: 2 }" |
|
|
|
|
placeholder="请输入" |
|
|
|
@ -147,15 +157,15 @@ |
|
|
|
|
<el-form-item label="实践时间"> |
|
|
|
|
<el-input |
|
|
|
|
class="mr-2 mb-2" |
|
|
|
|
v-for="(item, index) in form.shijianTime" |
|
|
|
|
v-for="(item, index) in form.practiceExamDate" |
|
|
|
|
:key="index" |
|
|
|
|
v-model="form.shijianTime[index]" |
|
|
|
|
v-model="form.practiceExamDate[index]" |
|
|
|
|
style="width: 180px" |
|
|
|
|
> |
|
|
|
|
<template #prepend>每月</template> |
|
|
|
|
<template #append>日</template> |
|
|
|
|
</el-input> |
|
|
|
|
<el-button type="primary" @click="form.shijianTime.push(undefined)"> |
|
|
|
|
<el-button type="primary" @click="form.practiceExamDate.push(undefined)"> |
|
|
|
|
新增考试时间 |
|
|
|
|
</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
@ -163,7 +173,7 @@ |
|
|
|
|
</el-row> |
|
|
|
|
</el-form> |
|
|
|
|
<template #footer> |
|
|
|
|
<el-button type="primary" @click="submitForm">保 存</el-button> |
|
|
|
|
<el-button type="primary" :disabled="formLoading" @click="submitForm">保 存</el-button> |
|
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button> |
|
|
|
|
</template> |
|
|
|
|
</Dialog> |
|
|
|
@ -171,10 +181,12 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script setup name="ExamVenue"> |
|
|
|
|
import * as api from '@/api/uav/testRoom' |
|
|
|
|
|
|
|
|
|
const message = useMessage() |
|
|
|
|
|
|
|
|
|
const searchForm = ref({ |
|
|
|
|
name: '', |
|
|
|
|
placeName: '', |
|
|
|
|
pageNo: 1, |
|
|
|
|
pageSize: 20 |
|
|
|
|
}) |
|
|
|
@ -192,54 +204,32 @@ function handleQuery() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getList() { |
|
|
|
|
// getStationList(searchForm.value).then((res) => { |
|
|
|
|
// console.log(res) |
|
|
|
|
// }) |
|
|
|
|
// 模拟数据 |
|
|
|
|
tableList.value = [ |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '上海01', |
|
|
|
|
address: '上海01地址', |
|
|
|
|
username: 'z张三', |
|
|
|
|
userPhone: '12345678901', |
|
|
|
|
contactName: '李四', |
|
|
|
|
contactPhone: '12345678901', |
|
|
|
|
lilunTime: [1, 10], |
|
|
|
|
shijianTime: [5, 15], |
|
|
|
|
lilunAddress: '上海01地址', |
|
|
|
|
shijianAddress: '上海01地址' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 2, |
|
|
|
|
name: '上海02', |
|
|
|
|
address: '上海02地址', |
|
|
|
|
username: 'z张三', |
|
|
|
|
userPhone: '12345678901', |
|
|
|
|
contactName: '李四', |
|
|
|
|
contactPhone: '12345678901', |
|
|
|
|
lilunTime: [2, 22], |
|
|
|
|
shijianTime: [5, 15], |
|
|
|
|
lilunAddress: '上海02地址', |
|
|
|
|
shijianAddress: '上海02地址' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
total.value = 2 |
|
|
|
|
try { |
|
|
|
|
api.searchTestroom(searchForm.value).then((res) => { |
|
|
|
|
tableList.value = res.list |
|
|
|
|
total.value = res.total |
|
|
|
|
}) |
|
|
|
|
} catch (error) { |
|
|
|
|
console.log(error) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const form = ref({}) |
|
|
|
|
const rules = { |
|
|
|
|
name: { required: true, message: '请输入名称', trigger: 'blur' }, |
|
|
|
|
username: { required: true, message: '请输入姓名', trigger: 'blur' }, |
|
|
|
|
userPhone: { required: true, message: '请输入手机号', trigger: 'blur' } |
|
|
|
|
placeName: { required: true, message: '请输入名称', trigger: 'blur' }, |
|
|
|
|
leader: { required: true, message: '请输入姓名', trigger: 'blur' }, |
|
|
|
|
leaderPhone: { required: true, message: '请输入手机号', trigger: 'blur' } |
|
|
|
|
} |
|
|
|
|
const dialogVisible = ref(false) |
|
|
|
|
const formLoading = ref(false) |
|
|
|
|
|
|
|
|
|
const handleDetail = (row) => { |
|
|
|
|
resetForm() |
|
|
|
|
dialogVisible.value = true |
|
|
|
|
if (row) { |
|
|
|
|
form.value = { ...row } |
|
|
|
|
form.value.theoryExamDate = row.theoryExamDate.split(',') |
|
|
|
|
form.value.practiceExamDate = row.practiceExamDate.split(',') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -247,16 +237,16 @@ const formRef = ref(null) |
|
|
|
|
function resetForm() { |
|
|
|
|
form.value = { |
|
|
|
|
id: undefined, |
|
|
|
|
name: '', |
|
|
|
|
username: '', |
|
|
|
|
userPhone: '', |
|
|
|
|
contactName: '', |
|
|
|
|
placeName: '', |
|
|
|
|
leader: '', |
|
|
|
|
leaderPhone: '', |
|
|
|
|
contacts: '', |
|
|
|
|
contactPhone: '', |
|
|
|
|
address: '', |
|
|
|
|
lilunAddress: '', |
|
|
|
|
lilunTime: [], |
|
|
|
|
shijianAddress: '', |
|
|
|
|
shijianTime: [] |
|
|
|
|
theoryExamAddress: '', |
|
|
|
|
theoryExamDate: [], |
|
|
|
|
practiceExamAddress: '', |
|
|
|
|
practiceExamDate: [] |
|
|
|
|
} |
|
|
|
|
formRef.value && formRef.value.resetFields() |
|
|
|
|
} |
|
|
|
@ -266,7 +256,7 @@ const handleDelete = async (row) => { |
|
|
|
|
// 删除的二次确认 |
|
|
|
|
await message.delConfirm() |
|
|
|
|
// 发起删除 |
|
|
|
|
await UserApi.deleteUser(row.id) |
|
|
|
|
await api.deleteTestroom({ id: row.placeId }) |
|
|
|
|
message.success('删除成功') |
|
|
|
|
// 刷新列表 |
|
|
|
|
getList() |
|
|
|
@ -274,9 +264,33 @@ const handleDelete = async (row) => { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const submitForm = async () => { |
|
|
|
|
if (!formRef.value) return |
|
|
|
|
const valid = await formRef.value.validate() |
|
|
|
|
if (!valid) return |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
} catch (err) { |
|
|
|
|
console.log(err) |
|
|
|
|
formLoading.value = true |
|
|
|
|
let params = { ...form.value } |
|
|
|
|
params.theoryExamDate = params.theoryExamDate.join(',') |
|
|
|
|
params.practiceExamDate = params.practiceExamDate.join(',') |
|
|
|
|
if (form.value.placeId) { |
|
|
|
|
api.updateTestroom(params).then((response) => { |
|
|
|
|
if (response) { |
|
|
|
|
message.success('修改成功') |
|
|
|
|
dialogVisible.value = false |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
api.addTestroom(params).then((response) => { |
|
|
|
|
if (response) { |
|
|
|
|
message.success('新增成功') |
|
|
|
|
dialogVisible.value = false |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} finally { |
|
|
|
|
formLoading.value = false |
|
|
|
|
getList() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|