| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <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="æ£å¸¸" :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="æ§å¶å¨SN" 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 ? 'æ£å¸¸' : 'ä½çµé' }}</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> |