| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- <template>
- <div class="search-bar">
- <!-- <div v-for="device in devices"
- class="bo">
- <div class="bo-top">
- <div class="top-co1">
- <img src="../assets/images/on.png"
- width="20"
- v-if="device.DState == 1">
- <img src="../assets/images/off.png"
- width="20"
- v-else>
- </div>
- <div class="top-co2">
- <div class="row">
- <span class="t-font power ">操作人: {{device.SendTo}}</span>
- </div>
- <div class="row">
- <span class="t-font power">操作时间: {{jstimehandl(device.CreateOn)}}</span>
- </div>
- </div>
- </div>
- </div> -->
- <el-table ref="singleTable"
- :data="devices"
- highlight-current-row
- width="100%">
- <el-table-column type="index"
- width="36">
- </el-table-column>
- <el-table-column property="SendTo"
- label="开锁人"
- align="center">
- </el-table-column>
- <el-table-column property="CreateOn"
- label="开锁时间"
- width="160"
- align="center">
- <template scope="scope">
- {{jstimehandl(scope.row.CreateOn)}}
- </template>
- </el-table-column>
- <el-table-column property="IsSend"
- label="开锁状态"
- align="center">
- <template scope="scope">
- <el-tag size="mini"
- type="success">{{'成功'}}</el-tag>
- </template>
- </el-table-column>
- </el-table>
- <el-pagination small
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page.sync="currentPage"
- :page-size="size"
- layout="total, prev, pager, next"
- :total="currentItemCount">
- </el-pagination>
- </div>
- </template>
- <script>
- import {
- Tab,
- TabItem,
- Loading,
- Datetime,
- Box,
- XButton,
- Popup,
- Group,
- Cell
- } from 'vux'
- import axios from 'axios'
- import DataChart from '../components/datachart.vue'
- // import moment from 'moment'
- export default {
- name: 'devicedetail',
- components: {
- Tab,
- TabItem,
- Loading,
- Datetime,
- Box,
- XButton,
- Popup,
- Group,
- Cell,
- DataChart
- },
- data () {
- return {
- isLoading: false,
- loadingText: '',
- devices: [],
- currentItemCount: 0,
- currentPage: 1,
- size: 20,
- cid: ''
- }
- },
- created () {
- let routeparams = this.$route.params.cid.split('_')
- this.cid = routeparams[0]
- this.initData(this.cid)
- // this.dataItem = routeparams[1]
- // this.cname = routeparams[2]
- // if (this.contains(this.items1, this.dataItem)) {
- // this.seriesData = [{name: '温度', unit: '℃'}, {name: '湿度', unit: '%'}]
- // } else if (this.contains(this.items2, this.dataItem)) {
- // this.seriesData = [{name: '温度', unit: '℃'}]
- // } else if (this.contains(this.itemo2Alone, this.dataItem)) {
- // this.seriesData = [{name: '氧气', unit: '%'}]
- // } else if (this.contains(this.itemo2, this.dataItem)) {
- // this.seriesData = [{name: '温度', unit: '℃'}, {name: '湿度', unit: '%'}, {name: '氧气', unit: '%'}]
- // } else if (this.contains(this.itemco2, this.dataItem)) {
- // this.seriesData = [{name: '温度', unit: '℃'}, {name: '湿度', unit: '%'}, {name: '二氧化碳', unit: '%'}]
- // } else if (this.contains(this.itemco2Alone, this.dataItem)) {
- // this.seriesData = [{name: '二氧化碳', unit: '%'}]
- // } else if (this.contains(this.itempower, this.dataItem)) {
- // this.seriesData = [{name: '功率', unit: 'W'}, {name: '电量', unit: 'V'}]
- // }
- // this.$services.channel.get('datavalue/' + this.cid, null)
- // .then(res => {
- // this.lastdata = res.data
- // this.lasttimeutc = this.getDate(this.lastdata.Time).getTime() / 1000 + ''
- // this.getChartData()
- // })
- },
- methods: {
- initData (code) {
- let _this = this
- // request
- axios.request({
- method: 'get',
- url: 'http://iot.labsop.cn:12001/api/remote_control/gettriggerhistory?current=' + this.currentPage + '&size=' + this.size + '&code=' + code
- }).then(res => {
- _this.devices = res.data.data.records
- _this.currentItemCount = res.data.data.total
- }).catch(error => {
- console.log(error)
- })
- },
- jstimehandl (val) {
- val = val.replace('T', ' ')
- return val.substring(0, 19)
- },
- handleSizeChange (value) {
- this.size = value
- this.currentPage = 1
- this.initData(this.cid)
- },
- handleCurrentChange (value) {
- this.currentPage = value
- this.initData(this.cid)
- },
- formatLongString (str, len) {
- return str.length > len ? str.substring(0, len) + '...' : str;
- }
- }
- }
- </script>
- <style type="text/css">
- html,
- body {
- background-color: #eeeeee;
- color: #424242;
- }
- .loadmore {
- text-align: center;
- padding: 10px;
- color: #9e9e9e;
- }
- .search-bar {
- border-bottom: 1px solid #e0e0e0;
- background-color: #f5f5f5;
- display: block;
- padding: 10px;
- }
- .search-input {
- padding: 4px 0;
- border-radius: 6px;
- background-color: white;
- height: 10px;
- }
- .bo {
- background-color: white;
- margin: 10px;
- border-radius: 2px;
- -webkit-box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.4);
- -moz-box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.4);
- box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.4);
- }
- .bo-top {
- padding: 10px;
- border-bottom: 1px solid #f5f5f5;
- border-top-left-radius: 2px;
- border-top-right-radius: 2px;
- }
- .top-co1 {
- width: 10%;
- display: table-cell;
- vertical-align: middle;
- }
- .top-co2 {
- width: 90%;
- display: table-cell;
- vertical-align: middle;
- }
- .top-co3 {
- width: 10%;
- display: table-cell;
- vertical-align: middle;
- }
- .top-co3 img {
- display: block;
- }
- .bo-bottom {
- text-align: left;
- padding: 10px;
- border-bottom-left-radius: 2px;
- border-bottom-right-radius: 2px;
- }
- .bo-cell {
- text-align: center;
- border-right: 1px solid #f5f5f5;
- display: inline-block;
- width: 32%;
- }
- .bo-cell:last-child {
- border: none;
- }
- .t-time {
- font-size: 14px;
- font-weight: light;
- color: #9e9e9e;
- }
- .t-font {
- display: block;
- font-size: 14px;
- font-weight: lighter;
- font-family: "Oswald";
- }
- .temperature {
- color: #ef5350;
- }
- .el-pagination {
- margin: 1rem 0 2rem;
- text-align: right;
- }
- .humidity {
- color: #29b6f6;
- }
- .co2 {
- color: #ffa726;
- }
- .o2 {
- color: #673ab7;
- }
- .power {
- color: #4caf50;
- }
- .t-desc {
- display: block;
- font-size: 11px;
- color: #9e9e9e;
- }
- .t-desc > img {
- margin-left: 4px;
- }
- .t-dot {
- color: #f44336;
- }
- .row {
- display: inline-block;
- width: 100%;
- height: 24px;
- line-height: 24px;
- }
- .row img {
- margin-top: 2px;
- margin-right: 4px;
- float: left;
- }
- .status-box {
- display: block;
- width: 16px;
- height: 16px;
- border-radius: 8px;
- margin-right: 8px;
- }
- .right-align {
- text-align: right;
- }
- </style>
|