Commit 0d6fa19e4ee35aa51b4848e185df596ec1fc50a3

Authored by wuxw
1 parent 300e6aff

admin加入物联网相关功能

src/api/iot/aAccessControlApi.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +// 获取门禁列表
  4 +export function listAdminAccessControl(params) {
  5 + return new Promise((resolve, reject) => {
  6 + request({
  7 + url: '/iot.listAdminAccessControl',
  8 + method: 'get',
  9 + params
  10 + }).then(response => {
  11 + const res = response.data
  12 + if (res.code === 0) {
  13 + resolve({
  14 + data: res.data,
  15 + total: res.total
  16 + })
  17 + } else {
  18 + reject(new Error(res.msg || '获取门禁列表失败'))
  19 + }
  20 + }).catch(error => {
  21 + reject(error)
  22 + })
  23 + })
  24 +}
  25 +
  26 +// 获取管理员小区列表
  27 +export function listAdminCommunitys(params) {
  28 + return new Promise((resolve, reject) => {
  29 + request({
  30 + url: '/community.listAdminCommunitys',
  31 + method: 'get',
  32 + params
  33 + }).then(response => {
  34 + const res = response.data
  35 + if (res.code === 0) {
  36 + resolve({
  37 + data: res.data,
  38 + total: res.total
  39 + })
  40 + } else {
  41 + reject(new Error(res.msg || '获取小区列表失败'))
  42 + }
  43 + }).catch(error => {
  44 + reject(error)
  45 + })
  46 + })
  47 +}
0 \ No newline at end of file 48 \ No newline at end of file
src/api/iot/adminBarrierApi.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +// 获取道闸设备列表
  4 +export function listAdminBarrier(params) {
  5 + return new Promise((resolve, reject) => {
  6 + request({
  7 + url: '/iot.listAdminBarrier',
  8 + method: 'get',
  9 + params
  10 + }).then(response => {
  11 + const res = response.data
  12 + if (res.code === 0) {
  13 + resolve(res)
  14 + } else {
  15 + reject(new Error(res.msg || '获取道闸设备列表失败'))
  16 + }
  17 + }).catch(error => {
  18 + reject(error)
  19 + })
  20 + })
  21 +}
  22 +
  23 +// 获取管理小区列表
  24 +export function listAdminCommunitys(params) {
  25 + return new Promise((resolve, reject) => {
  26 + request({
  27 + url: '/community.listAdminCommunitys',
  28 + method: 'get',
  29 + params
  30 + }).then(response => {
  31 + const res = response.data
  32 + if (res.code === 0) {
  33 + resolve(res)
  34 + } else {
  35 + reject(new Error(res.msg || '获取管理小区列表失败'))
  36 + }
  37 + }).catch(error => {
  38 + reject(error)
  39 + })
  40 + })
  41 +}
0 \ No newline at end of file 42 \ No newline at end of file
src/api/iot/adminChargeMachineApi.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +// 获取充电桩列表
  4 +export function listAdminChargeMachine(params) {
  5 + return new Promise((resolve, reject) => {
  6 + request({
  7 + url: '/iot.listAdminChargeMachine',
  8 + method: 'get',
  9 + params
  10 + }).then(response => {
  11 + const res = response.data
  12 + if (res.code === 0) {
  13 + resolve({
  14 + data: res.data,
  15 + total: res.total,
  16 + records: res.records
  17 + })
  18 + } else {
  19 + reject(new Error(res.msg || '获取充电桩列表失败'))
  20 + }
  21 + }).catch(error => {
  22 + reject(error)
  23 + })
  24 + })
  25 +}
  26 +
  27 +// 获取小区列表
  28 +export function listAdminCommunitys(params) {
  29 + return new Promise((resolve, reject) => {
  30 + request({
  31 + url: '/community.listAdminCommunitys',
  32 + method: 'get',
  33 + params
  34 + }).then(response => {
  35 + const res = response.data
  36 + if (res.code === 0) {
  37 + resolve({
  38 + data: res.data
  39 + })
  40 + } else {
  41 + reject(new Error(res.msg || '获取小区列表失败'))
  42 + }
  43 + }).catch(error => {
  44 + reject(error)
  45 + })
  46 + })
  47 +}
0 \ No newline at end of file 48 \ No newline at end of file
src/api/iot/adminInoutApi.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +// 获取管理员进出记录列表
  4 +export function listAdminAccessControlInout(params) {
  5 + return new Promise((resolve, reject) => {
  6 + request({
  7 + url: '/iot.listAdminAccessControlInout',
  8 + method: 'get',
  9 + params
  10 + }).then(response => {
  11 + const res = response.data
  12 + if (res.code === 0) {
  13 + resolve(res)
  14 + } else {
  15 + reject(new Error(res.msg || 'Failed to get admin access control inout list'))
  16 + }
  17 + }).catch(error => {
  18 + reject(error)
  19 + })
  20 + })
  21 +}
  22 +
  23 +// 获取管理员门禁列表
  24 +export function listAdminAccessControl(params) {
  25 + return new Promise((resolve, reject) => {
  26 + request({
  27 + url: '/iot.listAdminAccessControl',
  28 + method: 'get',
  29 + params
  30 + }).then(response => {
  31 + const res = response.data
  32 + if (res.code === 0) {
  33 + resolve(res)
  34 + } else {
  35 + reject(new Error(res.msg || 'Failed to get admin access control list'))
  36 + }
  37 + }).catch(error => {
  38 + reject(error)
  39 + })
  40 + })
  41 +}
  42 +
  43 +// 获取管理员小区列表
  44 +export function listAdminCommunitys(params) {
  45 + return new Promise((resolve, reject) => {
  46 + request({
  47 + url: '/community.listAdminCommunitys',
  48 + method: 'get',
  49 + params
  50 + }).then(response => {
  51 + const res = response.data
  52 + if (res.code === 0) {
  53 + resolve(res)
  54 + } else {
  55 + reject(new Error(res.msg || 'Failed to get admin community list'))
  56 + }
  57 + }).catch(error => {
  58 + reject(error)
  59 + })
  60 + })
  61 +}
0 \ No newline at end of file 62 \ No newline at end of file
src/api/iot/adminMeterApi.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +// 获取水电表列表
  4 +export function listAdminMeterMachine(params) {
  5 + return new Promise((resolve, reject) => {
  6 + request({
  7 + url: '/iot.listAdminMeterMachine',
  8 + method: 'get',
  9 + params
  10 + }).then(response => {
  11 + const res = response.data
  12 + if (res.code === 0) {
  13 + resolve({
  14 + data: res.data,
  15 + total: res.total
  16 + })
  17 + } else {
  18 + reject(new Error(res.msg || '获取水电表列表失败'))
  19 + }
  20 + }).catch(error => {
  21 + reject(error)
  22 + })
  23 + })
  24 +}
  25 +
  26 +// 获取小区列表
  27 +export function listAdminCommunitys(params) {
  28 + return new Promise((resolve, reject) => {
  29 + request({
  30 + url: '/community.listAdminCommunitys',
  31 + method: 'get',
  32 + params
  33 + }).then(response => {
  34 + const res = response.data
  35 + if (res.code === 0) {
  36 + resolve({
  37 + data: res.data,
  38 + total: res.total
  39 + })
  40 + } else {
  41 + reject(new Error(res.msg || '获取小区列表失败'))
  42 + }
  43 + }).catch(error => {
  44 + reject(error)
  45 + })
  46 + })
  47 +}
