From a836f03a5d1fbfa81e147d09ffdfa87ba3975c13 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 18 三月 2025 16:45:02 +0800
Subject: [PATCH] 1
---
admin/src/views/operation/tram.vue | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 229 insertions(+), 0 deletions(-)
diff --git a/admin/src/views/operation/tram.vue b/admin/src/views/operation/tram.vue
new file mode 100644
index 0000000..65e7cda
--- /dev/null
+++ b/admin/src/views/operation/tram.vue
@@ -0,0 +1,229 @@
+<template>
+ <TableLayout :permissions="['business:sites:query']">
+ <!-- 鎼滅储琛ㄥ崟 -->
+ <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
+ <el-form-item label="杞﹁締缂栧彿" prop="code">
+ <el-input v-model="searchForm.code" placeholder="璇疯緭鍏ヨ溅杈嗙紪鍙�" @keypress.enter.native="search"></el-input>
+ </el-form-item>
+ <el-form-item label="鎵�鍦ㄧ珯鐐�" prop="name">
+ <el-input v-model="searchForm.name" placeholder="璇疯緭鍏ュ悕绉�/缂栫爜" @keypress.enter.native="search"></el-input>
+ </el-form-item>
+ <el-form-item label="鐢甸噺鎯呭喌" prop="lowVoltage">
+ <el-select v-model="searchForm.lowVoltage" placeholder="鐢甸噺鎯呭喌" @change="search">
+ <el-option label="姝e父" :value="0" />
+ <el-option label="鐢甸噺浣�" :value="1" />
+ </el-select>
+ </el-form-item>
+ <section>
+ <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 @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 @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="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>
+ </template>
+ <!-- 鏂板缓/淇敼 -->
+ <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>
+
+<script>
+import BaseTable from '@/components/base/BaseTable'
+import TableLayout from '@/layouts/TableLayout'
+import Pagination from '@/components/common/Pagination'
+import TramEdit from './components/TramEdit.vue'
+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: 'bikes',
+ extends: BaseTable,
+ components: { TableLayout, Pagination, TramEdit, QRcode, ImportButton },
+ data() {
+ return {
+ // 鎼滅储
+ searchForm: {
+ id: '',
+ createDate: '',
+ creator: '',
+ editDate: '',
+ editor: '',
+ isdeleted: '',
+ info: '',
+ name: '',
+ code: '',
+ status: '',
+ lockNum: '',
+ lowVoltage: '',
+ ip: '',
+ type: 1,
+ clientVersion: ''
+ },
+ imgurl: '',
+ isShowPri: false,
+ downLoading: false,
+
+ selList: []
+ }
+ },
+ created() {
+ this.config({
+ module: '绔欑偣淇℃伅琛�',
+ 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