巡检计划

yangwl
wws 1 year ago
parent ca932a21eb
commit dd2fb856e0

@ -1,5 +1,23 @@
import request from '@/utils/request' import request from '@/utils/request'
// 处理计划-设备信息
export function formatEquItem(data) {
return request({
url: '/device/plan/formatEquItem',
method: 'post',
data: data
});
}
// 获取设备信息list
export function getEquList(equQuery) {
return request({
url: '/device/plan/getEquList',
method: 'get',
params: equQuery
});
}
// 查询计划列表 // 查询计划列表
export function listPlan(query) { export function listPlan(query) {
return request({ return request({

@ -202,7 +202,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['device:inspectionPlan:add']" v-hasPermi="['device:inspectionPlan:add']"
>新增</el-button> >新增
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -213,7 +214,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['device:inspectionPlan:edit']" v-hasPermi="['device:inspectionPlan:edit']"
>修改</el-button> >修改
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -224,7 +226,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['device:inspectionPlan:remove']" v-hasPermi="['device:inspectionPlan:remove']"
>删除</el-button> >删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -234,7 +237,8 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['device:inspectionPlan:export']" v-hasPermi="['device:inspectionPlan:export']"
>导出</el-button> >导出
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -292,14 +296,16 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['device:inspectionPlan:edit']" v-hasPermi="['device:inspectionPlan:edit']"
>修改</el-button> >修改
</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['device:inspectionPlan:remove']" v-hasPermi="['device:inspectionPlan:remove']"
>删除</el-button> >删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -313,88 +319,242 @@
/> />
<!-- 添加或修改计划对话框 --> <!-- 添加或修改计划对话框 -->
<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 ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="计划编码" prop="planCode"> <div class="my-step-mar">
<el-input v-model="form.planCode" placeholder="请输入计划编码" /> <el-steps :active="inspectionPlanStep" finish-status="success" align-center>
</el-form-item> <el-step title="巡检计划基本信息"></el-step>
<el-form-item label="计划名称" prop="planName"> <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-input v-model="form.planName" placeholder="请输入计划名称"/> <el-input v-model="form.planName" placeholder="请输入计划名称"/>
</el-form-item> </el-form-item>
<el-form-item label="车间" prop="planWorkshop"> </el-col>
<el-input v-model="form.planWorkshop" placeholder="请输入车间" /> <el-col :span=12 :offset="1">
</el-form-item> <el-form-item label-width="100px" label="巡检执行时间" prop="faultCode">
<el-form-item label="产线" prop="planProdLine"> <el-date-picker
<el-input v-model="form.planProdLine" placeholder="请输入产线" /> v-model="form.planTimeArray"
</el-form-item> type="datetimerange"
<el-form-item label="设备名称" prop="equipmentName"> range-separator="至"
<el-input v-model="form.equipmentName" placeholder="请输入设备名称" /> start-placeholder="开始时间"
</el-form-item> end-placeholder="结束时间">
<el-form-item label="设备编码" prop="equipmentCode">
<el-input v-model="form.equipmentCode" placeholder="请输入设备编码" />
</el-form-item>
<el-form-item label="循环周期" prop="planLoop">
<el-input v-model="form.planLoop" placeholder="请输入循环周期" />
</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-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="巡检人员" prop="planPerson"> </el-col>
<el-input v-model="form.planPerson" placeholder="请输入巡检人员" /> </el-row>
</el-form-item> <el-row>
<el-form-item label="是否可生产-限制" prop="planRestrict"> <el-col :span="6">
<el-input v-model="form.planRestrict" placeholder="请输入是否可生产-限制" /> <el-form-item label="循环周期" prop="faultCode">
</el-form-item> <el-input v-model="form.planName" placeholder="请输入循环周期"/>
<el-form-item label="是否委外" prop="planOutsource">
<el-input v-model="form.planOutsource" placeholder="请输入是否委外" />
</el-form-item> </el-form-item>
<el-form-item label="委外工单编码" prop="workCode"> </el-col>
<el-input v-model="form.workCode" placeholder="请输入委外工单编码" /> <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-select>
</el-col>
<el-col :span="6" :offset="1">
<el-form-item label-width="100px" label="计划状态" prop="faultCode">
<el-select v-model="form.planStatus" placeholder="计划状态" clearable>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="工厂" prop="factoryCode"> </el-col>
<el-input v-model="form.factoryCode" placeholder="请输入工厂" /> </el-row>
<el-row>
<el-col :span="8">
<el-form-item label="巡检人员" prop="faultCode">
<el-select v-model="form.planPerson" placeholder="请选择巡检人员" clearable>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="备用字段1" prop="attr1"> </el-col>
<el-input v-model="form.attr1" placeholder="请输入备用字段1" /> </el-row>
</div>
<!-- 选择设备巡检项目 -->
<div class="my-step-body" v-if="this.inspectionPlanStep==1">
<el-row>
<el-col class="my-step-mar" :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="selectEqu = true">
选择设备
</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="InspectionItem"
label="巡检项"
width="300">
</el-table-column>
<el-table-column
fixed="right"
label="操作"
>
<template slot-scope="scope">
<el-button @click="editorItem = true" type="text" size="small">编辑</el-button>
<el-button type="text" size="small">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 编辑检查项弹窗 -->
<el-dialog
title="编辑检查项"
:visible.sync="editorItem"
width="50%"
append-to-body
>
<span>这是一段信息</span>
<span slot="footer" class="dialog-footer">
<el-button @click="editorItem = false"> </el-button>
<el-button type="primary" @click="editorItem = false"> </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>
<el-form-item label="备用字段2" prop="attr2"> <el-form-item label="设备名称">
<el-input v-model="form.attr2" placeholder="请输入备用字段2" /> <el-input
v-model="equipmentQuery.equipmentName"
placeholder="请输入设备名称"
clearable
/>
</el-form-item> </el-form-item>
<el-form-item label="备用字段3" prop="attr3"> <el-form-item v-if="false" label="设备类型">
<el-input v-model="form.attr3" placeholder="请输入备用字段3" /> <el-input
v-model="equipmentQuery.equipmentName"
placeholder="请输入设备类型"
clearable
/>
</el-form-item> </el-form-item>
<el-form-item label="删除标志" prop="delFlag"> <el-form-item>
<el-input v-model="form.delFlag" placeholder="请输入删除标志" /> <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-item>
</el-form> </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>
<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.inspectionPlanStep==2">
</div>
</div>
</el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button v-if="this.inspectionPlanStep>0" @click="stepLast"></el-button>
<el-button @click="cancel"> </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>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listPlan, getPlan, delPlan, addPlan, updatePlan } from "@/api/device/plan"; import {listPlan, getPlan, delPlan, addPlan, updatePlan, getEquList, formatEquItem} from "@/api/device/plan";
export default { export default {
name: "Plan", name: "Plan",
dicts: ['device_loop_type', 'sys_normal_disable'],
data() { data() {
return { return {
//
selectEquList: [],
// loading
equLoading: false,
//
equTotal: 0,
// list
queryEquipment: [],
//
equipmentQuery: {
equipmentCode: null,
equipmentName: null,
pageNum: 1,
pageSize: 10,
},
//
selectEqu: false,
//
editorItem: false,
//
inspectionPlanStep: 0,
// //
pickerOptions: { pickerOptions: {
shortcuts: [{ shortcuts: [{
@ -474,16 +634,79 @@ export default {
updateTimeArray: [], updateTimeArray: [],
}, },
// //
form: {}, form: {
planLoopType: 'day',
planName: null,
planStatus: '0',
planPerson: null,
planTimeArray: [],
equipmentItem: [{equipmentCode: 123, itemList: [{itemCode: 111, itemDetail: [{detailCode: 222}]}]}],
},
// //
rules: { rules: {}
}
}; };
}, },
created() { created() {
this.getList(); this.getList();
}, },
methods: { methods: {
//
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 => {
console.log("开始格式化设备信息")
console.log(response)
})
},
//
selectChangeEqu(e) {
console.log("这里!!!!!")
console.log(e)
this.selectEquList = e;
},
//
getEquList() {
this.equLoading = true;
getEquList(this.equipmentQuery).then(response => {
this.equTotal = response.total;
this.queryEquipment = response.rows;
this.equLoading = false;
})
},
//
resetEqu() {
this.equipmentQuery = {
equipmentCode: null,
equipmentName: null,
pageNum: 1,
pageSize: 10,
};
this.getEquList();
},
//
stepLast() {
this.inspectionPlanStep--;
},
// -
stepNext() {
this.getEquList()
this.inspectionPlanStep++;
},
/** 查询计划列表 */ /** 查询计划列表 */
getList() { getList() {
this.loading = true; this.loading = true;
@ -509,11 +732,11 @@ export default {
equipmentName: null, equipmentName: null,
equipmentCode: null, equipmentCode: null,
planLoop: null, planLoop: null,
planLoopType: null, planLoopType: 'day',
planLoopStart: null, planLoopStart: null,
planLoopEnd: null, planLoopEnd: null,
planPerson: null, planPerson: null,
planStatus: null, planStatus: '0',
planRestrict: null, planRestrict: null,
planType: null, planType: null,
planOutsource: null, planOutsource: null,
@ -529,6 +752,8 @@ export default {
updateTime: null, updateTime: null,
createTimeArray: [], createTimeArray: [],
updateTimeArray: [], updateTimeArray: [],
planTimeArray: [],
equipmentItem: [{equipmentCode: 123, itemList: [{itemCode: 111, itemDetail: [{detailCode: 222}]}]}],
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -554,6 +779,9 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
//
this.resetQuery();
this.queryEquipment=[];
this.open = true; this.open = true;
this.title = "添加计划"; this.title = "添加计划";
}, },
@ -595,7 +823,8 @@ export default {
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {
});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -606,3 +835,13 @@ export default {
} }
}; };
</script> </script>
<style>
.my-step-mar {
margin-left: 10px;
margin-right: 10px;
}
.my-step-body {
margin-top: 15px;
}
</style>

Loading…
Cancel
Save