Browse Source

添加分页

DESKTOP-SVI9JE1\muzen 1 year ago
parent
commit
90af44138b
1 changed files with 14 additions and 5 deletions
  1. 14 5
      src/views/device/class/index.vue

+ 14 - 5
src/views/device/class/index.vue

@@ -23,9 +23,12 @@
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" @click="getSearch">搜索</el-button>
         <el-button icon="el-icon-refresh" @click="getRefresh">重置</el-button>
-        <el-button type="primary" icon="el-icon-plus" plain @click="getDetail()" v-hasPermi="['device:class:add']">新增</el-button>
-        <el-button type="primary" :disabled="ids === ''" @click="getChange(ids, 2, '批量上架')" v-hasPermi="['device:class:up']">批量上架</el-button>
-        <el-button type="primary" :disabled="ids === ''" @click="getChange(ids, 2, '批量下架')" v-hasPermi="['device:class:down']">批量下架</el-button>
+        <el-button type="primary" icon="el-icon-plus" plain @click="getDetail()"
+          v-hasPermi="['device:class:add']">新增</el-button>
+        <el-button type="primary" :disabled="ids === ''" @click="getChange(ids, 2, '批量上架')"
+          v-hasPermi="['device:class:up']">批量上架</el-button>
+        <el-button type="primary" :disabled="ids === ''" @click="getChange(ids, 2, '批量下架')"
+          v-hasPermi="['device:class:down']">批量下架</el-button>
       </el-form-item>
     </el-form>
     <!-- 列表 -->
@@ -46,15 +49,19 @@
       <el-table-column label="操作" align="center">
         <template slot-scope="scope">
           <el-button type="text" @click="getDetail(scope.row.id, true)">查看</el-button>
-          <el-button v-if="scope.row.status === 1" type="text" @click="getChange(scope.row.id, 2, '下架')" v-hasPermi="['device:class:down']">下架</el-button>
+          <el-button v-if="scope.row.status === 1" type="text" @click="getChange(scope.row.id, 2, '下架')"
+            v-hasPermi="['device:class:down']">下架</el-button>
           <span v-else style="margin-left: 10px;">
             <el-button type="text" @click="getDetail(scope.row.id)" v-hasPermi="['device:class:edit']">编辑</el-button>
-            <el-button type="text" @click="getChange(scope.row.id, 1, '上架')" v-hasPermi="['device:class:up']">上架</el-button>
+            <el-button type="text" @click="getChange(scope.row.id, 1, '上架')"
+              v-hasPermi="['device:class:up']">上架</el-button>
             <el-button type="delete" @click="getDelete(scope.row)" v-hasPermi="['device:class:delete']">删除</el-button>
           </span>
         </template>
       </el-table-column>
     </el-table>
+    <pagination v-show="total > 0" :total="total" :page.sync="form.pageNum" :limit.sync="form.pageSize"
+      @pagination="getList" />
   </div>
 </template>
 
@@ -72,6 +79,8 @@ export default {
         pageNum: 1,
         pageSize: 10
       },
+      // 总数据
+      total: 0,
       // 列表
       tableData: [],
       // 批量上下架