Commit 62156d68 authored by 王晓倩's avatar 王晓倩

巡检计划新增,修改,下发,作废

parent b64d106b
...@@ -59,6 +59,23 @@ public class TDeviceInfoController extends BaseController ...@@ -59,6 +59,23 @@ public class TDeviceInfoController extends BaseController
return AjaxResult.success(tDeviceInfoService.buildDeviceTreeSelect(param)); return AjaxResult.success(tDeviceInfoService.buildDeviceTreeSelect(param));
} }
/**
* 获取设备树
*/
@GetMapping("/deviceNodeTree")
public AjaxResult deviceNodeTree() throws Exception
{
List<Map<Object, Object>> list = null;
try {
list = tDeviceInfoService.buildDeviceTree();
} catch (Exception e) {
e.printStackTrace();
throw new Exception("获取设备列表失败");
}
return AjaxResult.success(list);
}
/** /**
* 导出设备信息列表 * 导出设备信息列表
*/ */
......
...@@ -3,6 +3,7 @@ package com.zehong.web.controller.deviceInspection; ...@@ -3,6 +3,7 @@ package com.zehong.web.controller.deviceInspection;
import java.util.List; import java.util.List;
import com.zehong.system.domain.form.InspectionPlanForm; import com.zehong.system.domain.form.InspectionPlanForm;
import com.zehong.system.domain.vo.InspectionPlanVo;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
......
...@@ -28,14 +28,17 @@ public class TInspectionPlan extends BaseEntity ...@@ -28,14 +28,17 @@ public class TInspectionPlan extends BaseEntity
@Excel(name = "工单id") @Excel(name = "工单id")
private String orderId; private String orderId;
/** 设备id */
private String deviceIds;
/** 开始时间 */ /** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime; private Date startTime;
/** 结束时间 */ /** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime; private Date endTime;
/** 地址 */ /** 地址 */
...@@ -84,6 +87,14 @@ public class TInspectionPlan extends BaseEntity ...@@ -84,6 +87,14 @@ public class TInspectionPlan extends BaseEntity
return orderId; return orderId;
} }
public String getDeviceIds() {
return deviceIds;
}
public void setDeviceIds(String deviceIds) {
this.deviceIds = deviceIds;
}
public void setStartTime(Date startTime) public void setStartTime(Date startTime)
{ {
this.startTime = startTime; this.startTime = startTime;
......
package com.zehong.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zehong.common.core.domain.BaseEntity;
import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TPipe;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 巡检计划对象 t_inspection_plan
*
* @author zehong
* @date 2021-07-21
*/
public class InspectionPlanVo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 巡检计划id */
private Integer planId;
/** 巡检计划名称 */
private String planName;
/** 设备id */
private String deviceIds;
/** 设备树列表 */
private Map<Object, List> deviceList;
/** 工单id */
private String orderId;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endTime;
/** 地址 */
private String address;
/** 计划状态(0未下发,1已下发,2进行中,3已完成) */
private String planStatus;
/** 是否作废(0正常,1作废) */
private String isDel;
/** 计划描述 */
private String remarks;
public void setPlanId(Integer planId)
{
this.planId = planId;
}
public Integer getPlanId()
{
return planId;
}
public void setPlanName(String planName)
{
this.planName = planName;
}
public String getPlanName()
{
return planName;
}
public String getDeviceIds() {
return deviceIds;
}
public void setDeviceIds(String deviceIds) {
this.deviceIds = deviceIds;
}
public Map<Object, List> getDeviceList() {
return deviceList;
}
public void setDeviceList(Map<Object, List> deviceList) {
this.deviceList = deviceList;
}
public void setOrderId(String orderId)
{
this.orderId = orderId;
}
public String getOrderId()
{
return orderId;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public void setPlanStatus(String planStatus)
{
this.planStatus = planStatus;
}
public String getPlanStatus()
{
return planStatus;
}
public String getIsDel() {
return isDel;
}
public void setIsDel(String isDel) {
this.isDel = isDel;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
}
...@@ -3,10 +3,7 @@ package com.zehong.system.service; ...@@ -3,10 +3,7 @@ package com.zehong.system.service;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.zehong.common.core.domain.TreeSelect;
import com.zehong.common.core.domain.entity.SysDept;
import com.zehong.system.domain.TDeviceInfo; import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TPipe;
/** /**
* 设备信息Service接口 * 设备信息Service接口
...@@ -40,6 +37,14 @@ public interface ITDeviceInfoService ...@@ -40,6 +37,14 @@ public interface ITDeviceInfoService
*/ */
public List<Map<Object, Object>> buildDeviceTreeSelect(Map<Object, List> param); public List<Map<Object, Object>> buildDeviceTreeSelect(Map<Object, List> param);
/**
* 设备树
*
* @param
* @return 树结构列表
*/
public List<Map<Object, Object>> buildDeviceTree() throws Exception;
/** /**
* 统计各设备类型的设备总数 * 统计各设备类型的设备总数
* @return * @return
......
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import com.zehong.common.core.domain.TreeSelect;
import com.zehong.common.core.domain.entity.SysDept;
import com.zehong.system.domain.TPipe; import com.zehong.system.domain.TPipe;
import com.zehong.system.mapper.TPipeMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDeviceInfoMapper; import com.zehong.system.mapper.TDeviceInfoMapper;
import com.zehong.system.domain.TDeviceInfo; import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.service.ITDeviceInfoService; import com.zehong.system.service.ITDeviceInfoService;
import org.springframework.web.bind.annotation.RequestParam;
/** /**
* 设备信息Service业务层处理 * 设备信息Service业务层处理
...@@ -24,6 +21,8 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService ...@@ -24,6 +21,8 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
{ {
@Autowired @Autowired
private TDeviceInfoMapper tDeviceInfoMapper; private TDeviceInfoMapper tDeviceInfoMapper;
@Autowired
private TPipeMapper tPipeMapper;
/** /**
* 查询设备信息 * 查询设备信息
...@@ -83,6 +82,94 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService ...@@ -83,6 +82,94 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
return list; return list;
} }
/**
* 设备树
*
* @param
* @return 树结构列表
*/
@Override
public List<Map<Object, Object>> buildDeviceTree() throws Exception
{
List<TPipe> pipeList = tPipeMapper.selectTPipeList(new TPipe());
List<TDeviceInfo> deviceList = tDeviceInfoMapper.selectTDeviceInfoList(new TDeviceInfo());
List<Map<Object, Object>> treeNodeList = new ArrayList<>();
if(pipeList.size() != 0){
List<Map<Object, Object>> childNodeList = new ArrayList<>();
for(TPipe pipe : pipeList){
Map<Object, Object> map = new HashMap<>();
map.put("id", pipe.getPipeId());
map.put("level", 2);
map.put("name", pipe.getPipeName());
childNodeList.add(map);
}
Map<Object, Object> treeNode = new HashMap<>();
treeNode.put("id", 0);
treeNode.put("level", 1);
treeNode.put("name", "管道");
treeNode.put("childList", childNodeList);
treeNodeList.add(treeNode);
}
if(deviceList.size() != 0) {
List<Map<Object, Object>> childNodeList1 = new ArrayList<>();
List<Map<Object, Object>> childNodeList2 = new ArrayList<>();
List<Map<Object, Object>> childNodeList3 = new ArrayList<>();
List<Map<Object, Object>> childNodeList4 = new ArrayList<>();
for (TDeviceInfo device : deviceList) {
Map<Object, Object> childNode = new HashMap<>();
childNode.put("id", device.getDeviceId());
childNode.put("level", 2);
childNode.put("name", device.getDeviceName());
if("1".equals(device.getDeviceType())) {
childNodeList1.add(childNode);
} else if ("2".equals(device.getDeviceType())) {
childNodeList2.add(childNode);
} else if ("3".equals(device.getDeviceType())) {
childNodeList3.add(childNode);
} else if ("4".equals(device.getDeviceType())){
childNodeList4.add(childNode);
}
}
Map<Object, Object> treeNode1 = new HashMap<>();
treeNode1.put("id", 1);
treeNode1.put("level", 1);
treeNode1.put("name", "调压阀");
treeNode1.put("childList", childNodeList1);
Map<Object, Object> treeNode2 = new HashMap<>();
treeNode2.put("id", 2);
treeNode2.put("level", 1);
treeNode2.put("name", "阀门井");
treeNode2.put("childList", childNodeList2);
Map<Object, Object> treeNode3 = new HashMap<>();
treeNode3.put("id", 3);
treeNode3.put("level", 1);
treeNode3.put("name", "流量计");
treeNode3.put("childList", childNodeList3);
Map<Object, Object> treeNode4 = new HashMap<>();
treeNode4.put("id", 4);
treeNode4.put("level", 1);
treeNode4.put("name", "压力表");
treeNode4.put("childList", childNodeList4);
treeNodeList.add(treeNode1);
treeNodeList.add(treeNode2);
treeNodeList.add(treeNode3);
treeNodeList.add(treeNode4);
}
return treeNodeList;
}
/** /**
* 统计各设备类型的设备总数 * 统计各设备类型的设备总数
* @return * @return
......
...@@ -3,6 +3,7 @@ package com.zehong.system.service.impl; ...@@ -3,6 +3,7 @@ package com.zehong.system.service.impl;
import java.util.List; import java.util.List;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.form.InspectionPlanForm; import com.zehong.system.domain.form.InspectionPlanForm;
import com.zehong.system.domain.vo.InspectionPlanVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TInspectionPlanMapper; import com.zehong.system.mapper.TInspectionPlanMapper;
......
...@@ -7,6 +7,7 @@ import com.zehong.common.core.domain.entity.SysUser; ...@@ -7,6 +7,7 @@ import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.*; import com.zehong.system.domain.*;
import com.zehong.system.domain.form.TWorkOrderForm; import com.zehong.system.domain.form.TWorkOrderForm;
import com.zehong.system.domain.vo.InspectionPlanVo;
import com.zehong.system.domain.vo.OrderFeedbackVo; import com.zehong.system.domain.vo.OrderFeedbackVo;
import com.zehong.system.domain.vo.WorkOrderVo; import com.zehong.system.domain.vo.WorkOrderVo;
import com.zehong.system.mapper.*; import com.zehong.system.mapper.*;
...@@ -289,9 +290,8 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -289,9 +290,8 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
plan.setUpdateTime(DateUtils.getNowDate()); plan.setUpdateTime(DateUtils.getNowDate());
tInspectionPlanMapper.updateTInspectionPlan(plan); tInspectionPlanMapper.updateTInspectionPlan(plan);
} else if ("0".equals(tWorkOrder.getOrderStatus())){
tWorkOrder.setUpdateTime(DateUtils.getNowDate());
} }
tWorkOrder.setUpdateTime(DateUtils.getNowDate());
return tWorkOrderMapper.updateTWorkOrder(tWorkOrder); return tWorkOrderMapper.updateTWorkOrder(tWorkOrder);
} }
......
...@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="planId" column="plan_id" /> <result property="planId" column="plan_id" />
<result property="planName" column="plan_name" /> <result property="planName" column="plan_name" />
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
<result property="deviceIds" column="device_ids" />
<result property="startTime" column="start_time" /> <result property="startTime" column="start_time" />
<result property="endTime" column="end_time" /> <result property="endTime" column="end_time" />
<result property="address" column="address" /> <result property="address" column="address" />
...@@ -19,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -19,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectTInspectionPlanVo"> <sql id="selectTInspectionPlanVo">
select plan_id, plan_name, order_id, start_time, end_time, address, plan_status, is_del, update_time, create_time, remarks from t_inspection_plan select plan_id, plan_name, order_id, device_ids, start_time, end_time, address, plan_status, is_del, update_time, create_time, remarks from t_inspection_plan
</sql> </sql>
<select id="selectTInspectionPlanList" parameterType="InspectionPlanForm" resultMap="TInspectionPlanResult"> <select id="selectTInspectionPlanList" parameterType="InspectionPlanForm" resultMap="TInspectionPlanResult">
...@@ -47,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -47,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planName != null">plan_name,</if> <if test="planName != null">plan_name,</if>
<if test="orderId != null">order_id,</if> <if test="orderId != null">order_id,</if>
<if test="deviceIds != null">device_ids,</if>
<if test="startTime != null">start_time,</if> <if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if> <if test="endTime != null">end_time,</if>
<if test="address != null">address,</if> <if test="address != null">address,</if>
...@@ -59,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -59,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planName != null">#{planName},</if> <if test="planName != null">#{planName},</if>
<if test="orderId != null">#{orderId},</if> <if test="orderId != null">#{orderId},</if>
<if test="deviceIds != null">#{deviceIds},</if>
<if test="startTime != null">#{startTime},</if> <if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if> <if test="endTime != null">#{endTime},</if>
<if test="address != null">#{address},</if> <if test="address != null">#{address},</if>
...@@ -75,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -75,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="planName != null">plan_name = #{planName},</if> <if test="planName != null">plan_name = #{planName},</if>
<if test="orderId != null">order_id = #{orderId},</if> <if test="orderId != null">order_id = #{orderId},</if>
<if test="deviceIds != null">device_ids = #{deviceIds},</if>
<if test="startTime != null">start_time = #{startTime},</if> <if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if> <if test="endTime != null">end_time = #{endTime},</if>
<if test="address != null">address = #{address},</if> <if test="address != null">address = #{address},</if>
......
...@@ -78,3 +78,11 @@ export function deviceTree(data) { ...@@ -78,3 +78,11 @@ export function deviceTree(data) {
}) })
} }
// 设备树
export function deviceNodeTree() {
return request({
url: '/device/deviceInfo/deviceNodeTree',
method: 'get'
})
}
...@@ -69,24 +69,25 @@ ...@@ -69,24 +69,25 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['deviceInspection:inspectionPlan:add']" v-hasPermi="['deviceInspection:inspectionPlan:add']"
>新增</el-button> >新增
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="inspectionPlanList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="inspectionPlanList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="序号" type="index" align="center" prop="planName" /> <el-table-column label="序号" type="index" align="center" prop="planName"/>
<el-table-column label="巡检计划名称" align="center" prop="planName" /> <el-table-column label="巡检计划名称" align="center" prop="planName"/>
<el-table-column label="计划时间" align="center" prop="startTime" width="280"> <el-table-column label="计划时间" align="center" prop="startTime" width="280">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.startTime, '{y}/{m}/{d}') }}</span> - <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.endTime, '{y}/{m}/{d}') }}</span> <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="地址" align="center" prop="address" /> <el-table-column label="地址" align="center" prop="address"/>
<el-table-column label="计划描述" align="center" prop="remarks" /> <el-table-column label="计划描述" align="center" prop="remarks"/>
<el-table-column label="状态" align="center" prop="planStatus" > <el-table-column label="状态" align="center" prop="planStatus">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.planStatus == 0">未下发</span> <span v-if="scope.row.planStatus == 0">未下发</span>
<span v-if="scope.row.planStatus == 1">已下发</span> <span v-if="scope.row.planStatus == 1">已下发</span>
...@@ -94,33 +95,41 @@ ...@@ -94,33 +95,41 @@
<span v-if="scope.row.planStatus == 3">已完成</span> <span v-if="scope.row.planStatus == 3">已完成</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="280">
<template slot-scope="scope"> <template slot-scope="scope">
<font v-if="scope.row.planStatus != 0">-</font>
<el-button <el-button
size="mini" size="normal"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleIssue(scope.row)"
v-hasPermi="['deviceInspection:inspectionPlan:edit']" v-hasPermi="['workOrder:basicsInfo:add']"
v-if="scope.row.planStatus == 0" v-if="scope.row.planStatus == 0"
>下发</el-button> >下发
</el-button>
<el-button <el-button
size="mini" size="normal"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['deviceInspection:inspectionPlan:edit']" v-hasPermi="['deviceInspection:inspectionPlan:edit']"
v-if="scope.row.planStatus == 0" v-if="scope.row.planStatus == 0"
>修改</el-button> >修改
</el-button>
<el-button <el-button
size="mini" size="normal"
type="text"
icon="el-icon-edit"
@click="showDetail(scope.row)"
>详情</el-button>
<el-button
size="normal"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleIsDel(scope.row)" @click="handleIsDel(scope.row)"
v-hasPermi="['deviceInspection:inspectionPlan:edit']" v-hasPermi="['deviceInspection:inspectionPlan:edit']"
v-if="scope.row.planStatus == 0" v-if="scope.row.planStatus == 0"
>作废</el-button> >作废
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -134,16 +143,28 @@ ...@@ -134,16 +143,28 @@
/> />
<!-- 添加或修改巡检计划对话框 --> <!-- 添加或修改巡检计划对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @close="cancel">
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<div v-if="this.title != '下发工单'">
<el-form-item label="巡检计划名称" prop="planName"> <el-form-item label="巡检计划名称" prop="planName">
<el-input v-model="form.planName" placeholder="请输入巡检计划名称" /> <el-input v-model="form.planName" placeholder="请输入巡检计划名称"/>
</el-form-item>
<el-form-item v-model="form.deviceIds" label="巡检设备">
<el-cascader
v-model="devices"
:options="options"
:props="props"
:show-all-levels="false"
@change="handleChange"
filterable
clearable
></el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="开始时间" prop="startTime"> <el-form-item label="开始时间" prop="startTime">
<el-date-picker clearable size="small" <el-date-picker clearable size="small"
v-model="form.startTime" v-model="form.startTime"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择开始时间"> placeholder="选择开始时间">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
...@@ -151,16 +172,45 @@ ...@@ -151,16 +172,45 @@
<el-date-picker clearable size="small" <el-date-picker clearable size="small"
v-model="form.endTime" v-model="form.endTime"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择结束时间"> placeholder="选择结束时间">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="地址" prop="address"> <el-form-item label="地址" prop="address">
<el-input v-model="form.address" placeholder="请输入地址" /> <el-input v-model="form.address" placeholder="请输入地址"/>
</el-form-item> </el-form-item>
<el-form-item label="计划描述" prop="remarks"> <el-form-item label="计划描述" prop="remarks">
<el-input type="textarea" v-model="form.remarks" placeholder="请输入计划描述" /> <el-input type="textarea" v-model="form.remarks" placeholder="请输入计划描述"/>
</el-form-item>
</div>
<div v-if="this.title == '下发工单'">
<el-form-item label="巡检计划名称" prop="planName">
<font>{{form.planName}}</font>
</el-form-item>
<el-form-item label="计划时间">
<font>{{ parseTime(form.startTime, '{y}-{m}-{d}') }}
{{ parseTime(form.endTime, '{y}-{m}-{d}') }}</font>
</el-form-item> </el-form-item>
<el-form-item label="地址" prop="address">
<font>{{form.address}}</font>
</el-form-item>
<el-form-item label="工单名称" prop="orderName">
<el-input v-model="form.orderName" placeholder="请输入工单名称" />
</el-form-item>
<el-form-item label="指定执行人员" prop="appointInspector">
<el-select v-model="form.appointInspectorName" placeholder="请选择执行人员" clearable size="small" @change="setUserId">
<el-option
v-for="item in inspector"
:key="item.userId"
:label="item.nickName"
:value="item.userId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="工单描述" prop="remarks">
<el-input type="textarea" v-model="form.remarks" placeholder="请输入工单描述" />
</el-form-item>
</div>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
...@@ -171,12 +221,14 @@ ...@@ -171,12 +221,14 @@
</template> </template>
<script> <script>
import { listInspectionPlan, getInspectionPlan, delInspectionPlan, addInspectionPlan, updateInspectionPlan, exportInspectionPlan } from "@/api/deviceInspection/inspectionPlan"; import { listInspectionPlan, getInspectionPlan, addInspectionPlan, updateInspectionPlan } from "@/api/deviceInspection/inspectionPlan";
import { addBasicsInfo } from "@/api/workOrder/basicsInfo";
import { inspectorList } from "@/api/system/user";
import { deviceNodeTree } from "@/api/device/deviceInfo";
export default { export default {
name: "InspectionPlan", name: "InspectionPlan",
components: { components: {},
},
data() { data() {
return { return {
// 遮罩层 // 遮罩层
...@@ -197,6 +249,21 @@ export default { ...@@ -197,6 +249,21 @@ export default {
inspectionPlanList: [], inspectionPlanList: [],
// 计划状态字典 // 计划状态字典
typeOptions: [], typeOptions: [],
// 设备级联
options: [],
planId: null,
planName: null,
remarks: null,
props: {
multiple: true,
value: "id",
label: "name",
level: "level",
children: "childList",
},
devices: null,
// 巡检员列表
inspector: [],
// 弹出层标题 // 弹出层标题
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
...@@ -213,9 +280,19 @@ export default { ...@@ -213,9 +280,19 @@ export default {
remarks: null remarks: null
}, },
// 表单参数 // 表单参数
form: {}, form: {
planId: null,
planName: null,
remarks: null
},
// 表单校验 // 表单校验
rules: { rules: {
planName: [
{ required: true, message: "计划名称不能为空", trigger: "blur" }
],
orderName: [
{ required: true, message: "工单名称不能为空", trigger: "blur" }
],
} }
}; };
}, },
...@@ -226,6 +303,10 @@ export default { ...@@ -226,6 +303,10 @@ export default {
}); });
}, },
methods: { methods: {
handleChange(value) {
// this.devices = value;
console.log(this.devices);
},
/** 查询巡检计划列表 */ /** 查询巡检计划列表 */
getList() { getList() {
this.loading = true; this.loading = true;
...@@ -235,6 +316,25 @@ export default { ...@@ -235,6 +316,25 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
/** 详细信息跳转 */
showDetail(row) {
this.$router.push({
path: '/basicsInfo/detail',
query:{
orderId : row.orderId
}
}) //带参跳转
},
getInspectorList(){
this.loading = true;
inspectorList().then(response => {
this.inspector = response.data;
this.loading = false;
});
},
setUserId(val){
this.form.appointInspector = val;
},
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false;
...@@ -268,21 +368,40 @@ export default { ...@@ -268,21 +368,40 @@ export default {
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.planId) this.ids = selection.map(item => item.planId)
this.single = selection.length!==1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
deviceNodeTree().then(response => {
this.options = response.data;
this.open = true; this.open = true;
this.title = "添加巡检计划"; this.title = "添加巡检计划";
});
},
/** 下发按钮操作 */
handleIssue(row) {
this.reset();
this.getInspectorList();
const planId = row.planId || this.ids
getInspectionPlan(planId).then(response => {
this.form = response.data;
this.form.remarks = "";
this.open = true;
this.title = "下发工单";
});
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
deviceNodeTree().then(response => {
this.options = response.data;
});
const planId = row.planId || this.ids const planId = row.planId || this.ids
getInspectionPlan(planId).then(response => { getInspectionPlan(planId).then(response => {
this.form = response.data; this.form = response.data;
this.devices = eval(this.form.deviceIds);
this.open = true; this.open = true;
this.title = "修改巡检计划"; this.title = "修改巡检计划";
}); });
...@@ -291,15 +410,44 @@ export default { ...@@ -291,15 +410,44 @@ export default {
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.planId != null) { if (this.title == "修改巡检计划") {
updateInspectionPlan(this.form).then(response => { updateInspectionPlan(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else if (this.title == "添加巡检计划") {
// 二维数组转字符串(处理设备级联选项的值)
var arr = this.devices;
var arrLen = arr.length;
var str = "[";
for (var i = 0 ;i < arrLen ; i++){
str += "[";
for(var j = 0; j < arr[i].length; j++){
str += arr[i][j];
if(j < arr[i].length-1){
str +=",";
}
}
str += "]";
if(i<arrLen-1){
str+=",";
}
}
str+="]";
this.form.deviceIds = str;
addInspectionPlan(this.form).then(response => { addInspectionPlan(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess("添加成功");
this.open = false;
this.getList();
});
} else if (this.title == "下发工单") {
console.log(this.form);
this.form.resourceId = this.form.planId;
this.form.orderType = "1";
addBasicsInfo(this.form).then(response => {
this.form = response.data;
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
...@@ -309,18 +457,19 @@ export default { ...@@ -309,18 +457,19 @@ export default {
}, },
/** 作废按钮操作 */ /** 作废按钮操作 */
handleIsDel(row) { handleIsDel(row) {
const planName = row.planName; row.isDel = "1";
this.$confirm('是否确认作废巡检计划名称为"' + planName + '"的数据项?', "警告", { this.$confirm('是否确认作废巡检计划名称为"' + this.form.planName + '"的数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function () {
return delInspectionPlan(planIds); return updateInspectionPlan(row);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("已作废");
}).catch(() => {}); }).catch(() => {
});
}, },
} }
}; };
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment