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

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

parent b64d106b
......@@ -59,6 +59,23 @@ public class TDeviceInfoController extends BaseController
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;
import java.util.List;
import com.zehong.system.domain.form.InspectionPlanForm;
import com.zehong.system.domain.vo.InspectionPlanVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......
......@@ -28,14 +28,17 @@ public class TInspectionPlan extends BaseEntity
@Excel(name = "工单id")
private String orderId;
/** 设备id */
private String deviceIds;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 地址 */
......@@ -84,7 +87,15 @@ public class TInspectionPlan extends BaseEntity
return orderId;
}
public void setStartTime(Date startTime)
public String getDeviceIds() {
return deviceIds;
}
public void setDeviceIds(String deviceIds) {
this.deviceIds = deviceIds;
}
public void setStartTime(Date 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;
import java.util.List;
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.TPipe;
/**
* 设备信息Service接口
......@@ -40,6 +37,14 @@ public interface ITDeviceInfoService
*/
public List<Map<Object, Object>> buildDeviceTreeSelect(Map<Object, List> param);
/**
* 设备树
*
* @param
* @return 树结构列表
*/
public List<Map<Object, Object>> buildDeviceTree() throws Exception;
/**
* 统计各设备类型的设备总数
* @return
......
package com.zehong.system.service.impl;
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.mapper.TPipeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDeviceInfoMapper;
import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.service.ITDeviceInfoService;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 设备信息Service业务层处理
......@@ -24,6 +21,8 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
{
@Autowired
private TDeviceInfoMapper tDeviceInfoMapper;
@Autowired
private TPipeMapper tPipeMapper;
/**
* 查询设备信息
......@@ -83,6 +82,94 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
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
......
......@@ -3,6 +3,7 @@ package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.form.InspectionPlanForm;
import com.zehong.system.domain.vo.InspectionPlanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TInspectionPlanMapper;
......
......@@ -7,6 +7,7 @@ import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.*;
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.WorkOrderVo;
import com.zehong.system.mapper.*;
......@@ -289,9 +290,8 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
plan.setUpdateTime(DateUtils.getNowDate());
tInspectionPlanMapper.updateTInspectionPlan(plan);
} else if ("0".equals(tWorkOrder.getOrderStatus())){
tWorkOrder.setUpdateTime(DateUtils.getNowDate());
}
tWorkOrder.setUpdateTime(DateUtils.getNowDate());
return tWorkOrderMapper.updateTWorkOrder(tWorkOrder);
}
......
......@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="planId" column="plan_id" />
<result property="planName" column="plan_name" />
<result property="orderId" column="order_id" />
<result property="deviceIds" column="device_ids" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="address" column="address" />
......@@ -19,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<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>
<select id="selectTInspectionPlanList" parameterType="InspectionPlanForm" resultMap="TInspectionPlanResult">
......@@ -47,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planName != null">plan_name,</if>
<if test="orderId != null">order_id,</if>
<if test="deviceIds != null">device_ids,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="address != null">address,</if>
......@@ -59,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planName != null">#{planName},</if>
<if test="orderId != null">#{orderId},</if>
<if test="deviceIds != null">#{deviceIds},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="address != null">#{address},</if>
......@@ -75,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="planName != null">plan_name = #{planName},</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="endTime != null">end_time = #{endTime},</if>
<if test="address != null">address = #{address},</if>
......
......@@ -78,3 +78,11 @@ export function deviceTree(data) {
})
}
// 设备树
export function deviceNodeTree() {
return request({
url: '/device/deviceInfo/deviceNodeTree',
method: 'get'
})
}
......@@ -69,24 +69,25 @@
size="mini"
@click="handleAdd"
v-hasPermi="['deviceInspection:inspectionPlan:add']"
>新增</el-button>
>新增
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="inspectionPlanList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" type="index" align="center" prop="planName" />
<el-table-column label="巡检计划名称" align="center" prop="planName" />
<el-table-column type="selection" width="55" align="center"/>
<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="startTime" width="280">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startTime, '{y}/{m}/{d}') }}</span> -
<span>{{ parseTime(scope.row.endTime, '{y}/{m}/{d}') }}</span>
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="地址" align="center" prop="address" />
<el-table-column label="计划描述" align="center" prop="remarks" />
<el-table-column label="状态" align="center" prop="planStatus" >
<el-table-column label="地址" align="center" prop="address"/>
<el-table-column label="计划描述" align="center" prop="remarks"/>
<el-table-column label="状态" align="center" prop="planStatus">
<template slot-scope="scope">
<span v-if="scope.row.planStatus == 0">未下发</span>
<span v-if="scope.row.planStatus == 1">已下发</span>
......@@ -94,33 +95,41 @@
<span v-if="scope.row.planStatus == 3">已完成</span>
</template>
</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">
<font v-if="scope.row.planStatus != 0">-</font>
<el-button
size="mini"
size="normal"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['deviceInspection:inspectionPlan:edit']"
@click="handleIssue(scope.row)"
v-hasPermi="['workOrder:basicsInfo:add']"
v-if="scope.row.planStatus == 0"
>下发</el-button>
>下发
</el-button>
<el-button
size="mini"
size="normal"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['deviceInspection:inspectionPlan:edit']"
v-if="scope.row.planStatus == 0"
>修改</el-button>
>修改
</el-button>
<el-button
size="normal"
type="text"
icon="el-icon-edit"
@click="showDetail(scope.row)"
>详情</el-button>
<el-button
size="mini"
size="normal"
type="text"
icon="el-icon-delete"
@click="handleIsDel(scope.row)"
v-hasPermi="['deviceInspection:inspectionPlan:edit']"
v-if="scope.row.planStatus == 0"
>作废</el-button>
>作废
</el-button>
</template>
</el-table-column>
</el-table>
......@@ -134,33 +143,74 @@
/>
<!-- 添加或修改巡检计划对话框 -->
<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="planName">
<el-input v-model="form.planName" placeholder="请输入巡检计划名称" />
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<el-date-picker clearable size="small"
v-model="form.startTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-date-picker clearable size="small"
v-model="form.endTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="地址" prop="address">
<el-input v-model="form.address" placeholder="请输入地址" />
</el-form-item>
<el-form-item label="计划描述" prop="remarks">
<el-input type="textarea" v-model="form.remarks" placeholder="请输入计划描述" />
</el-form-item>
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @close="cancel">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<div v-if="this.title != '下发工单'">
<el-form-item label="巡检计划名称" prop="planName">
<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 label="开始时间" prop="startTime">
<el-date-picker clearable size="small"
v-model="form.startTime"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-date-picker clearable size="small"
v-model="form.endTime"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="地址" prop="address">
<el-input v-model="form.address" placeholder="请输入地址"/>
</el-form-item>
<el-form-item label="计划描述" prop="remarks">
<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 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>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
......@@ -171,156 +221,255 @@
</template>
<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 {
name: "InspectionPlan",
components: {
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 巡检计划表格数据
inspectionPlanList: [],
// 计划状态字典
typeOptions: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
planName: null,
orderId: null,
startTime: null,
endTime: null,
planStatus: null,
remarks: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
this.getDicts("t_plan_status").then(response => {
this.typeOptions = response.data;
});
},
methods: {
/** 查询巡检计划列表 */
getList() {
this.loading = true;
listInspectionPlan(this.queryParams).then(response => {
this.inspectionPlanList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
export default {
name: "InspectionPlan",
components: {},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 巡检计划表格数据
inspectionPlanList: [],
// 计划状态字典
typeOptions: [],
// 设备级联
options: [],
planId: null,
planName: null,
orderId: null,
startTime: null,
endTime: null,
planStatus: "0",
updateTime: null,
createTime: null,
remarks: null
remarks: null,
props: {
multiple: true,
value: "id",
label: "name",
level: "level",
children: "childList",
},
devices: null,
// 巡检员列表
inspector: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
planName: null,
orderId: null,
startTime: null,
endTime: null,
planStatus: null,
remarks: null
},
// 表单参数
form: {
planId: null,
planName: null,
remarks: null
},
// 表单校验
rules: {
planName: [
{ required: true, message: "计划名称不能为空", trigger: "blur" }
],
orderName: [
{ required: true, message: "工单名称不能为空", trigger: "blur" }
],
}
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
created() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.planId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加巡检计划";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const planId = row.planId || this.ids
getInspectionPlan(planId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改巡检计划";
this.getDicts("t_plan_status").then(response => {
this.typeOptions = response.data;
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.planId != null) {
updateInspectionPlan(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInspectionPlan(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
methods: {
handleChange(value) {
// this.devices = value;
console.log(this.devices);
},
/** 查询巡检计划列表 */
getList() {
this.loading = true;
listInspectionPlan(this.queryParams).then(response => {
this.inspectionPlanList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 详细信息跳转 */
showDetail(row) {
this.$router.push({
path: '/basicsInfo/detail',
query:{
orderId : row.orderId
}
}
});
},
/** 作废按钮操作 */
handleIsDel(row) {
const planName = row.planName;
this.$confirm('是否确认作废巡检计划名称为"' + planName + '"的数据项?', "警告", {
}) //带参跳转
},
getInspectorList(){
this.loading = true;
inspectorList().then(response => {
this.inspector = response.data;
this.loading = false;
});
},
setUserId(val){
this.form.appointInspector = val;
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
planId: null,
planName: null,
orderId: null,
startTime: null,
endTime: null,
planStatus: "0",
updateTime: null,
createTime: null,
remarks: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.planId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
deviceNodeTree().then(response => {
this.options = response.data;
this.open = true;
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) {
this.reset();
deviceNodeTree().then(response => {
this.options = response.data;
});
const planId = row.planId || this.ids
getInspectionPlan(planId).then(response => {
this.form = response.data;
this.devices = eval(this.form.deviceIds);
this.open = true;
this.title = "修改巡检计划";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.title == "修改巡检计划") {
updateInspectionPlan(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} 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 => {
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.getList();
});
}
}
});
},
/** 作废按钮操作 */
handleIsDel(row) {
row.isDel = "1";
this.$confirm('是否确认作废巡检计划名称为"' + this.form.planName + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delInspectionPlan(planIds);
}).then(function () {
return updateInspectionPlan(row);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
}
};
this.msgSuccess("已作废");
}).catch(() => {
});
},
}
};
</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