Commit 2cf2edc2 authored by yaqizhang's avatar yaqizhang

Merge branch 'master' of ssh://111.61.77.35:15/gengdidi/gassafety-progress into master

parents d50bb857 a9ebcf55
package com.zehong.web.controller.supervise;
import java.io.File;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
......@@ -19,6 +16,7 @@ import com.zehong.system.domain.TEmployedPeopleInfo;
import com.zehong.system.service.ITEmployedPeopleInfoService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 从业人员信息Controller
......@@ -74,7 +72,7 @@ public class TEmployedPeopleInfoController extends BaseController
@PreAuthorize("@ss.hasPermi('regulation:supervise:add')")
@Log(title = "从业人员信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TEmployedPeopleInfo tEmployedPeopleInfo) throws ParseException {
public AjaxResult add( TEmployedPeopleInfo tEmployedPeopleInfo) throws ParseException {
//根据企业id查询企业名称
String EnterpriseName = tEmployedPeopleInfoService.selectEnterpriseName(tEmployedPeopleInfo.getBeyondEnterpriseId());
tEmployedPeopleInfo.setBeyondEnterpriseName(EnterpriseName);
......@@ -114,4 +112,41 @@ public class TEmployedPeopleInfoController extends BaseController
return AjaxResult.success(tEmployedPeopleInfoService.selectTEnterprise());
}
/**
* 图片上传接口
* @param file
* @return
*/
@ResponseBody
@RequestMapping("/addParent")
public String upFile(@RequestParam("file") MultipartFile file) {
String path = "D:\\img";
String fileName = file.getOriginalFilename();//获取文件名称
String suffixName=fileName.substring(fileName.lastIndexOf("."));//获取文件后缀
//uuid+文件名
fileName= UUID.randomUUID().toString().replace("-", "").toLowerCase()+suffixName;//重新生成文件名
System.out.println(fileName);
System.out.println("type::" + suffixName);
System.out.println("filename::" + fileName);
File targetFile = new File(path);
if (!targetFile.exists()) {
// 判断文件夹是否未空,空则创建
targetFile.mkdirs();
}
File saveFile = new File(targetFile, fileName);
try {
//指定本地存入路径
file.transferTo(saveFile);
System.out.println("执行成功");
String path1 = path + fileName;
//图片存储地址
System.out.println(path1);
return path1;
} catch (Exception e) {
e.printStackTrace();
System.out.println("执行失败");
return "failed";
}
}
}
......@@ -30,6 +30,9 @@ public class DeviceData {
private int iconType;
//下级设备数据封装类数组
private List<SubordinateEquipmentList> subordinateEquipmentList;
//压力表设备数量
private int numberPressureGauges;
......@@ -66,6 +69,80 @@ public class DeviceData {
//流量计报警中
private int numberInAlarm;
//探测器设备数量
private int detectorEquipment;
//探测器在线设备
private int detectorOnlineEquipment;
//探测器离线设备
private int detectorOfflineEquipment;
//探测器历史报警
private int detectorHistoricalAlarm;
//探测器已处理报警
private int detectorAlarmProcessed;
//探测器报警中
private int detectorInAlarm;
public List<SubordinateEquipmentList> getSubordinateEquipmentList() {
return subordinateEquipmentList;
}
public void setSubordinateEquipmentList(List<SubordinateEquipmentList> subordinateEquipmentList) {
this.subordinateEquipmentList = subordinateEquipmentList;
}
public int getDetectorEquipment() {
return detectorEquipment;
}
public void setDetectorEquipment(int detectorEquipment) {
this.detectorEquipment = detectorEquipment;
}
public int getDetectorOnlineEquipment() {
return detectorOnlineEquipment;
}
public void setDetectorOnlineEquipment(int detectorOnlineEquipment) {
this.detectorOnlineEquipment = detectorOnlineEquipment;
}
public int getDetectorOfflineEquipment() {
return detectorOfflineEquipment;
}
public void setDetectorOfflineEquipment(int detectorOfflineEquipment) {
this.detectorOfflineEquipment = detectorOfflineEquipment;
}
public int getDetectorHistoricalAlarm() {
return detectorHistoricalAlarm;
}
public void setDetectorHistoricalAlarm(int detectorHistoricalAlarm) {
this.detectorHistoricalAlarm = detectorHistoricalAlarm;
}
public int getDetectorAlarmProcessed() {
return detectorAlarmProcessed;
}
public void setDetectorAlarmProcessed(int detectorAlarmProcessed) {
this.detectorAlarmProcessed = detectorAlarmProcessed;
}
public int getDetectorInAlarm() {
return detectorInAlarm;
}
public void setDetectorInAlarm(int detectorInAlarm) {
this.detectorInAlarm = detectorInAlarm;
}
public int getNumberPressureGauges() {
return numberPressureGauges;
......@@ -259,7 +336,6 @@ public class DeviceData {
this.pressureFlows = pressureFlows;
}
@Override
public String toString() {
return "DeviceData{" +
......@@ -275,6 +351,7 @@ public class DeviceData {
", pressureFlows=" + pressureFlows +
", beyondEnterpriseName='" + beyondEnterpriseName + '\'' +
", iconType=" + iconType +
", subordinateEquipmentList=" + subordinateEquipmentList +
", numberPressureGauges=" + numberPressureGauges +
", onlineEquipment=" + onlineEquipment +
", offlineEquipment=" + offlineEquipment +
......@@ -287,6 +364,12 @@ public class DeviceData {
", numberHistoricalAlarm=" + numberHistoricalAlarm +
", numberAlarmProcessed=" + numberAlarmProcessed +
", numberInAlarm=" + numberInAlarm +
", detectorEquipment=" + detectorEquipment +
", detectorOnlineEquipment=" + detectorOnlineEquipment +
", detectorOfflineEquipment=" + detectorOfflineEquipment +
", detectorHistoricalAlarm=" + detectorHistoricalAlarm +
", detectorAlarmProcessed=" + detectorAlarmProcessed +
", detectorInAlarm=" + detectorInAlarm +
'}';
}
}
package com.zehong.system.domain;
import java.util.List;
public class DeviceList {
......
......@@ -14,6 +14,16 @@ public class PressureFlow {
private String deviceId;
private String iotNo;
public String getIotNo() {
return iotNo;
}
public void setIotNo(String iotNo) {
this.iotNo = iotNo;
}
public String getDeviceId() {
return deviceId;
}
......@@ -71,6 +81,7 @@ public class PressureFlow {
", deviceNum='" + deviceNum + '\'' +
", reportTime='" + reportTime + '\'' +
", deviceId='" + deviceId + '\'' +
", iotNo='" + iotNo + '\'' +
'}';
}
}
package com.zehong.system.domain;
/**
* 首页- 调压箱/阀门井 列表数据封装类
*/
public class PressureFlowList {
//设备编号
private String iotNo;
//设备名称
private String deviceName;
//探测介质
private String detectionMedium;
//联系人
private String linkman;
//联系电话
private String phone;
//设备状态 0正常 1掉线
private String detectorStatus;
public String getIotNo() {
return iotNo;
}
public void setIotNo(String iotNo) {
this.iotNo = iotNo;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDetectionMedium() {
return detectionMedium;
}
public void setDetectionMedium(String detectionMedium) {
this.detectionMedium = detectionMedium;
}
public String getLinkman() {
return linkman;
}
public void setLinkman(String linkman) {
this.linkman = linkman;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getDetectorStatus() {
return detectorStatus;
}
public void setDetectorStatus(String detectorStatus) {
this.detectorStatus = detectorStatus;
}
@Override
public String toString() {
return "PressureFlowList{" +
"iotNo='" + iotNo + '\'' +
", deviceName='" + deviceName + '\'' +
", detectionMedium='" + detectionMedium + '\'' +
", linkman='" + linkman + '\'' +
", phone='" + phone + '\'' +
", detectorStatus='" + detectorStatus + '\'' +
'}';
}
}
package com.zehong.system.domain;
/**
* 首页下级设备数据封装类
*/
public class SubordinateEquipmentList {
//设备数量
private int numberPressureGauges;
//在线设备
private int onlineEquipment;
//离线设备
private int offlineEquipment;
//历史报警
private int historicalAlarm;
//已处理报警
private int alarmProcessed;
//报警中
private int inAlarm;
//类型 1压力表 2流量计 3探测器
private int dataType;
public int getDataType() {
return dataType;
}
public void setDataType(int dataType) {
this.dataType = dataType;
}
public int getNumberPressureGauges() {
return numberPressureGauges;
}
public void setNumberPressureGauges(int numberPressureGauges) {
this.numberPressureGauges = numberPressureGauges;
}
public int getOnlineEquipment() {
return onlineEquipment;
}
public void setOnlineEquipment(int onlineEquipment) {
this.onlineEquipment = onlineEquipment;
}
public int getOfflineEquipment() {
return offlineEquipment;
}
public void setOfflineEquipment(int offlineEquipment) {
this.offlineEquipment = offlineEquipment;
}
public int getHistoricalAlarm() {
return historicalAlarm;
}
public void setHistoricalAlarm(int historicalAlarm) {
this.historicalAlarm = historicalAlarm;
}
public int getAlarmProcessed() {
return alarmProcessed;
}
public void setAlarmProcessed(int alarmProcessed) {
this.alarmProcessed = alarmProcessed;
}
public int getInAlarm() {
return inAlarm;
}
public void setInAlarm(int inAlarm) {
this.inAlarm = inAlarm;
}
@Override
public String toString() {
return "SubordinateEquipmentList{" +
"numberPressureGauges=" + numberPressureGauges +
", onlineEquipment=" + onlineEquipment +
", offlineEquipment=" + offlineEquipment +
", historicalAlarm=" + historicalAlarm +
", alarmProcessed=" + alarmProcessed +
", inAlarm=" + inAlarm +
", dataType=" + dataType +
'}';
}
}
......@@ -27,7 +27,7 @@ public class TDeviceInfoS extends BaseEntity {
private String deviceModel;
/**
* 设备类型:1.压力表 2.流量计
* 设备类型:1.压力表 2.流量计 3.探测器
*/
private String deviceType;
......@@ -41,6 +41,19 @@ public class TDeviceInfoS extends BaseEntity {
*/
private String remarksn;
/**
* 探测介质
*/
private String detectionMedium;
public String getDetectionMedium() {
return detectionMedium;
}
public void setDetectionMedium(String detectionMedium) {
this.detectionMedium = detectionMedium;
}
public Integer getRelationDeviceDetailId() {
return relationDeviceDetailId;
......@@ -105,9 +118,10 @@ public class TDeviceInfoS extends BaseEntity {
", relationDeviceId=" + relationDeviceId +
", deviceName='" + deviceName + '\'' +
", deviceModel='" + deviceModel + '\'' +
", deviceType=" + deviceType +
", deviceType='" + deviceType + '\'' +
", iotNo='" + iotNo + '\'' +
", remarksn='" + remarksn + '\'' +
", detectionMedium='" + detectionMedium + '\'' +
'}';
}
}
......@@ -25,6 +25,9 @@ public class TSiteStationInfoData {
//流量计数组
private List<PressureFlow> pressureFlows;
//下级设备数据封装类数组
private List<SubordinateEquipmentList> subordinateEquipmentList;
private int iconType;
private String companyType;
......@@ -65,6 +68,79 @@ public class TSiteStationInfoData {
//流量计报警中
private int numberInAlarm;
//探测器设备数量
private int detectorEquipment;
//探测器在线设备
private int detectorOnlineEquipment;
//探测器离线设备
private int detectorOfflineEquipment;
//探测器历史报警
private int detectorHistoricalAlarm;
//探测器已处理报警
private int detectorAlarmProcessed;
//探测器报警中
private int detectorInAlarm;
public List<SubordinateEquipmentList> getSubordinateEquipmentList() {
return subordinateEquipmentList;
}
public void setSubordinateEquipmentList(List<SubordinateEquipmentList> subordinateEquipmentList) {
this.subordinateEquipmentList = subordinateEquipmentList;
}
public int getDetectorEquipment() {
return detectorEquipment;
}
public void setDetectorEquipment(int detectorEquipment) {
this.detectorEquipment = detectorEquipment;
}
public int getDetectorOnlineEquipment() {
return detectorOnlineEquipment;
}
public void setDetectorOnlineEquipment(int detectorOnlineEquipment) {
this.detectorOnlineEquipment = detectorOnlineEquipment;
}
public int getDetectorOfflineEquipment() {
return detectorOfflineEquipment;
}
public void setDetectorOfflineEquipment(int detectorOfflineEquipment) {
this.detectorOfflineEquipment = detectorOfflineEquipment;
}
public int getDetectorHistoricalAlarm() {
return detectorHistoricalAlarm;
}
public void setDetectorHistoricalAlarm(int detectorHistoricalAlarm) {
this.detectorHistoricalAlarm = detectorHistoricalAlarm;
}
public int getDetectorAlarmProcessed() {
return detectorAlarmProcessed;
}
public void setDetectorAlarmProcessed(int detectorAlarmProcessed) {
this.detectorAlarmProcessed = detectorAlarmProcessed;
}
public int getDetectorInAlarm() {
return detectorInAlarm;
}
public void setDetectorInAlarm(int detectorInAlarm) {
this.detectorInAlarm = detectorInAlarm;
}
public int getNumberOnlineEquipment() {
return numberOnlineEquipment;
......@@ -282,6 +358,7 @@ public class TSiteStationInfoData {
", buildCompany='" + buildCompany + '\'' +
", powerCompany='" + powerCompany + '\'' +
", pressureFlows=" + pressureFlows +
", subordinateEquipmentList=" + subordinateEquipmentList +
", iconType=" + iconType +
", companyType='" + companyType + '\'' +
", numberPressureGauges=" + numberPressureGauges +
......@@ -296,6 +373,12 @@ public class TSiteStationInfoData {
", numberHistoricalAlarm=" + numberHistoricalAlarm +
", numberAlarmProcessed=" + numberAlarmProcessed +
", numberInAlarm=" + numberInAlarm +
", detectorEquipment=" + detectorEquipment +
", detectorOnlineEquipment=" + detectorOnlineEquipment +
", detectorOfflineEquipment=" + detectorOfflineEquipment +
", detectorHistoricalAlarm=" + detectorHistoricalAlarm +
", detectorAlarmProcessed=" + detectorAlarmProcessed +
", detectorInAlarm=" + detectorInAlarm +
'}';
}
}
package com.zehong.system.mapper;
import com.zehong.system.domain.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -72,4 +73,32 @@ public interface PipeInterfaceMapper {
* @return
*/
List<DeviceData> selectvalveData();
/**
* 查询下级在线设备数量
* @param pressureList
* @return
*/
int selectOnlineQuantity(@Param("pressureList")List<PressureFlow> pressureList,@Param("isOnLine")int isOnLine);
/**
* 查询历史报警数量
* @param pressureList
* @return
*/
int selectHistoricalAlarm(List<PressureFlow> pressureList);
/**
* 查询已处理报警
* @param pressureList
* @return
*/
int selectProcessAlarm(List<PressureFlow> pressureList);
/**
* 查询报警中
* @param pressureList
* @return
*/
int selectInAlarm(List<PressureFlow> pressureList);
}
package com.zehong.system.service;
import com.zehong.system.domain.*;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -69,4 +70,32 @@ public interface IPipeInterfaceService {
* @return
*/
List<DeviceData> selectvalveData();
/**
* 查询下级在线设备数量
* @param pressureList
* @return
*/
int selectOnlineQuantity(List<PressureFlow> pressureList,@Param("isOnLine") int isOnLine);
/**
* 查询历史报警数量
* @param pressureList
* @return
*/
int selectHistoricalAlarm(List<PressureFlow> pressureList);
/**
* 查询已处理报警
* @param pressureList
* @return
*/
int selectProcessAlarm(List<PressureFlow> pressureList);
/**
* 查询报警中
* @param pressureList
* @return
*/
int selectInAlarm(List<PressureFlow> pressureList);
}
......@@ -2,6 +2,7 @@ package com.zehong.system.service.impl;
import com.zehong.system.domain.*;
import com.zehong.system.mapper.PipeInterfaceMapper;
import com.zehong.system.service.IPipeInterfaceService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -116,4 +117,48 @@ public class PipeInterfaceServiceImpl implements IPipeInterfaceService {
List<DeviceData> pipeDates = pipeInterfaceMapper.selectvalveData();
return pipeDates;
}
/**
* 查询下级在线设备数量
* @param pressureList
* @return
*/
@Override
public int selectOnlineQuantity(List<PressureFlow> pressureList, int isOnLine) {
int i = pipeInterfaceMapper.selectOnlineQuantity(pressureList,isOnLine);
return i;
}
/**
* 查询历史报警数量
* @param pressureList
* @return
*/
@Override
public int selectHistoricalAlarm(List<PressureFlow> pressureList) {
int i = pipeInterfaceMapper.selectHistoricalAlarm(pressureList);
return i;
}
/**
* 查询已处理报警
* @param pressureList
* @return
*/
@Override
public int selectProcessAlarm(List<PressureFlow> pressureList) {
int i = pipeInterfaceMapper.selectProcessAlarm(pressureList);
return i;
}
/**
* 查询报警中
* @param pressureList
* @return
*/
@Override
public int selectInAlarm(List<PressureFlow> pressureList) {
int i = pipeInterfaceMapper.selectInAlarm(pressureList);
return i;
}
}
......@@ -38,6 +38,7 @@
<result property="deviceNo" column="device_model" />
<result property="deviceType" column="device_type" />
<result property="reportTime" column="create_time" />
<result property="iotNo" column="iot_no" />
</resultMap>
<!--场站数据-->
......@@ -102,9 +103,9 @@
</select>
<!--查询下级设备数据-->
<select id="selectPressureFlow" parameterType="DeviceData" resultMap="PressureFlowResult">
select device_model,device_type,create_time,relation_device_id from t_relation_device_detail_info
where relation_device_type='1'
<select id="selectPressureFlow" parameterType="java.util.List" resultMap="PressureFlowResult">
select device_model,device_type,create_time,relation_device_id,iot_no from t_relation_device_detail_info
where relation_device_type='1' and relation_device_id = #{deviceId}
</select>
<!--场站信息查询方法-->
......@@ -116,7 +117,7 @@
<!--查询场站下级数据-->
<select id="selecttSiteStationInfoDataList" parameterType="DeviceData" resultMap="PressureFlowResult">
select device_model,device_type,create_time,relation_device_id from t_relation_device_detail_info
where relation_device_type='2'
where relation_device_type='2' and relation_device_id = #{deviceId}
</select>
<!--监控信息查询-->
......@@ -142,4 +143,42 @@
where device_type='1' and is_del='0'
</select>
<!--查询在线下级设备数量-->
<select id="selectOnlineQuantity" parameterType="java.util.List" resultType="java.lang.Integer">
select count(detector_id) as id from t_detector_info
where is_del ='0' and detector_status=#{isOnLine} and detector_code in
(
<foreach collection="pressureList" item="item" index="index" separator=",">
#{item.iotNo}
</foreach>
)
</select>
<!--查询历史报警数量-->
<select id="selectHistoricalAlarm" parameterType="java.util.List" resultType="java.lang.Integer">
select count(id) from t_detector_report_data
where detector_code in
<foreach collection="list" item="pressureList" open="(" close=")" index="index" separator=",">
#{pressureList.iotNo}
</foreach>
</select>
<!--查询已处理报警-->
<select id="selectProcessAlarm" parameterType="java.util.List" resultType="java.lang.Integer">
select count(id) from t_detector_report_data
where is_cancel_alarm !='0' and detector_code in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.iotNo}
</foreach>
</select>
<!--查询报警中-->
<select id="selectInAlarm" parameterType="java.util.List" resultType="java.lang.Integer">
select count(id) from t_detector_report_data
where is_cancel_alarm ='0' and detector_code in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.iotNo}
</foreach>
</select>
</mapper>
......@@ -36,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deviceModel" column="device_model" />
<result property="deviceType" column="device_type" />
<result property="iotNo" column="iot_no" />
<result property="detectionMedium" column="detection_medium" />
<result property="remarksn" column="remarks" />
</resultMap>
......@@ -161,20 +162,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertDeviceDetailInfo">
INSERT INTO t_relation_device_detail_info (relation_device_id,device_name,device_model,device_type,iot_no,remarks)
INSERT INTO t_relation_device_detail_info (relation_device_id,detection_medium,device_name,device_model,device_type,iot_no,remarks)
VALUES
(#{relationDeviceId},#{deviceName},#{deviceModel},#{deviceType},#{iotNo},#{remarksn})
(#{relationDeviceId},#{detectionMedium},#{deviceName},#{deviceModel},#{deviceType},#{iotNo},#{remarksn})
</insert>
<!--获取设备详细信息列表-->
<select id="getdeviceDetailInfo" resultMap="TDeviceInfoResultS">
select relation_device_detail_id,relation_device_id,device_name,device_model,device_type,iot_no,remarks
select relation_device_detail_id,relation_device_id,device_name,device_model,device_type,iot_no,remarks,detection_medium
from t_relation_device_detail_info where relation_device_id =#{deviceId}
</select>
<!--查询无绑定的 关联设备信息-->
<select id="selectDetailInfo" 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
select relation_device_detail_id,detection_medium,relation_device_id,device_name,device_model,iot_no,remarks, (CASE device_type WHEN '1' THEN '压力表' WHEN '2' THEN '流量计' WHEN '3' THEN '探测器' end) as device_type
from t_relation_device_detail_info where is_del='0' and relation_device_id is null
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="deviceModel != null and deviceModel != ''"> and device_model like concat('%', #{deviceModel}, '%')</if>
......@@ -184,7 +185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--查询设备已经关联的关联设备-->
<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
select relation_device_detail_id,detection_medium,relation_device_id,device_name,device_model,iot_no,remarks, (CASE device_type WHEN '1' THEN '压力表' WHEN '2' THEN '流量计' WHEN '3' THEN '探测器' end) as device_type
from t_relation_device_detail_info where relation_device_id=#{id} and relation_device_type=#{relationDeviceType}
</select>
......
import request from '@/utils/request'
import request from '@/utils/request';
import qs from 'qs'
// 查询从业人员信息列表
export function listInfo(query) {
return request({
......@@ -18,11 +18,28 @@ export function getInfo(employedPeopleId) {
}
// 新增从业人员信息
export function addInfo(data) {
export function addInfo(file,form) {
return request({
url: '/regulation/supervise',
method: 'post',
data: data
data: {
file:file,
tEmployedPeopleInfo:form,
},
headers: {
"Content-Type": "multipart/form-data"
},
})
}
//传图片
export function addFile(file){
return request({
url: '/regulation/supervise/addParent',
method: 'post',
data: file,
headers: {
'Content-type': 'multipart/form-data'
},
})
}
......
......@@ -211,6 +211,7 @@
<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="detectionMedium" />
<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">
......@@ -256,6 +257,7 @@
<el-select v-model="formDetailInfo.deviceType" placeholder="请选择设备类型">
<el-option label="压力表" value="1" />
<el-option label="流量计" value="2" />
<el-option label="探测器" value="3" />
</el-select>
</el-form-item>
</el-col>
......@@ -267,6 +269,15 @@
</el-col>
</el-row>
<el-row>
<el-col :span="22">
<el-form-item label="探测介质" prop="detectionMedium" >
<el-input v-model="formDetailInfo.detectionMedium" placeholder="请输入探测介质" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22">
<el-form-item label="备注" prop="remarksn">
......@@ -498,6 +509,7 @@ export default {
deviceModel:'',
deviceType:'',
iotNo:'',
detectionMedium:'',
remarksn:''
},
/*动态添加输入框*/
......
......@@ -315,6 +315,7 @@
<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="detectionMedium" />
<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">
......@@ -362,6 +363,7 @@
<el-select v-model="formDetailInfo.deviceType" placeholder="请选择设备类型">
<el-option label="压力表" value="1" />
<el-option label="流量计" value="2" />
<el-option label="探测器" value="3" />
</el-select>
</el-form-item>
</el-col>
......@@ -373,6 +375,14 @@
</el-col>
</el-row>
<el-row>
<el-col :span="22">
<el-form-item label="探测介质" prop="detectionMedium" >
<el-input v-model="formDetailInfo.detectionMedium" placeholder="请输入探测介质" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22">
<el-form-item label="备注" prop="remarksn">
......@@ -427,6 +437,7 @@ export default {
deviceModel:'',
deviceType:'',
iotNo:'',
detectionMedium:'',
remarksn:''
},
//关联设备下级数据 表单校验
......
......@@ -137,6 +137,26 @@
</el-col>
</el-row>
<el-row>
<el-col :span="22">
<el-form-item label="上传头像" prop="idCard">
<el-upload
class="upload-demo"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-change="fileChange"
:before-upload="beforeUploadFile"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/jpeg/png格式,且不超过10MB</div>
</el-upload>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="发证日期" prop="issueDate">
......@@ -211,7 +231,7 @@
</template>
<script>
import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo, selectTEnterprise} from "@/api/regulation/supervise";
import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo, selectTEnterprise,addFile} from "@/api/regulation/supervise";
export default {
name: "Info",
......@@ -219,6 +239,12 @@ export default {
},
data() {
return {
//头像
fileList: [],
//头像数据
fileo :{
name: "",
url:"" },
// 遮罩层
loading: true,
// 导出遮罩层
......@@ -271,6 +297,43 @@ export default {
this.getList();
},
methods: {
/**上传头像方法*/
handleRemove(file, fileList) {
console.log(file, fileList);
},
handlePreview(file) {
console.log(file);
},
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
// 上传文件之前的钩子, 参数为上传的文件,若返回 false 或者返回 Promise 且被 reject,则停止上传
beforeUploadFile(file) {
let extension = file.name.substring(file.name.lastIndexOf('.') + 1);
let size = file.size / 1024 / 1024;
const isIMG =
file.type === 'image/jpg' ||
file.type === 'image/jpeg' ||
file.type === 'image/png'
if (!isIMG) {
this.$message.error('上传头像图片只支持jpg、jpeg、png格式!')
}
if (size > 10) {
this.$message.warning('图片大小不得超过10M');
}
},
// 文件状态改变时的钩子
fileChange(file, fileList) {
this.fileList = [];
this.fileo.name=file.name;
this.fileo.url=file.raw;
this.fileList.push(this.fileo);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }?`);
this.fileList = [];
},
/** 查询从业人员信息列表 */
getList() {
this.loading = true;
......@@ -285,6 +348,7 @@ export default {
cancel() {
this.open = false;
this.reset();
this.fileList = [];
},
// 表单重置
reset() {
......@@ -359,11 +423,40 @@ export default {
this.getList();
});
} else {
addInfo(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
// if (this.fileList.length === 0) {
// this.$message.warning('请上传图片');
// } else {
let file= new FormData();
file.append('file', this.fileList[0]);
// axios({
// method: "post",
// url: `${this.url}/transferRelationshipFile`,
// headers: {
// 'Content-type': 'multipart/form-data'
// },
// data: form
// }).then(function (response) {
// loading.close()
// that.$message({
// message: '图片上传完成',
// type: 'success'
// });
// })
//先传图片 返回图片存储地址
addFile(file).then(response => {
//传form表单
addInfo(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
// }
}
}
});
......@@ -398,6 +491,87 @@ export default {
}).catch(() => {});
},
/**
* 文件提交方法
*/
uploadFile() {
let that = this;
//是否清空数据
let accumulate;
if (this.fileList.length === 0) {
this.$message.warning('请上传文件');
} else {
this.$confirm('是否清空现有数据?', '提示', {
confirmButtonText: '是',
cancelButtonText: '否',
type: 'warning'
/**
* 这个是清空方法 走这个
*/
}).then(() => {
accumulate = 0;
this.$message({
type: 'success',
message: '已清空'
});
let form = new FormData();
form.append('file', this.fileList[0]);
const loading = this.$loading({
lock: true,
text: '数据正在上传中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
axios({
method: "post",
url: `${this.url}/transferRelationshipFile?Accumulate=` + accumulate,
headers: {
'Content-type': 'multipart/form-data'
},
data: form
}).then(function (response) {
loading.close()
that.$message({
message: '数据上传完成',
type: 'success'
});
})
/**
* 这个是取消清空方法 走这个
*/
}).catch(() => {
accumulate = 1;
this.$message({
type: 'success',
message: '取消清空',
});
let form = new FormData();
form.append('file', this.fileList[0]);
const loading = this.$loading({
lock: true,
text: '数据正在上传中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
axios({
method: "post",
url: `${this.url}/transferRelationshipFile?Accumulate=` + accumulate,
headers: {
'Content-type': 'multipart/form-data'
},
data: form
}).then(function (response) {
loading.close()
that.$message({
message: '数据上传完成',
type: 'success'
});
})
});
}
},
}
};
......
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