0 \ No newline at end of file 48 \ No newline at end of file
src/components/iot/selectAdminCommunity.vue 0 → 100644
  1 +<template>
  2 + <div class="border-radius">
  3 + <div class="margin-xs-r treeview attendance-staff" style="height: 650px;">
  4 + <ul class="list-group text-center border-radius">
  5 + <li
  6 + class="list-group-item node-orgTree"
  7 + v-for="(item,index) in communitys"
  8 + :key="index"
  9 + @click="handleSwatchCommunity(item)"
  10 + :class="{'vc-node-selected': communityId === item.communityId}"
  11 + >
  12 + {{item.name}}
  13 + </li>
  14 + </ul>
  15 + </div>
  16 + </div>
  17 +</template>
  18 +
  19 +<script>
  20 +import { listAdminCommunitys } from '@/api/iot/adminInoutApi'
  21 +
  22 +export default {
  23 + name: 'SelectAdminCommunity',
  24 + data() {
  25 + return {
  26 + communitys: [],
  27 + communityId: ''
  28 + }
  29 + },
  30 + created() {
  31 + this.loadAdminCommunitys()
  32 + },
  33 + methods: {
  34 + async loadAdminCommunitys() {
  35 + try {
  36 + const params = {
  37 + _uid: '123mlkdinkldldijdhuudjdjkkd',
  38 + page: 1,
  39 + row: 100
  40 + }
  41 + const res = await listAdminCommunitys(params)
  42 + this.communitys = [
  43 + { name: this.$t('adminInout.allCommunities'), communityId: '' },
  44 + ...res.data
  45 + ]
  46 + this.handleSwatchCommunity(this.communitys[0])
  47 + } catch (error) {
  48 + console.error('Failed to load communities:', error)
  49 + }
  50 + },
  51 + handleSwatchCommunity(community) {
  52 + this.communityId = community.communityId
  53 + this.$emit('change-community', community)
  54 + }
  55 + }
  56 +}
  57 +</script>
  58 +
  59 +<style scoped>
  60 +.vc-node-selected {
  61 + background-color: #f5f7fa;
  62 + color: #409eff;
  63 +}
  64 +</style>
0 \ No newline at end of file 65 \ No newline at end of file
src/i18n/index.js
@@ -76,6 +76,11 @@ import { messages as adminComplaintMessages } from &#39;../views/complaint/adminComp @@ -76,6 +76,11 @@ import { messages as adminComplaintMessages } from &#39;../views/complaint/adminComp
76 import { messages as adminComplaintDetailMessages } from '../views/complaint/adminComplaintDetailLang' 76 import { messages as adminComplaintDetailMessages } from '../views/complaint/adminComplaintDetailLang'
77 import { messages as adminWorkPoolMessages } from '../views/work/adminWorkPoolLang' 77 import { messages as adminWorkPoolMessages } from '../views/work/adminWorkPoolLang'
78 import { messages as adminWorkDetailMessages } from '../views/work/adminWorkDetailLang' 78 import { messages as adminWorkDetailMessages } from '../views/work/adminWorkDetailLang'
  79 +import { messages as aAccessControlMessages } from '../views/iot/aAccessControlLang'
  80 +import { messages as adminBarrierMessages } from '../views/iot/adminBarrierLang'
  81 +import { messages as adminChargeMachineMessages } from '../views/iot/adminChargeMachineLang'
  82 +import { messages as adminMeterMessages } from '../views/iot/adminMeterLang'
  83 +import { messages as adminInoutMessages } from '../views/iot/adminInoutLang'
79 84
80 Vue.use(VueI18n) 85 Vue.use(VueI18n)
81 86
@@ -156,6 +161,11 @@ const messages = { @@ -156,6 +161,11 @@ const messages = {
156 ...adminComplaintDetailMessages.en, 161 ...adminComplaintDetailMessages.en,
157 ...adminWorkPoolMessages.en, 162 ...adminWorkPoolMessages.en,
158 ...adminWorkDetailMessages.en, 163 ...adminWorkDetailMessages.en,
  164 + ...aAccessControlMessages.en,
  165 + ...adminBarrierMessages.en,
  166 + ...adminChargeMachineMessages.en,
  167 + ...adminMeterMessages.en,
  168 + ...adminInoutMessages.en,
159 }, 169 },
160 zh: { 170 zh: {
161 ...loginMessages.zh, 171 ...loginMessages.zh,
@@ -232,6 +242,11 @@ const messages = { @@ -232,6 +242,11 @@ const messages = {
232 ...adminComplaintDetailMessages.zh, 242 ...adminComplaintDetailMessages.zh,
233 ...adminWorkPoolMessages.zh, 243 ...adminWorkPoolMessages.zh,
234 ...adminWorkDetailMessages.zh, 244 ...adminWorkDetailMessages.zh,
  245 + ...aAccessControlMessages.zh,
  246 + ...adminBarrierMessages.zh,
  247 + ...adminChargeMachineMessages.zh,
  248 + ...adminMeterMessages.zh,
  249 + ...adminInoutMessages.zh,
235 } 250 }
236 } 251 }
237 252
src/router/index.js
@@ -366,6 +366,31 @@ const routes = [ @@ -366,6 +366,31 @@ const routes = [
366 name: '/views/work/adminWorkDetail', 366 name: '/views/work/adminWorkDetail',
367 component: () => import('@/views/work/adminWorkDetailList.vue') 367 component: () => import('@/views/work/adminWorkDetailList.vue')
368 }, 368 },
  369 + {
  370 + path: '/pages/iot/aAccessControl',
  371 + name: '/pages/iot/aAccessControl',
  372 + component: () => import('@/views/iot/aAccessControlList.vue')
  373 + },
  374 + {
  375 + path: '/pages/iot/adminBarrier',
  376 + name: '/pages/iot/adminBarrier',
  377 + component: () => import('@/views/iot/adminBarrierList.vue')
  378 + },
  379 + {
  380 + path: '/pages/iot/adminChargeMachine',
  381 + name: '/pages/iot/adminChargeMachine',
  382 + component: () => import('@/views/iot/adminChargeMachineList.vue')
  383 + },
  384 + {
  385 + path: '/pages/iot/adminMeter',
  386 + name: '/pages/iot/adminMeter',
  387 + component: () => import('@/views/iot/adminMeterList.vue')
  388 + },
  389 + {
  390 + path:'/pages/iot/adminInout',
  391 + name:'/pages/iot/adminInout',
  392 + component: () => import('@/views/iot/adminInoutList.vue')
  393 + },
369 // 其他子路由可以在这里添加 394 // 其他子路由可以在这里添加
370 ] 395 ]
371 }, 396 },
src/views/iot/aAccessControlLang.js 0 → 100644
  1 +export const messages = {
  2 + en: {
  3 + aAccessControl: {
  4 + search: {
  5 + title: 'Search Conditions',
  6 + machineCode: 'Please enter device code',
  7 + machineName: 'Please enter device name',
  8 + locationName: 'Please enter location name'
  9 + },
  10 + list: {
  11 + title: 'Access Control Information'
  12 + },
  13 + table: {
  14 + communityName: 'Community Name',
  15 + machineCode: 'Device Code',
  16 + machineName: 'Device Name',
  17 + machineIp: 'IP',
  18 + machineMac: 'Mac',
  19 + promptSwitch: 'Prompt Switch',
  20 + direction: 'Direction',
  21 + implBean: 'Manufacturer',
  22 + locationName: 'Location',
  23 + stateName: 'Online Status',
  24 + heartbeatTime: 'Heartbeat Time'
  25 + },
  26 + direction: {
  27 + in: 'In',
  28 + out: 'Out'
  29 + },
  30 + fetchError: 'Failed to get access control list'
  31 + }
  32 + },
  33 + zh: {
  34 + aAccessControl: {
  35 + search: {
  36 + title: '查询条件',
  37 + machineCode: '请输入设备编码',
  38 + machineName: '请输入设备名称',
  39 + locationName: '请输入位置名称'
  40 + },
  41 + list: {
  42 + title: '门禁信息'
  43 + },
  44 + table: {
  45 + communityName: '小区名称',
  46 + machineCode: '门禁编码',
  47 + machineName: '门禁名称',
  48 + machineIp: 'IP',
  49 + machineMac: 'Mac',
  50 + promptSwitch: '开门提示',
  51 + direction: '方向',
  52 + implBean: '厂家',
  53 + locationName: '位置',
  54 + stateName: '在线',
  55 + heartbeatTime: '心跳时间'
  56 + },
  57 + direction: {
  58 + in: '进',
  59 + out: '出'
  60 + },
  61 + fetchError: '获取门禁列表失败'
  62 + }
  63 + }
  64 +}
