From 6d1754304d79d3398df52126cd1d3cd7d630e94a Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期二, 01 十一月 2022 11:59:46 +0800 Subject: [PATCH] 单兵、音柱页面显示 --- src/views/systemSetting/device/loudspeaker/index.vue | 81 ++++++++++++++++++++++++++++++++++++---- 1 files changed, 72 insertions(+), 9 deletions(-) diff --git a/src/views/systemSetting/device/loudspeaker/index.vue b/src/views/systemSetting/device/loudspeaker/index.vue index 7a427c8..de78e41 100644 --- a/src/views/systemSetting/device/loudspeaker/index.vue +++ b/src/views/systemSetting/device/loudspeaker/index.vue @@ -4,7 +4,11 @@ <div class="header-content"> <div class="search"> <span style="padding-right: 20px">绛涢�夋潯浠�:</span> - <el-select v-model="context" placeholder="绛涢�夋潯浠�"> + <el-select + v-model="context" + placeholder="绛涢�夋潯浠�" + @change="handleStateChange" + > <el-option v-for="item in options" :key="item.value" @@ -38,6 +42,7 @@ }" :data="list" style="width: 100%" + :row-class-name="tableRowClassName" > <el-table-column type="selection" min-width="5"> </el-table-column> <el-table-column prop="name" label="闊虫煴鍚嶇О" min-width="10"> @@ -75,6 +80,24 @@ </template> </el-table-column> </el-table> + + <!-- tools --> + <div class="tools"> + <div class="funs"></div> + <div class="pagination"> + <el-pagination + background + :current-page="currentPage" + layout="prev, pager, next" + :total="totalNum" + :page-size="pageSize" + @current-change="changeCurrentPage" + @prev-click="handlePrev" + @next-click="handleNext" + > + </el-pagination> + </div> + </div> </div> </main> <footer> @@ -83,6 +106,7 @@ title="娣诲姞闊虫煴" :visible.sync="dialogCreate" width="60%" + v-if="dialogCreate" :before-close="handleClose" > <MyForm :info="loudspeakerInfo" :closeDialog="null"></MyForm> @@ -102,7 +126,7 @@ data() { return { dialogCreate: false, - context: 0, + context: null, options: [ { value: null, @@ -118,8 +142,10 @@ }, ], list: [], - current: 1, - size: 10, + totalNum: 0, + pageSize: 10, + currentPage: 1, + renderFlag: false, loudspeakerInfo: { id: 0, name: "", @@ -139,8 +165,23 @@ "saveLoudspeaker", "updateLoudspeaker", ]), + handleEdit(row) { + this.loudspeakerInfo = row; + this.dialogCreate = true; + }, + handleDelete(row) {}, formatSate(row, column) { return row.state == 1 ? "鍦ㄧ嚎" : "绂荤嚎"; + }, + + // 璁剧疆琛ㄦ牸鏂戦┈绾� + tableRowClassName({ row, rowIndex }) { + if ((rowIndex + 1) % 2 == 0) { + return "warning-row"; + } else { + return "success-row"; + } + return ""; }, // 寮圭獥鍏抽棴 handleClose(done) { @@ -150,14 +191,36 @@ }, // 璁剧疆tableData setTableData() { - const { current, size, context } = this; - let arr = this.getLoudspeakerList({ - current, - size, + const { currentPage, pageSize, context } = this; + this.getLoudspeakerList({ + currentPage, + pageSize, + state: context, }).then((res) => { - this.list = arr.data.data; + if (res.data.code == 200) { + this.list = res.data.data.records; + this.totalNum = res.data.data.total; + } }); }, + handleStateChange(e) { + this.setTableData(); + }, + // 褰撳墠椤垫敼鍙樿Е鍙戜簨浠� + changeCurrentPage(page) { + this.currentPage = page; + this.setTableData(); + }, + // 涓婁竴椤电偣鍑讳簨浠� + handlePrev(page) { + this.currentPage = page; + this.setTableData(); + }, + // 涓嬩竴椤电偣鍑讳簨浠� + handleNext(page) { + this.currentPage = page; + this.setTableData(); + }, }, }; </script> -- Gitblit v1.8.0