保养计划初始化、巡检工单初始化

yangwl
wws 1 year ago
parent 5dae96df0a
commit a51be53fb6

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询计划工单列表
export function listDeviceOrder(query) {
return request({
url: '/device/deviceOrder/list',
method: 'get',
params: query
});
}
// 查询计划工单详细
export function getDeviceOrder(orderId) {
return request({
url: '/device/deviceOrder/' + orderId,
method: 'get'
});
}
// 新增计划工单
export function addDeviceOrder(data) {
return request({
url: '/device/deviceOrder',
method: 'post',
data: data
});
}
// 修改计划工单
export function updateDeviceOrder(data) {
return request({
url: '/device/deviceOrder',
method: 'put',
data: data
});
}
// 删除计划工单
export function delDeviceOrder(orderId) {
return request({
url: '/device/deviceOrder/' + orderId,
method: 'delete'
});
}

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询保养计划列表
export function listUpkeepPlan(query) {
return request({
url: '/device/upkeepPlan/list',
method: 'get',
params: query
});
}
// 查询保养计划详细
export function getUpkeepPlan(planId) {
return request({
url: '/device/upkeepPlan/' + planId,
method: 'get'
});
}
// 新增保养计划
export function addUpkeepPlan(data) {
return request({
url: '/device/upkeepPlan',
method: 'post',
data: data
});
}
// 修改保养计划
export function updateUpkeepPlan(data) {
return request({
url: '/device/upkeepPlan',
method: 'put',
data: data
});
}
// 删除保养计划
export function delUpkeepPlan(planId) {
return request({
url: '/device/upkeepPlan/' + planId,
method: 'delete'
});
}

