多租户前端调整

This commit is contained in:
kerwincui
2022-06-04 00:52:24 +08:00
parent 46aa17f320
commit cb2aa585c4
5 changed files with 61 additions and 131 deletions

View File

@@ -9,28 +9,14 @@
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
<el-form-item style="float:right;">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['iot:category:add']">新增</el-button>
</el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<el-card style="padding-bottom:100px;"> <el-card style="padding-bottom:100px;">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['iot:category:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['iot:category:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['iot:category:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['iot:category:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="categoryList" @selection-change="handleSelectionChange" border> <el-table v-loading="loading" :data="categoryList" @selection-change="handleSelectionChange" border>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="产品分类名称" align="center" prop="categoryName" /> <el-table-column label="产品分类名称" align="center" prop="categoryName" />
<el-table-column label="备注" align="left" prop="remark" min-width="150" /> <el-table-column label="备注" align="left" prop="remark" min-width="150" />
<el-table-column label="系统定义" align="center" prop="isSys"> <el-table-column label="系统定义" align="center" prop="isSys">
@@ -47,7 +33,7 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
<template slot-scope="scope"> <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="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']" v-if =" canEdit ? true : (scope.row.isSys == '1' ? false : true)">删除</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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -92,7 +78,7 @@ export default {
data() { data() {
return { return {
// 判断是否获取到修改权限 // 判断是否获取到修改权限
canEdit:false, canEdit: false,
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组 // 选中数组
@@ -140,11 +126,11 @@ export default {
this.init(); this.init();
}, },
methods: { methods: {
init(){ init() {
if (this.$store.state.user.roles.indexOf("admin") !== -1){ if (this.$store.state.user.roles.indexOf("admin") !== -1) {
this.canEdit = true this.canEdit = true
} }
}, },
/** 查询产品分类列表 */ /** 查询产品分类列表 */
getList() { getList() {
this.loading = true; this.loading = true;
@@ -233,10 +219,10 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const categoryIds = row.categoryId || this.ids; const categoryIds = row.categoryId || this.ids;
let msg=""; let msg = "";
this.$modal.confirm('是否确认删除产品分类编号为"' + categoryIds + '"的数据项?').then(function () { this.$modal.confirm('是否确认删除产品分类编号为"' + categoryIds + '"的数据项?').then(function () {
return delCategory(categoryIds).then(response => { return delCategory(categoryIds).then(response => {
msg=response.msg; msg = response.msg;
}); });
}).then(() => { }).then(() => {
this.getList(); this.getList();

View File

@@ -15,28 +15,14 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-tag type="danger" style="margin-left:15px;">该功能暂不可用,后面版本发布</el-tag> <el-tag type="danger" style="margin-left:15px;">该功能暂不可用,后面版本发布</el-tag>
</el-form-item> </el-form-item>
<el-form-item style="float:right;">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['iot:clientDetails:add']">新增</el-button>
</el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<el-card style="padding-bottom: 100px"> <el-card style="padding-bottom: 100px">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['iot:clientDetails:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['iot:clientDetails:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" disabled @click="handleDelete" v-hasPermi="['iot:clientDetails:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['iot:clientDetails:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="clientDetailsList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="clientDetailsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="授权平台" align="center" prop="type"> <el-table-column label="授权平台" align="center" prop="type">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.oauth_platform" :value="scope.row.type" /> <dict-tag :options="dict.type.oauth_platform" :value="scope.row.type" />
@@ -276,29 +262,29 @@ export default {
); );
}, },
/** 格式化显示授权模式 */ /** 格式化显示授权模式 */
formatGrantTypesDisplay(data){ formatGrantTypesDisplay(data) {
let dataArray=data.split(","); let dataArray = data.split(",");
let displayHtml="" let displayHtml = ""
for(let i=0;i<dataArray.length;i++){ for (let i = 0; i < dataArray.length; i++) {
displayHtml=displayHtml+"<div style='background-color:#eee;margin:0 auto;margin-bottom:5px;width:86px;border-radius:5px;padding:3px;'>"+this.convertGrantType(dataArray[i])+"</div>" displayHtml = displayHtml + "<div style='background-color:#eee;margin:0 auto;margin-bottom:5px;width:86px;border-radius:5px;padding:3px;'>" + this.convertGrantType(dataArray[i]) + "</div>"
} }
return displayHtml; return displayHtml;
}, },
/** 授权模式转换 */ /** 授权模式转换 */
convertGrantType(type){ convertGrantType(type) {
if(type=="client_credentials"){ if (type == "client_credentials") {
return "客户端模式" return "客户端模式"
}else if(type=="password"){ } else if (type == "password") {
return "密码模式"; return "密码模式";
}else if(type=="authorization_code"){ } else if (type == "authorization_code") {
return "授权码模式"; return "授权码模式";
}else if(type=="implicit"){ } else if (type == "implicit") {
return "简化模式"; return "简化模式";
}else if(type=="refresh_token"){ } else if (type == "refresh_token") {
return "刷新Token"; return "刷新Token";
}else{ } else {
return ""; return "";
} }
} }
}, },

View File

@@ -12,28 +12,14 @@
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
<el-form-item style="float:right;">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['iot:firmware:add']">新增</el-button>
</el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<el-card style="padding-bottom:100px;"> <el-card style="padding-bottom:100px;">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['iot:firmware:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['iot:firmware:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['iot:firmware:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['iot:firmware:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="firmwareList" @selection-change="handleSelectionChange" border> <el-table v-loading="loading" :data="firmwareList" @selection-change="handleSelectionChange" border>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="固件名称" align="center" prop="firmwareName" /> <el-table-column label="固件名称" align="center" prop="firmwareName" />
<el-table-column label="产品名称" align="center" prop="productName" /> <el-table-column label="产品名称" align="center" prop="productName" />
<el-table-column label="租户名称" align="center" prop="tenantName" /> <el-table-column label="租户名称" align="center" prop="tenantName" />
@@ -58,7 +44,7 @@
<template slot-scope="scope"> <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="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="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']" v-if =" canEdit ? true : (scope.row.isSys == '1' ? false : true)">删除</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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -124,7 +110,7 @@ export default {
data() { data() {
return { return {
// 判断是否有修改权限 // 判断是否有修改权限
canEdit:false, canEdit: false,
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组 // 选中数组
@@ -206,11 +192,11 @@ export default {
this.init(); this.init();
}, },
methods: { methods: {
init(){ init() {
if (this.$store.state.user.roles.indexOf("admin") !== -1){ if (this.$store.state.user.roles.indexOf("admin") !== -1) {
this.canEdit = true this.canEdit = true
} }
}, },
/** 查询产品固件列表 */ /** 查询产品固件列表 */
getList() { getList() {
this.loading = true; this.loading = true;
@@ -336,9 +322,9 @@ export default {
} }
}, },
// 获取文件路径 // 获取文件路径
getFilePath(data){ getFilePath(data) {
console.log(data); console.log(data);
this.form.filePath=data; this.form.filePath = data;
}, },
// 文件提交处理 // 文件提交处理

View File

@@ -9,28 +9,14 @@
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
<el-form-item style="float:right;">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['iot:group:add']">新增</el-button>
</el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<el-card style="padding-bottom:100px;"> <el-card style="padding-bottom:100px;">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['iot:group:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['iot:group:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['iot:group:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['iot:group:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="groupList" @selection-change="handleSelectionChange" border> <el-table v-loading="loading" :data="groupList" @selection-change="handleSelectionChange" border>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="分组名称" align="center" prop="groupName" width="200" /> <el-table-column label="分组名称" align="center" prop="groupName" width="200" />
<el-table-column label="分组排序" align="center" prop="groupOrder" width="100" /> <el-table-column label="分组排序" align="center" prop="groupOrder" width="100" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">

View File

@@ -14,28 +14,14 @@
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
<el-form-item style="float:right;">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['iot:template:add']">新增</el-button>
</el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<el-card style="padding-bottom:100px;"> <el-card style="padding-bottom:100px;">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['iot:template:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['iot:template:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['iot:template:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['iot:template:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="templateList" @selection-change="handleSelectionChange" border> <el-table v-loading="loading" :data="templateList" @selection-change="handleSelectionChange" border>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="名称" align="center" prop="templateName" /> <el-table-column label="名称" align="center" prop="templateName" />
<el-table-column label="标识符" align="center" prop="identifier" /> <el-table-column label="标识符" align="center" prop="identifier" />
<el-table-column label="首页显示" align="center" prop="isTop" width="80"> <el-table-column label="首页显示" align="center" prop="isTop" width="80">
@@ -75,8 +61,8 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
<template slot-scope="scope"> <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="primary" style="padding:5px;" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:template:edit']" v-if="scope.row.isSys == '1' && isTenant!=true" >修改</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> <el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:template:remove']" v-if="scope.row.isSys == '1' && isTenant!=true">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -184,7 +170,7 @@
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled=" canEdit ? false : (form.isSys == '1' ? true : false)"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
@@ -212,8 +198,8 @@ export default {
dicts: ["iot_things_type", "iot_data_type", "iot_yes_no"], dicts: ["iot_things_type", "iot_data_type", "iot_yes_no"],
data() { data() {
return { return {
// 是否具有修改权限 admin可以修改系统定义的通用物 其他不可以 // 是否为租户
canEdit: false, isTenant: false,
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组 // 选中数组
@@ -277,8 +263,8 @@ export default {
}, },
methods: { methods: {
init() { init() {
if (this.$store.state.user.roles.indexOf("admin") !== -1) { if (this.$store.state.user.roles.indexOf("tenant") !== -1) {
this.canEdit = true this.isTenant = true
} }
}, },
/** 查询通用物模型列表 */ /** 查询通用物模型列表 */