0 \ No newline at end of file 65 \ No newline at end of file
src/views/iot/aAccessControlList.vue 0 → 100644
  1 +<template>
  2 + <div class="access-control-container">
  3 + <el-row :gutter="20">
  4 + <el-col :span="4">
  5 + <select-admin-community @changeCommunity="handleCommunityChange" />
  6 + </el-col>
  7 + <el-col :span="20">
  8 + <el-card class="box-card">
  9 + <div slot="header" class="clearfix flex justify-between">
  10 + <span>{{ $t('aAccessControl.search.title') }}</span>
  11 + </div>
  12 + <el-row :gutter="20">
  13 + <el-col :span="6">
  14 + <el-input v-model="searchForm.machineCode" :placeholder="$t('aAccessControl.search.machineCode')"
  15 + clearable />
  16 + </el-col>
  17 + <el-col :span="6">
  18 + <el-input v-model="searchForm.machineName" :placeholder="$t('aAccessControl.search.machineName')"
  19 + clearable />
  20 + </el-col>
  21 + <el-col :span="6">
  22 + <el-input v-model="searchForm.locationName" :placeholder="$t('aAccessControl.search.locationName')"
  23 + clearable />
  24 + </el-col>
  25 + <el-col :span="6">
  26 + <el-button type="primary" @click="handleSearch">
  27 + {{ $t('common.search') }}
  28 + </el-button>
  29 + </el-col>
  30 + </el-row>
  31 + </el-card>
  32 +
  33 + <el-card class="box-card" style="margin-top: 20px;">
  34 + <div slot="header" class="clearfix flex justify-between">
  35 + <span>{{ $t('aAccessControl.list.title') }}</span>
  36 + </div>
  37 + <el-table v-loading="loading" :data="tableData" border style="width: 100%">
  38 + <el-table-column prop="communityName" :label="$t('aAccessControl.table.communityName')" align="center" />
  39 + <el-table-column prop="machineCode" :label="$t('aAccessControl.table.machineCode')" align="center" />
  40 + <el-table-column prop="machineName" :label="$t('aAccessControl.table.machineName')" align="center" />
  41 + <el-table-column prop="machineIp" :label="$t('aAccessControl.table.machineIp')" align="center">
  42 + <template slot-scope="scope">
  43 + {{ scope.row.machineIp || '-' }}
  44 + </template>
  45 + </el-table-column>
  46 + <el-table-column prop="machineMac" :label="$t('aAccessControl.table.machineMac')" align="center">
  47 + <template slot-scope="scope">
  48 + {{ scope.row.machineMac || '-' }}
  49 + </template>
  50 + </el-table-column>
  51 + <el-table-column prop="promptSwitch" :label="$t('aAccessControl.table.promptSwitch')" align="center">
  52 + <template slot-scope="scope">
  53 + {{ scope.row.promptSwitch === 'ON' ? $t('common.yes') : $t('common.no') }}
  54 + </template>
  55 + </el-table-column>
  56 + <el-table-column prop="direction" :label="$t('aAccessControl.table.direction')" align="center">
  57 + <template slot-scope="scope">
  58 + {{ scope.row.direction === '3306' ? $t('aAccessControl.direction.in') : $t('aAccessControl.direction.out')
  59 + }}
  60 + </template>
  61 + </el-table-column>
  62 + <el-table-column prop="implBean" :label="$t('aAccessControl.table.implBean')" align="center" />
  63 + <el-table-column prop="locationName" :label="$t('aAccessControl.table.locationName')" align="center" />
  64 + <el-table-column prop="stateName" :label="$t('aAccessControl.table.stateName')" align="center" />
  65 + <el-table-column prop="heartbeatTime" :label="$t('aAccessControl.table.heartbeatTime')" align="center" />
  66 + <el-table-column :label="$t('common.operation')" align="center" width="150">
  67 + <template slot-scope="scope">
  68 + <el-button size="mini" type="primary" @click="handleDetail(scope.row)">
  69 + {{ $t('common.detail') }}
  70 + </el-button>
  71 + </template>
  72 + </el-table-column>
  73 + </el-table>
  74 + <el-pagination :current-page.sync="pagination.current" :page-sizes="[10, 20, 30, 50]"
  75 + :page-size="pagination.size" :total="pagination.total" layout="total, sizes, prev, pager, next, jumper"
  76 + @size-change="handleSizeChange" @current-change="handleCurrentChange" />
  77 + </el-card>
  78 + </el-col>
  79 + </el-row>
  80 + </div>
  81 +</template>
  82 +
  83 +<script>
  84 +import { listAdminAccessControl } from '@/api/iot/aAccessControlApi'
  85 +import SelectAdminCommunity from '@/components/community/selectAdminCommunity'
  86 +
  87 +export default {
  88 + name: 'AAccessControlList',
  89 + components: {
  90 + SelectAdminCommunity
  91 + },
  92 + data() {
  93 + return {
  94 + loading: false,
  95 + searchForm: {
  96 + machineCode: '',
  97 + machineName: '',
  98 + locationName: '',
  99 + communityId: ''
  100 + },
  101 + tableData: [],
  102 + pagination: {
  103 + current: 1,
  104 + size: 10,
  105 + total: 0
  106 + }
  107 + }
  108 + },
  109 + created() {
  110 + this.getList()
  111 + },
  112 + methods: {
  113 + async getList() {
  114 + try {
  115 + this.loading = true
  116 + const params = {
  117 + ...this.searchForm,
  118 + page: this.pagination.current,
  119 + row: this.pagination.size
  120 + }
  121 + const { data, total } = await listAdminAccessControl(params)
  122 + this.tableData = data
  123 + this.pagination.total = total
  124 + } catch (error) {
  125 + this.$message.error(this.$t('aAccessControl.fetchError'))
  126 + } finally {
  127 + this.loading = false
  128 + }
  129 + },
  130 + handleSearch() {
  131 + this.pagination.current = 1
  132 + this.getList()
  133 + },
  134 + handleSizeChange(val) {
  135 + this.pagination.size = val
  136 + this.getList()
  137 + },
  138 + handleCurrentChange(val) {
  139 + this.pagination.current = val
  140 + this.getList()
  141 + },
  142 + handleCommunityChange(community) {
  143 + this.searchForm.communityId = community.communityId
  144 + this.handleSearch()
  145 + },
  146 + handleDetail(row) {
  147 + this.$router.push({
  148 + path: '/iot/aAccessControlDetail',
  149 + query: { machineId: row.machineId }
  150 + })
  151 + }
  152 + }
  153 +}
  154 +</script>
  155 +
  156 +<style lang="scss" scoped>
  157 +.access-control-container {
  158 + padding: 20px;
  159 +
  160 + .box-card {
  161 + margin-bottom: 20px;
  162 + }
  163 +
  164 + .el-pagination {
  165 + margin-top: 20px;
  166 + text-align: right;
  167 + }
  168 +}
  169 +</style>
