巡检计划新增接口初始化

yangwl
wws 1 year ago
parent 6893a07bae
commit 90538f1438

@ -1,5 +1,13 @@
import request from '@/utils/request'
// 查询人员信息
export function getPersonList() {
return request({
url: '/device/plan/getPersonList',
method: 'get'
});
}
// 处理计划-设备信息
export function formatEquItem(data) {
return request({

@ -325,17 +325,18 @@
<el-steps :active="inspectionPlanStep" finish-status="success" align-center>
<el-step title="巡检计划基本信息"></el-step>
<el-step title="选择设备、巡检项目"></el-step>
<el-step title="巡检人员"></el-step>
</el-steps>
<!-- 巡检计划基本信息 -->
<div class="my-step-body" v-if="this.inspectionPlanStep==0">
<el-row>
<el-col :span="8">
<el-form-item label="计划名称" prop="faultCode">
<el-form-item label="计划名称">
<el-input v-model="form.planName" placeholder="请输入计划名称"/>
</el-form-item>
</el-col>
<el-col :span=12 :offset="1">
<el-form-item label-width="100px" label="巡检执行时间" prop="faultCode">
<el-form-item label-width="100px" label="巡检执行时间">
<el-date-picker
v-model="form.planTimeArray"
type="datetimerange"
@ -348,8 +349,8 @@
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="循环周期" prop="faultCode">
<el-input v-model="form.planName" placeholder="请输入循环周期"/>
<el-form-item label="循环周期">
<el-input v-model="form.planLoop" placeholder="请输入循环周期"/>
</el-form-item>
</el-col>
<el-col :span="2">
@ -363,7 +364,7 @@
</el-select>
</el-col>
<el-col :span="6" :offset="1">
<el-form-item label-width="100px" label="计划状态" prop="faultCode">
<el-form-item label-width="100px" label="计划状态">
<el-select v-model="form.planStatus" placeholder="计划状态" clearable>
<el-option
v-for="dict in dict.type.sys_normal_disable"
@ -375,9 +376,9 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-row v-if="false">
<el-col :span="8">
<el-form-item label="巡检人员" prop="faultCode">
<el-form-item label="巡检人员">
<el-select v-model="form.planPerson" placeholder="请选择巡检人员" clearable>
</el-select>
</el-form-item>
@ -392,7 +393,7 @@
type="primary"
plain
size="mini"
@click="selectEqu = true">
@click="selectEquBtn">
选择设备
</el-button>
</el-col>
@ -413,7 +414,7 @@
width="180">
</el-table-column>
<el-table-column
prop="InspectionItem"
prop="itemTempName"
label="巡检项"
width="300">
</el-table-column>
@ -422,8 +423,8 @@
label="操作"
>
<template slot-scope="scope">
<el-button @click="editorItem = true" type="text" size="small">编辑</el-button>
<el-button type="text" size="small">删除</el-button>
<el-button @click="editorTheItem(scope.row)" type="text" size="small">编辑</el-button>
<el-button @click="delTheEquItem(scope.row)" type="text" size="small">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -434,10 +435,37 @@
width="50%"
append-to-body
>
<span>这是一段信息</span>
<!-- 编辑检查标准 -->
<el-table
:data="itemDetailList"
v-loading="detailLoading"
stripe
@selection-change="selectChangeEqu"
style="width: 100%">
<el-table-column width="55" align="center"/>
<el-table-column
prop="itemName"
label="检查项">
</el-table-column>
<el-table-column
prop="standardName"
label="检查标准">
</el-table-column>
<el-table-column
prop="standardTypeName"
label="标准类型">
</el-table-column>
<el-table-column
fixed="right"
label="操作"
>
<template slot-scope="scope">
<el-button @click="delStandard(scope.row)" type="text" size="small">删除</el-button>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="editorItem = false"> </el-button>
<el-button type="primary" @click="editorItem = false"> </el-button>
<el-button type="primary" @click="standardBtn"> </el-button>
</span>
</el-dialog>
<!-- 选择设备弹窗 -->
@ -511,29 +539,56 @@
</span>
</el-dialog>
</div>
<!-- 高级设置-弃用 -->
<!-- 巡检人员 -->
<div class="my-step-body" v-if="this.inspectionPlanStep==2">
<el-row>
<el-col :span="24" :offset="1">
<el-transfer
:titles="['人员','已选择人员']"
filterable
:filter-method="filterMethod"
filter-placeholder="请输入人员名称"
v-model="selectPersonList"
:data="personList">
</el-transfer>
</el-col>
</el-row>
</div>
</div>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button v-if="this.inspectionPlanStep>0" @click="stepLast"></el-button>
<el-button v-if="this.inspectionPlanStep<1" @click="stepNext"></el-button>
<el-button v-if="this.inspectionPlanStep==1" type="primary" @click="submitForm"> </el-button>
<el-button v-if="this.inspectionPlanStep<2" @click="stepNext"></el-button>
<el-button v-if="this.inspectionPlanStep==2" type="primary" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {listPlan, getPlan, delPlan, addPlan, updatePlan, getEquList, formatEquItem} from "@/api/device/plan";
import {
listPlan,
getPlan,
delPlan,
addPlan,
updatePlan,
getEquList,
formatEquItem,
getPersonList
} from "@/api/device/plan";
export default {
name: "Plan",
dicts: ['device_loop_type', 'sys_normal_disable'],
data() {
return {
// 穿
personList: [],
selectPersonList: [],
// list
itemDetailList:[],
// loading
detailLoading: false,
//
selectEquList: [],
// loading
@ -639,8 +694,11 @@ export default {
planName: null,
planStatus: '0',
planPerson: null,
planLoop:null,
planTimeArray: [],
equipmentItem: [{equipmentCode: 123, itemList: [{itemCode: 111, itemDetail: [{detailCode: 222}]}]}],
equipmentItem: [],
personList: [],
planType: "inspection",
},
//
rules: {}
@ -650,6 +708,79 @@ export default {
this.getList();
},
methods: {
// List-穿
setPerson() {
getPersonList().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.personList.push({
label: response.data[i].nickName + '(' + response.data[i].userName + ')',
key: response.data[i].userId,
})
}
});
},
// 穿
filterMethod(query, item) {
return item.label.indexOf(query) > -1;
},
//
selectEquBtn() {
this.selectEqu = true;
},
//
standardBtn() {
console.log("这里是你要确定的数据");
console.log(this.form.equipmentItem)
this.editorItem = false;
},
//
delStandard(e) {
e.showFlag = false;
for (let i = 0; i < this.itemDetailList.length; i++) {
if (this.itemDetailList[i].detailCode == e.detailCode) {
this.itemDetailList[i].showFlag = false;
this.itemDetailList.splice(i,1);
}
}
},
// -
editorTheItem(e) {
console.log(e)
//
this.itemDetailList = [];
//
for (let i = 0; i < e.equCheckItemList.length; i++) {
for (let j = 0; j < e.equCheckItemList[i].equCheckItemDetailList.length; j++) {
//
e.equCheckItemList[i].equCheckItemDetailList[j].itemName = e.equCheckItemList[i].itemName;
// false
if (e.equCheckItemList[i].equCheckItemDetailList[j].showFlag == false) {
e.equCheckItemList[i].equCheckItemDetailList.splice(j,1);
}
//
if (e.equCheckItemList[i].equCheckItemDetailList[j].standardType == "qualitative") {
e.equCheckItemList[i].equCheckItemDetailList[j].standardTypeName = "定性";
}else {
e.equCheckItemList[i].equCheckItemDetailList[j].standardTypeName = "定量";
}
this.itemDetailList.push(e.equCheckItemList[i].equCheckItemDetailList[j]);
}
}
this.editorItem = true;
},
// -
delTheEquItem(e) {
console.log("删除")
console.log(e)
console.log(this.form.equipmentItem)
this.form.equipmentItem.splice(e.equipmentCode, 1)
},
//
confirmSelectEquBtn() {
//
@ -669,6 +800,12 @@ export default {
formatEquItem(this.selectEquList).then(response => {
console.log("开始格式化设备信息")
console.log(response)
for (let i = 0; i < response.data.length; i++) {
this.form.equipmentItem.push(response.data[i]);
}
this.selectEqu = false;
})
},
@ -703,9 +840,7 @@ export default {
},
// -
stepNext() {
this.getEquList()
this.inspectionPlanStep++;
},
/** 查询计划列表 */
getList() {
@ -738,7 +873,7 @@ export default {
planPerson: null,
planStatus: '0',
planRestrict: null,
planType: null,
planType: "inspection",
planOutsource: null,
workCode: null,
factoryCode: null,
@ -753,7 +888,8 @@ export default {
createTimeArray: [],
updateTimeArray: [],
planTimeArray: [],
equipmentItem: [{equipmentCode: 123, itemList: [{itemCode: 111, itemDetail: [{detailCode: 222}]}]}],
equipmentItem: [],
personList: [],
};
this.resetForm("form");
},
@ -782,6 +918,11 @@ export default {
//
this.resetQuery();
this.queryEquipment = [];
this.inspectionPlanStep = 0;
this.selectPersonList = [];
this.getEquList();
this.setPerson();
this.open = true;
this.title = "添加计划";
},
@ -797,15 +938,55 @@ export default {
},
/** 提交按钮 */
submitForm() {
//
if (this.form.planName == null) {
this.$message({
message: '计划名称不能为空!',
type: 'warning'
})
return
}
if (this.form.planLoop == null) {
this.$message({
message: '循环周期不能为空!',
type: 'warning'
})
return
}
if (this.form.planLoopType == null) {
this.$message({
message: '请选择循环周期类型!',
type: 'warning'
})
return
}
if (this.form.planStatus == null) {
this.$message({
message: '请选择计划状态!',
type: 'warning'
})
return
}
if (this.form.planTimeArray.length == 0) {
this.$message({
message: '请选择计划执行时间!',
type: 'warning'
})
return
}
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.planId != null) {
this.form.personList = this.selectPersonList;
updatePlan(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
this.form.personList = this.selectPersonList;
addPlan(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
@ -844,4 +1025,7 @@ export default {
.my-step-body {
margin-top: 15px;
}
.el-transfer-panel {
width: 300px;
}
</style>

Loading…
Cancel
Save