93 lines
2.7 KiB
Vue
93 lines
2.7 KiB
Vue
<template>
|
|
<div>
|
|
<el-table v-loading="loading" :data="deviceList">
|
|
<el-table-column align="center" type="index" label="#"></el-table-column>
|
|
<el-table-column align="center" label="名称" prop="deviceName"></el-table-column>
|
|
<el-table-column label="图片" align="center" prop="picture" width="100">
|
|
<template slot-scope="scope">
|
|
<image-preview :src="scope.row.picture" :width="50" :height="50"/>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="MAC" prop="mac"></el-table-column>
|
|
<el-table-column align="center" label="SN" prop="deviceNo"></el-table-column>
|
|
<el-table-column align="center" label="型号" prop="model"></el-table-column>
|
|
<el-table-column align="center" label="店铺" prop="storeName"></el-table-column>
|
|
<el-table-column align="center" label="最近更新时间" prop="updateTime"></el-table-column>
|
|
<el-table-column align="center" label="状态">
|
|
<template slot-scope="d">
|
|
<dict-tag :options="dict.type.sm_device_online_status" :value="d.row.onlineStatus"></dict-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="创建时间" prop="createTime"></el-table-column>
|
|
<el-table-column align="center" label="操作">
|
|
<template slot-scope="d">
|
|
<el-link type="primary" icon="el-icon-view" :underline="false" @click="handleView(d.row)">查看</el-link>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<pagination
|
|
:auto-scroll="false"
|
|
v-show="total>0"
|
|
:total="total"
|
|
:page.sync="queryParams.pageNum"
|
|
:limit.sync="queryParams.pageSize"
|
|
@pagination="getDeviceList"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {listDevice} from "@/api/system/device";
|
|
|
|
export default {
|
|
name: 'userDevice',
|
|
dicts: ['sm_device_online_status'],
|
|
props: {
|
|
// 用户id
|
|
userId: {
|
|
type: String,
|
|
default: null,
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
deviceList: [],
|
|
loading: false,
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
userId: null,
|
|
},
|
|
total: 0,
|
|
}
|
|
},
|
|
watch: {
|
|
userId(nv, ov) {
|
|
this.getDeviceList(nv);
|
|
}
|
|
},
|
|
created() {
|
|
this.getDeviceList(this.userId);
|
|
},
|
|
methods: {
|
|
// 获取用户设备列表
|
|
getDeviceList(userId) {
|
|
this.loading = true;
|
|
this.queryParams.userId = userId | this.userId;
|
|
listDevice(this.queryParams).then(response => {
|
|
this.deviceList = response.rows;
|
|
this.total = response.total;
|
|
}).finally(() => {
|
|
this.loading = false;
|
|
})
|
|
},
|
|
// 点击查看操作
|
|
handleView(row) {
|
|
this.$router.push({path:'/smDevice/detail', query: {deviceId: row.deviceId}})
|
|
}
|
|
}
|
|
|
|
}
|
|
</script>
|