Compare commits

...

2 Commits

11 changed files with 2199 additions and 0 deletions

View File

@ -0,0 +1,155 @@
package com.god.web.controller.constructionMachinery;
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.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.god.constructionMachinery.domain.GcjxDeviceReport;
import com.god.constructionMachinery.service.IGcjxDeviceReportService;
import com.god.common.utils.poi.ExcelUtil;
import com.god.common.core.page.TableDataInfo;
/**
* 工程机械-报表中心Controller
*
* @author god
* @date 2023-12-04
*/
@RestController
@RequestMapping("/constructionMachinery/devicereport")
public class GcjxDeviceReportController extends BaseController
{
@Autowired
private IGcjxDeviceReportService gcjxDeviceReportService;
/**
* 查询工程机械-报表中心列表
*/
// @PreAuthorize("@ss.hasPermi('constructionMachinery:devicereport:list')")
@GetMapping("/list")
public TableDataInfo list(GcjxDeviceReport gcjxDeviceReport)
{
startPage();
List<GcjxDeviceReport> list = gcjxDeviceReportService.selectGcjxDeviceReportList(gcjxDeviceReport);
return getDataTable(list);
}
@GetMapping("/listWeek")
public TableDataInfo listWeek(GcjxDeviceReport gcjxDeviceReport)
{
startPage();
List<GcjxDeviceReport> list = gcjxDeviceReportService.selectGcjxDeviceReportListByWeek(gcjxDeviceReport);
return getDataTable(list);
}
@GetMapping("/listMonth")
public TableDataInfo listMonth(GcjxDeviceReport gcjxDeviceReport)
{
startPage();
List<GcjxDeviceReport> list = gcjxDeviceReportService.selectGcjxDeviceReportListByMonth(gcjxDeviceReport);
return getDataTable(list);
}
@GetMapping("/listYear")
public TableDataInfo listYear(GcjxDeviceReport gcjxDeviceReport)
{
startPage();
List<GcjxDeviceReport> list = gcjxDeviceReportService.selectGcjxDeviceReportListByYear(gcjxDeviceReport);
return getDataTable(list);
}
/**
* 导出工程机械-报表中心列表
*/
// @PreAuthorize("@ss.hasPermi('constructionMachinery:devicereport:export')")
@Log(title = "工程机械-报表中心", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, GcjxDeviceReport gcjxDeviceReport)
{
List<GcjxDeviceReport> list = gcjxDeviceReportService.selectGcjxDeviceReportList(gcjxDeviceReport);
ExcelUtil<GcjxDeviceReport> util = new ExcelUtil<GcjxDeviceReport>(GcjxDeviceReport.class);
util.exportExcel(response, list, "工程机械-报表中心数据");
}
@Log(title = "工程机械-报表中心", businessType = BusinessType.EXPORT)
@PostMapping("/exportWeek")
public void exportWeek(HttpServletResponse response, GcjxDeviceReport gcjxDeviceReport)
{
List<GcjxDeviceReport> list = gcjxDeviceReportService.selectGcjxDeviceReportListByWeek(gcjxDeviceReport);
ExcelUtil<GcjxDeviceReport> util = new ExcelUtil<GcjxDeviceReport>(GcjxDeviceReport.class);
util.exportExcel(response, list, "工程机械-报表中心数据");
}
@Log(title = "工程机械-报表中心", businessType = BusinessType.EXPORT)
@PostMapping("/exportMonth")
public void exportMonth(HttpServletResponse response, GcjxDeviceReport gcjxDeviceReport)
{
List<GcjxDeviceReport> list = gcjxDeviceReportService.selectGcjxDeviceReportListByMonth(gcjxDeviceReport);
ExcelUtil<GcjxDeviceReport> util = new ExcelUtil<GcjxDeviceReport>(GcjxDeviceReport.class);
util.exportExcel(response, list, "工程机械-报表中心数据");
}
@Log(title = "工程机械-报表中心", businessType = BusinessType.EXPORT)
@PostMapping("/exportYear")
public void exportYear(HttpServletResponse response, GcjxDeviceReport gcjxDeviceReport)
{
List<GcjxDeviceReport> list = gcjxDeviceReportService.selectGcjxDeviceReportListByYear(gcjxDeviceReport);
ExcelUtil<GcjxDeviceReport> util = new ExcelUtil<GcjxDeviceReport>(GcjxDeviceReport.class);
util.exportExcel(response, list, "工程机械-报表中心数据");
}
/**
* 获取工程机械-报表中心详细信息
*/
// @PreAuthorize("@ss.hasPermi('constructionMachinery:devicereport:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(gcjxDeviceReportService.selectGcjxDeviceReportById(id));
}
/**
* 新增工程机械-报表中心
*/
// @PreAuthorize("@ss.hasPermi('constructionMachinery:devicereport:add')")
@Log(title = "工程机械-报表中心", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody GcjxDeviceReport gcjxDeviceReport)
{
return toAjax(gcjxDeviceReportService.insertGcjxDeviceReport(gcjxDeviceReport));
}
/**
* 修改工程机械-报表中心
*/
// @PreAuthorize("@ss.hasPermi('constructionMachinery:devicereport:edit')")
@Log(title = "工程机械-报表中心", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody GcjxDeviceReport gcjxDeviceReport)
{
return toAjax(gcjxDeviceReportService.updateGcjxDeviceReport(gcjxDeviceReport));
}
/**
* 删除工程机械-报表中心
*/
//@PreAuthorize("@ss.hasPermi('constructionMachinery:devicereport:remove')")
@Log(title = "工程机械-报表中心", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(gcjxDeviceReportService.deleteGcjxDeviceReportByIds(ids));
}
}

