<template> <div class="product_container"> <div class="productData"> <data-info-item :img="require('@/assets/kitchen/设备数.png')" :number="statistics.activeDeviceQuantity" :title="'累计激活设备数'" :unit="'个'" ></data-info-item> <data-info-item :img="require('@/assets/kitchen/设备在线数.png')" :number="statistics.onlineDeviceQuantity" :title="'今日设备在线数'" :unit="'个'" class="middle" ></data-info-item> <data-info-item :img="require('@/assets/kitchen/在线率.png')" :number="statistics.onlineDeviceRatio" :title="'今日设备在线率'" :unit="''" ></data-info-item> </div> <div class="productFun"> <div class="productInput"> SN码 <div class="inputBox" style="width: 120px"> <el-input placeholder="请入SN码" v-model="selectInfo.snCode" clearable class="product-input" > </el-input> </div> 设备型号 <div class="inputBox" style="width: 144px"> <el-input placeholder="请入设备型号" v-model="selectInfo.productCode" clearable class="product-input" > </el-input> </div> 设备品类 <div class="inputBox" style="width: 194px"> <el-select v-model="selectInfo.brandName" filterable clearable placeholder="请输入或选则设备类型"> <el-option v-for="item in categoryList" :key="item.id" :label="item.categoryName" :value="item.categoryName" > </el-option> </el-select> </div> 设备状态 <div class="inputBox" style="width: 90px"> <el-select v-model="selectInfo.deviceStatus" filterable clearable placeholder="" > <el-option v-for="item in DevState" :key="item.value" :label="item.label" :value="item.value" > </el-option> </el-select> </div> 是否绑定用户 <div class="inputBox" style="width: 70px"> <el-select v-model="selectInfo.deviceBindUser" filterable clearable placeholder=""> <el-option v-for="item in userBind" :key="item.value" :label="item.label" :value="item.value" > </el-option> </el-select> </div> </div> <div class="productBtn"> <el-button type="primary" icon="el-icon-search" class="btnItem" @click="selectData">查询</el-button > <el-button type="primary" icon="el-icon-refresh-right" class="btnItem" @click="reset" >重置</el-button > <el-button type="danger" icon="el-icon-delete-solid" class="btnItem bgred" >删除</el-button > <el-button type="primary" icon="el-icon-folder-opened" class="btnItem" >导出</el-button > </div> </div> <el-table :data="tableData.rows" :row-class-name="tableRowClassName" :header-cell-style ="{'text-align': 'center' ,background:' #2483b3',color:'white'}" :row-style="{'text-align': 'center'}" style="width: 100%"> <el-table-column type="selection" width="55"> </el-table-column> <el-table-column prop="index" label="序号"> </el-table-column> <!-- <el-table-column prop="id" label="序号" > </el-table-column> --> <el-table-column prop="snCode" label="SN码" > </el-table-column> <el-table-column prop="brandName" label="设备品牌"> </el-table-column> <el-table-column prop="productCode" label="设备型号"> </el-table-column> <el-table-column prop="createTime" label="生产日期"> </el-table-column> <el-table-column prop="deviceStatus" label="设备状态"> <template slot-scope="scope"> <!-- {{scope.deviceStatus=='1'}} --> <!-- {{scope.row.deviceStatus=='1'}} --> {{scope.row.deviceStatus=='1'?'在线':'离线'}} </template> </el-table-column> <el-table-column prop="deviceActiveTime" label="激活时间"> </el-table-column> <el-table-column prop="deviceActive" label="是否激活"> <template slot-scope="scope"> {{scope.row.deviceActive=='1'?'是':'否'}} </template> </el-table-column> <el-table-column prop="deviceBindUser" label="是否用户绑定设备"> <template slot-scope="scope"> {{scope.row.deviceBindUser=='1'?'是':'否'}} </template> </el-table-column> <el-table-column label="操作"> <template slot-scope="scope"> <el-button @click="showInfo(scope.row)" type="text" size="small">详情</el-button> </template> </el-table-column> </el-table> <!-- 分页组件 --> <group-page :limit ="limit" :total="total" :offset="offset" :count="tableData.total" @setOffset="setOffset" @setLimit ="setLimit" v-model="isFristPage"/> <device-info-dialog :isShowInfo="isShowInfo" @close ="closeInfo" :dataInfo="rowInfo"></device-info-dialog> </div> </template> <script> //组件 import DataInfoItem from "../../components/mycomponent/DataInfoItem.vue"; import deviceInfoDialog from "../../components/mycomponent/dialog/deviceInfoDialog.vue"; import GroupPage from '../../components/mycomponent/groupPage.vue'; //逻辑 import {tableRowClassName} from '../../utils/myUtils/changeTableTr' import { d_listPage ,d_statistics } from '../../api/product/device' import { listMixin,elDataDialog } from '../../utils/myUtils/mixins/listPage' import { C_list } from '../../api/product/category' export default { mixins:[listMixin,elDataDialog], components: { DataInfoItem, deviceInfoDialog, GroupPage }, data() { return { statistics:{}, dataInfo:{}, // 新数据的chushixiang selectInfo:{ // 搜索框中的数据的数据 snCode: "", productCode:"", brandName:"", deviceStatus:"", deviceBindUser:"", }, categoryList:[], DevState:[ { label:'在线', value: '1' }, { label:'离线', value: '0' } ], userBind:[ { label:'是', value: '1' }, { label:'否', value: '0' } ], }; }, mounted(){ // 相关状态获取 d_statistics().then(res =>{ this.statistics =res }) C_list().then(res =>{ console.log(res); this.categoryList= res }) }, methods:{ tableRowClassName:tableRowClassName, // handleClick(rowData){ // this.isShowInfo =true // this.rowId = rowData.id // }, // closeInfo(){ // this.isShowInfo =false // }, // 获取指定页面 getListPage(limit,offset){ d_listPage(`limit=${limit}&offset=${offset}`,this.queryInfo).then(res => { // 得到相关数据 res.rows.forEach((item,index)=>{ item.index =(index+1)+((offset-1)*10) }) this.tableData = res }) }, reset(){ this.selectInfo= { snCode: "", productCode:"", brandName:"", deviceStatus:"", deviceBindUser:"", } this.queryInfo = { ...this.selectInfo} }, } }; </script> <style lang="scss" scoped> .product_container { position: relative; width: 100%; // min-height: 600px; min-height: 700px; overflow: auto; .productData { // min-width:1725px; width: 100%; display: flex; justify-content: center; .middle { margin: 0 30px; } } .productFun { margin: 30px 0; display: flex; justify-content: space-between; .productInput { display: flex; align-items: center; .inputBox { margin: 0 8px; } } .productBtn { .btnItem { margin-right: 10px; border-radius: 5px; // height: 32px; // width: 84px; font-size: 16px; } } } } </style>