0 \ No newline at end of file 170 \ No newline at end of file
src/views/iot/adminBarrierLang.js 0 → 100644
  1 +export const messages = {
  2 + en: {
  3 + adminBarrier: {
  4 + allCommunities: 'All Communities',
  5 + search: {
  6 + title: 'Search Conditions',
  7 + machineCode: 'Please enter device code',
  8 + machineName: 'Please enter device name'
  9 + },
  10 + list: {
  11 + title: 'Barrier Devices'
  12 + },
  13 + table: {
  14 + communityName: 'Community Name',
  15 + machineCode: 'Device Code',
  16 + machineName: 'Device Name',
  17 + machineIp: 'Device IP',
  18 + direction: 'Direction',
  19 + implBeanName: 'Manufacturer',
  20 + boxName: 'Box',
  21 + stateName: 'Status',
  22 + monitorName: 'Monitor',
  23 + heartbeatTime: 'Heartbeat Time',
  24 + createTime: 'Create Time'
  25 + },
  26 + direction: {
  27 + in: 'In',
  28 + out: 'Out'
  29 + }
  30 + }
  31 + },
  32 + zh: {
  33 + adminBarrier: {
  34 + allCommunities: '全部小区',
  35 + search: {
  36 + title: '查询条件',
  37 + machineCode: '请输入设备编码',
  38 + machineName: '请输入设备名称'
  39 + },
  40 + list: {
  41 + title: '道闸设备'
  42 + },
  43 + table: {
  44 + communityName: '小区名称',
  45 + machineCode: '设备编码',
  46 + machineName: '设备名称',
  47 + machineIp: '设备IP',
  48 + direction: '设备方向',
  49 + implBeanName: '道闸厂家',
  50 + boxName: '岗亭',
  51 + stateName: '状态',
  52 + monitorName: '监控',
  53 + heartbeatTime: '心跳时间',
  54 + createTime: '创建时间'
  55 + },
  56 + direction: {
  57 + in: '进',
  58 + out: '出'
  59 + }
  60 + }
  61 + }
  62 +}
0 \ No newline at end of file 63 \ No newline at end of file
src/views/iot/adminBarrierList.vue 0 → 100644
  1 +<template>
  2 + <div>
  3 + <el-row :gutter="20">
  4 + <el-col :span="4" class="padding-r-0">
  5 + <select-admin-community @changeCommunity="handleCommunityChange" />
  6 + </el-col>
  7 + <el-col :span="20">
  8 + <el-card class="box-card">
  9 + <div slot="header" class="clearfix flex justify-between">
  10 + <span>{{ $t('adminBarrier.search.title') }}</span>
  11 + </div>
  12 + <el-row :gutter="20">
  13 + <el-col :span="6">
  14 + <el-input :placeholder="$t('adminBarrier.search.machineCode')"
  15 + v-model="adminBarrierInfo.conditions.machineCode" class="form-control" />
  16 + </el-col>
  17 + <el-col :span="6">
  18 + <el-input :placeholder="$t('adminBarrier.search.machineName')"
  19 + v-model="adminBarrierInfo.conditions.machineName" class="form-control" />
  20 + </el-col>
  21 + <el-col :span="4">
  22 + <el-button type="primary" size="small" @click="_queryAdminBarrierMethod()">
  23 + <i class="el-icon-search"></i>
  24 + <span>{{ $t('common.search') }}</span>
  25 + </el-button>
  26 + </el-col>
  27 + </el-row>
  28 + </el-card>
  29 +
  30 + <el-card class="box-card margin-top">
  31 + <div slot="header" class="clearfix flex justify-between">
  32 + <span>{{ $t('adminBarrier.list.title') }}</span>
  33 + </div>
  34 + <el-table :data="adminBarrierInfo.barriers" border style="width: 100%" v-loading="loading">
  35 + <el-table-column prop="communityName" :label="$t('adminBarrier.table.communityName')" align="center" />
  36 + <el-table-column prop="machineCode" :label="$t('adminBarrier.table.machineCode')" align="center" />
  37 + <el-table-column prop="machineName" :label="$t('adminBarrier.table.machineName')" align="center" />
  38 + <el-table-column prop="machineIp" :label="$t('adminBarrier.table.machineIp')" align="center" />
  39 + <el-table-column :label="$t('adminBarrier.table.direction')" align="center">
  40 + <template slot-scope="scope">
  41 + {{ scope.row.direction === '3306' ? $t('adminBarrier.direction.in') : $t('adminBarrier.direction.out') }}
  42 + </template>
  43 + </el-table-column>
  44 + <el-table-column prop="implBeanName" :label="$t('adminBarrier.table.implBeanName')" align="center" />
  45 + <el-table-column prop="boxName" :label="$t('adminBarrier.table.boxName')" align="center" />
  46 + <el-table-column prop="stateName" :label="$t('adminBarrier.table.stateName')" align="center" />
  47 + <el-table-column prop="monitorName" :label="$t('adminBarrier.table.monitorName')" align="center" />
  48 + <el-table-column prop="heartbeatTime" :label="$t('adminBarrier.table.heartbeatTime')" align="center" />
  49 + <el-table-column prop="createTime" :label="$t('adminBarrier.table.createTime')" align="center" />
  50 + </el-table>
  51 +
  52 + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  53 + :current-page="adminBarrierInfo.conditions.page" :page-sizes="[10, 20, 30, 50]"
  54 + :page-size="adminBarrierInfo.conditions.row" layout="total, sizes, prev, pager, next, jumper"
  55 + :total="adminBarrierInfo.total" class="pagination" />
  56 + </el-card>
  57 + </el-col>
  58 + </el-row>
  59 + </div>
  60 +</template>
  61 +
  62 +<script>
  63 +import SelectAdminCommunity from '@/components/community/selectAdminCommunity'
  64 +import { listAdminBarrier } from '@/api/iot/adminBarrierApi'
  65 +
  66 +export default {
  67 + name: 'AdminBarrierList',
  68 + components: {
  69 + SelectAdminCommunity
  70 + },
  71 + data() {
  72 + return {
  73 + loading: false,
  74 + adminBarrierInfo: {
  75 + barriers: [],
  76 + parkingBoxs: [],
  77 + total: 0,
  78 + records: 1,
  79 + moreCondition: false,
  80 + machineId: '',
  81 + conditions: {
  82 + machineCode: '',
  83 + machineName: '',
  84 + boxId: '',
  85 + communityId: '',
  86 + page: 1,
  87 + row: 10
  88 + }
  89 + }
  90 + }
  91 + },
  92 + created() {
  93 + this._listAdminBarriers(this.adminBarrierInfo.conditions.page, this.adminBarrierInfo.conditions.row)
  94 + },
  95 + methods: {
  96 + handleCommunityChange(community) {
  97 + this.adminBarrierInfo.conditions.communityId = community.communityId
  98 + this._listAdminBarriers(this.adminBarrierInfo.conditions.page, this.adminBarrierInfo.conditions.row)
  99 + },
  100 + async _listAdminBarriers(page, rows) {
  101 + try {
  102 + this.loading = true
  103 + this.adminBarrierInfo.conditions.page = page
  104 + this.adminBarrierInfo.conditions.row = rows
  105 +
  106 + const res = await listAdminBarrier(this.adminBarrierInfo.conditions)
  107 + this.adminBarrierInfo.total = res.total
  108 + this.adminBarrierInfo.records = res.records
  109 + this.adminBarrierInfo.barriers = res.data
  110 + } catch (error) {
  111 + console.error('请求失败处理', error)
  112 + } finally {
  113 + this.loading = false
  114 + }
  115 + },
  116 + _queryAdminBarrierMethod() {
  117 + this._listAdminBarriers(1, this.adminBarrierInfo.conditions.row)
  118 + },
  119 + handleSizeChange(val) {
  120 + this._listAdminBarriers(this.adminBarrierInfo.conditions.page, val)
  121 + },
  122 + handleCurrentChange(val) {
  123 + this._listAdminBarriers(val, this.adminBarrierInfo.conditions.row)
  124 + }
  125 + }
  126 +}
  127 +</script>
  128 +
  129 +<style scoped>
  130 +.padding-r-0 {
  131 + padding-right: 0;
  132 +}
  133 +
  134 +.pagination {
  135 + margin-top: 20px;
  136 + text-align: right;
  137 +}
  138 +</style>
