first commit
This commit is contained in:
508
src/views/mes/dv/checkplan/index.vue
Normal file
508
src/views/mes/dv/checkplan/index.vue
Normal file
@ -0,0 +1,508 @@
|
||||
<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="planType">
|
||||
<el-select v-model="queryParams.planType" placeholder="请选择类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.dv_plan_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.mes_order_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</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="['mes:dv:checkplan: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="['mes:dv:checkplan: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="['mes:dv:checkplan: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="['mes:dv:checkplan:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="checkplanList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="方案编号" align="center" prop="planCode" >
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
@click="handleView(scope.row)"
|
||||
v-hasPermi="['mes:dv:checkplan:query']"
|
||||
>{{scope.row.planCode}}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="方案名称" align="center" prop="planName" />
|
||||
<el-table-column label="方案类型" align="center" width="120px" prop="planType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.dv_plan_type" :value="scope.row.planType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开始日期" align="center" prop="startDate" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束日期" align="center" prop="endDate" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="频率" width="100px" align="center" prop="cycleType">
|
||||
<template slot-scope="scope">
|
||||
<span style="display: inline-flex;">
|
||||
{{scope.row.cycleCount}}
|
||||
<dict-tag :options="dict.type.mes_cycle_type" :value="scope.row.cycleType"/>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="130px" 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-if="scope.row.status =='PREPARE'"
|
||||
v-hasPermi="['mes:dv:checkplan:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-if="scope.row.status =='PREPARE'"
|
||||
v-hasPermi="['mes:dv:checkplan:remove']"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-video-pause"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-if="scope.row.status =='FINISHED'"
|
||||
v-hasPermi="['mes:dv:checkplan:edit']"
|
||||
>停用</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="960px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="方案编码" prop="planCode">
|
||||
<el-input v-model="form.planCode" placeholder="请输入方案编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item label-width="80">
|
||||
<el-switch v-model="autoGenFlag"
|
||||
active-color="#13ce66"
|
||||
active-text="自动生成"
|
||||
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="方案名称" prop="planName">
|
||||
<el-input v-model="form.planName" placeholder="请输入方案名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="方案类型" prop="planType" >
|
||||
<el-select v-model="form.planType" placeholder="请选择方案类型">
|
||||
<el-option
|
||||
v-for="dict in dict.type.dv_plan_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="频率" prop="cycleCount">
|
||||
<el-tooltip content="这里的频率指的是每隔多长周期进行一次点检或保养,例如每隔1个月进行一次点检,则频率为1 月。">
|
||||
<el-input-number :min="1" :max="99999999" :step="1" v-model="form.cycleCount" placeholder="请输入次数" />
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4" >
|
||||
<el-form-item prop="cycleType" label-width="80">
|
||||
<el-select v-model="form.cycleType" placeholder="请选择频率">
|
||||
<el-option
|
||||
v-for="dict in dict.type.mes_cycle_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="开始日期" prop="startDate">
|
||||
<el-date-picker clearable
|
||||
v-model="form.startDate"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择开始日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="结束日期" prop="endDate">
|
||||
<el-date-picker clearable
|
||||
v-model="form.endDate"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择结束日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-tabs type="border-card" v-if="form.planId != null">
|
||||
<el-tab-pane label="设备清单">
|
||||
<Checkmachinery ref="machinerylist" :optType="optType" :planId="form.planId" ></Checkmachinery>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="form.planType=='CHECK'?'点检项目':'保养项目'">
|
||||
<Checksubject ref="subjectlist" :optType="optType" :planId="form.planId" ></Checksubject>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" v-if="form.status =='PREPARE' && optType !='view' ">保存</el-button>
|
||||
<el-button type="success" @click="handleFinish" v-if="form.status =='PREPARE' && optType !='view' && form.planId !=null">启用</el-button>
|
||||
<el-button type="success" @click="handleDeFinish" v-if="form.status =='FINISHED' && optType !='view' && form.planId !=null">停用</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCheckplan, getCheckplan, delCheckplan, addCheckplan, updateCheckplan } from "@/api/mes/dv/checkplan";
|
||||
import Checkmachinery from "./machinery.vue"
|
||||
import Checksubject from "./subject.vue"
|
||||
import {genCode} from "@/api/system/autocode/rule"
|
||||
export default {
|
||||
name: "Checkplan",
|
||||
dicts: ['mes_cycle_type','mes_order_status','dv_plan_type'],
|
||||
components:{Checkmachinery,Checksubject},
|
||||
data() {
|
||||
return {
|
||||
autoGenFlag: false,
|
||||
optType: null,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备点检方案头表格数据
|
||||
checkplanList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
planCode: null,
|
||||
planName: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
cycleType: null,
|
||||
cycleCount: null,
|
||||
status: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
planCode: [
|
||||
{ required: true, message: "方案编码不能为空", trigger: "blur" },
|
||||
{ max: 64, message: "字段过长", trigger: "blur" }
|
||||
],
|
||||
planName: [
|
||||
{ required: true, message: "方案名称不能为空", trigger: "blur" },
|
||||
{ max: 100, message: "字段过长", trigger: "blur" }
|
||||
],
|
||||
planType:[
|
||||
{ required: true, message: "方案类型不能为空", trigger: "blur" }
|
||||
],
|
||||
cycleType: [
|
||||
{ required: true, message: "请选择点检频率", trigger: "blur" }
|
||||
],
|
||||
cycleCount: [
|
||||
{ required: true, message: "请输入点检次数", trigger: "blur" }
|
||||
],
|
||||
remark: [
|
||||
{ max: 250, message: '长度必须小于250个字符', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备点检方案头列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCheckplan(this.queryParams).then(response => {
|
||||
this.checkplanList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
planId: null,
|
||||
planCode: null,
|
||||
planName: null,
|
||||
planType: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
cycleType: null,
|
||||
cycleCount: null,
|
||||
status: 'PREPARE',
|
||||
remark: null,
|
||||
attr1: null,
|
||||
attr2: null,
|
||||
attr3: null,
|
||||
attr4: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.autoGenFlag = false;
|
||||
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 = "添加方案";
|
||||
this.optType = "add";
|
||||
},
|
||||
// 查询明细按钮操作
|
||||
handleView(row){
|
||||
this.reset();
|
||||
const planId = row.planId || this.ids;
|
||||
getCheckplan(planId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "查看方案信息";
|
||||
this.optType = "view";
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const planId = row.planId || this.ids
|
||||
getCheckplan(planId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改方案";
|
||||
this.optType = "edit";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.planId != null) {
|
||||
updateCheckplan(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addCheckplan(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
handleFinish(){
|
||||
if(this.form.planId != null && this.form.status =='PREPARE'){
|
||||
this.form.status='FINISHED';
|
||||
updateCheckplan(this.form).then(response => {
|
||||
this.$modal.msgSuccess("已启用");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
},err =>{
|
||||
this.form.status='PREPARE';
|
||||
});
|
||||
}
|
||||
},
|
||||
handleDeFinish(){
|
||||
if(this.form.planId != null && this.form.status =='FINISHED'){
|
||||
this.form.status='PREPARE';
|
||||
updateCheckplan(this.form).then(response => {
|
||||
this.$modal.msgSuccess("已停用");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
},err =>{
|
||||
this.form.status='FINISHED';
|
||||
});
|
||||
}
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const planIds = row.planId || this.ids;
|
||||
this.$modal.confirm('是否确认删除方案编号为"' + planIds + '"的数据项?').then(function() {
|
||||
return delCheckplan(planIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('mes/dv/checkplan/export', {
|
||||
...this.queryParams
|
||||
}, `checkplan_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
//自动生成编码
|
||||
handleAutoGenChange(autoGenFlag){
|
||||
if(autoGenFlag){
|
||||
genCode('CHECKPLAN_CODE').then(response =>{
|
||||
this.form.planCode = response;
|
||||
});
|
||||
}else{
|
||||
this.form.planCode = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
154
src/views/mes/dv/checkplan/machinery.vue
Normal file
154
src/views/mes/dv/checkplan/machinery.vue
Normal file
@ -0,0 +1,154 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
v-if="optType !='view'"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['mes:dv:checkplan:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
v-if="optType !='view'"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['mes:dv:checkplan:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
<MachinerySelect ref="machinerySelect" @onSelected="onMachineryAdd"></MachinerySelect>
|
||||
<el-table v-loading="loading" :data="checkmachineryList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="设备编码" align="center" prop="machineryCode" />
|
||||
<el-table-column label="设备名称" align="center" prop="machineryName" />
|
||||
<el-table-column label="品牌" align="center" prop="machineryBrand" />
|
||||
<el-table-column label="规格型号" align="center" prop="machinerySpec" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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-delete"
|
||||
v-if="optType !='view'"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['mes:dv:checkplan: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"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCheckmachinery, delCheckmachinery, addCheckmachinery } from "@/api/mes/dv/checkmachinery";
|
||||
import MachinerySelect from "@/components/machinerySelect/index.vue";
|
||||
export default {
|
||||
name: "Checkmachinery",
|
||||
components:{MachinerySelect},
|
||||
props:{
|
||||
planId: null,
|
||||
optType: null
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 点检设备表格数据
|
||||
checkmachineryList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
planId: this.planId,
|
||||
machineryId: null,
|
||||
machineryCode: null,
|
||||
machineryName: null,
|
||||
machineryBrand: null,
|
||||
machinerySpec: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询点检设备列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCheckmachinery(this.queryParams).then(response => {
|
||||
this.checkmachineryList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.recordId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.$refs.machinerySelect.showFlag = true;
|
||||
},
|
||||
//设备资源选择回调
|
||||
onMachineryAdd(rows){
|
||||
if(rows !=null && rows.length >0){
|
||||
rows.forEach(row => {
|
||||
row.planId = this.planId;
|
||||
addCheckmachinery(row).then(response =>{
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const recordIds = row.recordId || this.ids;
|
||||
this.$modal.confirm('是否确认删除点检设备编号为"' + recordIds + '"的数据项?').then(function() {
|
||||
return delCheckmachinery(recordIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
152
src/views/mes/dv/checkplan/subject.vue
Normal file
152
src/views/mes/dv/checkplan/subject.vue
Normal file
@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<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-if="optType !='view'"
|
||||
v-hasPermi="['mes:dv:checkplan:add']"
|
||||
>新增</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-if="optType !='view'"
|
||||
v-hasPermi="['mes:dv:checkplan:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
<DvsubjectSelect ref="subjectSelect" subjectType="CHECK" @onSelected="onSubjectSelected"></DvsubjectSelect>
|
||||
|
||||
<el-table v-loading="loading" :data="checksubjectList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="项目名称" align="center" prop="subjectName" width="150px"/>
|
||||
<el-table-column label="项目内容" align="center" width="350px" prop="subjectContent" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="标准" align="center" width="300px" prop="subjectStandard" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="操作" align="center" v-if="optType !='view'" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['mes:dv:checkplan: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"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listChecksubject, getChecksubject, delChecksubject, addChecksubject, updateChecksubject } from "@/api/mes/dv/checksubject";
|
||||
import DvsubjectSelect from "@/components/dvsubjectSelect/multi.vue"
|
||||
export default {
|
||||
name: "Checksubject",
|
||||
props:{
|
||||
planId: null,
|
||||
optType: null
|
||||
},
|
||||
components:{DvsubjectSelect},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
selectedRows: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 点检项目表格数据
|
||||
checksubjectList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
planId: this.planId,
|
||||
subjectId: null,
|
||||
subjectCode: null,
|
||||
subjectName: null,
|
||||
subjectType: null,
|
||||
subjectContent: null,
|
||||
subjectStandard: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询点检项目列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listChecksubject(this.queryParams).then(response => {
|
||||
this.checksubjectList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.recordId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.$refs.subjectSelect.showFlag = true;
|
||||
},
|
||||
onSubjectSelected(rows){
|
||||
if(rows != null && rows.length >0){
|
||||
rows.forEach(row => {
|
||||
row.planId= this.planId;
|
||||
addChecksubject(row).then(response => {
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const recordIds = row.recordId || this.ids;
|
||||
this.$modal.confirm('是否确认删除点检项目编号为"' + recordIds + '"的数据项?').then(function() {
|
||||
return delChecksubject(recordIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
436
src/views/mes/dv/checkrecord/index.vue
Normal file
436
src/views/mes/dv/checkrecord/index.vue
Normal file
@ -0,0 +1,436 @@
|
||||
<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="machineryCode">
|
||||
<el-input
|
||||
v-model="queryParams.machineryCode"
|
||||
placeholder="请输入设备编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="machineryName">
|
||||
<el-input
|
||||
v-model="queryParams.machineryName"
|
||||
placeholder="请输入设备名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="点检时间" prop="checkTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.checkTime"
|
||||
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="['mes:dv:checkrecord: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="['mes:dv:checkrecord: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="['mes:dv:checkrecord:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="checkrecordList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="设备编码" align="center" prop="machineryCode" >
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
@click="handleView(scope.row)"
|
||||
v-hasPermi="['mes:dv:checkrecord:query']"
|
||||
>{{scope.row.machineryCode}}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备名称" align="center" prop="machineryName" />
|
||||
<el-table-column label="品牌" align="center" prop="machineryBrand" />
|
||||
<el-table-column label="规格型号" align="center" prop="machinerySpec" />
|
||||
<el-table-column label="计划编码" align="center" prop="planCode" />
|
||||
<el-table-column label="计划名称" align="center" prop="planName" />
|
||||
<el-table-column label="点检人" align="center" prop="nickName" />
|
||||
<el-table-column label="点检时间" align="center" prop="checkTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.checkTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>
|
||||
</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"
|
||||
v-if="scope.row.status =='PREPARE'"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['mes:dv:checkrecord:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
v-if="scope.row.status =='PREPARE'"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['mes:dv:checkrecord: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="960px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备编码" prop="machineryCode">
|
||||
<el-input v-model="form.machineryCode" placeholder="请选择设备" >
|
||||
<el-button slot="append" @click="handleSelectMachinery" icon="el-icon-search"></el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<MachinerySelectSingle ref="machinerySelect" @onSelected="onMachineryAdd"></MachinerySelectSingle>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备名称" prop="machineryName">
|
||||
<el-input v-model="form.machineryName" readonly="readonly" placeholder="请选择设备" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="品牌" prop="machineryBrand">
|
||||
<el-input v-model="form.machineryBrand" readonly="readonly" placeholder="请选择设备" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="规格型号" prop="machinerySpec">
|
||||
<el-input v-model="form.machinerySpec" readonly="readonly" type="textarea" placeholder="请选择设备" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="点检计划" prop="planName">
|
||||
<el-input v-model="form.planName" placeholder="请选择设备点检计划" >
|
||||
<el-button slot="append" @click="handleSelectPlan" icon="el-icon-search"></el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<CheckplanSelect ref="checkplanSelect" planType="CHECK" @onSelected="onPlanAdd"></CheckplanSelect>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="点检人" prop="nickName">
|
||||
<el-input v-model="form.nickName" placeholder="请选择点检人" >
|
||||
<el-button slot="append" @click="handleUserSelect" icon="el-icon-search"></el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<UserSingleSelect ref="userSelect" @onSelected="onUserSelected"></UserSingleSelect>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="点检时间" prop="checkTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.checkTime"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择点检时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-divider v-if="form.recordId !=null" content-position="center">点检项目</el-divider>
|
||||
<el-card shadow="always" v-if="form.recordId !=null" class="box-card">
|
||||
<CheckRecordLine ref="checkRecordLine" :optType="optType" :recordId="form.recordId"></CheckRecordLine>
|
||||
</el-card>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE' ">返 回</el-button>
|
||||
<el-button type="primary" @click="submitForm" v-if="optType !=='view' && form.status =='PREPARE' " >保 存</el-button>
|
||||
<el-button type="success" @click="handleFinish" v-if="optType !=='view' && form.status =='PREPARE' " >提 交</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCheckrecord, getCheckrecord, delCheckrecord, addCheckrecord, updateCheckrecord } from "@/api/mes/dv/checkrecord";
|
||||
import MachinerySelectSingle from "@/components/machinerySelect/single.vue";
|
||||
import CheckplanSelect from "@/components/dvplanSelect/index.vue";
|
||||
import CheckRecordLine from "./line.vue";
|
||||
import UserSingleSelect from "@/components/userSelect/single.vue"
|
||||
export default {
|
||||
name: "Checkrecord",
|
||||
dicts: ['mes_order_status'],
|
||||
components:{ MachinerySelectSingle, CheckplanSelect, CheckRecordLine, UserSingleSelect},
|
||||
data() {
|
||||
return {
|
||||
optType: null,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备点检记录表格数据
|
||||
checkrecordList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
planId: null, planCode: null, planName: null, planType: null, machineryId: null, machineryCode: null, machineryName: null, machineryBrand: null, machinerySpec: null, checkTime: null, nickName: null, status: null, },
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
machineryId: [
|
||||
{ required: true, message: "设备ID不能为空", trigger: "blur" }
|
||||
], machineryCode: [
|
||||
{ required: true, message: "设备编码不能为空", trigger: "blur" }
|
||||
],
|
||||
checkTime: [
|
||||
{ required: true, message: "点检时间不能为空", trigger: "blur" }
|
||||
], }
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备点检记录列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCheckrecord(this.queryParams).then(response => {
|
||||
this.checkrecordList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
recordId: null, planId: null, planCode: null, planName: null, planType: null, machineryId: null, machineryCode: null, machineryName: null, machineryBrand: null, machinerySpec: null, checkTime: this.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"), status: "PREPARE", remark: null, attr1: null, attr2: null, attr3: null, attr4: null, createBy: null, createTime: null, updateBy: null, updateTime: null };
|
||||
this.form.userId= this.$store.state.user.id;
|
||||
this.form.nickName= this.$store.state.user.nick;
|
||||
this.form.userName= this.$store.state.user.name;
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.recordId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加设备点检记录";
|
||||
this.optType = "add";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const recordId = row.recordId || this.ids
|
||||
getCheckrecord(recordId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改设备点检记录";
|
||||
this.optType = "edit";
|
||||
});
|
||||
},
|
||||
handleView(row) {
|
||||
this.reset();
|
||||
const recordId = row.recordId || this.ids
|
||||
getCheckrecord(recordId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "查看设备点检记录";
|
||||
this.optType = "view";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.recordId != null) {
|
||||
updateCheckrecord(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addCheckrecord(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
handleFinish(){
|
||||
if(this.form.recordId != null && this.form.status =='PREPARE'){
|
||||
this.form.status='FINISHED';
|
||||
updateCheckrecord(this.form).then(response => {
|
||||
this.$modal.msgSuccess("已提交");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
},err =>{
|
||||
this.form.status='PREPARE';
|
||||
});
|
||||
}
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const recordIds = row.recordId || this.ids;
|
||||
this.$modal.confirm('是否确认删除设备点检记录编号为"' + recordIds + '"的数据项?').then(function() {
|
||||
return delCheckrecord(recordIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
handleSelectMachinery(){
|
||||
debugger;
|
||||
this.$refs.machinerySelect.showFlag = true;
|
||||
},
|
||||
|
||||
//设备资源选择回调
|
||||
onMachineryAdd(obj){
|
||||
if(obj !=null && obj != undefined){
|
||||
this.form.machineryId = obj.machineryId;
|
||||
this.form.machineryCode = obj.machineryCode;
|
||||
this.form.machineryName = obj.machineryName;
|
||||
this.form.machineryBrand = obj.machineryBrand;
|
||||
this.form.machinerySpec = obj.machinerySpec;
|
||||
}
|
||||
},
|
||||
|
||||
handleSelectPlan(){
|
||||
this.$refs.checkplanSelect.showFlag = true;
|
||||
},
|
||||
|
||||
onPlanAdd(obj){
|
||||
if(obj !=null && obj != undefined){
|
||||
this.form.planId = obj.planId;
|
||||
this.form.planCode = obj.planCode;
|
||||
this.form.planName = obj.planName;
|
||||
this.form.planType = obj.planType;
|
||||
}
|
||||
},
|
||||
|
||||
//点击人员选择按钮
|
||||
handleUserSelect(){
|
||||
this.$refs.userSelect.showFlag = true;
|
||||
},
|
||||
//人员选择返回
|
||||
onUserSelected(row){
|
||||
this.form.userId = row.userId;
|
||||
this.form.nickName = row.nickName;
|
||||
this.form.userName = row.userName;
|
||||
},
|
||||
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('dv/checkrecord/export', {
|
||||
...this.queryParams
|
||||
}, `checkrecord_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
277
src/views/mes/dv/checkrecord/line.vue
Normal file
277
src/views/mes/dv/checkrecord/line.vue
Normal file
@ -0,0 +1,277 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="10" v-if="optType !== 'view'" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['dv:checkrecordline: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="['dv:checkrecordline: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="['dv:checkrecordline:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="checkrecordlineList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="项目名称" align="center" prop="subjectName" />
|
||||
<el-table-column label="检查内容" align="center" prop="subjectContent" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="标准" align="center" prop="subjectStandard" />
|
||||
<el-table-column label="点检结果" align="center" prop="checkStatus" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.dv_cm_result_status" :value="scope.row.checkStatus"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="异常描述" align="center" prop="checkResult" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="操作" align="center" v-if="optType !== 'view'" 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="['dv:checkrecordline:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['dv:checkrecordline: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="960px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="项目名称" prop="subjectName">
|
||||
<el-input v-model="form.subjectName" placeholder="请选择检查项目" >
|
||||
<el-button slot="append" @click="handleSelectSubject" icon="el-icon-search"></el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<DvSubjectSelect ref="subjectSelect" subjectType="CHECK" @onSelected="onSubjectSelected"></DvSubjectSelect>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="标准" prop="subjectStandard">
|
||||
<el-input v-model="form.subjectStandard" placeholder="请输入标准" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="项目内容">
|
||||
<el-input type="textarea" v-model="form.subjectContent" :min-height="192"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="点检结果">
|
||||
<el-radio-group v-model="form.checkStatus">
|
||||
<el-radio label="Y">正常</el-radio>
|
||||
<el-radio label="N">异常</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.checkStatus === 'N'" label="异常描述" prop="checkResult">
|
||||
<el-input v-model="form.checkResult" type="textarea" 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 { listCheckrecordline, getCheckrecordline, delCheckrecordline, addCheckrecordline, updateCheckrecordline } from "@/api/mes/dv/checkrecordline";
|
||||
import DvSubjectSelect from "@/components/dvsubjectSelect/single.vue";
|
||||
export default {
|
||||
name: "Checkrecordline",
|
||||
props:{
|
||||
optType: null,
|
||||
recordId: null,
|
||||
},
|
||||
dicts: ['dv_cm_result_status'],
|
||||
components:{ DvSubjectSelect },
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备点检记录行表格数据
|
||||
checkrecordlineList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
recordId: this.recordId, subjectId: null, subjectCode: null, subjectName: null, subjectType: null, subjectContent: null, subjectStandard: null, checkStatus: null, checkResult: null, },
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
recordId: [
|
||||
{ required: true, message: "计划ID不能为空", trigger: "blur" }
|
||||
], subjectId: [
|
||||
{ required: true, message: "项目ID不能为空", trigger: "blur" }
|
||||
], subjectCode: [
|
||||
{ required: true, message: "项目编码不能为空", trigger: "blur" }
|
||||
], subjectContent: [
|
||||
{ required: true, message: "项目内容不能为空", trigger: "blur" }
|
||||
], checkStatus: [
|
||||
{ required: true, message: "点检结果不能为空", trigger: "blur" }
|
||||
], }
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备点检记录行列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCheckrecordline(this.queryParams).then(response => {
|
||||
this.checkrecordlineList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
lineId: null, recordId: this.recordId, subjectId: null, subjectCode: null, subjectName: null, subjectType: null, subjectContent: null, subjectStandard: null, checkStatus: "Y", checkResult: null, attr1: null, attr2: null, attr3: null, attr4: 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.lineId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加设备点检记录行";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const lineId = row.lineId || this.ids
|
||||
getCheckrecordline(lineId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改设备点检记录行";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.lineId != null) {
|
||||
updateCheckrecordline(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addCheckrecordline(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const lineIds = row.lineId || this.ids;
|
||||
this.$modal.confirm('是否确认删除设备点检记录行编号为"' + lineIds + '"的数据项?').then(function() {
|
||||
return delCheckrecordline(lineIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
handleSelectSubject(){
|
||||
this.$refs.subjectSelect.showFlag = true;
|
||||
},
|
||||
onSubjectSelected(obj){
|
||||
if(obj){
|
||||
this.form.subjectId = obj.subjectId;
|
||||
this.form.subjectCode = obj.subjectCode;
|
||||
this.form.subjectName = obj.subjectName;
|
||||
this.form.subjectType = obj.subjectType;
|
||||
this.form.subjectContent = obj.subjectContent;
|
||||
this.form.subjectStandard = obj.subjectStandard;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
82
src/views/mes/dv/machinery/components/Checkplan.vue
Normal file
82
src/views/mes/dv/machinery/components/Checkplan.vue
Normal file
@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<el-table v-loading="loading" :data="checkplanList">
|
||||
<el-table-column label="计划编码" align="center" prop="planCode" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column label="计划名称" align="center" width="200px" prop="planName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="开始日期" align="center" prop="startDate" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束日期" align="center" prop="endDate" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="频率" align="center" prop="cycleType">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.cycleCount}}
|
||||
<dict-tag :options="dict.type.mes_cycle_type" :value="scope.row.cycleType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- <pagination-->
|
||||
<!-- v-show="total>0"-->
|
||||
<!-- :total="total"-->
|
||||
<!-- :page.sync="queryParams.pageNum"-->
|
||||
<!-- :limit.sync="queryParams.pageSize"-->
|
||||
<!-- @pagination="getList"-->
|
||||
<!-- />-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {getCheckPlan} from "@/api/mes/dv/checkplan";
|
||||
|
||||
export default {
|
||||
name: "CheckPlan",
|
||||
dicts: ['mes_cycle_type','mes_order_status','dv_plan_type'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: false,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 点检 / 保养数据
|
||||
checkplanList: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
getOpen(query) {
|
||||
this.queryParams.planType = query.planType
|
||||
this.queryParams.machineryCode = query.machineryCode
|
||||
this.getList()
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
getCheckPlan(this.queryParams).then(response => {
|
||||
this.checkplanList = response.data;
|
||||
// this.checkplanList = response.rows;
|
||||
// this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
80
src/views/mes/dv/machinery/components/Repair.vue
Normal file
80
src/views/mes/dv/machinery/components/Repair.vue
Normal file
@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-table v-loading="loading" :data="repairList">
|
||||
<el-table-column label="维修单编号" width="120px" align="center" prop="repairCode" />
|
||||
<el-table-column label="维修单名称" width="150px" align="center" prop="repairName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="报修日期" align="center" prop="requireDate" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.requireDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="维修完成日期" align="center" prop="finishDate" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.finishDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="验收日期" align="center" prop="confirmDate" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.confirmDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="维修结果" align="center" prop="repairResult">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.mes_repair_result" :value="scope.row.repairResult"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="维修人员" align="center" prop="acceptedBy" />
|
||||
<el-table-column label="验收人员" align="center" prop="confirmBy" />
|
||||
<el-table-column label="单据状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- <pagination-->
|
||||
<!-- v-show="total>0"-->
|
||||
<!-- :total="total"-->
|
||||
<!-- :page.sync="queryParams.pageNum"-->
|
||||
<!-- :limit.sync="queryParams.pageSize"-->
|
||||
<!-- @pagination="getList"-->
|
||||
<!-- />-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getRepairList} from "@/api/mes/dv/repair";
|
||||
|
||||
export default {
|
||||
name: "Repair",
|
||||
dicts: ['mes_repair_result', 'mes_order_status'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: false,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 点检 / 保养数据
|
||||
repairList: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
getOpen(query) {
|
||||
this.queryParams.machineryCode = query.machineryCode
|
||||
this.getList()
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
getRepairList(this.queryParams).then(response => {
|
||||
this.repairList = response.data;
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
763
src/views/mes/dv/machinery/index.vue
Normal file
763
src/views/mes/dv/machinery/index.vue
Normal file
@ -0,0 +1,763 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="20">
|
||||
<!--分类数据-->
|
||||
<el-col :span="4" :xs="24">
|
||||
<div class="head-container">
|
||||
<el-input
|
||||
v-model="machineryTypeName"
|
||||
placeholder="请输入分类名称"
|
||||
clearable
|
||||
size="small"
|
||||
prefix-icon="el-icon-search"
|
||||
style="margin-bottom: 20px"
|
||||
/>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-tree
|
||||
:data="machineryTypeOptions"
|
||||
:props="defaultProps"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode"
|
||||
ref="tree"
|
||||
default-expand-all
|
||||
@node-click="handleNodeClick"
|
||||
/>
|
||||
</div>
|
||||
</el-col>
|
||||
<!--设备数据-->
|
||||
<el-col :span="20" :xs="24">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="设备编码" prop="machineryCode">
|
||||
<el-input
|
||||
v-model="queryParams.machineryCode"
|
||||
placeholder="请输入设备编码"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="machineryName">
|
||||
<el-input
|
||||
v-model="queryParams.machineryName"
|
||||
placeholder="请输入设备名称"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</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="['mes:dv:machinery: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="['mes:dv:machinery: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="['mes:dv:machinery:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="info"
|
||||
plain
|
||||
icon="el-icon-upload2"
|
||||
size="mini"
|
||||
@click="handleImport"
|
||||
v-hasPermi="['mes:dv:machinery:import']"
|
||||
>导入</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['mes:dv:machinery:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="machineryList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="设备编码" width = "120" align="center" key="machineryCode" prop="machineryCode">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="handleView(scope.row)"
|
||||
v-hasPermi="['mes:dv:machinery:query']"
|
||||
>{{scope.row.machineryCode}}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备名称" min-width="120" align="left" key="machineryName" prop="machineryName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="品牌" align="left" key="machineryBrand" prop="machineryBrand" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="规格型号" align="left" key="machinerySpec" prop="machinerySpec" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="所属车间" align="center" key="workshopName" prop="workshopName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="设备状态" align="center" key="status" prop="status" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.mes_machinery_status" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
width="160"
|
||||
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="['mes:dv:machinery:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['mes:dv:machinery:remove']"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-printer"
|
||||
@click="handleHiPrint(scope.row)"
|
||||
v-hasPermi="['mes:dv:machinery:print']"
|
||||
>标签打印</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-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 添加或修改设备对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="14">
|
||||
<el-row>
|
||||
<el-col :span="16">
|
||||
<el-form-item label="设备编码" prop="machineryCode">
|
||||
<el-input v-model="form.machineryCode" :disabled="optType != 'add'" readonly="readonly" maxlength="64" v-if="['view','edit'].indexOf(optType)> -1"/>
|
||||
<el-input v-model="form.machineryCode" :disabled="optType != 'add'" placeholder="请输入设备编码" maxlength="64" v-else/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label-width="80">
|
||||
<el-switch v-model="autoGenFlag"
|
||||
active-color="#13ce66"
|
||||
active-text="自动生成"
|
||||
@change="handleAutoGenChange(autoGenFlag)" v-if="['view','edit'].indexOf(optType)< 0">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="设备名称" prop="machineryName">
|
||||
<el-input v-model="form.machineryName" maxlength="255" readonly="readonly" v-if="optType=='view'" />
|
||||
<el-input v-model="form.machineryName" placeholder="请输入设备名称" maxlength="255" v-else/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="品牌" prop="machineryBrand">
|
||||
<el-input v-model="form.machineryBrand" maxlength="255" readonly="readonly" v-if="optType=='view'" />
|
||||
<el-input v-model="form.machineryBrand" placeholder="请输入品牌" maxlength="255" v-else/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="设备分类" prop="machineryTypeId">
|
||||
<treeselect v-model="form.machineryTypeId" :options="machineryTypeOptions" :normalizer="normalizer" disabled v-if="optType=='view'" />
|
||||
<treeselect v-model="form.machineryTypeId" :options="machineryTypeOptions" :normalizer="normalizer" placeholder="请选择所属分类" v-else :disable-branch-nodes='true' />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属车间" prop="workshopId">
|
||||
<el-select v-model="form.workshopId" @change="changeWorkshop" placeholder="请选择车间">
|
||||
<el-option
|
||||
v-for="item in workshopOptions"
|
||||
:key="item.workshopId"
|
||||
:label="item.workshopName"
|
||||
:value="item.workshopId"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备状态" prop="status">
|
||||
<el-select v-model="form.status" placeholder="请选择设备状态">
|
||||
<el-option
|
||||
v-for="item in dict.type.mes_machinery_status"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<BarcodeImg ref="barcodeImg" :bussinessId="form.machineryId" :bussinessCode="form.machineryCode" barcodeType="MACHINERY"></BarcodeImg>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="form.machineryId !=null">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="最近点检时间" prop="lastCheckTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.lastCheckTime"
|
||||
readonly
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="最近保养时间" prop="lastMaintenTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.lastMaintenTime"
|
||||
readonly
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="规格型号" prop="machinerySpec">
|
||||
<el-input v-model="form.machinerySpec" type="textarea" maxlength="255" readonly="readonly" v-if="optType=='view'" />
|
||||
<el-input v-model="form.machinerySpec" type="textarea" placeholder="请输入规格型号" maxlength="255" v-else/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" readonly v-if="optType=='view'"></el-input>
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" v-else></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-tabs type="border-card" v-model="activeName" v-if="optType != 'add'" @tab-click="handleActive">
|
||||
<el-tab-pane label="点检记录" name="check">
|
||||
<CheckPlan ref="checkList" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="保养记录" name="maintenance">
|
||||
<CheckPlan ref="maintenanceList" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="维修记录" name="repair">
|
||||
<Repair ref="repairList" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" v-if="optType !='view'">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 物料导入对话框 -->
|
||||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:limit="1"
|
||||
accept=".xlsx, .xls"
|
||||
:headers="upload.headers"
|
||||
:action="upload.url + '?updateSupport=' + upload.updateSupport"
|
||||
:disabled="upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress"
|
||||
:on-success="handleFileSuccess"
|
||||
:auto-upload="false"
|
||||
drag
|
||||
>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip text-center" slot="tip">
|
||||
<div class="el-upload__tip" slot="tip">
|
||||
<el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的设备数据
|
||||
</div>
|
||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
|
||||
</div>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||||
<el-button @click="upload.open = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listMachinery, getMachinery, delMachinery, addMachinery, updateMachinery } from "@/api/mes/dv/machinery";
|
||||
import { listMachinerytype } from "@/api/mes/dv/machinerytype";
|
||||
import { listAllWorkshop } from "@/api/mes/md/workshop";
|
||||
import {genCode} from "@/api/system/autocode/rule"
|
||||
import { getToken } from "@/utils/auth";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import BarcodeImg from "@/components/barcodeImg/index.vue";
|
||||
import CheckPlan from "@/views/mes/dv/machinery/components/Checkplan.vue"
|
||||
import Repair from "@/views/mes/dv/machinery/components/Repair.vue"
|
||||
import {getBarcodeUrl} from "@/api/mes/wm/barcode";
|
||||
import { option } from "runjs";
|
||||
import { hiprintMixin } from "../../../../mixins/hiprintMixin";
|
||||
import {print} from "../../../../utils/print"
|
||||
import {getByTemplateType} from "@/api/print/template";
|
||||
|
||||
export default {
|
||||
name: "Machinery",
|
||||
dicts: ['sys_yes_no','mes_machinery_status'],
|
||||
components: { Treeselect,BarcodeImg, CheckPlan, Repair },
|
||||
mixins: [hiprintMixin],
|
||||
data() {
|
||||
return {
|
||||
activeName: "check",
|
||||
//自动生成编码
|
||||
autoGenFlag:false,
|
||||
optType: undefined,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 物料产品表格数据
|
||||
machineryList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 设备类型树选项
|
||||
machineryTypeOptions: [],
|
||||
//车间选项
|
||||
workshopOptions:[],
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 设备类型名称
|
||||
machineryTypeName: undefined,
|
||||
// 表单参数
|
||||
form: {},
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "machineryTypeName"
|
||||
},
|
||||
// 用户导入参数
|
||||
upload: {
|
||||
// 是否显示弹出层(用户导入)
|
||||
open: false,
|
||||
// 弹出层标题(用户导入)
|
||||
title: "",
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 是否更新已经存在的用户数据
|
||||
updateSupport: 0,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: "Bearer " + getToken() },
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + "/mes/dv/machinery/importData"
|
||||
},
|
||||
//二维码查询参数
|
||||
barcodeParams: {
|
||||
bussinessId: null,
|
||||
bussinessCode: null,
|
||||
barcodeFormart: 'QR_CODE', //模式二维码
|
||||
barcodeType: 'MACHINERY' //类型
|
||||
},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
machineryCode: null,
|
||||
machineryName: null,
|
||||
machineryBrand: null,
|
||||
machinerySpec: null,
|
||||
machineryTypeId: null,
|
||||
machineryTypeCode: null,
|
||||
machineryTypeName: null,
|
||||
workshopId: null,
|
||||
workshopCode: null,
|
||||
workshopName: null,
|
||||
status: null
|
||||
},
|
||||
|
||||
// 表单校验
|
||||
rules: {
|
||||
machineryCode: [
|
||||
{ required: true, message: "设备编码不能为空", trigger: "blur" },
|
||||
{ max: 64, message: '设备编码长度必须小于64个字符', trigger: 'blur' }
|
||||
],
|
||||
machineryName: [
|
||||
{ required: true, message: "设备名称不能为空", trigger: "blur" }
|
||||
],
|
||||
workshopId: [
|
||||
{ required: true, message: "车间不能为空",trigger: "blur"}
|
||||
],
|
||||
machineryTypeId: [
|
||||
{ required: true, message: "设备分类不能为空", trigger: "blur" },
|
||||
],
|
||||
remark: [
|
||||
{ max: 250, message: '长度必须小于250个字符', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// 根据设备分类名称筛选分类树
|
||||
machineryTypeName(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getTreeselect();
|
||||
},
|
||||
methods: {
|
||||
// 使用HiPrint打印
|
||||
async handleHiPrint(row) {
|
||||
let printData = row
|
||||
let printTemplate
|
||||
// 处理数据 - 获取条形码图片地址
|
||||
let barcodeParams = {
|
||||
bussinessId: row.machineryId,
|
||||
bussinessCode: row.machineryCode,
|
||||
barcodeFormart: "QR_CODE",
|
||||
barcodeType: "MACHINERY"
|
||||
};
|
||||
await getBarcodeUrl(barcodeParams).then(res => {
|
||||
if (res.data) {
|
||||
printData.barcodeContent = res.data.barcodeContent
|
||||
} else {
|
||||
printData.barcodeContent = ''
|
||||
}
|
||||
})
|
||||
// 获取打印模板
|
||||
let templateStatus = true
|
||||
await getByTemplateType("MACHINERY").then(res => {
|
||||
printTemplate = res.data.templateJson
|
||||
}).catch(err => {
|
||||
templateStatus = false
|
||||
})
|
||||
if (templateStatus) {
|
||||
print(printTemplate, printData, this.hiprintTemplate, this.hiprintThis)
|
||||
}
|
||||
|
||||
},
|
||||
handleActive (tab) {
|
||||
const query = {}
|
||||
query.machineryCode = this.form.machineryCode
|
||||
if (tab.name == "check") {
|
||||
query.planType = "CHECK"
|
||||
this.$refs.checkList.getOpen(query)
|
||||
}
|
||||
if (tab.name == "maintenance") {
|
||||
query.planType = "MAINTEN"
|
||||
this.$refs.maintenanceList.getOpen(query)
|
||||
}
|
||||
if (tab.name == "repair") {
|
||||
this.$refs.repairList.getOpen(query)
|
||||
}
|
||||
},
|
||||
changeWorkshop(val) {
|
||||
const workshop = this.workshopOptions.filter(item => item.workshopId == val)
|
||||
this.form.workshopId = workshop[0].workshopId
|
||||
this.form.workshopName = workshop[0].workshopName
|
||||
this.form.workshopCode = workshop[0].workshopCode
|
||||
},
|
||||
/** 查询物料编码列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listMachinery(this.queryParams).then(response => {
|
||||
this.machineryList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
},
|
||||
getWorkshops(){
|
||||
listAllWorkshop().then( response => {
|
||||
this.workshopOptions =response.data;
|
||||
});
|
||||
},
|
||||
/** 转换设备类型数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.machineryTypeId,
|
||||
label: node.machineryTypeName,
|
||||
children: node.children
|
||||
};
|
||||
},
|
||||
/** 查询设备类型下拉树结构 */
|
||||
getTreeselect() {
|
||||
listMachinerytype().then(response => {
|
||||
debugger;
|
||||
this.machineryTypeOptions = [];
|
||||
const data = this.handleTree(response.data, "machineryTypeId", "parentTypeId")[0];
|
||||
this.machineryTypeOptions.push(data);
|
||||
});
|
||||
},
|
||||
// 筛选节点
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.machineryTypeName.indexOf(value) !== -1;
|
||||
},
|
||||
// 节点单击事件
|
||||
handleNodeClick(data) {
|
||||
this.queryParams.machineryTypeId = data.machineryTypeId;
|
||||
this.handleQuery();
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
machineryId: null,
|
||||
machineryCode: null,
|
||||
machineryName: null,
|
||||
machineryBrand: null,
|
||||
machinerySpec: null,
|
||||
machineryTypeId: null,
|
||||
machineryTypeCode: null,
|
||||
machineryTypeName: null,
|
||||
workshopId: null,
|
||||
workshopCode: null,
|
||||
workshopName: null,
|
||||
lastMaintenTime: null,
|
||||
lastCheckTime: null,
|
||||
status: "STOP",
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.autoGenFlag = false;
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.machineryId);
|
||||
this.single = selection.length != 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
// 查询明细按钮操作
|
||||
handleView(row){
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
this.getWorkshops();
|
||||
const machineryId = row.machineryId || this.ids;
|
||||
getMachinery(machineryId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "查看设备信息";
|
||||
this.optType = "view";
|
||||
this.activeName = "check"
|
||||
const query = {
|
||||
machineryCode: this.form.machineryCode,
|
||||
planType: "CHECK"
|
||||
}
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.barcodeImg.getBarcode();
|
||||
this.$refs.checkList.getOpen(query)
|
||||
})
|
||||
});
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
debugger;
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
this.getWorkshops();
|
||||
if(this.queryParams.machineryTypeId != 0){
|
||||
this.form.machineryTypeId = this.queryParams.machineryTypeId;
|
||||
}
|
||||
this.optType = "add";
|
||||
this.open = true;
|
||||
this.title = "新增设备";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
this.getWorkshops();
|
||||
const machineryId = row.machineryId || this.ids
|
||||
getMachinery(machineryId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改设备";
|
||||
this.optType = "edit";
|
||||
this.activeName = "check"
|
||||
const query = {
|
||||
machineryCode: this.form.machineryCode,
|
||||
planType: "CHECK"
|
||||
}
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.barcodeImg.getBarcode();
|
||||
this.$refs.checkList.getOpen(query)
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.machineryId != undefined) {
|
||||
updateMachinery(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
debugger;
|
||||
addMachinery(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const machineryIds = row.machineryId || this.ids;
|
||||
this.$modal.confirm('确认删除数据项?').then(function() {
|
||||
return delMachinery(machineryIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('mes/dv/machinery/export', {
|
||||
...this.queryParams
|
||||
}, `user_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 导入按钮操作 */
|
||||
handleImport() {
|
||||
this.upload.title = "设备导入";
|
||||
this.upload.open = true;
|
||||
},
|
||||
/** 下载模板操作 */
|
||||
importTemplate() {
|
||||
this.download('mes/dv/machinery/importTemplate', {
|
||||
}, `md_item_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
this.upload.isUploading = true;
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
this.upload.open = false;
|
||||
this.upload.isUploading = false;
|
||||
this.$refs.upload.clearFiles();
|
||||
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
||||
this.getList();
|
||||
},
|
||||
// 提交上传文件
|
||||
submitFileForm() {
|
||||
this.$refs.upload.submit();
|
||||
},
|
||||
//自动生成编码
|
||||
handleAutoGenChange(autoGenFlag){
|
||||
if(autoGenFlag){
|
||||
genCode('MACHINERY_CODE').then(response =>{
|
||||
this.form.machineryCode = response;
|
||||
});
|
||||
}else{
|
||||
this.form.machineryCode = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.flex-container{
|
||||
display: flex;
|
||||
justify-content: center; /* 水平居中 */
|
||||
align-items: center; /* 垂直居中 */
|
||||
}
|
||||
.barcodeClass {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border: 1px dashed;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
294
src/views/mes/dv/machinerytype/index.vue
Normal file
294
src/views/mes/dv/machinerytype/index.vue
Normal file
@ -0,0 +1,294 @@
|
||||
<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="machineryTypeName">
|
||||
<el-input
|
||||
v-model="queryParams.machineryTypeName"
|
||||
placeholder="请输入设备类型名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="enableFlag">
|
||||
<el-select v-model="queryParams.enableFlag" placeholder="选择是或否" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_yes_no"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</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-table
|
||||
v-loading="loading"
|
||||
:data="machinerytypeList"
|
||||
row-key="machineryTypeId"
|
||||
default-expand-all
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
>
|
||||
<el-table-column label="设备类型编码" prop="machineryTypeCode" />
|
||||
<el-table-column label="设备类型名称" align="center" prop="machineryTypeName" />
|
||||
<el-table-column label="是否启用" align="center" prop="enableFlag" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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="['mes:dv:machinerytype:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-plus"
|
||||
@click="handleAdd(scope.row)"
|
||||
v-hasPermi="['mes:dv:machinerytype:add']"
|
||||
>新增</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.parentTypeId != 0"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['mes:dv:machinerytype:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 添加或修改设备类型对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="24" v-if="form.parentTypeId !== 0">
|
||||
<el-form-item label="父类型" prop="parentTypeId">
|
||||
<treeselect v-model="form.parentTypeId" :options="machinerytypeOptions" :normalizer="normalizer" placeholder="请选择父类型" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备类型名称" prop="machineryTypeName">
|
||||
<el-input v-model="form.machineryTypeName" placeholder="请输入设备类型名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否启用" prop="enableFlag">
|
||||
<el-radio-group v-model="form.enableFlag" disabled v-if="optType=='view'">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.sys_yes_no"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
<el-radio-group v-model="form.enableFlag" v-else>
|
||||
<el-radio
|
||||
v-for="dict in dict.type.sys_yes_no"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</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 { listMachinerytype, getMachinerytype, delMachinerytype, addMachinerytype, updateMachinerytype } from "@/api/mes/dv/machinerytype";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
|
||||
export default {
|
||||
name: "Machinerytype",
|
||||
dicts: ['sys_yes_no'],
|
||||
components: {
|
||||
Treeselect
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
optType:undefined,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 设备类型表格数据
|
||||
machinerytypeList: [],
|
||||
// 设备类型树选项
|
||||
machinerytypeOptions: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
machineryTypeCode: null,
|
||||
machineryTypeName: null,
|
||||
parentTypeId: null,
|
||||
ancestors: null,
|
||||
enableFlag: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
parentTypeId: [
|
||||
{ required: true, message: "父类型不能为空", trigger: "blur" }
|
||||
],
|
||||
machineryTypeName: [
|
||||
{ required: true, message: "设备类型名称不能为空", trigger: "blur" },
|
||||
{ max: 100, message: "字段过长", trigger: "blur" }
|
||||
],
|
||||
enableFlag: [
|
||||
{ required: true, message: "是否启用不能为空", trigger: "blur" }
|
||||
],
|
||||
remark: [
|
||||
{ max: 250, message: '长度必须小于250个字符', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备类型列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listMachinerytype(this.queryParams).then(response => {
|
||||
this.machinerytypeList = this.handleTree(response.data, "machineryTypeId", "parentTypeId");
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 转换设备类型数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.machineryTypeId,
|
||||
label: node.machineryTypeName,
|
||||
children: node.children
|
||||
};
|
||||
},
|
||||
/** 查询设备类型下拉树结构 */
|
||||
getTreeselect() {
|
||||
listMachinerytype().then(response => {
|
||||
debugger;
|
||||
this.machinerytypeOptions = [];
|
||||
const data = this.handleTree(response.data, "machineryTypeId", "parentTypeId")[0];
|
||||
this.machinerytypeOptions.push(data);
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
machineryTypeId: null,
|
||||
machineryTypeName: null,
|
||||
parentTypeId: 1,
|
||||
ancestors: null,
|
||||
enableFlag: 'Y',
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd(row) {
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
if (row != null && row.machineryTypeId) {
|
||||
this.form.parentTypeId = row.machineryTypeId;
|
||||
} else {
|
||||
this.form.parentTypeId = 0;
|
||||
}
|
||||
this.open = true;
|
||||
this.title = "添加设备类型";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
if (row != null) {
|
||||
this.form.parentTypeId = row.machineryTypeId;
|
||||
}
|
||||
getMachinerytype(row.machineryTypeId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改设备类型";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.machineryTypeId != null) {
|
||||
updateMachinerytype(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addMachinerytype(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm('是否确认删除设备类型编号为"' + row.machineryTypeId + '"的数据项?').then(function() {
|
||||
return delMachinerytype(row.machineryTypeId);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
431
src/views/mes/dv/maintenrecord/index.vue
Normal file
431
src/views/mes/dv/maintenrecord/index.vue
Normal file
@ -0,0 +1,431 @@
|
||||
<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="planName">
|
||||
<el-input
|
||||
v-model="queryParams.planName"
|
||||
placeholder="请输入计划名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="设备编码" prop="machineryCode">
|
||||
<el-input
|
||||
v-model="queryParams.machineryCode"
|
||||
placeholder="请输入设备编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="machineryName">
|
||||
<el-input
|
||||
v-model="queryParams.machineryName"
|
||||
placeholder="请输入设备名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="保养人" prop="nickName">
|
||||
<el-input
|
||||
v-model="queryParams.nickName"
|
||||
placeholder="请输入名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="保养时间" prop="maintenTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.maintenTime"
|
||||
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="['mes:dv:maintenrecord: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="['mes:dv:maintenrecord: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="['mes:dv:maintenrecord:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="maintenrecordList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="设备编码" align="center" prop="machineryCode" >
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
@click="handleView(scope.row)"
|
||||
v-hasPermi="['mes:dv:maintenrecord:query']"
|
||||
>{{scope.row.machineryCode}}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备名称" align="center" prop="machineryName" />
|
||||
<el-table-column label="品牌" align="center" prop="machineryBrand" />
|
||||
<el-table-column label="规格型号" align="center" prop="machinerySpec" />
|
||||
<el-table-column label="计划名称" align="center" prop="planName" />
|
||||
<el-table-column label="保养时间" align="center" prop="maintenTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.maintenTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="保养人" align="center" prop="nickName" />
|
||||
<el-table-column label="状态" align="center" prop="status" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>
|
||||
</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-if="scope.row.status === 'PREPARE'"
|
||||
v-hasPermi="['dv:maintenrecord:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-if="scope.row.status === 'PREPARE'"
|
||||
v-hasPermi="['dv:maintenrecord: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="960px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备编码" prop="machineryCode">
|
||||
<el-input v-model="form.machineryCode" placeholder="请选择设备" >
|
||||
<el-button slot="append" @click="handleSelectMachinery" icon="el-icon-search"></el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<MachinerySelectSingle ref="machinerySelect" @onSelected="onMachineryAdd"></MachinerySelectSingle>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备名称" prop="machineryName">
|
||||
<el-input v-model="form.machineryName" readonly="readonly" placeholder="请选择设备" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="品牌" prop="machineryBrand">
|
||||
<el-input v-model="form.machineryBrand" readonly="readonly" placeholder="请选择设备" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="规格型号" prop="machinerySpec">
|
||||
<el-input v-model="form.machinerySpec" readonly="readonly" type="textarea" placeholder="请选择设备" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="保养计划" prop="planName">
|
||||
<el-input v-model="form.planName" placeholder="请选择设备保养计划" >
|
||||
<el-button slot="append" @click="handleSelectPlan" icon="el-icon-search"></el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<CheckplanSelect ref="checkplanSelect" planType="MAINTEN" @onSelected="onPlanAdd"></CheckplanSelect>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="保养人" prop="nickName">
|
||||
<el-input v-model="form.nickName" placeholder="请选择保养人" >
|
||||
<el-button slot="append" @click="handleUserSelect" icon="el-icon-search"></el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<UserSingleSelect ref="userSelect" @onSelected="onUserSelected"></UserSingleSelect>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="保养时间" prop="maintenTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.maintenTime"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择保养时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-divider v-if="form.recordId !=null" content-position="center">保养项目</el-divider>
|
||||
<el-card shadow="always" v-if="form.recordId !=null" class="box-card">
|
||||
<MaintenRecordLine ref="maintenRecordLine" :optType="optType" :recordId="form.recordId"></MaintenRecordLine>
|
||||
</el-card>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE' ">返 回</el-button>
|
||||
<el-button type="primary" @click="submitForm" v-if="optType !=='view' && form.status =='PREPARE' " >保 存</el-button>
|
||||
<el-button type="success" @click="handleFinish" v-if="optType !=='view' && form.status =='PREPARE' " >提 交</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listMaintenrecord, getMaintenrecord, delMaintenrecord, addMaintenrecord, updateMaintenrecord } from "@/api/mes/dv/maintenrecord";
|
||||
import MachinerySelectSingle from "@/components/machinerySelect/single.vue";
|
||||
import CheckplanSelect from "@/components/dvplanSelect/index.vue";
|
||||
import UserSingleSelect from "@/components/userSelect/single.vue"
|
||||
import MaintenRecordLine from "./line.vue"
|
||||
export default {
|
||||
name: "Maintenrecord",
|
||||
dicts: ['mes_order_status'],
|
||||
components: {MachinerySelectSingle, CheckplanSelect, UserSingleSelect, MaintenRecordLine},
|
||||
data() {
|
||||
return {
|
||||
optType: null,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备保养记录表格数据
|
||||
maintenrecordList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
planId: null, planCode: null, planName: null, planType: null, machineryId: null, machineryCode: null, machineryName: null, machineryBrand: null, machinerySpec: null, maintenTime: null, userId: null, userName: null, nickName: null, status: null, },
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
machineryId: [
|
||||
{ required: true, message: "设备ID不能为空", trigger: "blur" }
|
||||
], machineryCode: [
|
||||
{ required: true, message: "设备编码不能为空", trigger: "blur" }
|
||||
], machineryName: [
|
||||
{ required: true, message: "设备名称不能为空", trigger: "blur" }
|
||||
], maintenTime: [
|
||||
{ required: true, message: "保养时间不能为空", trigger: "blur" }
|
||||
], }
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备保养记录列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listMaintenrecord(this.queryParams).then(response => {
|
||||
this.maintenrecordList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
recordId: null, planId: null, planCode: null, planName: null, planType: null, machineryId: null, machineryCode: null, machineryName: null, machineryBrand: null, machinerySpec: null, maintenTime: null, userId: null, userName: null, nickName: null, status: "PREPARE", remark: null, attr1: null, attr2: null, attr3: null, attr4: null, createBy: null, createTime: null, updateBy: null, updateTime: null };
|
||||
this.form.userId= this.$store.state.user.id;
|
||||
this.form.nickName= this.$store.state.user.nick;
|
||||
this.form.userName= this.$store.state.user.name;
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.recordId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加设备保养记录";
|
||||
this.optType = "add";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const recordId = row.recordId || this.ids
|
||||
getMaintenrecord(recordId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改设备保养记录";
|
||||
this.optType = "edit";
|
||||
});
|
||||
},
|
||||
handleView(row) {
|
||||
this.reset();
|
||||
const recordId = row.recordId || this.ids
|
||||
getMaintenrecord(recordId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "查看设备保养记录";
|
||||
this.optType = "view";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.recordId != null) {
|
||||
updateMaintenrecord(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addMaintenrecord(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
handleFinish(){
|
||||
if(this.form.recordId != null && this.form.status =='PREPARE'){
|
||||
this.form.status='FINISHED';
|
||||
updateMaintenrecord(this.form).then(response => {
|
||||
this.$modal.msgSuccess("已提交");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
},err =>{
|
||||
this.form.status='PREPARE';
|
||||
});
|
||||
}
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const recordIds = row.recordId || this.ids;
|
||||
this.$modal.confirm('是否确认删除设备保养记录编号为"' + recordIds + '"的数据项?').then(function() {
|
||||
return delMaintenrecord(recordIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
|
||||
handleSelectMachinery(){
|
||||
this.$refs.machinerySelect.showFlag = true;
|
||||
},
|
||||
|
||||
//设备资源选择回调
|
||||
onMachineryAdd(obj){
|
||||
if(obj !=null && obj != undefined){
|
||||
this.form.machineryId = obj.machineryId;
|
||||
this.form.machineryCode = obj.machineryCode;
|
||||
this.form.machineryName = obj.machineryName;
|
||||
this.form.machineryBrand = obj.machineryBrand;
|
||||
this.form.machinerySpec = obj.machinerySpec;
|
||||
}
|
||||
},
|
||||
|
||||
handleSelectPlan(){
|
||||
this.$refs.checkplanSelect.showFlag = true;
|
||||
},
|
||||
|
||||
onPlanAdd(obj){
|
||||
if(obj !=null && obj != undefined){
|
||||
this.form.planId = obj.planId;
|
||||
this.form.planCode = obj.planCode;
|
||||
this.form.planName = obj.planName;
|
||||
this.form.planType = obj.planType;
|
||||
}
|
||||
},
|
||||
|
||||
//点击人员选择按钮
|
||||
handleUserSelect(){
|
||||
this.$refs.userSelect.showFlag = true;
|
||||
},
|
||||
//人员选择返回
|
||||
onUserSelected(row){
|
||||
this.form.userId = row.userId;
|
||||
this.form.nickName = row.nickName;
|
||||
this.form.userName = row.userName;
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
264
src/views/mes/dv/maintenrecord/line.vue
Normal file
264
src/views/mes/dv/maintenrecord/line.vue
Normal file
@ -0,0 +1,264 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="10" v-if="optType != 'view'" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['dv:maintenrecordline: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="['dv:maintenrecordline: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="['dv:maintenrecordline:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="maintenrecordlineList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="项目名称" align="center" prop="subjectName" />
|
||||
<el-table-column label="项目内容" align="center" prop="subjectContent" />
|
||||
<el-table-column label="标准" align="center" prop="subjectStandard" />
|
||||
<el-table-column label="保养结果" align="center" prop="maintenStatus" />
|
||||
<el-table-column label="异常描述" align="center" prop="maintenResult" />
|
||||
<el-table-column label="操作" align="center" v-if="optType != 'view'" 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="['dv:maintenrecordline:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['dv:maintenrecordline: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="recordId">
|
||||
<el-input v-model="form.recordId" placeholder="请输入计划ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目ID" prop="subjectId">
|
||||
<el-input v-model="form.subjectId" placeholder="请输入项目ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目编码" prop="subjectCode">
|
||||
<el-input v-model="form.subjectCode" placeholder="请输入项目编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目名称" prop="subjectName">
|
||||
<el-input v-model="form.subjectName" placeholder="请输入项目名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目类型" prop="subjectType">
|
||||
<el-select v-model="form.subjectType" placeholder="请选择项目类型">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目内容">
|
||||
<editor v-model="form.subjectContent" :min-height="192"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="标准" prop="subjectStandard">
|
||||
<el-input v-model="form.subjectStandard" placeholder="请输入标准" />
|
||||
</el-form-item>
|
||||
<el-form-item label="保养结果">
|
||||
<el-radio-group v-model="form.maintenStatus">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="异常描述" prop="maintenResult">
|
||||
<el-input v-model="form.maintenResult" type="textarea" 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 { listMaintenrecordline, getMaintenrecordline, delMaintenrecordline, addMaintenrecordline, updateMaintenrecordline } from "@/api/mes/dv/maintenrecordline";
|
||||
import DvSubjectSelect from "@/components/dvsubjectSelect/single.vue";
|
||||
export default {
|
||||
name: "Maintenrecordline",
|
||||
props:{
|
||||
optType: null,
|
||||
recordId: null,
|
||||
},
|
||||
dicts: ['dv_cm_result_status'],
|
||||
components:{ DvSubjectSelect },
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备保养记录行表格数据
|
||||
maintenrecordlineList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
recordId: null, subjectId: null, subjectCode: null, subjectName: null, subjectType: null, subjectContent: null, subjectStandard: null, maintenStatus: null, maintenResult: null, },
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
recordId: [
|
||||
{ required: true, message: "计划ID不能为空", trigger: "blur" }
|
||||
], subjectId: [
|
||||
{ required: true, message: "项目ID不能为空", trigger: "blur" }
|
||||
], subjectCode: [
|
||||
{ required: true, message: "项目编码不能为空", trigger: "blur" }
|
||||
], subjectContent: [
|
||||
{ required: true, message: "项目内容不能为空", trigger: "blur" }
|
||||
], maintenStatus: [
|
||||
{ required: true, message: "保养结果不能为空", trigger: "blur" }
|
||||
], }
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备保养记录行列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listMaintenrecordline(this.queryParams).then(response => {
|
||||
this.maintenrecordlineList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
lineId: null, recordId: null, subjectId: null, subjectCode: null, subjectName: null, subjectType: null, subjectContent: null, subjectStandard: null, maintenStatus: "0", maintenResult: null, attr1: null, attr2: null, attr3: null, attr4: 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.lineId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加设备保养记录行";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const lineId = row.lineId || this.ids
|
||||
getMaintenrecordline(lineId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改设备保养记录行";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.lineId != null) {
|
||||
updateMaintenrecordline(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addMaintenrecordline(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const lineIds = row.lineId || this.ids;
|
||||
this.$modal.confirm('是否确认删除设备保养记录行编号为"' + lineIds + '"的数据项?').then(function() {
|
||||
return delMaintenrecordline(lineIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('dv/maintenrecordline/export', {
|
||||
...this.queryParams
|
||||
}, `maintenrecordline_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
508
src/views/mes/dv/repair/index.vue
Normal file
508
src/views/mes/dv/repair/index.vue
Normal file
@ -0,0 +1,508 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="维修单编号" prop="repairCode">
|
||||
<el-input
|
||||
v-model="queryParams.repairCode"
|
||||
placeholder="请输入维修单编号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="维修单名称" prop="repairName">
|
||||
<el-input
|
||||
v-model="queryParams.repairName"
|
||||
placeholder="请输入维修单名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="设备编码" prop="machineryCode">
|
||||
<el-input
|
||||
v-model="queryParams.machineryCode"
|
||||
placeholder="请输入设备编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="machineryName">
|
||||
<el-input
|
||||
v-model="queryParams.machineryName"
|
||||
placeholder="请输入设备名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="维修结果" prop="repairResult">
|
||||
<el-select v-model="queryParams.repairResult" placeholder="请选择维修结果" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.mes_repair_result"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择单据状态" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.mes_order_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</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="['mes:dv:repair: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="['mes:dv:repair: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="['mes:dv:repair:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="repairList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="维修单编号" width="120px" align="center" prop="repairCode" />
|
||||
<el-table-column label="维修单名称" width="150px" align="center" prop="repairName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="设备编码" align="center" prop="machineryCode" />
|
||||
<el-table-column label="设备名称" align="center" prop="machineryName" />
|
||||
<el-table-column label="报修日期" align="center" prop="requireDate" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.requireDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="维修完成日期" align="center" prop="finishDate" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.finishDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="验收日期" align="center" prop="confirmDate" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.confirmDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="维修结果" align="center" prop="repairResult">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.mes_repair_result" :value="scope.row.repairResult"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="维修人员" align="center" prop="acceptedBy" />
|
||||
<el-table-column label="验收人员" align="center" prop="confirmBy" />
|
||||
<el-table-column label="单据状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>
|
||||
</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="['mes:dv:repair:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['mes:dv:repair: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="960px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="维修单编号" prop="repairCode">
|
||||
<el-input v-model="form.repairCode" placeholder="请输入维修单编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item label-width="80">
|
||||
<el-switch v-model="autoGenFlag"
|
||||
active-color="#13ce66"
|
||||
active-text="自动生成"
|
||||
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="维修单名称" prop="repairName">
|
||||
<el-input v-model="form.repairName" placeholder="请输入维修单名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备编号" prop="machineryCode">
|
||||
<el-input v-model="form.machineryCode" placeholder="请选择设备" disabled >
|
||||
<el-button style="border-color: #46a6ff; background-color: #46a6ff;color: white;" slot="append" @click="handleMachineryAdd" icon="el-icon-search"></el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<MachinerySelectSingle ref="machinerySelect" @onSelected="onMachineryAdd"></MachinerySelectSingle>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备名称" prop="machineryName">
|
||||
<el-input v-model="form.machineryName" placeholder="请选择设备" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="品牌" prop="machineryBrand">
|
||||
<el-input v-model="form.machineryBrand" placeholder="请选择设备" disabled/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="报修日期" prop="requireDate">
|
||||
<el-date-picker clearable
|
||||
v-model="form.requireDate"
|
||||
style="width: 187px"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择报修日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="维修完成日期" v-if="form.status =='APPROVING' || form.status=='FINISHED' || form.status=='CONFIRMED' " prop="finishDate">
|
||||
<el-date-picker clearable
|
||||
v-model="form.finishDate"
|
||||
style="width: 187px"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择维修完成日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="验收日期" v-if="form.status=='FINISHED' || form.status=='CONFIRMED' " prop="confirmDate">
|
||||
<el-date-picker clearable
|
||||
v-model="form.confirmDate"
|
||||
style="width: 187px"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择验收日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="维修结果" v-if="form.status =='APPROVING' || form.status=='FINISHED' || form.status=='CONFIRMED' ">
|
||||
<el-radio-group v-model="form.repairResult">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.mes_repair_result"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="维修人员" prop="acceptedName" v-if="form.status =='APPROVING' || form.status=='FINISHED' || form.status=='CONFIRMED' ">
|
||||
<el-input v-model="form.acceptedName" readonly="readonly"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="验收人员" prop="confirmName" v-if="form.status=='FINISHED' || form.status=='CONFIRMED' ">
|
||||
<el-input v-model="form.confirmName" readonly="readonly"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-divider v-if="form.repairId !=null" content-position="center">维修内容</el-divider>
|
||||
<el-card shadow="always" v-if="form.repairId !=null" class="box-card">
|
||||
<Repairline ref="line" :repairId="form.repairId" :optType="optType"></Repairline>
|
||||
</el-card>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" v-if="form.status =='PREPARE' && optType !='view'" @click="submitForm">提 交</el-button>
|
||||
<el-button type="primary" v-if="form.status == 'APPROVING' && optType !='view'" @click="finish">完成维修</el-button>
|
||||
<el-button type="success" v-if="form.status == 'FINISHED' && optType !='view'" @click="confirm">验收通过</el-button>
|
||||
<el-button type="danger" v-if="form.status == 'FINISHED' && optType !='view'" @click="unconfirm">不通过</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listRepair, getRepair, delRepair, addRepair, updateRepair } from "@/api/mes/dv/repair";
|
||||
import MachinerySelectSingle from "@/components/machinerySelect/single.vue";
|
||||
import Repairline from './line.vue'
|
||||
import {genCode} from "@/api/system/autocode/rule"
|
||||
export default {
|
||||
name: "Repair",
|
||||
dicts: ['mes_repair_result', 'mes_order_status'],
|
||||
components: {Repairline,MachinerySelectSingle},
|
||||
data() {
|
||||
return {
|
||||
autoGenFlag:false,
|
||||
optType: undefined,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备维修单表格数据
|
||||
repairList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
repairCode: null,
|
||||
repairName: null,
|
||||
machineryId: null,
|
||||
machineryCode: null,
|
||||
machineryName: null,
|
||||
machineryBrand: null,
|
||||
machinerySpec: null,
|
||||
machineryTypeId: null,
|
||||
requireDate: null,
|
||||
finishDate: null,
|
||||
confirmDate: null,
|
||||
repairResult: null,
|
||||
acceptedBy: null,
|
||||
confirmBy: null,
|
||||
status: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
repairCode: [
|
||||
{ required: true, message: "维修单编号不能为空", trigger: "blur" },
|
||||
{ max: 64, message: "字段过长", trigger: "blur" }
|
||||
],
|
||||
repairName: [
|
||||
{ max: 100, message: "字段过长", trigger: "blur" }
|
||||
],
|
||||
machineryId: [
|
||||
{ required: true, message: "设备ID不能为空", trigger: "blur" }
|
||||
],
|
||||
machineryCode: [
|
||||
{ required: true, message: "设备编码不能为空", trigger: "blur" }
|
||||
],
|
||||
machineryName: [
|
||||
{ required: true, message: "设备名称不能为空", trigger: "blur" }
|
||||
],
|
||||
requireDate: [
|
||||
{ required: true, message: "请选择报修日期", trigger: "blur" }
|
||||
],
|
||||
remark: [
|
||||
{ max: 250, message: '长度必须小于250个字符', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备维修单列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listRepair(this.queryParams).then(response => {
|
||||
this.repairList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
repairId: null,
|
||||
repairCode: null,
|
||||
repairName: null,
|
||||
machineryId: null,
|
||||
machineryCode: null,
|
||||
machineryName: null,
|
||||
machineryBrand: null,
|
||||
machinerySpec: null,
|
||||
machineryTypeId: null,
|
||||
requireDate: null,
|
||||
finishDate: null,
|
||||
confirmDate: null,
|
||||
repairResult: "",
|
||||
acceptedBy: null,
|
||||
confirmBy: null,
|
||||
status: 'PREPARE',
|
||||
remark: null,
|
||||
attr1: null,
|
||||
attr2: null,
|
||||
attr3: null,
|
||||
attr4: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.autoGenFlag= false;
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.repairId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加设备维修单";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const repairId = row.repairId || this.ids
|
||||
getRepair(repairId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改设备维修单";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.repairId != null) {
|
||||
updateRepair(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addRepair(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const repairIds = row.repairId || this.ids;
|
||||
this.$modal.confirm('是否确认删除设备维修单编号为"' + repairIds + '"的数据项?').then(function() {
|
||||
return delRepair(repairIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('dv/repair/export', {
|
||||
...this.queryParams
|
||||
}, `repair_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
//设备资源选择弹出
|
||||
handleMachineryAdd(){
|
||||
this.$refs.machinerySelect.handleOpen(this.form.machineryId)
|
||||
},
|
||||
//设备资源选择回调
|
||||
onMachineryAdd(row){
|
||||
this.form.machineryId = row.machineryId;
|
||||
this.form.machineryTypeId = row.machineryTypeId;
|
||||
this.form.machineryCode = row.machineryCode;
|
||||
this.form.machineryName = row.machineryName;
|
||||
this.form.machineryBrand = row.machineryBrand;
|
||||
},
|
||||
//自动生成编码
|
||||
handleAutoGenChange(autoGenFlag){
|
||||
if(autoGenFlag){
|
||||
genCode('DV_REPAIR_CODE').then(response =>{
|
||||
this.form.repairCode = response;
|
||||
});
|
||||
}else{
|
||||
this.form.repairCode = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
285
src/views/mes/dv/repair/line.vue
Normal file
285
src/views/mes/dv/repair/line.vue
Normal file
@ -0,0 +1,285 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<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="['mes:dv:repair:add']"
|
||||
>新增</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="['mes:dv:repair:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="repairlineList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="项目名称" align="center" prop="subjectName" />
|
||||
<el-table-column label="故障描述" align="center" prop="malfunction" >
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-input type="textarea">{{scope.row.malfunction}}</el-input>-->
|
||||
<!-- </template>-->
|
||||
</el-table-column>
|
||||
<el-table-column label="故障描述资源" align="center" prop="malfunctionUrl" >
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column label="维修情况" align="center" prop="repairDes" />
|
||||
<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="['mes:dv:repair:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['mes:dv:repair: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="960px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="项目名称" prop="subjectCode">
|
||||
<el-select v-model="form.subjectName" @change="changeSubject" filterable placeholder="请输入项目名称" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in dvsubjectList"
|
||||
:key="item.subjectId"
|
||||
:label="item.subjectName"
|
||||
:value="item.subjectCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="故障描述" prop="malfunction">
|
||||
<el-input v-model="form.malfunction" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="故障描述资源" prop="malfunctionUrl">
|
||||
<el-input type="textarea" v-model="form.malfunctionUrl" placeholder="请输入故障描述资源" />
|
||||
</el-form-item>
|
||||
<el-form-item label="维修情况" prop="repairDes">
|
||||
<el-input v-model="form.repairDes" type="textarea" 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 { listRepairline, getRepairline, delRepairline, addRepairline, updateRepairline } from "@/api/mes/dv/repairline";
|
||||
import { listDvsubject } from "@/api/mes/dv/dvsubject";
|
||||
|
||||
export default {
|
||||
name: "Repairline",
|
||||
props: {
|
||||
repairId: null,
|
||||
optType: undefined
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 项目选择
|
||||
dvsubjectList: [],
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备维修单行表格数据
|
||||
repairlineList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
repairId: this.repairId,
|
||||
subjectId: null,
|
||||
subjectCode: null,
|
||||
subjectName: null,
|
||||
subjectType: null,
|
||||
subjectContent: null,
|
||||
subjectStandard: null,
|
||||
malfunction: null,
|
||||
malfunctionUrl: null,
|
||||
repairDes: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
subjectCode: [
|
||||
{ required: true, message: "项目名称不能为空", trigger: "blur" }
|
||||
],
|
||||
malfunction: [
|
||||
{ required: true, message: "故障描述不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
listDvsubject({pageNum: 1, pageSize: 99999}).then(res =>{
|
||||
this.dvsubjectList = res.rows
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 选择项目
|
||||
changeSubject(val) {
|
||||
let data = (this.dvsubjectList.filter(item => item.subjectCode == val))[0]
|
||||
this.form.subjectId = data.subjectId
|
||||
this.form.subjectName = data.subjectName
|
||||
this.form.subjectCode = data.subjectCode
|
||||
this.form.subjectContent = data.subjectContent
|
||||
},
|
||||
/** 查询设备维修单行列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listRepairline(this.queryParams).then(response => {
|
||||
this.repairlineList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
lineId: null,
|
||||
repairId: this.repairId,
|
||||
subjectId: null,
|
||||
subjectCode: null,
|
||||
subjectName: null,
|
||||
subjectType: null,
|
||||
subjectContent: null,
|
||||
subjectStandard: null,
|
||||
malfunction: null,
|
||||
malfunctionUrl: null,
|
||||
repairDes: null,
|
||||
remark: null,
|
||||
attr1: null,
|
||||
attr2: null,
|
||||
attr3: null,
|
||||
attr4: 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.lineId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加设备维修单行";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const lineId = row.lineId || this.ids
|
||||
getRepairline(lineId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改设备维修单行";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.lineId != null) {
|
||||
updateRepairline(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addRepairline(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const lineIds = row.lineId || this.ids;
|
||||
this.$modal.confirm('是否确认删除当前数据项?').then(function() {
|
||||
return delRepairline(lineIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('dv/repairline/export', {
|
||||
...this.queryParams
|
||||
}, `repairline_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
373
src/views/mes/dv/subject/index.vue
Normal file
373
src/views/mes/dv/subject/index.vue
Normal file
@ -0,0 +1,373 @@
|
||||
<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="subjectCode">
|
||||
<el-input
|
||||
v-model="queryParams.subjectCode"
|
||||
placeholder="请输入项目编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目名称" prop="subjectName">
|
||||
<el-input
|
||||
v-model="queryParams.subjectName"
|
||||
placeholder="请输入项目名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目类型" prop="subjectType">
|
||||
<el-select v-model="queryParams.subjectType" placeholder="请选择项目类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.mes_dvsubject_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</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="['mes:dv:dvsubject: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="['mes:dv:dvsubject: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="['mes:dv:dvsubject: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="['mes:dv:dvsubject:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="dvsubjectList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="项目编码" align="center" prop="subjectCode" />
|
||||
<el-table-column label="项目类型" align="center" prop="subjectType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.mes_dvsubject_type" :value="scope.row.subjectType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="项目名称" align="center" prop="subjectName" />
|
||||
<el-table-column label="项目内容" align="center" prop="subjectContent" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="标准" align="center" prop="subjectStandard" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="是否启用" align="center" prop="enableFlag">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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="['mes:dv:dvsubject:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['mes:dv:dvsubject: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="960px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目编码" prop="subjectCode">
|
||||
<el-input v-model="form.subjectCode" placeholder="请输入项目编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item label-width="80">
|
||||
<el-switch v-model="autoGenFlag"
|
||||
active-color="#13ce66"
|
||||
active-text="自动生成"
|
||||
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="项目名称" prop="subjectName">
|
||||
<el-input v-model="form.subjectName" placeholder="请输入项目名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="项目类型" prop="subjectType">
|
||||
<el-radio-group v-model="form.subjectType">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.mes_dvsubject_type"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否启用">
|
||||
<el-radio-group v-model="form.enableFlag">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.sys_yes_no"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="项目内容" prop="subjectContent">
|
||||
<el-input type="textarea" v-model="form.subjectContent" placeholder="请输入项目内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标准" prop="subjectStandard">
|
||||
<el-input type="textarea" v-model="form.subjectStandard" placeholder="请输入标准" autosize/>
|
||||
</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 { listDvsubject, getDvsubject, delDvsubject, addDvsubject, updateDvsubject } from "@/api/mes/dv/dvsubject";
|
||||
import {genCode} from "@/api/system/autocode/rule"
|
||||
export default {
|
||||
name: "Dvsubject",
|
||||
dicts: ['sys_yes_no', 'mes_dvsubject_type'],
|
||||
data() {
|
||||
return {
|
||||
autoGenFlag: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组s
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备点检保养项目表格数据
|
||||
dvsubjectList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
subjectCode: null,
|
||||
subjectName: null,
|
||||
subjectType: null,
|
||||
subjectContent: null,
|
||||
subjectStandard: null,
|
||||
enableFlag: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
subjectCode: [
|
||||
{ required: true, message: "项目编码不能为空", trigger: "blur" },
|
||||
{ max: 64, message: "字段过长", trigger: "blur" }
|
||||
],
|
||||
subjectType: [
|
||||
{ required: true, message: "请选择项目类型", trigger: "blur" }
|
||||
],
|
||||
subjectName: [
|
||||
{ max: 100, message: "字段过长", trigger: "blur" }
|
||||
],
|
||||
subjectContent: [
|
||||
{ required: true, message: "项目内容不能为空", trigger: "blur" },
|
||||
{ max: 250, message: "字段过长", trigger: "blur" }
|
||||
],
|
||||
enableFlag: [
|
||||
{ required: true, message: "是否启用不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备点检保养项目列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listDvsubject(this.queryParams).then(response => {
|
||||
this.dvsubjectList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
subjectId: null,
|
||||
subjectCode: null,
|
||||
subjectName: null,
|
||||
subjectType: null,
|
||||
subjectContent: null,
|
||||
subjectStandard: null,
|
||||
enableFlag: "Y",
|
||||
remark: null,
|
||||
attr1: null,
|
||||
attr2: null,
|
||||
attr3: null,
|
||||
attr4: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.autoGenFlag = false;
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.subjectId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加设备点检保养项目";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const subjectId = row.subjectId || this.ids
|
||||
getDvsubject(subjectId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改设备点检保养项目";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.subjectId != null) {
|
||||
updateDvsubject(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addDvsubject(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const subjectIds = row.subjectId || this.ids;
|
||||
this.$modal.confirm('是否确认删除设备点检保养项目编号为"' + subjectIds + '"的数据项?').then(function() {
|
||||
return delDvsubject(subjectIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('mes/dv/dvsubject/export', {
|
||||
...this.queryParams
|
||||
}, `dvsubject_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
//自动生成编码
|
||||
handleAutoGenChange(autoGenFlag){
|
||||
if(autoGenFlag){
|
||||
genCode('SUBJECT_CODE').then(response =>{
|
||||
this.form.subjectCode = response;
|
||||
});
|
||||
}else{
|
||||
this.form.subjectCode = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user