Commit eea1a2a6 authored by wuqinghua's avatar wuqinghua

2022-2-14 吴卿华

parent 2343b553
......@@ -78,10 +78,12 @@ public class TDeviceInfoController extends BaseController
{
//添加设备信息表数据 并且返回新增id
tDeviceInfoService.insertTDeviceInfo(listaw.gettDeviceInfo());
// TDeviceInfo tDeviceInfo = new TDeviceInfo();
// //根据企业id查询企业名称
// String EnterpriseName = tEmployedPeopleInfoService.selectEnterpriseName(tDeviceInfo.getBeyondEnterpriseId());
// tDeviceInfo.setBeyondEnterpriseName(EnterpriseName);
//将关联设备信息与设备进行绑定
tDeviceInfoService.updatetRelationDeviceDetailInfo(listaw.gettDeviceInfoS(),listaw.gettDeviceInfo().getDeviceId());
TDeviceInfo tDeviceInfo = new TDeviceInfo();
//根据企业id查询企业名称
String EnterpriseName = tEmployedPeopleInfoService.selectEnterpriseName(tDeviceInfo.getBeyondEnterpriseId());
tDeviceInfo.setBeyondEnterpriseName(EnterpriseName);
}
/**
......
......@@ -3,6 +3,7 @@ package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TDeviceInfoS;
import org.apache.ibatis.annotations.Param;
/**
* 设备信息Mapper接口
......@@ -90,4 +91,10 @@ public interface TDeviceInfoMapper
* @param deviceId
*/
void deleteDetailinfOS(int deviceId);
/**
* 将关联设备信息与设备进行绑定
* @param gettDeviceInfoS
*/
void updatetRelationDeviceDetailInfo(@Param("gettDeviceInfoS")List<TDeviceInfoS> gettDeviceInfoS,@Param("id") Long id);
}
......@@ -3,6 +3,7 @@ package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TDeviceInfoS;
import org.apache.ibatis.annotations.Param;
/**
* 设备信息Service接口
......@@ -90,4 +91,10 @@ public interface ITDeviceInfoService
* @param deviceId
*/
void deleteDetailinfOS(int deviceId);
/**
* 将关联设备信息与设备进行绑定
* @param gettDeviceInfoS
*/
void updatetRelationDeviceDetailInfo(@Param("gettDeviceInfoS") List<TDeviceInfoS> gettDeviceInfoS,@Param("id") Long id);
}
......@@ -3,6 +3,7 @@ package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.TDeviceInfoS;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDeviceInfoMapper;
......@@ -142,4 +143,13 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
public void deleteDetailinfOS(int deviceId) {
tDeviceInfoMapper.deleteDetailinfOS(deviceId);
}
/**
* 将关联设备信息与设备进行绑定
* @param gettDeviceInfoS
*/
@Override
public void updatetRelationDeviceDetailInfo(@Param("gettDeviceInfoS")List<TDeviceInfoS> gettDeviceInfoS,@Param("id") Long id) {
tDeviceInfoMapper.updatetRelationDeviceDetailInfo(gettDeviceInfoS,id);
}
}
......@@ -55,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
<if test="deviceAddr != null and deviceAddr != ''"> and device_addr = #{deviceAddr}</if>
</where>
group by a.device_id desc
</select>
<select id="selectTDeviceInfoById" parameterType="Long" resultMap="TDeviceInfoResult">
......@@ -149,14 +150,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</update>
<!--添加关联设备信息表数据-->
<!-- <insert id="insertDeviceDetailInfo" parameterType="java.util.List">-->
<!-- INSERT INTO t_relation_device_detail_info (relation_device_id,device_name,device_model,device_type,iot_no)-->
<!-- VALUES-->
<!-- <foreach collection="list" item="item" index="key" separator=",">-->
<!-- (#{item.relationDeviceId},#{item.deviceName},#{item.deviceModel},#{item.deviceType},#{item.iotNo})-->
<!-- </foreach>-->
<!-- </insert>-->
<insert id="insertDeviceDetailInfo">
INSERT INTO t_relation_device_detail_info (relation_device_id,device_name,device_model,device_type,iot_no,remarks)
......@@ -193,4 +186,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update t_relation_device_detail_info set is_del='1' where relation_device_detail_id = #{deviceId}
</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>
</mapper>
......@@ -123,8 +123,8 @@
@pagination="getList"
/>
<!--绑定关联设备弹出框-->
<el-dialog title="选择关联设备" :visible.sync="dialogTableVisible" formLabelWidth="120px">
<!--选择关联设备弹出框-->
<el-dialog title="选择关联设备" :visible.sync="dialogTableVisible" formLabelWidth="160px">
<template>
<el-form :model="dateQueryParams" ref="queryForm" :inline="true" v-show="showSearch" >
<el-form-item label="设备名称" prop="deviceName">
......@@ -171,17 +171,17 @@
v-hasPermi="['device:device:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['device:device:edit']"
>修改</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['device:device:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="danger"
......@@ -234,30 +234,46 @@
<!--添加关联设备弹出框-->
<el-dialog title="添加关联设备" :visible.sync="dialogFormVisible">
<el-form :model="formDetailInfo" label-width="90px" style="height: 270px">
<el-form ref="formDetailInfo" :model="formDetailInfo" :rules="formDetailInfoRules" label-width="95px" style="height: 230px">
<el-form-item label="设备名称">
<el-input v-model="formDetailInfo.deviceName" placeholder="请输入设备名称" autocomplete="off"></el-input>
</el-form-item>
<el-row>
<el-col :span="11">
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="formDetailInfo.deviceName" placeholder="请输入设备名称" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-form-item label="设备型号" >
<el-col :span="11">
<el-form-item label="设备型号" prop="deviceModel">
<el-input v-model="formDetailInfo.deviceModel" placeholder="请输入设备型号" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="设备类型" >
<el-row>
<el-col :span="11">
<el-form-item label="设备类型" prop="deviceType">
<el-select v-model="formDetailInfo.deviceType" placeholder="请选择设备类型">
<el-option label="压力表" value="1" />
<el-option label="流量计" value="2" />
</el-select>
</el-form-item>
</el-col>
<el-form-item label="物联网编号" >
<el-col :span="11">
<el-form-item label="物联网编号" prop="iotNo" >
<el-input v-model="formDetailInfo.iotNo" placeholder="请输入物联网编号" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注" >
<el-input v-model="formDetailInfo.remarksn" placeholder="请输入备注" />
<el-row>
<el-col :span="22">
<el-form-item label="备注" prop="remarksn">
<el-input v-model="formDetailInfo.remarksn" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="addDetailInfo"> </el-button>
......@@ -268,81 +284,146 @@
<!-- 添加或修改设备信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-dialog :title="title" :visible.sync="open" width="780px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="11">
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="设备编号" prop="deviceCode">
<el-input v-model="form.deviceCode" placeholder="请输入设备编号" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="所在地址" prop="deviceAddr">
<el-input v-model="form.deviceAddr" placeholder="请输入所在地址" />
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="设备型号" prop="deviceModel">
<el-input v-model="form.deviceModel" placeholder="请输入设备型号" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="设备类型" prop="deviceType">
<el-select v-model="form.deviceType" placeholder="请选择设备类型">
<el-option label="阀井" value="1" />
<el-option label="调压箱" value="2" />
</el-select>
</el-form-item>
</el-col>
<!-- <el-form-item label="权属单位" prop="beyondEnterpriseId">-->
<!-- <el-input v-model="form.beyondEnterpriseId" placeholder="请输入权属单位" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="权属单位名称" prop="beyondEnterpriseName">-->
<!-- <el-input v-model="form.beyondEnterpriseName" placeholder="请输入权属单位名称" />-->
<!-- </el-form-item>-->
<el-form-item label="权属单位" prop="beyondEnterpriseName">
<el-col :span="11">
<el-form-item label="权属单位" prop="beyondEnterpriseId">
<el-select v-model="form.beyondEnterpriseId" placeholder="请在下拉框中选择权属单位" maxlength="255" :disabled="false" clearable>
<el-option v-for="item in test" :key="item.enterpriseId" :label="item.enterpriseName" :value="item.enterpriseId">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<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-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-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22">
<el-form-item label="设备图片路径" prop="iconUrl">
<el-input v-model="form.iconUrl" type="textarea" placeholder="请输入内容" />
<el-input v-model="form.iconUrl" type="textarea" placeholder="请输入图片路径" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="联系人" prop="linkman">
<el-input v-model="form.linkman" placeholder="请输入联系人" />
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入电话" />
</el-form-item>
<el-form-item label="安装时间" prop="installationTime">
<el-date-picker clearable size="small"
v-model="form.installationTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择安装时间">
</el-date-picker>
</el-form-item>
<el-form-item label="最后巡检时间" prop="inspectionTime">
<el-date-picker clearable size="small"
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="安装时间" prop="installationTime">
<el-date-picker clearable size="small"
v-model="form.installationTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择安装时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="最后巡检时间" prop="inspectionTime">
<el-date-picker clearable size="small"
v-model="form.inspectionTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择最后巡检时间">
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" placeholder="请输入备注" />
</el-form-item>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22">
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<h3>关联设备</h3>
<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="deviceModel" />
<el-table-column label="设备类型" align="center" prop="deviceType" />
<el-table-column label="物联网编号" align="center" prop="iotNo" />
<el-table-column label="备注" align="center" prop="remarksn" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="deleteDataListilInfo(scope.row,scope.$index)"
v-hasPermi="['device:device:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogTableVisible = true">选择关联设备</el-button>
<el-button type="primary" @click="selectDataListInfo">选择关联设备</el-button>
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
......@@ -365,6 +446,8 @@ export default {
tableData: [],
//存储已被选中的下级数据id
DetailInfoListId :[],
//存储已经选中的下级关联数据
DetailInfoList:[],
multipleSelection: [],
dialogTableVisible: false,
dialogFormVisible: false,
......@@ -450,7 +533,43 @@ export default {
test: {},
// 表单校验
rules: {
}
deviceName: [
{ required: true, message: "请输入设备名称", trigger: "blur" },
],
deviceCode: [
{ required: true, message: "请输入设备编号", trigger: "blur" },
],
deviceAddr: [
{ required: true, message: "请输入所在地址", trigger: "blur" },
],
deviceModel: [
{ required: true, message: "请输入设备型号", trigger: "blur" },
],
deviceType: [
{ required: true, message: "请选择设备类型", trigger: "blur" },
],
beyondEnterpriseId: [
{ required: true, message: "请选择权属单位", trigger: "blur" },
],
},
//关联设备下级数据 表单校验
formDetailInfoRules:{
deviceName:[
{ required: true, message: "请输入设备名称", trigger: "blur" },
],
deviceModel:[
{ required: true, message: "请输入设备型号", trigger: "blur" },
],
deviceType:[
{ required: true, message: "请选择设备类型", trigger: "blur" },
],
iotNo:[
{ required: true, message: "请输入联网编号", trigger: "blur" },
],
remarksn:[
{ required: true, message: "请输入备注", trigger: "blur" },
],
},
};
},
created() {
......@@ -544,6 +663,7 @@ export default {
//关联数据多选框选中数据
tableDataSelectionChange(selection){
this.ids = selection.map(item => item.relationDeviceDetailId)
this.datalist=selection.map(item => item)
//按钮 非选中禁用
this.single = selection.length!==1
this.multiple = !selection.length
......@@ -635,8 +755,7 @@ export default {
}
},
/**提交数据方法*/
submitForm(formName) {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.deviceId != null) {
......@@ -646,11 +765,13 @@ export default {
this.getList();
});
} else {
this.$refs[formName].validate((valid) => {
if (valid) {
//获取已经选中的下级设备id
const deviceIds = this.ids;
// alert(deviceIds)
var tDeviceInfon={
tDeviceInfo:this.form,
// tDeviceInfoS:this.dynamicValidateForm.domains
tDeviceInfoS:this.datalist
}
addDevice(JSON.stringify(tDeviceInfon)).then(response => {
this.msgSuccess("新增成功");
......@@ -661,7 +782,7 @@ export default {
console.log('error submit!!');
return false;
}
});
}
}
});
......@@ -669,24 +790,29 @@ export default {
},
/**关联设备添加方法*/
addDetailInfo(){
addDetailInfos(this.formDetailInfo).then(response => {
// this.tableData.push(this.formDetailInfo)
//关闭弹出层
this.dialogFormVisible = false;
//数据表单重置
this.formDetailInfo={
deviceName: null,
deviceModel:null,
deviceType:null,
iotNo:null,
remarksn:null
};
this.getDataList();
this.msgSuccess("新增成功");
this.$refs["formDetailInfo"].validate(valid => {
if (valid) {
addDetailInfos(this.formDetailInfo).then(response => {
// this.tableData.push(this.formDetailInfo)
//关闭弹出层
this.dialogFormVisible = false;
//数据表单重置
this.formDetailInfo={
deviceName: null,
deviceModel:null,
deviceType:null,
iotNo:null,
remarksn:null
};
this.getDataList();
this.msgSuccess("新增成功");
});
}
});
},
/*关联设备单条删除方法*/
/**关联设备单条删除方法*/
deleteDetailInfo(row){
const deviceIds = row.relationDeviceDetailId;
this.$confirm('是否确认删除设备信息编号为"' + deviceIds + '"的数据项?', "警告", {
......@@ -701,7 +827,10 @@ export default {
this.msgSuccess("删除成功");
}).catch(() => {});
},
/**关联设备已经选中数据删除方法*/
deleteDataListilInfo(row,index){
this.DetailInfoList.splice(index,1);
},
/**
* 批量删除关联设备方法
* @param row
......@@ -719,11 +848,11 @@ export default {
this.msgSuccess("删除成功");
}).catch(() => {});
},
/**添加关联设备与设备绑定的数据 (存储到数组中)*/
insertListDetailInfo(row){
//获取已经选中的下级设备id
const deviceIds = this.ids;
const li=this.datalist;
this.$confirm('是否确认添加关联设备信息?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
......@@ -731,17 +860,30 @@ 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)
console.log(deviceIds)
// alert(this.DetailInfoListId)
this.dialogTableVisible=false
this.msgSuccess("添加成功");
}).catch(() => {});
},
/**
* 选择关联设备查询方法
*/
selectDataListInfo(){
//查询下级设备数据
getDdeviceDetailInfo(this.dateQueryParams).then(response => {
//下级设备数据 到时候换成下级数据
this.tableData = response.rows;
this.detailTotal = response.total;
this.loadings = false;
//打开选择关联设备弹出框
this.dialogTableVisible = true
});
}
}
};
......
......@@ -115,7 +115,7 @@
<!-- 添加或修改燃气用户对话框 -->
<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="100px">
<el-form-item label="用户账号" prop="username">
<el-input v-model="form.username" placeholder="请输入用户账号" />
</el-form-item>
......
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