0 \ No newline at end of file 139 \ No newline at end of file
src/views/iot/adminChargeMachineLang.js 0 → 100644
  1 +export const messages = {
  2 + en: {
  3 + adminChargeMachine: {
  4 + search: {
  5 + title: 'Search Conditions',
  6 + machineName: 'Please enter machine name',
  7 + machineCode: 'Please enter machine code'
  8 + },
  9 + list: {
  10 + title: 'Charge Machines'
  11 + },
  12 + table: {
  13 + communityName: 'Community Name',
  14 + machineName: 'Machine Name',
  15 + machineCode: 'Machine Code',
  16 + factoryName: 'Factory',
  17 + portCount: 'Port Count',
  18 + ruleName: 'Charge Rule',
  19 + chargeTypeName: 'Charge Type',
  20 + stateName: 'Status',
  21 + heartbeatTime: 'Heartbeat Time',
  22 + monitorName: 'Monitor'
  23 + },
  24 + allCommunities: 'All Communities',
  25 + fetchError: 'Failed to fetch charge machines',
  26 + fetchCommunityError: 'Failed to fetch communities'
  27 + }
  28 + },
  29 + zh: {
  30 + adminChargeMachine: {
  31 + search: {
  32 + title: '查询条件',
  33 + machineName: '请输入设备名称',
  34 + machineCode: '请输入设备编号'
  35 + },
  36 + list: {
  37 + title: '充电桩列表'
  38 + },
  39 + table: {
  40 + communityName: '小区名称',
  41 + machineName: '设备名称',
  42 + machineCode: '设备编号',
  43 + factoryName: '厂家',
  44 + portCount: '插槽/桩个数',
  45 + ruleName: '充电规则',
  46 + chargeTypeName: '充电类型',
  47 + stateName: '状态',
  48 + heartbeatTime: '心跳时间',
  49 + monitorName: '监控'
  50 + },
  51 + allCommunities: '全部小区',
  52 + fetchError: '获取充电桩列表失败',
  53 + fetchCommunityError: '获取小区列表失败'
  54 + }
  55 + }
  56 +}
0 \ No newline at end of file 57 \ No newline at end of file
src/views/iot/adminChargeMachineList.vue 0 → 100644
  1 +<template>
  2 + <div class="admin-charge-machine-container">
  3 + <el-row>
  4 + <el-col :span="4">
  5 + <select-admin-community ref="selectCommunity" @changeCommunity="handleCommunityChange"></select-admin-community>
  6 + </el-col>
  7 + <el-col :span="20">
  8 + <el-card class="box-card">
  9 + <div slot="header" class="clearfix">
  10 + <span>{{ $t('adminChargeMachine.search.title') }}</span>
  11 + </div>
  12 + <el-row :gutter="20">
  13 + <el-col :span="6">
  14 + <el-input v-model="searchForm.machineName" :placeholder="$t('adminChargeMachine.search.machineName')"
  15 + clearable @keyup.enter.native="handleSearch">
  16 + </el-input>
  17 + </el-col>
  18 + <el-col :span="6">
  19 + <el-input v-model="searchForm.machineCode" :placeholder="$t('adminChargeMachine.search.machineCode')"
  20 + clearable @keyup.enter.native="handleSearch">
  21 + </el-input>
  22 + </el-col>
  23 + <el-col :span="2">
  24 + <el-button type="primary" @click="handleSearch">{{ $t('common.search') }}</el-button>
  25 + </el-col>
  26 + </el-row>
  27 + </el-card>
  28 +
  29 + <el-card class="box-card" style="margin-top: 20px;">
  30 + <div slot="header" class="clearfix">
  31 + <span>{{ $t('adminChargeMachine.list.title') }}</span>
  32 + </div>
  33 + <el-table v-loading="loading" :data="tableData" border style="width: 100%">
  34 + <el-table-column prop="communityName" :label="$t('adminChargeMachine.table.communityName')" align="center">
  35 + </el-table-column>
  36 + <el-table-column prop="machineName" :label="$t('adminChargeMachine.table.machineName')" align="center">
  37 + </el-table-column>
  38 + <el-table-column prop="machineCode" :label="$t('adminChargeMachine.table.machineCode')" align="center">
  39 + </el-table-column>
  40 + <el-table-column prop="factoryName" :label="$t('adminChargeMachine.table.factoryName')" align="center">
  41 + </el-table-column>
  42 + <el-table-column prop="portCount" :label="$t('adminChargeMachine.table.portCount')" align="center">
  43 + </el-table-column>
  44 + <el-table-column prop="ruleName" :label="$t('adminChargeMachine.table.ruleName')" align="center">
  45 + </el-table-column>
  46 + <el-table-column prop="chargeTypeName" :label="$t('adminChargeMachine.table.chargeTypeName')" align="center">
  47 + </el-table-column>
  48 + <el-table-column prop="stateName" :label="$t('adminChargeMachine.table.stateName')" align="center">
  49 + </el-table-column>
  50 + <el-table-column prop="heartbeatTime" :label="$t('adminChargeMachine.table.heartbeatTime')" align="center">
  51 + </el-table-column>
  52 + <el-table-column prop="monitorName" :label="$t('adminChargeMachine.table.monitorName')" align="center">
  53 + </el-table-column>
  54 + <el-table-column :label="$t('common.operation')" align="center" width="150">
  55 + <template slot-scope="scope">
  56 + <el-button size="mini" @click="handleDetail(scope.row)">
  57 + {{ $t('common.detail') }}
  58 + </el-button>
  59 + </template>
  60 + </el-table-column>
  61 + </el-table>
  62 +
  63 + <el-pagination :current-page.sync="page.current" :page-sizes="[10, 20, 30, 50]" :page-size="page.size"
  64 + :total="page.total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
  65 + @current-change="handleCurrentChange" style="margin-top: 20px;">
  66 + </el-pagination>
  67 + </el-card>
  68 + </el-col>
  69 + </el-row>
  70 + </div>
  71 +</template>
  72 +
  73 +<script>
  74 +import { listAdminChargeMachine } from '@/api/iot/adminChargeMachineApi'
  75 +import SelectAdminCommunity from '@/components/community/selectAdminCommunity'
  76 +
  77 +export default {
  78 + name: 'AdminChargeMachineList',
  79 + components: {
  80 + SelectAdminCommunity
  81 + },
  82 + data() {
  83 + return {
  84 + loading: false,
  85 + searchForm: {
  86 + machineName: '',
  87 + machineCode: '',
  88 + communityId: '',
  89 + chargeType: ''
  90 + },
  91 + tableData: [],
  92 + page: {
  93 + current: 1,
  94 + size: 10,
  95 + total: 0
  96 + }
  97 + }
  98 + },
  99 + created() {
  100 + this.getList()
  101 + },
  102 + methods: {
  103 + async getList() {
  104 + try {
  105 + this.loading = true
  106 + const params = {
  107 + page: this.page.current,
  108 + row: this.page.size,
  109 + ...this.searchForm
  110 + }
  111 + const { data, total } = await listAdminChargeMachine(params)
  112 + this.tableData = data
  113 + this.page.total = total
  114 + } catch (error) {
  115 + this.$message.error(this.$t('adminChargeMachine.fetchError'))
  116 + } finally {
  117 + this.loading = false
  118 + }
  119 + },
  120 + handleSearch() {
  121 + this.page.current = 1
  122 + this.getList()
  123 + },
  124 + handleCommunityChange(community) {
  125 + this.searchForm.communityId = community.communityId
  126 + this.getList()
  127 + },
  128 + handleDetail(row) {
  129 + this.$router.push({ path: '/iot/chargeMachineDetail', query: { machineId: row.machineId } })
  130 + },
  131 + handleSizeChange(val) {
  132 + this.page.size = val
  133 + this.getList()
  134 + },
  135 + handleCurrentChange(val) {
  136 + this.page.current = val
  137 + this.getList()
  138 + }
  139 + }
  140 +}
  141 +</script>
  142 +
  143 +<style lang="scss" scoped>
  144 +.admin-charge-machine-container {
  145 + padding: 20px;
  146 +
  147 + .box-card {
  148 + margin-bottom: 20px;
  149 + }
  150 +
  151 + .clearfix {
  152 + font-weight: bold;
  153 + font-size: 16px;
  154 + }
  155 +}
  156 +</style>