@ -0,0 +1,608 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="计划id" prop="planId">
<el-input
v-model="queryParams.planId"
placeholder="请输入计划id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="计划编码" prop="planCode">
<el-input
v-model="queryParams.planCode"
placeholder="请输入计划编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="单号" prop="orderCode">
<el-input
v-model="queryParams.orderCode"
placeholder="请输入单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="车间" prop="planWorkshop">
<el-input
v-model="queryParams.planWorkshop"
placeholder="请输入车间"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="产线" prop="planProdLine">
<el-input
v-model="queryParams.planProdLine"
placeholder="请输入产线"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="循环周期" prop="planLoop">
<el-input
v-model="queryParams.planLoop"
placeholder="请输入循环周期"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="循环执行时间开始" prop="planLoopStart">
<el-date-picker clearable
v-model="queryParams.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="queryParams.planLoopEnd"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择循环执行时间结束">
</el-date-picker>
</el-form-item>
<el-form-item label="实际开始时间" prop="orderStart">
<el-date-picker clearable
v-model="queryParams.orderStart"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择实际开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="实际结束时间" prop="orderEnd">
<el-date-picker clearable
v-model="queryParams.orderEnd"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择实际结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="设备编码" prop="equipmentCode">
<el-input
v-model="queryParams.equipmentCode"
placeholder="请输入设备编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工单费用" prop="orderCost">
<el-input
v-model="queryParams.orderCost"
placeholder="请输入工单费用"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="责任人" prop="planPerson">
<el-input
v-model="queryParams.planPerson"
placeholder="请输入责任人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工单用时" prop="orderCostTime">
<el-input
v-model="queryParams.orderCostTime"
placeholder="请输入工单用时"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="签字" prop="orderSignPerson">
<el-input
v-model="queryParams.orderSignPerson"
placeholder="请输入签字"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工厂" prop="factoryCode">
<el-input
v-model="queryParams.factoryCode"
placeholder="请输入工厂"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段1" prop="attr1">
<el-input
v-model="queryParams.attr1"
placeholder="请输入备用字段1"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段2" prop="attr2">
<el-input
v-model="queryParams.attr2"
placeholder="请输入备用字段2"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段3" prop="attr3">
<el-input
v-model="queryParams.attr3"
placeholder="请输入备用字段3"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="删除标志" prop="delFlag">
<el-input
v-model="queryParams.delFlag"
placeholder="请输入删除标志"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建人" prop="createBy">
<el-input
v-model="queryParams.createBy"
placeholder="请输入创建人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker clearable
v-model="queryParams.createTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择创建时间">
</el-date-picker>
</el-form-item>
<el-form-item label="更新人" prop="updateBy">
<el-input
v-model="queryParams.updateBy"
placeholder="请输入更新人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="更新时间" prop="updateTime">
<el-date-picker clearable
v-model="queryParams.updateTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择更新时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['device:deviceOrder:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['device:deviceOrder:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['device:deviceOrder:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['device:deviceOrder:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="deviceOrderList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="orderId" />
<el-table-column label="计划id" align="center" prop="planId" />
<el-table-column label="计划编码" align="center" prop="planCode" />
<el-table-column label="计划类型" align="center" prop="planType" />
<el-table-column label="单号" align="center" prop="orderCode" />
<el-table-column label="车间" align="center" prop="planWorkshop" />
<el-table-column label="产线" align="center" prop="planProdLine" />
<el-table-column label="循环周期" align="center" prop="planLoop" />
<el-table-column label="循环周期类型" align="center" prop="planLoopType" />
<el-table-column label="循环执行时间开始" align="center" prop="planLoopStart" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.planLoopStart, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="循环执行时间结束" align="center" prop="planLoopEnd" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.planLoopEnd, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="实际开始时间" align="center" prop="orderStart" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.orderStart, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="实际结束时间" align="center" prop="orderEnd" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.orderEnd, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="设备编码" align="center" prop="equipmentCode" />
<el-table-column label="工单状态" align="center" prop="orderStatus" />
<el-table-column label="工单费用" align="center" prop="orderCost" />
<el-table-column label="责任人" align="center" prop="planPerson" />
<el-table-column label="工单用时" align="center" prop="orderCostTime" />
<el-table-column label="签字" align="center" prop="orderSignPerson" />
<el-table-column label="工厂" align="center" prop="factoryCode" />
<el-table-column label="备用字段1" align="center" prop="attr1" />
<el-table-column label="备用字段2" align="center" prop="attr2" />
<el-table-column label="备用字段3" align="center" prop="attr3" />
<el-table-column label="删除标志" align="center" prop="delFlag" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updateBy" />
<el-table-column label="更新时间" align="center" prop="updateTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['device:deviceOrder:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['device:deviceOrder:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改计划工单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="计划id" prop="planId">
<el-input v-model="form.planId" placeholder="请输入计划id" />
</el-form-item>
<el-form-item label="计划编码" prop="planCode">
<el-input v-model="form.planCode" placeholder="请输入计划编码" />
</el-form-item>
<el-form-item label="单号" prop="orderCode">
<el-input v-model="form.orderCode" 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="请输入产线" />
</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-form-item>
<el-form-item label="实际开始时间" prop="orderStart">
<el-date-picker clearable
v-model="form.orderStart"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择实际开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="实际结束时间" prop="orderEnd">
<el-date-picker clearable
v-model="form.orderEnd"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择实际结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="设备编码" prop="equipmentCode">
<el-input v-model="form.equipmentCode" placeholder="请输入设备编码" />
</el-form-item>
<el-form-item label="工单费用" prop="orderCost">
<el-input v-model="form.orderCost" placeholder="请输入工单费用" />
</el-form-item>
<el-form-item label="责任人" prop="planPerson">
<el-input v-model="form.planPerson" placeholder="请输入责任人" />
</el-form-item>
<el-form-item label="工单用时" prop="orderCostTime">
<el-input v-model="form.orderCostTime" placeholder="请输入工单用时" />
</el-form-item>
<el-form-item label="签字" prop="orderSignPerson">
<el-input v-model="form.orderSignPerson" placeholder="请输入签字" />
</el-form-item>
<el-form-item label="工厂" prop="factoryCode">
<el-input v-model="form.factoryCode" placeholder="请输入工厂" />
</el-form-item>
<el-form-item label="备用字段1" prop="attr1">
<el-input v-model="form.attr1" placeholder="请输入备用字段1" />
</el-form-item>
<el-form-item label="备用字段2" prop="attr2">
<el-input v-model="form.attr2" placeholder="请输入备用字段2" />
</el-form-item>
<el-form-item label="备用字段3" prop="attr3">
<el-input v-model="form.attr3" placeholder="请输入备用字段3" />
</el-form-item>
<el-form-item label="删除标志" prop="delFlag">
<el-input v-model="form.delFlag" placeholder="请输入删除标志" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDeviceOrder, getDeviceOrder, delDeviceOrder, addDeviceOrder, updateDeviceOrder } from "@/api/device/deviceOrder";
export default {
name: "DeviceOrder",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
deviceOrderList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
planId: null,
planCode: null,
planType: null,
orderCode: null,
planWorkshop: null,
planProdLine: null,
planLoop: null,
planLoopType: null,
planLoopStart: null,
planLoopEnd: null,
orderStart: null,
orderEnd: null,
equipmentCode: null,
orderStatus: null,
orderCost: null,
planPerson: null,
orderCostTime: null,
orderSignPerson: null,
factoryCode: null,
attr1: null,
attr2: null,
attr3: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询计划工单列表 */
getList() {
this.loading = true;
listDeviceOrder(this.queryParams).then(response => {
this.deviceOrderList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
orderId: null,
planId: null,
planCode: null,
planType: null,
orderCode: null,
planWorkshop: null,
planProdLine: null,
planLoop: null,
planLoopType: null,
planLoopStart: null,
planLoopEnd: null,
orderStart: null,
orderEnd: null,
equipmentCode: null,
orderStatus: null,
orderCost: null,
planPerson: null,
orderCostTime: null,
orderSignPerson: null,
factoryCode: null,
attr1: null,
attr2: null,
attr3: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.orderId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加计划工单";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const orderId = row.orderId || this.ids
getDeviceOrder(orderId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改计划工单";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.orderId != null) {
updateDeviceOrder(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDeviceOrder(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const orderIds = row.orderId || this.ids;
this.$modal.confirm('是否确认删除计划工单编号为"' + orderIds + '"的数据项?').then(function() {
return delDeviceOrder(orderIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('device/deviceOrder/export', {
...this.queryParams
}, `deviceOrder_${new Date().getTime()}.xlsx`)
}
}
};
</script>

@ -0,0 +1,670 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="计划编码" prop="planCode">
<el-input
v-model="queryParams.planCode"
placeholder="请输入计划编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="计划名称" prop="planName">
<el-input
v-model="queryParams.planName"
placeholder="请输入计划名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="车间" prop="planWorkshop">
<el-input
v-model="queryParams.planWorkshop"
placeholder="请输入车间"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="产线" prop="planProdLine">
<el-input
v-model="queryParams.planProdLine"
placeholder="请输入产线"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备名称" prop="equipmentName">
<el-input
v-model="queryParams.equipmentName"
placeholder="请输入设备名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备编码" prop="equipmentCode">
<el-input
v-model="queryParams.equipmentCode"
placeholder="请输入设备编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="循环周期" prop="planLoop">
<el-input
v-model="queryParams.planLoop"
placeholder="请输入循环周期"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="循环周期类型" prop="planLoopType">
<el-select v-model="queryParams.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-form-item>
<el-form-item label="循环执行时间开始" prop="planLoopStart">
<el-date-picker clearable
v-model="queryParams.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="queryParams.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="queryParams.planPerson"
placeholder="请输入巡检人员"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="计划状态" prop="planStatus">
<el-select v-model="queryParams.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 label="是否可生产-限制" prop="planRestrict">
<el-input
v-model="queryParams.planRestrict"
placeholder="请输入是否可生产-限制"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否委外" prop="planOutsource">
<el-input
v-model="queryParams.planOutsource"
placeholder="请输入是否委外"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="委外工单编码" prop="workCode">
<el-input
v-model="queryParams.workCode"
placeholder="请输入委外工单编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工厂" prop="factoryCode">
<el-input
v-model="queryParams.factoryCode"
placeholder="请输入工厂"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段1" prop="attr1">
<el-input
v-model="queryParams.attr1"
placeholder="请输入备用字段1"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段2" prop="attr2">
<el-input
v-model="queryParams.attr2"
placeholder="请输入备用字段2"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段3" prop="attr3">
<el-input
v-model="queryParams.attr3"
placeholder="请输入备用字段3"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="删除标志" prop="delFlag">
<el-input
v-model="queryParams.delFlag"
placeholder="请输入删除标志"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建人" prop="createBy">
<el-input
v-model="queryParams.createBy"
placeholder="请输入创建人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker clearable
v-model="queryParams.createTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择创建时间">
</el-date-picker>
</el-form-item>
<el-form-item label="更新人" prop="updateBy">
<el-input
v-model="queryParams.updateBy"
placeholder="请输入更新人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="更新时间" prop="updateTime">
<el-date-picker clearable
v-model="queryParams.updateTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择更新时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['device:upkeepPlan:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['device:upkeepPlan:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['device:upkeepPlan:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['device:upkeepPlan:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="upkeepPlanList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="planId" />
<el-table-column label="计划编码" align="center" prop="planCode" />
<el-table-column label="计划名称" align="center" prop="planName" />
<el-table-column label="车间" align="center" prop="planWorkshop" />
<el-table-column label="产线" align="center" prop="planProdLine" />
<el-table-column label="设备名称" align="center" prop="equipmentName" />
<el-table-column label="设备编码" align="center" prop="equipmentCode" />
<el-table-column label="循环周期" align="center" prop="planLoop" />
<el-table-column label="循环周期类型" align="center" prop="planLoopType">
<template slot-scope="scope">
<dict-tag :options="dict.type.device_loop_type" :value="scope.row.planLoopType"/>
</template>
</el-table-column>
<el-table-column label="循环执行时间开始" align="center" prop="planLoopStart" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.planLoopStart, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="循环执行时间结束" align="center" prop="planLoopEnd" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.planLoopEnd, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="巡检人员" align="center" prop="planPerson" />
<el-table-column label="计划状态" align="center" prop="planStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.planStatus"/>
</template>
</el-table-column>
<el-table-column label="是否可生产-限制" align="center" prop="planRestrict" />
<el-table-column label="维护类型" align="center" prop="planType" />
<el-table-column label="是否委外" align="center" prop="planOutsource" />
<el-table-column label="委外工单编码" align="center" prop="workCode" />
<el-table-column label="工厂" align="center" prop="factoryCode" />
<el-table-column label="备用字段1" align="center" prop="attr1" />
<el-table-column label="备用字段2" align="center" prop="attr2" />
<el-table-column label="备用字段3" align="center" prop="attr3" />
<el-table-column label="删除标志" align="center" prop="delFlag" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updateBy" />
<el-table-column label="更新时间" align="center" prop="updateTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['device:upkeepPlan:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['device:upkeepPlan:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改保养计划对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item 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="请输入产线" />
</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-form-item>
<el-form-item label="循环周期" prop="planLoop">
<el-input v-model="form.planLoop" placeholder="请输入循环周期" />
</el-form-item>
<el-form-item label="循环周期类型" prop="planLoopType">
<el-select v-model="form.planLoopType" placeholder="请选择循环周期类型">
<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-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-form-item>
<el-form-item label="工厂" prop="factoryCode">
<el-input v-model="form.factoryCode" placeholder="请输入工厂" />
</el-form-item>
<el-form-item label="备用字段1" prop="attr1">
<el-input v-model="form.attr1" placeholder="请输入备用字段1" />
</el-form-item>
<el-form-item label="备用字段2" prop="attr2">
<el-input v-model="form.attr2" placeholder="请输入备用字段2" />
</el-form-item>
<el-form-item label="备用字段3" prop="attr3">
<el-input v-model="form.attr3" placeholder="请输入备用字段3" />
</el-form-item>
<el-form-item label="删除标志" prop="delFlag">
<el-input v-model="form.delFlag" placeholder="请输入删除标志" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listUpkeepPlan, getUpkeepPlan, delUpkeepPlan, addUpkeepPlan, updateUpkeepPlan } from "@/api/device/upkeepPlan";
export default {
name: "UpkeepPlan",
dicts: ['device_loop_type', 'sys_normal_disable'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
upkeepPlanList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
planCode: null,
planName: null,
planWorkshop: null,
planProdLine: null,
equipmentName: null,
equipmentCode: null,
planLoop: null,
planLoopType: null,
planLoopStart: null,
planLoopEnd: null,
planPerson: null,
planStatus: null,
planRestrict: null,
planType: 'maintenance',
planOutsource: null,
workCode: null,
factoryCode: null,
attr1: null,
attr2: null,
attr3: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
},
//
form: {},
//
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" }
]
}
};
},
created() {
this.getList();
},
methods: {
/** 查询保养计划列表 */
getList() {
this.loading = true;
listUpkeepPlan(this.queryParams).then(response => {
this.upkeepPlanList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
planId: null,
planCode: null,
planName: null,
planWorkshop: null,
planProdLine: null,
equipmentName: null,
equipmentCode: null,
planLoop: null,
planLoopType: null,
planLoopStart: null,
planLoopEnd: null,
planPerson: null,
planStatus: null,
planRestrict: null,
planType: 'maintenance',
planOutsource: null,
workCode: null,
factoryCode: null,
attr1: null,
attr2: null,
attr3: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.planId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加保养计划";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const planId = row.planId || this.ids
getUpkeepPlan(planId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改保养计划";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.planId != null) {
updateUpkeepPlan(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addUpkeepPlan(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const planIds = row.planId || this.ids;
this.$modal.confirm('是否确认删除保养计划编号为"' + planIds + '"的数据项?').then(function() {
return delUpkeepPlan(planIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('device/upkeepPlan/export', {
...this.queryParams
}, `upkeepPlan_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save