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

@@ -0,0 +1,61 @@
/*
Navicat Premium Data Transfer
Source Server : 阿里云
Source Server Type : MySQL
Source Server Version : 50726
Source Host : 114.55.33.198:3306
Source Schema : wumei-smart
Target Server Type : MySQL
Target Server Version : 50726
File Encoding : 65001
Date: 15/04/2022 23:32:21
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for iot_things_model_template
-- ----------------------------
DROP TABLE IF EXISTS `iot_things_model_template`;
CREATE TABLE `iot_things_model_template` (
`template_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '物模型ID',
`template_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '物模型名称',
`tenant_id` bigint(20) NOT NULL COMMENT '租户ID',
`tenant_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '租户名称',
`identifier` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识符,产品下唯一',
`type` tinyint(1) NOT NULL COMMENT '模型类别1-属性2-功能3-事件)',
`datatype` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '数据类型integer、decimal、string、bool、array、enum',
`specs` json NOT NULL COMMENT '数据定义',
`is_sys` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否系统通用0-否1-是)',
`is_Top` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否首页显示0-否1-是)',
`is_Monitor` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否实时监测0-否1-是)',
`del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志0代表存在 2代表删除',
`create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`template_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '物模型模板' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of iot_things_model_template
-- ----------------------------
INSERT INTO `iot_things_model_template` VALUES (1, '空气温度', 1, 'admin', 'temperature', 1, 'decimal', '{\"max\": 120, \"min\": -20, \"step\": 0.1, \"type\": \"decimal\", \"unit\": \"℃\"}', 1, 1, 1, '0', 'admin', '2022-03-09 17:41:49', '', '2022-03-09 20:58:06', NULL);
INSERT INTO `iot_things_model_template` VALUES (2, '空气湿度', 1, 'admin', 'humidity', 1, 'decimal', '{\"max\": 100, \"min\": 0, \"step\": 0.1, \"type\": \"decimal\", \"unit\": \"%\"}', 1, 1, 1, '0', 'admin', '2022-03-09 17:41:49', '', '2022-03-11 00:11:08', NULL);
INSERT INTO `iot_things_model_template` VALUES (3, '二氧化碳', 1, 'admin', 'co2', 1, 'integer', '{\"max\": 6000, \"min\": 100, \"step\": 1, \"type\": \"integer\", \"unit\": \"ppm\"}', 1, 0, 1, '0', 'admin', '2022-03-09 17:41:49', '', '2022-04-12 16:06:23', NULL);
INSERT INTO `iot_things_model_template` VALUES (4, '室内亮度', 1, 'admin', 'brightness', 1, 'integer', '{\"max\": 10000, \"min\": 0, \"step\": 1, \"type\": \"integer\", \"unit\": \"cd/m2\"}', 1, 0, 1, '0', 'admin', '2022-03-09 17:41:49', '', '2022-03-11 00:10:17', NULL);
INSERT INTO `iot_things_model_template` VALUES (5, '设备开关', 1, 'admin', 'switch', 2, 'bool', '{\"type\": \"bool\", \"trueText\": \"打开\", \"falseText\": \"关闭\"}', 1, 1, 0, '0', 'admin', '2022-03-09 17:41:49', '', '2022-03-09 17:41:49', NULL);
INSERT INTO `iot_things_model_template` VALUES (6, '运行档位', 1, 'admin', 'gear', 2, 'enum', '{\"type\": \"enum\", \"enumList\": [{\"text\": \"低速档位\", \"value\": \"0\"}, {\"text\": \"中速档位\", \"value\": \"1\"}, {\"text\": \"中高速档位\", \"value\": \"2\"}, {\"text\": \"高速档位\", \"value\": \"3\"}]}', 1, 1, 0, '0', 'admin', '2022-03-09 17:41:49', '', '2022-03-09 17:41:49', NULL);
INSERT INTO `iot_things_model_template` VALUES (7, '灯光颜色', 1, 'admin', 'light_color', 2, 'array', '{\"type\": \"array\", \"arrayType\": \"int\"}', 1, 0, 0, '0', 'admin', '2022-03-09 17:41:49', '', '2022-03-11 00:54:11', NULL);
INSERT INTO `iot_things_model_template` VALUES (8, '屏显消息', 1, 'admin', 'message', 2, 'string', '{\"type\": \"string\", \"maxLength\": 1024}', 1, 0, 0, '0', 'admin', '2022-03-09 17:41:49', '', '2022-03-09 17:41:49', NULL);
INSERT INTO `iot_things_model_template` VALUES (9, '上报监测数据', 1, 'admin', 'report_monitor', 2, 'integer', '{\"max\": 10, \"min\": 1, \"step\": 1, \"type\": \"integer\", \"unit\": \"次数\"}', 1, 0, 0, '0', 'admin', '2022-03-09 17:41:49', '', '2022-03-09 17:41:49', NULL);
INSERT INTO `iot_things_model_template` VALUES (10, '环境温度过高', 1, 'admin', 'height_temperature', 3, 'decimal', '{\"max\": 100, \"min\": 0, \"step\": 0.1, \"type\": \"decimal\", \"unit\": \"℃\"}', 1, 0, 0, '0', 'admin', '2022-03-09 17:41:49', '', '2022-03-11 14:48:21', NULL);
INSERT INTO `iot_things_model_template` VALUES (11, '设备发生异常', 1, 'admin', 'exception', 3, 'string', '{\"type\": \"string\", \"maxLength\": 1024}', 1, 0, 0, '0', 'admin', '2022-03-09 17:41:49', '', '2022-03-09 17:41:49', NULL);
INSERT INTO `iot_things_model_template` VALUES (15, '管理员测试通用物', 1, 'admin', '1111111', 1, 'integer', '{\"max\": 1111, \"min\": 11, \"step\": null, \"type\": \"integer\"}', 1, 0, 0, '0', 'admin', '2022-04-15 23:30:23', '', NULL, NULL);
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -11,7 +11,7 @@
Target Server Version : 50726 Target Server Version : 50726
File Encoding : 65001 File Encoding : 65001
Date: 14/04/2022 23:28:40 Date: 15/04/2022 23:33:21
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
@@ -31,7 +31,6 @@ CREATE TABLE `sys_role_menu` (
-- Records of sys_role_menu -- Records of sys_role_menu
-- ---------------------------- -- ----------------------------
INSERT INTO `sys_role_menu` VALUES (2, 108); INSERT INTO `sys_role_menu` VALUES (2, 108);
INSERT INTO `sys_role_menu` VALUES (2, 112);
INSERT INTO `sys_role_menu` VALUES (2, 2000); INSERT INTO `sys_role_menu` VALUES (2, 2000);
INSERT INTO `sys_role_menu` VALUES (2, 2001); INSERT INTO `sys_role_menu` VALUES (2, 2001);
INSERT INTO `sys_role_menu` VALUES (2, 2002); INSERT INTO `sys_role_menu` VALUES (2, 2002);

View File

@@ -8,8 +8,8 @@ spring:
master: master:
url: jdbc:mysql://localhost/wumei-smart?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost/wumei-smart?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
# password: wumei-smart password: wumei-smart
password: 123456 # password: 123456
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭

View File

@@ -65,8 +65,8 @@ spring:
# 数据库索引 # 数据库索引
database: 0 database: 0
# 密码 # 密码
# password: wumei-smart password: wumei-smart
password: 123456 # password: 123456
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
lettuce: lettuce:

View File

@@ -1,5 +1,6 @@
package com.ruoyi.iot.controller; package com.ruoyi.iot.controller;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -48,7 +49,14 @@ public class CategoryController extends BaseController
public TableDataInfo list(Category category) public TableDataInfo list(Category category)
{ {
startPage(); startPage();
List<Category> list = categoryService.selectCategoryList(category); List<Category> list = new ArrayList<>();
if(category.getTenantName()== null || category.getTenantName()=="")
{
list = categoryService.selectCategoryList(category);
}else {
list = categoryService.selectCategoryList1(category);
}
return getDataTable(list); return getDataTable(list);
} }
@@ -58,9 +66,15 @@ public class CategoryController extends BaseController
@PreAuthorize("@ss.hasPermi('iot:category:list')") @PreAuthorize("@ss.hasPermi('iot:category:list')")
@GetMapping("/shortlist") @GetMapping("/shortlist")
@ApiOperation("分类简短列表") @ApiOperation("分类简短列表")
public AjaxResult shortlist() public AjaxResult shortlist(Category category)
{ {
List<IdAndName> list = categoryService.selectCategoryShortList(); List<IdAndName> list = new ArrayList<>();
if(category.getTenantName()==""||category.getTenantName()==null)
{
list = categoryService.selectCategoryShortList();
}else {
list = categoryService.selectCategoryShortList1(category);
}
return AjaxResult.success(list); return AjaxResult.success(list);
} }

View File

@@ -18,6 +18,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@@ -43,7 +44,16 @@ public class DeviceController extends BaseController
public TableDataInfo list(Device device) public TableDataInfo list(Device device)
{ {
startPage(); startPage();
List<Device> list = deviceService.selectDeviceList(device); List<Device> list = new ArrayList<>();
if(device.getUserName()==null || device.getUserName()=="" )
{
list = deviceService.selectDeviceList(device);
System.out.print("进入模糊查询");
}else {
// 精确查询
System.out.print("进入精准查询"+device.getUserName());
list = deviceService.selectDeviceList1(device);
}
return getDataTable(list); return getDataTable(list);
} }
@@ -56,7 +66,14 @@ public class DeviceController extends BaseController
public TableDataInfo shortList(Device device) public TableDataInfo shortList(Device device)
{ {
startPage(); startPage();
List<DeviceShortOutput> list = deviceService.selectDeviceShortList(device); List<DeviceShortOutput> list = new ArrayList<>();
if(device.getUserName()==null || device.getUserName()=="" )
{
list = deviceService.selectDeviceShortList(device);
}else {
// 精确查询
list = deviceService.selectDeviceShortList1(device);
}
return getDataTable(list); return getDataTable(list);
} }

View File

@@ -59,6 +59,7 @@ public class FirmwareController extends BaseController
public TableDataInfo list(Firmware firmware) public TableDataInfo list(Firmware firmware)
{ {
startPage(); startPage();
System.out.print("租户名称"+firmware.getTenantName()+"hs");
List<Firmware> list = firmwareService.selectFirmwareList(firmware); List<Firmware> list = firmwareService.selectFirmwareList(firmware);
return getDataTable(list); return getDataTable(list);
} }

View File

@@ -1,5 +1,6 @@
package com.ruoyi.iot.controller; package com.ruoyi.iot.controller;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -49,7 +50,16 @@ public class GroupController extends BaseController
public TableDataInfo list(Group group) public TableDataInfo list(Group group)
{ {
startPage(); startPage();
List<Group> list = groupService.selectGroupList(group); List<Group> list = new ArrayList<>();
if(group.getUserName() == null || group.getUserName() == "")
{
// 搜索查询 ,mapper使用的是模糊查询
list = groupService.selectGroupList(group);
}else {
// 精准查询
list = groupService.selectGroupList1(group);
}
return getDataTable(list); return getDataTable(list);
} }

View File

@@ -17,6 +17,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@@ -42,7 +43,13 @@ public class ProductController extends BaseController
public TableDataInfo list(Product product) public TableDataInfo list(Product product)
{ {
startPage(); startPage();
List<Product> list = productService.selectProductList(product); List<Product> list = new ArrayList<>();
if(product.getTenantName()=="" ||product.getTenantName()==null)
{
list = productService.selectProductList(product);
}else {
list = productService.selectProductList1(product);
}
return getDataTable(list); return getDataTable(list);
} }
@@ -52,8 +59,9 @@ public class ProductController extends BaseController
@PreAuthorize("@ss.hasPermi('iot:product:list')") @PreAuthorize("@ss.hasPermi('iot:product:list')")
@GetMapping("/shortList") @GetMapping("/shortList")
@ApiOperation("产品简短列表") @ApiOperation("产品简短列表")
public AjaxResult shortList() public AjaxResult shortList(Product product)
{ {
List<IdAndName> list = productService.selectProductShortList(); List<IdAndName> list = productService.selectProductShortList();
return AjaxResult.success(list); return AjaxResult.success(list);
} }

View File

@@ -1,5 +1,6 @@
package com.ruoyi.iot.controller; package com.ruoyi.iot.controller;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -47,7 +48,13 @@ public class ThingsModelTemplateController extends BaseController
public TableDataInfo list(ThingsModelTemplate thingsModelTemplate) public TableDataInfo list(ThingsModelTemplate thingsModelTemplate)
{ {
startPage(); startPage();
List<ThingsModelTemplate> list = thingsModelTemplateService.selectThingsModelTemplateList(thingsModelTemplate); List<ThingsModelTemplate> list = new ArrayList<>();
if (thingsModelTemplate.getTenantName() == ""|| thingsModelTemplate.getTenantName() == null){
list = thingsModelTemplateService.selectThingsModelTemplateList(thingsModelTemplate);
}else{
// 精准查询
list = thingsModelTemplateService.selectThingsModelTemplateList1(thingsModelTemplate);
}
return getDataTable(list); return getDataTable(list);
} }

View File

@@ -77,4 +77,8 @@ public interface CategoryMapper
* @return 结果 * @return 结果
*/ */
public int productCountInCategorys(Long[] categoryIds); public int productCountInCategorys(Long[] categoryIds);
// 精准查询
List<Category> selectCategoryList1(Category category);
List<IdAndName> selectCategoryShortList1(Category category);
} }