0 \ No newline at end of file 157 \ No newline at end of file
src/views/iot/adminInoutLang.js 0 → 100644
  1 +export const messages = {
  2 + en: {
  3 + adminInout: {
  4 + search: {
  5 + title: 'Search Conditions',
  6 + inputUserName: 'Please enter user name',
  7 + inputPhone: 'Please enter phone number',
  8 + inputStartTime: 'Please enter start time',
  9 + inputEndTime: 'Please enter end time',
  10 + selectAccessControl: 'Please select access control',
  11 + selectOpenStatus: 'Please select open status'
  12 + },
  13 + list: {
  14 + title: 'Access Records'
  15 + },
  16 + table: {
  17 + face: 'Face',
  18 + communityName: 'Community Name',
  19 + number: 'Number',
  20 + deviceName: 'Device Name',
  21 + deviceCode: 'Device Code',
  22 + userName: 'User Name',
  23 + openType: 'Open Type',
  24 + phone: 'Phone',
  25 + idCard: 'ID Card',
  26 + similarity: 'Similarity',
  27 + openStatus: 'Open Status',
  28 + openTime: 'Open Time'
  29 + },
  30 + allCommunities: 'All Communities',
  31 + faceOpen: 'Face Open',
  32 + otherOpen: 'Other',
  33 + openSuccess: 'Open Success',
  34 + openFailed: 'Open Failed'
  35 + }
  36 + },
  37 + zh: {
  38 + adminInout: {
  39 + search: {
  40 + title: '查询条件',
  41 + inputUserName: '请填写用户名称',
  42 + inputPhone: '请填写手机号',
  43 + inputStartTime: '请输入开始时间',
  44 + inputEndTime: '请输入结束时间',
  45 + selectAccessControl: '请选择门禁',
  46 + selectOpenStatus: '请选择开门状态'
  47 + },
  48 + list: {
  49 + title: '进出记录'
  50 + },
  51 + table: {
  52 + face: '人脸',
  53 + communityName: '小区名称',
  54 + number: '编号',
  55 + deviceName: '设备名称',
  56 + deviceCode: '设备编码',
  57 + userName: '用户名称',
  58 + openType: '开门方式',
  59 + phone: '手机号',
  60 + idCard: '用户身份证',
  61 + similarity: '相似度',
  62 + openStatus: '开门状态',
  63 + openTime: '开门时间'
  64 + },
  65 + allCommunities: '全部小区',
  66 + faceOpen: '人脸开门',
  67 + otherOpen: '其他',
  68 + openSuccess: '开门成功',
  69 + openFailed: '开门失败'
  70 + }
  71 + }
  72 +}
