From 7dd6a5534f3b35a7ebe0641112731a71c4cfb6c1 Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期四, 06 六月 2024 17:26:29 +0800 Subject: [PATCH] feat:成绩管理-试卷展示 --- src/views/Manage/ScoreInquiry/index.vue | 318 +++++++++++++++++++++------------------------------- 1 files changed, 130 insertions(+), 188 deletions(-) diff --git a/src/views/Manage/ScoreInquiry/index.vue b/src/views/Manage/ScoreInquiry/index.vue index ac665ed..6eefda8 100644 --- a/src/views/Manage/ScoreInquiry/index.vue +++ b/src/views/Manage/ScoreInquiry/index.vue @@ -1,234 +1,176 @@ -<!-- 鎴愮哗鏌ヨ --> +<!-- 绛斿嵎绠$悊 --> <template> <div class="c"> <div class="bg"> <div class="main"> - <!-- 甯﹁繑鍥炵殑鏍囬 --> - <TitleIndex title="鎴愮哗鏌ヨ" /> + <!-- 寰呰繑鍥炵殑鏍囬 --> + <TitleIndex title="绛斿嵎绠$悊" /> <div class="content"> <!-- 鎼滅储 --> <div> - <el-form - :inline="true" - :model="formLabelAlign" - class="demo-form-inline" - :label-position="labelPosition" - label-width="80px" - > - <el-form-item label="娲诲姩鍖哄煙"> - <el-select - v-model="formLabelAlign.region" - placeholder="娲诲姩鍖哄煙" - > - <el-option - label="鍖哄煙涓�" - value="shanghai" - ></el-option> - <el-option - label="鍖哄煙浜�" - value="beijing" - ></el-option> + <el-form :inline="true" :model="queryParam" class="demo-form-inline" label-width="80px"> + <el-form-item> + <el-input v-model="queryParam.name" placeholder="璇疯緭鍏ュ悕绉�" clearable></el-input> + </el-form-item> + <el-form-item> + <el-select v-model="queryParam.subjectId" placeholder="璇烽�夋嫨绉戠洰" clearable multiple @change="search"> + <el-option v-for="item in subjects" :key="item.id" :value="item.id" :label="item.name"></el-option> </el-select> </el-form-item> - <el-form-item label="娲诲姩鍖哄煙"> - <el-select - v-model="formLabelAlign.region" - placeholder="娲诲姩鍖哄煙" - > - <el-option - label="鍖哄煙涓�" - value="shanghai" - ></el-option> - <el-option - label="鍖哄煙浜�" - value="beijing" - ></el-option> - </el-select> - </el-form-item> - <el-form-item label="瀛﹀彿"> - <el-input v-model="formLabelAlign.type"></el-input> - </el-form-item> - <el-form-item label=""> - <el-button - style="width:100px;margin-top: 42px;" - type="primary" - size="small" - >鏌ヨ</el-button> + <el-form-item> + <el-button style="width:100px;" type="primary" size="small" @click="search()">鏌ヨ</el-button> </el-form-item> </el-form> </div> <!-- 琛ㄦ牸 --> - <!-- 淇敼琛ㄦ牸鐨勯珮搴� --> - <!-- :row-style="{height:'30px'}" - :cell-style="{padding: '0'}" --> - <el-table - :data="tableData" - border - style="width: 100%;" - :row-style="{height:'34px'}" - :cell-style="{padding: '0'}" - > - <el-table-column - prop="date" - label="瀛﹀勾" - width="100" - > + <el-table v-loading="listLoading" :data="tableData" border style="width: 100%;"> + <el-table-column align="center" prop="paperName" label="鍚嶇О" /> + <el-table-column align="center" prop="subjectName" label="绉戠洰" /> + <el-table-column align="center" prop="paperType" label="璇曞嵎绫诲瀷" width="150px"> + <template slot-scope="{row}"> + <span v-if="row.paperType === 1">鍥哄畾璇曞嵎</span> + <span v-if="row.paperType === 2">闅忔満璇曞嵎</span> + <span v-if="row.paperType === 3">椤哄簭璇曞嵎</span> + </template> </el-table-column> - <el-table-column - prop="name" - label="瀛︽湡" - width="150" - > + <el-table-column align="center" prop="questionCount" label="棰樼洰鏁伴噺" width="100px" /> + <el-table-column align="center" prop="systemScore" label="鎬诲垎" width="100px" /> + <el-table-column align="center" prop="personAnswerNum" label="鍙傝�冧汉鏁�" width="100px"> + <template slot-scope="{row}"> + <span>{{ row.personAnswerNum + "/" + row.personTotalNum }}</span> + </template> </el-table-column> - <el-table-column - prop="address" - label="瀛﹀彿" - width="150" - > - </el-table-column> - <el-table-column - prop="date" - label="璇剧▼鍚嶇О" - width="180" - > - </el-table-column> - <el-table-column - prop="name" - label="鏄惁鍚堟牸" - width="100" - > - </el-table-column> - <el-table-column - prop="address" - label="鎴愮哗" - > - </el-table-column> - <el-table-column - label="鎿嶄綔" - align="center" - > - <template slot-scope="scope"> - <el-button - size="mini" - @click="handleEdit(scope.$index, scope.row)" - >鏌ョ湅璇曞嵎</el-button> - <el-button - size="mini" - type="danger" - @click="handleDelete(scope.$index, scope.row)" - >瀵煎嚭璇曞嵎</el-button> + <el-table-column align="center" prop="userName" label="鍒涘缓浜�" width="100px" /> + <el-table-column label="鎿嶄綔" align="center"> + <template slot-scope="{row}"> + <el-button size="mini" @click="view(row)">鏌ョ湅</el-button> </template> </el-table-column> </el-table> - <div - class="block" - style="display: flex; margin-top: 40px;" - > - <el-pagination - style="margin:auto" - background - :page-size="10" - layout="prev, pager, next, jumper" - :total="100" - > - </el-pagination> - </div> + <pagination v-show="total > 0" :total="total" :page.sync="queryParam.pageIndex" + :limit.sync="queryParam.pageSize" @pagination="search" /> </div> - </div> - </div> + <el-dialog :visible.sync="visible" width="400px"> + <el-form :model="form" ref="form" label-width="100px" v-loading="formLoading" :rules="rules"> + <el-form-item label="鍚嶇О锛�" prop="name" required> + <el-input v-model="form.name" maxlength="10" show-word-limit /> + </el-form-item> + <el-form-item label="鎺掑簭锛�" prop="itemOrder" required> + <el-input-number v-model="form.itemOrder" type="number" :min="1" :max="100" /> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="submitForm">鎻愪氦</el-button> + <el-button @click="resetForm">閲嶇疆</el-button> + </el-form-item> + </el-form> + </el-dialog> </div> </template> <script> +// 寮曞叆褰堝嚭绐楀彛绲勪欢 +import subjectApi from '@/api/subject' +import examPaperAnwserApi from '@/api/examPaperAnwser' +import Pagination from '@/components/Pagination' + export default { + // 娉ㄥ唽 + components: { + Pagination + }, data() { return { - labelPosition: "top", - formLabelAlign: { - type: "", - user: "", - region: "", + listLoading: true, + queryParam: { + name: '', + pageIndex: 1, + pageSize: 10 }, - tableData: [ - { - date: "2016-05-02", - name: "鐜嬪皬铏�", - address: "1234568798788", - }, - { - date: "2016-05-04", - name: "鐜嬪皬铏�", - address: "1234568798788", - }, - { - date: "2016-05-01", - name: "鐜嬪皬铏�", - address: "1234568798788", - }, - { - date: "2016-05-03", - name: "鐜嬪皬铏�", - address: "1234568798788", - }, - { - date: "2016-05-02", - name: "鐜嬪皬铏�", - address: "1234568798788", - }, - { - date: "2016-05-04", - name: "鐜嬪皬铏�", - address: "1234568798788", - }, - { - date: "2016-05-01", - name: "鐜嬪皬铏�", - address: "1234568798788", - }, - { - date: "2016-05-03", - name: "鐜嬪皬铏�", - address: "1234568798788", - }, - { - date: "2016-05-02", - name: "鐜嬪皬铏�", - address: "1234568798788", - }, - { - date: "2016-05-04", - name: "鐜嬪皬铏�", - address: "5252252552555", - }, - ], + formLoading: false, + total: 0, + tableData: [], + form: { + id: '', + name: '', + itemOrder: '' + }, + visible: false, + subjects: [] }; }, - methods: { - // 杩斿洖涓婁竴涓〉闈� - goBack() { - this.$router.back(); - }, - //鎻愪氦鎸夐挳 - onSubmit() { - console.log("submit!"); - }, + created() { + this.search() + this.getSubjects(); }, + methods: { + // 鑾峰彇绉戠洰 + getSubjects() { + subjectApi.list().then(re => { + this.subjects = re.data + }) + }, + // 鑾峰彇鍒楄〃 + search() { + this.listLoading = true + examPaperAnwserApi.pageExamPaper(this.queryParam).then(re => { + this.tableData = re.data.list + this.total = re.data.total + this.queryParam.pageSize = re.data.pageSize + this.queryParam.pageIndex = re.data.pageNum + this.listLoading = false + }) + }, + view(row) { + if (row) { + subjectApi.select(row.id).then(re => { + if (re.code === 1) { + this.form = re.data; + this.visible = true; + this.$router.push({ path: '/manage/question-bank', query: { id: row.id } }); + } else { + this.$message.error(re.message) + } + }) + } else { + this.visible = true; + } + }, + submitForm() { + let _this = this + this.$refs.form.validate((valid) => { + if (valid) { + this.formLoading = true + subjectApi.edit(this.form).then(re => { + if (re.code === 1) { + _this.$message.success(re.message) + _this.search() + _this.formLoading = false + _this.visible = false + } else { + _this.$message.error(re.message) + _this.formLoading = false + _this.visible = false + } + }) + } + }) + } + } }; </script> <style scoped lang="scss"> .flex { display: flex; } + // 鍐呭 .content { width: 1262px; margin-bottom: 80px; background-color: #fff; - padding: 40px; + padding: 20px 40px; border-radius: 10px; } </style> - - -- Gitblit v1.8.0