保养计划-新增

master
wws 1 year ago
parent e369da6d03
commit 73f356e9ca

@ -1,5 +1,14 @@
import request from '@/utils/request' import request from '@/utils/request'
// 获取备件信息list
export function querySpareList(query) {
return request({
url: '/device/sparePartsLedger/list',
method: 'get',
params: query
});
}
// 处理计划-设备信息 // 处理计划-设备信息
export function formatEquItem(data) { export function formatEquItem(data) {
return request({ return request({

@ -25,7 +25,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="产线" prop="planProdLine"> <el-form-item v-if="false" label="产线" prop="planProdLine">
<el-input <el-input
v-model="queryParams.planProdLine" v-model="queryParams.planProdLine"
placeholder="请输入产线" placeholder="请输入产线"
@ -33,7 +33,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="设备名称" prop="equipmentName"> <el-form-item v-if="false" label="设备名称" prop="equipmentName">
<el-input <el-input
v-model="queryParams.equipmentName" v-model="queryParams.equipmentName"
placeholder="请输入设备名称" placeholder="请输入设备名称"
@ -41,7 +41,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="设备编码" prop="equipmentCode"> <el-form-item v-if="false" label="设备编码" prop="equipmentCode">
<el-input <el-input
v-model="queryParams.equipmentCode" v-model="queryParams.equipmentCode"
placeholder="请输入设备编码" placeholder="请输入设备编码"
@ -49,7 +49,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="循环周期" prop="planLoop"> <el-form-item v-if="false" label="循环周期" prop="planLoop">
<el-input <el-input
v-model="queryParams.planLoop" v-model="queryParams.planLoop"
placeholder="请输入循环周期" placeholder="请输入循环周期"
@ -57,7 +57,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="循环周期类型" prop="planLoopType"> <el-form-item v-if="false" label="循环周期类型" prop="planLoopType">
<el-select v-model="queryParams.planLoopType" placeholder="请选择循环周期类型" clearable> <el-select v-model="queryParams.planLoopType" placeholder="请选择循环周期类型" clearable>
<el-option <el-option
v-for="dict in dict.type.device_loop_type" v-for="dict in dict.type.device_loop_type"
@ -67,7 +67,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="循环执行时间开始" prop="planLoopStart"> <el-form-item v-if="false" label="循环执行时间开始" prop="planLoopStart">
<el-date-picker clearable <el-date-picker clearable
v-model="queryParams.planLoopStart" v-model="queryParams.planLoopStart"
type="date" type="date"
@ -75,7 +75,7 @@
placeholder="请选择循环执行时间开始"> placeholder="请选择循环执行时间开始">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="循环执行时间结束" prop="planLoopEnd"> <el-form-item v-if="false" label="循环执行时间结束" prop="planLoopEnd">
<el-date-picker clearable <el-date-picker clearable
v-model="queryParams.planLoopEnd" v-model="queryParams.planLoopEnd"
type="date" type="date"
@ -83,7 +83,7 @@
placeholder="请选择循环执行时间结束"> placeholder="请选择循环执行时间结束">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="巡检人员" prop="planPerson"> <el-form-item v-if="false" label="巡检人员" prop="planPerson">
<el-input <el-input
v-model="queryParams.planPerson" v-model="queryParams.planPerson"
placeholder="请输入巡检人员" placeholder="请输入巡检人员"
@ -101,7 +101,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否可生产-限制" prop="planRestrict"> <el-form-item v-if="false" label="是否可生产-限制" prop="planRestrict">
<el-input <el-input
v-model="queryParams.planRestrict" v-model="queryParams.planRestrict"
placeholder="请输入是否可生产-限制" placeholder="请输入是否可生产-限制"
@ -109,7 +109,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="是否委外" prop="planOutsource"> <el-form-item v-if="false" label="是否委外" prop="planOutsource">
<el-input <el-input
v-model="queryParams.planOutsource" v-model="queryParams.planOutsource"
placeholder="请输入是否委外" placeholder="请输入是否委外"
@ -117,7 +117,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="委外工单编码" prop="workCode"> <el-form-item v-if="false" label="委外工单编码" prop="workCode">
<el-input <el-input
v-model="queryParams.workCode" v-model="queryParams.workCode"
placeholder="请输入委外工单编码" placeholder="请输入委外工单编码"
@ -125,7 +125,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="工厂" prop="factoryCode"> <el-form-item v-if="false" label="工厂" prop="factoryCode">
<el-input <el-input
v-model="queryParams.factoryCode" v-model="queryParams.factoryCode"
placeholder="请输入工厂" placeholder="请输入工厂"
@ -133,7 +133,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="备用字段1" prop="attr1"> <el-form-item v-if="false" label="备用字段1" prop="attr1">
<el-input <el-input
v-model="queryParams.attr1" v-model="queryParams.attr1"
placeholder="请输入备用字段1" placeholder="请输入备用字段1"
@ -141,7 +141,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="备用字段2" prop="attr2"> <el-form-item v-if="false" label="备用字段2" prop="attr2">
<el-input <el-input
v-model="queryParams.attr2" v-model="queryParams.attr2"
placeholder="请输入备用字段2" placeholder="请输入备用字段2"
@ -149,7 +149,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="备用字段3" prop="attr3"> <el-form-item v-if="false" label="备用字段3" prop="attr3">
<el-input <el-input
v-model="queryParams.attr3" v-model="queryParams.attr3"
placeholder="请输入备用字段3" placeholder="请输入备用字段3"
@ -157,7 +157,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="删除标志" prop="delFlag"> <el-form-item v-if="false" label="删除标志" prop="delFlag">
<el-input <el-input
v-model="queryParams.delFlag" v-model="queryParams.delFlag"
placeholder="请输入删除标志" placeholder="请输入删除标志"
@ -212,7 +212,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['device:upkeepPlan:add']" v-hasPermi="['device:upkeepPlan:add']"
>新增</el-button> >新增
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -223,7 +224,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['device:upkeepPlan:edit']" v-hasPermi="['device:upkeepPlan:edit']"
>修改</el-button> >修改
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -234,7 +236,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['device:upkeepPlan:remove']" v-hasPermi="['device:upkeepPlan:remove']"
>删除</el-button> >删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -244,20 +247,22 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['device:upkeepPlan:export']" v-hasPermi="['device:upkeepPlan: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>
<el-table v-loading="loading" :data="upkeepPlanList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="upkeepPlanList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="主键" align="center" prop="planId" /> <el-table-column width="60" align="center" label="序号" type="index"></el-table-column>
<el-table-column v-if="false" label="主键" align="center" prop="planId"/>
<el-table-column label="计划编码" align="center" prop="planCode"/> <el-table-column label="计划编码" align="center" prop="planCode"/>
<el-table-column label="计划名称" align="center" prop="planName"/> <el-table-column label="计划名称" align="center" prop="planName"/>
<el-table-column label="车间" align="center" prop="planWorkshop"/> <el-table-column label="车间" align="center" prop="planWorkshop"/>
<el-table-column label="产线" align="center" prop="planProdLine" /> <el-table-column v-if="false" label="产线" align="center" prop="planProdLine"/>
<el-table-column label="设备名称" align="center" prop="equipmentName" /> <el-table-column v-if="false" label="设备名称" align="center" prop="equipmentName"/>
<el-table-column label="设备编码" align="center" prop="equipmentCode" /> <el-table-column v-if="false" label="设备编码" align="center" prop="equipmentCode"/>
<el-table-column label="循环周期" align="center" prop="planLoop"/> <el-table-column label="循环周期" align="center" prop="planLoop"/>
<el-table-column label="循环周期类型" align="center" prop="planLoopType"> <el-table-column label="循环周期类型" align="center" prop="planLoopType">
<template slot-scope="scope"> <template slot-scope="scope">
@ -274,21 +279,21 @@
<span>{{ parseTime(scope.row.planLoopEnd, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.planLoopEnd, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="巡检人员" align="center" prop="planPerson" /> <el-table-column v-if="false" label="巡检人员" align="center" prop="planPerson"/>
<el-table-column label="计划状态" align="center" prop="planStatus"> <el-table-column label="计划状态" align="center" prop="planStatus">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.planStatus"/> <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.planStatus"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="是否可生产-限制" align="center" prop="planRestrict" /> <el-table-column v-if="false" label="是否可生产-限制" align="center" prop="planRestrict"/>
<el-table-column label="维护类型" align="center" prop="planType" /> <el-table-column v-if="false" label="维护类型" align="center" prop="planType"/>
<el-table-column label="是否委外" align="center" prop="planOutsource" /> <el-table-column v-if="false" label="是否委外" align="center" prop="planOutsource"/>
<el-table-column label="委外工单编码" align="center" prop="workCode" /> <el-table-column v-if="false" label="委外工单编码" align="center" prop="workCode"/>
<el-table-column label="工厂" align="center" prop="factoryCode" /> <el-table-column v-if="false" label="工厂" align="center" prop="factoryCode"/>
<el-table-column label="备用字段1" align="center" prop="attr1" /> <el-table-column v-if="false" label="备用字段1" align="center" prop="attr1"/>
<el-table-column label="备用字段2" align="center" prop="attr2" /> <el-table-column v-if="false" label="备用字段2" align="center" prop="attr2"/>
<el-table-column label="备用字段3" align="center" prop="attr3" /> <el-table-column v-if="false" label="备用字段3" align="center" prop="attr3"/>
<el-table-column label="删除标志" align="center" prop="delFlag" /> <el-table-column v-if="false" label="删除标志" align="center" prop="delFlag"/>
<el-table-column label="创建人" align="center" prop="createBy"/> <el-table-column label="创建人" align="center" prop="createBy"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
@ -309,14 +314,16 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['device:upkeepPlan:edit']" v-hasPermi="['device:upkeepPlan: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:upkeepPlan:remove']" v-hasPermi="['device:upkeepPlan:remove']"
>删除</el-button> >删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -339,7 +346,7 @@
<el-steps :active="upkeepSteps" finish-status="success" align-center> <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-step title="更换备件"></el-step> <el-step v-if="false" title="更换备件"></el-step>
<el-step title="人员"></el-step> <el-step title="人员"></el-step>
</el-steps> </el-steps>
<!-- 保养计划基本信息 --> <!-- 保养计划基本信息 -->
@ -358,12 +365,24 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="6"> <el-col :span="8">
<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-col>
<el-col :offset="1" :span="6" v-if="form.upkeep == 1">
<el-form-item label="循环周期:"> <el-form-item label="循环周期:">
<el-input v-model="form.planLoop" 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" v-if="form.upkeep == 1">
<el-select v-model="form.planLoopType" placeholder="周期" clearable> <el-select v-model="form.planLoopType" placeholder="周期" clearable>
<el-option <el-option
v-for="dict in dict.type.device_loop_type" v-for="dict in dict.type.device_loop_type"
@ -373,18 +392,6 @@
/> />
</el-select> </el-select>
</el-col> </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-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="20"> <el-col :span="20">
@ -394,6 +401,20 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-if="form.calculationRule == 0">
<el-col :span="20">
<el-form-item label-width="100px" label="保养执行时间">
<el-date-picker
@change="changeArray"
v-model="form.planTimeArray"
type="datetimerange"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row> <el-row>
<el-col :span="20"> <el-col :span="20">
<el-form-item label-width="110px" label="是否停机保养:"> <el-form-item label-width="110px" label="是否停机保养:">
@ -437,11 +458,13 @@
width="300"> width="300">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="150"
fixed="right" fixed="right"
label="操作" label="操作"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="editorTheItem(scope.row)" type="text" size="small">编辑</el-button> <el-button @click="editorTheItem(scope.row)" type="text" size="small">标准</el-button>
<el-button @click="selectSpareBtn(scope.row)" type="text" size="small">备件</el-button>
<el-button @click="delTheEquItem(scope.row)" 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>
@ -560,13 +583,211 @@
<el-button type="primary" @click="confirmSelectEquBtn"> </el-button> <el-button type="primary" @click="confirmSelectEquBtn"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<!-- 选择备件弹窗 -->
<el-dialog
title="备件领用"
:visible.sync="spareDialog"
width="50%"
append-to-body
>
<el-tabs type="border-card">
<el-tab-pane label="备件选择">
<el-form :model="spareQuery" ref="queryBPForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="备件编码">
<el-input
v-model="spareQuery.materialCode"
placeholder="请输入备件编码"
clearable
/>
</el-form-item>
<el-form-item label="备件名称">
<el-input
v-model="spareQuery.materialDesc"
placeholder="请输入备件名称"
clearable
/>
</el-form-item>
<el-form-item v-if="false" label="备件类型">
<el-input
v-model="spareQuery.spareType"
placeholder="请输入备件类型"
clearable
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getSpareList"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetSpare"></el-button>
</el-form-item>
</el-form>
<!-- 搜索-备件列表 -->
<el-table
:data="spareList"
v-loading="spareLoading"
stripe
@selection-change="selectChangeSpare"
style="width: 100%">
<el-table-column v-if="false" type="selection" width="55" align="center"/>
<el-table-column
prop="materialCode"
label="备件号">
</el-table-column>
<el-table-column
prop="materialDesc"
label="备件名称">
</el-table-column>
<el-table-column
prop="spareType"
label="备件类型">
</el-table-column>
<el-table-column
prop="amount"
label="库存数量">
</el-table-column>
<el-table-column
width="150"
fixed="right"
label="操作"
>
<template slot-scope="scope">
<el-button @click="addSpareList(scope.row)" type="text" size="small">添加</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="spareTotal>0"
:total="spareTotal"
:page.sync="spareQuery.pageNum"
:limit.sync="spareQuery.pageSize"
@pagination="getSpareList"
/>
<span slot="footer" class="dialog-footer">
<el-button @click="spareDialog = false"> </el-button>
<el-button type="primary" @click="confirmSelectSpareBtn"> </el-button>
</span>
</el-tab-pane>
<el-tab-pane label="备件数量">
<el-row>
<el-col class="my-step-mar" :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="applyNumDialog = true , applyNum = null">
领用数量
</el-button>
</el-col>
</el-row>
<el-table
:data="chooseSpareList"
v-loading="spareLoading"
stripe
@selection-change="selectChangeSpare"
style="width: 100%">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column
prop="materialCode"
label="备件号">
</el-table-column>
<el-table-column
prop="materialDesc"
label="备件名称">
</el-table-column>
<el-table-column
prop="spareType"
label="备件类型">
</el-table-column>
<el-table-column
prop="amount"
label="库存数量">
</el-table-column>
<el-table-column
prop="applyNum"
label="领用数量">
</el-table-column>
<el-table-column
width="150"
fixed="right"
label="操作"
>
<template slot-scope="scope">
<el-button @click="delSpareList(scope.row)" type="text" size="small">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
title="申领数量"
:visible.sync="applyNumDialog"
width="30%"
append-to-body
>
<el-row>
<el-col :span="8" :offset="7">
<el-input-number v-model="applyNum" @change="changeApplySpareNum" :min="1" label="描述文字"></el-input-number>
</el-col>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button v-if="false" @click="applyNumDialog = false"> </el-button>
<el-button type="primary" @click="applyNumDialog = false"> </el-button>
</span>
</el-dialog>
</el-tab-pane>
<el-button type="primary" class="dialog-footer" @click="spareChangeCom"></el-button>
</el-tabs>
</el-dialog>
</div> </div>
<!-- 更换备件 --> <!-- 更换备件 -->
<div class="my-step-body" v-if="this.upkeepSteps==2"> <div class="my-step-body" v-if="false">
更换备件 <el-row>
<el-col class="my-step-mar" :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="selectSpareBtn">
选择备件
</el-button>
</el-col>
</el-row>
<el-table
:data="form.selectSpareList"
stripe
style="width: 100%">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column
prop="materialCode"
label="备件号"
width="180">
</el-table-column>
<el-table-column
prop="materialDesc"
label="备件名称"
width="180">
</el-table-column>
<el-table-column
prop="amount"
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>
</div> </div>
<!-- 人员 --> <!-- 人员 -->
<div class="my-step-body" v-if="this.upkeepSteps==3"> <div class="my-step-body" v-if="this.upkeepSteps==2">
<el-row> <el-row>
<el-col :span="24" :offset="1"> <el-col :span="24" :offset="1">
<el-transfer <el-transfer
@ -585,8 +806,8 @@
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<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 > 0" @click="stepLast"></el-button>
<el-button style="margin-top: 12px;" v-if="this.upkeepSteps < 3" @click="stepNext"></el-button> <el-button style="margin-top: 12px;" v-if="this.upkeepSteps < 2" @click="stepNext"></el-button>
<el-button type="primary" v-if="this.upkeepSteps == 3" @click="submitForm"> </el-button> <el-button type="primary" v-if="this.upkeepSteps == 2" @click="submitForm"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
@ -599,7 +820,7 @@ import {
delUpkeepPlan, delUpkeepPlan,
addUpkeepPlan, addUpkeepPlan,
updateUpkeepPlan, updateUpkeepPlan,
formatEquItem formatEquItem, setSpareList, querySpareList
} from "@/api/device/upkeepPlan"; } from "@/api/device/upkeepPlan";
import {getEquList, getPersonList, getWorkCenter} from "@/api/device/plan"; import {getEquList, getPersonList, getWorkCenter} from "@/api/device/plan";
@ -608,6 +829,22 @@ export default {
dicts: ['device_loop_type', 'sys_normal_disable'], dicts: ['device_loop_type', 'sys_normal_disable'],
data() { data() {
return { return {
//
selOnSpare: [],
//
applyNum: null,
//
applyNumDialog: false,
//
chooseSpareList: [],
//
spareTotal: 0,
// table
spareLoading: false,
//
spareDialog: false,
// list
spareList: [],
// 穿 // 穿
personList: [], personList: [],
selectPersonList: [], selectPersonList: [],
@ -626,6 +863,13 @@ export default {
// list // list
queryEquipment: [], queryEquipment: [],
// //
spareQuery: {
materialCode: null,
materialDesc: null,
pageNum: 1,
pageSize: 10,
},
//
equipmentQuery: { equipmentQuery: {
equipmentCode: null, equipmentCode: null,
equipmentName: null, equipmentName: null,
@ -689,6 +933,7 @@ export default {
}, },
// //
form: { form: {
selectSpareList: [],
equipmentItem: [], equipmentItem: [],
shutDown: '0', shutDown: '0',
calculationRule: '0', calculationRule: '0',
@ -697,6 +942,8 @@ export default {
upkeep: '1', upkeep: '1',
planName: null, planName: null,
planWorkshop: null, planWorkshop: null,
personList:[],
planTimeArray:[],
}, },
// //
rules: {} rules: {}
@ -706,6 +953,194 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
//
spareChangeCom() {
console.log("点击了完成按钮")
console.log(this.chooseSpareList)
console.log("form")
console.log(this.form)
this.spareDialog = false;
},
//
changeApplySpareNum(e) {
for (let i = 0; i < this.selOnSpare.length; i++) {
this.selOnSpare[i].applyNum = e;
}
},
// -
delSpareList(e) {
console.log("删除备件")
console.log(e)
for (let i = 0; i < this.chooseSpareList.length; i++){
if (this.chooseSpareList[i].materialCode == e.materialCode) {
this.chooseSpareList.splice(i,1);
this.$message({
message: '删除成功!',
type: 'success'
})
}
}
},
// -
addSpareList(e) {
console.log("选择备件")
console.log(e)
for (let i = 0; i < this.chooseSpareList.length; i++){
if (this.chooseSpareList[i].materialCode == e.materialCode) {
this.$message({
message: '不可重复添加!',
type: 'warning'
})
return;
}
}
this.chooseSpareList.push(e);
this.$message({
message: '添加成功!',
type: 'success'
})
},
//
changeArray(e) {
console.log(e)
console.log(this.form.planTimeArray)
if (this.form.planLoop == null) {
this.$message({
message: '请输入循环周期!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
if (this.form.planLoopType == null) {
this.$message({
message: '请选择循环类型!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
//
if (this.form.planLoopType == 'day') {
//
let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime();
//
let days = Math.floor(diff / (1000 * 60 * 60 * 24));
if (days > this.form.planLoop) {
this.$message({
message: '可执行时间范围为' + days + '天,循环周期为' + days + '天,超过循环周期' + (days - this.form.planLoop) + '天,请重新选择执行时间!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
}
if (this.form.planLoopType == 'week') {
//
let diff = this.form.planTimeArray[1].getTime() - this.form.planTimeArray[0].getTime();
//
let weeks = Math.floor(diff / (1000 * 60 * 60 * 24 * 7));
if (weeks > (this.form.planLoop / 7)) {
this.$message({
message: '可执行时间范围为' + weeks + '周,循环周期为' + weeks + '周,超过循环周期' + (weeks * 7 - this.form.planLoop) + '天,请重新选择执行时间!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
}
if (this.form.planLoopType == 'month') {
let monthsDiff = (this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear()) * 12 + this.form.planTimeArray[1].getMonth() - this.form.planTimeArray[0].getMonth();
if (monthsDiff > this.form.planLoop) {
this.$message({
message: '可执行时间范围为' + monthsDiff + '月,循环周期为' + monthsDiff + '月,超过循环周期' + (monthsDiff - this.form.planLoop) + '月,请重新选择执行时间!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
}
if (this.form.planLoopType == 'season') {
let monthsDiff = (this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear()) * 12 + this.form.planTimeArray[1].getMonth() - this.form.planTimeArray[0].getMonth();
if (monthsDiff * 3 > this.form.planLoop) {
this.$message({
message: '可执行时间范围为' + monthsDiff * 3 + '季度,循环周期为' + monthsDiff * 3 + '季度,超过循环周期' + (monthsDiff - this.form.planLoop) + '月,请重新选择执行时间!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
}
if (this.form.planLoopType == 'year') {
//
let yearsDiff = this.form.planTimeArray[1].getFullYear() - this.form.planTimeArray[0].getFullYear();
if (yearsDiff > this.form.planLoop) {
this.$message({
message: '可执行时间范围为' + yearsDiff + '年,循环周期为' + yearsDiff + '年,超过循环周期' + (yearsDiff - this.form.planLoop) + '年,请重新选择执行时间!',
type: 'warning'
})
this.form.planTimeArray = [];
return
}
}
},
//
confirmSelectSpareBtn() {
console.log("点击了选择备件确定按钮")
},
//
selectChangeSpare(e) {
console.log("多选改变")
console.log(e)
this.selOnSpare = e;
},
//
resetSpare() {
this.spareQuery = {
materialCode: null,
materialDesc: null,
pageNum: 1,
pageSize: 10,
};
this.setSpareList();
console.log("点击了搜索重置按钮")
},
//
setSpareList() {
querySpareList(this.spareQuery).then(response => {
this.spareTotal = response.total;
this.spareList = response.rows;
this.spareLoading = false;
console.log(response)
})
},
//
getSpareList() {
this.setSpareList()
console.log("点击了搜索备件按钮")
},
//
selectSpareBtn(e) {
console.log("点击了选择备件按钮!")
console.log(e)
this.setSpareList();
if (e.spareList == null) {
e.spareList = [];
}
this.chooseSpareList = e.spareList;
this.spareDialog = true;
},
// List-穿 // List-穿
setPerson() { setPerson() {
getPersonList().then(response => { getPersonList().then(response => {
@ -898,6 +1333,9 @@ export default {
calculationRule: '0', calculationRule: '0',
shutDown: '0', shutDown: '0',
equipmentItem: [], equipmentItem: [],
personList:[],
selectSpareList: [],
planTimeArray:[],
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -965,6 +1403,7 @@ export default {
this.getList(); this.getList();
}); });
} else { } else {
this.form.personList = this.selectPersonList;
addUpkeepPlan(this.form).then(response => { addUpkeepPlan(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
@ -982,7 +1421,8 @@ export default {
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {
});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -1004,6 +1444,6 @@ export default {
} }
.el-transfer-panel { .el-transfer-panel {
width: 270px; width: 250px;
} }
</style> </style>

Loading…
Cancel
Save