wuhao 3 年 前
コミット
8637c5b34f
1 ファイル変更12 行追加6 行削除
  1. 12 6
      src/views/device/category/index.vue

+ 12 - 6
src/views/device/category/index.vue

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