Commit 58107bbd authored by wuqinghua's avatar wuqinghua

2022-2-15 吴卿华

parent 4b9c01b3
......@@ -78,8 +78,10 @@ public class TDeviceInfoController extends BaseController
{
//添加设备信息表数据 并且返回新增id
tDeviceInfoService.insertTDeviceInfo(listaw.gettDeviceInfo());
//将关联设备信息与设备进行绑定
tDeviceInfoService.updatetRelationDeviceDetailInfo(listaw.gettDeviceInfoS(),listaw.gettDeviceInfo().getDeviceId());
if (!"null".equals(listaw.gettDeviceInfoS())){
//将关联设备信息与设备进行绑定
tDeviceInfoService.updatetRelationDeviceDetailInfo(listaw.gettDeviceInfoS(),listaw.gettDeviceInfo().getDeviceId());
}
TDeviceInfo tDeviceInfo = new TDeviceInfo();
//根据企业id查询企业名称
String EnterpriseName = tEmployedPeopleInfoService.selectEnterpriseName(tDeviceInfo.getBeyondEnterpriseId());
......@@ -143,13 +145,22 @@ public class TDeviceInfoController extends BaseController
}
/**
* 关联设备批量数据删除接口
* 关联设备数据删除接口
*/
@RequestMapping("/deleteDetailInfo")
public void deleteDetailInfo(@RequestBody int deviceId){
tDeviceInfoService.deleteDetailinfOS(deviceId);
}
/**
* 解绑 设备与关联设备关系
* @param deviceId
*/
@RequestMapping("/deleteDeviceDetailInfo")
public void deleteDeviceDetailInfo(@RequestBody int deviceId){
tDeviceInfoService.deleteDeviceDetailInfo(deviceId);
}
/**
* 关联设备批量数据删除接口
* @param deviceId
......@@ -158,4 +169,29 @@ public class TDeviceInfoController extends BaseController
public void deleteeListDetailInfo(@RequestBody Long[] deviceId){
tDeviceInfoService.deleteDetailInfo(deviceId);
}
/**
* 查询设备已经关联的关联设备接口
* @param id
* @return
*/
@RequestMapping("/selectDetailInfoList")
public TableDataInfo selectDetailInfoList(@RequestBody int id){
List<TDeviceInfoS> tDeviceInfoS = tDeviceInfoService.selectDetailInfoList(id);
return getDataTable(tDeviceInfoS);
}
/**
* 关联设备绑定接口
* @param listaw
*/
@RequestMapping("/updateDetailInfoList")
public void updateDetailInfoList(@RequestBody Listaw listaw){
if (!"null".equals(listaw.gettDeviceInfoS())){
//将关联设备信息与设备进行绑定
tDeviceInfoService.updatetRelationDeviceDetailInfo(listaw.gettDeviceInfoS(),listaw.gettDeviceInfo().getDeviceId());
}
}
}
......@@ -10,7 +10,7 @@ import com.zehong.common.core.domain.BaseEntity;
/**
* 设备信息对象 t_device_info
*
*
* @author zehong
* @date 2022-01-27
*/
......@@ -38,7 +38,7 @@ public class TDeviceInfo extends BaseEntity
private String deviceModel;
/** 设备类型:1.阀井 2.调压箱 3.巡检员 4.视频 */
@Excel(name = "设备类型:1.阀井 2.调压箱 3.巡检员 4.视频")
@Excel(name = "设备类型")
private String deviceType;
/** 权属单位 */
......@@ -49,18 +49,22 @@ public class TDeviceInfo extends BaseEntity
private String beyondEnterpriseName;
/** 经度 */
private BigDecimal longitude;
@Excel(name = "经度")
private String longitude;
/** 纬度 */
private BigDecimal latitude;
@Excel(name = "纬度")
private String latitude;
/** 设备图片路径 */
private String iconUrl;
/** 联系人 */
@Excel(name = "联系人")
private String linkman;
/** 电话 */
@Excel(name = "电话")
private String phone;
/** 安装时间 */
......@@ -77,156 +81,159 @@ public class TDeviceInfo extends BaseEntity
/** 备注 */
private String remarks;
public void setDeviceId(Long deviceId)
public void setDeviceId(Long deviceId)
{
this.deviceId = deviceId;
}
public Long getDeviceId()
public Long getDeviceId()
{
return deviceId;
}
public void setDeviceName(String deviceName)
public void setDeviceName(String deviceName)
{
this.deviceName = deviceName;
}
public String getDeviceName()
public String getDeviceName()
{
return deviceName;
}
public void setDeviceCode(String deviceCode)
public void setDeviceCode(String deviceCode)
{
this.deviceCode = deviceCode;
}
public String getDeviceCode()
public String getDeviceCode()
{
return deviceCode;
}
public void setDeviceAddr(String deviceAddr)
public void setDeviceAddr(String deviceAddr)
{
this.deviceAddr = deviceAddr;
}
public String getDeviceAddr()
public String getDeviceAddr()
{
return deviceAddr;
}
public void setDeviceModel(String deviceModel)
public void setDeviceModel(String deviceModel)
{
this.deviceModel = deviceModel;
}
public String getDeviceModel()
public String getDeviceModel()
{
return deviceModel;
}
public void setDeviceType(String deviceType)
public void setDeviceType(String deviceType)
{
this.deviceType = deviceType;
}
public String getDeviceType()
public String getDeviceType()
{
return deviceType;
}
public void setBeyondEnterpriseId(Long beyondEnterpriseId)
public void setBeyondEnterpriseId(Long beyondEnterpriseId)
{
this.beyondEnterpriseId = beyondEnterpriseId;
}
public Long getBeyondEnterpriseId()
public Long getBeyondEnterpriseId()
{
return beyondEnterpriseId;
}
public void setBeyondEnterpriseName(String beyondEnterpriseName)
public void setBeyondEnterpriseName(String beyondEnterpriseName)
{
this.beyondEnterpriseName = beyondEnterpriseName;
}
public String getBeyondEnterpriseName()
public String getBeyondEnterpriseName()
{
return beyondEnterpriseName;
}
public void setLongitude(BigDecimal longitude)
{
this.longitude = longitude;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public BigDecimal getLongitude()
{
public String getLongitude() {
return longitude;
}
public void setLatitude(BigDecimal latitude)
{
this.latitude = latitude;
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public BigDecimal getLatitude()
{
public String getLatitude() {
return latitude;
}
public void setIconUrl(String iconUrl)
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public void setIconUrl(String iconUrl)
{
this.iconUrl = iconUrl;
}
public String getIconUrl()
public String getIconUrl()
{
return iconUrl;
}
public void setLinkman(String linkman)
public void setLinkman(String linkman)
{
this.linkman = linkman;
}
public String getLinkman()
public String getLinkman()
{
return linkman;
}
public void setPhone(String phone)
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
public String getPhone()
{
return phone;
}
public void setInstallationTime(Date installationTime)
public void setInstallationTime(Date installationTime)
{
this.installationTime = installationTime;
}
public Date getInstallationTime()
public Date getInstallationTime()
{
return installationTime;
}
public void setInspectionTime(Date inspectionTime)
public void setInspectionTime(Date inspectionTime)
{
this.inspectionTime = inspectionTime;
}
public Date getInspectionTime()
public Date getInspectionTime()
{
return inspectionTime;
}
public void setIsDel(String isDel)
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
public String getIsDel()
{
return isDel;
}
public void setRemarks(String remarks)
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
public String getRemarks()
{
return remarks;
}
......
......@@ -97,4 +97,17 @@ public interface TDeviceInfoMapper
* @param gettDeviceInfoS
*/
void updatetRelationDeviceDetailInfo(@Param("gettDeviceInfoS")List<TDeviceInfoS> gettDeviceInfoS,@Param("id") Long id);
/**
* 查询设备已经关联的关联设备
* @param id
* @return
*/
List<TDeviceInfoS> selectDetailInfoList(int id);
/**
* 解绑 设备与关联设备关系
* @param deviceId
*/
void deleteDeviceDetailInfo(int deviceId);
}
......@@ -97,4 +97,17 @@ public interface ITDeviceInfoService
* @param gettDeviceInfoS
*/
void updatetRelationDeviceDetailInfo(@Param("gettDeviceInfoS") List<TDeviceInfoS> gettDeviceInfoS,@Param("id") Long id);
/**
* 查询设备已经关联的关联设备
* @param id
* @return
*/
List<TDeviceInfoS> selectDetailInfoList(int id);
/**
* 解绑 设备与关联设备关系
* @param deviceId
*/
void deleteDeviceDetailInfo(int deviceId);
}
......@@ -152,4 +152,24 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
public void updatetRelationDeviceDetailInfo(@Param("gettDeviceInfoS")List<TDeviceInfoS> gettDeviceInfoS,@Param("id") Long id) {
tDeviceInfoMapper.updatetRelationDeviceDetailInfo(gettDeviceInfoS,id);
}
/**
* 查询设备已经关联的关联设备
* @param id
* @return
*/
@Override
public List<TDeviceInfoS> selectDetailInfoList(int id) {
List<TDeviceInfoS> tDeviceInfoS = tDeviceInfoMapper.selectDetailInfoList(id);
return tDeviceInfoS;
}
/**
* 解绑 设备与关联设备关系
* @param deviceId
*/
@Override
public void deleteDeviceDetailInfo(int deviceId) {
tDeviceInfoMapper.deleteDeviceDetailInfo(deviceId);
}
}
......@@ -173,6 +173,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
group by relation_device_detail_id desc
</select>
<!--查询设备已经关联的关联设备-->
<select id="selectDetailInfoList" resultMap="TDeviceInfoResultS">
select relation_device_detail_id,relation_device_id,device_name,device_model,iot_no,remarks, (CASE device_type WHEN '1' THEN '压力表' WHEN '2' THEN '流量计' end) as device_type
from t_relation_device_detail_info where relation_device_id=#{id}
</select>
<!--关联设备数据删除接口-->
<update id="deleteDetailInfo">
update t_relation_device_detail_info set is_del='1' where relation_device_detail_id in
......@@ -188,13 +194,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--将关联设备信息与设备进行绑定-->
<update id="updatetRelationDeviceDetailInfo" parameterType="java.util.List">
update t_relation_device_detail_info set relation_device_id = #{id}
where
relation_device_detail_id in
<foreach collection="gettDeviceInfoS" item="items" index="key" open="(" separator="," close=")">
#{items.relationDeviceDetailId}
</foreach>
</update>
<update id="updatetRelationDeviceDetailInfo" parameterType="java.util.List">
update t_relation_device_detail_info set relation_device_id = #{id}
where
relation_device_detail_id in
<foreach collection="gettDeviceInfoS" item="items" index="key" open="(" separator="," close=")">
#{items.relationDeviceDetailId}
</foreach>
</update>
<!--解绑 设备与关联设备关系-->
<update id="deleteDeviceDetailInfo">
update t_relation_device_detail_info set relation_device_id='0' where relation_device_detail_id=#{deviceId}
</update>
</mapper>
......@@ -87,6 +87,17 @@ export function addDetailInfos(data) {
})
}
// 解除 设备与关联设备信息
export function deleteDeviceDetailInfo(deviceId) {
return request({
url: '/device/device/deleteDeviceDetailInfo',
method: 'delete',
data:deviceId
})
}
// 删除关联设备信息
export function deleteeListDetailInfo(deviceId) {
return request({
......@@ -96,4 +107,20 @@ export function deleteeListDetailInfo(deviceId) {
})
}
//查询已经关联的关联设备信息
export function selectDetailInfoList(data){
return request({
url: '/device/device/selectDetailInfoList',
method: 'post',
data: data
})
}
// 新增设备信息
export function updateDetailInfoLists(data) {
return request({
url: '/device/device/updateDetailInfoList',
method: 'post',
data: data
})
}
......@@ -193,17 +193,17 @@
v-hasPermi="['device:device:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['device:device:export']"
>导出</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- :loading="exportLoading"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['device:device:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getDataList"></right-toolbar>
</el-row>
<el-table v-loading="loadings" ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%" max-height="250" @selection-change="tableDataSelectionChange">
......@@ -337,13 +337,13 @@
<el-row>
<el-col :span="11">
<el-form-item label="经度" prop="longitude">
<el-input onkeyup="this.value=this.value.replace(/\D/g,'')" v-model="form.longitude" placeholder="请输入经度" />
<el-input v-model="form.longitude" placeholder="请输入经度" />
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="纬度" prop="latitude">
<el-input onkeyup="this.value=this.value.replace(/\D/g,'')" v-model="form.latitude" placeholder="请输入纬度" />
<el-input v-model="form.latitude" placeholder="请输入纬度" />
</el-form-item>
</el-col>
</el-row>
......@@ -433,7 +433,7 @@
<script>
import { listDevice, getDevice, delDevice, addDevice, updateDevice, exportDevice, selectTEnterprise,getDdeviceDetailInfo,addDetailInfos,deleteDetailInfo,deleteeListDetailInfo } from "@/api/regulation/device";
import { listDevice, getDevice, delDevice, addDevice, updateDevice, exportDevice, selectTEnterprise,getDdeviceDetailInfo,addDetailInfos,deleteDetailInfo,deleteeListDetailInfo,selectDetailInfoList,deleteDeviceDetailInfo,updateDetailInfoLists} from "@/api/regulation/device";
export default {
name: "Device",
......@@ -631,7 +631,6 @@ export default {
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
......@@ -674,6 +673,8 @@ export default {
selectTEnterprise().then(response => {
this.test = response.data;
});
//清空关联设备数据
this.DetailInfoList=''
this.loadings = true;
//查询下级设备数据
getDdeviceDetailInfo(this.dateQueryParams).then(response => {
......@@ -694,10 +695,13 @@ export default {
this.test = response.data;
});
const deviceId = row.deviceId || this.ids
//查询关联设备信息数据
// getDdeviceDetailInfo(deviceId).then(response => {
// this.dynamicValidateForm.domains = response.data;
// });
selectDetailInfoList(deviceId).then(response => {
this.DetailInfoList = response.rows;
this.loadings = false;
});
this.reset();
getDevice(deviceId).then(response => {
......@@ -736,7 +740,6 @@ export default {
this.exportLoading = false;
}).catch(() => {});
},
/**动态添加输入框方法*/
addDomain() {
this.dynamicValidateForm.domains.push({
......@@ -764,7 +767,19 @@ export default {
this.open = false;
this.getList();
});
if ( this.datalist !=null){
var tDeviceInfon={
tDeviceInfo:this.form,
tDeviceInfoS:this.datalist
}
//重新绑定修改后的关联设备
updateDetailInfoLists(JSON.stringify(tDeviceInfon)).then(response => {
this.open = false;
this.getList();
});
}
} else {
alert("走的新增")
if (valid) {
//获取已经选中的下级设备id
const deviceIds = this.ids;
......@@ -811,7 +826,6 @@ export default {
});
},
/**关联设备单条删除方法*/
deleteDetailInfo(row){
const deviceIds = row.relationDeviceDetailId;
......@@ -829,7 +843,18 @@ export default {
},
/**关联设备已经选中数据删除方法*/
deleteDataListilInfo(row,index){
this.DetailInfoList.splice(index,1);
const deviceIds = row.relationDeviceDetailId;
//判断form表单是否有id来验证是修改的删除还是添加的删除
if (this.form.deviceId != null) {
deleteDeviceDetailInfo(deviceIds).then(response => {
this.msgSuccess("删除成功");
this.DetailInfoList.splice(index,1);
});
}else {
this.DetailInfoList.splice(index,1);
this.msgSuccess("删除成功");
}
},
/**
* 批量删除关联设备方法
......@@ -860,15 +885,26 @@ export default {
}).then(function() {
}).then(() => {
// this.DetailInfoList.push(this.datalist)
//清空数组数据 将之前的数据清空
this.DetailInfoListId.splice(row);
this.DetailInfoList=this.datalist;
//添加到数组中 以便下次使用
this.DetailInfoListId.push(deviceIds);
// alert(this.DetailInfoListId)
this.dialogTableVisible=false
this.msgSuccess("添加成功");
if (this.form.deviceId != null) {
//修改
this.DetailInfoList=this.DetailInfoList.concat(this.datalist)
//添加到数组中 以便下次使用
this.DetailInfoListId.push(deviceIds);
// alert(this.DetailInfoListId)
this.dialogTableVisible=false
this.msgSuccess("添加成功");
}else {
//添加
// this.DetailInfoList.push(this.datalist)
//清空数组数据 将之前的数据清空
this.DetailInfoListId.splice(row);
this.DetailInfoList=this.datalist;
//添加到数组中 以便下次使用
this.DetailInfoListId.push(deviceIds);
// alert(this.DetailInfoListId)
this.dialogTableVisible=false
this.msgSuccess("添加成功");
}
}).catch(() => {});
},
/**
......
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