Commit 764b6777 authored by 王晓倩's avatar 王晓倩

巡检计划解决indexOf错误

parent 624e1196
...@@ -290,9 +290,8 @@ export default { ...@@ -290,9 +290,8 @@ export default {
} }
}); });
}, },
/** 工单详细信息跳转 */ /** 详细信息跳转 */
showDetail(row) { showDetail(row) {
this.$router.push({ this.$router.push({
path: '/deviceAlarm/alarmdetail', path: '/deviceAlarm/alarmdetail',
query: { query: {
......
...@@ -143,15 +143,14 @@ ...@@ -143,15 +143,14 @@
/> />
<!-- 添加或修改巡检计划对话框 --> <!-- 添加或修改巡检计划对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @close="cancel"> <el-dialog :title="title1" :visible.sync="open1" width="800px" append-to-body @close="cancel">
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form1" :model="form1" :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="form1.planName" placeholder="请输入巡检计划名称"/>
</el-form-item> </el-form-item>
<el-form-item label="巡检设备" prop="devices"> <el-form-item label="巡检设备" prop="devices">
<el-cascader <el-cascader
v-model="form.devices" v-model="form1.devices"
:options="options" :options="options"
:props="props" :props="props"
:show-all-levels="false" :show-all-levels="false"
...@@ -163,7 +162,7 @@ ...@@ -163,7 +162,7 @@
</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="form1.startTime"
type="date" type="date"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择开始时间"> placeholder="选择开始时间">
...@@ -171,35 +170,41 @@ ...@@ -171,35 +170,41 @@
</el-form-item> </el-form-item>
<el-form-item label="结束时间" prop="endTime"> <el-form-item label="结束时间" prop="endTime">
<el-date-picker clearable size="small" <el-date-picker clearable size="small"
v-model="form.endTime" v-model="form1.endTime"
type="date" type="date"
value-format="yyyy-MM-dd HH:mm:ss" 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="form1.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="form1.remarks" placeholder="请输入计划描述"/>
</el-form-item> </el-form-item>
</div> </el-form>
<div v-if="this.title == '填写工单信息'"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm1"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog :title="title2" :visible.sync="open2" width="800px" append-to-body @close="cancel">
<el-form ref="form2" :model="form2" :rules="rules" label-width="120px">
<el-form-item label="巡检计划名称" prop="plansName"> <el-form-item label="巡检计划名称" prop="plansName">
<font>{{plansName}}</font> <font>{{plansName}}</font>
</el-form-item> </el-form-item>
<el-form-item label="计划时间"> <el-form-item label="计划时间">
<font>{{ parseTime(form.startTime, '{y}-{m}-{d}') }} <font>{{ parseTime(form2.startTime, '{y}-{m}-{d}') }}
{{ parseTime(form.endTime, '{y}-{m}-{d}') }}</font> {{ parseTime(form2.endTime, '{y}-{m}-{d}') }}</font>
</el-form-item> </el-form-item>
<el-form-item label="地址" prop="address"> <el-form-item label="地址" prop="address">
<font>{{form.address}}</font> <font>{{form2.address}}</font>
</el-form-item> </el-form-item>
<el-form-item label="工单名称" prop="orderName"> <el-form-item label="工单名称" prop="orderName">
<el-input v-model="form.orderName" placeholder="请输入工单名称" /> <el-input v-model="form2.orderName" placeholder="请输入工单名称" />
</el-form-item> </el-form-item>
<el-form-item label="指定执行人员" prop="appointInspector"> <el-form-item label="指定执行人员" prop="appointInspector">
<el-select v-model="form.appointInspectorName" placeholder="请选择执行人员" clearable size="small" @change="setUserId"> <el-select v-model="form2.appointInspector" placeholder="请选择执行人员" clearable size="small" @change="setUserId">
<el-option <el-option
v-for="item in inspector" v-for="item in inspector"
:key="item.userId" :key="item.userId"
...@@ -209,12 +214,11 @@ ...@@ -209,12 +214,11 @@
</el-select> </el-select>
</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="form2.remarks" placeholder="请输入工单描述" />
</el-form-item> </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="submitForm2"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
...@@ -264,9 +268,13 @@ ...@@ -264,9 +268,13 @@
// 巡检员列表 // 巡检员列表
inspector: [], inspector: [],
// 弹出层标题 // 弹出层标题
title: "", title1: "",
// 是否显示弹出层
open1: false,
// 弹出层标题
title2: "",
// 是否显示弹出层 // 是否显示弹出层
open: false, open2: false,
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
...@@ -278,8 +286,10 @@ ...@@ -278,8 +286,10 @@
planStatus: null, planStatus: null,
remarks: null remarks: null
}, },
// 表单参数 // 巡检计划表单参数
form: { }, form1: { },
// 工单表单参数
form2: { },
// 表单校验 // 表单校验
rules: { rules: {
planName: [ planName: [
...@@ -344,12 +354,13 @@ ...@@ -344,12 +354,13 @@
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open1 = false;
this.open2 = false;
this.reset(); this.reset();
}, },
// 表单重置 // 表单重置
reset() { reset() {
this.form = { this.form1 = {
planId: null, planId: null,
planName: null, planName: null,
orderId: null, orderId: null,
...@@ -361,7 +372,21 @@ ...@@ -361,7 +372,21 @@
remarks: null remarks: null
}; };
this.devices = null; this.devices = null;
this.resetForm("form"); this.resetForm("form1");
this.form2 = {
planId: null,
planName: null,
orderId: null,
orderName: null,
startTime: null,
endTime: null,
planStatus: "0",
appointInspector: null,
updateTime: null,
createTime: null,
remarks: null
};
this.resetForm("form2");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
...@@ -384,8 +409,8 @@ ...@@ -384,8 +409,8 @@
this.reset(); this.reset();
deviceNodeTree().then(response => { deviceNodeTree().then(response => {
this.options = response.data; this.options = response.data;
this.open = true; this.open1 = true;
this.title = "添加巡检计划"; this.title1 = "添加巡检计划";
}); });
}, },
/** 下发按钮操作 */ /** 下发按钮操作 */
...@@ -394,11 +419,11 @@ ...@@ -394,11 +419,11 @@
this.getInspectorList(); this.getInspectorList();
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.form2 = response.data;
this.plansName = this.form.planName; this.plansName = this.form2.planName;
this.form.remarks = ""; this.form2.remarks = "";
this.open = true; this.open2 = true;
this.title = "填写工单信息"; this.title2 = "填写工单信息";
}); });
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
...@@ -409,66 +434,120 @@ ...@@ -409,66 +434,120 @@
}); });
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.form1 = response.data;
this.form.devices = eval(this.form.deviceIds); this.form1.devices = eval(this.form1.deviceIds);
this.open = true; this.open1 = true;
this.title = "修改巡检计划"; this.title1 = "修改巡检计划";
}); });
}, },
/** 提交按钮 */ /** 新增修改巡检计划提交按钮 */
submitForm() { submitForm1() {
this.$refs["form"].validate(valid => { this.$refs["form1"].validate(valid => {
if (valid) { if (valid) {
if(this.title != "填写工单信息") { // 二维数组转字符串(处理设备级联选项的值)
// 二维数组转字符串(处理设备级联选项的值) var arr = this.form1.devices;
var arr = this.form.devices; var arrLen = arr.length;
var arrLen = arr.length; var str = "[";
var str = "["; for (var i = 0; i < arrLen; i++) {
for (var i = 0; i < arrLen; i++) { str += "[";
str += "["; for (var j = 0; j < arr[i].length; j++) {
for (var j = 0; j < arr[i].length; j++) { str += arr[i][j];
str += arr[i][j]; if (j < arr[i].length - 1) {
if (j < arr[i].length - 1) {
str += ",";
}
}
str += "]";
if (i < arrLen - 1) {
str += ","; str += ",";
} }
} }
str += "]"; str += "]";
this.form.deviceIds = str; if (i < arrLen - 1) {
str += ",";
}
} }
str += "]";
this.form1.deviceIds = str;
if (this.title == "修改巡检计划") { if (this.title1 == "修改巡检计划") {
updateInspectionPlan(this.form).then(response => { updateInspectionPlan(this.form1).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open1 = false;
this.getList(); this.getList();
}); });
} else if (this.title == "添加巡检计划") { } else if (this.title1 == "添加巡检计划") {
addInspectionPlan(this.form).then(response => { addInspectionPlan(this.form1).then(response => {
this.msgSuccess("添加成功"); this.msgSuccess("添加成功");
this.open = false; this.open1 = false;
this.getList();
});
} else if (this.title == "填写工单信息") {
this.form.resourceId = this.form.planId;
this.form.orderType = "1";
addBasicsInfo(this.form).then(response => {
this.msgSuccess("生成工单成功");
this.open = false;
this.getList(); this.getList();
}); });
} }
} }
}); });
}, },
/** 生成工单提交按钮 */
submitForm2() {
this.$refs["form2"].validate(valid => {
if (valid) {
this.form2.resourceId = this.form2.planId;
this.form2.orderType = "1";
addBasicsInfo(this.form2).then(response => {
this.msgSuccess("生成工单成功");
this.open2 = false;
this.getList();
});
}
});
},
// /** 提交按钮 */
// submitForm() {
// this.$refs["form"].validate(valid => {
// if (valid) {
// if(this.title != "填写工单信息") {
// // 二维数组转字符串(处理设备级联选项的值)
// var arr = this.form.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;
// }
//
// if (this.title == "修改巡检计划") {
// updateInspectionPlan(this.form).then(response => {
// this.msgSuccess("修改成功");
// this.open = false;
// this.getList();
// });
// } else if (this.title == "添加巡检计划") {
// addInspectionPlan(this.form).then(response => {
// this.msgSuccess("添加成功");
// this.open = false;
// this.getList();
// });
// } else if (this.title == "填写工单信息") {
// this.form.resourceId = this.form.planId;
// this.form.orderType = "1";
// addBasicsInfo(this.form).then(response => {
// this.msgSuccess("生成工单成功");
// this.open = false;
// this.getList();
// });
// }
// }
// });
// },
/** 作废按钮操作 */ /** 作废按钮操作 */
handleIsDel(row) { handleIsDel(row) {
row.isDel = "1"; row.isDel = "1";
this.$confirm('是否确认作废巡检计划名称为"' + this.form.planName + '"的数据项?', "警告", { this.$confirm('是否确认作废巡检计划名称为"' + row.planName + '"的数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
v-model="queryParams.startAllotTime" v-model="queryParams.startAllotTime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
type="datetime" type="datetime"
placeholder="请选择始时间" placeholder="请选择始时间"
align="right"> align="right">
</el-date-picker> </el-date-picker>
<font color="#C0C4CC"></font> <font color="#C0C4CC"></font>
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
v-model="queryParams.endAllotTime" v-model="queryParams.endAllotTime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
type="datetime" type="datetime"
placeholder="请选择结束时间" placeholder="请选择截止时间"
align="right"> align="right">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
<el-input v-model="form.orderName" placeholder="请输入工单名称" /> <el-input v-model="form.orderName" placeholder="请输入工单名称" />
</el-form-item> </el-form-item>
<el-form-item label="指定执行人员" prop="appointInspector"> <el-form-item label="指定执行人员" prop="appointInspector">
<el-select v-model="form.appointInspectorName" placeholder="请选择执行人员" clearable size="small" @change="setUserId"> <el-select v-model="form.appointInspector" placeholder="请选择执行人员" clearable size="small" @change="setUserId">
<el-option <el-option
v-for="item in inspector" v-for="item in inspector"
:key="item.userId" :key="item.userId"
......
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