0 \ No newline at end of file 73 \ No newline at end of file
src/views/iot/adminInoutList.vue 0 → 100644
  1 +<template>
  2 + <div class="admin-inout-container">
  3 + <el-row :gutter="20">
  4 + <el-col :span="4">
  5 + <select-admin-community @change-community="handleCommunityChange" />
  6 + </el-col>
  7 + <el-col :span="20">
  8 + <el-card class="box-card">
  9 + <div slot="header" class="clearfix flex justify-between">
  10 + <span>{{ $t('adminInout.search.title') }}</span>
  11 + </div>
  12 + <el-row :gutter="20">
  13 + <el-col :span="4">
  14 + <el-select v-model="conditions.machineId" :placeholder="$t('adminInout.search.selectAccessControl')"
  15 + clearable class="w-100">
  16 + <el-option v-for="item in accessControls" :key="item.machineId" :label="item.machineName"
  17 + :value="item.machineId" />
  18 + </el-select>
  19 + </el-col>
  20 + <el-col :span="4">
  21 + <el-input v-model="conditions.name" :placeholder="$t('adminInout.search.inputUserName')" clearable />
  22 + </el-col>
  23 + <el-col :span="4">
  24 + <el-input v-model="conditions.tel" :placeholder="$t('adminInout.search.inputPhone')" clearable />
  25 + </el-col>
  26 + <el-col :span="4">
  27 + <el-select v-model="conditions.state" :placeholder="$t('adminInout.search.selectOpenStatus')" clearable
  28 + class="w-100">
  29 + <el-option :label="$t('adminInout.openSuccess')" value="C" />
  30 + <el-option :label="$t('adminInout.openFailed')" value="F" />
  31 + </el-select>
  32 + </el-col>
  33 + <el-col :span="2">
  34 + <el-button type="primary" @click="handleQuery">
  35 + {{ $t('common.search') }}
  36 + </el-button>
  37 + </el-col>
  38 + </el-row>
  39 + <el-row :gutter="20" class="mt-20">
  40 + <el-col :span="4">
  41 + <el-date-picker v-model="conditions.queryStartTime" type="datetime"
  42 + :placeholder="$t('adminInout.search.inputStartTime')" class="w-100" />
  43 + </el-col>
  44 + <el-col :span="4">
  45 + <el-date-picker v-model="conditions.queryEndTime" type="datetime"
  46 + :placeholder="$t('adminInout.search.inputEndTime')" class="w-100" />
  47 + </el-col>
  48 + </el-row>
  49 + </el-card>
  50 +
  51 + <el-card class="box-card mt-20">
  52 + <div slot="header" class="clearfix flex justify-between">
  53 + <span>{{ $t('adminInout.list.title') }}</span>
  54 + </div>
  55 + <el-table v-loading="loading" :data="adminInouts" border style="width: 100%">
  56 + <el-table-column :label="$t('adminInout.table.face')" align="center">
  57 + <template slot-scope="scope">
  58 + <el-image style="width: 60px; height: 60px; cursor: pointer;"
  59 + :src="scope.row.facePath || '/img/noPhoto.jpg'" :preview-src-list="[scope.row.facePath]" fit="cover" />
  60 + </template>
  61 + </el-table-column>
  62 + <el-table-column prop="communityName" :label="$t('adminInout.table.communityName')" align="center" />
  63 + <el-table-column prop="inoutId" :label="$t('adminInout.table.number')" align="center" />
  64 + <el-table-column prop="machineName" :label="$t('adminInout.table.deviceName')" align="center" />
  65 + <el-table-column prop="machineCode" :label="$t('adminInout.table.deviceCode')" align="center" />
  66 + <el-table-column prop="name" :label="$t('adminInout.table.userName')" align="center" />
  67 + <el-table-column :label="$t('adminInout.table.openType')" align="center">
  68 + <template slot-scope="scope">
  69 + {{ scope.row.openTypeCd === '1000' ? $t('adminInout.faceOpen') : $t('adminInout.otherOpen') }}
  70 + </template>
  71 + </el-table-column>
  72 + <el-table-column prop="tel" :label="$t('adminInout.table.phone')" align="center">
  73 + <template slot-scope="scope">
  74 + {{ scope.row.tel || '-' }}
  75 + </template>
  76 + </el-table-column>
  77 + <el-table-column prop="idCard" :label="$t('adminInout.table.idCard')" align="center">
  78 + <template slot-scope="scope">
  79 + {{ scope.row.idCard || '-' }}
  80 + </template>
  81 + </el-table-column>
  82 + <el-table-column prop="similar" :label="$t('adminInout.table.similarity')" align="center" />
  83 + <el-table-column :label="$t('adminInout.table.openStatus')" align="center">
  84 + <template slot-scope="scope">
  85 + {{ scope.row.state === 'C' ? $t('adminInout.openSuccess') : $t('adminInout.openFailed') }}
  86 + </template>
  87 + </el-table-column>
  88 + <el-table-column prop="createTime" :label="$t('adminInout.table.openTime')" align="center" />
  89 + </el-table>
  90 + <el-pagination class="mt-20" :current-page.sync="page.current" :page-sizes="[10, 20, 30, 50]"
  91 + :page-size="page.size" :total="page.total" layout="total, sizes, prev, pager, next, jumper"
  92 + @size-change="handleSizeChange" @current-change="handleCurrentChange" />
  93 + </el-card>
  94 + </el-col>
  95 + </el-row>
  96 + </div>
  97 +</template>
  98 +
  99 +<script>
  100 +import SelectAdminCommunity from '@/components/community/selectAdminCommunity'
  101 +import { listAdminAccessControlInout, listAdminAccessControl } from '@/api/iot/adminInoutApi'
  102 +
  103 +export default {
  104 + name: 'AdminInoutList',
  105 + components: {
  106 + SelectAdminCommunity
  107 + },
  108 + data() {
  109 + return {
  110 + loading: false,
  111 + adminInouts: [],
  112 + accessControls: [],
  113 + conditions: {
  114 + machineId: '',
  115 + name: '',
  116 + tel: '',
  117 + state: '',
  118 + queryStartTime: '',
  119 + queryEndTime: '',
  120 + communityId: '',
  121 + page: 1,
  122 + row: 10
  123 + },
  124 + page: {
  125 + current: 1,
  126 + size: 10,
  127 + total: 0
  128 + }
  129 + }
  130 + },
  131 + created() {
  132 + this.listAccessControls()
  133 + },
  134 + methods: {
  135 + async listAdminInouts() {
  136 + try {
  137 + this.loading = true
  138 + const res = await listAdminAccessControlInout(this.conditions)
  139 + this.adminInouts = res.data
  140 + this.page.total = res.total
  141 + } catch (error) {
  142 + console.error('Failed to load inout records:', error)
  143 + } finally {
  144 + this.loading = false
  145 + }
  146 + },
  147 + async listAccessControls() {
  148 + try {
  149 + const params = {
  150 + page: 1,
  151 + row: 100,
  152 + communityId: this.conditions.communityId
  153 + }
  154 + const res = await listAdminAccessControl(params)
  155 + this.accessControls = res.data
  156 + } catch (error) {
  157 + console.error('Failed to load access controls:', error)
  158 + }
  159 + },
  160 + handleCommunityChange(community) {
  161 + this.conditions.communityId = community.communityId
  162 + this.listAccessControls()
  163 + this.listAdminInouts()
  164 + },
  165 + handleQuery() {
  166 + this.conditions.page = 1
  167 + this.listAdminInouts()
  168 + },
  169 + handleSizeChange(size) {
  170 + this.conditions.row = size
  171 + this.listAdminInouts()
  172 + },
  173 + handleCurrentChange(current) {
  174 + this.conditions.page = current
  175 + this.listAdminInouts()
  176 + }
  177 + }
  178 +}
  179 +</script>
  180 +
  181 +<style scoped>
  182 +.admin-inout-container {
  183 + padding: 20px;
  184 +}
  185 +
  186 +.mt-20 {
  187 + margin-top: 20px;
  188 +}
  189 +
  190 +.w-100 {
  191 + width: 100%;
  192 +}
  193 +</style>
0 \ No newline at end of file 194 \ No newline at end of file
src/views/iot/adminMeterLang.js 0 → 100644
  1 +export const messages = {
  2 + en: {
  3 + adminMeter: {
  4 + search: {
  5 + title: 'Search Conditions',
  6 + machineName: 'Please enter name',
  7 + address: 'Please enter meter number',
  8 + machineModel: 'Please select model',
  9 + roomName: 'Please enter room number (building-unit-room)'
  10 + },
  11 + table: {
  12 + title: 'Smart Water and Electricity Meter',
  13 + machineId: 'ID',
  14 + communityName: 'Community Name',
  15 + machineName: 'Name',
  16 + address: 'Meter Number',
  17 + meterType: 'Meter Type',
  18 + machineModel: 'Model',
  19 + roomName: 'Room',
  20 + implBeanName: 'Manufacturer',
  21 + degree: 'Current Degree',
  22 + curDegrees: 'Remaining Amount',
  23 + curReadingTime: 'Reading Time',
  24 + stateName: 'Status',
  25 + heartbeatTime: 'Heartbeat Time',
  26 + readlingTime: 'Reading on day {day} at {hour}:00 every month'
  27 + },
  28 + model: {
  29 + recharge: 'Recharge Mode',
  30 + reading: 'Reading Mode'
  31 + },
  32 + community: {
  33 + all: 'All Communities',
  34 + fetchError: 'Failed to load communities'
  35 + },
  36 + fetchError: 'Failed to load meter data'
  37 + }
  38 + },
  39 + zh: {
  40 + adminMeter: {
  41 + search: {
  42 + title: '查询条件',
  43 + machineName: '请输入名称',
  44 + address: '请输入表号',
  45 + machineModel: '请选择模式',
  46 + roomName: '请输入房屋编号(楼栋-单元-房屋)'
  47 + },
  48 + table: {
  49 + title: '智能水电表',
  50 + machineId: '编号',
  51 + communityName: '小区名称',
  52 + machineName: '名称',
  53 + address: '表号',
  54 + meterType: '表类型',
  55 + machineModel: '模式',
  56 + roomName: '房屋',
  57 + implBeanName: '设备厂家',
  58 + degree: '当前度数',
  59 + curDegrees: '剩余金额',
  60 + curReadingTime: '读表时间',
  61 + stateName: '状态',
  62 + heartbeatTime: '心跳时间',
  63 + readlingTime: '每月{day}日{hour}时抄表'
  64 + },
  65 + model: {
  66 + recharge: '充值模式',
  67 + reading: '抄表模式'
  68 + },
  69 + community: {
  70 + all: '全部小区',
  71 + fetchError: '加载小区失败'
  72 + },
  73 + fetchError: '加载水电表数据失败'
  74 + }
  75 + }
  76 +}
