若依微服务1.2.5

1、
dev
xins 1 year ago
parent 22e1c58338
commit 5c3f1aec4b

@ -56,4 +56,6 @@ public class HwDictConstants {
public static final String REDIS_KEY_DEVICE_INFO = "hw_device_info";//保存设备用户名和密码等信息的redis的key
public static final String DEVICE_MODE_STATUS_NORMAL = "1";//设备模型正常状态
}

@ -144,6 +144,16 @@ public class HwDeviceController extends BaseController
return success(hwSceneService.selectHwSceneList(scene));
}
@RequiresPermissions("business:device:list")
@GetMapping("/getEditedScenes")
public AjaxResult getEditedScenes(HwScene scene)
{
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = loginUser.getSysUser();
scene.setTenantId(user.getTenantId());
return success(hwSceneService.selectHwSceneList4Select(scene));
}
/**
*
*/

@ -8,6 +8,9 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.business.domain.HwDeviceModeFunction;
import com.ruoyi.business.domain.HwScene;
import com.ruoyi.business.service.IHwSceneService;
import com.ruoyi.common.core.constant.HwDictConstants;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.context.SecurityContextHolder;
import com.ruoyi.common.security.utils.SecurityUtils;
@ -44,6 +47,9 @@ public class HwDeviceModeController extends BaseController {
@Autowired
private IHwDeviceModeService hwDeviceModeService;
@Autowired
private IHwSceneService hwSceneService;
/**
*
*/
@ -51,7 +57,8 @@ public class HwDeviceModeController extends BaseController {
@GetMapping("/list")
public TableDataInfo list(HwDeviceMode hwDeviceMode) {
startPage();
List<HwDeviceMode> list = hwDeviceModeService.selectHwDeviceModeList(hwDeviceMode);
hwDeviceMode.setDeviceModeStatus(HwDictConstants.DEVICE_MODE_STATUS_NORMAL);
List<HwDeviceMode> list = hwDeviceModeService.selectHwDeviceModeJoinList(hwDeviceMode);
return getDataTable(list);
}
@ -91,6 +98,10 @@ public class HwDeviceModeController extends BaseController {
@Log(title = "设备模型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody HwDeviceMode hwDeviceMode) {
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = loginUser.getSysUser();
hwDeviceMode.setTenantId(user.getTenantId());
hwDeviceMode.setCreateBy(user.getUserName());
return toAjax(hwDeviceModeService.insertHwDeviceMode(hwDeviceMode));
}
@ -114,4 +125,19 @@ public class HwDeviceModeController extends BaseController {
return toAjax(hwDeviceModeService.deleteHwDeviceModeByDeviceModeIds(deviceModeIds));
}
@RequiresPermissions("business:deviceMode:list")
@GetMapping("/getScenes")
public AjaxResult getScenes(HwScene scene) {
return success(hwSceneService.selectHwSceneList(scene));
}
@RequiresPermissions("business:deviceMode:list")
@GetMapping("/getEditedScenes")
public AjaxResult getEditedScenes(HwScene scene) {
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = loginUser.getSysUser();
scene.setTenantId(user.getTenantId());
return success(hwSceneService.selectHwSceneList4Select(scene));
}
}

@ -63,6 +63,10 @@ public class HwDeviceMode extends BaseEntity
@Excel(name = "预留字段")
private String deviceModeField;
private String tenantName;
private String sceneName;
/** 设备模型功能信息 */
private List<HwDeviceModeFunction> hwDeviceModeFunctionList;
@ -185,6 +189,22 @@ public class HwDeviceMode extends BaseEntity
this.hwDeviceModeFunctionList = hwDeviceModeFunctionList;
}
public String getTenantName() {
return tenantName;
}
public void setTenantName(String tenantName) {
this.tenantName = tenantName;
}
public String getSceneName() {
return sceneName;
}
public void setSceneName(String sceneName) {
this.sceneName = sceneName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -135,4 +135,12 @@ public interface HwDeviceModeMapper
*/
public List<HwDeviceModeParameter> selectDeviceModeParametersByModeFunctionId(Long modeFunctionId);
/**
* ,Join
*
* @param hwDeviceMode
* @return
*/
public List<HwDeviceMode> selectHwDeviceModeJoinList(HwDeviceMode hwDeviceMode);
}

@ -6,6 +6,7 @@ import java.util.Map;
import com.ruoyi.business.domain.HwDeviceMode;
import com.ruoyi.business.domain.HwDeviceModeFunction;
import com.ruoyi.business.domain.HwDeviceModeParameter;
import com.ruoyi.common.datascope.annotation.DataScope;
/**
* Service
@ -99,4 +100,12 @@ public interface IHwDeviceModeService
*/
public Map<String, List<HwDeviceModeParameter>> selectDeviceModeParametersByModeFunctionId(Long modeFunctionId);
/**
* ,Join
*
* @param hwDeviceMode
* @return
*/
public List<HwDeviceMode> selectHwDeviceModeJoinList(HwDeviceMode hwDeviceMode);
}

