保养计划

master
wws 1 year ago
parent fd76285b78
commit e369da6d03

@ -1,5 +1,14 @@
import request from '@/utils/request'
// 处理计划-设备信息
export function formatEquItem(data) {
return request({
url: '/device/upkeepPlan/formatEquItem',
method: 'post',
data: data
});
}
// 查询保养计划列表
export function listUpkeepPlan(query) {
return request({

@ -1227,6 +1227,6 @@ export default {
}
.el-transfer-panel {
width: 300px;
width: 260px;
}
</style>

@ -330,108 +330,315 @@
/>
<!-- 添加或修改保养计划对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="计划编码" prop="planCode">
<el-form-item v-if="false" label="计划编码" prop="planCode">
<el-input v-model="form.planCode" placeholder="请输入计划编码" />
</el-form-item>
<el-form-item label="计划名称" prop="planName">
<el-input v-model="form.planName" placeholder="请输入计划名称" />
</el-form-item>
<el-form-item label="车间" prop="planWorkshop">
<el-input v-model="form.planWorkshop" placeholder="请输入车间" />
</el-form-item>
<el-form-item label="产线" prop="planProdLine">
<el-input v-model="form.planProdLine" placeholder="请输入产线" />
<div class="my-step-mar">
<el-steps :active="upkeepSteps" 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-steps>
<!-- 保养计划基本信息 -->
<div class="my-step-body" v-if="this.upkeepSteps==0">
<el-row>
<el-col :span="8">
<el-form-item label="保养名称:">
<el-input v-model="form.planName" placeholder="请输入保养名称"/>
</el-form-item>
<el-form-item label="设备名称" prop="equipmentName">
<el-input v-model="form.equipmentName" placeholder="请输入设备名称" />
</el-form-item>
<el-form-item label="设备编码" prop="equipmentCode">
<el-input v-model="form.equipmentCode" placeholder="请输入设备编码" />
</el-col>
<el-col :span=12 :offset="1">
<el-form-item label="保养类型:">
<el-radio v-model="form.upkeep" label="0"></el-radio>
<el-radio v-model="form.upkeep" label="1"></el-radio>
</el-form-item>
<el-form-item label="循环周期" prop="planLoop">
<el-input v-model="form.planLoop" placeholder="请输入循环周期" />
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="循环周期:">
<el-input v-model="form.planLoop" placeholder="请输入循环周期"/>
</el-form-item>
<el-form-item label="循环周期类型" prop="planLoopType">
<el-select v-model="form.planLoopType" placeholder="请选择循环周期类型">
</el-col>
<el-col :span="2">
<el-select v-model="form.planLoopType" placeholder="周期" clearable>
<el-option
v-for="dict in dict.type.device_loop_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
/>
</el-select>
</el-col>
<el-col :span="8" :offset="1">
<el-form-item label="工作中心:">
<el-select v-model="form.planWorkshop" placeholder="工作中心" clearable>
<el-option
v-for="item in workCenterList"
:key="item.factoryCode"
:label="item.factoryName"
:value="item.factoryCode">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="循环执行时间开始" prop="planLoopStart">
<el-date-picker clearable
v-model="form.planLoopStart"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择循环执行时间开始">
</el-date-picker>
</el-form-item>
<el-form-item label="循环执行时间结束" prop="planLoopEnd">
<el-date-picker clearable
v-model="form.planLoopEnd"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择循环执行时间结束">
</el-date-picker>
</el-form-item>
<el-form-item label="巡检人员" prop="planPerson">
<el-input v-model="form.planPerson" placeholder="请输入巡检人员" />
</el-form-item>
<el-form-item label="计划状态" prop="planStatus">
<el-radio-group v-model="form.planStatus">
<el-radio
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="是否可生产-限制" prop="planRestrict">
<el-input v-model="form.planRestrict" placeholder="请输入是否可生产-限制" />
</el-form-item>
<el-form-item label="是否委外" prop="planOutsource">
<el-input v-model="form.planOutsource" placeholder="请输入是否委外" />
</el-form-item>
<el-form-item label="委外工单编码" prop="workCode">
<el-input v-model="form.workCode" placeholder="请输入委外工单编码" />
</el-col>
</el-row>
<el-row>
<el-col :span="20">
<el-form-item label-width="160px" label="计划保养时间计算规则:">
<el-radio v-model="form.calculationRule" label="0"></el-radio>
<el-radio v-model="form.calculationRule" label="1"></el-radio>
</el-form-item>
<el-form-item label="工厂" prop="factoryCode">
<el-input v-model="form.factoryCode" placeholder="请输入工厂" />
</el-col>
</el-row>
<el-row>
<el-col :span="20">
<el-form-item label-width="110px" label="是否停机保养:">
<el-radio v-model="form.shutDown" label="0"></el-radio>
<el-radio v-model="form.shutDown" label="1"></el-radio>
</el-form-item>
<el-form-item label="备用字段1" prop="attr1">
<el-input v-model="form.attr1" placeholder="请输入备用字段1" />
</el-col>
</el-row>
</div>
<!-- 选择设备保养项 -->
<div class="my-step-body" v-if="this.upkeepSteps==1">
<el-row>
<el-col class="my-step-mar" :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="selectEquBtn">
选择设备
</el-button>
</el-col>
</el-row>
<el-table
:data="form.equipmentItem"
stripe
style="width: 100%">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column
prop="equipmentCode"
label="设备编码"
width="180">
</el-table-column>
<el-table-column
prop="equipmentName"
label="设备名称"
width="180">
</el-table-column>
<el-table-column
prop="itemTempName"
label="巡检项"
width="300">
</el-table-column>
<el-table-column
fixed="right"
label="操作"
>
<template slot-scope="scope">
<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>
<!-- 编辑检查项弹窗 -->
<el-dialog
title="编辑检查项"
:visible.sync="editorItem"
width="50%"
append-to-body
>
<!-- 编辑检查标准 -->
<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 type="primary" @click="standardBtn"> </el-button>
</span>
</el-dialog>
<!-- 选择设备弹窗 -->
<el-dialog
title="选择设备"
:visible.sync="selectEqu"
width="50%"
append-to-body
>
<el-form :model="equipmentQuery" ref="queryBPForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="设备编码">
<el-input
v-model="equipmentQuery.equipmentCode"
placeholder="请输入设备编码"
clearable
/>
</el-form-item>
<el-form-item label="备用字段2" prop="attr2">
<el-input v-model="form.attr2" placeholder="请输入备用字段2" />
<el-form-item label="设备名称">
<el-input
v-model="equipmentQuery.equipmentName"
placeholder="请输入设备名称"
clearable
/>
</el-form-item>
<el-form-item label="备用字段3" prop="attr3">
<el-input v-model="form.attr3" placeholder="请输入备用字段3" />
<el-form-item v-if="false" label="设备类型">
<el-input
v-model="equipmentQuery.equipmentName"
placeholder="请输入设备类型"
clearable
/>
</el-form-item>
<el-form-item label="删除标志" prop="delFlag">
<el-input v-model="form.delFlag" placeholder="请输入删除标志" />
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getEquList"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetEqu"></el-button>
</el-form-item>
</el-form>
<!-- 搜索-设备列表 -->
<el-table
:data="queryEquipment"
v-loading="equLoading"
stripe
@selection-change="selectChangeEqu"
style="width: 100%">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column
prop="equipmentCode"
label="设备编码">
</el-table-column>
<el-table-column
prop="equipmentName"
label="设备名称">
</el-table-column>
<el-table-column
prop="equipmentTypeName"
label="设备类型">
</el-table-column>
<el-table-column
prop="workshopName"
label="工作中心">
</el-table-column>
</el-table>
<pagination
v-show="equTotal>0"
:total="equTotal"
:page.sync="equipmentQuery.pageNum"
:limit.sync="equipmentQuery.pageSize"
@pagination="getEquList"
/>
<span slot="footer" class="dialog-footer">
<el-button @click="selectEqu = false"> </el-button>
<el-button type="primary" @click="confirmSelectEquBtn"> </el-button>
</span>
</el-dialog>
</div>
<!-- 更换备件 -->
<div class="my-step-body" v-if="this.upkeepSteps==2">
更换备件
</div>
<!-- 人员 -->
<div class="my-step-body" v-if="this.upkeepSteps==3">
<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 type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
<el-button style="margin-top: 12px;" v-if="this.upkeepSteps > 0" @click="stepLast"></el-button>
<el-button style="margin-top: 12px;" v-if="this.upkeepSteps < 3" @click="stepNext"></el-button>
<el-button type="primary" v-if="this.upkeepSteps == 3" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listUpkeepPlan, getUpkeepPlan, delUpkeepPlan, addUpkeepPlan, updateUpkeepPlan } from "@/api/device/upkeepPlan";
import {
listUpkeepPlan,
getUpkeepPlan,
delUpkeepPlan,
addUpkeepPlan,
updateUpkeepPlan,
formatEquItem
} from "@/api/device/upkeepPlan";
import {getEquList, getPersonList, getWorkCenter} from "@/api/device/plan";
export default {
name: "UpkeepPlan",
dicts: ['device_loop_type', 'sys_normal_disable'],
data() {
return {
// 穿
personList: [],
selectPersonList: [],
// list
workCenterList: [],
// list
itemDetailList: [],
// loading
detailLoading: false,
//
selectEquList: [],
// loading
equLoading: false,
//
equTotal: 0,
// list
queryEquipment: [],
//
equipmentQuery: {
equipmentCode: null,
equipmentName: null,
workshopCode: null,
pageNum: 1,
pageSize: 10,
},
//
selectEqu: false,
//
editorItem: false,
//
upkeepSteps: 0,
//
loading: true,
//
@ -481,76 +688,169 @@ export default {
updateTime: null
},
//
form: {},
form: {
equipmentItem: [],
shutDown: '0',
calculationRule: '0',
planLoopType: 'day',
planLoop: null,
upkeep: '1',
planName: null,
planWorkshop: null,
},
//
rules: {
planCode: [
{ required: true, message: "计划编码不能为空", trigger: "blur" }
],
planName: [
{ required: true, message: "计划名称不能为空", trigger: "blur" }
],
planWorkshop: [
{ required: true, message: "车间不能为空", trigger: "blur" }
],
planProdLine: [
{ required: true, message: "产线不能为空", trigger: "blur" }
],
equipmentName: [
{ required: true, message: "设备名称不能为空", trigger: "blur" }
],
equipmentCode: [
{ required: true, message: "设备编码不能为空", trigger: "blur" }
],
planLoop: [
{ required: true, message: "循环周期不能为空", trigger: "blur" }
],
planLoopType: [
{ required: true, message: "循环周期类型不能为空", trigger: "change" }
],
planLoopStart: [
{ required: true, message: "循环执行时间开始不能为空", trigger: "blur" }
],
planLoopEnd: [
{ required: true, message: "循环执行时间结束不能为空", trigger: "blur" }
],
planPerson: [
{ required: true, message: "巡检人员不能为空", trigger: "blur" }
],
planStatus: [
{ required: true, message: "计划状态不能为空", trigger: "change" }
],
planType: [
{ required: true, message: "维护类型不能为空", trigger: "change" }
],
planOutsource: [
{ required: true, message: "是否委外不能为空", trigger: "blur" }
],
factoryCode: [
{ required: true, message: "工厂不能为空", trigger: "blur" }
],
delFlag: [
{ required: true, message: "删除标志不能为空", trigger: "blur" }
],
createBy: [
{ required: true, message: "创建人不能为空", trigger: "blur" }
],
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
],
updateBy: [
{ required: true, message: "更新人不能为空", trigger: "blur" }
],
updateTime: [
{ required: true, message: "更新时间不能为空", trigger: "blur" }
]
}
rules: {}
};
},
created() {
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;
},
//
setWorkCenter() {
getWorkCenter().then(response => {
this.workCenterList = response.data;
})
},
//
standardBtn() {
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) {
//
this.itemDetailList = [];
//
if (e.equCheckItemList == null) {
// -
for (let i = 0; i < e.equPlanDetailList.length; i++) {
for (let j = 0; j < e.equPlanDetailList[i].equPlanStandardList.length; j++) {
//
e.equPlanDetailList[i].equPlanStandardList[j].itemName = e.equPlanDetailList[i].itemName;
//
if (e.equPlanDetailList[i].equPlanStandardList[j].standardType == "qualitative") {
e.equPlanDetailList[i].equPlanStandardList[j].standardTypeName = "定性";
} else {
e.equPlanDetailList[i].equPlanStandardList[j].standardTypeName = "定量";
}
this.itemDetailList.push(e.equPlanDetailList[i].equPlanStandardList[j]);
}
}
} else {
// -
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) {
this.form.equipmentItem.splice(e.equipmentCode, 1)
},
//
confirmSelectEquBtn() {
//
for (let i = 0; i < this.form.equipmentItem.length; i++) {
for (let j = 0; j < this.selectEquList.length; j++) {
if (this.form.equipmentItem[i].equipmentCode == this.selectEquList[j].equipmentCode) {
this.$message({
message: "存在已选择的设备!",
type: "warning"
})
return
}
}
}
//
formatEquItem(this.selectEquList).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.form.equipmentItem.push(response.data[i]);
}
this.selectEqu = false;
})
},
//
selectChangeEqu(e) {
this.selectEquList = e;
},
//
getEquList() {
this.equLoading = true;
this.equipmentQuery.workshopCode = this.form.planWorkshop;
getEquList(this.equipmentQuery).then(response => {
this.equTotal = response.total;
this.queryEquipment = response.rows;
this.equLoading = false;
})
},
//
selectEquBtn() {
this.getEquList();
this.selectEqu = true;
},
//
stepLast() {
this.upkeepSteps--;
},
//
stepNext() {
this.upkeepSteps++;
},
/** 查询保养计划列表 */
getList() {
this.loading = true;
@ -576,7 +876,7 @@ export default {
equipmentName: null,
equipmentCode: null,
planLoop: null,
planLoopType: null,
planLoopType: 'day',
planLoopStart: null,
planLoopEnd: null,
planPerson: null,
@ -593,10 +893,25 @@ export default {
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null,
upkeep: '1',
calculationRule: '0',
shutDown: '0',
equipmentItem: [],
};
this.resetForm("form");
},
//
resetEqu() {
this.equipmentQuery = {
equipmentCode: null,
equipmentName: null,
workshopCode: null,
pageNum: 1,
pageSize: 10,
};
this.getEquList();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
@ -616,6 +931,15 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.reset();
//
this.resetQuery();
this.queryEquipment = [];
this.upkeepSteps = 0;
this.selectPersonList = [];
this.personList = [];
this.setPerson();
this.setWorkCenter();
this.open = true;
this.title = "添加保养计划";
},
@ -634,6 +958,7 @@ export default {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.planId != null) {
this.form.personList = this.selectPersonList;
updateUpkeepPlan(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
@ -668,3 +993,17 @@ export default {
}
};
</script>
<style>
.my-step-mar {
margin-left: 10px;
margin-right: 10px;
}
.my-step-body {
margin-top: 15px;
}
.el-transfer-panel {
width: 270px;
}
</style>

Loading…
Cancel
Save