Ver código fonte

:zap: 顶部菜单增加排序功能

smallchill 6 anos atrás
pai
commit
e2e6503492
1 arquivos alterados com 13 adições e 3 exclusões
  1. 13 3
      src/views/system/topmenu.vue

+ 13 - 3
src/views/system/topmenu.vue

@@ -33,12 +33,14 @@
                    plain>菜单配置
         </el-button>
       </template>
-      <template slot-scope="{row}"
-                slot="source">
+      <template slot-scope="{row}" slot="source">
         <div style="text-align:center">
           <i :class="row.source"></i>
         </div>
       </template>
+      <template slot="sort" slot-scope="{row}" >
+        <el-input-number v-model="row.sort" @change="sortChange(row)" :min="1" :max="100"></el-input-number>
+      </template>
     </avue-crud>
     <el-dialog title="下级菜单配置"
                append-to-body
@@ -88,7 +90,7 @@
         menuGrantList: [],
         menuTreeObj: [],
         option: {
-          height:'auto',
+          height: 'auto',
           calcHeight: 30,
           tip: false,
           searchShow: true,
@@ -138,6 +140,7 @@
               label: "菜单排序",
               prop: "sort",
               type: "number",
+              slot: true,
               rules: [{
                 required: true,
                 message: "请输入菜单排序",
@@ -267,6 +270,13 @@
         }
         done();
       },
+      sortChange(row) {
+        update(row).then(() => {
+          this.onLoad(this.page);
+        }, error => {
+          window.console.log(error);
+        });
+      },
       searchReset() {
         this.query = {};
         this.onLoad(this.page);