From b565a275fe240e2bd8a939c3b4beed98d03767bc Mon Sep 17 00:00:00 2001 From: liukangdong <898885815@qq.com> Date: 星期四, 20 二月 2025 18:17:15 +0800 Subject: [PATCH] ll --- admin/src/views/operation/tram.vue | 201 ++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 160 insertions(+), 41 deletions(-) diff --git a/admin/src/views/operation/tram.vue b/admin/src/views/operation/tram.vue index c557513..3f221de 100644 --- a/admin/src/views/operation/tram.vue +++ b/admin/src/views/operation/tram.vue @@ -15,54 +15,65 @@ </el-select> </el-form-item> <section> - <el-button type="primary" @click="search">鎼滅储</el-button> + <el-button type="primary" @click="search(1)">鎼滅储</el-button> <el-button @click="reset">閲嶇疆</el-button> </section> </el-form> <!-- 琛ㄦ牸鍜屽垎椤� --> <template v-slot:table-wrap> <ul class="toolbar" v-permissions="['business:sites:create']"> - <li><el-button type="primary" @click="$refs.TramEditRef.open('鏂板杞﹁締')" icon="el-icon-plus" v-permissions="['business:sites:create']">鏂板缓</el-button></li> + <li><el-button type="primary" @click="$refs.TramEditRef.open('鏂板杞﹁締')" icon="el-icon-plus" + v-permissions="['business:sites:create']">鏂板缓</el-button></li> + <li><el-button @click="handleDelAll">鎵归噺鍒犻櫎</el-button></li> + <li v-permissions="['system:user:create']"> + <ImportButton text="瀵煎叆" template-name="鐢佃溅妯℃澘.xlsx" template-path="/template/tram_import_tem.xlsx" + action="/business/bikes/importExcel" @success="search" /> + </li> + <li><el-button :loading="downLoading" @click="handleDownAll" + v-permissions="['business:sites:create']">鎵归噺涓嬭浇浜岀淮鐮�</el-button></li> </ul> - <el-table - v-loading="isWorking.search" - :data="tableData.list" - stripe - border - > - <el-table-column prop="code" label="杞﹁締缂栫爜" :sort-method="(a,b)=>{ return a.code-b.code}" sortable min-width="100px" align="center"></el-table-column> - <el-table-column prop="name" label="杞﹁締绫诲瀷" sortable min-width="100px" align="center"></el-table-column> - <el-table-column prop="name" label="鎺у埗鍣⊿N" sortable min-width="100px" align="center"></el-table-column> - <el-table-column prop="name" label="褰撳墠鐢靛帇鍊�" sortable min-width="100px" align="center"></el-table-column> - <el-table-column prop="name" label="鐢甸噺鎯呭喌" sortable min-width="100px" align="center"></el-table-column> - <el-table-column prop="name" label="绔欑偣缂栧彿" sortable min-width="100px" align="center"></el-table-column> - <el-table-column prop="name" label="绔欑偣鍚嶇О" sortable min-width="100px" align="center"></el-table-column> - <el-table-column prop="createTime" label="鏈�鍚庨�氳鏃堕棿" sortable min-width="100px" align="center"></el-table-column> - <el-table-column - v-if="containPermissions(['business:sites:update', 'business:sites:delete'])" - label="鎿嶄綔" - min-width="160" - align="center" - fixed="right" - > + <el-table @selection-change="handleSelectionChange" v-loading="isWorking.search" :data="tableData.list" stripe + border> + <el-table-column type="selection" width="55" align="center"></el-table-column> + <el-table-column prop="code" label="杞﹁締缂栫爜" min-width="100px" align="center"></el-table-column> + <el-table-column prop="paramName" label="杞﹁締绫诲瀷" min-width="100px" align="center"></el-table-column> + <el-table-column prop="deviceSn" label="鎺у埗鍣⊿N" min-width="100px" align="center"></el-table-column> + <el-table-column prop="voltage" label="褰撳墠鐢靛帇鍊�" sortable min-width="100px" align="center"></el-table-column> + <el-table-column label="鐢甸噺鎯呭喌" width="80px" align="center"> + <template v-slot="{ row }"> + <span :class="{ red: row.lowVoltage == 1 }">{{ row.lowVoltage == 0 ? '姝e父' : '浣庣數閲�' }}</span> + </template> + </el-table-column> + <el-table-column prop="siteId" label="绔欑偣缂栧彿" min-width="100px" align="center"></el-table-column> + <el-table-column prop="siteName" label="绔欑偣鍚嶇О" min-width="100px" align="center"></el-table-column> + <el-table-column prop="heartDate" label="鏈�鍚庨�氳鏃堕棿" min-width="100px" align="center"></el-table-column> + <el-table-column v-if="containPermissions(['business:sites:update', 'business:sites:delete'])" label="鎿嶄綔" + min-width="160" align="center" fixed="right"> <template slot-scope="{row}"> - <el-button type="text" @click="$refs.QRcode.open('鏌ョ湅浜岀淮鐮�', row.code)" icon="el-icon-picture-outline-round">鏌ョ湅浜岀淮鐮�</el-button> - <el-button type="text" @click="$refs.TramEditRef.open('缂栬緫杞﹁締', row)" icon="el-icon-edit" v-permissions="['business:sites:update']">缂栬緫</el-button> - <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:sites:delete']">鍒犻櫎</el-button> + <el-button type="text" @click="handlePri(row)" icon="el-icon-picture-outline-round">鏌ョ湅浜岀淮鐮�</el-button> + <el-button type="text" @click="$refs.TramEditRef.open('缂栬緫杞﹁締', row)" icon="el-icon-edit" + v-permissions="['business:sites:update']">缂栬緫</el-button> + <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" + v-permissions="['business:sites:delete']">鍒犻櫎</el-button> </template> </el-table-column> </el-table> - <pagination - @size-change="handleSizeChange" - @current-change="handlePageChange" - :pagination="tableData.pagination" - > + <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> </pagination> </template> <!-- 鏂板缓/淇敼 --> - <TramEdit ref="TramEditRef" @success="handlePageChange"/> - <!-- 鏌ョ湅浜岀淮鐮� --> - <QRcode ref="QRcode" /> + <TramEdit ref="TramEditRef" @success="search" /> + <el-dialog title="鏌ョ湅浜岀淮鐮�" :visible.sync="isShowPri" width="600px"> + <div style="display: flex;align-items: center;justify-content: center;"> + <el-image style="width: 500px; height: 500px" :src="imgurl" :preview-src-list="[imgurl]"></el-image> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="isShowPri = false">鍙� 娑�</el-button> + <el-button type="primary" @click="isShowPri = false">纭� 瀹�</el-button> + </span> + </el-dialog> + <QRcode ref="QRcodeRef" /> + <!-- <ImportWindow ref="ImportWindowRef" templateName="鐢佃溅淇℃伅妯℃澘" /> --> </TableLayout> </template> @@ -71,12 +82,16 @@ import TableLayout from '@/layouts/TableLayout' import Pagination from '@/components/common/Pagination' import TramEdit from './components/TramEdit.vue' -import QRcode from '@/components/business/QRcode' +import QRcode from './components/QRcode' +import ImportButton from '@/components/common/ImportButton' +import { tranListPost } from '@/api/business/bikes.js' +import { qrcodeBike, qrcodeBikeList, deleteBatchById } from '@/api/business/bikes.js' +import { Message } from 'element-ui' export default { - name: 'Sites', + name: 'bikes', extends: BaseTable, - components: { TableLayout, Pagination, TramEdit, QRcode }, - data () { + components: { TableLayout, Pagination, TramEdit, QRcode, ImportButton }, + data() { return { // 鎼滅储 searchForm: { @@ -92,18 +107,122 @@ status: '', lockNum: '', ip: '', + type: 1, clientVersion: '' - } + }, + imgurl: '', + isShowPri: false, + downLoading: false, + + selList: [] } }, - created () { + created() { this.config({ module: '绔欑偣淇℃伅琛�', - api: '/business/sites', + api: '/business/bikes', 'field.id': 'id', 'field.main': 'id' }) this.search() + }, + methods: { + handleSelectionChange(val) { + this.selList = val + console.log(val) + + }, + handleDelAll() { + const { selList } = this + if (selList.length == 0) return Message.warning('璇峰厛閫夋嫨瑕佸垹闄ょ殑杞﹁締') + this.$confirm('鎮ㄧ‘璁よ鍒犻櫎閫変腑鐨勮溅杈嗗悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }).then(() => { + deleteBatchById({ ids: selList.map(i => i.id).join() }).then(res => { + if (res) { + this.search(1) + Message.success('鍒犻櫎鎴愬姛') + } + }) + }) + }, + handlePri(row) { + this.imgurl = null + qrcodeBike({ fouce: 0, bikeId: row.id }).then(res => { + if (res && res.imgurl) { + this.imgurl = res.imgurl + this.isShowPri = true + } + }) + }, + handleDownAll() { + this.downLoading = true + qrcodeBikeList({ fouce: 0 }).then(res => { + this.downLoading = false + this.$refs.QRcodeRef.list = res + this.$refs.QRcodeRef.visible = true + }, () => { + this.downLoading = false + }) + }, + search(pageIndex) { + this.tableData.pagination.pageIndex = pageIndex || this.tableData.pagination.pageIndex + this.isWorking.search = true + tranListPost({ + page: this.tableData.pagination.pageIndex, + capacity: this.tableData.pagination.pageSize, + model: this.searchForm, + sorts: this.tableData.sorts + }) + .then(data => { + this.tableData.list = data.records + this.tableData.pagination.total = data.total + }) + .catch(e => { + this.$tip.apiFailed(e) + }) + .finally(() => { + this.isWorking.search = false + }) + }, + handleSizeChange(pageSize) { + this.tableData.pagination.pageSize = pageSize + this.search() + }, + // 鎺掑簭 + handleSortChange(sortData) { + this.tableData.sorts = [] + if (sortData.order != null) { + this.tableData.sorts.push({ + property: sortData.column.sortBy, + direction: sortData.order === 'descending' ? 'DESC' : 'ASC' + }) + } + this.handlePageChange() + }, + // 椤电爜鍙樻洿澶勭悊 + handlePageChange(pageIndex) { + this.tableData.pagination.pageIndex = pageIndex || this.tableData.pagination.pageIndex + this.isWorking.search = true + tranListPost({ + page: this.tableData.pagination.pageIndex, + capacity: this.tableData.pagination.pageSize, + model: this.searchForm, + sorts: this.tableData.sorts + }) + .then(data => { + this.tableData.list = data.records + this.tableData.pagination.total = data.total + }) + .catch(e => { + this.$tip.apiFailed(e) + }) + .finally(() => { + this.isWorking.search = false + }) + }, } } </script> -- Gitblit v1.9.3