|
@@ -9,7 +9,7 @@
|
|
|
|
|
|
<!-- 表格 -->
|
|
|
<el-table :data="tableData" v-loading="loading">
|
|
|
- <el-table-column label="ID" prop="id" align="center" />
|
|
|
+ <el-table-column label="分类ID" prop="id" align="center" />
|
|
|
<el-table-column label="分类名称" prop="name" align="center" />
|
|
|
<el-table-column label="状态" align="center">
|
|
|
<template slot-scope="scope">
|
|
@@ -39,7 +39,7 @@
|
|
|
</el-form>
|
|
|
<div slot="footer">
|
|
|
<el-button size="mini" @click="getCancel">取消</el-button>
|
|
|
- <el-button type="primary" size="mini" @click="getAdd">确定</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="getCreate">确定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -65,7 +65,10 @@ export default {
|
|
|
dialogVisible: false,
|
|
|
title: "",
|
|
|
// 提交表单
|
|
|
- form: {},
|
|
|
+ form: {
|
|
|
+ name: '',
|
|
|
+ status: 1
|
|
|
+ },
|
|
|
// 表单验证
|
|
|
rules: {
|
|
|
name: [
|
|
@@ -103,18 +106,21 @@ export default {
|
|
|
// 新增 / 编辑按钮
|
|
|
getChange(row) {
|
|
|
this.dialogVisible = true;
|
|
|
- this.form = row ? row : {};
|
|
|
+ this.form = row ? row : {
|
|
|
+ name: '',
|
|
|
+ status: 1
|
|
|
+ };
|
|
|
this.title = row ? "编辑" : "新增";
|
|
|
},
|
|
|
|
|
|
// 取消
|
|
|
getCancel() {
|
|
|
- this.$refs.form.resetFields();
|
|
|
+ this.$refs.form.clearValidate();
|
|
|
this.dialogVisible = false;
|
|
|
},
|
|
|
|
|
|
// 确定
|
|
|
- getAdd() {
|
|
|
+ getCreate() {
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
if (this.form.id) {
|