巡检计划新增接口初始化

yangwl
wws 1 year ago
parent 6893a07bae
commit 90538f1438

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

@ -325,17 +325,18 @@
<el-steps :active="inspectionPlanStep" finish-status="success" align-center> <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-step title="选择设备、巡检项目"></el-step>
<el-step title="巡检人员"></el-step>
</el-steps> </el-steps>
<!-- 巡检计划基本信息 --> <!-- 巡检计划基本信息 -->
<div class="my-step-body" v-if="this.inspectionPlanStep==0"> <div class="my-step-body" v-if="this.inspectionPlanStep==0">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="计划名称" prop="faultCode"> <el-form-item label="计划名称">
<el-input v-model="form.planName" placeholder="请输入计划名称"/> <el-input v-model="form.planName" placeholder="请输入计划名称"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span=12 :offset="1"> <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 <el-date-picker
v-model="form.planTimeArray" v-model="form.planTimeArray"
type="datetimerange" type="datetimerange"
@ -348,8 +349,8 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="循环周期" prop="faultCode"> <el-form-item label="循环周期">
<el-input v-model="form.planName" placeholder="请输入循环周期"/> <el-input v-model="form.planLoop" placeholder="请输入循环周期"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
@ -363,7 +364,7 @@
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="6" :offset="1"> <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-select v-model="form.planStatus" placeholder="计划状态" clearable>
<el-option <el-option
v-for="dict in dict.type.sys_normal_disable" v-for="dict in dict.type.sys_normal_disable"
@ -375,9 +376,9 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row v-if="false">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="巡检人员" prop="faultCode"> <el-form-item label="巡检人员">
<el-select v-model="form.planPerson" placeholder="请选择巡检人员" clearable> <el-select v-model="form.planPerson" placeholder="请选择巡检人员" clearable>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -392,7 +393,7 @@
type="primary" type="primary"
plain plain
size="mini" size="mini"
@click="selectEqu = true"> @click="selectEquBtn">
选择设备 选择设备
</el-button> </el-button>
</el-col> </el-col>
@ -413,7 +414,7 @@
width="180"> width="180">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="InspectionItem" prop="itemTempName"
label="巡检项" label="巡检项"
width="300"> width="300">
</el-table-column> </el-table-column>
@ -422,8 +423,8 @@
label="操作" label="操作"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="editorItem = true" type="text" size="small">编辑</el-button> <el-button @click="editorTheItem(scope.row)" type="text" size="small">编辑</el-button>
<el-button type="text" size="small">删除</el-button> <el-button @click="delTheEquItem(scope.row)" type="text" size="small">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -433,11 +434,38 @@
:visible.sync="editorItem" :visible.sync="editorItem"
width="50%" width="50%"
append-to-body 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"> <span slot="footer" class="dialog-footer">
<el-button @click="editorItem = false"> </el-button> <el-button type="primary" @click="standardBtn"> </el-button>
<el-button type="primary" @click="editorItem = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<!-- 选择设备弹窗 --> <!-- 选择设备弹窗 -->
@ -511,29 +539,56 @@
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
<!-- 高级设置-弃用 --> <!-- 巡检人员 -->
<div class="my-step-body" v-if="this.inspectionPlanStep==2"> <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>
</div> </div>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button v-if="this.inspectionPlanStep>0" @click="stepLast"></el-button> <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<2" @click="stepNext"></el-button>
<el-button v-if="this.inspectionPlanStep==1" type="primary" @click="submitForm"> </el-button> <el-button v-if="this.inspectionPlanStep==2" type="primary" @click="submitForm"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <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 { export default {
name: "Plan", name: "Plan",
dicts: ['device_loop_type', 'sys_normal_disable'], dicts: ['device_loop_type', 'sys_normal_disable'],
data() { data() {
return { return {
// 穿
personList: [],
selectPersonList: [],
// list
itemDetailList:[],
// loading
detailLoading: false,
// //
selectEquList: [], selectEquList: [],
// loading // loading
@ -639,8 +694,11 @@ export default {
planName: null, planName: null,
planStatus: '0', planStatus: '0',
planPerson: null, planPerson: null,
planLoop:null,
planTimeArray: [], planTimeArray: [],
equipmentItem: [{equipmentCode: 123, itemList: [{itemCode: 111, itemDetail: [{detailCode: 222}]}]}], equipmentItem: [],
personList: [],
planType: "inspection",
}, },
// //
rules: {} rules: {}
@ -650,6 +708,79 @@ export default {
this.getList(); this.getList();
}, },
methods: { 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() { confirmSelectEquBtn() {
// //
@ -669,6 +800,12 @@ export default {
formatEquItem(this.selectEquList).then(response => { formatEquItem(this.selectEquList).then(response => {
console.log("开始格式化设备信息") console.log("开始格式化设备信息")
console.log(response) 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() { stepNext() {
this.getEquList()
this.inspectionPlanStep++; this.inspectionPlanStep++;
}, },
/** 查询计划列表 */ /** 查询计划列表 */
getList() { getList() {
@ -738,7 +873,7 @@ export default {
planPerson: null, planPerson: null,
planStatus: '0', planStatus: '0',
planRestrict: null, planRestrict: null,
planType: null, planType: "inspection",
planOutsource: null, planOutsource: null,
workCode: null, workCode: null,
factoryCode: null, factoryCode: null,
@ -753,7 +888,8 @@ export default {
createTimeArray: [], createTimeArray: [],
updateTimeArray: [], updateTimeArray: [],
planTimeArray: [], planTimeArray: [],
equipmentItem: [{equipmentCode: 123, itemList: [{itemCode: 111, itemDetail: [{detailCode: 222}]}]}], equipmentItem: [],
personList: [],
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -781,7 +917,12 @@ export default {
this.reset(); this.reset();
// //
this.resetQuery(); this.resetQuery();
this.queryEquipment=[]; this.queryEquipment = [];
this.inspectionPlanStep = 0;
this.selectPersonList = [];
this.getEquList();
this.setPerson();
this.open = true; this.open = true;
this.title = "添加计划"; this.title = "添加计划";
}, },
@ -797,15 +938,55 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { 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 => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.planId != null) { if (this.form.planId != null) {
this.form.personList = this.selectPersonList;
updatePlan(this.form).then(response => { updatePlan(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
this.form.personList = this.selectPersonList;
addPlan(this.form).then(response => { addPlan(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
@ -844,4 +1025,7 @@ export default {
.my-step-body { .my-step-body {
margin-top: 15px; margin-top: 15px;
} }
.el-transfer-panel {
width: 300px;
}
</style> </style>

Loading…
Cancel
Save