From 7c20fd15b7fbc2bd5756b39d5ab655cc849ffcc3 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期三, 16 七月 2025 22:39:23 +0800 Subject: [PATCH] 添加时间筛选 --- src/views/systemSetting/device/handheldTerminal/index.vue | 231 ++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 139 insertions(+), 92 deletions(-) diff --git a/src/views/systemSetting/device/handheldTerminal/index.vue b/src/views/systemSetting/device/handheldTerminal/index.vue index c7ba97f..8c2a2cf 100644 --- a/src/views/systemSetting/device/handheldTerminal/index.vue +++ b/src/views/systemSetting/device/handheldTerminal/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" @@ -14,28 +18,30 @@ </el-option> </el-select> </div> + + <div class="main-title"> + <el-button + class="el-icon-plus button-addition" + type="primary" + @click="handleAdd" + >娣诲姞</el-button + > + </div> </div> </header> <main> <div class="main-content"> - <div class="main-title"> - <el-button - class="el-icon-plus" - type="primary" - @click="dialogCreate = true" - >娣诲姞</el-button - > - </div> <!-- 鏁版嵁灞曠ず --> <el-table + border + stripe ref="multipleTable" :header-cell-style="{ - background: '#06122c', - 'font-size': '12px', - color: '#4b9bb7', + background: '#F5F5F5', 'font-weight': '650', 'line-height': '45px', }" + :row-class-name="tableRowClassName" :data="list" style="width: 100%" > @@ -48,7 +54,7 @@ </el-table-column> <el-table-column prop="phone" label="鑱旂郴鏂瑰紡" min-width="10"> </el-table-column> - <el-table-column prop="pDepartName" label="鎵�灞為儴闂�" min-width="10"> + <el-table-column prop="pdepartName" label="鎵�灞為儴闂�" min-width="10"> </el-table-column> <el-table-column prop="departName" label="鎵�灞炲ぇ闃�" min-width="10"> </el-table-column> @@ -63,7 +69,7 @@ <el-table-column prop="operation" label="鎿嶄綔" min-width="20"> <template slot-scope="scope"> - <div class="btn"> + <div class="operation"> <span @click="handleEdit(scope.row)">缂栬緫</span> <span class="line">|</span> <span @click="handleDelete(scope.row)">鍒犻櫎</span> @@ -72,23 +78,42 @@ </el-table-column> </el-table> </div> + + <!-- 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> </main> <footer> <!-- 娣诲姞闊虫煴 --> <el-dialog - title="娣诲姞闊虫煴" + title="娣诲姞鎵嬫寔璁惧" :visible.sync="dialogCreate" + v-if="dialogCreate" width="60%" :before-close="handleClose" > - <MyForm :info="loudspeakerInfo" :closeDialog="null"></MyForm> + <MyForm :info="handheldTerminal" @closeDialog="handleCallBack"></MyForm> </el-dialog> </footer> </div> </template> <script> import { createNamespacedHelpers } from "vuex"; -const { mapActions } = createNamespacedHelpers("loudspeaker"); +const { mapActions } = createNamespacedHelpers("handheldTerminal"); import MyForm from "./components/dialogForm.vue"; export default { @@ -98,7 +123,7 @@ data() { return { dialogCreate: false, - context: 0, + context: null, options: [ { value: null, @@ -114,45 +139,100 @@ }, ], list: [], - current: 1, - size: 10, - loudspeakerInfo: { - id: 0, - name: "", - code: "", - power: "", - frequencyResponse: "", - fullRangeSpeaker: "", - }, + totalNum: 0, + pageSize: 10, + currentPage: 1, + renderFlag: false, + handheldTerminal: {}, }; }, created() { this.setTableData(); }, methods: { - ...mapActions([ - "getLoudspeakerList", - "saveLoudspeaker", - "updateLoudspeaker", - ]), + ...mapActions(["getHandheldTerminalList", "deleteHandheldTerminal"]), + handleAdd() { + this.handheldTerminal = { + id: 0, + name: "", + code: "", + user: "", + phone: "", + departId: 0, + departName: "", + }; + this.dialogCreate = true; + }, + handleEdit(row) { + this.handheldTerminal = row; + this.dialogCreate = true; + }, + handleDelete(row) { + this.$confirm("纭鍒犻櫎锛�").then((_) => { + this.deleteHandheldTerminal(row.id).then((res) => { + this.$message({ + type: "success", + message: "鍒犻櫎鎴愬姛锛�", + }); + this.setTableData(); + }); + }); + }, + + handleCallBack(e) { + this.currentPage = 1; + this.dialogCreate = false; + this.setTableData(); + }, 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) { this.$confirm("纭鍏抽棴?").then((_) => { + this.dialogCreate = false; done(); }); }, // 璁剧疆tableData setTableData() { - const { current, size, context } = this; - let arr = this.getLoudspeakerList({ - current, - size, + const { currentPage, pageSize, context } = this; + this.getHandheldTerminalList({ + currentPage, + pageSize, + state: context, }).then((res) => { - this.list = arr.data.data; + this.list = res.records; + this.totalNum = res.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(); }, }, }; @@ -160,15 +240,12 @@ <style lang="scss" scoped> .list { text-align: left; - margin: 10px 20px; - color: #4b9bb7; - + padding: 10px 20px; + // color: #4b9bb7; + border: 1px solid #ccc; header { - background-color: #09152f; - border: 1pox solid #fff; - .header-content { - padding: 0 40px; + padding: 0; display: flex; line-height: 100px; justify-content: space-between; @@ -184,27 +261,18 @@ .el-input { flex: 2; - color: #1d3f57; - - &::v-deep .el-input__inner { - background-color: #09152f; - border: 1px solid #17324c; - } } + } + + .main-title { + line-height: 60px; + padding: 0px; } } } main { - background-color: #09152f; - margin-top: 20px; padding-bottom: 50px; - border: 1pox solid #fff; - - .main-title { - line-height: 60px; - padding: 10px 20px; - } .tools { display: flex; @@ -219,7 +287,7 @@ line-height: 28px; display: flex; align-items: center; - border: 1px solid #17324c; + // border: 1px solid #17324c; border-radius: 4px; font-size: 12px; margin-left: 10px; @@ -232,19 +300,6 @@ .el-select { width: 120px; } - - &::v-deep .el-input__inner { - border: none; - background-color: #09152f; - } - - &:hover { - border: 1px solid #4b9bb7; - } - - &:hover .el-checkbox { - color: #4b9bb7; - } } } @@ -253,30 +308,22 @@ display: flex; line-height: 50px; justify-content: center; - - .el-pagination { - &::v-deep li, - &::v-deep .btn-prev, - &::v-deep .btn-next { - background-color: #071f39; - color: #4b9bb7; - } - - &::v-deep .active { - background-color: #409eff; - color: #fff; - } - } } } - .el-table { - color: #4b9bb7; - font-size: 10px; + .operationBox { + display: flex; + } + .el-divider { + background-color: #4b9bb7; + } + .el-table { + // color: #4b9bb7; + // font-size: 10px; .operation { display: flex; - + color: var(--operation-color); .line { padding: 0 5px; } @@ -288,4 +335,4 @@ } } } -</style> \ No newline at end of file +</style> -- Gitblit v1.8.0