From 2088fc58f63e6d72e48ae3fd5da5fa27d12bc0a5 Mon Sep 17 00:00:00 2001 From: luohairen <3399054449@qq.com> Date: 星期五, 01 十一月 2024 13:59:30 +0800 Subject: [PATCH] 优化手机号、座机号验证 --- src/views/exam/paper/list.vue | 114 +++++++++++++++++++++++++++------------------------------ 1 files changed, 54 insertions(+), 60 deletions(-) diff --git a/src/views/exam/paper/list.vue b/src/views/exam/paper/list.vue index bc8a314..d98981f 100644 --- a/src/views/exam/paper/list.vue +++ b/src/views/exam/paper/list.vue @@ -1,72 +1,52 @@ <template> <div class="app-container"> <el-form :model="queryParam" ref="queryForm" :inline="true"> - <el-form-item label="璇曞嵎ID锛�"> - <el-input v-model="queryParam.id" clearable></el-input> - </el-form-item> - <el-form-item label="瀛︾锛�" > - <el-select - v-model="queryParam.subjectId" - placeholder="鍏ㄩ儴绉戠洰" - clearable - > - <el-option v-for="item in subjects" :key="item.id" :label="item.name" :value="item.id"/> - </el-select> + <el-form-item label="璇曞嵎鍚嶇О锛�"> + <el-input v-model="queryParam.name" size="small" clearable @input="search"></el-input> </el-form-item> <el-form-item> - <el-button type="primary" @click="submitForm">鏌ヨ</el-button> - <router-link :to="{path:'/exam/paper/edit'}" class="link-left"> - <el-button type="primary">娣诲姞</el-button> + <el-button type="primary" @click="submitForm" size="small">鏌ヨ</el-button> + <router-link :to="{ path: '/exam/paper/edit' }" class="link-left"> + <el-button type="primary" size="small">娣诲姞</el-button> + </router-link> + <el-button class="link-left" type="danger" @click="downloadImportTemplate" size="small">涓嬭浇妯℃澘</el-button> + <router-link :to="{ path: '/exam/paper/import' }" class="link-left"> + <el-button type="success" size="small">瀵煎叆</el-button> </router-link> </el-form-item> </el-form> <el-table v-loading="listLoading" :data="tableData" border fit highlight-current-row style="width: 100%"> - <el-table-column align="center" prop="id" label="Id" width="90px"/> - <el-table-column align="center" prop="subjectId" label="瀛︾" width="120px" > - <template slot-scope="scope"> - {{ translate(scope.row.subjectId) }} - </template> - </el-table-column> - <el-table-column align="center" prop="name" label="鍚嶇О" /> - <el-table-column - align="center" - prop="paperType" - label="璇曞嵎绫诲瀷" - > + <el-table-column align="center" prop="id" label="Id" width="90px" /> + <el-table-column align="center" prop="name" label="鍚嶇О" /> + <el-table-column align="center" prop="paperType" label="璇曞嵎绫诲瀷"> <template slot-scope="scope"> <div v-if="scope.row.paperType === 1">鍥哄畾璇曞嵎</div> <div v-else-if="scope.row.paperType === 2">闅忔満璇曞嵎</div> <div v-else-if="scope.row.paperType === 3">闅忓簭璇曞嵎</div> </template> </el-table-column> - <el-table-column - align="center" - prop="suggestTime" - label="寤鸿鏃堕暱(鍒嗛挓)" - > + <el-table-column align="center" prop="suggestTime" label="寤鸿鏃堕暱(鍒嗛挓)"> </el-table-column> - <el-table-column - align="center" - prop="num" - label="棰樼洰鏁伴噺" - > + <el-table-column align="center" prop="num" label="棰樼洰鏁伴噺"> </el-table-column> - <el-table-column - align="center" - prop="score" - label="鎬诲垎" - > + <el-table-column align="center" prop="score" label="鎬诲垎"> </el-table-column> - <el-table-column align="center" prop="createTime" label="鍒涘缓鏃堕棿" width="160px"/> - <el-table-column label="鎿嶄綔" align="center" width="160px"> + <el-table-column align="center" prop="createTime" label="鍒涘缓鏃堕棿" width="160px" /> + <el-table-column label="鎿嶄綔" align="center" width="160px"> <template slot-scope="{row}"> - <el-button size="mini" @click="$router.push({path:'/exam/paper/edit',query:{id:row.id}})" >缂栬緫</el-button> - <el-button size="mini" type="danger" @click="deletePaper(row)" class="link-left">鍒犻櫎</el-button> + <el-button size="mini" @click="$router.push({ path: '/exam/paper/edit', query: { id: row.id } })">缂栬緫</el-button> + <el-popconfirm + style="margin: 0 5px" + title="纭畾瑕佸垹闄よ璇曞嵎鍚楋紵" + @confirm="deletePaper(row)" + > + <el-button slot="reference" type="danger" size="mini" class="link-left">鍒犻櫎</el-button> + </el-popconfirm> </template> </el-table-column> </el-table> - <pagination v-show="total>0" :total="total" :page.sync="queryParam.pageIndex" :limit.sync="queryParam.pageSize" - @pagination="search"/> + <pagination v-show="total > 0" :total="total" :page.sync="queryParam.pageIndex" :limit.sync="queryParam.pageSize" + @pagination="search" /> </div> </template> @@ -74,13 +54,15 @@ import Pagination from '@/components/Pagination' import subjectApi from '@/api/subject' import examPaperApi from '@/api/examPaper' +import { downloadExcel } from '@/utils/download' +import userApi from "@/api/user"; export default { components: { Pagination }, - data () { + data() { return { queryParam: { - id: null, + name: null, level: null, subjectId: null, pageIndex: 1, @@ -92,16 +74,22 @@ total: 0 } }, - created () { + created() { this.getSubjects() this.search() }, methods: { - submitForm () { + // 涓嬭浇瀵煎叆妯℃澘 + downloadImportTemplate() { + examPaperApi.downloadImportTemplate().then(res => { + downloadExcel(res, '璇曞嵎瀵煎叆妯℃澘') + }) + }, + submitForm() { this.queryParam.pageIndex = 1 this.search() }, - search () { + search() { this.listLoading = true examPaperApi.pageList(this.queryParam).then(data => { const re = data.data @@ -112,14 +100,20 @@ }) }, deletePaper (row) { - let _this = this - examPaperApi.deletePaper(row.id).then(re => { - if (re.code === 1) { - _this.search() - _this.$message.success(re.message) - } else { - _this.$message.error(re.message) - } + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ヨ瘯鍗�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + let _this = this + examPaperApi.deletePaper(row.id).then(re => { + if (re.code === 1) { + _this.search() + _this.$message.success(re.message) + } else { + _this.$message.error(re.message) + } + }) }) }, // 鑾峰彇绉戠洰 -- Gitblit v1.8.0