View File

@@ -161,6 +161,10 @@ public interface DeviceMapper
* @return * @return
*/ */
public int deleteDeviceGroupByDeviceIds(Long[] deviceIds); public int deleteDeviceGroupByDeviceIds(Long[] deviceIds);
// 查询简短设备列表 // 查询所有简短设备列表
List<DeviceAllShortOutput> selectAllDeviceShortList1(String userName); List<DeviceAllShortOutput> selectAllDeviceShortList1(String userName);
//精准查询
List<Device> selectDeviceList1(Device device);
List<DeviceShortOutput> selectDeviceShortList1(Device device);
} }

View File

@@ -83,4 +83,7 @@ public interface GroupMapper
* @return * @return
*/ */
public int deleteDeviceGroupByGroupIds(Long[] groupIds); public int deleteDeviceGroupByGroupIds(Long[] groupIds);
// 精准查询所有
List<Group> selectGroupList1(Group group);
} }

View File

@@ -116,4 +116,6 @@ public interface ProductMapper
* @return 结果 * @return 结果
*/ */
public int thingsCountInProduct(Long productId); public int thingsCountInProduct(Long productId);
// 精准查询
List<Product> selectProductList1(Product product);
} }

View File

@@ -68,4 +68,6 @@ public interface ThingsModelTemplateMapper
* @return 结果 * @return 结果
*/ */
public int deleteThingsModelTemplateByTemplateIds(Long[] templateIds); public int deleteThingsModelTemplateByTemplateIds(Long[] templateIds);
// 精准查询
List<ThingsModelTemplate> selectThingsModelTemplateList1(ThingsModelTemplate thingsModelTemplate);
} }

