|
@@ -1,67 +1,46 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
-
|
|
|
+
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
|
|
|
+ <el-form-item label="期数名称" prop="period">
|
|
|
+ <el-input v-model="queryParams.period" placeholder="请输入期数名称" clearable size="small" style="width: 140px"
|
|
|
+ @keyup.enter.native="getList()" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="cyan" icon="el-icon-search" size="mini" @click="getList()">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- icon="el-icon-plus"
|
|
|
- size="mini"
|
|
|
- @click="handleAdd"
|
|
|
- >添加</el-button>
|
|
|
+ <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">添加</el-button>
|
|
|
</el-col>
|
|
|
+
|
|
|
</el-row>
|
|
|
|
|
|
<el-table :data="periodList">
|
|
|
- <el-table-column label="ID" prop="id" align="center" width="120"/>
|
|
|
- <el-table-column label="期数" prop="period" align="center" width="350"/>
|
|
|
+ <el-table-column label="ID" prop="id" align="center" width="120" />
|
|
|
+ <el-table-column label="期数" prop="period" align="center" width="350" />
|
|
|
<el-table-column label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="handleEdit(scope.row)"
|
|
|
- >编辑</el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
|
|
|
<div style="display: inline-block;width: 10px"></div>
|
|
|
- <el-popconfirm
|
|
|
- title="确定删除吗?"
|
|
|
- @confirm="handleDelete(scope.row)"
|
|
|
- >
|
|
|
- <el-button
|
|
|
- slot="reference"
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-delete"
|
|
|
- >删除</el-button>
|
|
|
+ <el-popconfirm title="确定删除吗?" @confirm="handleDelete(scope.row)">
|
|
|
+ <el-button slot="reference" size="mini" type="text" icon="el-icon-delete">删除</el-button>
|
|
|
</el-popconfirm>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
<!-- 翻页 -->
|
|
|
- <pagination
|
|
|
- v-show="total>0"
|
|
|
- :total="total"
|
|
|
- :page.sync="queryParams.pageNum"
|
|
|
- :limit.sync="queryParams.pageSize"
|
|
|
- @pagination="getList"
|
|
|
- />
|
|
|
+ <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList" />
|
|
|
|
|
|
<!-- 添加弹窗 -->
|
|
|
- <el-dialog
|
|
|
- :title="isAdd ? '添加期数' : '编辑期数'"
|
|
|
- :visible.sync="openEdit"
|
|
|
- width="400px"
|
|
|
- @close="dialogClose"
|
|
|
- >
|
|
|
+ <el-dialog :title="isAdd ? '添加期数' : '编辑期数'" :visible.sync="openEdit" width="400px" @close="dialogClose">
|
|
|
<el-form :model="queryPlatform" :rules="rules" ref="platForm">
|
|
|
<el-form-item label="期数名称" prop="period">
|
|
|
- <el-input
|
|
|
- clearable
|
|
|
- size="small"
|
|
|
- v-model="queryPlatform.period"
|
|
|
- />
|
|
|
+ <el-input clearable size="small" v-model="queryPlatform.period" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
@@ -99,6 +78,11 @@ export default {
|
|
|
this.getList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
/** 期数新增 */
|
|
|
handleAdd() {
|
|
|
this.isAdd = true
|
|
@@ -115,12 +99,12 @@ export default {
|
|
|
handleEdit(value) {
|
|
|
this.openEdit = true
|
|
|
this.isAdd = false
|
|
|
- this.queryPlatform = {...value}
|
|
|
+ this.queryPlatform = { ...value }
|
|
|
},
|
|
|
/** 列表删除 */
|
|
|
handleDelete(value) {
|
|
|
delPeriod(value.id).then(response => {
|
|
|
- if(response.data){
|
|
|
+ if (response.data) {
|
|
|
this.msgSuccess("删除成功");
|
|
|
this.getList()
|
|
|
}
|
|
@@ -130,11 +114,11 @@ export default {
|
|
|
submitForm(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- if(this.isAdd) {
|
|
|
-
|
|
|
+ if (this.isAdd) {
|
|
|
+
|
|
|
addPeriod(this.queryPlatform).then(response => {
|
|
|
this.openEdit = false
|
|
|
- if(response.data){
|
|
|
+ if (response.data) {
|
|
|
this.msgSuccess("添加成功");
|
|
|
this.getList()
|
|
|
this.queryPlatform = {
|
|
@@ -145,11 +129,11 @@ export default {
|
|
|
this.openEdit = false
|
|
|
});
|
|
|
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
console.log(this.queryPlatform)
|
|
|
editPeriod(this.queryPlatform).then(response => {
|
|
|
this.openEdit = false
|
|
|
- if(response.data){
|
|
|
+ if (response.data) {
|
|
|
this.msgSuccess("修改成功");
|
|
|
this.getList()
|
|
|
}
|
|
@@ -157,7 +141,7 @@ export default {
|
|
|
this.openEdit = false
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
} else {
|
|
|
return false;
|
|
@@ -166,7 +150,7 @@ export default {
|
|
|
},
|
|
|
/** 弹窗关闭触发 */
|
|
|
dialogClose() {
|
|
|
- if(!this.isAdd){
|
|
|
+ if (!this.isAdd) {
|
|
|
this.queryPlatform = {
|
|
|
period: ''
|
|
|
}
|