zhaothird

This commit is contained in:
redamancy-qian
2022-04-16 00:48:53 +08:00
parent 4bc2b41a38
commit f052bda831
42 changed files with 369 additions and 73 deletions

View File

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

View File

@@ -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 = {

View File

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