View File

@@ -68,4 +68,9 @@ public interface ICategoryService
* @return 结果 * @return 结果
*/ */
public int deleteCategoryByCategoryId(Long categoryId); public int deleteCategoryByCategoryId(Long categoryId);
// 精准查询
List<Category> selectCategoryList1(Category category);
List<IdAndName> selectCategoryShortList1(Category category);
} }

View File

@@ -154,4 +154,10 @@ public interface IDeviceService
// 获取所有简短设备列表 // 获取所有简短设备列表
List<DeviceAllShortOutput> selectAllDeviceShortList1(String userName); List<DeviceAllShortOutput> selectAllDeviceShortList1(String userName);
// 精准查询
List<Device> selectDeviceList1(Device device);
// 精准查询所有条件设备的简短信息
List<DeviceShortOutput> selectDeviceShortList1(Device device);
} }

View File

@@ -74,4 +74,6 @@ public interface IGroupService
*/ */
public int deleteGroupByGroupId(Long groupId); public int deleteGroupByGroupId(Long groupId);
// 精准查询
List<Group> selectGroupList1(Group group);
} }

View File

@@ -77,4 +77,7 @@ public interface IProductService
* @return 结果 * @return 结果
*/ */
public int deleteProductByProductId(Long productId); public int deleteProductByProductId(Long productId);
// 精准查询
List<Product> selectProductList1(Product product);
} }