@ -23,6 +23,8 @@ public interface IHwSceneService
public List<HwScene> selectHwSceneBySceneModeId(Long sceneModeId);
//场景选择
List<HwScene> selectHwSceneByTenantId(Long tenantId);
/**
*
*

@ -115,6 +115,7 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService {
}
});
hwDeviceMode.setCreateTime(DateUtils.getNowDate());
hwDeviceMode.setCreateBy(SecurityUtils.getUsername());
int rows = hwDeviceModeMapper.insertHwDeviceMode(hwDeviceMode);
@ -324,6 +325,18 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService {
return hwDeviceModeParametersMap;
}
/**
* ,Join
*
* @param hwDeviceMode
* @return
*/
@Override
@DataScope(tenantAlias = "hdm")
public List<HwDeviceMode> selectHwDeviceModeJoinList(HwDeviceMode hwDeviceMode) {
return hwDeviceModeMapper.selectHwDeviceModeJoinList(hwDeviceMode);
}
/**
* @param: hwDeviceModeFunction
* @description

@ -7,9 +7,7 @@ import java.util.List;
import com.ruoyi.business.domain.HwSceneMode;
import com.ruoyi.business.domain.VO.HwSceneVo;
import com.ruoyi.common.core.constant.HwDictConstants;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.datascope.annotation.DataScope;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysUser;
@ -28,7 +26,8 @@ import com.ruoyi.business.service.IHwSceneService;
* @date 2023-08-23
*/
@Service
public class HwSceneServiceImpl implements IHwSceneService {
public class HwSceneServiceImpl implements IHwSceneService
{
@Autowired
private HwSceneMapper hwSceneMapper;
@Autowired
@ -42,7 +41,8 @@ public class HwSceneServiceImpl implements IHwSceneService {
* @return
*/
@Override
public HwScene selectHwSceneBySceneId(Long sceneId) {
public HwScene selectHwSceneBySceneId(Long sceneId)
{
return hwSceneMapper.selectHwSceneBySceneId(sceneId);
}
@ -53,6 +53,17 @@ public class HwSceneServiceImpl implements IHwSceneService {
return hwScenes;
}
@Override
public List<HwScene> selectHwSceneByTenantId(Long tenantId) {
if (tenantId == 0){
return hwSceneMapper.selectHwSceneByTenantId0(tenantId);
}
else
return hwSceneMapper.selectHwSceneByTenantIdNot0(tenantId);
}
/**
*
*
@ -60,25 +71,21 @@ public class HwSceneServiceImpl implements IHwSceneService {
* @return
*/
@Override
@DataScope(tenantAlias = "hs")
public List<HwScene> selectHwSceneList(HwScene hwScene) {
List<HwScene> scenes = hwSceneMapper.selectHwSceneList(hwScene);
boolean defaultFlag = false;
for (HwScene scene : scenes) {
if (defaultFlag) {
scene.setDefaultFlag(HwDictConstants.DEVICE_DEFAULT_FLAG_NO);
} else {
if (scene.getDefaultFlag().equalsIgnoreCase(HwDictConstants.DEVICE_DEFAULT_FLAG_YES)) {
defaultFlag = true;
}
}
}
return scenes;
public List<HwScene> selectHwSceneList(HwScene hwScene)
{
return hwSceneMapper.selectHwSceneList(hwScene);
}
@Override
public List<HwSceneVo> selectHwSceneList2(HwSceneVo hwScene) {
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
if (sysUser.getUserName().equals("admin"))
return hwSceneMapper.selectHwSceneVoList(hwScene);
else
{
return hwSceneMapper.selectHwSceneVoListByTenantId(sysUser.getTenantId());
}
}
@ -89,9 +96,10 @@ public class HwSceneServiceImpl implements IHwSceneService {
* @return
*/
@Override
public int insertHwScene(HwScene hwScene) {
if (hwScene.getDefaultFlag() == "1") {
hwSceneMapper.updateDefaultFlag(hwScene.getTenantId());
public int insertHwScene(HwScene hwScene)
{
if(hwScene.getDefaultFlag() == "1"){
hwSceneMapper.updateDefaultFlag(hwScene.getTenantId());
}
hwScene.setDefaultFlag("1");
LoginUser loginUser = SecurityUtils.getLoginUser();
@ -101,20 +109,20 @@ public class HwSceneServiceImpl implements IHwSceneService {
hwScene.setSceneId(lon);
hwScene.setCreateBy(sysUser.getNickName());
if (hwScene.getPreserveTime() == null) {
if (hwScene.getPreserveTime()==null){
hwScene.setPreserveTime(new BigDecimal(90));
}
if (hwScene.getTestPreserveTime() == null) {
if (hwScene.getTestPreserveTime()==null){
hwScene.setTestPreserveTime(new BigDecimal(30));
}
String randomKey = RandomStringUtils.random(12, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789");
String randomSecret = RandomStringUtils.random(16, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789");
String randomSecret = RandomStringUtils.random(16,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789");
hwScene.setModeKey(randomKey);
hwScene.setModeSecret(randomSecret);
hwScene.setCreateTime(DateUtils.getNowDate());
List<HwScene> list = new ArrayList<HwScene>();
list.add(hwScene);
redisService.setCacheList(hwScene.getSceneId() + "", list);
redisService.setCacheList(hwScene.getSceneId()+"",list);
return hwSceneMapper.insertHwScene(hwScene);
}
@ -126,15 +134,16 @@ public class HwSceneServiceImpl implements IHwSceneService {
* @return
*/
@Override
public int updateHwScene(HwScene hwScene) {
if (hwScene.getDefaultFlag() == "1") {
public int updateHwScene(HwScene hwScene)
{
if(hwScene.getDefaultFlag() == "1"){
hwSceneMapper.updateDefaultFlag(hwScene.getTenantId());
}
hwScene.setDefaultFlag("1");
hwScene.setUpdateTime(DateUtils.getNowDate());
List<HwScene> list = new ArrayList<HwScene>();
list.add(hwScene);
redisService.setCacheList(hwScene.getSceneId() + "", list);
redisService.setCacheList(hwScene.getSceneId()+"",list);
return hwSceneMapper.updateHwScene(hwScene);
}
@ -145,12 +154,13 @@ public class HwSceneServiceImpl implements IHwSceneService {
* @return
*/
@Override
public int deleteHwSceneBySceneIds(Long[] sceneIds) {
public int deleteHwSceneBySceneIds(Long[] sceneIds)
{
List<Long> list = new ArrayList<>();
for (int i = 0; i < sceneIds.length; i++) {
for (int i = 0; i < sceneIds.length;i++){
list.add(sceneIds[i]);
}
redisService.deleteObject(sceneIds + "");
redisService.deleteObject(sceneIds+"");
return hwSceneMapper.deleteHwSceneBySceneIds(sceneIds);
}
@ -161,8 +171,9 @@ public class HwSceneServiceImpl implements IHwSceneService {
* @return
*/
@Override
public int deleteHwSceneBySceneId(Long sceneId) {
redisService.deleteObject(sceneId + "");
public int deleteHwSceneBySceneId(Long sceneId)
{
redisService.deleteObject(sceneId+"");
return hwSceneMapper.deleteHwSceneBySceneId(sceneId);
}
}

@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deviceModeField" column="device_mode_field" />
<result property="sceneName" column="scene_name" />
<result property="tenantName" column="tenant_name" />
</resultMap>
<resultMap id="HwDeviceModeHwDeviceModeFunctionResult" type="HwDeviceMode" extends="HwDeviceModeResult">
@ -91,6 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 租户数据范围过滤 -->
${params.tenantDataScope}
</where>
order by device_mode_id desc
</select>
<select id="selectHwDeviceModeByDeviceModeId" parameterType="Long" resultMap="HwDeviceModeHwDeviceModeFunctionResult">
@ -289,4 +292,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where mode_function_id = #{modeFunctionId}
</select>
<select id="selectHwDeviceModeJoinList" parameterType="HwDeviceMode" resultMap="HwDeviceModeResult">
select hdm.device_mode_id,hdm.device_mode_name,hdm.gps_flag,hdm.mode_classfication,
hs.scene_name,ht.tenant_name,hdm.tenant_id,hdm.scene_id
from hw_device_mode hdm
left join hw_scene hs on hdm.scene_id = hs.scene_id
left join hw_tenant ht on hdm.tenant_id=ht.tenant_id
<where>
<if test="deviceModeName != null and deviceModeName != ''"> and hdm.device_mode_name like concat('%', #{deviceModeName}, '%')</if>
<if test="tenantId != null "> and hdm.tenant_id = #{tenantId}</if>
<if test="sceneId != null "> and hdm.scene_id = #{sceneId}</if>
<if test="languageCode != null and languageCode != ''"> and hdm.language_code = #{languageCode}</if>
<if test="gpsFlag != null and gpsFlag != ''"> and hdm.gps_flag = #{gpsFlag}</if>
<if test="deviceModeStatus != null and deviceModeStatus != ''"> and hdm.device_mode_status = #{deviceModeStatus}</if>
<if test="commonFlag != null and commonFlag != ''"> and hdm.common_flag = #{commonFlag}</if>
<if test="modeClassfication != null "> and hdm.mode_classfication = #{modeClassfication}</if>
<if test="deviceModePic != null and deviceModePic != ''"> and hdm.device_mode_pic = #{deviceModePic}</if>
<if test="dataVerifyLevel != null and dataVerifyLevel != ''"> and hdm.data_verify_level = #{dataVerifyLevel}</if>
<if test="deviceModeField != null and deviceModeField != ''"> and hdm.device_mode_field = #{deviceModeField}</if>
<!-- 租户数据范围过滤 -->
${params.tenantDataScope}
</where>
</select>
</mapper>

@ -45,7 +45,7 @@ export function delDevice(deviceId) {
}
// 查询场景信息列表供选择使用(例如下拉列表)
// 查询场景信息列表供查询页面选择使用(例如下拉列表)
export function getScenes(query) {
return request({
url: '/business/device/getScenes',
@ -54,6 +54,14 @@ export function getScenes(query) {
})
}
// 查询场景信息列表供编辑页面选择使用(例如下拉列表)
export function getEditedScenes(query) {
return request({
url: '/business/device/getEditedScenes',
method: 'get',
params: query
})
}
// 查询监控单元树
export function getMonitorTree(sceneId) {

@ -43,6 +43,20 @@ export function delDeviceMode(deviceModeId) {
})
}
// 查询场景信息列表供插叙页面选择使用(例如下拉列表)
export function getScenes(query) {
return request({
url: '/business/deviceMode/getScenes',
method: 'get',
params: query
})
}
// 查询场景信息列表供编辑页面选择使用(例如下拉列表)
export function getEditedScenes(query) {
return request({
url: '/business/deviceMode/getEditedScenes',
method: 'get',
params: query
})
}

@ -232,6 +232,34 @@ export const dynamicRoutes = [
meta: { title: '修改设备模型', activeMenu: '/business/deviceMode' }
}
]
},
{
path: '/electronicFence/fence-add',
component: Layout,
hidden: true,
permissions: ['business:electronicFence:add'],
children: [
{
path: 'index',
component: () => import('@/views/business/electronicFence/editElectronicFence'),
name: 'ModeAdd',
meta: { title: '添加电子围栏', activeMenu: '/business/electronicFence' }
}
]
},
{
path: '/electronicFence/fence-edit',
component: Layout,
hidden: true,
permissions: ['business:electronicFence:edit'],
children: [
{
path: 'index/:electronicFenceId(\\d+)',
component: () => import('@/views/business/electronicFence/editElectronicFence'),
name: 'ModeEdit',
meta: { title: '修改电子围栏', activeMenu: '/business/electronicFence' }
}
]
}
]

@ -62,6 +62,52 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="设备模型图片" prop="deviceModePic">
<el-upload
single
:action="uploadImgUrl"
list-type="picture-card"
:limit="limit"
:on-success="handleUploadSuccess"
:before-upload="handleBeforeUpload"
:on-error="handleUploadError"
:on-exceed="handleExceed"
ref="imageUpload"
:on-remove="handleDeletePicture"
:show-file-list="true"
:headers="headers"
:file-list="fileList"
:on-preview="handlePictureCardPreview"
:class="{hide: this.fileList.length >= 1}"
>
<i class="el-icon-plus"></i>
</el-upload>
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
请上传
<template v-if="fileSize"> <b style="color: #f56c6c">{{ fileSize }}MB</b></template>
<template v-if="fileType"> <b style="color: #f56c6c">{{ fileType.join("/") }}</b></template>
的文件
</div>
<el-dialog
:visible.sync="dialogVisible"
title="预览"
width="800"
append-to-body
>
<img
:src="dialogImageUrl"
style="display: block; max-width: 100%; margin: 0 auto"
/>
</el-dialog>
</el-form-item>
</el-col>
</el-row>
</el-form>
@ -302,8 +348,7 @@
</template>
<script>
import {getScenes} from "@/api/business/scene";
import {addDeviceMode, getDeviceMode, updateDeviceMode} from "@/api/business/deviceMode";
import {addDeviceMode, getDeviceMode, updateDeviceMode,getEditedScenes} from "@/api/business/deviceMode";
import deviceModeService from "./deviceModeService";
import deviceModeEvent from "./deviceModeEvent";
import {
@ -311,6 +356,7 @@ import {
delDeviceModeFunction,
updateDeviceModeFunction
} from "@/api/business/deviceModeFunction";
import {getToken} from "@/utils/auth";
export default {
dicts: ['hw_device_mode_gps_flag', 'hw_mode_function_mode_classfication', 'hw_mode_function_function_type', 'hw_mode_function_function_type', 'hw_mode_function_data_type', 'hw_mode_function_display_flag', 'hw_mode_function_rw_flag'],
@ -318,7 +364,29 @@ export default {
deviceModeService,
deviceModeEvent
},
props: [],
props: {
value: [String, Object, Array],
//
limit: {
type: Number,
default: 1,
},
// (MB)
fileSize: {
type: Number,
default: 5,
},
// , ['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["png", "jpg", "jpeg"],
},
//
isShowTip: {
type: Boolean,
default: true
}
},
data() {
return {
info: {},
@ -369,6 +437,7 @@ export default {
//
scenes: [],
//
languages: [],
@ -390,6 +459,19 @@ export default {
//
tableHeight: document.documentElement.scrollHeight - 245 + "px",
number: 0,
uploadList: [],
dialogImageUrl: "",
dialogVisible: false,
hideUpload: false,
uploadImgUrl: process.env.VUE_APP_BASE_API + "/file/upload", //
headers: {
Authorization: "Bearer " + getToken(),
},
fileList: [],
}
},
created() {
@ -404,7 +486,7 @@ export default {
// this.languages = response.data;
// });
getScenes().then(response => {
getEditedScenes().then(response => {
this.scenes = response.data;
});
@ -417,6 +499,12 @@ export default {
this.servicesData = (res.data.deviceModeFunctionMap)['2'];
this.eventsData = (res.data.deviceModeFunctionMap)['3'];
this.deviceModeId = deviceModeId;
if (res.data.deviceMode.deviceModePic != null) {
let previewFile = {};
previewFile.url = res.data.deviceMode.deviceModePic
this.fileList.push(previewFile);
}
// this.columns = res.data.rows;
});
/** 查询字典下拉列表 */
@ -661,8 +749,108 @@ export default {
}
})
},
/**上传图片处理*/
// loading
handleBeforeUpload(file) {
let isImg = false;
if (this.fileType.length) {
let fileExtension = "";
if (file.name.lastIndexOf(".") > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
}
isImg = this.fileType.some(type => {
if (file.type.indexOf(type) > -1) return true;
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
return false;
});
} else {
isImg = file.type.indexOf("image") > -1;
}
if (!isImg) {
this.$modal.msgError(`文件格式不正确, 请上传${this.fileType.join("/")}图片格式文件!`);
return false;
}
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
if (!isLt) {
this.$modal.msgError(`上传头像图片大小不能超过 ${this.fileSize} MB!`);
return false;
}
}
this.$modal.loading("正在上传图片,请稍候...");
this.number++;
},
checkPicture(file) {
},
//
handleExceed() {
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} !`);
},
//
handleUploadSuccess(res, file) {
if (res.code === 200) {
this.uploadList.push(res.data.url);
this.uploadedSuccessfully();
} else {
this.number--;
this.$modal.closeLoading();
this.$modal.msgError(res.msg);
this.$refs.imageUpload.handleRemove(file);
this.uploadedSuccessfully();
}
},
//
uploadedSuccessfully() {
if (this.number > 0 && this.uploadList.length === this.number) {
this.fileList = this.fileList.concat(this.uploadList);
this.uploadList = [];
this.number = 0;
this.info.deviceModePic = this.fileList[0];
// this.$emit("input", this.listToString(this.fileList));
this.$modal.closeLoading();
}
},
//
handleDeletePicture(file) {
const findex = this.fileList.map(f => f.name).indexOf(file.name);
if (findex > -1) {
this.fileList.splice(findex, 1);
// this.$emit("input", this.listToString(this.fileList));
}
this.info.deviceModePic = '';
},
//
handleUploadError() {
this.$modal.msgError("上传图片失败,请重试");
this.$modal.closeLoading();
},
//
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
//
listToString(list, separator) {
let strs = "";
separator = separator || ",";
for (let i in list) {
if (list[i].url) {
strs += list[i].url.replace(this.baseUrl, "") + separator;
}
}
return strs != '' ? strs.substr(0, strs.length - 1) : '';
},
},
}
</script>

@ -9,55 +9,36 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="所属租户" prop="tenantId">
<el-input
v-model="queryParams.tenantId"
placeholder="请输入租户"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="所属场景" prop="sceneId">
<el-input
v-model="queryParams.sceneId"
placeholder="请输入所属场景"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="语言" prop="languageCode">
<el-select v-model="queryParams.languageCode" placeholder="请选择">
<el-select v-model="queryParams.sceneId" placeholder="请选择" @input="sceneChange">
<el-option
v-for="(language, index) in languages"
v-for="(scene, index) in scenes"
:key="index"
:label="language.languageName"
:value="language.languageCode"
:label="scene.sceneName"
:value="scene.sceneId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="定位标识" prop="gpsFlag">
<el-input
v-model="queryParams.gpsFlag"
placeholder="请输入定位标识"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="通用标识" prop="commonFlag">
<el-input
v-model="queryParams.commonFlag"
placeholder="请输入是否通用物模型"
clearable
@keyup.enter.native="handleQuery"
/>
<el-select v-model="queryParams.gpsFlag" placeholder="请选择" clearable>
<el-option
v-for="dict in dict.type.hw_device_mode_gps_flag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="模型分类" prop="modeClassfication">
<el-input
v-model="queryParams.modeClassfication"
placeholder="请输入模型分类"
clearable
@keyup.enter.native="handleQuery"
/>
<el-select v-model="queryParams.modeClassfication" placeholder="请选择" clearable>
<el-option
v-for="dict in dict.type.hw_mode_function_mode_classfication"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
@ -106,13 +87,18 @@
<el-table v-loading="loading" :data="deviceModeList" @selection-change="handleSelectionChange">
<el-table-column label="模型名称" align="center" prop="deviceModeName"/>
<el-table-column label="所属租户" align="center" prop="tenantId"/>
<el-table-column label="所属场景" align="center" prop="sceneId"/>
<el-table-column label="语言" align="center" prop="languageCode" :formatter="formatRow"/>
<el-table-column label="定位标识" align="center" prop="gpsFlag"/>
<el-table-column label="是否通用物模型" align="center" prop="commonFlag"/>
<el-table-column label="模型分类" align="center" prop="modeClassfication"/>
<el-table-column label="设备模型图片地址" align="center" prop="deviceModePic"/>
<el-table-column label="所属租户" align="center" prop="tenantName"/>
<el-table-column label="所属场景" align="center" prop="sceneName"/>
<el-table-column label="定位标识" align="center" prop="gpsFlag">
<template slot-scope="scope">
<dict-tag :options="dict.type.hw_device_mode_gps_flag" :value="scope.row.gpsFlag"/>
</template>
</el-table-column>
<el-table-column label="模型分类" align="center" prop="modeClassfication">
<template slot-scope="scope">
<dict-tag :options="dict.type.hw_mode_function_mode_classfication" :value="scope.row.modeClassfication"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -147,11 +133,11 @@
</template>
<script>
import {listDeviceMode, getDeviceMode, delDeviceMode, addDeviceMode, updateDeviceMode} from "@/api/business/deviceMode";
import {getScenes} from "@/api/business/scene";
import {listDeviceMode, getDeviceMode, delDeviceMode, addDeviceMode, updateDeviceMode,getScenes} from "@/api/business/deviceMode";
import {getLanguages} from "@/api/basic/language";
export default {
dicts: ['hw_device_mode_gps_flag', 'hw_mode_function_mode_classfication'],
name: "DeviceMode",
data() {
return {
@ -242,6 +228,14 @@ export default {
},
},
activated() {
const time = this.$route.query.t;
if (time != null && time != this.uniqueId) {
this.uniqueId = time;
this.queryParams.pageNum = Number(this.$route.query.pageNum);
this.getList();
}
},
methods: {
/** 查询设备模型列表 */
@ -310,15 +304,7 @@ export default {
const deviceModeId = row.deviceModeId || this.ids
const deviceModeName = row.deviceModeName || this.tableNames[0];
const params = {pageNum: this.queryParams.pageNum};
getDeviceMode(deviceModeId).then(response => {
// this.form = response.data;
// this.hwDeviceModeFunctionList = response.data.hwDeviceModeFunctionList;
// this.open = true;
// this.title = "";
this.$tab.openPage("修改[" + deviceModeName + "]", '/deviceMode/mode-edit/index/' + deviceModeId, params);
});
this.$tab.openPage("修改设备模型[" + deviceModeName + "]", '/deviceMode/mode-edit/index/' + deviceModeId, params);
},
/** 提交按钮 */
submitForm() {

@ -0,0 +1,148 @@
<template>
<div class="container">
<div style="padding: 12px">
<el-form :inline="true" :model="form" class="demo-form-inline">
<el-form-item label="条件1">
<el-input v-model="form.data1" placeholder="条件1"></el-input>
</el-form-item>
<el-form-item label="2">
<el-input v-model="form.data2" placeholder="2"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="a"></el-button>
</el-form-item>
</el-form>
<div>
<el-button type="primary" @click="createPolygon"></el-button>
<el-button type="primary" @click="createCircle"></el-button>
<el-button type="primary" @click="clear"></el-button>
<el-button type="primary" @click="getDate"></el-button>
</div>
</div>
<div id="map" class="map"></div>
</div>
</template>
<script>
let map = null
let polyEditor = null
let CircleEditor = null
let path = [[116.390969, 39.911592], [116.391496, 39.909008], [116.389264, 39.909765], [116.38802, 39.911016]]
let path1 = [[116.391969, 39.912592], [116.392496, 39.910008], [116.390264, 39.910765], [116.38902, 39.912016]]
export default {
components: {},
data() {
return {
form: {
data1: '',
data2: ''
}
}
},
mounted() {
map = new AMap.Map('map', {
zoom: 11,
center: [113.4, 23.35],
});
CircleEditor = new AMap.CircleEditor(map);
CircleEditor.on('add', function (data) {
let circle = data.target;
// CircleEditor.addAdsorbCircles(circle);
circle.on('dblclick', () => {
CircleEditor.setTarget(circle);
CircleEditor.open();
})
})
polyEditor = new AMap.PolygonEditor(map);
polyEditor.on('add', function (data) {
let polygon = data.target;
polyEditor.addAdsorbPolygons(polygon);
polygon.on('dblclick', () => {
polyEditor.setTarget(polygon);
polyEditor.open();
})
})
},
methods: {
a() {
this.clear();
[path, path1].forEach(e => {
this.setPolygon(e)
})
},
clear() {
if (!polyEditor) return
CircleEditor.close();
polyEditor.close();
let polygons = map.getAllOverlays('polygon');
let circles = map.getAllOverlays('circle');
map.remove(polygons)
map.remove(circles)
},
createPolygon() {
polyEditor.close();
polyEditor.setTarget();
polyEditor.open()
},
createCircle() {
CircleEditor.close();
CircleEditor.setTarget();
CircleEditor.open()
},
setPolygon(e) {
let thisPolygon = new AMap.Polygon({path: e});
thisPolygon.on('dblclick', () => {
polyEditor.setTarget(thisPolygon);
polyEditor.open();
})
map.add(thisPolygon)
map.setFitView()
},
getDate() {
let polygons = map.getAllOverlays('polygon');
let circles = map.getAllOverlays('circle');
let list = polygons.map(e => e._opts.path)
let list1 = circles.map(e => {
return {
center: e._opts.center,
radius: e._opts.radius
}
})
let params = []
let params1 = []
list.forEach((e, index) => {
e.forEach(val => {
params.push({
longitude: val[0],
latitude: val[1],
index: index
})
})
})
list1.forEach((e, index) => {
params1.push({
center: e.center,
radius: e.radius,
index: index
})
})
console.log(params)
console.log(params1)
}
}
};
</script>
<style lang="less" scoped>
.container {
height: calc(100vh - 84px)
}
.map {
width: 100%;
height: 100%;
}
</style>

@ -370,20 +370,15 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加电子围栏";
const params = {pageNum: this.queryParams.pageNum};
this.$tab.openPage("添加电子围栏", '/electronicFence/fence-add/index', params);
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const electronicFenceId = row.electronicFenceId || this.ids
getElectronicFence(electronicFenceId).then(response => {
this.form = response.data;
this.hwFenceTargetList = response.data.hwFenceTargetList;
this.open = true;
this.title = "修改电子围栏";
});
let electronicFenceName = row.electronicName;
this.$tab.openPage("修改电子围栏[" + electronicFenceName + "]", '/electronicFence/fence-edit/index/' + electronicFenceId, params);
},
/** 提交按钮 */
submitForm() {

Loading…
Cancel
Save