0 \ No newline at end of file 77 \ No newline at end of file
src/views/iot/adminMeterList.vue 0 → 100644
  1 +<template>
  2 + <div class="admin-meter-container">
  3 + <el-row :gutter="20">
  4 + <el-col :span="4">
  5 + <select-admin-community @changeCommunity="handleCommunityChange" />
  6 + </el-col>
  7 + <el-col :span="20">
  8 + <el-card class="search-card">
  9 + <div slot="header" class="clearfix flex justify-between">
  10 + <span>{{ $t('adminMeter.search.title') }}</span>
  11 + </div>
  12 + <el-row :gutter="20">
  13 + <el-col :span="6">
  14 + <el-input v-model="searchForm.machineNameLike" :placeholder="$t('adminMeter.search.machineName')"
  15 + clearable />
  16 + </el-col>
  17 + <el-col :span="6">
  18 + <el-input v-model="searchForm.address" :placeholder="$t('adminMeter.search.address')" clearable />
  19 + </el-col>
  20 + <el-col :span="6">
  21 + <el-select v-model="searchForm.machineModel" :placeholder="$t('adminMeter.search.machineModel')" clearable>
  22 + <el-option :label="$t('adminMeter.model.recharge')" value="1001" />
  23 + <el-option :label="$t('adminMeter.model.reading')" value="2002" />
  24 + </el-select>
  25 + </el-col>
  26 + <el-col :span="6">
  27 + <el-input v-model="searchForm.roomNameLike" :placeholder="$t('adminMeter.search.roomName')" clearable />
  28 + </el-col>
  29 + <el-col :span="24" style="margin-top: 10px">
  30 + <el-button type="primary" @click="handleSearch">
  31 + {{ $t('common.search') }}
  32 + </el-button>
  33 + </el-col>
  34 + </el-row>
  35 + </el-card>
  36 +
  37 + <el-card class="table-card">
  38 + <div slot="header" class="clearfix flex justify-between">
  39 + <span>{{ $t('adminMeter.table.title') }}</span>
  40 + </div>
  41 + <el-table v-loading="loading" :data="tableData" border style="width: 100%">
  42 + <el-table-column prop="machineId" :label="$t('adminMeter.table.machineId')" align="center" />
  43 + <el-table-column prop="communityName" :label="$t('adminMeter.table.communityName')" align="center" />
  44 + <el-table-column prop="machineName" :label="$t('adminMeter.table.machineName')" align="center" />
  45 + <el-table-column prop="address" :label="$t('adminMeter.table.address')" align="center" />
  46 + <el-table-column :label="$t('adminMeter.table.meterType')" align="center">
  47 + <template slot-scope="scope">
  48 + {{ getMeterTypeName(scope.row.meterType) }}
  49 + </template>
  50 + </el-table-column>
  51 + <el-table-column :label="$t('adminMeter.table.machineModel')" align="center">
  52 + <template slot-scope="scope">
  53 + {{ scope.row.machineModel === '1001' ? $t('adminMeter.model.recharge') : $t('adminMeter.model.reading') }}
  54 + </template>
  55 + </el-table-column>
  56 + <el-table-column prop="roomName" :label="$t('adminMeter.table.roomName')" align="center" />
  57 + <el-table-column prop="implBeanName" :label="$t('adminMeter.table.implBeanName')" align="center" />
  58 + <el-table-column :label="$t('adminMeter.table.degree')" align="center">
  59 + <template slot-scope="scope">
  60 + {{ scope.row.machineModel === '1001' ? (scope.row.degree || scope.row.prestoreDegrees) : '-' }}
  61 + </template>
  62 + </el-table-column>
  63 + <el-table-column :label="$t('adminMeter.table.curDegrees')" align="center">
  64 + <template slot-scope="scope">
  65 + <span v-if="scope.row.machineModel === '1001'">
  66 + {{ scope.row.curDegrees }}
  67 + </span>
  68 + <span v-else>
  69 + {{ scope.row.curDegrees }}({{ $t('adminMeter.table.readingTime', {
  70 + day: scope.row.readDay, hour:
  71 + scope.row.readHours
  72 + }) }})
  73 + </span>
  74 + </template>
  75 + </el-table-column>
  76 + <el-table-column prop="curReadingTime" :label="$t('adminMeter.table.curReadingTime')" align="center" />
  77 + <el-table-column prop="stateName" :label="$t('adminMeter.table.stateName')" align="center" />
  78 + <el-table-column prop="heartbeatTime" :label="$t('adminMeter.table.heartbeatTime')" align="center" />
  79 + <el-table-column :label="$t('common.operation')" align="center" width="120">
  80 + <template slot-scope="scope">
  81 + <el-button size="mini" @click="handleDetail(scope.row)">
  82 + {{ $t('common.detail') }}
  83 + </el-button>
  84 + </template>
  85 + </el-table-column>
  86 + </el-table>
  87 +
  88 + <el-pagination :current-page.sync="pagination.current" :page-sizes="[10, 20, 30, 50]"
  89 + :page-size="pagination.size" :total="pagination.total" layout="total, sizes, prev, pager, next, jumper"
  90 + @size-change="handleSizeChange" @current-change="handleCurrentChange" />
  91 + </el-card>
  92 + </el-col>
  93 + </el-row>
  94 + </div>
  95 +</template>
  96 +
  97 +<script>
  98 +import SelectAdminCommunity from '@/components/community/selectAdminCommunity'
  99 +import { listAdminMeterMachine } from '@/api/iot/adminMeterApi'
  100 +
  101 +export default {
  102 + name: 'AdminMeterList',
  103 + components: {
  104 + SelectAdminCommunity
  105 + },
  106 + data() {
  107 + return {
  108 + loading: false,
  109 + searchForm: {
  110 + machineNameLike: '',
  111 + address: '',
  112 + machineModel: '',
  113 + roomNameLike: '',
  114 + communityId: ''
  115 + },
  116 + tableData: [],
  117 + meterTypes: [],
  118 + pagination: {
  119 + current: 1,
  120 + size: 10,
  121 + total: 0
  122 + }
  123 + }
  124 + },
  125 + created() {
  126 + this.getList()
  127 + },
  128 + methods: {
  129 + async getList() {
  130 + try {
  131 + this.loading = true
  132 + const params = {
  133 + ...this.searchForm,
  134 + page: this.pagination.current,
  135 + row: this.pagination.size
  136 + }
  137 + const { data, total } = await listAdminMeterMachine(params)
  138 + this.tableData = data
  139 + this.pagination.total = total
  140 + } catch (error) {
  141 + this.$message.error(this.$t('adminMeter.fetchError'))
  142 + } finally {
  143 + this.loading = false
  144 + }
  145 + },
  146 + handleSearch() {
  147 + this.pagination.current = 1
  148 + this.getList()
  149 + },
  150 + handleCommunityChange(community) {
  151 + this.searchForm.communityId = community.communityId
  152 + this.handleSearch()
  153 + },
  154 + handleSizeChange(val) {
  155 + this.pagination.size = val
  156 + this.getList()
  157 + },
  158 + handleCurrentChange(val) {
  159 + this.pagination.current = val
  160 + this.getList()
  161 + },
  162 + getMeterTypeName(meterType) {
  163 + const type = this.meterTypes.find(item => item.typeId === meterType)
  164 + return type ? type.typeName : '-'
  165 + },
  166 + handleDetail(row) {
  167 + this.$router.push({
  168 + path: '/iot/meterDetail',
  169 + query: {
  170 + machineId: row.machineId,
  171 + roomId: row.roomId
  172 + }
  173 + })
  174 + }
  175 + }
  176 +}
  177 +</script>
  178 +
  179 +<style lang="scss" scoped>
  180 +.admin-meter-container {
  181 + padding: 20px;
  182 +
  183 + .search-card {
  184 + margin-bottom: 20px;
  185 + }
  186 +
  187 + .el-select {
  188 + width: 100%;
  189 + }
  190 +}
  191 +</style>
0 \ No newline at end of file 192 \ No newline at end of file