Commit cea890c8 authored by wanghao's avatar wanghao

1 燃气用户下 增加 安全装置加装信息 开发,并自测。

parent e56ada59
...@@ -8,7 +8,9 @@ import com.zehong.common.utils.SecurityUtils; ...@@ -8,7 +8,9 @@ import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.ServletUtils; import com.zehong.common.utils.ServletUtils;
import com.zehong.framework.web.service.TokenService; import com.zehong.framework.web.service.TokenService;
import com.zehong.system.domain.TDetectorUserCount; import com.zehong.system.domain.TDetectorUserCount;
import com.zehong.system.domain.vo.GasUserAndSafetyDeviceVo;
import com.zehong.system.domain.vo.TDetectorUserInspectVo; import com.zehong.system.domain.vo.TDetectorUserInspectVo;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -177,6 +179,21 @@ public class TDetectorUserController extends BaseController ...@@ -177,6 +179,21 @@ public class TDetectorUserController extends BaseController
return toAjax(tDetectorUserService.insertTDetectorUser(tDetectorUser)); return toAjax(tDetectorUserService.insertTDetectorUser(tDetectorUser));
} }
/**
* 新增燃气用户和安全装置
*/
@PostMapping("/addUserAndSafetyDevice")
public AjaxResult addUserAndSafetyDevice(@RequestBody GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo) {
return toAjax(tDetectorUserService.addUserAndSafetyDevice(gasUserAndSafetyDeviceVo));
}
/**
* 修改燃气用户和安全装置
*/
@PostMapping("/updateUserAndSafetyDevice")
public AjaxResult updateUserAndSafetyDevice(@RequestBody GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo) {
return toAjax(tDetectorUserService.updateUserAndSafetyDevice(gasUserAndSafetyDeviceVo));
}
/** /**
* 修改燃气用户 * 修改燃气用户
*/ */
......
...@@ -2,6 +2,7 @@ package com.zehong.web.controller.supervise; ...@@ -2,6 +2,7 @@ package com.zehong.web.controller.supervise;
import java.util.List; import java.util.List;
import com.zehong.system.domain.TDetailInfoList;
import com.zehong.system.domain.TDeviceInfoS; import com.zehong.system.domain.TDeviceInfoS;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -124,4 +125,15 @@ public class TGasuserSafetyDeviceInfoController extends BaseController ...@@ -124,4 +125,15 @@ public class TGasuserSafetyDeviceInfoController extends BaseController
public void deleteSafetyDeviceInfo(@RequestBody Long safetyDetailId){ public void deleteSafetyDeviceInfo(@RequestBody Long safetyDetailId){
tGasuserSafetyDeviceInfoService.deleteSafetyDeviceInfo(safetyDetailId); tGasuserSafetyDeviceInfoService.deleteSafetyDeviceInfo(safetyDetailId);
} }
/**
* 根据 燃气用户id 查询集合数据
* @param userId i
*/
@GetMapping("/selectSafetyDeviceDetailInfoList/{userId}")
public AjaxResult selectSafetyDeviceDetailInfoList(@PathVariable("userId") Long userId){
return AjaxResult.success(tGasuserSafetyDeviceInfoService.selectSafetyDeviceDetailInfoList(userId));
}
} }
...@@ -51,8 +51,8 @@ public class TGasuserSafetyDeviceInfo extends BaseEntity ...@@ -51,8 +51,8 @@ public class TGasuserSafetyDeviceInfo extends BaseEntity
/** 安装位置 */ /** 安装位置 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "安装位置", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "安装位置")
private Date deviceInstallPosition; private String deviceInstallPosition;
/** 负责人 */ /** 负责人 */
@Excel(name = "负责人") @Excel(name = "负责人")
...@@ -138,12 +138,12 @@ public class TGasuserSafetyDeviceInfo extends BaseEntity ...@@ -138,12 +138,12 @@ public class TGasuserSafetyDeviceInfo extends BaseEntity
{ {
return deviceInstallTime; return deviceInstallTime;
} }
public void setDeviceInstallPosition(Date deviceInstallPosition) public void setDeviceInstallPosition(String deviceInstallPosition)
{ {
this.deviceInstallPosition = deviceInstallPosition; this.deviceInstallPosition = deviceInstallPosition;
} }
public Date getDeviceInstallPosition() public String getDeviceInstallPosition()
{ {
return deviceInstallPosition; return deviceInstallPosition;
} }
......
package com.zehong.system.domain.vo;
import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TGasuserSafetyDeviceInfo;
import java.util.List;
public class GasUserAndSafetyDeviceVo {
private TDetectorUser detectorUser;
private List<TGasuserSafetyDeviceInfo> gasuserSafetyDeviceInfoList;
public TDetectorUser getDetectorUser() {
return detectorUser;
}
public void setDetectorUser(TDetectorUser detectorUser) {
this.detectorUser = detectorUser;
}
public List<TGasuserSafetyDeviceInfo> getGasuserSafetyDeviceInfoList() {
return gasuserSafetyDeviceInfoList;
}
public void setGasuserSafetyDeviceInfoList(List<TGasuserSafetyDeviceInfo> gasuserSafetyDeviceInfoList) {
this.gasuserSafetyDeviceInfoList = gasuserSafetyDeviceInfoList;
}
}
package com.zehong.system.mapper; package com.zehong.system.mapper;
import java.util.List; import java.util.List;
import com.zehong.system.domain.TGasuserSafetyDeviceInfo; import com.zehong.system.domain.TGasuserSafetyDeviceInfo;
import org.apache.ibatis.annotations.Param;
/** /**
* 用户管理-燃气用户-安全装置加装维护Mapper接口 * 用户管理-燃气用户-安全装置加装维护Mapper接口
...@@ -74,4 +76,13 @@ public interface TGasuserSafetyDeviceInfoMapper ...@@ -74,4 +76,13 @@ public interface TGasuserSafetyDeviceInfoMapper
public int deleteSafetyDeviceListInfo(Long[] gasUserSafetyDeviceIds); public int deleteSafetyDeviceListInfo(Long[] gasUserSafetyDeviceIds);
public int deleteSafetyDeviceInfo(Long deviceId); public int deleteSafetyDeviceInfo(Long deviceId);
List<TGasuserSafetyDeviceInfo> selectSafetyDeviceDetailInfoList(Long userId);
/**
* 将关联设备信息与设备进行绑定
* @param gettDeviceInfoS
*/
void updatetRelationSafetyDeviceInfo(@Param("gettDeviceInfoS")List<TGasuserSafetyDeviceInfo> gettDeviceInfoS,
@Param("id") Long id);
} }
...@@ -5,6 +5,7 @@ import java.util.Map; ...@@ -5,6 +5,7 @@ import java.util.Map;
import com.zehong.system.domain.TDetectorUser; import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TDetectorUserCount; import com.zehong.system.domain.TDetectorUserCount;
import com.zehong.system.domain.vo.GasUserAndSafetyDeviceVo;
import com.zehong.system.domain.vo.TDetectorUserInspectVo; import com.zehong.system.domain.vo.TDetectorUserInspectVo;
import com.zehong.system.domain.vo.TDetectorUserVO; import com.zehong.system.domain.vo.TDetectorUserVO;
import com.zehong.system.domain.vo.TMassMarksDetectorUserVO; import com.zehong.system.domain.vo.TMassMarksDetectorUserVO;
...@@ -103,6 +104,20 @@ public interface ITDetectorUserService ...@@ -103,6 +104,20 @@ public interface ITDetectorUserService
*/ */
public int insertTDetectorUser(TDetectorUser tDetectorUser); public int insertTDetectorUser(TDetectorUser tDetectorUser);
/**
* 新增燃气用户和安全装置
* @param gasUserAndSafetyDeviceVo gas
* @return r
*/
public int addUserAndSafetyDevice(GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo);
/**
* 修改燃气用户和安全装置
* @param gasUserAndSafetyDeviceVo gas
* @return r
*/
public int updateUserAndSafetyDevice(GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo);
/** /**
* 修改燃气用户 * 修改燃气用户
* *
......
...@@ -68,10 +68,16 @@ public interface ITGasuserSafetyDeviceInfoService ...@@ -68,10 +68,16 @@ public interface ITGasuserSafetyDeviceInfoService
/** /**
* 关联设备数据删除接口 * 关联设备数据删除接口
* @param deviceIds * @param deviceId
*/ */
void deleteSafetyDeviceInfo(Long deviceId); void deleteSafetyDeviceInfo(Long deviceId);
/**
* 根据 燃气用户id 查询数据
* @param userId
* @return
*/
List<TGasuserSafetyDeviceInfo> selectSafetyDeviceDetailInfoList(Long userId);
/** /**
* 删除用户管理-燃气用户-安全装置加装维护信息 * 删除用户管理-燃气用户-安全装置加装维护信息
* *
......
...@@ -8,9 +8,12 @@ import java.util.stream.Collectors; ...@@ -8,9 +8,12 @@ import java.util.stream.Collectors;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.TDetectorUserCount; import com.zehong.system.domain.TDetectorUserCount;
import com.zehong.system.domain.TGasuserSafetyDeviceInfo;
import com.zehong.system.domain.vo.GasUserAndSafetyDeviceVo;
import com.zehong.system.domain.vo.TDetectorUserInspectVo; import com.zehong.system.domain.vo.TDetectorUserInspectVo;
import com.zehong.system.domain.vo.TDetectorUserVO; import com.zehong.system.domain.vo.TDetectorUserVO;
import com.zehong.system.mapper.TDeviceInfoMapper; import com.zehong.system.mapper.TDeviceInfoMapper;
import com.zehong.system.mapper.TGasuserSafetyDeviceInfoMapper;
import com.zehong.system.mapper.TSiteStationInfoMapper; import com.zehong.system.mapper.TSiteStationInfoMapper;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -19,6 +22,8 @@ import com.zehong.system.mapper.TDetectorUserMapper; ...@@ -19,6 +22,8 @@ import com.zehong.system.mapper.TDetectorUserMapper;
import com.zehong.system.domain.TDetectorUser; import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.service.ITDetectorUserService; import com.zehong.system.service.ITDetectorUserService;
import javax.annotation.Resource;
/** /**
* 燃气用户Service业务层处理 * 燃气用户Service业务层处理
* *
...@@ -35,6 +40,8 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -35,6 +40,8 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
@Autowired @Autowired
private TSiteStationInfoMapper tSiteStationInfoMapper; private TSiteStationInfoMapper tSiteStationInfoMapper;
@Resource
private TGasuserSafetyDeviceInfoMapper gasuserSafetyDeviceInfoMapper;
/** /**
* 查询探测器用户列表 * 查询探测器用户列表
...@@ -290,6 +297,45 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -290,6 +297,45 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
return tDetectorUserMapper.insertTDetectorUser(tDetectorUser); return tDetectorUserMapper.insertTDetectorUser(tDetectorUser);
} }
/**
* 新增燃气用户 和 安全装置
* @param gasUserAndSafetyDeviceVo gas
* @return r
*/
@Override
public int addUserAndSafetyDevice(GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo) {
TDetectorUser detectorUser = gasUserAndSafetyDeviceVo.getDetectorUser();
tDetectorUserMapper.insertTDetectorUser(detectorUser);
List<TGasuserSafetyDeviceInfo> gasuserSafetyDeviceInfoList = gasUserAndSafetyDeviceVo.getGasuserSafetyDeviceInfoList();
if (gasuserSafetyDeviceInfoList != null && gasuserSafetyDeviceInfoList.size() > 0) {
for (TGasuserSafetyDeviceInfo tGasuserSafetyDeviceInfo : gasuserSafetyDeviceInfoList) {
tGasuserSafetyDeviceInfo.setRelationGasuserId(detectorUser.getUserId());
}
gasuserSafetyDeviceInfoMapper.updatetRelationSafetyDeviceInfo(gasuserSafetyDeviceInfoList, detectorUser.getUserId());
}
return 1;
}
/**
* 修改燃气用户 和 安全装置
* @param gasUserAndSafetyDeviceVo gas
* @return r
*/
@Override
public int updateUserAndSafetyDevice(GasUserAndSafetyDeviceVo gasUserAndSafetyDeviceVo) {
TDetectorUser detectorUser = gasUserAndSafetyDeviceVo.getDetectorUser();
List<TGasuserSafetyDeviceInfo> gasuserSafetyDeviceInfoList = gasUserAndSafetyDeviceVo.getGasuserSafetyDeviceInfoList();
if (gasuserSafetyDeviceInfoList != null && gasuserSafetyDeviceInfoList.size() > 0) {
for (TGasuserSafetyDeviceInfo tGasuserSafetyDeviceInfo : gasuserSafetyDeviceInfoList) {
tGasuserSafetyDeviceInfo.setRelationGasuserId(detectorUser.getUserId());
}
gasuserSafetyDeviceInfoMapper.updatetRelationSafetyDeviceInfo(gasuserSafetyDeviceInfoList, detectorUser.getUserId());
}
return 1;
}
/** /**
* 修改燃气用户 * 修改燃气用户
* *
......
...@@ -109,6 +109,16 @@ public class TGasuserSafetyDeviceInfoServiceImpl implements ITGasuserSafetyDevic ...@@ -109,6 +109,16 @@ public class TGasuserSafetyDeviceInfoServiceImpl implements ITGasuserSafetyDevic
tGasuserSafetyDeviceInfoMapper.deleteSafetyDeviceInfo(deviceId); tGasuserSafetyDeviceInfoMapper.deleteSafetyDeviceInfo(deviceId);
} }
/**
* 根据燃气用户id查询数据
* @param userId u
* @return r
*/
@Override
public List<TGasuserSafetyDeviceInfo> selectSafetyDeviceDetailInfoList(Long userId) {
return tGasuserSafetyDeviceInfoMapper.selectSafetyDeviceDetailInfoList(userId);
}
/** /**
* 删除用户管理-燃气用户-安全装置加装维护信息 * 删除用户管理-燃气用户-安全装置加装维护信息
* *
......
...@@ -130,4 +130,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -130,4 +130,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="deleteSafetyDeviceInfo"> <update id="deleteSafetyDeviceInfo">
update t_gasuser_safety_device_info set is_del='1' where f_gasUser_safety_device_id = #{deviceId} update t_gasuser_safety_device_info set is_del='1' where f_gasUser_safety_device_id = #{deviceId}
</update> </update>
<select id="selectSafetyDeviceDetailInfoList" resultMap="TGasuserSafetyDeviceInfoResult" parameterType="Long">
<include refid="selectTGasuserSafetyDeviceInfoVo"/>
where f_relation_gasUser_id = #{userId} and is_del='0'
</select>
<!--将关联设备信息与设备进行绑定-->
<update id="updatetRelationSafetyDeviceInfo" parameterType="java.util.List">
update t_gasuser_safety_device_info set f_relation_gasUser_id = #{id}
where
f_gasUser_safety_device_id in
<foreach collection="gettDeviceInfoS" item="items" index="key" open="(" separator="," close=")">
#{items.gasUserSafetyDeviceId}
</foreach>
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -87,7 +87,7 @@ export function addSafetyDetailInfo(data) { ...@@ -87,7 +87,7 @@ export function addSafetyDetailInfo(data) {
// 关联安装加装装置 批量删除 // 关联安装加装装置 批量删除
export function deleteSafetyDeviceListInfo(data) { export function deleteSafetyDeviceListInfo(data) {
return request({ return request({
url: '/gasUserSafetyDevice/deleteSafetyDeviceListInfo', url: '/gasUserSafetyDevice/info/deleteSafetyDeviceListInfo',
method: 'post', method: 'post',
data: data data: data
}) })
...@@ -96,8 +96,36 @@ export function deleteSafetyDeviceListInfo(data) { ...@@ -96,8 +96,36 @@ export function deleteSafetyDeviceListInfo(data) {
// 删除关联设备信息 // 删除关联设备信息
export function deleteSafetyDeviceInfo(deviceId) { export function deleteSafetyDeviceInfo(deviceId) {
return request({ return request({
url: '/gasUserSafetyDevice/deleteSafetyDeviceInfo', url: '/gasUserSafetyDevice/info/deleteSafetyDeviceInfo',
method: 'delete', method: 'delete',
data:deviceId data:deviceId
}) })
}
// 根据燃气用户id 查询 关联 安全装置加装
export function selectSafetyDeviceDetailInfo(userId) {
return request({
url: '/gasUserSafetyDevice/info/selectSafetyDeviceDetailInfoList/'+ userId,
method: 'get'
})
}
// 新增燃气用户-包含安全装置
export function addUserAndSafetyDevice(data) {
return request({
url: '/supervise/user/addUserAndSafetyDevice',
method: 'post',
data: data
})
}
// 修改燃气用户-包含安全装置
export function updateUserAndSafetyDevice(data) {
return request({
url: '/supervise/user/updateUserAndSafetyDevice',
method: 'post',
data: data
})
} }
\ No newline at end of file
...@@ -1029,6 +1029,8 @@ export default { ...@@ -1029,6 +1029,8 @@ export default {
const deviceIds = this.ids; const deviceIds = this.ids;
const li=this.datalist; const li=this.datalist;
if (this.form.deviceId != null) { if (this.form.deviceId != null) {
console.log("this.DetailInfoList = " + this.DetailInfoList);
console.log("this.datalist = " + this.datalist);
//修改 //修改
this.DetailInfoList=this.DetailInfoList.concat(this.datalist) this.DetailInfoList=this.DetailInfoList.concat(this.datalist)
//添加到数组中 以便下次使用 //添加到数组中 以便下次使用
......
...@@ -256,15 +256,15 @@ ...@@ -256,15 +256,15 @@
<div class="tableTitle"> <div class="tableTitle">
<img :src="relationImg" style="width: 24px; height: 25px;position: relative; left: -355px; top: -12px;"/> <img :src="relationImg" style="width: 24px; height: 25px;position: relative; left: -355px; top: -12px;"/>
<span class="midText">安全装置加装</span> <span class="midText">安全装置</span>
</div> </div>
<el-table v-loading="loadings" ref="multipleTable" :data="DetailInfoList" tooltip-effect="dark" style="width: 100%" max-height="250" @selection-change="tableDataSelectionChange"> <el-table v-loading="loadings" ref="multipleTable" :data="DetailInfoList" tooltip-effect="dark" style="width: 100%" max-height="250" @selection-change="tableDataSelectionChange">
<el-table-column label="设备名称" align="center" prop="deviceName" /> <el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备型号" align="center" prop="deviceModel" /> <el-table-column label="设备型号" align="center" prop="deviceModel" />
<el-table-column label="设备类型" align="center" prop="deviceType" /> <el-table-column label="设备类型" align="center" prop="relationDeviceType" />
<el-table-column label="物联网编号" width="85" align="center" prop="iotNo" /> <el-table-column label="物联网编号" width="85" align="center" prop="fIotNo" />
<el-table-column label="探测介质" align="center" prop="detMed" /> <el-table-column label="探测介质" align="center" prop="detectionMedium" />
<el-table-column label="设备安装时间" width="100" align="center" prop="deviceInstallTime" /> <el-table-column label="设备安装时间" width="100" align="center" prop="deviceInstallTime" />
<el-table-column label="安装位置" align="center" prop="deviceInstallPosition" /> <el-table-column label="安装位置" align="center" prop="deviceInstallPosition" />
<el-table-column label="负责人" align="center" prop="head" /> <el-table-column label="负责人" align="center" prop="head" />
...@@ -283,15 +283,15 @@ ...@@ -283,15 +283,15 @@
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="selectDataListInfo">选择安全装置加装</el-button> <el-button type="primary" @click="selectDataListInfo">选择安全装置</el-button>
<el-button type="primary" @click="submitForm">确 定</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>
<!--添加关联设备弹出框--> <!--添加关联设备弹出框-->
<el-dialog title="添加关联设备" :visible.sync="dialogFormVisible"> <el-dialog title="添加安装装置" :visible.sync="dialogFormVisible">
<el-form ref="formDetailInfo" :model="formDetailInfo" :rules="formDetailInfoRules" label-width="95px" style="height: 230px"> <el-form ref="formDetailInfo" :model="formDetailInfo" :rules="formDetailInfoRules" label-width="100px" style="height: 230px">
<el-row> <el-row>
<el-col :span="11"> <el-col :span="11">
...@@ -317,17 +317,21 @@ ...@@ -317,17 +317,21 @@
<el-col :span="11"> <el-col :span="11">
<el-form-item label="物联网编号" prop="fIotNo" > <el-form-item label="物联网编号" prop="fIotNo" >
<el-input v-model="formDetailInfo.fIotNo" placeholder="请输入物联网编号" /> <el-input v-model="formDetailInfo.fIotNo" placeholder="请输入物联网编号" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="11"> <el-col :span="11">
<el-form-item label="设备安装时间" prop="deviceInstallTime"> <el-form-item label="设备安装时间" prop="deviceInstallTime">
<el-input v-model="formDetailInfo.deviceInstallTime" placeholder="请选择安装时间"> <el-date-picker clearable size="small"
</el-input> v-model="formDetailInfo.deviceInstallTime"
</el-form-item> type="date"
value-format="yyyy-MM-dd"
placeholder="选择安装时间">
</el-date-picker>
</el-form-item>
</el-col> </el-col>
<el-col :span="11"> <el-col :span="11">
...@@ -367,8 +371,8 @@ ...@@ -367,8 +371,8 @@
</el-dialog> </el-dialog>
<!--选择关联设备弹出框--> <!--选择安全装置弹出框-->
<el-dialog title="选择关联设备" width="1100px" :visible.sync="dialogTableVisible" formLabelWidth="160px"> <el-dialog title="选择安全装置" width="1100px" :visible.sync="dialogTableVisible" formLabelWidth="160px">
<template> <template>
<el-form :model="dateQueryParams" ref="queryForm" :inline="true" v-show="showSearch" > <el-form :model="dateQueryParams" ref="queryForm" :inline="true" v-show="showSearch" >
<el-form-item label="设备名称" prop="deviceName"> <el-form-item label="设备名称" prop="deviceName">
...@@ -391,7 +395,7 @@ ...@@ -391,7 +395,7 @@
</el-form-item> </el-form-item>
<el-form-item label="物联网编号" prop="deviceAddr"> <el-form-item label="物联网编号" prop="deviceAddr">
<el-input <el-input
v-model="dateQueryParams.iotNo" v-model="dateQueryParams.fIotNo"
placeholder="请输入物联网编号" placeholder="请输入物联网编号"
clearable clearable
size="small" size="small"
...@@ -426,13 +430,13 @@ ...@@ -426,13 +430,13 @@
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getDataList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getDataList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loadings" ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%" max-height="250" @selection-change="tableDataSelectionChange"> <el-table v-loading="safetyDeviceManageLoadings" ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%" max-height="250" @selection-change="tableDataSelectionChange">
<el-table-column type="selection" width="55" align="center"></el-table-column> <el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column label="设备名称" align="center" prop="deviceName" /> <el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备型号" align="center" prop="deviceModel" /> <el-table-column label="设备型号" align="center" prop="deviceModel" />
<el-table-column label="设备类型" align="center" prop="deviceType" /> <el-table-column label="设备类型" align="center" prop="relationDeviceType" />
<el-table-column label="物联网编号" width="85" align="center" prop="iotNo" /> <el-table-column label="物联网编号" width="85" align="center" prop="fIotNo" />
<el-table-column label="探测介质" align="center" prop="detMed" /> <el-table-column label="探测介质" align="center" prop="detectionMedium" />
<el-table-column label="设备安装时间" width="100" align="center" prop="deviceInstallTime" /> <el-table-column label="设备安装时间" width="100" align="center" prop="deviceInstallTime" />
<el-table-column label="安装位置" align="center" prop="deviceInstallPosition" /> <el-table-column label="安装位置" align="center" prop="deviceInstallPosition" />
<el-table-column label="负责人" align="center" prop="head" /> <el-table-column label="负责人" align="center" prop="head" />
...@@ -466,7 +470,10 @@ ...@@ -466,7 +470,10 @@
</template> </template>
<script> <script>
import { listUser, getUser, delUser, addUser, updateUser,newExportUser,getNoSelectSafetyDetailInfo,addSafetyDetailInfo,deleteSafetyDeviceInfo,deleteSafetyDeviceListInfo} from "@/api/regulation/user"; import { listUser, getUser, delUser, addUser, updateUser,newExportUser,
getNoSelectSafetyDetailInfo,addSafetyDetailInfo,deleteSafetyDeviceInfo,
deleteSafetyDeviceListInfo,selectSafetyDeviceDetailInfo,
addUserAndSafetyDevice,updateUserAndSafetyDevice} from "@/api/regulation/user";
import { selectTEnterprise} from "@/api/regulation/supervise"; import { selectTEnterprise} from "@/api/regulation/supervise";
import { noPageListVillage} from "@/api/regulation/userManagement/village"; import { noPageListVillage} from "@/api/regulation/userManagement/village";
import GetPos from '@/components/GetPos'; import GetPos from '@/components/GetPos';
...@@ -493,7 +500,7 @@ export default { ...@@ -493,7 +500,7 @@ export default {
deviceModel:'', deviceModel:'',
fIotNo:'', fIotNo:'',
detectionMedium:'', detectionMedium:'',
deviceInstallTime:'', deviceInstallTime:null,
deviceInstallPosition:'', deviceInstallPosition:'',
head:'', head:'',
phone:'' phone:''
...@@ -502,11 +509,17 @@ export default { ...@@ -502,11 +509,17 @@ export default {
/**--------------地图使用数据---------------*/ /**--------------地图使用数据---------------*/
dialogTableVisibles: false, dialogTableVisibles: false,
devicePos: [], devicePos: [],
//下级设备数据数组
tableData: [],
/**--------------地图使用数据---------------*/ /**--------------地图使用数据---------------*/
// 居住区数据集合 // 居住区数据集合
villageList:[], villageList:[],
// 遮罩层 // 遮罩层
loading: true, loading: true,
//下级数据的遮罩层
loadings:true,
//下级数据的遮罩层
safetyDeviceManageLoadings:true,
// 导出遮罩层 // 导出遮罩层
exportLoading: false, exportLoading: false,
// 选中数组 // 选中数组
...@@ -536,6 +549,12 @@ export default { ...@@ -536,6 +549,12 @@ export default {
username: null, username: null,
nickName: null, nickName: null,
}, },
// 查询参数
dateQueryParams: {
deviceName: null,
deviceModel: null,
fIotNo: null,
},
// 表单参数 // 表单参数
form: { form: {
userId: null, userId: null,
...@@ -607,6 +626,46 @@ export default { ...@@ -607,6 +626,46 @@ export default {
}, },
methods: { methods: {
/**关联设备已经选中数据删除方法*/
deleteDataListilInfo(row,index){
const deviceIds = row.gasUserSafetyDeviceId;
//判断form表单是否有id来验证是修改的删除还是添加的删除
if (this.form.userId != null) {
deleteSafetyDeviceInfo(deviceIds).then(response => {
this.msgSuccess("删除成功");
this.DetailInfoList.splice(index,1);
});
}else {
this.DetailInfoList.splice(index,1);
this.msgSuccess("删除成功");
}
},
/**关联设备单条删除方法*/
deleteDetailInfo(row){
const deviceIds = row.gasUserSafetyDeviceId;
this.$confirm('是否确认删除安全装置编号为"' + deviceIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return deleteSafetyDeviceInfo(deviceIds);
}).then(() => {
// this.tableData.splice(index,1);
this.getDataList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
//关联数据多选框选中数据
tableDataSelectionChange(selection){
this.ids = selection.map(item => item.gasUserSafetyDeviceId)
this.datalist=selection.map(item => item)
//按钮 非选中禁用
this.single = selection.length!==1
this.multiple = !selection.length
},
/**关联设备单条删除方法*/ /**关联设备单条删除方法*/
deleteSafetyDeviceInfo(row){ deleteSafetyDeviceInfo(row){
const deviceIds = row.gasUserSafetyDeviceId; const deviceIds = row.gasUserSafetyDeviceId;
...@@ -629,7 +688,7 @@ export default { ...@@ -629,7 +688,7 @@ export default {
*/ */
deleteListDetailInfo(row){ deleteListDetailInfo(row){
const deviceIds = this.ids; const deviceIds = this.ids;
this.$confirm('是否确认删除安全装置加装为"' + deviceIds + '"的数据项?', "警告", { this.$confirm('是否确认删除安全装置为"' + deviceIds + '"的数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
...@@ -645,9 +704,14 @@ export default { ...@@ -645,9 +704,14 @@ export default {
//获取已经选中的下级设备id //获取已经选中的下级设备id
const deviceIds = this.ids; const deviceIds = this.ids;
const li=this.datalist; const li=this.datalist;
if (this.form.userId != null) { if (this.form.userId != null) {
//修改
this.DetailInfoList=this.DetailInfoList.concat(this.datalist) if (this.DetailInfoList) {
//修改
this.DetailInfoList=this.DetailInfoList.concat(this.datalist)
} else {
this.DetailInfoList=this.datalist;
}
//添加到数组中 以便下次使用 //添加到数组中 以便下次使用
this.DetailInfoListId.push(deviceIds); this.DetailInfoListId.push(deviceIds);
// alert(this.DetailInfoListId) // alert(this.DetailInfoListId)
...@@ -669,7 +733,7 @@ export default { ...@@ -669,7 +733,7 @@ export default {
/**关联设备添加方法*/ /**关联设备添加方法*/
addSafetyDeviceInfo(){ addSafetyDeviceInfo(){
this.$refs["formDetailInfoRules"].validate(valid => { this.$refs["formDetailInfo"].validate(valid => {
if (valid) { if (valid) {
addSafetyDetailInfo(this.formDetailInfo).then(response => { addSafetyDetailInfo(this.formDetailInfo).then(response => {
// this.tableData.push(this.formDetailInfo) // this.tableData.push(this.formDetailInfo)
...@@ -702,26 +766,36 @@ export default { ...@@ -702,26 +766,36 @@ export default {
/**查询下级数据列表方法*/ /**查询下级数据列表方法*/
getDataList(){ getDataList(){
this.loadings = true; this.safetyDeviceManageLoadings = true;
// console.log(this.dateQueryParams) // console.log(this.dateQueryParams)
//查询下级设备数据 //查询下级设备数据
getNoSelectSafetyDetailInfo(this.dateQueryParams).then(response => { getNoSelectSafetyDetailInfo(this.dateQueryParams).then(response => {
//下级设备数据 到时候换成下级数据 //下级设备数据 到时候换成下级数据
this.tableData = response.rows; this.tableData = response.rows;
this.detailTotal = response.total; this.detailTotal = response.total;
this.loadings = false; this.safetyDeviceManageLoadings = false;
}); });
}, },
/** 下级数据重置按钮操作 搜索框重置*/
resetQueryDate(){
this.dateQueryParams={
deviceName: null,
deviceModel: null,
fIotNo: null,
}
this.getDataList();
},
/** /**
* 选择关联设备查询方法 * 选择关联设备查询方法
*/ */
selectDataListInfo(){ selectDataListInfo(){
//查询下级设备数据 //查询下级设备数据
getDdeviceDetailInfo(this.dateQueryParams).then(response => { getNoSelectSafetyDetailInfo(this.dateQueryParams).then(response => {
//下级设备数据 到时候换成下级数据 //下级设备数据 到时候换成下级数据
this.tableData = response.rows; this.tableData = response.rows;
this.detailTotal = response.total; this.detailTotal = response.total;
this.loadings = false; this.safetyDeviceManageLoadings = false;
//打开选择关联设备弹出框 //打开选择关联设备弹出框
this.dialogTableVisible = true this.dialogTableVisible = true
}); });
...@@ -790,6 +864,8 @@ export default { ...@@ -790,6 +864,8 @@ export default {
this.test = response.data; this.test = response.data;
}); });
this.reset(); this.reset();
//清空关联设备数据
this.DetailInfoList=''
this.open = true; this.open = true;
this.title = "添加燃气用户"; this.title = "添加燃气用户";
}, },
...@@ -806,6 +882,12 @@ export default { ...@@ -806,6 +882,12 @@ export default {
this.open = true; this.open = true;
this.title = "修改燃气用户"; this.title = "修改燃气用户";
this.devicePos = [response.data.longitude, response.data.latitude]; this.devicePos = [response.data.longitude, response.data.latitude];
});
//查询关联设备信息数据
selectSafetyDeviceDetailInfo(userId).then(response => {
this.DetailInfoList = response.data;
this.loadings = false;
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
...@@ -817,9 +899,28 @@ export default { ...@@ -817,9 +899,28 @@ export default {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
if ( this.datalist !=null){
var tDeviceInfon={
detectorUser:this.form,
gasuserSafetyDeviceInfoList:this.datalist
}
//重新绑定修改后的关联设备
updateUserAndSafetyDevice(JSON.stringify(tDeviceInfon)).then(response => {
this.open = false;
this.getList();
});
}
} else { } else {
addUser(this.form).then(response => {
var tDeviceInfon={
detectorUser:this.form,
gasuserSafetyDeviceInfoList:this.datalist
}
addUserAndSafetyDevice(JSON.stringify(tDeviceInfon)).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment