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

巡检计划解决indexOf错误

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