View File

@ -0,0 +1,182 @@
package com.god.constructionMachinery.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.god.common.annotation.Excel;
import com.god.common.core.domain.BaseEntity;
/**
* 工程机械-报表中心对象 gcjx_device_report
*
* @author god
* @date 2023-12-04
*/
public class GcjxDeviceReport extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private String id;
/** 设备编号 */
@Excel(name = "设备编号")
private String deviceCode;
/** 设备名称 */
@Excel(name = "设备名称")
private String deviceName;
/** 日期 */
@Excel(name = "日期")
private String deviceDate;
/** 周 */
@Excel(name = "")
private String deviceWeek;
/** 月 */
@Excel(name = "")
private String deviceMonth;
/** 年 */
@Excel(name = "")
private String deviceYear;
/** 运行时长 */
@Excel(name = "运行时长")
private String runningTime;
/** 油耗 */
@Excel(name = "油耗")
private String deviceFuel;
/** 维修次数 */
@Excel(name = "维修次数")
private String repairNumber;
private String startDate;
private String endDate;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setDeviceCode(String deviceCode)
{
this.deviceCode = deviceCode;
}
public String getDeviceCode()
{
return deviceCode;
}
public void setDeviceName(String deviceName)
{
this.deviceName = deviceName;
}
public String getDeviceName()
{
return deviceName;
}
public void setDeviceDate(String deviceDate)
{
this.deviceDate = deviceDate;
}
public String getDeviceDate()
{
return deviceDate;
}
public void setDeviceWeek(String deviceWeek)
{
this.deviceWeek = deviceWeek;
}
public String getDeviceWeek()
{
return deviceWeek;
}
public void setDeviceMonth(String deviceMonth)
{
this.deviceMonth = deviceMonth;
}
public String getDeviceMonth()
{
return deviceMonth;
}
public void setDeviceYear(String deviceYear)
{
this.deviceYear = deviceYear;
}
public String getDeviceYear()
{
return deviceYear;
}
public void setRunningTime(String runningTime)
{
this.runningTime = runningTime;
}
public String getRunningTime()
{
return runningTime;
}
public void setDeviceFuel(String deviceFuel)
{
this.deviceFuel = deviceFuel;
}
public String getDeviceFuel()
{
return deviceFuel;
}
public void setRepairNumber(String repairNumber)
{
this.repairNumber = repairNumber;
}
public String getRepairNumber()
{
return repairNumber;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("deviceCode", getDeviceCode())
.append("deviceName", getDeviceName())
.append("deviceDate", getDeviceDate())
.append("deviceWeek", getDeviceWeek())
.append("deviceMonth", getDeviceMonth())
.append("deviceYear", getDeviceYear())
.append("runningTime", getRunningTime())
.append("deviceFuel", getDeviceFuel())
.append("repairNumber", getRepairNumber())
.toString();
}
}

View File

