|
@@ -4,6 +4,13 @@
|
|
|
<h2 class="part-box-title">试卷模板管理</h2>
|
|
|
<!-- 搜索 -->
|
|
|
<el-form class="part-filter-form" inline :model="searchForm">
|
|
|
+ <el-form-item label="版头名称">
|
|
|
+ <el-input
|
|
|
+ v-model="searchForm.name"
|
|
|
+ placeholder="请输入版头名称"
|
|
|
+ maxlength="50"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="danger" @click="handleCurrentChange(1)">
|
|
|
查询
|
|
@@ -12,8 +19,9 @@
|
|
|
</el-form>
|
|
|
|
|
|
<div class="part-box-action">
|
|
|
+ <div></div>
|
|
|
<el-button type="primary" plain icon="icon icon-edit" @click="toCreate"
|
|
|
- >新建模板
|
|
|
+ >新建
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -21,7 +29,7 @@
|
|
|
<div class="part-box">
|
|
|
<!-- 页面列表 -->
|
|
|
<el-table ref="table" :data="tableData">
|
|
|
- <el-table-column prop="name" label="名称"> </el-table-column>
|
|
|
+ <el-table-column prop="name" label="模版名称"> </el-table-column>
|
|
|
<el-table-column
|
|
|
prop="createTime"
|
|
|
label="创建时间"
|
|
@@ -54,6 +62,13 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column width="170" label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ @click="toEdit(scope.row)"
|
|
|
+ >编辑
|
|
|
+ </el-button>
|
|
|
<el-button
|
|
|
v-if="!onlyAssignTeacher"
|
|
|
size="mini"
|
|
@@ -63,31 +78,13 @@
|
|
|
>
|
|
|
{{ scope.row.enable ? "禁用" : "启用" }}
|
|
|
</el-button>
|
|
|
- <el-dropdown>
|
|
|
- <el-button type="primary" plain size="mini">
|
|
|
- 更多<i class="el-icon-more el-icon--right"></i>
|
|
|
- </el-button>
|
|
|
- <el-dropdown-menu slot="dropdown" class="action-dropdown">
|
|
|
- <el-dropdown-item>
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="primary"
|
|
|
- plain
|
|
|
- @click="toEdit(scope.row)"
|
|
|
- >编辑模板
|
|
|
- </el-button>
|
|
|
- </el-dropdown-item>
|
|
|
- <el-dropdown-item v-if="!onlyAssignTeacher">
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="danger"
|
|
|
- plain
|
|
|
- @click="toDelete(scope.row)"
|
|
|
- >删除
|
|
|
- </el-button>
|
|
|
- </el-dropdown-item>
|
|
|
- </el-dropdown-menu>
|
|
|
- </el-dropdown>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ @click="toDelete(scope.row)"
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -107,13 +104,18 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { paperTemplateListApi } from "../api";
|
|
|
+import {
|
|
|
+ paperTemplateListApi,
|
|
|
+ paperTemplateEnableApi,
|
|
|
+ paperTemplateDeleteApi,
|
|
|
+} from "../api";
|
|
|
|
|
|
export default {
|
|
|
name: "PaperTemplateManage",
|
|
|
data() {
|
|
|
return {
|
|
|
loading: false,
|
|
|
+ searchForm: { name: "" },
|
|
|
tableData: [],
|
|
|
curRow: {},
|
|
|
currentPage: 1,
|
|
@@ -121,12 +123,16 @@ export default {
|
|
|
total: 10,
|
|
|
};
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ // this.search();
|
|
|
+ },
|
|
|
methods: {
|
|
|
async search() {
|
|
|
if (this.loading) return;
|
|
|
this.loading = true;
|
|
|
|
|
|
const res = await paperTemplateListApi({
|
|
|
+ ...this.searchForm,
|
|
|
pageNumber: this.currentPage,
|
|
|
pageSize: this.pageSize,
|
|
|
}).catch(() => {});
|
|
@@ -146,15 +152,48 @@ export default {
|
|
|
this.pageSize = val;
|
|
|
this.search();
|
|
|
},
|
|
|
- toCreate() {},
|
|
|
- toEnable(row) {
|
|
|
- console.log(row);
|
|
|
+ toCreate() {
|
|
|
+ this.$router.push({
|
|
|
+ name: "PaperTemplateEdit",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async toEnable(row) {
|
|
|
+ const action = row.enable ? "禁用" : "启用";
|
|
|
+ const confirm = await this.$confirm(
|
|
|
+ `确定要${action}该试卷模板吗?`,
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ type: "warning",
|
|
|
+ }
|
|
|
+ ).catch(() => {});
|
|
|
+ if (confirm !== "confirm") return;
|
|
|
+
|
|
|
+ const enable = !row.enable;
|
|
|
+ await paperTemplateEnableApi({
|
|
|
+ id: row.id,
|
|
|
+ enable,
|
|
|
+ });
|
|
|
+ this.$message.success("操作成功!");
|
|
|
+ this.search();
|
|
|
},
|
|
|
toEdit(row) {
|
|
|
console.log(row);
|
|
|
+ this.$router.push({
|
|
|
+ name: "PaperTemplateEdit",
|
|
|
+ params: {
|
|
|
+ tid: row.id,
|
|
|
+ },
|
|
|
+ });
|
|
|
},
|
|
|
- toDelete(row) {
|
|
|
- console.log(row);
|
|
|
+ async toDelete(row) {
|
|
|
+ const confirm = await this.$confirm(`确定要删除该试卷模板吗?`, "提示", {
|
|
|
+ type: "warning",
|
|
|
+ }).catch(() => {});
|
|
|
+ if (confirm !== "confirm") return;
|
|
|
+
|
|
|
+ await paperTemplateDeleteApi([row.id]);
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+ this.deletePageLastItem();
|
|
|
},
|
|
|
},
|
|
|
};
|