mirror of
https://github.com/kerwincui/FastBee.git
synced 2025-10-14 04:13:55 +08:00
zhaoSecond
This commit is contained in:
@@ -2,84 +2,91 @@ import request from '@/utils/request'
|
||||
|
||||
// 查询设备列表
|
||||
export function listDevice(query) {
|
||||
return request({
|
||||
url: '/iot/device/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
return request({
|
||||
url: '/iot/device/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询设备简短列表
|
||||
export function listDeviceShort(query) {
|
||||
return request({
|
||||
url: '/iot/device/shortList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
return request({
|
||||
url: '/iot/device/shortList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询所有设备简短列表
|
||||
export function listAllDeviceShort() {
|
||||
return request({
|
||||
url: '/iot/device/all',
|
||||
method: 'get',
|
||||
})
|
||||
return request({
|
||||
url: '/iot/device/all',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
// 查询所有设备简短列表
|
||||
export function listAllDeviceShort2(query) {
|
||||
return request({
|
||||
url: '/iot/device/all',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询设备详细
|
||||
export function getDevice(deviceId) {
|
||||
return request({
|
||||
url: '/iot/device/' + deviceId,
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: '/iot/device/' + deviceId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询设备运行状态详细
|
||||
export function getDeviceRunningStatus(deviceId) {
|
||||
return request({
|
||||
url: '/iot/device/runningStatus/' + deviceId,
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: '/iot/device/runningStatus/' + deviceId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询设备物模型的值
|
||||
export function getDeviceThingsModelValue(deviceId) {
|
||||
return request({
|
||||
url: '/iot/device/thingsModelValue/' + deviceId,
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: '/iot/device/thingsModelValue/' + deviceId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增设备
|
||||
export function addDevice(data) {
|
||||
return request({
|
||||
url: '/iot/device',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: '/iot/device',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改设备
|
||||
export function updateDevice(data) {
|
||||
return request({
|
||||
url: '/iot/device',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: '/iot/device',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除设备
|
||||
export function delDevice(deviceId) {
|
||||
return request({
|
||||
url: '/iot/device/' + deviceId,
|
||||
method: 'delete'
|
||||
})
|
||||
return request({
|
||||
url: '/iot/device/' + deviceId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 生成设备编号
|
||||
export function generatorDeviceNum() {
|
||||
return request({
|
||||
url: '/iot/device/generator',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
return request({
|
||||
url: '/iot/device/generator',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
@@ -97,7 +97,7 @@
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
|
||||
<div v-show="isAdmin">
|
||||
<el-row :gutter="40" style="margin-top:80px;">
|
||||
<el-col :span="1">
|
||||
<el-card style="margin:-10px;height:218px;margin-right:-31px;padding-top:35px;text-align:center;font-weight:bold;" shadow="none">
|
||||
@@ -144,7 +144,7 @@
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
<div style="margin:-21px;margin-top:100px;bottom:0;border:1px solid #ccc;padding:10px;margin-bottom:-21px;">
|
||||
<div>
|
||||
<el-link href="http://wumei.live" target="_blank" type="primary" style="margin-left:20px;">开源生活物联网平台 >></el-link>
|
||||
@@ -175,6 +175,7 @@ import {
|
||||
} from "@/api/iot/emqx";
|
||||
import {
|
||||
listAllDeviceShort,
|
||||
listAllDeviceShort2
|
||||
} from "@/api/iot/device";
|
||||
|
||||
export default {
|
||||
@@ -184,6 +185,11 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 控制是否显示服务器状态栏
|
||||
isAdmin:true,
|
||||
queryParams:{
|
||||
userName: ''
|
||||
},
|
||||
// 设备列表
|
||||
deviceList: [],
|
||||
// 设备总数
|
||||
@@ -220,61 +226,24 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// this.deviceList = [{
|
||||
// id: 21,
|
||||
// name: '海门',
|
||||
// value: 9,
|
||||
// long: 121.15,
|
||||
// lat: 31.89,
|
||||
// address: "海门",
|
||||
// product: "测试产品",
|
||||
// version: 1.0,
|
||||
// status: 1,
|
||||
// },
|
||||
// {
|
||||
// id: 21,
|
||||
// name: '鄂尔多斯',
|
||||
// value: 12,
|
||||
// long: 109.781327,
|
||||
// lat: 39.608266,
|
||||
// address: "海门",
|
||||
// product: "测试产品",
|
||||
// version: 2.0,
|
||||
// status: 2
|
||||
// },
|
||||
// {
|
||||
// id: 21,
|
||||
// name: '招远',
|
||||
// value: 12,
|
||||
// long: 120.38,
|
||||
// lat: 37.35,
|
||||
// address: "海门",
|
||||
// product: "测试产品",
|
||||
// version: 1.0,
|
||||
// status: 3
|
||||
// },
|
||||
// {
|
||||
// id: 21,
|
||||
// name: '海口',
|
||||
// value: 12,
|
||||
// long: 110.38,
|
||||
// lat: 20.35,
|
||||
// address: "测试",
|
||||
// product: "测试产品",
|
||||
// version: 1.0,
|
||||
// status: 4
|
||||
// }
|
||||
// ];
|
||||
this.init();
|
||||
this.getAllDevice();
|
||||
this.getServer();
|
||||
this.getMqttStats();
|
||||
this.statisticMqtt();
|
||||
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
// 设置用户的角色 用以区分自己创建的设备
|
||||
// 由于admin可以看所有数据所以判断
|
||||
if (this.$store.state.user.roles !="admin"){
|
||||
this.isAdmin = false
|
||||
this.queryParams.userName = this.$store.state.user.name
|
||||
}
|
||||
},
|
||||
/**查询所有设备 */
|
||||
getAllDevice() {
|
||||
listAllDeviceShort().then(response => {
|
||||
listAllDeviceShort2(this.queryParams).then(response => {
|
||||
this.deviceList = response.rows;
|
||||
this.deviceCount=response.total;
|
||||
this.$nextTick(() => {
|
||||
|
@@ -52,7 +52,7 @@
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="small" type="primary" style="padding:5px;" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:category:edit']">修改</el-button>
|
||||
<el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:category:remove']">删除</el-button>
|
||||
<el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:category:remove']" :disabled="scope.row.isSys == '1' ? (canEdit ? false : true) : false">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -73,7 +73,7 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button type="primary" @click="submitForm" :disabled="form.isSys == '1' ? (canEdit ? false : true) : false">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@@ -96,6 +96,8 @@ export default {
|
||||
dicts: ["iot_yes_no"],
|
||||
data() {
|
||||
return {
|
||||
// 判断是否获取到修改权限
|
||||
canEdit:false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
@@ -151,8 +153,14 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
if (this.$store.state.user.roles =="admin"){
|
||||
this.canEdit = true
|
||||
}
|
||||
},
|
||||
/** 查询产品分类列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
|
@@ -450,6 +450,11 @@ export default {
|
||||
this.queryParams.params["beginActiveTime"] = this.daterangeActiveTime[0];
|
||||
this.queryParams.params["endActiveTime"] = this.daterangeActiveTime[1];
|
||||
}
|
||||
// 设置用户的角色 用以区分自己创建的设备
|
||||
// 由于admin可以看所有数据所以判断
|
||||
if (this.$store.state.user.roles !=="admin"){
|
||||
this.queryParams.userName = this.$store.state.user.name
|
||||
}
|
||||
listDeviceShort(this.queryParams).then(response => {
|
||||
this.deviceList = response.rows;
|
||||
this.total = response.total;
|
||||
|
@@ -58,7 +58,7 @@
|
||||
<template slot-scope="scope">
|
||||
<el-button size="small" type="info" style="padding:5px;" icon="el-icon-download" @click="handleDownload(scope.row)">下载</el-button>
|
||||
<el-button size="small" type="primary" style="padding:5px;" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:firmware:edit']">修改</el-button>
|
||||
<el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:firmware:remove']">删除</el-button>
|
||||
<el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:firmware:remove']" :disabled="scope.row.isSys == '1' ? (canEdit ? false : true) : false">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -88,7 +88,7 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button type="primary" @click="submitForm" :disabled="form.isSys == '1' ? (canEdit ? false : true) : false">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@@ -124,6 +124,8 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 判断是否有修改权限
|
||||
canEdit:false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
@@ -217,10 +219,19 @@ export default {
|
||||
created() {
|
||||
this.getList();
|
||||
this.getProductShortList();
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
if (this.$store.state.user.roles =="admin"){
|
||||
this.canEdit = true
|
||||
}
|
||||
},
|
||||
/** 查询产品固件列表 */
|
||||
getList() {
|
||||
if (this.$store.state.user.roles !="admin"){
|
||||
this.queryParams.tenantName = this.$store.state.user.name
|
||||
}
|
||||
this.loading = true;
|
||||
listFirmware(this.queryParams).then(response => {
|
||||
this.firmwareList = response.rows;
|
||||
|
@@ -158,6 +158,11 @@ export default {
|
||||
/** 查询设备分组列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 设置用户的角色 用以区分自己创建的设备
|
||||
// 由于admin可以看所有数据所以判断
|
||||
if (this.$store.state.user.roles !=="admin"){
|
||||
this.queryParams.userName = this.$store.state.user.name
|
||||
}
|
||||
listGroup(this.queryParams).then(response => {
|
||||
this.groupList = response.rows;
|
||||
this.total = response.total;
|
||||
|
@@ -22,10 +22,10 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card style="padding-bottom:100px;">
|
||||
<el-row :gutter="30" v-loading="loading" >
|
||||
<el-col :span="6" v-for="(item,index) in productList" :key="index" style="margin-bottom:30px;text-align:center;">
|
||||
<el-col :span="6" v-for="(item,index) in productList" :key="index" style="margin-bottom:30px;text-align:center;" v-show="(item.isSys == 1) || (userName == item.tenantName)">
|
||||
<div>
|
||||
<el-card :body-style="{ padding: '20px'}" shadow="always">
|
||||
<el-row type="flex" :gutter="10" justify="space-between">
|
||||
<el-col :span="20" style="text-align:left;">
|
||||
@@ -80,6 +80,7 @@
|
||||
<el-button size="mini" type="warning" icon="el-icon-search" @click="handleViewDevice(item.productId)" v-hasPermi="['tool:gen:edit']">查看设备</el-button>
|
||||
</el-button-group>
|
||||
</el-card>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
@@ -117,6 +118,9 @@ export default {
|
||||
dicts: ['iot_yes_no', 'iot_product_status', 'iot_device_type', 'iot_network_method', 'iot_vertificate_method', 'iot_device_chip'],
|
||||
data() {
|
||||
return {
|
||||
userName:'',
|
||||
// 判断用户是否是管理员
|
||||
isAdmin:false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 总条数
|
||||
@@ -148,6 +152,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.init();
|
||||
},
|
||||
activated() {
|
||||
const time = this.$route.query.t;
|
||||
@@ -158,6 +163,17 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
if (this.$store.state.user.roles =="admin"){
|
||||
this.isAdmin = true
|
||||
// 显示全部的情况 = 角色是管理员admin
|
||||
// 显示系统定义和自己 = 角色是租户
|
||||
// 都会显示 = 系统定义
|
||||
// 条件: isSys = '1' || this.$store.state.user.name == item.tenantName
|
||||
}
|
||||
this.userName = this.$store.state.user.name
|
||||
console.log(this.userName)
|
||||
},
|
||||
/** 查询产品列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
|
@@ -76,7 +76,7 @@
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="small" type="primary" style="padding:5px;" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:template:edit']">修改</el-button>
|
||||
<el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:template:remove']">删除</el-button>
|
||||
<el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:template:remove']" :disabled="scope.row.isSys == '1' ? (canEdit ? false : true) : false">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -184,7 +184,7 @@
|
||||
</el-form>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button type="primary" @click="submitForm" :disabled="form.isSys == '1' ? (canEdit ? false : true) : false">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@@ -212,6 +212,8 @@ export default {
|
||||
dicts: ["iot_things_type", "iot_data_type", "iot_yes_no"],
|
||||
data() {
|
||||
return {
|
||||
// 是否具有修改权限 admin可以修改系统定义的通用物 其他不可以
|
||||
canEdit: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
@@ -271,8 +273,14 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
if (this.$store.state.user.roles =="admin"){
|
||||
this.canEdit = true
|
||||
}
|
||||
},
|
||||
/** 查询通用物模型列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
|
@@ -137,6 +137,7 @@
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:role:remove']"
|
||||
:disabled="scope.row.roleKey !== 'visitor'"
|
||||
>删除</el-button>
|
||||
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:role:edit']">
|
||||
<span class="el-dropdown-link">
|
||||
|
Reference in New Issue
Block a user