| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <TableLayout :permissions="['business:device:query']"> |
| | | <!-- æç´¢è¡¨å --> |
| | | <div ref="QueryFormRef" slot="search-form"> |
| | | <el-form ref="searchForm" :model="searchForm" label-width="100px" inline> |
| | | <el-form-item title="åç§°" prop="name"> |
| | | <el-input v-model="searchForm.name" placeholder="请è¾å
¥åç§°" @keypress.enter.native="search"></el-input> |
| | | </el-form-item> |
| | | <section> |
| | | <el-button type="primary" @click="search">æç´¢</el-button> |
| | | <el-button @click="reset">éç½®</el-button> |
| | | </section> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <!-- è¡¨æ ¼åå页 --> |
| | | <template v-slot:table-wrap> |
| | | <ul class="toolbar"> |
| | | <li><el-button type="primary" @click="synchronousData">忥</el-button></li> |
| | | </ul> |
| | | <el-table :max-height="tableHeight" v-loading="isWorking.search" :data="tableData.list" stripe> |
| | | <el-table-column label="åºå·" width="55" fixed><template slot-scope="scope">{{ scope.$index + 1 |
| | | }}</template></el-table-column> |
| | | <el-table-column prop="name" label="设å¤åç§°"></el-table-column> |
| | | <el-table-column prop="manufature" label="åå"></el-table-column> |
| | | <el-table-column prop="no" label="设å¤ç¼å·"></el-table-column> |
| | | <el-table-column prop="online" label="å¨çº¿ç¶æ"> |
| | | <template slot-scope="{row}"> |
| | | <span v-if="row.online == 0">离线</span> |
| | | <span v-if="row.online == 1">å¨çº¿</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="ip" label="设å¤ip"></el-table-column> |
| | | <el-table-column prop="port" label="设å¤ç«¯å£"></el-table-column> |
| | | <el-table-column v-if="containPermissions(['business:device:update'])" label="æä½" min-width="120" fixed="right"> |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" @click="$refs.OperaDeviceLedWindow.open('è®¾ç½®å±æ¾å
容', row)" icon="el-icon-edit" |
| | | v-permissions="['business:device:update']">è®¾ç½®å±æ¾å
容</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> |
| | | </pagination> |
| | | </template> |
| | | <!-- æ°å»º/ä¿®æ¹ --> |
| | | <OperaDeviceLedWindow ref="OperaDeviceLedWindow" @success="handlePageChange" /> |
| | | </TableLayout> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseTable from '@/components/base/BaseTable' |
| | | import TableLayout from '@/layouts/TableLayout' |
| | | import Pagination from '@/components/common/Pagination' |
| | | import OperaDeviceLedWindow from '@/components/business/OperaDeviceLedWindow' |
| | | import { syncDevices, updateEntranceById } from '@/api/business/device' |
| | | export default { |
| | | name: 'Device', |
| | | extends: BaseTable, |
| | | components: { TableLayout, Pagination, OperaDeviceLedWindow }, |
| | | data() { |
| | | return { |
| | | // æç´¢ |
| | | searchForm: { |
| | | doorName: '', |
| | | regionPathName: '', |
| | | isEntrance: '', |
| | | online: '', |
| | | type: 2 |
| | | }, |
| | | options: [] |
| | | } |
| | | }, |
| | | created() { |
| | | this.config({ |
| | | module: '设å¤ä¿¡æ¯è¡¨', |
| | | api: '/business/device', |
| | | 'field.id': 'id', |
| | | 'field.main': 'id' |
| | | }) |
| | | this.search() |
| | | }, |
| | | mounted() { |
| | | this.$nextTick(() => { |
| | | this.tableHeight = document.body.scrollHeight - this.$refs.QueryFormRef.offsetHeight - 300 |
| | | }) |
| | | }, |
| | | methods: { |
| | | changeManufature(e, row) { |
| | | updateEntranceById({ |
| | | id: row.id, |
| | | isEntrance: e |
| | | }) |
| | | }, |
| | | synchronousData() { |
| | | this.$dialog.actionConfirm('æä½ç¡®è®¤æé', 'æ¨ç¡®è®¤åæ¥å
¨é¨ä¿¡æ¯åï¼') |
| | | .then(() => { |
| | | this.isWorking.delete = true |
| | | syncDevices({ type: 2 }) |
| | | .then(res => { |
| | | this.$tip.apiSuccess(res || '忥æå') |
| | | this.search() |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking.delete = false |
| | | }) |
| | | }) |
| | | .catch(() => { }) |
| | | } |
| | | } |
| | | } |
| | | </script> |