zhaoSecond

This commit is contained in:
redamancy-qian
2022-04-14 23:38:46 +08:00
parent 217f2d2773
commit 1a5df34c4f
18 changed files with 463 additions and 108 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;