View File

@@ -58,4 +58,7 @@ public interface IThingsModelTemplateService
* @return 结果 * @return 结果
*/ */
public int deleteThingsModelTemplateByTemplateId(Long templateId); public int deleteThingsModelTemplateByTemplateId(Long templateId);
// 精准查询
List<ThingsModelTemplate> selectThingsModelTemplateList1(ThingsModelTemplate thingsModelTemplate);
} }

View File

@@ -97,6 +97,11 @@ public class CategoryServiceImpl implements ICategoryService
return categoryMapper.updateCategory(category); return categoryMapper.updateCategory(category);
} }
@Override
public List<IdAndName> selectCategoryShortList1(Category category) {
return categoryMapper.selectCategoryShortList1(category);
}
/** /**
* 批量删除产品分类 * 批量删除产品分类
* *
@@ -127,4 +132,9 @@ public class CategoryServiceImpl implements ICategoryService
{ {
return categoryMapper.deleteCategoryByCategoryId(categoryId); return categoryMapper.deleteCategoryByCategoryId(categoryId);
} }
@Override
public List<Category> selectCategoryList1(Category category) {
return categoryMapper.selectCategoryList1(category);
}
} }

View File

@@ -250,6 +250,12 @@ public class DeviceServiceImpl implements IDeviceService {
return deviceList; return deviceList;
} }
// 精准查询所有条件的设备
@Override
public List<DeviceShortOutput> selectDeviceShortList1(Device device) {
return deviceMapper.selectDeviceShortList1(device);
}
/** /**
* Json物模型集合转换为对象中的分类集合 * Json物模型集合转换为对象中的分类集合
* *
@@ -538,6 +544,11 @@ public class DeviceServiceImpl implements IDeviceService {
public List<DeviceAllShortOutput> selectAllDeviceShortList1(String userName) { public List<DeviceAllShortOutput> selectAllDeviceShortList1(String userName) {
return deviceMapper.selectAllDeviceShortList1(userName); return deviceMapper.selectAllDeviceShortList1(userName);
} }
// 精准查询
@Override
public List<Device> selectDeviceList1(Device device) {
return deviceMapper.selectDeviceList1(device);
}
/** /**

View File

@@ -139,4 +139,10 @@ public class GroupServiceImpl implements IGroupService
return groupMapper.deleteGroupByGroupId(groupId); return groupMapper.deleteGroupByGroupId(groupId);
} }
// 精准查询所有
@Override
public List<Group> selectGroupList1(Group group) {
return groupMapper.selectGroupList1(group);
}
} }

View File

@@ -180,6 +180,7 @@ public class ProductServiceImpl implements IProductService
return AjaxResult.error("删除失败"); return AjaxResult.error("删除失败");
} }
/** /**
* 删除产品信息 * 删除产品信息
* *
@@ -193,4 +194,9 @@ public class ProductServiceImpl implements IProductService
redisCache.deleteObject(tslPreKey+productId); redisCache.deleteObject(tslPreKey+productId);
return productMapper.deleteProductByProductId(productId); return productMapper.deleteProductByProductId(productId);
} }
// 精准查询
@Override
public List<Product> selectProductList1(Product product) {
return productMapper.selectProductList1(product);
}
} }

View File

@@ -108,4 +108,9 @@ public class ThingsModelTemplateServiceImpl implements IThingsModelTemplateServi
{ {
return thingsModelTemplateMapper.deleteThingsModelTemplateByTemplateId(templateId); return thingsModelTemplateMapper.deleteThingsModelTemplateByTemplateId(templateId);
} }
// 精准查询
@Override
public List<ThingsModelTemplate> selectThingsModelTemplateList1(ThingsModelTemplate thingsModelTemplate) {
return thingsModelTemplateMapper.selectThingsModelTemplateList1(thingsModelTemplate);
}
} }

View File

@@ -34,12 +34,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by order_num order by order_num
</select> </select>
<select id="selectCategoryList1" parameterType="com.ruoyi.iot.domain.Category" resultMap="CategoryResult">
<include refid="selectCategoryVo"/>
<where>
<if test="categoryName != null and categoryName != ''"> and category_name = #{categoryName}</if>
<if test="tenantName != null and tenantName != ''"> and tenant_name = #{tenantName} or is_sys = 1</if>
<if test="isSys != null "> and is_sys = #{isSys}</if>
</where>
order by order_num
</select>
<select id="selectCategoryShortList" resultMap="CategoryShortResult"> <select id="selectCategoryShortList" resultMap="CategoryShortResult">
select category_id, category_name select category_id, category_name
from iot_category from iot_category
order by order_num order by order_num
</select> </select>
<select id="selectCategoryShortList1" resultMap="CategoryShortResult">
select category_id, category_name
from iot_category
<where>
<if test="categoryName != null and categoryName != ''"> and category_name = #{categoryName}</if>
<if test="tenantName != null and tenantName != ''"> and tenant_name = #{tenantName} or is_sys = 1</if>
<if test="isSys != null "> and is_sys = #{isSys}</if>
</where>
order by order_num
</select>
<select id="selectCategoryByCategoryId" parameterType="Long" resultMap="CategoryResult"> <select id="selectCategoryByCategoryId" parameterType="Long" resultMap="CategoryResult">
<include refid="selectCategoryVo"/> <include refid="selectCategoryVo"/>

View File

@@ -109,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select device_id, device_name, product_name, user_name, serial_number, firmware_version, status,rssi,is_shadow , select device_id, device_name, product_name, user_name, serial_number, firmware_version, status,rssi,is_shadow ,
is_custom_location, active_time,network_address,longitude,latitude from iot_device is_custom_location, active_time,network_address,longitude,latitude from iot_device
<where> <where>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if> <if test="userName != null and userName != ''"> and user_name = #{userName}</if>
</where> </where>
</select> </select>
<select id="selectDeviceList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceResult"> <select id="selectDeviceList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceResult">
@@ -129,6 +129,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by create_time desc order by create_time desc
</select> </select>
<select id="selectDeviceList1" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceResult">
<include refid="selectDeviceVo"/>
<where>
<if test="deviceName != null and deviceName != ''"> and device_name = #{deviceName}</if>
<if test="productId != null "> and product_id = #{productId}</if>
<if test="productName != null and productName != ''"> and product_name = #{productName}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name= #{userName}</if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="tenantName != null and tenantName != ''"> and tenant_name= #{tenantName}</if>
<if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
<if test="status != null "> and status = #{status}</if>
<if test="networkAddress != null and networkAddress != ''"> and network_address = #{networkAddress} </if>
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
</where>
order by create_time desc
</select>
<select id="selectAllDeviceShortList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceAllShortResult"> <select id="selectAllDeviceShortList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceAllShortResult">
select device_id, device_name, product_name, user_name, serial_number, firmware_version, status,rssi,is_shadow , select device_id, device_name, product_name, user_name, serial_number, firmware_version, status,rssi,is_shadow ,
@@ -159,6 +176,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by create_time desc order by create_time desc
</select> </select>
<select id="selectDeviceShortList1" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceShortResult">
<include refid="selectDeviceShortVo"/>
<where>
<if test="deviceName != null and deviceName != ''"> and device_name = #{deviceName}</if>
<if test="productId != null "> and product_id = #{productId}</if>
<if test="productName != null and productName != ''"> and product_name = #{productName}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name = #{userName}</if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="tenantName != null and tenantName != ''"> and tenant_name=#{tenantName}</if>
<if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
<if test="status != null "> and status = #{status}</if>
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
</where>
order by create_time desc
</select>
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult"> <select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
<include refid="selectDeviceVo"/> <include refid="selectDeviceVo"/>

View File

@@ -23,7 +23,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select firmware_id, firmware_name, product_id, product_name, tenant_id, tenant_name, is_sys, version, file_path, create_time, update_time, remark from iot_firmware select firmware_id, firmware_name, product_id, product_name, tenant_id, tenant_name, is_sys, version, file_path, create_time, update_time, remark from iot_firmware
</sql> </sql>
<select id="selectFirmwareList" parameterType="com.ruoyi.iot.domain.Firmware" resultMap="FirmwareResult"> <select id="selectFirmwareList" parameterType="com.ruoyi.iot.domain.Firmware" resultMap="FirmwareResult">
<include refid="selectFirmwareVo"/> <include refid="selectFirmwareVo"/>
<where> <where>

View File

@@ -31,6 +31,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by group_order order by group_order
</select> </select>
<select id="selectGroupList1" parameterType="com.ruoyi.iot.domain.Group" resultMap="GroupResult">
<include refid="selectGroupVo"/>
<where>
<if test="groupName != null and groupName != ''"> and group_name = #{groupName}</if>
<if test="userName != null and userName != ''"> and user_name = #{userName}</if>
</where>
order by group_order
</select>
<select id="selectGroupByGroupId" parameterType="Long" resultMap="GroupResult"> <select id="selectGroupByGroupId" parameterType="Long" resultMap="GroupResult">
<include refid="selectGroupVo"/> <include refid="selectGroupVo"/>

View File

@@ -51,10 +51,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by create_time desc order by create_time desc
</select> </select>
<select id="selectProductList1" parameterType="com.ruoyi.iot.domain.Product" resultMap="ProductResult">
<include refid="selectProductVo"/>
<where>
<if test="productName != null and productName != ''"> and product_name=#{productName}</if>
<if test="categoryId != null "> and category_id = #{categoryId}</if>
<if test="categoryName != null and categoryName != ''"> and category_name = #{categoryName}</if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="tenantName != null and tenantName != ''"> and tenant_name = #{tenantName} or is_sys = 1</if>
<if test="isSys != null "> and is_sys = #{isSys}</if>
<if test="isAuthorize != null "> and is_authorize = #{isAuthorize}</if>
<if test="status != null "> and status = #{status}</if>
<if test="deviceType != null "> and device_type = #{deviceType}</if>
<if test="networkMethod != null "> and network_method = #{networkMethod}</if>
</where>
order by create_time desc
</select>
<select id="selectProductShortList" parameterType="Long" resultMap="ProductShortResult"> <select id="selectProductShortList" parameterType="Long" resultMap="ProductShortResult">
select product_id,product_name from iot_product select product_id,product_name from iot_product
where tenant_id=#{userId} where tenant_id=#{userId} or is_sys = 1
order by create_time desc order by create_time desc
</select> </select>

View File

@@ -34,6 +34,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by create_time desc order by create_time desc
</select> </select>
<select id="selectThingsModelTemplateList1" parameterType="com.ruoyi.iot.domain.ThingsModelTemplate" resultMap="ThingsModelTemplateResult">
<include refid="selectThingsModelTemplateVo"/>
<where>
<if test="templateName != null and templateName != ''"> and template_name = #{templateName}</if>
<if test="type != null "> and type = #{type}</if>
<if test="specs != null and specs != ''"> and specs = #{specs}</if>
<if test="tenantName != null and tenantName != ''"> and create_by = #{tenantName} or is_sys = 1</if>
</where>
order by create_time desc
</select>
<select id="selectThingsModelTemplateByTemplateId" parameterType="Long" resultMap="ThingsModelTemplateResult"> <select id="selectThingsModelTemplateByTemplateId" parameterType="Long" resultMap="ThingsModelTemplateResult">
<include refid="selectThingsModelTemplateVo"/> <include refid="selectThingsModelTemplateVo"/>

View File

@@ -16,6 +16,14 @@ export function listShortCategory() {
method: 'get', method: 'get',
}) })
} }
// 查询产品简短分类列表
export function listShortCategory1(query) {
return request({
url: '/iot/category/shortlist',
method: 'get',
params: query
})
}
// 查询产品分类详细 // 查询产品分类详细
export function getCategory(categoryId) { export function getCategory(categoryId) {

View File

@@ -97,7 +97,7 @@
</el-col> </el-col>
</el-row> </el-row>
<div v-show="isAdmin"> <div v-if="isAdmin">
<el-row :gutter="40" style="margin-top:80px;"> <el-row :gutter="40" style="margin-top:80px;">
<el-col :span="1"> <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"> <el-card style="margin:-10px;height:218px;margin-right:-31px;padding-top:35px;text-align:center;font-weight:bold;" shadow="none">
@@ -236,7 +236,7 @@ export default {
init(){ init(){
// 设置用户的角色 用以区分自己创建的设备 // 设置用户的角色 用以区分自己创建的设备
// 由于admin可以看所有数据所以判断 // 由于admin可以看所有数据所以判断
if (this.$store.state.user.roles !="admin"){ if (this.$store.state.user.roles.indexOf("admin") === -1){
this.isAdmin = false this.isAdmin = false
this.queryParams.userName = this.$store.state.user.name this.queryParams.userName = this.$store.state.user.name
} }

View File

@@ -52,7 +52,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']" :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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -73,7 +73,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <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> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
@@ -157,13 +157,16 @@ export default {
}, },
methods: { methods: {
init(){ init(){
if (this.$store.state.user.roles =="admin"){ if (this.$store.state.user.roles.indexOf("admin") !== -1){
this.canEdit = true this.canEdit = true
} }
}, },
/** 查询产品分类列表 */ /** 查询产品分类列表 */
getList() { getList() {
this.loading = true; 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 => { listCategory(this.queryParams).then(response => {
this.categoryList = response.rows; this.categoryList = response.rows;
this.total = response.total; this.total = response.total;

View File

@@ -443,16 +443,15 @@ export default {
model.value = 0; model.value = 0;
this.mqttPublish(4, this.monitorDevice, model); this.mqttPublish(4, this.monitorDevice, model);
}, },
/** 查询设备列表 */ /** 查询所有简短设备列表 */
getList() { getList() {
this.loading = true; this.loading = true;
if (null != this.daterangeActiveTime && '' != this.daterangeActiveTime) { if (null != this.daterangeActiveTime && '' != this.daterangeActiveTime) {
this.queryParams.params["beginActiveTime"] = this.daterangeActiveTime[0]; this.queryParams.params["beginActiveTime"] = this.daterangeActiveTime[0];
this.queryParams.params["endActiveTime"] = this.daterangeActiveTime[1]; this.queryParams.params["endActiveTime"] = this.daterangeActiveTime[1];
} }
// 设置用户的角色 用以区分自己创建的设备 // 判断是否是admin角色
// 由于admin可以看所有数据所以判断 if (this.$store.state.user.roles.indexOf("admin") === -1){
if (this.$store.state.user.roles !=="admin"){
this.queryParams.userName = this.$store.state.user.name this.queryParams.userName = this.$store.state.user.name
} }
listDeviceShort(this.queryParams).then(response => { listDeviceShort(this.queryParams).then(response => {

View File

@@ -95,6 +95,10 @@ export default {
/** 查询产品列表 */ /** 查询产品列表 */
getList() { getList() {
this.loading = true; 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 => { listProduct(this.queryParams).then(response => {
this.productList = response.rows; this.productList = response.rows;
this.total = response.total; this.total = response.total;

View File

@@ -58,13 +58,12 @@
<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']" :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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> <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-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
@@ -88,7 +87,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <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> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
@@ -223,7 +222,7 @@ export default {
}, },
methods: { methods: {
init(){ init(){
if (this.$store.state.user.roles =="admin"){ if (this.$store.state.user.roles.indexOf("admin") !== -1){
this.canEdit = true this.canEdit = true
} }
}, },

View File

@@ -160,7 +160,7 @@ export default {
this.loading = true; this.loading = true;
// 设置用户的角色 用以区分自己创建的设备 // 设置用户的角色 用以区分自己创建的设备
// 由于admin可以看所有数据所以判断 // 由于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 this.queryParams.userName = this.$store.state.user.name
} }
listGroup(this.queryParams).then(response => { listGroup(this.queryParams).then(response => {

View File

@@ -24,8 +24,7 @@
</el-card> </el-card>
<el-card style="padding-bottom:100px;"> <el-card style="padding-bottom:100px;">
<el-row :gutter="30" v-loading="loading" > <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)"> <el-col :span="6" v-for="(item,index) in productList" :key="index" style="margin-bottom:30px;text-align:center;">
<div>
<el-card :body-style="{ padding: '20px'}" shadow="always"> <el-card :body-style="{ padding: '20px'}" shadow="always">
<el-row type="flex" :gutter="10" justify="space-between"> <el-row type="flex" :gutter="10" justify="space-between">
<el-col :span="20" style="text-align:left;"> <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 size="mini" type="warning" icon="el-icon-search" @click="handleViewDevice(item.productId)" v-hasPermi="['tool:gen:edit']">查看设备</el-button>
</el-button-group> </el-button-group>
</el-card> </el-card>
</div>
</el-col> </el-col>
</el-row> </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'], dicts: ['iot_yes_no', 'iot_product_status', 'iot_device_type', 'iot_network_method', 'iot_vertificate_method', 'iot_device_chip'],
data() { data() {
return { return {
userName:'',
// 判断用户是否是管理员
isAdmin:false,
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 总条数 // 总条数
@@ -152,7 +147,6 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
this.init();
}, },
activated() { activated() {
const time = this.$route.query.t; const time = this.$route.query.t;
@@ -163,20 +157,12 @@ export default {
} }
}, },
methods: { 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() { getList() {
this.loading = true; 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 => { listProduct(this.queryParams).then(response => {
this.productList = response.rows; this.productList = response.rows;
this.total = response.total; this.total = response.total;

View File

@@ -121,7 +121,8 @@ import productAlert from "./product-alert"
import productAuthorize from "./product-authorize" import productAuthorize from "./product-authorize"
import imageUpload from "../../../components/ImageUpload/index" import imageUpload from "../../../components/ImageUpload/index"
import { import {
listShortCategory listShortCategory,
listShortCategory1
} from "@/api/iot/category"; } from "@/api/iot/category";
import { import {
getProduct, getProduct,
@@ -169,6 +170,10 @@ export default {
trigger: "blur" trigger: "blur"
}] }]
}, },
// 查询参数
queryParams: {
tenantName: null,
},
}; };
}, },
@@ -179,12 +184,18 @@ export default {
if (this.form.productId != 0) { if (this.form.productId != 0) {
this.getProduct(); this.getProduct();
} }
this.init();
},
methods: {
init(){
if (this.$store.state.user.roles.indexOf("admin") === -1){
this.queryParams.tenantName = this.$store.state.user.name
}
// 获取简短分类列表 // 获取简短分类列表
listShortCategory().then(response => { listShortCategory1(this.queryParams).then(response => {
this.categoryShortList = response.data; this.categoryShortList = response.data;
}) })
}, },
methods: {
/** 返回按钮 */ /** 返回按钮 */
goBack() { goBack() {
const obj = { const obj = {

View File

@@ -71,6 +71,7 @@ export default {
pageSize: 10, pageSize: 10,
templateName: null, templateName: null,
type: null, type: null,
tenantName:''
}, },
}; };
}, },
@@ -82,6 +83,9 @@ export default {
/** 查询通用物模型列表 */ /** 查询通用物模型列表 */
getList() { getList() {
this.loading = true; 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) => { listTemplate(this.queryParams).then((response) => {
this.templateList = response.rows; this.templateList = response.rows;
this.total = response.total; this.total = response.total;

View File

@@ -76,7 +76,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: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']" >修改</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="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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -184,7 +184,7 @@
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <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> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
@@ -238,6 +238,8 @@ export default {
pageSize: 10, pageSize: 10,
templateName: null, templateName: null,
type: null, type: null,
// 增加属性
tenantName: ''
}, },
// 表单参数 // 表单参数
form: {}, form: {},
@@ -277,13 +279,16 @@ export default {
}, },
methods: { methods: {
init(){ init(){
if (this.$store.state.user.roles =="admin"){ if (this.$store.state.user.roles.indexOf("admin") !== -1){
this.canEdit = true this.canEdit = true
} }
}, },
/** 查询通用物模型列表 */ /** 查询通用物模型列表 */
getList() { getList() {
this.loading = true; 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) => { listTemplate(this.queryParams).then((response) => {
this.templateList = response.rows; this.templateList = response.rows;
this.total = response.total; this.total = response.total;
@@ -372,6 +377,8 @@ export default {
this.form.isMonitor = 0; this.form.isMonitor = 0;
this.form.isTop = 0; this.form.isTop = 0;
} }
// 添加通用物模型的修改者
this.form.updateBy = this.$store.state.user.name
updateTemplate(this.form).then((response) => { updateTemplate(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
@@ -386,6 +393,8 @@ export default {
this.form.isMonitor = 0; this.form.isMonitor = 0;
this.form.isTop = 0; this.form.isTop = 0;
} }
// 添加通用物模型的创造者
this.form.createBy = this.$store.state.user.name
addTemplate(this.form).then((response) => { addTemplate(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;