Compare commits

...

5 Commits

Author SHA1 Message Date
400aedb4b6 系统名称修改 2024-07-30 14:37:10 +08:00
0c93b0686f 系统名称修改 2024-06-27 15:03:57 +08:00
34456d8b29 首页修改 2024-06-26 18:01:10 +08:00
1b937b5905 首页修改 2024-06-26 17:57:06 +08:00
af585370c0 添加供应商管理 2024-06-26 13:55:08 +08:00
28 changed files with 1196 additions and 351 deletions

View File

@ -0,0 +1,105 @@
package com.inspur.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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 com.inspur.common.annotation.Log;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.common.enums.BusinessType;
import com.inspur.system.domain.SysSupplier;
import com.inspur.system.service.ISysSupplierService;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.common.core.page.TableDataInfo;
/**
* 供应商管理Controller
*
* @author inspur
* @date 2024-06-25
*/
@RestController
@RequestMapping("/system/supplier")
public class SysSupplierController extends BaseController
{
@Autowired
private ISysSupplierService sysSupplierService;
/**
* 查询供应商管理列表
*/
// @PreAuthorize("@ss.hasPermi('system:supplier:list')")
@GetMapping("/list")
public TableDataInfo list(SysSupplier sysSupplier)
{
startPage();
List<SysSupplier> list = sysSupplierService.selectSysSupplierList(sysSupplier);
return getDataTable(list);
}
/**
* 导出供应商管理列表
*/
// @PreAuthorize("@ss.hasPermi('system:supplier:export')")
@Log(title = "供应商管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysSupplier sysSupplier)
{
List<SysSupplier> list = sysSupplierService.selectSysSupplierList(sysSupplier);
ExcelUtil<SysSupplier> util = new ExcelUtil<SysSupplier>(SysSupplier.class);
util.exportExcel(response, list, "供应商管理数据");
}
/**
* 获取供应商管理详细信息
*/
// @PreAuthorize("@ss.hasPermi('system:supplier:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(sysSupplierService.selectSysSupplierById(id));
}
/**
* 新增供应商管理
*/
// @PreAuthorize("@ss.hasPermi('system:supplier:add')")
@Log(title = "供应商管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysSupplier sysSupplier)
{
return toAjax(sysSupplierService.insertSysSupplier(sysSupplier));
}
/**
* 修改供应商管理
*/
// @PreAuthorize("@ss.hasPermi('system:supplier:edit')")
@Log(title = "供应商管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysSupplier sysSupplier)
{
return toAjax(sysSupplierService.updateSysSupplier(sysSupplier));
}
/**
* 删除供应商管理
*/
// @PreAuthorize("@ss.hasPermi('system:supplier:remove')")
@Log(title = "供应商管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sysSupplierService.deleteSysSupplierByIds(ids));
}
}

View File

@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源 ehms_tygyhnt ehms_sdyyjc
master:
url: jdbc:mysql://117.73.2.117:3306/ehms_zjcksjqr_wg?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://117.73.2.117:3306/ehms_bnyd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: ehms
password: Y123456a
# 从库数据源

View File

@ -12,15 +12,15 @@ 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 com.god.common.annotation.Log;
import com.god.common.core.controller.BaseController;
import com.god.common.core.domain.AjaxResult;
import com.god.common.enums.BusinessType;
import com.inspur.common.annotation.Log;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.common.enums.BusinessType;
import ${packageName}.domain.${ClassName};
import ${packageName}.service.I${ClassName}Service;
import com.god.common.utils.poi.ExcelUtil;
import com.inspur.common.utils.poi.ExcelUtil;
#if($table.crud || $table.sub)
import com.god.common.core.page.TableDataInfo;
import com.inspur.common.core.page.TableDataInfo;
#elseif($table.tree)
#end

View File

@ -3,14 +3,14 @@ package ${packageName}.domain;
#foreach ($import in $importList)
import ${import};
#end
import com.god.common.annotation.Excel;
import com.inspur.common.annotation.Excel;
#if($table.crud || $table.sub)
#elseif($table.tree)
#end
/**
* ${functionName}对象 ${tableName}
*
*
* @author ${author}
* @date ${datetime}
*/
@ -58,12 +58,12 @@ public class ${ClassName} extends ${Entity}
#else
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#end
public void set${AttrName}($column.javaType $column.javaField)
public void set${AttrName}($column.javaType $column.javaField)
{
this.$column.javaField = $column.javaField;
}
public $column.javaType get${AttrName}()
public $column.javaType get${AttrName}()
{
return $column.javaField;
}

View File

@ -3,7 +3,7 @@ package ${packageName}.service.impl;
import java.util.List;
#foreach ($column in $columns)
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
import com.god.common.utils.DateUtils;
import com.inspur.common.utils.DateUtils;
#break
#end
#end
@ -11,7 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
#if($table.sub)
import java.util.ArrayList;
import com.god.common.utils.StringUtils;
import com.inspur.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import ${packageName}.domain.${subClassName};
#end
@ -21,19 +21,19 @@ import ${packageName}.service.I${ClassName}Service;
/**
* ${functionName}Service业务层处理
*
*
* @author ${author}
* @date ${datetime}
*/
@Service
public class ${ClassName}ServiceImpl implements I${ClassName}Service
public class ${ClassName}ServiceImpl implements I${ClassName}Service
{
@Autowired
private ${ClassName}Mapper ${className}Mapper;
/**
* 查询${functionName}
*
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
@ -45,7 +45,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
/**
* 查询${functionName}列表
*
*
* @param ${className} ${functionName}
* @return ${functionName}
*/
@ -57,7 +57,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
/**
* 新增${functionName}
*
*
* @param ${className} ${functionName}
* @return 结果
*/
@ -83,7 +83,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
/**
* 修改${functionName}
*
*
* @param ${className} ${functionName}
* @return 结果
*/
@ -107,7 +107,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
/**
* 批量删除${functionName}
*
*
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键
* @return 结果
*/
@ -125,7 +125,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
/**
* 删除${functionName}信息
*
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return 结果
*/
@ -144,7 +144,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
/**
* 新增${subTable.functionName}信息
*
*
* @param ${className} ${functionName}对象
*/
public void insert${subClassName}(${ClassName} ${className})

View File

@ -3,11 +3,11 @@ package ${packageName}.domain;
#foreach ($import in $subImportList)
import ${import};
#end
import com.god.common.annotation.Excel;
import com.inspur.common.annotation.Excel;
/**
* ${subTable.functionName}对象 ${subTableName}
*
*
* @author ${author}
* @date ${datetime}
*/
@ -45,12 +45,12 @@ public class ${subClassName} extends BaseEntity
#else
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#end
public void set${AttrName}($column.javaType $column.javaField)
public void set${AttrName}($column.javaType $column.javaField)
{
this.$column.javaField = $column.javaField;
}
public $column.javaType get${AttrName}()
public $column.javaType get${AttrName}()
{
return $column.javaField;
}

View File

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.patrol.mapper.PatrolTaskWorkorderMapper">
<resultMap type="PatrolTaskWorkorder" id="PatrolTaskWorkorderResult">
<result property="id" column="id" />
<result property="workorderCode" column="workorder_code" />
@ -43,8 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from patrol_task_workorder a
left join patrol_task b on a.task_id=b.id
left join ehms_eam_equipments_infomation c on a.equip_id=c.id
<where>
<where>
<if test="params.beginWorkorderCode != null and params.beginWorkorderCode != '' and params.endWorkorderCode != null and params.endWorkorderCode != ''"> and workorder_code between #{params.beginWorkorderCode} and #{params.endWorkorderCode}</if>
<if test="workorderCode != null and workorderCode != ''"> and a.workorder_code like concat('%', #{workorderCode}, '%')</if>
<if test="workorderStatus != null and workorderStatus != ''"> and a.workorder_status like concat('%', #{workorderStatus}, '%')</if>
<if test="workorderType != null and workorderType != ''"> and a.workorder_type like concat('%', #{workorderType}, '%')</if>
<if test="equipName != null and equipName != ''"> and c.equip_name like concat('%', #{equipName}, '%')</if>
@ -64,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by a.dispatch_time desc
</select>
<select id="selectPatrolTaskWorkorderById" parameterType="String" resultMap="PatrolTaskWorkorderResult">
<include refid="selectPatrolTaskWorkorderVo"/>
where id = #{id}
@ -79,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join patrol_task b on a.task_id=b.id
where a.id = #{id}
</select>
<insert id="insertPatrolTaskWorkorder" parameterType="PatrolTaskWorkorder">
insert into patrol_task_workorder
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -156,7 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deletePatrolTaskWorkorderByIds" parameterType="String">
delete from patrol_task_workorder where id in
delete from patrol_task_workorder where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
@ -177,4 +178,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
patrol_task_workorder
</select>
</mapper>
</mapper>

View File

@ -94,4 +94,8 @@ public interface EhmsEamEquipmentsInfomationMapper
* @return
*/
List<EhmsEamEquipmentsInfomation> getNoDataTermInfo();
List<Map<String, Object>> getPatrol();
List<Map<String, Object>> getClassList();
List<Map<String, Object>> getFileList();
List<Map<String, Object>> getLocationList();
}

View File

@ -95,5 +95,5 @@ public interface IEhmsEamEquipmentsInfomationService
* 获取首页charts统计数据
* @return
*/
public Map<String,List<String>> loadChartsData();
public Map<String,Object> loadChartsData();
}

View File

@ -23,15 +23,17 @@ import javax.validation.Validator;
import java.beans.Transient;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author zhangjunwen
* @create 2022/11/2
*/
@Service
public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipmentsInfomationService
{
public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipmentsInfomationService {
@Resource
private EhmsEamEquipmentsInfomationMapper ehmsEamEquipmentsInfomationMapper;
@ -54,10 +56,9 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
* @return 资产管理系统设备信息
*/
@Override
public EhmsEamEquipmentsInfomation selectEhmsEamEquipmentsInfomationById(String id)
{
public EhmsEamEquipmentsInfomation selectEhmsEamEquipmentsInfomationById(String id) {
EhmsEamEquipmentsInfomation result = ehmsEamEquipmentsInfomationMapper.selectEhmsEamEquipmentsInfomationById(id);
if (result.getId() != null){
if (result.getId() != null) {
SysDept dept = sysDeptMapper.selectDeptById(result.getEquipLocationId());
result.setEquipLocation(dept.getDeptName());
}
@ -71,10 +72,9 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
* @return 资产管理系统设备信息
*/
@Override
public List<EhmsEamEquipmentsInfomation> selectEhmsEamEquipmentsInfomationList(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation)
{
public List<EhmsEamEquipmentsInfomation> selectEhmsEamEquipmentsInfomationList(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation) {
List<EhmsEamEquipmentsInfomation> resultList = ehmsEamEquipmentsInfomationMapper.selectEhmsEamEquipmentsInfomationList(ehmsEamEquipmentsInfomation);
if(resultList.size() != 0){
if (resultList.size() != 0) {
for (EhmsEamEquipmentsInfomation eamEquipmentsInfomation : resultList) {
SysDept dept = sysDeptMapper.selectDeptById(eamEquipmentsInfomation.getEquipLocationId());
eamEquipmentsInfomation.setEquipLocation(dept.getDeptName());
@ -91,8 +91,7 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
* @return 资产管理系统设备信息
*/
@Override
public List<EhmsEamEquipmentsInfomation> selectLifeList(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation)
{
public List<EhmsEamEquipmentsInfomation> selectLifeList(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation) {
List<EhmsEamEquipmentsInfomation> resultList = ehmsEamEquipmentsInfomationMapper.selectLifeList(ehmsEamEquipmentsInfomation);
return resultList;
@ -100,14 +99,14 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
/**
* 根据时间查询设备信息
*
* @return
*/
@Override
public List<EhmsEamEquipmentsInfomation> selectEhmsEamEquipmentsInfomationListByDate(String startDate,String endDate)
{
public List<EhmsEamEquipmentsInfomation> selectEhmsEamEquipmentsInfomationListByDate(String startDate, String endDate) {
//TODO 对查询出来的设备组织id查询器组织名再赋值
List<EhmsEamEquipmentsInfomation> resultList = ehmsEamEquipmentsInfomationMapper.selectEhmsEamEquipmentsInfomationListByDate(startDate,endDate);
if(resultList.size() != 0){
List<EhmsEamEquipmentsInfomation> resultList = ehmsEamEquipmentsInfomationMapper.selectEhmsEamEquipmentsInfomationListByDate(startDate, endDate);
if (resultList.size() != 0) {
for (EhmsEamEquipmentsInfomation eamEquipmentsInfomation : resultList) {
SysDept dept = sysDeptMapper.selectDeptById(eamEquipmentsInfomation.getEquipLocationId());
eamEquipmentsInfomation.setEquipLocation(dept.getDeptName());
@ -119,12 +118,12 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
/**
* 导入数据
*
* @param facilityList 设备信息
* @param facilityList 设备信息
* @param isUpdateSupport 是否更新支持如果已存在则进行更新数据
* @return 结果
*/
@Override
public String importEamEquipmentsInfomation(List<EhmsEamEquipmentsInfomation> facilityList, Boolean isUpdateSupport){
public String importEamEquipmentsInfomation(List<EhmsEamEquipmentsInfomation> facilityList, Boolean isUpdateSupport) {
if (StringUtils.isNull(facilityList) || facilityList.size() == 0) {
throw new ServiceException("导入数据不能为空!");
}
@ -144,7 +143,7 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
deptSelect.setDeptName(ehmsEamEquipmentsInfomation.getEquipLocation());
System.err.println(deptSelect);
List<SysDept> deptList = sysDeptMapper.selectDeptList(deptSelect);
if(deptList.size() > 1 || deptList.size() == 0){
if (deptList.size() > 1 || deptList.size() == 0) {
throw new Exception("组织不存在请重新填写");
}
ehmsEamEquipmentsInfomation.setEquipLocationId(deptList.get(0).getDeptId());
@ -183,24 +182,23 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
*/
@Override
@Transient
public int insertEhmsEamEquipmentsInfomation(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation)
{
public int insertEhmsEamEquipmentsInfomation(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation) {
ehmsEamEquipmentsInfomation.setId(GetUUID.getUUID());
ehmsEamEquipmentsInfomation.setParentEquipId("0");
EhmsEamEquipmentsClass findClass = new EhmsEamEquipmentsClass();
findClass.setClassName(ehmsEamEquipmentsInfomation.getEquipClass());
List<EhmsEamEquipmentsClass> findClassList = ehmsEamEquipmentsClassMapper.selectEhmsEamEquipmentsClassList(findClass);
if (findClassList.size() == 0){
if (findClassList.size() == 0) {
ehmsEamEquipmentsInfomation.setEquipClassId(null);
}
ehmsEamEquipmentsInfomation.setEquipClassId(findClassList.get(0).getId());
if(ehmsEamEquipmentsInfomation.getEquipStatus() == 1){
if (ehmsEamEquipmentsInfomation.getEquipStatus() == 1) {
ehmsEamEquipmentsInfomation.setIsRunning("1");
}
//如果闲置状态就插入闲置设备表
if(ehmsEamEquipmentsInfomation.getEquipStatus() == 2){
if (ehmsEamEquipmentsInfomation.getEquipStatus() == 2) {
EhmsEamEquipIdleRecord idleRecord = new EhmsEamEquipIdleRecord();
idleRecord.setId(GetUUID.getUUID());
idleRecord.setEquipInfoId(ehmsEamEquipmentsInfomation.getId());
@ -220,10 +218,9 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
*/
@Override
@Transient
public int updateEhmsEamEquipmentsInfomation(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation)
{
System.err.println("是否变化;"+ehmsEamEquipmentsInfomation.getIsChange());
if("".equals(ehmsEamEquipmentsInfomation.getIsChange()) && ehmsEamEquipmentsInfomation.getEquipStatus() == 2){
public int updateEhmsEamEquipmentsInfomation(EhmsEamEquipmentsInfomation ehmsEamEquipmentsInfomation) {
System.err.println("是否变化;" + ehmsEamEquipmentsInfomation.getIsChange());
if ("".equals(ehmsEamEquipmentsInfomation.getIsChange()) && ehmsEamEquipmentsInfomation.getEquipStatus() == 2) {
//插入闲置
EhmsEamEquipIdleRecord idleRecord = new EhmsEamEquipIdleRecord();
idleRecord.setId(GetUUID.getUUID());
@ -233,12 +230,12 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
idleRecord.setIdleStartDate(sdf.format(new Date()));
ehmsEamEquipIdleRecordMapper.insertEhmsEamEquipIdleRecord(idleRecord);
}
if("改变".equals(ehmsEamEquipmentsInfomation.getIsChange())){
if ("改变".equals(ehmsEamEquipmentsInfomation.getIsChange())) {
EhmsEamEquipIdleRecord record = new EhmsEamEquipIdleRecord();
record.setEquipInfoId(ehmsEamEquipmentsInfomation.getId());
//通过设备信息id查询闲置设备id
List<EhmsEamEquipIdleRecord> recordList = ehmsEamEquipIdleRecordMapper.selectEhmsEamEquipIdleRecordList(record);
if(recordList.size() == 0 || recordList.size() >1){
if (recordList.size() == 0 || recordList.size() > 1) {
return 0;
}
EhmsEamEquipIdleRecord idleRecord = recordList.get(0);
@ -250,7 +247,7 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
EhmsEamEquipmentsClass findClass = new EhmsEamEquipmentsClass();
findClass.setClassName(ehmsEamEquipmentsInfomation.getEquipClass());
List<EhmsEamEquipmentsClass> findClassList = ehmsEamEquipmentsClassMapper.selectEhmsEamEquipmentsClassList(findClass);
if (findClassList.size() == 0){
if (findClassList.size() == 0) {
ehmsEamEquipmentsInfomation.setEquipClassId(null);
}
ehmsEamEquipmentsInfomation.setEquipClassId(findClassList.get(0).getId());
@ -264,8 +261,7 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
* @return 结果
*/
@Override
public int deleteEhmsEamEquipmentsInfomationByIds(String[] ids)
{
public int deleteEhmsEamEquipmentsInfomationByIds(String[] ids) {
return ehmsEamEquipmentsInfomationMapper.deleteEhmsEamEquipmentsInfomationByIds(ids);
}
@ -276,74 +272,89 @@ public class EhmsEamEquipmentsInfomationServiceImpl implements IEhmsEamEquipment
* @return 结果
*/
@Override
public int deleteEhmsEamEquipmentsInfomationById(String id)
{
public int deleteEhmsEamEquipmentsInfomationById(String id) {
return ehmsEamEquipmentsInfomationMapper.deleteEhmsEamEquipmentsInfomationById(id);
}
/**
* 获取首页设备统计数据
*
* @return
*/
@Override
public Map<String,String> getEqNum() {
Map<String,String> rs = new HashMap<>();
List<Map<String,Object>> l = ehmsEamEquipmentsInfomationMapper.getEqNum();
public Map<String, String> getEqNum() {
Map<String, String> rs = new HashMap<>();
List<Map<String, Object>> l = ehmsEamEquipmentsInfomationMapper.getEqNum();
int total = 0;
int run = 0;
int notRun = 0;
if(null != l && l.size()>0){
for(Map<String,Object> i : l){
if(i.get("isRunning").equals("1")){
if (null != l && l.size() > 0) {
for (Map<String, Object> i : l) {
if (i.get("isRunning").equals("1")) {
run += Integer.parseInt(i.get("num").toString());
}else if(i.get("isRunning").equals("0")){
} else if (i.get("isRunning").equals("0")) {
notRun += Integer.parseInt(i.get("num").toString());
}
total += Integer.parseInt(i.get("num").toString());
}
}
rs.put("total",String.valueOf(total));
rs.put("run",String.valueOf(run));
rs.put("notRun",String.valueOf(notRun));
rs.put("total", String.valueOf(total));
rs.put("run", String.valueOf(run));
rs.put("notRun", String.valueOf(notRun));
return rs;
}
/**
* 获取首页charts统计数据
*
* @return
*/
@Override
public Map<String, List<String>> loadChartsData() {
Map<String, List<String>> rs = new HashMap<>();
List dateList = new ArrayList();
List runTimeList = new ArrayList();
List shutdownRateList = new ArrayList();
List<Map<String,Object>> l = ehmsEamEquipmentsInfomationMapper.getEqNum();
int num = 0;
for(int i=0; i<l.size(); i++){
num += Integer.parseInt(l.get(i).get("num").toString());
public Map<String, Object> loadChartsData() {
Map<String, Object> rs = new HashMap<>();
// 获取前三个月份
List<Integer> monthList = new ArrayList<>();
List<Integer> dailyList = new ArrayList<>();
List<Integer> meterReadingList = new ArrayList<>();
List<Integer> professionalList = new ArrayList<>();
LocalDate currentDate = LocalDate.now();
for (int i = 0; i < 3; i++) {
monthList.add(Integer.parseInt(currentDate.format(DateTimeFormatter.ofPattern("MM"))));
currentDate = currentDate.minusMonths(1);
dailyList.add(0);
meterReadingList.add(0);
professionalList.add(0);
}
String startDate = DateUtils.parseDateToStr("YYYY-MM-dd",DateUtils.getAfterTime(DateUtils.getNowDate(),-20));
List<Map<String, Object>> runTime = ehmsEamEquipmentsInfomationMapper.getRunTime(startDate);
Map<String, Object> runTimeMap = new HashMap<>();
for(int i=0;i<runTime.size();i++){
runTimeMap.put(runTime.get(i).get("date").toString(),runTime.get(i).get("time"));
}
for(int i=-20 ;i<0 ;i++){
Date d = DateUtils.getAfterTime(DateUtils.getNowDate(),i);
dateList.add(DateUtils.parseDateToStr("MM-dd",d));
String key = DateUtils.parseDateToStr("YYYY-MM-dd",d);
if(runTimeMap.containsKey(key)){
runTimeList.add(Long.parseLong(runTimeMap.get(key).toString())/60);
shutdownRateList.add(100-(Long.parseLong(runTimeMap.get(key).toString())*10000/(24*60*60*num))/100.0);
}else{
runTimeList.add(0);
shutdownRateList.add(100);
Collections.reverse(monthList);
// 巡检柱状图数据
List<Map<String, Object>> patrolList = ehmsEamEquipmentsInfomationMapper.getPatrol();
for(Map<String, Object> pmap : patrolList){
if("日常巡检".equals(pmap.get("name").toString())){
dailyList.set(monthList.indexOf(Integer.parseInt(pmap.get("month").toString())),Integer.parseInt(pmap.get("num").toString()));
}
if("抄表巡检".equals(pmap.get("name").toString())){
meterReadingList.set(monthList.indexOf(Integer.parseInt(pmap.get("month").toString())),Integer.parseInt(pmap.get("num").toString()));
}
if("专业巡检".equals(pmap.get("name").toString())){
professionalList.set(monthList.indexOf(Integer.parseInt(pmap.get("month").toString())),Integer.parseInt(pmap.get("num").toString()));
}
}
rs.put("dateList",dateList);
rs.put("runTimeList",runTimeList);
rs.put("shutdownRateList",shutdownRateList);
rs.put("monthList",monthList);
rs.put("dailyList", dailyList);
rs.put("meterReadingList", meterReadingList);
rs.put("professionalList", professionalList);
// 分类饼图数据
List<Map<String, Object>> classList = ehmsEamEquipmentsInfomationMapper.getClassList();
rs.put("classList", classList);
// 文件饼图数据
List<Map<String, Object>> fileList = ehmsEamEquipmentsInfomationMapper.getFileList();
rs.put("fileList", fileList);
// 设备分布饼图数据
List<Map<String, Object>> locationList = ehmsEamEquipmentsInfomationMapper.getLocationList();
rs.put("locationList", locationList);
return rs;
}
}

View File

@ -0,0 +1,136 @@
package com.inspur.system.domain;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 供应商管理对象 sys_supplier
*
* @author inspur
* @date 2024-06-25
*/
public class SysSupplier extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 供应商编号 */
@Excel(name = "供应商编号")
private String sNum;
/** 供应商名称 */
@Excel(name = "供应商名称")
private String sName;
/** 地址 */
@Excel(name = "地址")
private String sAddress;
/** 联系人 */
@Excel(name = "联系人")
private String sPerson;
/** 联系方式 */
@Excel(name = "联系方式")
private String sPhone;
/** 供应商行业 */
@Excel(name = "供应商行业")
private String sType;
/** 状态 */
@Excel(name = "状态")
private String status;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setsNum(String sNum)
{
this.sNum = sNum;
}
public String getsNum()
{
return sNum;
}
public void setsName(String sName)
{
this.sName = sName;
}
public String getsName()
{
return sName;
}
public void setsAddress(String sAddress)
{
this.sAddress = sAddress;
}
public String getsAddress()
{
return sAddress;
}
public void setsPerson(String sPerson)
{
this.sPerson = sPerson;
}
public String getsPerson()
{
return sPerson;
}
public void setsPhone(String sPhone)
{
this.sPhone = sPhone;
}
public String getsPhone()
{
return sPhone;
}
public void setsType(String sType)
{
this.sType = sType;
}
public String getsType()
{
return sType;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sNum", getsNum())
.append("sName", getsName())
.append("sAddress", getsAddress())
.append("sPerson", getsPerson())
.append("sPhone", getsPhone())
.append("sType", getsType())
.append("remark", getRemark())
.append("status", getStatus())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.inspur.system.mapper;
import java.util.List;
import com.inspur.system.domain.SysSupplier;
/**
* 供应商管理Mapper接口
*
* @author inspur
* @date 2024-06-25
*/
public interface SysSupplierMapper
{
/**
* 查询供应商管理
*
* @param id 供应商管理主键
* @return 供应商管理
*/
public SysSupplier selectSysSupplierById(Long id);
/**
* 查询供应商管理列表
*
* @param sysSupplier 供应商管理
* @return 供应商管理集合
*/
public List<SysSupplier> selectSysSupplierList(SysSupplier sysSupplier);
/**
* 新增供应商管理
*
* @param sysSupplier 供应商管理
* @return 结果
*/
public int insertSysSupplier(SysSupplier sysSupplier);
/**
* 修改供应商管理
*
* @param sysSupplier 供应商管理
* @return 结果
*/
public int updateSysSupplier(SysSupplier sysSupplier);
/**
* 删除供应商管理
*
* @param id 供应商管理主键
* @return 结果
*/
public int deleteSysSupplierById(Long id);
/**
* 批量删除供应商管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSysSupplierByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.inspur.system.service;
import java.util.List;
import com.inspur.system.domain.SysSupplier;
/**
* 供应商管理Service接口
*
* @author inspur
* @date 2024-06-25
*/
public interface ISysSupplierService
{
/**
* 查询供应商管理
*
* @param id 供应商管理主键
* @return 供应商管理
*/
public SysSupplier selectSysSupplierById(Long id);
/**
* 查询供应商管理列表
*
* @param sysSupplier 供应商管理
* @return 供应商管理集合
*/
public List<SysSupplier> selectSysSupplierList(SysSupplier sysSupplier);
/**
* 新增供应商管理
*
* @param sysSupplier 供应商管理
* @return 结果
*/
public int insertSysSupplier(SysSupplier sysSupplier);
/**
* 修改供应商管理
*
* @param sysSupplier 供应商管理
* @return 结果
*/
public int updateSysSupplier(SysSupplier sysSupplier);
/**
* 批量删除供应商管理
*
* @param ids 需要删除的供应商管理主键集合
* @return 结果
*/
public int deleteSysSupplierByIds(Long[] ids);
/**
* 删除供应商管理信息
*
* @param id 供应商管理主键
* @return 结果
*/
public int deleteSysSupplierById(Long id);
}

View File

@ -0,0 +1,93 @@
package com.inspur.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspur.system.mapper.SysSupplierMapper;
import com.inspur.system.domain.SysSupplier;
import com.inspur.system.service.ISysSupplierService;
/**
* 供应商管理Service业务层处理
*
* @author inspur
* @date 2024-06-25
*/
@Service
public class SysSupplierServiceImpl implements ISysSupplierService
{
@Autowired
private SysSupplierMapper sysSupplierMapper;
/**
* 查询供应商管理
*
* @param id 供应商管理主键
* @return 供应商管理
*/
@Override
public SysSupplier selectSysSupplierById(Long id)
{
return sysSupplierMapper.selectSysSupplierById(id);
}
/**
* 查询供应商管理列表
*
* @param sysSupplier 供应商管理
* @return 供应商管理
*/
@Override
public List<SysSupplier> selectSysSupplierList(SysSupplier sysSupplier)
{
return sysSupplierMapper.selectSysSupplierList(sysSupplier);
}
/**
* 新增供应商管理
*
* @param sysSupplier 供应商管理
* @return 结果
*/
@Override
public int insertSysSupplier(SysSupplier sysSupplier)
{
return sysSupplierMapper.insertSysSupplier(sysSupplier);
}
/**
* 修改供应商管理
*
* @param sysSupplier 供应商管理
* @return 结果
*/
@Override
public int updateSysSupplier(SysSupplier sysSupplier)
{
return sysSupplierMapper.updateSysSupplier(sysSupplier);
}
/**
* 批量删除供应商管理
*
* @param ids 需要删除的供应商管理主键
* @return 结果
*/
@Override
public int deleteSysSupplierByIds(Long[] ids)
{
return sysSupplierMapper.deleteSysSupplierByIds(ids);
}
/**
* 删除供应商管理信息
*
* @param id 供应商管理主键
* @return 结果
*/
@Override
public int deleteSysSupplierById(Long id)
{
return sysSupplierMapper.deleteSysSupplierById(id);
}
}

View File

@ -5,21 +5,21 @@
<mapper namespace="com.inspur.eam.mapper.EhmsEamEquipmentsInfomationMapper">
<resultMap type="EhmsEamEquipmentsInfomation" id="EhmsEamEquipmentsInfomationResult">
<result property="id" column="id" />
<result property="equipId" column="equip_id" />
<result property="equipName" column="equip_name" />
<result property="equipSpecifications" column="equip_specifications" />
<result property="equipClass" column="equip_class" />
<result property="equipSerialNum" column="equip_serial_num" />
<result property="equipManufacturer" column="equip_manufacturer" />
<result property="equipProductionDate" column="equip_production_date" />
<result property="equipStatus" column="equip_status" />
<result property="equipLocationId" column="equip_location_id" />
<result property="fixedAssetsNum" column="fixed_assets_num" />
<result property="parentEquipId" column="parent_equip_id"/>
<result property="equipManagerId" column="equip_manager_id"/>
<result property="isRunning" column="is_running"/>
<result property="areaName" column="area_name"/>
<result property="id" column="id"/>
<result property="equipId" column="equip_id"/>
<result property="equipName" column="equip_name"/>
<result property="equipSpecifications" column="equip_specifications"/>
<result property="equipClass" column="equip_class"/>
<result property="equipSerialNum" column="equip_serial_num"/>
<result property="equipManufacturer" column="equip_manufacturer"/>
<result property="equipProductionDate" column="equip_production_date"/>
<result property="equipStatus" column="equip_status"/>
<result property="equipLocationId" column="equip_location_id"/>
<result property="fixedAssetsNum" column="fixed_assets_num"/>
<result property="parentEquipId" column="parent_equip_id"/>
<result property="equipManagerId" column="equip_manager_id"/>
<result property="isRunning" column="is_running"/>
<result property="areaName" column="area_name"/>
<result property="equipClassId" column="equip_class_id`"/>
<result property="theoryLife" column="theory_life"/>
<result property="runTime" column="run_time"/>
@ -28,31 +28,57 @@
</resultMap>
<sql id="selectEhmsEamEquipmentsInfomationVo">
select a.id, equip_id, equip_name, equip_specifications, equip_class, equip_serial_num, equip_manufacturer, equip_production_date, equip_status,area_name, equip_location_id, fixed_assets_num, parent_equip_id,equip_manager_id,u.user_name as equipManager,is_running,equip_class_id from ehms_eam_equipments_infomation a
left join sys_user u on u.user_id = a.equip_manager_id
select a.id,
equip_id,
equip_name,
equip_specifications,
equip_class,
equip_serial_num,
equip_manufacturer,
equip_production_date,
equip_status,
area_name,
equip_location_id,
fixed_assets_num,
parent_equip_id,
equip_manager_id,
u.user_name as equipManager,
is_running,
equip_class_id
from ehms_eam_equipments_infomation a
left join sys_user u on u.user_id = a.equip_manager_id
</sql>
<select id="selectEhmsEamEquipmentsInfomationList" parameterType="EhmsEamEquipmentsInfomation" resultMap="EhmsEamEquipmentsInfomationResult">
<select id="selectEhmsEamEquipmentsInfomationList" parameterType="EhmsEamEquipmentsInfomation"
resultMap="EhmsEamEquipmentsInfomationResult">
<include refid="selectEhmsEamEquipmentsInfomationVo"/>
<where>
<if test="id != null and equipId != ''"> and id = #{id}</if>
<if test="equipId != null and equipId != ''"> and equip_id = #{equipId}</if>
<if test="equipName != null and equipName != ''"> and equip_name like concat('%', #{equipName}, '%')</if>
<if test="equipSpecifications != null and equipSpecifications != ''"> and equip_specifications = #{equipSpecifications}</if>
<if test="equipClass != null and equipClass != ''"> and equip_class = #{equipClass}</if>
<if test="equipSerialNum != null and equipSerialNum != ''"> and equip_serial_num = #{equipSerialNum}</if>
<if test="equipManufacturer != null and equipManufacturer != ''"> and equip_manufacturer = #{equipManufacturer}</if>
<if test="equipProductionDate != null and equipProductionDate != ''"> and equip_production_date = #{equipProductionDate}</if>
<if test="equipStatus != null "> and equip_status = #{equipStatus}</if>
<if test="equipLocationId != null and equipLocationId != ''"> and equip_location_id = #{equipLocationId}</if>
<if test="fixedAssetsNum != null and fixedAssetsNum != ''"> and fixed_assets_num = #{fixedAssetsNum}</if>
<if test="parentEquipId != null and parentEquipId != ''"> and parent_equip_id = #{parentEquipId}</if>
<if test="equipManagerId != null and equipManagerId != ''"> and equip_manager_id = #{equipManagerId}</if>
<if test="areaName != null and areaName != ''"> and area_name = #{areaName}</if>
<if test="equipClassId != null and equipClassId != ''"> and equip_class_id = #{equipClassId}</if>
<if test="id != null and equipId != ''">and id = #{id}</if>
<if test="equipId != null and equipId != ''">and equip_id = #{equipId}</if>
<if test="equipName != null and equipName != ''">and equip_name like concat('%', #{equipName}, '%')</if>
<if test="equipSpecifications != null and equipSpecifications != ''">and equip_specifications =
#{equipSpecifications}
</if>
<if test="equipClass != null and equipClass != ''">and equip_class = #{equipClass}</if>
<if test="equipSerialNum != null and equipSerialNum != ''">and equip_serial_num = #{equipSerialNum}</if>
<if test="equipManufacturer != null and equipManufacturer != ''">and equip_manufacturer =
#{equipManufacturer}
</if>
<if test="equipProductionDate != null and equipProductionDate != ''">and equip_production_date =
#{equipProductionDate}
</if>
<if test="equipStatus != null ">and equip_status = #{equipStatus}</if>
<if test="equipLocationId != null and equipLocationId != ''">and equip_location_id = #{equipLocationId}
</if>
<if test="fixedAssetsNum != null and fixedAssetsNum != ''">and fixed_assets_num = #{fixedAssetsNum}</if>
<if test="parentEquipId != null and parentEquipId != ''">and parent_equip_id = #{parentEquipId}</if>
<if test="equipManagerId != null and equipManagerId != ''">and equip_manager_id = #{equipManagerId}</if>
<if test="areaName != null and areaName != ''">and area_name = #{areaName}</if>
<if test="equipClassId != null and equipClassId != ''">and equip_class_id = #{equipClassId}</if>
</where>
</select>
<select id="selectLifeList" parameterType="EhmsEamEquipmentsInfomation" resultMap="EhmsEamEquipmentsInfomationResult">
<select id="selectLifeList" parameterType="EhmsEamEquipmentsInfomation"
resultMap="EhmsEamEquipmentsInfomationResult">
select temp.*,(temp.theory_life - temp.run_time - temp.consume_time) left_time from(
SELECT
a.id,
@ -73,37 +99,47 @@
a.equip_class_id,
a.theory_life,
ROUND( TIMESTAMPDIFF( HOUR, a.equip_production_date, now())* 0.7 ) run_time,
( SELECT count( 1 )* 180 FROM ehms_maintenance_work_order t WHERE t.equ_number = a.equip_id )+a.time consume_time
( SELECT count( 1 )* 180 FROM ehms_maintenance_work_order t WHERE t.equ_number = a.equip_id )+a.time
consume_time
FROM
ehms_eam_equipments_infomation a ) as temp
<where>
<if test="id != null and equipId != ''"> and id = #{id}</if>
<if test="equipId != null and equipId != ''"> and equip_id = #{equipId}</if>
<if test="equipName != null and equipName != ''"> and equip_name like concat('%', #{equipName}, '%')</if>
<if test="equipSpecifications != null and equipSpecifications != ''"> and equip_specifications = #{equipSpecifications}</if>
<if test="equipClass != null and equipClass != ''"> and equip_class = #{equipClass}</if>
<if test="equipSerialNum != null and equipSerialNum != ''"> and equip_serial_num = #{equipSerialNum}</if>
<if test="equipManufacturer != null and equipManufacturer != ''"> and equip_manufacturer = #{equipManufacturer}</if>
<if test="equipProductionDate != null and equipProductionDate != ''"> and equip_production_date = #{equipProductionDate}</if>
<if test="equipStatus != null "> and equip_status = #{equipStatus}</if>
<if test="equipLocationId != null and equipLocationId != ''"> and equip_location_id = #{equipLocationId}</if>
<if test="fixedAssetsNum != null and fixedAssetsNum != ''"> and fixed_assets_num = #{fixedAssetsNum}</if>
<if test="parentEquipId != null and parentEquipId != ''"> and parent_equip_id = #{parentEquipId}</if>
<if test="equipManagerId != null and equipManagerId != ''"> and equip_manager_id = #{equipManagerId}</if>
<if test="areaName != null and areaName != ''"> and area_name = #{areaName}</if>
<if test="equipClassId != null and equipClassId != ''"> and equip_class_id = #{equipClassId}</if>
<if test="id != null and equipId != ''">and id = #{id}</if>
<if test="equipId != null and equipId != ''">and equip_id = #{equipId}</if>
<if test="equipName != null and equipName != ''">and equip_name like concat('%', #{equipName}, '%')</if>
<if test="equipSpecifications != null and equipSpecifications != ''">and equip_specifications =
#{equipSpecifications}
</if>
<if test="equipClass != null and equipClass != ''">and equip_class = #{equipClass}</if>
<if test="equipSerialNum != null and equipSerialNum != ''">and equip_serial_num = #{equipSerialNum}</if>
<if test="equipManufacturer != null and equipManufacturer != ''">and equip_manufacturer =
#{equipManufacturer}
</if>
<if test="equipProductionDate != null and equipProductionDate != ''">and equip_production_date =
#{equipProductionDate}
</if>
<if test="equipStatus != null ">and equip_status = #{equipStatus}</if>
<if test="equipLocationId != null and equipLocationId != ''">and equip_location_id = #{equipLocationId}
</if>
<if test="fixedAssetsNum != null and fixedAssetsNum != ''">and fixed_assets_num = #{fixedAssetsNum}</if>
<if test="parentEquipId != null and parentEquipId != ''">and parent_equip_id = #{parentEquipId}</if>
<if test="equipManagerId != null and equipManagerId != ''">and equip_manager_id = #{equipManagerId}</if>
<if test="areaName != null and areaName != ''">and area_name = #{areaName}</if>
<if test="equipClassId != null and equipClassId != ''">and equip_class_id = #{equipClassId}</if>
</where>
order by equip_class
</select>
<select id="selectEhmsEamEquipmentsInfomationById" parameterType="String" resultMap="EhmsEamEquipmentsInfomationResult">
<select id="selectEhmsEamEquipmentsInfomationById" parameterType="String"
resultMap="EhmsEamEquipmentsInfomationResult">
<include refid="selectEhmsEamEquipmentsInfomationVo"/>
where a.id = #{id}
</select>
<!-- public List<EhmsEamEquipmentsInfomation> selectEhmsEamEquipmentsInfomationListByDate(@Param("startDate")String startDate,-->
<!-- 通过时间查询设备信息-->
<select id="selectEhmsEamEquipmentsInfomationListByDate" parameterType="String" resultMap="EhmsEamEquipmentsInfomationResult">
<!-- public List<EhmsEamEquipmentsInfomation> selectEhmsEamEquipmentsInfomationListByDate(@Param("startDate")String startDate,-->
<!-- 通过时间查询设备信息-->
<select id="selectEhmsEamEquipmentsInfomationListByDate" parameterType="String"
resultMap="EhmsEamEquipmentsInfomationResult">
<include refid="selectEhmsEamEquipmentsInfomationVo"/>
where equip_production_date &gt;= #{startDate}
AND equip_production_date &lt;= #{endDate}
@ -172,7 +208,9 @@
</update>
<delete id="deleteEhmsEamEquipmentsInfomationById" parameterType="String">
delete from ehms_eam_equipments_infomation where id = #{id}
delete
from ehms_eam_equipments_infomation
where id = #{id}
</delete>
<delete id="deleteEhmsEamEquipmentsInfomationByIds" parameterType="String">
@ -183,18 +221,87 @@
</delete>
<select id="getEqNum" resultType="map">
select is_running isRunning,count(1) num from ehms_eam_equipments_infomation where equip_status ='1' group by is_running
select is_running isRunning, count(1) num
from ehms_eam_equipments_infomation
where equip_status = '1'
group by is_running
</select>
<select id="getRunTime" resultType="map">
select sum(run_time) time,create_date date from ehms_equ_run_hour where create_date >= #{startDate} GROUP BY create_date
select sum(run_time) time,create_date date
from ehms_equ_run_hour
where create_date >= #{startDate}
GROUP BY create_date
</select>
<!--List<EhmsEamEquipmentsInfomation> getNoDataTermInfo() 获取无终端的设备-->
<select id="getNoDataTermInfo" resultMap="EhmsEamEquipmentsInfomationResult">
select a.id from ehms_eam_equipments_infomation a
LEFT JOIN ehms_eam_data_terminal b
ON b.data_term_belong_equip_id = a.id
select a.id
from ehms_eam_equipments_infomation a
LEFT JOIN ehms_eam_data_terminal b
ON b.data_term_belong_equip_id = a.id
WHERE b.data_term_belong_equip_id IS null;
</select>
</mapper>
<select id="getPatrol" resultType="map">
SELECT MONTH (patrol_time) "month",
CASE record_type
WHEN 'daily' THEN
'日常巡检'
WHEN 'meter_reading' THEN
'抄表巡检'
WHEN 'professional' THEN
'专业巡检'
ELSE
''
END
"name"
, IFNULL(COUNT(*),0) num
FROM patrol_record
WHERE
EXTRACT(YEAR_MONTH FROM patrol_time) BETWEEN
EXTRACT(YEAR_MONTH FROM DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH)) AND
EXTRACT(YEAR_MONTH FROM CURRENT_DATE)
GROUP BY EXTRACT(YEAR_MONTH FROM patrol_time),record_type
ORDER BY EXTRACT(YEAR_MONTH FROM patrol_time)
</select>
<select id="getClassList" resultType="map">
SELECT a.class_name "name",
IFNULL(b.num, 0) "value"
FROM `ehms_eam_equipments_class` a
LEFT JOIN (SELECT equip_class_id, count(0) num
FROM `ehms_eam_equipments_infomation`
GROUP BY equip_class_id) b ON a.id = b.equip_class_id
</select>
<select id="getFileList" resultType="map">
SELECT CASE
upload_type
WHEN 'huiyi' THEN
'会议纪要'
WHEN 'jishu' THEN
'技术协议'
WHEN 'peixun' THEN
'培训资料'
ELSE ''
END "name",
count(0)
"value"
FROM `ehms_upload_file`
GROUP BY upload_type
</select>
<select id="getLocationList" resultType="map">
SELECT a.dept_name "name",
IFNULL(b.num, 0) "value"
FROM (
SELECT dept_id,
dept_name
FROM `sys_dept` d
WHERE del_flag = '0'
AND (SELECT count(0) FROM sys_dept WHERE parent_id = d.dept_id) = 0
) a
LEFT JOIN (SELECT equip_location_id, count(0) num
FROM `ehms_eam_equipments_infomation`
GROUP BY equip_location_id) b ON a.dept_id = b.equip_location_id
</select>
</mapper>

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.system.mapper.SysSupplierMapper">
<resultMap type="SysSupplier" id="SysSupplierResult">
<result property="id" column="id" />
<result property="sNum" column="s_num" />
<result property="sName" column="s_name" />
<result property="sAddress" column="s_address" />
<result property="sPerson" column="s_person" />
<result property="sPhone" column="s_phone" />
<result property="sType" column="s_type" />
<result property="remark" column="remark" />
<result property="status" column="status" />
</resultMap>
<sql id="selectSysSupplierVo">
select id, s_num, s_name, s_address, s_person, s_phone, s_type, remark, status from sys_supplier
</sql>
<select id="selectSysSupplierList" parameterType="SysSupplier" resultMap="SysSupplierResult">
<include refid="selectSysSupplierVo"/>
<where>
<if test="sNum != null and sNum != ''"> and s_num like concat('%', #{sNum}, '%')</if>
<if test="sName != null and sName != ''"> and s_name like concat('%', #{sName}, '%')</if>
<if test="sType != null and sType != ''"> and s_type like concat('%', #{sType}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectSysSupplierById" parameterType="Long" resultMap="SysSupplierResult">
<include refid="selectSysSupplierVo"/>
where id = #{id}
</select>
<insert id="insertSysSupplier" parameterType="SysSupplier">
insert into sys_supplier
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="sNum != null">s_num,</if>
<if test="sName != null">s_name,</if>
<if test="sAddress != null">s_address,</if>
<if test="sPerson != null">s_person,</if>
<if test="sPhone != null">s_phone,</if>
<if test="sType != null">s_type,</if>
<if test="remark != null">remark,</if>
<if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="sNum != null">#{sNum},</if>
<if test="sName != null">#{sName},</if>
<if test="sAddress != null">#{sAddress},</if>
<if test="sPerson != null">#{sPerson},</if>
<if test="sPhone != null">#{sPhone},</if>
<if test="sType != null">#{sType},</if>
<if test="remark != null">#{remark},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="updateSysSupplier" parameterType="SysSupplier">
update sys_supplier
<trim prefix="SET" suffixOverrides=",">
<if test="sNum != null">s_num = #{sNum},</if>
<if test="sName != null">s_name = #{sName},</if>
<if test="sAddress != null">s_address = #{sAddress},</if>
<if test="sPerson != null">s_person = #{sPerson},</if>
<if test="sPhone != null">s_phone = #{sPhone},</if>
<if test="sType != null">s_type = #{sType},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="status != null">status = #{status},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysSupplierById" parameterType="Long">
delete from sys_supplier where id = #{id}
</delete>
<delete id="deleteSysSupplierByIds" parameterType="String">
delete from sys_supplier where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -1,10 +1,10 @@
# 页面标题
VUE_APP_TITLE = 设备健康管理系统
VUE_APP_TITLE = 设备预测性维护系统
# 开发环境配置
ENV = 'development'
# 设备健康管理系统/开发环境
# 设备预测性维护系统/开发环境
VUE_APP_BASE_API = '/dev-api'
# 路由懒加载

View File

@ -1,8 +1,8 @@
# 页面标题
VUE_APP_TITLE = 设备健康管理系统
VUE_APP_TITLE = 设备预测性维护系统
# 生产环境配置
ENV = 'production'
# 设备健康管理系统/生产环境
# 设备预测性维护系统/生产环境
VUE_APP_BASE_API = '/ehms-api'

View File

@ -1,10 +1,10 @@
# 页面标题
VUE_APP_TITLE = 设备健康管理系统
VUE_APP_TITLE = 设备预测性维护系统
NODE_ENV = production
# 测试环境配置
ENV = 'staging'
# 设备健康管理系统/测试环境
# 设备预测性维护系统/测试环境
VUE_APP_BASE_API = '/stage-api'

View File

@ -1,7 +1,7 @@
{
"name": "ehms",
"version": "3.8.4",
"description": "设备健康管理系统",
"description": "设备预测性维护系统",
"author": "",
"license": "MIT",
"scripts": {

View File

@ -11,12 +11,12 @@ export function listInfomation(query) {
// 查询资产管理系统设备信息所有数据
export function listAllInfomation(query) {
// return request({
// url: "/eam/infomation/listAll",
// method: "get",
// params: query,
// });
return [];
return request({
url: "/eam/infomation/listAll",
method: "get",
params: query,
});
// return [];
}
// 查询资产管理系统设备信息详细

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 KiB

After

Width:  |  Height:  |  Size: 563 KiB

View File

@ -1,36 +1,70 @@
<template>
<div class="navbar">
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
<hamburger
id="hamburger-container"
:is-active="sidebar.opened"
class="hamburger-container"
@toggleClick="toggleSideBar"
/>
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/>
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/>
<breadcrumb
id="breadcrumb-container"
class="breadcrumb-container"
v-if="!topNav"
/>
<top-nav
id="topmenu-container"
class="topmenu-container"
v-if="topNav"
/>
<div class="right-menu">
<template v-if="device!=='mobile'">
<search id="header-search" class="right-menu-item" />
<search
id="header-search"
class="right-menu-item"
/>
<screenfull
id="screenfull"
class="right-menu-item hover-effect"
/>
<screenfull id="screenfull" class="right-menu-item hover-effect" />
<el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
<el-tooltip
content="布局大小"
effect="dark"
placement="bottom"
>
<size-select
id="size-select"
class="right-menu-item hover-effect"
/>
</el-tooltip>
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<el-dropdown
class="avatar-container right-menu-item hover-effect"
trigger="click"
>
<div class="avatar-wrapper">
<img :src="avatar" class="user-avatar">
<img
:src="avatar"
class="user-avatar"
>
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
<router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item>
</router-link>
<el-dropdown-item @click.native="setting = true">
<!-- <el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout">
</el-dropdown-item> -->
<el-dropdown-item
divided
@click.native="logout"
>
<span>退出登录</span>
</el-dropdown-item>
</el-dropdown-menu>
@ -40,15 +74,15 @@
</template>
<script>
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import TopNav from '@/components/TopNav'
import Hamburger from '@/components/Hamburger'
import Screenfull from '@/components/Screenfull'
import SizeSelect from '@/components/SizeSelect'
import Search from '@/components/HeaderSearch'
import EhmsGit from '@/components/Ehms/Git'
import EhmsDoc from '@/components/Ehms/Doc'
import { mapGetters } from "vuex";
import Breadcrumb from "@/components/Breadcrumb";
import TopNav from "@/components/TopNav";
import Hamburger from "@/components/Hamburger";
import Screenfull from "@/components/Screenfull";
import SizeSelect from "@/components/SizeSelect";
import Search from "@/components/HeaderSearch";
import EhmsGit from "@/components/Ehms/Git";
import EhmsDoc from "@/components/Ehms/Doc";
export default {
components: {
@ -59,48 +93,46 @@ export default {
SizeSelect,
Search,
EhmsGit,
EhmsDoc
EhmsDoc,
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'device'
]),
...mapGetters(["sidebar", "avatar", "device"]),
setting: {
get() {
return this.$store.state.settings.showSettings
return this.$store.state.settings.showSettings;
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val
})
}
this.$store.dispatch("settings/changeSetting", {
key: "showSettings",
value: val,
});
},
},
topNav: {
get() {
return this.$store.state.settings.topNav
}
}
return this.$store.state.settings.topNav;
},
},
},
methods: {
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
this.$store.dispatch("app/toggleSideBar");
},
async logout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/ehms/index';
this.$confirm("确定注销并退出系统吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.$store.dispatch("LogOut").then(() => {
location.href = "/ehms/index";
});
})
}).catch(() => {});
}
}
}
.catch(() => {});
},
},
};
</script>
<style lang="scss" scoped>
@ -109,18 +141,18 @@ export default {
overflow: hidden;
position: relative;
background: #fff;
box-shadow: 0 1px 4px rgba(0,21,41,.08);
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.hamburger-container {
line-height: 46px;
height: 100%;
float: left;
cursor: pointer;
transition: background .3s;
-webkit-tap-highlight-color:transparent;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover {
background: rgba(0, 0, 0, .025)
background: rgba(0, 0, 0, 0.025);
}
}
@ -157,10 +189,10 @@ export default {
&.hover-effect {
cursor: pointer;
transition: background .3s;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, .025)
background: rgba(0, 0, 0, 0.025);
}
}
}

View File

@ -1,45 +1,74 @@
<template>
<div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
<div
class="sidebar-logo-container"
:class="{'collapse':collapse}"
:style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }"
>
<transition name="sidebarLogoFade">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
<h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
<router-link
v-if="collapse"
key="collapse"
class="sidebar-logo-link"
to="/"
>
<img
v-if="logo"
:src="logo"
class="sidebar-logo"
/>
<h1
v-else
class="sidebar-title"
:style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }"
>{{ title }} </h1>
</router-link>
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
<router-link
v-else
key="expand"
class="sidebar-logo-link"
to="/"
>
<img
v-if="logo"
:src="logo"
class="sidebar-logo"
/>
<h1
class="sidebar-title"
:style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }"
>{{ title }} </h1>
</router-link>
</transition>
</div>
</template>
<script>
import logoImg from '@/assets/logo/inspur.png'
import variables from '@/assets/styles/variables.scss'
import logoImg from "@/assets/logo/inspur.png";
import variables from "@/assets/styles/variables.scss";
export default {
name: 'SidebarLogo',
name: "SidebarLogo",
props: {
collapse: {
type: Boolean,
required: true
}
required: true,
},
},
computed: {
variables() {
return variables;
},
sideTheme() {
return this.$store.state.settings.sideTheme
}
return this.$store.state.settings.sideTheme;
},
},
data() {
return {
title: '设备健康管理系统',
logo: logoImg
}
}
}
title: "设备预测性维护系统",
logo: logoImg,
};
},
};
</script>
<style lang="scss" scoped>

View File

@ -2,7 +2,7 @@ module.exports = {
/**
* 侧边栏主题 深色主题theme-dark浅色主题theme-light
*/
sideTheme: 'theme-dark',
sideTheme: "theme-light",
/**
* 是否系统布局配置
@ -12,7 +12,7 @@ module.exports = {
/**
* 是否显示顶部导航
*/
topNav: false,
topNav: true,
/**
* 是否显示 tagsView
@ -22,12 +22,12 @@ module.exports = {
/**
* 是否固定头部
*/
fixedHeader: false,
fixedHeader: true,
/**
* 是否显示logo
*/
sidebarLogo: true,
sidebarLogo: false,
/**
* 是否显示动态标题
@ -40,5 +40,5 @@ module.exports = {
* The default is only used in the production env
* If you want to also use it in dev, you can pass ['production', 'development']
*/
errorLog: 'production'
}
errorLog: "production",
};

View File

@ -1,42 +1,59 @@
import defaultSettings from '@/settings'
import defaultSettings from "@/settings";
const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings
const {
sideTheme,
showSettings,
topNav,
tagsView,
fixedHeader,
sidebarLogo,
dynamicTitle,
} = defaultSettings;
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
const storageSetting = JSON.parse(localStorage.getItem("layout-setting")) || "";
const state = {
title: '',
theme: storageSetting.theme || '#409EFF',
title: "",
theme: storageSetting.theme || "#13C2C2",
sideTheme: storageSetting.sideTheme || sideTheme,
showSettings: showSettings,
topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,
tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView,
fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo,
dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle
}
tagsView:
storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView,
fixedHeader:
storageSetting.fixedHeader === undefined
? fixedHeader
: storageSetting.fixedHeader,
sidebarLogo:
storageSetting.sidebarLogo === undefined
? sidebarLogo
: storageSetting.sidebarLogo,
dynamicTitle:
storageSetting.dynamicTitle === undefined
? dynamicTitle
: storageSetting.dynamicTitle,
};
const mutations = {
CHANGE_SETTING: (state, { key, value }) => {
if (state.hasOwnProperty(key)) {
state[key] = value
state[key] = value;
}
}
}
},
};
const actions = {
// 修改布局设置
changeSetting({ commit }, data) {
commit('CHANGE_SETTING', data)
commit("CHANGE_SETTING", data);
},
// 设置网页标题
setTitle({ commit }, title) {
state.title = title
}
}
state.title = title;
},
};
export default {
namespaced: true,
state,
mutations,
actions
}
actions,
};

View File

@ -1,7 +1,12 @@
<template>
<div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">设备健康管理系统</h3>
<el-form
ref="loginForm"
:model="loginForm"
:rules="loginRules"
class="login-form"
>
<h3 class="title">设备预测性维护系统</h3>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
@ -9,7 +14,11 @@
auto-complete="off"
placeholder="账号"
>
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
<svg-icon
slot="prefix"
icon-class="user"
class="el-input__icon input-icon"
/>
</el-input>
</el-form-item>
<el-form-item prop="password">
@ -20,10 +29,17 @@
placeholder="密码"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
<svg-icon
slot="prefix"
icon-class="password"
class="el-input__icon input-icon"
/>
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnabled">
<el-form-item
prop="code"
v-if="captchaEnabled"
>
<el-input
v-model="loginForm.code"
auto-complete="off"
@ -31,13 +47,24 @@
style="width: 63%"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
<svg-icon
slot="prefix"
icon-class="validCode"
class="el-input__icon input-icon"
/>
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
<img
:src="codeUrl"
@click="getCode"
class="login-code-img"
/>
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
<el-checkbox
v-model="loginForm.rememberMe"
style="margin:0px 0px 25px 0px;"
>记住密码</el-checkbox>
<el-form-item style="width:100%;">
<el-button
:loading="loading"
@ -49,8 +76,14 @@
<span v-if="!loading"> </span>
<span v-else> 中...</span>
</el-button>
<div style="float: right;" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
<div
style="float: right;"
v-if="register"
>
<router-link
class="link-type"
:to="'/register'"
>立即注册</router-link>
</div>
</el-form-item>
</el-form>
@ -64,7 +97,7 @@
<script>
import { getCodeImg } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
import { encrypt, decrypt } from "@/utils/jsencrypt";
export default {
name: "Login",
@ -76,32 +109,32 @@ export default {
password: "",
rememberMe: false,
code: "",
uuid: ""
uuid: "",
},
loginRules: {
username: [
{ required: true, trigger: "blur", message: "请输入您的账号" }
{ required: true, trigger: "blur", message: "请输入您的账号" },
],
password: [
{ required: true, trigger: "blur", message: "请输入您的密码" }
{ required: true, trigger: "blur", message: "请输入您的密码" },
],
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
code: [{ required: true, trigger: "change", message: "请输入验证码" }],
},
loading: false,
//
captchaEnabled: true,
//
register: false,
redirect: undefined
redirect: undefined,
};
},
watch: {
$route: {
handler: function(route) {
handler: function (route) {
this.redirect = route.query && route.query.redirect;
},
immediate: true
}
immediate: true,
},
},
created() {
this.getCode();
@ -109,8 +142,9 @@ export default {
},
methods: {
getCode() {
getCodeImg().then(res => {
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
getCodeImg().then((res) => {
this.captchaEnabled =
res.captchaEnabled === undefined ? true : res.captchaEnabled;
if (this.captchaEnabled) {
this.codeUrl = "data:image/gif;base64," + res.img;
this.loginForm.uuid = res.uuid;
@ -120,38 +154,46 @@ export default {
getCookie() {
const username = Cookies.get("username");
const password = Cookies.get("password");
const rememberMe = Cookies.get('rememberMe')
const rememberMe = Cookies.get("rememberMe");
this.loginForm = {
username: username === undefined ? this.loginForm.username : username,
password: password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
password:
password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
};
},
handleLogin() {
this.$refs.loginForm.validate(valid => {
this.$refs.loginForm.validate((valid) => {
if (valid) {
this.loading = true;
if (this.loginForm.rememberMe) {
Cookies.set("username", this.loginForm.username, { expires: 30 });
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
Cookies.set("password", encrypt(this.loginForm.password), {
expires: 30,
});
Cookies.set("rememberMe", this.loginForm.rememberMe, {
expires: 30,
});
} else {
Cookies.remove("username");
Cookies.remove("password");
Cookies.remove('rememberMe');
Cookies.remove("rememberMe");
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}).catch(() => {
this.loading = false;
if (this.captchaEnabled) {
this.getCode();
}
});
this.$store
.dispatch("Login", this.loginForm)
.then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(() => {});
})
.catch(() => {
this.loading = false;
if (this.captchaEnabled) {
this.getCode();
}
});
}
});
}
}
},
},
};
</script>

View File

@ -1,10 +1,24 @@
<template>
<div class="register">
<el-form ref="registerForm" :model="registerForm" :rules="registerRules" class="register-form">
<h3 class="title">设备健康管理系统</h3>
<el-form
ref="registerForm"
:model="registerForm"
:rules="registerRules"
class="register-form"
>
<h3 class="title">设备预测性维护系统</h3>
<el-form-item prop="username">
<el-input v-model="registerForm.username" type="text" auto-complete="off" placeholder="账号">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
<el-input
v-model="registerForm.username"
type="text"
auto-complete="off"
placeholder="账号"
>
<svg-icon
slot="prefix"
icon-class="user"
class="el-input__icon input-icon"
/>
</el-input>
</el-form-item>
<el-form-item prop="password">
@ -15,7 +29,11 @@
placeholder="密码"
@keyup.enter.native="handleRegister"
>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
<svg-icon
slot="prefix"
icon-class="password"
class="el-input__icon input-icon"
/>
</el-input>
</el-form-item>
<el-form-item prop="confirmPassword">
@ -26,10 +44,17 @@
placeholder="确认密码"
@keyup.enter.native="handleRegister"
>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
<svg-icon
slot="prefix"
icon-class="password"
class="el-input__icon input-icon"
/>
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnabled">
<el-form-item
prop="code"
v-if="captchaEnabled"
>
<el-input
v-model="registerForm.code"
auto-complete="off"
@ -37,10 +62,18 @@
style="width: 63%"
@keyup.enter.native="handleRegister"
>
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
<svg-icon
slot="prefix"
icon-class="validCode"
class="el-input__icon input-icon"
/>
</el-input>
<div class="register-code">
<img :src="codeUrl" @click="getCode" class="register-code-img"/>
<img
:src="codeUrl"
@click="getCode"
class="register-code-img"
/>
</div>
</el-form-item>
<el-form-item style="width:100%;">
@ -55,7 +88,10 @@
<span v-else> 中...</span>
</el-button>
<div style="float: right;">
<router-link class="link-type" :to="'/login'">使用已有账户登录</router-link>
<router-link
class="link-type"
:to="'/login'"
>使用已有账户登录</router-link>
</div>
</el-form-item>
</el-form>
@ -85,25 +121,35 @@ export default {
password: "",
confirmPassword: "",
code: "",
uuid: ""
uuid: "",
},
registerRules: {
username: [
{ required: true, trigger: "blur", message: "请输入您的账号" },
{ min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' }
{
min: 2,
max: 20,
message: "用户账号长度必须介于 2 和 20 之间",
trigger: "blur",
},
],
password: [
{ required: true, trigger: "blur", message: "请输入您的密码" },
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
{
min: 5,
max: 20,
message: "用户密码长度必须介于 5 和 20 之间",
trigger: "blur",
},
],
confirmPassword: [
{ required: true, trigger: "blur", message: "请再次输入您的密码" },
{ required: true, validator: equalToPassword, trigger: "blur" }
{ required: true, validator: equalToPassword, trigger: "blur" },
],
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
code: [{ required: true, trigger: "change", message: "请输入验证码" }],
},
loading: false,
captchaEnabled: true
captchaEnabled: true,
};
},
created() {
@ -111,8 +157,9 @@ export default {
},
methods: {
getCode() {
getCodeImg().then(res => {
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
getCodeImg().then((res) => {
this.captchaEnabled =
res.captchaEnabled === undefined ? true : res.captchaEnabled;
if (this.captchaEnabled) {
this.codeUrl = "data:image/gif;base64," + res.img;
this.registerForm.uuid = res.uuid;
@ -120,27 +167,37 @@ export default {
});
},
handleRegister() {
this.$refs.registerForm.validate(valid => {
this.$refs.registerForm.validate((valid) => {
if (valid) {
this.loading = true;
register(this.registerForm).then(res => {
const username = this.registerForm.username;
this.$alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", '系统提示', {
dangerouslyUseHTMLString: true,
type: 'success'
}).then(() => {
this.$router.push("/login");
}).catch(() => {});
}).catch(() => {
this.loading = false;
if (this.captchaEnabled) {
this.getCode();
}
})
register(this.registerForm)
.then((res) => {
const username = this.registerForm.username;
this.$alert(
"<font color='red'>恭喜你,您的账号 " +
username +
" 注册成功!</font>",
"系统提示",
{
dangerouslyUseHTMLString: true,
type: "success",
}
)
.then(() => {
this.$router.push("/login");
})
.catch(() => {});
})
.catch(() => {
this.loading = false;
if (this.captchaEnabled) {
this.getCode();
}
});
}
});
}
}
},
},
};
</script>