mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 00:45:55 +08:00
zhaothird
This commit is contained in:
@@ -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']" :disabled="scope.row.isSys == '1' ? (canEdit ? false : true) : false">删除</el-button>
|
||||
<el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:category:remove']" v-if =" canEdit ? true : (scope.row.isSys == '1' ? false : true)">删除</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" :disabled="form.isSys == '1' ? (canEdit ? false : true) : false">确 定</el-button>
|
||||
<el-button type="primary" @click="submitForm" :disabled=" canEdit ? false : (form.isSys == '1' ? true : false)">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@@ -156,14 +156,17 @@ export default {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
if (this.$store.state.user.roles =="admin"){
|
||||
this.canEdit = true
|
||||
}
|
||||
},
|
||||
init(){
|
||||
if (this.$store.state.user.roles.indexOf("admin") !== -1){
|
||||
this.canEdit = true
|
||||
}
|
||||
},
|
||||
/** 查询产品分类列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
if (this.$store.state.user.roles.indexOf("admin") === -1){
|
||||
this.queryParams.tenantName = this.$store.state.user.name
|
||||
}
|
||||
listCategory(this.queryParams).then(response => {
|
||||
this.categoryList = response.rows;
|
||||
this.total = response.total;
|
||||
|
||||
@@ -294,7 +294,7 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
/**
|
||||
* Mqtt发布消息
|
||||
* @type 类型(1=属性,2=功能,3=OTA升级,4=实时监测)
|
||||
* @device 设备
|
||||
@@ -443,16 +443,15 @@ export default {
|
||||
model.value = 0;
|
||||
this.mqttPublish(4, this.monitorDevice, model);
|
||||
},
|
||||
/** 查询设备列表 */
|
||||
/** 查询所有简短设备列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
if (null != this.daterangeActiveTime && '' != this.daterangeActiveTime) {
|
||||
this.queryParams.params["beginActiveTime"] = this.daterangeActiveTime[0];
|
||||
this.queryParams.params["endActiveTime"] = this.daterangeActiveTime[1];
|
||||
}
|
||||
// 设置用户的角色 用以区分自己创建的设备
|
||||
// 由于admin可以看所有数据所以判断
|
||||
if (this.$store.state.user.roles !=="admin"){
|
||||
// 判断是否是admin角色
|
||||
if (this.$store.state.user.roles.indexOf("admin") === -1){
|
||||
this.queryParams.userName = this.$store.state.user.name
|
||||
}
|
||||
listDeviceShort(this.queryParams).then(response => {
|
||||
|
||||
@@ -95,6 +95,10 @@ export default {
|
||||
/** 查询产品列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 判断是否是admin角色
|
||||
if (this.$store.state.user.roles.indexOf("admin") === -1){
|
||||
this.queryParams.tenantName = this.$store.state.user.name
|
||||
}
|
||||
listProduct(this.queryParams).then(response => {
|
||||
this.productList = response.rows;
|
||||
this.total = response.total;
|
||||
@@ -125,7 +129,7 @@ export default {
|
||||
setRadioSelected(productId) {
|
||||
for (let i = 0; i < this.productList.length; i++) {
|
||||
if (this.productList[i].productId == productId) {
|
||||
this.productList[i].isSelect = true;
|
||||
this.productList[i].isSelect = true;
|
||||
} else {
|
||||
this.productList[i].isSelect = false;
|
||||
}
|
||||
|
||||
@@ -58,13 +58,12 @@
|
||||
<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']" :disabled="scope.row.isSys == '1' ? (canEdit ? false : true) : false">删除</el-button>
|
||||
<el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:firmware:remove']" v-if =" canEdit ? true : (scope.row.isSys == '1' ? false : true)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改产品固件对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
@@ -88,7 +87,7 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="form.isSys == '1' ? (canEdit ? false : true) : false">确 定</el-button>
|
||||
<el-button type="primary" @click="submitForm" :disabled=" canEdit ? false : (form.isSys == '1' ? true : false)">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@@ -222,11 +221,11 @@ export default {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
if (this.$store.state.user.roles =="admin"){
|
||||
this.canEdit = true
|
||||
}
|
||||
},
|
||||
init(){
|
||||
if (this.$store.state.user.roles.indexOf("admin") !== -1){
|
||||
this.canEdit = true
|
||||
}
|
||||
},
|
||||
/** 查询产品固件列表 */
|
||||
getList() {
|
||||
if (this.$store.state.user.roles !="admin"){
|
||||
|
||||
@@ -160,7 +160,7 @@ export default {
|
||||
this.loading = true;
|
||||
// 设置用户的角色 用以区分自己创建的设备
|
||||
// 由于admin可以看所有数据所以判断
|
||||
if (this.$store.state.user.roles !=="admin"){
|
||||
if (this.$store.state.user.roles.indexOf("admin") === -1){
|
||||
this.queryParams.userName = this.$store.state.user.name
|
||||
}
|
||||
listGroup(this.queryParams).then(response => {
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
</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;" v-show="(item.isSys == 1) || (userName == item.tenantName)">
|
||||
<div>
|
||||
<el-col :span="6" v-for="(item,index) in productList" :key="index" style="margin-bottom:30px;text-align:center;">
|
||||
<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,7 +79,6 @@
|
||||
<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>
|
||||
|
||||
@@ -118,9 +116,6 @@ 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,
|
||||
// 总条数
|
||||
@@ -152,7 +147,6 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.init();
|
||||
},
|
||||
activated() {
|
||||
const time = this.$route.query.t;
|
||||
@@ -163,20 +157,12 @@ 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;
|
||||
if (this.$store.state.user.roles.indexOf("admin") === -1){
|
||||
this.queryParams.tenantName = this.$store.state.user.name
|
||||
}
|
||||
listProduct(this.queryParams).then(response => {
|
||||
this.productList = response.rows;
|
||||
this.total = response.total;
|
||||
|
||||
@@ -121,7 +121,8 @@ import productAlert from "./product-alert"
|
||||
import productAuthorize from "./product-authorize"
|
||||
import imageUpload from "../../../components/ImageUpload/index"
|
||||
import {
|
||||
listShortCategory
|
||||
listShortCategory,
|
||||
listShortCategory1
|
||||
} from "@/api/iot/category";
|
||||
import {
|
||||
getProduct,
|
||||
@@ -169,6 +170,10 @@ export default {
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
tenantName: null,
|
||||
},
|
||||
|
||||
};
|
||||
},
|
||||
@@ -179,12 +184,18 @@ export default {
|
||||
if (this.form.productId != 0) {
|
||||
this.getProduct();
|
||||
}
|
||||
// 获取简短分类列表
|
||||
listShortCategory().then(response => {
|
||||
this.categoryShortList = response.data;
|
||||
})
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
if (this.$store.state.user.roles.indexOf("admin") === -1){
|
||||
this.queryParams.tenantName = this.$store.state.user.name
|
||||
}
|
||||
// 获取简短分类列表
|
||||
listShortCategory1(this.queryParams).then(response => {
|
||||
this.categoryShortList = response.data;
|
||||
})
|
||||
},
|
||||
/** 返回按钮 */
|
||||
goBack() {
|
||||
const obj = {
|
||||
|
||||
@@ -71,6 +71,7 @@ export default {
|
||||
pageSize: 10,
|
||||
templateName: null,
|
||||
type: null,
|
||||
tenantName:''
|
||||
},
|
||||
};
|
||||
},
|
||||
@@ -82,6 +83,9 @@ export default {
|
||||
/** 查询通用物模型列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
if (this.$store.state.user.roles.indexOf("admin") === -1){
|
||||
this.queryParams.tenantName = this.$store.state.user.name
|
||||
}
|
||||
listTemplate(this.queryParams).then((response) => {
|
||||
this.templateList = response.rows;
|
||||
this.total = response.total;
|
||||
|
||||
@@ -75,8 +75,8 @@
|
||||
</el-table-column>
|
||||
<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']" :disabled="scope.row.isSys == '1' ? (canEdit ? false : true) : false">删除</el-button>
|
||||
<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']" v-if =" canEdit ? true : (scope.row.isSys == '1' ? false : true)">删除</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" :disabled="form.isSys == '1' ? (canEdit ? false : true) : false">确 定</el-button>
|
||||
<el-button type="primary" @click="submitForm" :disabled=" canEdit ? false : (form.isSys == '1' ? true : false)">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@@ -238,6 +238,8 @@ export default {
|
||||
pageSize: 10,
|
||||
templateName: null,
|
||||
type: null,
|
||||
// 增加属性
|
||||
tenantName: ''
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@@ -277,13 +279,16 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
if (this.$store.state.user.roles =="admin"){
|
||||
if (this.$store.state.user.roles.indexOf("admin") !== -1){
|
||||
this.canEdit = true
|
||||
}
|
||||
},
|
||||
/** 查询通用物模型列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
if (this.$store.state.user.roles.indexOf("admin") === -1){
|
||||
this.queryParams.tenantName = this.$store.state.user.name
|
||||
}
|
||||
listTemplate(this.queryParams).then((response) => {
|
||||
this.templateList = response.rows;
|
||||
this.total = response.total;
|
||||
@@ -372,6 +377,8 @@ export default {
|
||||
this.form.isMonitor = 0;
|
||||
this.form.isTop = 0;
|
||||
}
|
||||
// 添加通用物模型的修改者
|
||||
this.form.updateBy = this.$store.state.user.name
|
||||
updateTemplate(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
@@ -386,6 +393,8 @@ export default {
|
||||
this.form.isMonitor = 0;
|
||||
this.form.isTop = 0;
|
||||
}
|
||||
// 添加通用物模型的创造者
|
||||
this.form.createBy = this.$store.state.user.name
|
||||
addTemplate(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
|
||||
Reference in New Issue
Block a user