@ -0,0 +1,64 @@
package com.god.constructionMachinery.mapper;
import java.util.List;
import com.god.constructionMachinery.domain.GcjxDeviceReport;
/**
* 工程机械-报表中心Mapper接口
*
* @author god
* @date 2023-12-04
*/
public interface GcjxDeviceReportMapper
{
/**
* 查询工程机械-报表中心
*
* @param id 工程机械-报表中心主键
* @return 工程机械-报表中心
*/
public GcjxDeviceReport selectGcjxDeviceReportById(String id);
/**
* 查询工程机械-报表中心列表
*
* @param gcjxDeviceReport 工程机械-报表中心
* @return 工程机械-报表中心集合
*/
public List<GcjxDeviceReport> selectGcjxDeviceReportList(GcjxDeviceReport gcjxDeviceReport);
public List<GcjxDeviceReport> selectGcjxDeviceReportListByYear(GcjxDeviceReport gcjxDeviceReport);
public List<GcjxDeviceReport> selectGcjxDeviceReportListByMonth(GcjxDeviceReport gcjxDeviceReport);
public List<GcjxDeviceReport> selectGcjxDeviceReportListByWeek(GcjxDeviceReport gcjxDeviceReport);
/**
* 新增工程机械-报表中心
*
* @param gcjxDeviceReport 工程机械-报表中心
* @return 结果
*/
public int insertGcjxDeviceReport(GcjxDeviceReport gcjxDeviceReport);
/**
* 修改工程机械-报表中心
*
* @param gcjxDeviceReport 工程机械-报表中心
* @return 结果
*/
public int updateGcjxDeviceReport(GcjxDeviceReport gcjxDeviceReport);
/**
* 删除工程机械-报表中心
*
* @param id 工程机械-报表中心主键
* @return 结果
*/
public int deleteGcjxDeviceReportById(String id);
/**
* 批量删除工程机械-报表中心
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteGcjxDeviceReportByIds(String[] ids);
}

View File

@ -0,0 +1,64 @@
package com.god.constructionMachinery.service;
import java.util.List;
import com.god.constructionMachinery.domain.GcjxDeviceReport;
/**
* 工程机械-报表中心Service接口
*
* @author god
* @date 2023-12-04
*/
public interface IGcjxDeviceReportService
{
/**
* 查询工程机械-报表中心
*
* @param id 工程机械-报表中心主键
* @return 工程机械-报表中心
*/
public GcjxDeviceReport selectGcjxDeviceReportById(String id);
/**
* 查询工程机械-报表中心列表
*
* @param gcjxDeviceReport 工程机械-报表中心
* @return 工程机械-报表中心集合
*/
public List<GcjxDeviceReport> selectGcjxDeviceReportList(GcjxDeviceReport gcjxDeviceReport);
public List<GcjxDeviceReport> selectGcjxDeviceReportListByYear(GcjxDeviceReport gcjxDeviceReport);
public List<GcjxDeviceReport> selectGcjxDeviceReportListByMonth(GcjxDeviceReport gcjxDeviceReport);
public List<GcjxDeviceReport> selectGcjxDeviceReportListByWeek(GcjxDeviceReport gcjxDeviceReport);
/**
* 新增工程机械-报表中心
*
* @param gcjxDeviceReport 工程机械-报表中心
* @return 结果
*/
public int insertGcjxDeviceReport(GcjxDeviceReport gcjxDeviceReport);
/**
* 修改工程机械-报表中心
*
* @param gcjxDeviceReport 工程机械-报表中心
* @return 结果
*/
public int updateGcjxDeviceReport(GcjxDeviceReport gcjxDeviceReport);
/**
* 批量删除工程机械-报表中心
*
* @param ids 需要删除的工程机械-报表中心主键集合
* @return 结果
*/
public int deleteGcjxDeviceReportByIds(String[] ids);
/**
* 删除工程机械-报表中心信息
*
* @param id 工程机械-报表中心主键
* @return 结果
*/
public int deleteGcjxDeviceReportById(String id);
}

View File

@ -0,0 +1,111 @@
package com.god.constructionMachinery.service.impl;
import java.util.List;
import com.god.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.god.constructionMachinery.mapper.GcjxDeviceReportMapper;
import com.god.constructionMachinery.domain.GcjxDeviceReport;
import com.god.constructionMachinery.service.IGcjxDeviceReportService;
/**
* 工程机械-报表中心Service业务层处理
*
* @author god
* @date 2023-12-04
*/
@Service
public class GcjxDeviceReportServiceImpl implements IGcjxDeviceReportService
{
@Autowired
private GcjxDeviceReportMapper gcjxDeviceReportMapper;
/**
* 查询工程机械-报表中心
*
* @param id 工程机械-报表中心主键
* @return 工程机械-报表中心
*/
@Override
public GcjxDeviceReport selectGcjxDeviceReportById(String id)
{
return gcjxDeviceReportMapper.selectGcjxDeviceReportById(id);
}
/**
* 查询工程机械-报表中心列表
*
* @param gcjxDeviceReport 工程机械-报表中心
* @return 工程机械-报表中心
*/
@Override
public List<GcjxDeviceReport> selectGcjxDeviceReportList(GcjxDeviceReport gcjxDeviceReport)
{
return gcjxDeviceReportMapper.selectGcjxDeviceReportList(gcjxDeviceReport);
}
@Override
public List<GcjxDeviceReport> selectGcjxDeviceReportListByYear(GcjxDeviceReport gcjxDeviceReport) {
return gcjxDeviceReportMapper.selectGcjxDeviceReportListByYear(gcjxDeviceReport);
}
@Override
public List<GcjxDeviceReport> selectGcjxDeviceReportListByMonth(GcjxDeviceReport gcjxDeviceReport) {
return gcjxDeviceReportMapper.selectGcjxDeviceReportListByMonth(gcjxDeviceReport);
}
@Override
public List<GcjxDeviceReport> selectGcjxDeviceReportListByWeek(GcjxDeviceReport gcjxDeviceReport) {
return gcjxDeviceReportMapper.selectGcjxDeviceReportListByWeek(gcjxDeviceReport);
}
/**
* 新增工程机械-报表中心
*
* @param gcjxDeviceReport 工程机械-报表中心
* @return 结果
*/
@Override
public int insertGcjxDeviceReport(GcjxDeviceReport gcjxDeviceReport)
{
gcjxDeviceReport.setId(IdUtils.fastUUID());
return gcjxDeviceReportMapper.insertGcjxDeviceReport(gcjxDeviceReport);
}
/**
* 修改工程机械-报表中心
*
* @param gcjxDeviceReport 工程机械-报表中心
* @return 结果
*/
@Override
public int updateGcjxDeviceReport(GcjxDeviceReport gcjxDeviceReport)
{
return gcjxDeviceReportMapper.updateGcjxDeviceReport(gcjxDeviceReport);
}
/**
* 批量删除工程机械-报表中心
*
* @param ids 需要删除的工程机械-报表中心主键
* @return 结果
*/
@Override
public int deleteGcjxDeviceReportByIds(String[] ids)
{
return gcjxDeviceReportMapper.deleteGcjxDeviceReportByIds(ids);
}
/**
* 删除工程机械-报表中心信息
*
* @param id 工程机械-报表中心主键
* @return 结果
*/
@Override
public int deleteGcjxDeviceReportById(String id)
{
return gcjxDeviceReportMapper.deleteGcjxDeviceReportById(id);
}
}

View File

@ -0,0 +1,150 @@
<?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.god.constructionMachinery.mapper.GcjxDeviceReportMapper">
<resultMap type="GcjxDeviceReport" id="GcjxDeviceReportResult">
<result property="id" column="id" />
<result property="deviceCode" column="device_code" />
<result property="deviceName" column="device_name" />
<result property="deviceDate" column="device_date" />
<result property="deviceWeek" column="device_week" />
<result property="deviceMonth" column="device_month" />
<result property="deviceYear" column="device_year" />
<result property="runningTime" column="running_time" />
<result property="deviceFuel" column="device_fuel" />
<result property="repairNumber" column="repair_number" />
</resultMap>
<sql id="selectGcjxDeviceReportVo">
select id, device_code, device_name, device_date, device_week, device_month, device_year, running_time, device_fuel, repair_number from gcjx_device_report
</sql>
<select id="selectGcjxDeviceReportList" parameterType="GcjxDeviceReport" resultMap="GcjxDeviceReportResult">
<include refid="selectGcjxDeviceReportVo"/>
<where>
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="startDate != null and startDate != ''"> and device_date between #{startDate} and #{endDate}</if>
<if test="deviceWeek != null and deviceWeek != ''"> and device_week = #{deviceWeek}</if>
<if test="deviceMonth != null and deviceMonth != ''"> and device_month = #{deviceMonth}</if>
<if test="deviceYear != null and deviceYear != ''"> and device_year = #{deviceYear}</if>
<if test="runningTime != null and runningTime != ''"> and running_time = #{runningTime}</if>
<if test="deviceFuel != null and deviceFuel != ''"> and device_fuel = #{deviceFuel}</if>
<if test="repairNumber != null and repairNumber != ''"> and repair_number = #{repairNumber}</if>
</where>
order by device_date desc
</select>
<select id="selectGcjxDeviceReportListByWeek" parameterType="GcjxDeviceReport" resultMap="GcjxDeviceReportResult">
SELECT device_code, device_name, device_year, device_week, ROUND(sum(running_time),1) as running_time, ROUND(sum(device_fuel),1) as device_fuel, ROUND(sum(repair_number)) as repair_number FROM gcjx_device_report
<where>
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="startDate != null and startDate != ''"> and device_date between #{startDate} and #{endDate}</if>
<if test="deviceWeek != null and deviceWeek != ''"> and device_week = #{deviceWeek}</if>
<if test="deviceMonth != null and deviceMonth != ''"> and device_month = #{deviceMonth}</if>
<if test="deviceYear != null and deviceYear != ''"> and device_year = #{deviceYear}</if>
<if test="runningTime != null and runningTime != ''"> and running_time = #{runningTime}</if>
<if test="deviceFuel != null and deviceFuel != ''"> and device_fuel = #{deviceFuel}</if>
<if test="repairNumber != null and repairNumber != ''"> and repair_number = #{repairNumber}</if>
</where>
group by device_code, device_year, device_week
order by device_year desc, device_week desc, device_code
</select>
<select id="selectGcjxDeviceReportListByMonth" parameterType="GcjxDeviceReport" resultMap="GcjxDeviceReportResult">
select device_code, device_name, device_month, ROUND(sum(running_time),1) as running_time, ROUND(sum(device_fuel),1) as device_fuel, ROUND(sum(repair_number)) as repair_number from gcjx_device_report
<where>
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="startDate != null and startDate != ''"> and device_date between #{startDate} and #{endDate}</if>
<if test="deviceWeek != null and deviceWeek != ''"> and device_week = #{deviceWeek}</if>
<if test="deviceMonth != null and deviceMonth != ''"> and device_month = #{deviceMonth}</if>
<if test="deviceYear != null and deviceYear != ''"> and device_year = #{deviceYear}</if>
<if test="runningTime != null and runningTime != ''"> and running_time = #{runningTime}</if>
<if test="deviceFuel != null and deviceFuel != ''"> and device_fuel = #{deviceFuel}</if>
<if test="repairNumber != null and repairNumber != ''"> and repair_number = #{repairNumber}</if>
</where>
group by device_code, device_month
order by device_month desc, device_code
</select>
<select id="selectGcjxDeviceReportListByYear" parameterType="GcjxDeviceReport" resultMap="GcjxDeviceReportResult">
select device_code, device_name, device_year, ROUND(sum(running_time),1) as running_time, ROUND(sum(device_fuel),1) as device_fuel, ROUND(sum(repair_number)) as repair_number from gcjx_device_report
<where>
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="startDate != null and startDate != ''"> and device_date between #{startDate} and #{endDate}</if>
<if test="deviceWeek != null and deviceWeek != ''"> and device_week = #{deviceWeek}</if>
<if test="deviceMonth != null and deviceMonth != ''"> and device_month = #{deviceMonth}</if>
<if test="deviceYear != null and deviceYear != ''"> and device_year = #{deviceYear}</if>
<if test="runningTime != null and runningTime != ''"> and running_time = #{runningTime}</if>
<if test="deviceFuel != null and deviceFuel != ''"> and device_fuel = #{deviceFuel}</if>
<if test="repairNumber != null and repairNumber != ''"> and repair_number = #{repairNumber}</if>
</where>
group by device_code, device_year
order by device_year desc, device_code
</select>
<select id="selectGcjxDeviceReportById" parameterType="String" resultMap="GcjxDeviceReportResult">
<include refid="selectGcjxDeviceReportVo"/>
where id = #{id}
</select>
<insert id="insertGcjxDeviceReport" parameterType="GcjxDeviceReport">
insert into gcjx_device_report
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="deviceCode != null">device_code,</if>
<if test="deviceName != null">device_name,</if>
<if test="deviceDate != null">device_date,</if>
<if test="deviceWeek != null">device_week,</if>
<if test="deviceMonth != null">device_month,</if>
<if test="deviceYear != null">device_year,</if>
<if test="runningTime != null">running_time,</if>
<if test="deviceFuel != null">device_fuel,</if>
<if test="repairNumber != null">repair_number,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="deviceCode != null">#{deviceCode},</if>
<if test="deviceName != null">#{deviceName},</if>
<if test="deviceDate != null">#{deviceDate},</if>
<if test="deviceWeek != null">#{deviceWeek},</if>
<if test="deviceMonth != null">#{deviceMonth},</if>
<if test="deviceYear != null">#{deviceYear},</if>
<if test="runningTime != null">#{runningTime},</if>
<if test="deviceFuel != null">#{deviceFuel},</if>
<if test="repairNumber != null">#{repairNumber},</if>
</trim>
</insert>
<update id="updateGcjxDeviceReport" parameterType="GcjxDeviceReport">
update gcjx_device_report
<trim prefix="SET" suffixOverrides=",">
<if test="deviceCode != null">device_code = #{deviceCode},</if>
<if test="deviceName != null">device_name = #{deviceName},</if>
<if test="deviceDate != null">device_date = #{deviceDate},</if>
<if test="deviceWeek != null">device_week = #{deviceWeek},</if>
<if test="deviceMonth != null">device_month = #{deviceMonth},</if>
<if test="deviceYear != null">device_year = #{deviceYear},</if>
<if test="runningTime != null">running_time = #{runningTime},</if>
<if test="deviceFuel != null">device_fuel = #{deviceFuel},</if>
<if test="repairNumber != null">repair_number = #{repairNumber},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGcjxDeviceReportById" parameterType="String">
delete from gcjx_device_report where id = #{id}
</delete>
<delete id="deleteGcjxDeviceReportByIds" parameterType="String">
delete from gcjx_device_report where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,65 @@
import request from '@/utils/request'
// 查询工程机械-报表中心列表
export function listDevicereport(query) {
return request({
url: '/constructionMachinery/devicereport/list',
method: 'get',
params: query
})
}
export function listDevicereportWeek(query) {
return request({
url: '/constructionMachinery/devicereport/listWeek',
method: 'get',
params: query
})
}
export function listDevicereportMonth(query) {
return request({
url: '/constructionMachinery/devicereport/listMonth',
method: 'get',
params: query
})
}
export function listDevicereportYear(query) {
return request({
url: '/constructionMachinery/devicereport/listYear',
method: 'get',
params: query
})
}
// 查询工程机械-报表中心详细
export function getDevicereport(id) {
return request({
url: '/constructionMachinery/devicereport/' + id,
method: 'get'
})
}
// 新增工程机械-报表中心
export function addDevicereport(data) {
return request({
url: '/constructionMachinery/devicereport',
method: 'post',
data: data
})
}
// 修改工程机械-报表中心
export function updateDevicereport(data) {
return request({
url: '/constructionMachinery/devicereport',
method: 'put',
data: data
})
}
// 删除工程机械-报表中心
export function delDevicereport(id) {
return request({
url: '/constructionMachinery/devicereport/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,349 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="设备编号" prop="deviceCode">
<el-input
v-model="queryParams.deviceCode"
placeholder="请输入设备编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input
v-model="queryParams.deviceName"
placeholder="请输入设备名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="日期" prop="deviceDate">
<el-date-picker
v-model="fullDateValue"
type="daterange"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:editable="false"
:key="2"
></el-date-picker>
</el-form-item>
<!--<el-form-item label="周" prop="deviceWeek">
<el-input
v-model="queryParams.deviceWeek"
placeholder="请输入周"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="月" prop="deviceMonth">
<el-input
v-model="queryParams.deviceMonth"
placeholder="请输入月"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="年" prop="deviceYear">
<el-input
v-model="queryParams.deviceYear"
placeholder="请输入年"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!--<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['constructionMachinery:devicereport:add']"
>新增</el-button>
</el-col>-->
<!--<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['constructionMachinery:devicereport:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['constructionMachinery:devicereport:remove']"
>删除</el-button>
</el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['constructionMachinery:devicereport:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="devicereportList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!--<el-table-column label="主键" align="center" prop="id" />-->
<el-table-column label="设备编号" align="center" prop="deviceCode" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="日期" align="center" prop="deviceDate" />
<!--<el-table-column label="周" align="center" prop="deviceWeek" />
<el-table-column label="月" align="center" prop="deviceMonth" />
<el-table-column label="年" align="center" prop="deviceYear" />-->
<el-table-column label="运行时长h" align="center" prop="runningTime" />
<el-table-column label="油耗L" align="center" prop="deviceFuel"/>
<el-table-column label="维修次数" align="center" prop="repairNumber" />
<!--<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['constructionMachinery:devicereport:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['constructionMachinery:devicereport:remove']"
>删除</el-button>
</template>
</el-table-column>-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改报表中心对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="设备编号" prop="deviceCode">
<el-input v-model="form.deviceCode" placeholder="请输入设备编号" />
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
</el-form-item>
<el-form-item label="日期" prop="deviceDate">
<el-input v-model="form.deviceDate" placeholder="请输入日期" />
</el-form-item>
<el-form-item label="周" prop="deviceWeek">
<el-input v-model="form.deviceWeek" placeholder="请输入周" />
</el-form-item>
<el-form-item label="月" prop="deviceMonth">
<el-input v-model="form.deviceMonth" placeholder="请输入月" />
</el-form-item>
<el-form-item label="年" prop="deviceYear">
<el-input v-model="form.deviceYear" placeholder="请输入年" />
</el-form-item>
<el-form-item label="运行时长" prop="runningTime">
<el-input v-model="form.runningTime" placeholder="请输入运行时长" />
</el-form-item>
<el-form-item label="油耗" prop="deviceFuel">
<el-input v-model="form.deviceFuel" placeholder="请输入油耗" />
</el-form-item>
<el-form-item label="维修次数" prop="repairNumber">
<el-input v-model="form.repairNumber" placeholder="请输入维修次数" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDevicereport, getDevicereport, delDevicereport, addDevicereport, updateDevicereport } from "@/api/constructionMachinery/devicereport";
export default {
name: "Devicereport",
data() {
return {
fullDateValue: null,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
devicereportList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
deviceCode: null,
deviceName: null,
deviceDate: null,
deviceWeek: null,
deviceMonth: null,
deviceYear: null,
runningTime: null,
deviceFuel: null,
repairNumber: null,
startDate: null,
endDate: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询报表中心列表 */
getList() {
this.loading = true;
if (this.fullDateValue != null && this.fullDateValue != ""){
this.queryParams.startDate = this.fullDateValue[0]
this.queryParams.endDate = this.fullDateValue[1]
}else {
this.queryParams.startDate = null
this.queryParams.endDate = null
}
listDevicereport(this.queryParams).then(response => {
this.devicereportList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
deviceCode: "QZJ007812",
deviceName: "塔式起重机812",
deviceDate: "2023-11-",
deviceWeek: null,
deviceMonth: "2023-11",
deviceYear: "2023",
runningTime: null,
deviceFuel: null,
repairNumber: "0"
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.fullDateValue = null
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加报表中心";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getDevicereport(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改报表中心";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDevicereport(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDevicereport(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除报表中心编号为"' + ids + '"的数据项?').then(function() {
return delDevicereport(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('constructionMachinery/devicereport/export', {
...this.queryParams
}, `devicereport_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -0,0 +1,353 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="设备编号" prop="deviceCode">
<el-input
v-model="queryParams.deviceCode"
placeholder="请输入设备编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input
v-model="queryParams.deviceName"
placeholder="请输入设备名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="日期" prop="deviceDate">
<el-date-picker
v-model="fullDateValue"
type="daterange"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:editable="false"
:key="2"
></el-date-picker>
</el-form-item>
<!--<el-form-item label="周" prop="deviceWeek">
<el-input
v-model="queryParams.deviceWeek"
placeholder="请输入周"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="月" prop="deviceMonth">
<el-input
v-model="queryParams.deviceMonth"
placeholder="请输入月"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="年" prop="deviceYear">
<el-input
v-model="queryParams.deviceYear"
placeholder="请输入年"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!--<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['constructionMachinery:devicereport:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['constructionMachinery:devicereport:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['constructionMachinery:devicereport:remove']"
>删除</el-button>
</el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['constructionMachinery:devicereport:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="devicereportList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!--<el-table-column label="主键" align="center" prop="id" />-->
<el-table-column label="设备编号" align="center" prop="deviceCode" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
<!--<el-table-column label="日期" align="center" prop="deviceDate" />
<el-table-column label="周" align="center" prop="deviceWeek">
<template slot-scope="scope">{{ scope.row.deviceWeek ? scope.row.deviceYear + ' 第' + scope.row.deviceWeek + '周' : '-' }}</template>
</el-table-column>-->
<el-table-column label="月" align="center" prop="deviceMonth" />
<!-- <el-table-column label="年" align="center" prop="deviceYear" />-->
<el-table-column label="运行时长h" align="center" prop="runningTime" />
<el-table-column label="油耗L" align="center" prop="deviceFuel"/>
<el-table-column label="维修次数" align="center" prop="repairNumber">
<template slot-scope="scope">{{ Math.round(scope.row.repairNumber)}}</template>
</el-table-column>
<!--<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['constructionMachinery:devicereport:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['constructionMachinery:devicereport:remove']"
>删除</el-button>
</template>
</el-table-column>-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改报表中心对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="设备编号" prop="deviceCode">
<el-input v-model="form.deviceCode" placeholder="请输入设备编号" />
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
</el-form-item>
<el-form-item label="日期" prop="deviceDate">
<el-input v-model="form.deviceDate" placeholder="请输入日期" />
</el-form-item>
<el-form-item label="周" prop="deviceWeek">
<el-input v-model="form.deviceWeek" placeholder="请输入周" />
</el-form-item>
<el-form-item label="月" prop="deviceMonth">
<el-input v-model="form.deviceMonth" placeholder="请输入月" />
</el-form-item>
<el-form-item label="年" prop="deviceYear">
<el-input v-model="form.deviceYear" placeholder="请输入年" />
</el-form-item>
<el-form-item label="运行时长" prop="runningTime">
<el-input v-model="form.runningTime" placeholder="请输入运行时长" />
</el-form-item>
<el-form-item label="油耗" prop="deviceFuel">
<el-input v-model="form.deviceFuel" placeholder="请输入油耗" />
</el-form-item>
<el-form-item label="维修次数" prop="repairNumber">
<el-input v-model="form.repairNumber" placeholder="请输入维修次数" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDevicereportMonth, getDevicereport, delDevicereport, addDevicereport, updateDevicereport } from "@/api/constructionMachinery/devicereport";
export default {
name: "Devicereport",
data() {
return {
fullDateValue: null,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
devicereportList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
deviceCode: null,
deviceName: null,
deviceDate: null,
deviceWeek: null,
deviceMonth: null,
deviceYear: null,
runningTime: null,
deviceFuel: null,
repairNumber: null,
startDate: null,
endDate: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询报表中心列表 */
getList() {
this.loading = true;
if (this.fullDateValue != null && this.fullDateValue != ""){
this.queryParams.startDate = this.fullDateValue[0]
this.queryParams.endDate = this.fullDateValue[1]
}else {
this.queryParams.startDate = null
this.queryParams.endDate = null
}
listDevicereportMonth(this.queryParams).then(response => {
this.devicereportList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
deviceCode: null,
deviceName: null,
deviceDate: null,
deviceWeek: null,
deviceMonth: null,
deviceYear: null,
runningTime: null,
deviceFuel: null,
repairNumber: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.fullDateValue = null
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加报表中心";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getDevicereport(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改报表中心";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDevicereport(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDevicereport(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除报表中心编号为"' + ids + '"的数据项?').then(function() {
return delDevicereport(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('constructionMachinery/devicereport/exportMonth', {
...this.queryParams
}, `devicereportMonth_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -0,0 +1,353 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="设备编号" prop="deviceCode">
<el-input
v-model="queryParams.deviceCode"
placeholder="请输入设备编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input
v-model="queryParams.deviceName"
placeholder="请输入设备名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="日期" prop="deviceDate">
<el-date-picker
v-model="fullDateValue"
type="daterange"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:editable="false"
:key="2"
></el-date-picker>
</el-form-item>
<!--<el-form-item label="周" prop="deviceWeek">
<el-input
v-model="queryParams.deviceWeek"
placeholder="请输入周"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="月" prop="deviceMonth">
<el-input
v-model="queryParams.deviceMonth"
placeholder="请输入月"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="年" prop="deviceYear">
<el-input
v-model="queryParams.deviceYear"
placeholder="请输入年"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!--<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['constructionMachinery:devicereport:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['constructionMachinery:devicereport:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['constructionMachinery:devicereport:remove']"
>删除</el-button>
</el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['constructionMachinery:devicereport:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="devicereportList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!--<el-table-column label="主键" align="center" prop="id" />-->
<el-table-column label="设备编号" align="center" prop="deviceCode" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
<!--<el-table-column label="日期" align="center" prop="deviceDate" />-->
<el-table-column label="周" align="center" prop="deviceWeek">
<template slot-scope="scope">{{ scope.row.deviceWeek ? scope.row.deviceYear + ' 第' + scope.row.deviceWeek + '周' : '-' }}</template>
</el-table-column>
<!-- <el-table-column label="月" align="center" prop="deviceMonth" />
<el-table-column label="年" align="center" prop="deviceYear" />-->
<el-table-column label="运行时长h" align="center" prop="runningTime" />
<el-table-column label="油耗L" align="center" prop="deviceFuel"/>
<el-table-column label="维修次数" align="center" prop="repairNumber">
<template slot-scope="scope">{{ Math.round(scope.row.repairNumber)}}</template>
</el-table-column>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['constructionMachinery:devicereport:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['constructionMachinery:devicereport:remove']"
>删除</el-button>
</template>
</el-table-column>-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改报表中心对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="设备编号" prop="deviceCode">
<el-input v-model="form.deviceCode" placeholder="请输入设备编号" />
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
</el-form-item>
<el-form-item label="日期" prop="deviceDate">
<el-input v-model="form.deviceDate" placeholder="请输入日期" />
</el-form-item>
<el-form-item label="周" prop="deviceWeek">
<el-input v-model="form.deviceWeek" placeholder="请输入周" />
</el-form-item>
<el-form-item label="月" prop="deviceMonth">
<el-input v-model="form.deviceMonth" placeholder="请输入月" />
</el-form-item>
<el-form-item label="年" prop="deviceYear">
<el-input v-model="form.deviceYear" placeholder="请输入年" />
</el-form-item>
<el-form-item label="运行时长" prop="runningTime">
<el-input v-model="form.runningTime" placeholder="请输入运行时长" />
</el-form-item>
<el-form-item label="油耗" prop="deviceFuel">
<el-input v-model="form.deviceFuel" placeholder="请输入油耗" />
</el-form-item>
<el-form-item label="维修次数" prop="repairNumber">
<el-input v-model="form.repairNumber" placeholder="请输入维修次数" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDevicereportWeek, getDevicereport, delDevicereport, addDevicereport, updateDevicereport } from "@/api/constructionMachinery/devicereport";
export default {
name: "Devicereport",
data() {
return {
fullDateValue: null,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
devicereportList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
deviceCode: null,
deviceName: null,
deviceDate: null,
deviceWeek: null,
deviceMonth: null,
deviceYear: null,
runningTime: null,
deviceFuel: null,
repairNumber: null,
startDate: null,
endDate: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询报表中心列表 */
getList() {
this.loading = true;
if (this.fullDateValue != null && this.fullDateValue != ""){
this.queryParams.startDate = this.fullDateValue[0]
this.queryParams.endDate = this.fullDateValue[1]
}else {
this.queryParams.startDate = null
this.queryParams.endDate = null
}
listDevicereportWeek(this.queryParams).then(response => {
this.devicereportList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
deviceCode: null,
deviceName: null,
deviceDate: null,
deviceWeek: null,
deviceMonth: null,
deviceYear: null,
runningTime: null,
deviceFuel: null,
repairNumber: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.fullDateValue = null
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加报表中心";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getDevicereport(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改报表中心";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDevicereport(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDevicereport(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除报表中心编号为"' + ids + '"的数据项?').then(function() {
return delDevicereport(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('constructionMachinery/devicereport/exportWeek', {
...this.queryParams
}, `devicereport_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -0,0 +1,353 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="设备编号" prop="deviceCode">
<el-input
v-model="queryParams.deviceCode"
placeholder="请输入设备编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input
v-model="queryParams.deviceName"
placeholder="请输入设备名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="日期" prop="deviceDate">
<el-date-picker
v-model="fullDateValue"
type="daterange"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:editable="false"
:key="2"
></el-date-picker>
</el-form-item>
<!--<el-form-item label="周" prop="deviceWeek">
<el-input
v-model="queryParams.deviceWeek"
placeholder="请输入周"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="月" prop="deviceMonth">
<el-input
v-model="queryParams.deviceMonth"
placeholder="请输入月"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="年" prop="deviceYear">
<el-input
v-model="queryParams.deviceYear"
placeholder="请输入年"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!--<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['constructionMachinery:devicereport:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['constructionMachinery:devicereport:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['constructionMachinery:devicereport:remove']"
>删除</el-button>
</el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['constructionMachinery:devicereport:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="devicereportList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!--<el-table-column label="主键" align="center" prop="id" />-->
<el-table-column label="设备编号" align="center" prop="deviceCode" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
<!--<el-table-column label="日期" align="center" prop="deviceDate" />
<el-table-column label="周" align="center" prop="deviceWeek">
<template slot-scope="scope">{{ scope.row.deviceWeek ? scope.row.deviceYear + ' 第' + scope.row.deviceWeek + '周' : '-' }}</template>
</el-table-column>
<el-table-column label="月" align="center" prop="deviceMonth" />-->
<el-table-column label="年" align="center" prop="deviceYear" />
<el-table-column label="运行时长h" align="center" prop="runningTime" />
<el-table-column label="油耗L" align="center" prop="deviceFuel"/>
<el-table-column label="维修次数" align="center" prop="repairNumber">
<template slot-scope="scope">{{ Math.round(scope.row.repairNumber)}}</template>
</el-table-column>
<!--<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['constructionMachinery:devicereport:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['constructionMachinery:devicereport:remove']"
>删除</el-button>
</template>
</el-table-column>-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改报表中心对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="设备编号" prop="deviceCode">
<el-input v-model="form.deviceCode" placeholder="请输入设备编号" />
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
</el-form-item>
<el-form-item label="日期" prop="deviceDate">
<el-input v-model="form.deviceDate" placeholder="请输入日期" />
</el-form-item>
<el-form-item label="周" prop="deviceWeek">
<el-input v-model="form.deviceWeek" placeholder="请输入周" />
</el-form-item>
<el-form-item label="月" prop="deviceMonth">
<el-input v-model="form.deviceMonth" placeholder="请输入月" />
</el-form-item>
<el-form-item label="年" prop="deviceYear">
<el-input v-model="form.deviceYear" placeholder="请输入年" />
</el-form-item>
<el-form-item label="运行时长" prop="runningTime">
<el-input v-model="form.runningTime" placeholder="请输入运行时长" />
</el-form-item>
<el-form-item label="油耗" prop="deviceFuel">
<el-input v-model="form.deviceFuel" placeholder="请输入油耗" />
</el-form-item>
<el-form-item label="维修次数" prop="repairNumber">
<el-input v-model="form.repairNumber" placeholder="请输入维修次数" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDevicereportYear, getDevicereport, delDevicereport, addDevicereport, updateDevicereport } from "@/api/constructionMachinery/devicereport";
export default {
name: "Devicereport",
data() {
return {
fullDateValue: null,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
devicereportList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
deviceCode: null,
deviceName: null,
deviceDate: null,
deviceWeek: null,
deviceMonth: null,
deviceYear: null,
runningTime: null,
deviceFuel: null,
repairNumber: null,
startDate: null,
endDate: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询报表中心列表 */
getList() {
this.loading = true;
if (this.fullDateValue != null && this.fullDateValue != ""){
this.queryParams.startDate = this.fullDateValue[0]
this.queryParams.endDate = this.fullDateValue[1]
}else {
this.queryParams.startDate = null
this.queryParams.endDate = null
}
listDevicereportYear(this.queryParams).then(response => {
this.devicereportList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
deviceCode: null,
deviceName: null,
deviceDate: null,
deviceWeek: null,
deviceMonth: null,
deviceYear: null,
runningTime: null,
deviceFuel: null,
repairNumber: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.fullDateValue = null
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加报表中心";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getDevicereport(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改报表中心";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDevicereport(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDevicereport(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除报表中心编号为"' + ids + '"的数据项?').then(function() {
return delDevicereport(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('constructionMachinery/devicereport/exportYear', {
...this.queryParams
}, `devicereportYear_${new Date().getTime()}.xlsx`)
}
}
};
</script>