Commit 9aa06f49 authored by yaqizhang's avatar yaqizhang

详情页加按钮

parent e8ee48b8
...@@ -178,6 +178,49 @@ ...@@ -178,6 +178,49 @@
</el-col> </el-col>
</el-row> </el-row>
</template> </template>
<div class="" style="width: 95%; height: 60px;margin-left: 50px;text-align: center;" v-if="form.orderId == '' || form.orderId == null">
<el-button
size="normal"
type="primary"
icon="el-icon-edit"
@click="handleIssue(form.alarmId)"
v-hasPermi="['workOrder:basicsInfo:add']">
生成工单
</el-button>
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
<el-form-item label="报警设备" prop="deviceName">
<font>{{ form.deviceName }}</font>
</el-form-item>
<el-form-item label="报警类型" prop="alarmType">
<font>{{ form.alarmType }}</font>
</el-form-item>
<el-form-item label="报警值" prop="alarmValue">
<font>{{ form.alarmValue }}</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.appointInspector" 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>
</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>
</div> </div>
</div> </div>
</template> </template>
...@@ -186,6 +229,7 @@ ...@@ -186,6 +229,7 @@
import { getDeviceAlarm } from "@/api/dataMonitoring/deviceAlarm"; import { getDeviceAlarm } from "@/api/dataMonitoring/deviceAlarm";
import { deviceTree } from "@/api/device/deviceInfo"; import { deviceTree } from "@/api/device/deviceInfo";
import { addBasicsInfo } from "@/api/workOrder/basicsInfo";
import gaodeMap from "utils/gaodeMap.js"; import gaodeMap from "utils/gaodeMap.js";
import { map, DEVICE_TYPE } from "utils/gaodeMap.js"; import { map, DEVICE_TYPE } from "utils/gaodeMap.js";
import { inspectorList } from "@/api/system/user"; import { inspectorList } from "@/api/system/user";
...@@ -201,9 +245,21 @@ export default { ...@@ -201,9 +245,21 @@ export default {
alarmId:'', alarmId:'',
// 折线图标题 // 折线图标题
title: "", title: "",
open: false,
// 巡检员列表
inspector: [],
// 表单参数 // 表单参数
form: { }, form: { },
rule: { }, rule: { },
// 表单校验
rules: {
orderName: [
{ required: true, message: "工单名称不能为空", trigger: "blur" },
],
appointInspector: [
{ required: true, message: "请选择巡检人员", trigger: "blur" },
],
},
}; };
}, },
created() { created() {
...@@ -536,6 +592,48 @@ export default { ...@@ -536,6 +592,48 @@ export default {
}); });
}, },
/** 下发按钮操作 */
handleIssue(alarmId) {
// this.reset();
this.getInspectorList();
// const alarmId = row.alarmId || this.ids;
getDeviceAlarm(alarmId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "填写工单信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
this.form.resourceId = this.form.alarmId;
this.form.orderType = "3";
addBasicsInfo(this.form).then((response) => {
this.msgSuccess("生成工单成功");
this.open = false;
this.getList();
});
}
});
},
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();
},
/** 详细信息跳转 */ /** 详细信息跳转 */
showDetail(orderId) { showDetail(orderId) {
this.$router.push({ this.$router.push({
......
...@@ -120,17 +120,124 @@ ...@@ -120,17 +120,124 @@
</div> </div>
<el-divider></el-divider> <el-divider></el-divider>
<div class="" style="width: 95%; height: 60px;margin-left: 50px;text-align: center;" v-if="form.planStatus == 0">
<el-button
size="normal"
type="primary"
icon="el-icon-edit"
@click="handleIssue(form.planId)"
v-hasPermi="['workOrder:basicsInfo:add']"
>生成工单
</el-button>
<el-button
size="normal"
type="primary"
icon="el-icon-edit"
@click="handleUpdate(form.planId)"
v-hasPermi="['deviceInspection:inspectionPlan:edit']"
>修改
</el-button>
<el-button
size="normal"
type="primary"
icon="el-icon-delete"
@click="handleIsDel(form.planId)"
v-hasPermi="['deviceInspection:inspectionPlan:edit']"
>作废
</el-button>
<el-dialog :title="title1" :visible.sync="open1" width="800px" append-to-body @close="cancel">
<el-form ref="form1" :model="form1" :rules="rules1" label-width="120px">
<el-form-item label="巡检计划名称" prop="planName">
<el-input v-model="form1.planName" placeholder="请输入巡检计划名称"/>
</el-form-item>
<el-form-item label="巡检设备" prop="devices">
<el-cascader
v-model="form1.devices"
:options="options"
:props="props"
:show-all-levels="false"
@change="handleChange"
filterable
clearable
style="width: 640px"
></el-cascader>
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<el-date-picker clearable size="small"
v-model="form1.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="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="form1.address" type="textarea" placeholder="请输入地址"/>
</el-form-item>
<el-form-item label="计划描述" prop="remarks">
<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>
</el-dialog>
<el-dialog :title="title2" :visible.sync="open2" width="800px" append-to-body @close="cancel">
<el-form ref="form2" :model="form2" :rules="rules2" label-width="120px">
<el-form-item label="巡检计划名称">
<font>{{form2.planName}}</font>
</el-form-item>
<el-form-item label="计划时间">
<font>{{ parseTime(form2.startTime, '{y}-{m}-{d}') }} 至
{{ parseTime(form2.endTime, '{y}-{m}-{d}') }}</font>
</el-form-item>
<el-form-item label="地址">
<font>{{form2.address}}</font>
</el-form-item>
<el-form-item label="工单名称" prop="orderName">
<el-input v-model="form2.orderName" placeholder="请输入工单名称" />
</el-form-item>
<el-form-item label="指定执行人员" prop="appointInspector">
<el-select v-model="form2.appointInspector" placeholder="请选择执行人员" clearable size="small" >
<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="form2.remarks" placeholder="请输入工单描述" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm2">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { getInspectionPlan } from "@/api/deviceInspection/inspectionPlan"; import { listInspectionPlan, getInspectionPlan, addInspectionPlan, updateInspectionPlan } from "@/api/deviceInspection/inspectionPlan";
import { addBasicsInfo } from "@/api/workOrder/basicsInfo";
import gaodeMap from "utils/gaodeMap.js"; import gaodeMap from "utils/gaodeMap.js";
import { DEVICE_TYPE} from "utils/gaodeMap.js"; import { DEVICE_TYPE} from "utils/gaodeMap.js";
import { inspectorList } from "@/api/system/user"; import { inspectorList } from "@/api/system/user";
// import { deviceTree } from "@/api/device/deviceInfo"; import { deviceTree } from "@/api/device/deviceInfo";
import { deviceNodeTree } from "@/api/device/deviceInfo";
export default { export default {
name: "InspectionPlanDetail", name: "InspectionPlanDetail",
...@@ -155,12 +262,33 @@ export default { ...@@ -155,12 +262,33 @@ export default {
childList: [] childList: []
} }
], ],
// 巡检计划表单参数
form1: {
},
form2: {
},
// 巡检员列表
inspector: [],
props: {
multiple: true,
value: "id",
label: "name",
level: "level",
children: "childList",
},
// 弹出层标题
title2: "",
// 非单个禁用 // 非单个禁用
single: true, single: true,
// 是否显示弹出层
open1: false,
// 是否显示弹出层
open2: false,
// 非多个禁用 // 非多个禁用
multiple: true, multiple: true,
// 显示搜索条件 // 显示搜索条件
showSearch: true, showSearch: true,
title1: "",
// 总条数 // 总条数
total: 0, total: 0,
// 弹出层标题 // 弹出层标题
...@@ -178,16 +306,44 @@ export default { ...@@ -178,16 +306,44 @@ export default {
planStatus: null, planStatus: null,
remarks: null remarks: null
}, },
// 设备级联
options: [],
// 表单参数 // 表单参数
form: { }, form: { },
// 表单校验 // 表单校验
rules: { rules: {
},
rules1: {
planName: [
{ required: true, message: "请输入计划名称", trigger: "blur" }
],
devices: [
{ required: true, message: "请选择巡检设备", trigger: "blur" }
],
startTime: [
{ required: true, message: "请选择开始时间", trigger: "blur" }
],
endTime: [
{ required: true, message: "请选择结束时间", trigger: "blur" }
],
address: [
{ required: true, message: "请输入地址", trigger: "blur" }
],
},
rules2: {
orderName: [
{ required: true, message: "请输入工单名称", trigger: "blur" }
],
appointInspector: [
{ required: true, message: "请选择巡检人员", trigger: "blur" }
],
} }
}; };
}, },
created() { created() {
// 如果是跳转来的,则接受初始化参数 // 如果是跳转来的,则接受初始化参数
// this.user_id = this.$route.query.id; //详细信息页接收参数 // this.user_id = this.$route.query.id; //详细信息页接收参数
this.getList();
this.planId = this.$route.query.planId; this.planId = this.$route.query.planId;
this.getDetail(); this.getDetail();
}, },
...@@ -197,6 +353,18 @@ export default { ...@@ -197,6 +353,18 @@ export default {
this.getDetail(); this.getDetail();
}, },
methods: { methods: {
/** 查询巡检计划列表 */
getList() {
this.loading = true;
listInspectionPlan(this.queryParams).then(response => {
this.inspectionPlanList = response.rows;
this.total = response.total;
this.loading = false;
});
},
handleChange(value) {
console.log(this.form1.devices);
},
getInspectorList(){ getInspectorList(){
this.loading = true; this.loading = true;
inspectorList().then(response => { inspectorList().then(response => {
...@@ -241,27 +409,134 @@ export default { ...@@ -241,27 +409,134 @@ export default {
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open1 = false;
// this.reset(); this.open2 = false;
this.reset();
},
/** 生成工单提交按钮 */
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();
});
}
});
},
/** 新增修改巡检计划提交按钮 */
submitForm1() {
this.$refs["form1"].validate(valid => {
console.log("form1", this.$refs["form1"]);
if (valid) {
// 二维数组转字符串(处理设备级联选项的值)
var arr = this.form1.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.form1.deviceIds = str;
if (this.title1 == "修改巡检计划") {
updateInspectionPlan(this.form1).then(response => {
this.msgSuccess("修改成功");
this.open1 = false;
this.getList();
});
} else if (this.title1 == "新增巡检计划") {
addInspectionPlan(this.form1).then(response => {
this.msgSuccess("添加成功");
this.open1 = false;
this.getList();
});
}
}
});
},
/** 作废按钮操作 */
handleIsDel(planId) {
// this.form.planId.isDel = "1";
this.$confirm('是否确认作废巡检计划名称为"' + this.form.planName + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return updateInspectionPlan(planId);
}).then(() => {
this.getList();
this.msgSuccess("已作废");
}).catch(() => {
});
}, },
// 表单重置 // 表单重置
reset() { reset() {
this.form = { this.form1 = {
planId: null, planId: null,
planName: null,
orderId: null, orderId: null,
orderType: null, startTime: null,
orderName: null, endTime: null,
orderStatus: "0", planStatus: null,
updateTime: null,
createTime: null, createTime: null,
remarks: null
};
this.resetForm("form1");
this.form2 = {
planId: null,
planName: null,
orderId: null,
orderName: null,
startTime: null,
endTime: null,
planStatus: null,
appointInspector: null, appointInspector: null,
allotTime: null, updateTime: null,
actualInspector: null, createTime: null,
actualTime: null,
remarks: null remarks: null
}; };
this.resetForm("form"); this.resetForm("form2");
}, },
/** 修改按钮操作 */
handleUpdate(planId) {
this.reset();
deviceNodeTree().then(response => {
this.options = response.data;
});
getInspectionPlan(planId).then(response => {
this.form1 = response.data;
this.form1.devices = eval(this.form1.deviceIds);
this.open1 = true;
this.title1 = "修改巡检计划";
});
},
/** 下发按钮操作 */
handleIssue(planId) {
this.getInspectorList();
// const planId = row.planId || this.ids
getInspectionPlan(planId).then(response => {
this.form2 = response.data;
this.form2.remarks = "";
this.open2 = true;
this.title2 = "填写工单信息";
});
},
/** 详细信息跳转 */ /** 详细信息跳转 */
showDetail(orderId) { showDetail(orderId) {
this.$router.push({ this.$router.push({
...@@ -280,14 +555,6 @@ export default { ...@@ -280,14 +555,6 @@ export default {
this.title = "工单信息归档"; this.title = "工单信息归档";
}); });
}, },
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
deviceNodeTree().then(response => {
this.options = response.data;
});
},
} }
} }
</script> </script>
......
...@@ -172,17 +172,194 @@ ...@@ -172,17 +172,194 @@
</i> </i>
</div> </div>
</div> </div>
<div class="" style="width: 95%; height: 60px;margin-left: 50px;text-align: center;" v-if="form.orderId == '' || form.orderId == null">
<el-button
size="normal"
type="primary"
icon="el-icon-edit"
@click="handleIssue(form.troubleId)"
v-hasPermi="['workOrder:basicsInfo:add']"
>生成工单
</el-button>
<el-button
size="normal"
type="primary"
icon="el-icon-edit"
@click="handleUpdate(form.troubleId)"
v-hasPermi="['riskManagement:hiddenTrouble:edit']"
>修改
</el-button>
<el-button
size="normal"
type="primary"
icon="el-icon-delete"
@click="handleIsDel(form.troubleId)"
v-hasPermi="['riskManagement:hiddenTrouble:query']"
>作废
</el-button>
<!-- 添加或修改隐患信息对话框 -->
<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-col>
<el-form-item label="隐患名称" prop="troubleName" style="width: 720px">
<el-input v-model="form1.troubleName" placeholder="请输入隐患名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="隐患类型" prop="troubleType">
<el-select v-model="form1.troubleType" placeholder="请选择隐患类型">
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="隐患级别" prop="troubleLevel">
<el-select v-model="form1.troubleLevel" placeholder="请选择隐患级别">
<el-option
v-for="dict in levelOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="上报人" prop="reportMan">
<el-select v-model="form1.reportMan" placeholder="请选择上报人" clearable size="small" >
<el-option
v-for="item in userList"
:key="item.userId"
:label="item.nickName"
:value="item.userId"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="隐患设备" prop="device">
<el-cascader
v-model="form1.device"
:options="options"
:props="props"
:show-all-levels="false"
@change="handleChange"
filterable
clearable
></el-cascader>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="地址" prop="address" style="width: 720px">
<el-input v-model="form1.address" type="textarea" placeholder="请输入地址" />
</el-form-item>
</el-col>
<el-col>
<el-form-item label="经纬度" prop="longitude">
<el-row>
<el-col :span="8">
<el-input v-model.number="form1.longitude" placeholder="请输入经度" />
</el-col>
<el-col :span="8" style="margin-left: 10px">
<el-input v-model.number="form1.latitude" placeholder="请输入纬度"/>
</el-col>
<el-col :span="5" style="margin-left: 10px">
<el-button type="primary" plain @click="MapdialogFun">选择经纬度</el-button>
</el-col>
</el-row>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="图片上传" prop="pictureUrl">
<MyFileUpload
listType="picture-card"
@resFun="getFileInfo"
@remove="listRemove"
:fileArr="fileList"
/>
<el-input v-show="false" disabled v-model="form1.pictureUrl"></el-input>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="隐患信息" prop="remarks" style="width: 720px">
<el-input v-model="form1.remarks" type="textarea" placeholder="请输入隐患信息" />
</el-form-item>
</el-col>
</el-form>
<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="隐患名称">
<font>{{form2.troubleName}}</font>
</el-form-item>
<el-form-item label="隐患类型">
<font v-if="form2.troubleType == 1">设备老化</font>
<font v-if="form2.troubleType == 2">质保过期</font>
</el-form-item>
<el-form-item label="隐患级别">
<font v-if="form2.troubleLevel == 1">Ⅰ级</font>
<font v-if="form2.troubleLevel == 2">Ⅱ级</font>
<font v-if="form2.troubleLevel == 3">Ⅲ级</font>
</el-form-item>
<el-form-item label="工单名称" prop="orderName" style="width: 720px">
<el-input v-model="form2.orderName" placeholder="请输入工单名称" />
</el-form-item>
<el-form-item label="指定执行人员" prop="appointInspector" >
<el-select v-model="form2.appointInspector" placeholder="请选择执行人员" clearable size="small" style="width: 600px">
<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" style="width: 720px">
<el-input type="textarea" v-model="form2.remarks" placeholder="请输入工单描述" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm2">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<Mapdialog
v-if="loadmap"
:dialogTableVisible="dialogTableVisible"
@dialogcancelFun="dialogcancelFun"
:slat="form1.latitude"
:slng="form1.longitude"
@confirmFun="confirmFun($event)"
></Mapdialog>
</div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { getHiddenTrouble } from "@/api/riskManagement/hiddenTrouble"; import { listHiddenTrouble, getHiddenTrouble, addHiddenTrouble, updateHiddenTrouble, exportHiddenTrouble } from "@/api/riskManagement/hiddenTrouble";
import { addBasicsInfo } from "@/api/workOrder/basicsInfo";
import { inspectorList, allListUser } from "@/api/system/user";
import { deviceNodeTree } from "@/api/device/deviceInfo";
import MyFileUpload from '@/components/MyFileUpload';
import Mapdialog from "@/components/mapDialog/checkDeviceLoaction.vue";
export default { export default {
name: "HiddenTroubleDetail", name: "HiddenTroubleDetail",
components: { components: {
MyFileUpload,
Mapdialog
}, },
data() { data() {
return { return {
...@@ -190,15 +367,103 @@ export default { ...@@ -190,15 +367,103 @@ export default {
isDisplay:false, isDisplay:false,
showAndHide : false, showAndHide : false,
form: { }, form: { },
rules: { }, // 隐患类型字典
typeOptions: [],
levelOptions: [],
// 用户列表
userList: [],
props: {
value: "id",
label: "name",
level: "level",
children: "childList",
},
// 上传文件列表
fileList: [],
// 巡检员列表
inspector: [],
// 表单校验
rules: {
troubleName: [
{ required: true, message: "请输入隐患名称", trigger: "blur" }
],
troubleType: [
{ required: true, message: "请选择隐患类型", trigger: "blur" }
],
troubleLevel: [
{ required: true, message: "请选择隐患级别", trigger: "blur" }
],
reportMan: [
{ required: true, message: "请选择上报人", trigger: "blur" }
],
address: [
{ required: true, message: "请输入地址", trigger: "blur" }
],
pictureUrl: [
{ required: true, message: "请上传图片", trigger: "blur" }
],
longitude: [
{ required: true, message: "请输入经纬度", trigger: "blur" }
],
orderName: [
{ required: true, message: "请输入工单名称", trigger: "blur" }
],
appointInspector: [
{ required: true, message: "请选择巡检人员", trigger: "blur" }
],
},
// 查询参数
queryParams: {
troubleName: null,
troubleType: null,
deviceId: null,
troubleLevel: null,
orderId: null,
longitude: null,
deviceType: null,
latitude: null,
dealStatus: null,
address: null,
remarks: null,
pictureUrl: null,
reportMan: null
},
// 弹出层标题
title1: "",
title2: "",
// 是否显示弹出层
open1: false,
open2: false,
// 表单参数
form1: {},
form2: {},
// 设备级联
options: [],
}; };
}, },
created() { created() {
this.getList();
// 如果是跳转来的,则接受初始化参数 // 如果是跳转来的,则接受初始化参数
this.troubleId = this.$route.query.troubleId; this.troubleId = this.$route.query.troubleId;
this.getDetail(); this.getDetail();
this.getDicts("t_trouble_type").then(response => {
this.typeOptions = response.data;
});
this.getDicts("t_trouble_level").then(response => {
this.levelOptions = response.data;
});
}, },
methods: { methods: {
/** 查询隐患信息列表 */
getList() {
this.loading = true;
listHiddenTrouble(this.queryParams).then(response => {
this.hiddenTroubleList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 获取隐患信息详情 */ /** 获取隐患信息详情 */
getDetail (){ getDetail (){
getHiddenTrouble(this.troubleId).then(response =>{ getHiddenTrouble(this.troubleId).then(response =>{
...@@ -215,6 +480,115 @@ export default { ...@@ -215,6 +480,115 @@ export default {
} }
}) })
}, },
/** 提交按钮 */
submitForm1() {
this.$refs["form1"].validate(valid => {
if (valid) {
if (this.form1.troubleId != null) {
updateHiddenTrouble(this.form1).then(response => {
this.msgSuccess("修改成功");
this.open1 = false;
this.getList();
});
} else {
addHiddenTrouble(this.form1).then(response => {
this.msgSuccess("新增成功");
this.open1 = false;
this.getList();
});
}
}
});
},
getInspectorList(){
this.loading = true;
inspectorList().then(response => {
this.inspector = response.data;
this.loading = false;
});
},
/** 修改按钮操作 */
handleUpdate(troubleId) {
this.reset();
this.getUserList();
deviceNodeTree().then(response => {
this.options = response.data;
});
getHiddenTrouble(troubleId).then(response => {
this.form1 = response.data;
console.log("this.form1", this.form1);
if(this.form1.deviceType != null && this.form1.deviceId != null){
this.form1.device = [this.form1.deviceType, this.form1.deviceId];
}
this.open1 = true;
this.title1 = "修改隐患信息";
if (this.form1.pictureUrl) {
this.fileList.push({
url: this.form1.pictureUrl,
});
}
});
},
cancel() {
this.open1 = false;
this.open2 = false;
this.fileList = [];
this.reset();
},
/** 生成工单提交按钮 */
submitForm2() {
this.$refs["form2"].validate(valid => {
if (valid) {
this.form2.resourceId = this.form2.troubleId;
this.form2.orderType = "2";
addBasicsInfo(this.form2).then(response => {
this.msgSuccess("生成工单成功");
this.open2 = false;
this.getList();
});
}
});
},
/** 下发按钮操作 */
handleIssue(troubleId) {
this.reset();
this.getInspectorList();
getHiddenTrouble(troubleId).then(response => {
this.form2 = response.data;
this.form2.remarks = "";
this.open2 = true;
this.title2 = "填写工单信息";
});
},
getFileInfo(res){
this.form1.pictureUrl = res.url;
},
listRemove(e) {
this.form1.pictureUrl = "";
this.fileList = [];
},
confirmFun(res) {
//确认选择经纬度
this.form1.longitude = res.lng;
this.form1.latitude = res.lat;
},
MapdialogFun() {
this.loadmap = true;
this.dialogTableVisible = true;
},
handleChange(value) {
console.log(this.form1.device);
let arr = this.form1.device;
this.form1.deviceType = arr[0];
this.form1.deviceId = arr[1];
},
getUserList(){
this.loading = true;
allListUser().then(response => {
this.userList = response.data;
this.loading = false;
});
},
// 点击按钮显示隐藏 // 点击按钮显示隐藏
changeDisplay(e) { changeDisplay(e) {
this.isDisplay = !this.isDisplay this.isDisplay = !this.isDisplay
...@@ -235,6 +609,58 @@ export default { ...@@ -235,6 +609,58 @@ export default {
this.showAndHide = false; this.showAndHide = false;
} }
}, },
// 表单重置
reset() {
this.form1 = {
troubleId: null,
troubleType: null,
deviceId: null,
troubleLevel: null,
orderId: null,
longitude: null,
device: null,
deviceType: null,
latitude: null,
dealStatus: null,
updateTime: null,
address: null,
createTime: null,
remarks: null,
pictureUrl: null,
reportMan: null
};
this.resetForm("form1");
this.form2 = {
troubleId: null,
troubleName: null,
troubleType: null,
troubleLevel: null,
orderId: null,
orderName: null,
appointInspector: null,
updateTime: null,
createTime: null,
remarks: null
};
this.resetForm("form2");
},
/** 作废按钮操作 */
handleIsDel(troubleId) {
// this.form.troubleId.isDel = "1";
this.$confirm('是否确认作废隐患名称为"' + this.form.troubleName + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return updateHiddenTrouble(troubleId);
}).then(() => {
this.getList();
this.msgSuccess("已作废");
}).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