设备保养设备巡检
This commit is contained in:
@@ -1,40 +1,3 @@
|
||||
|
||||
首页
|
||||
工单管理
|
||||
合并请求
|
||||
里程碑
|
||||
探索
|
||||
通知469
|
||||
创建…
|
||||
个人信息和配置
|
||||
mt-fe-group / yudao-dev
|
||||
取消关注
|
||||
11
|
||||
点赞
|
||||
0
|
||||
派生
|
||||
0
|
||||
代码
|
||||
工单
|
||||
0
|
||||
合并请求
|
||||
0
|
||||
版本发布
|
||||
0
|
||||
百科
|
||||
动态
|
||||
559 提交
|
||||
25 分支
|
||||
145 MiB
|
||||
分支: projects/mes-test
|
||||
yudao-dev/src/views/equipment/base/repair/CustomDialogForm.vue
|
||||
346 行
|
||||
8.9 KiB
|
||||
原始文件
|
||||
永久链接
|
||||
Blame
|
||||
文件历史
|
||||
|
||||
<!--
|
||||
filename: dialogForm.vue
|
||||
author: liubin
|
||||
@@ -44,53 +7,74 @@ Blame
|
||||
|
||||
<template>
|
||||
<el-drawer :visible.sync="visible" :show-close="false" :wrapper-closable="disabled" class="drawer"
|
||||
custom-class="mes-drawer" size="65%" @closed="$emit('destroy')">
|
||||
custom-class="mes-drawer" size="50%" @closed="$emit('destroy')">
|
||||
<small-title slot="title" :no-padding="true">
|
||||
{{ disabled ? '查看详情' : !dataForm.maintenanceStatus ? '修改' : '完成' }}
|
||||
</small-title>
|
||||
<div class="drawer-body flex">
|
||||
<div class="drawer-body__content">
|
||||
<el-form ref="form" :model="dataForm" label-width="100px" label-position="top" v-loading="formLoading">
|
||||
<div>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="维修单号" prop="repairOrderNumber">
|
||||
<span>{{ dataForm.repairOrderNumber }}</span>
|
||||
</el-form-item>
|
||||
<div class="blodTip">故障发生时间</div>
|
||||
<div class="lightTip">{{ parseTime(dataForm.faultTime) }}</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备名称" prop="equipmentName">
|
||||
<span>{{ dataForm.equipmentName }}</span>
|
||||
</el-form-item>
|
||||
<div class="blodTip">故障级别</div>
|
||||
<div class="lightTip">{{ getDictDataLabel('fault-level', dataForm.faultLevel) }}</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="维修工" prop="repairman">
|
||||
<span>{{ dataForm.repairman }}</span>
|
||||
</el-form-item>
|
||||
<div class="blodTip">故障类型</div>
|
||||
<div class="lightTip">{{ getDictDataLabel('fault-type', dataForm.faultType) }}</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="故障发生时间" prop="faultTime">
|
||||
<span>{{ parseTime(dataForm.faultTime) }}</span>
|
||||
</el-form-item>
|
||||
<div class="blodTip">维修工</div>
|
||||
<div class="lightTip">{{ dataForm.repairman }}</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="故障级别" prop="faultLevel">
|
||||
<span>{{ getDictDataLabel('fault-level', dataForm.faultLevel) }}</span>
|
||||
</el-form-item>
|
||||
<div class="blodTip">联系方式</div>
|
||||
<div class="lightTip">{{ dataForm.repairmanPhone }}</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="联系方式" prop="repairmanPhone">
|
||||
<span>{{ dataForm.repairmanPhone }}</span>
|
||||
</el-form-item>
|
||||
<div class="blodTip">维修方式</div>
|
||||
<div class="lightTip">{{ getDictDataLabel('repair-mode', dataForm.repairMode) }}</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider style="margin-top: -10px" />
|
||||
|
||||
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
|
||||
{{ '设备维修信息' }}
|
||||
</small-title>
|
||||
<el-row>
|
||||
<div class="blodTip">维修附件</div>
|
||||
<div v-if="dataForm.files && dataForm.files.length > 0">
|
||||
<uploadedFile
|
||||
class="file"
|
||||
v-for="file in dataForm.files"
|
||||
:file="file"
|
||||
:key="file.fileUrl"
|
||||
:disabled="disabled"
|
||||
@delete="!disabled && handleDeleteFile(file, col.prop)" />
|
||||
</div>
|
||||
<p v-else>暂无附件</p>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<div class="blodTip">创建时间</div>
|
||||
<div class="lightTip">{{ parseTime(dataForm.createTime) }}</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="blodTip">创建人</div>
|
||||
<div class="lightTip">{{ dataForm.creator }}</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="blodTip">备注</div>
|
||||
<div class="lightTip">{{ dataForm.remark }}</div>
|
||||
</el-row>
|
||||
</div>
|
||||
<!-- <el-divider style="margin-top: -10px" />
|
||||
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
|
||||
{{ '设备维修信息' }}
|
||||
</small-title> -->
|
||||
<!-- <el-form ref="form" :model="dataForm" label-width="100px" label-position="top" v-loading="formLoading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="维修开始时间" prop="maintenanceStartTime"
|
||||
@@ -129,7 +113,6 @@ Blame
|
||||
<el-col>
|
||||
<el-form-item label="故障明细" prop="faultDetail"
|
||||
:rules="[{ required: true, message: '故障明细不能为空', trigger: 'blur' }]">
|
||||
<!-- // 富文本 -->
|
||||
<editor v-model="dataForm.faultDetail" :read-only="disabled" :min-height="150" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -138,7 +121,6 @@ Blame
|
||||
<el-row :gutter="20">
|
||||
<el-col>
|
||||
<el-form-item label="维修记录" prop="maintenanceDetail">
|
||||
<!-- // 富文本 -->
|
||||
<editor v-model="dataForm.maintenanceDetail" :read-only="disabled" :min-height="150" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -159,7 +141,7 @@ Blame
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-form> -->
|
||||
|
||||
<div v-if="!disabled" class="drawer-body__footer">
|
||||
<el-button style="" @click="goback()">取消</el-button>
|
||||
@@ -174,11 +156,73 @@ Blame
|
||||
import SmallTitle from '../../base/alarm/Record/SmallTitle.vue';
|
||||
import { getEqRepair, updateEqRepair } from '@/api/equipment/base/repair'
|
||||
import Editor from "@/components/Editor";
|
||||
import FileUpload from "@/components/FileUpload";
|
||||
// import FileUpload from "@/components/FileUpload";
|
||||
import { getDictDatas } from "@/utils/dict";
|
||||
import { parseTime } from '@/utils/ruoyi'
|
||||
import { getDictDataLabel } from '@/utils/dict';
|
||||
|
||||
const uploadedFile = {
|
||||
name: 'UploadedFile',
|
||||
props: ['file', 'disabled'],
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
handleDelete() {
|
||||
this.$emit('delete', this.file);
|
||||
},
|
||||
async handleDownload() {
|
||||
const data = await this.$axios({
|
||||
url: this.file.fileUrl,
|
||||
method: 'get',
|
||||
responseType: 'blob',
|
||||
});
|
||||
|
||||
await this.$message.success('开始下载');
|
||||
// create download link
|
||||
const url = window.URL.createObjectURL(data);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = this.file.fileName;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
render: function (h) {
|
||||
return (
|
||||
<div
|
||||
title={this.file.fileName}
|
||||
onClick={this.handleDownload}
|
||||
style={{
|
||||
background: `url(${tupleImg}) no-repeat`,
|
||||
backgroundSize: '14px',
|
||||
backgroundPosition: '0 55%',
|
||||
paddingLeft: '20px',
|
||||
paddingRight: '24px',
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
overflow: 'hidden',
|
||||
cursor: 'pointer',
|
||||
display: 'inline-block',
|
||||
}}>
|
||||
{this.file.fileName}
|
||||
{!this.disabled && (
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-close"
|
||||
style="float: right; position: relative; top: 2px; left: 8px; z-index: 100"
|
||||
class="dialog__upload_component__close"
|
||||
onClick={this.handleDelete}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'DialogForm',
|
||||
model: {
|
||||
@@ -186,7 +230,7 @@ export default {
|
||||
event: 'update',
|
||||
},
|
||||
emits: ['update'],
|
||||
components: { SmallTitle, Editor, FileUpload },
|
||||
components: { SmallTitle, Editor, uploadedFile },
|
||||
props: {
|
||||
// dataForm: {
|
||||
// type: Object,
|
||||
@@ -237,18 +281,18 @@ export default {
|
||||
this.visible = true;
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$refs['form'].resetFields();
|
||||
// this.$refs['form'].resetFields();
|
||||
|
||||
if (this.dataForm.id) {
|
||||
// 获取设备维修
|
||||
getEqRepair(this.dataForm.id).then(response => {
|
||||
this.formLoading = false
|
||||
this.dataForm = response.data;
|
||||
this.dataForm.maintenanceStatus = row.maintenanceStatus || 0
|
||||
if (this.dataForm.files.length > 0) {
|
||||
this.file = this.dataForm.files[0].fileUrl
|
||||
this.fileName = this.dataForm.files[0].fileName
|
||||
}
|
||||
// this.dataForm.maintenanceStatus = row.maintenanceStatus || 0
|
||||
// if (this.dataForm.files.length > 0) {
|
||||
// this.file = this.dataForm.files[0].fileUrl
|
||||
// this.fileName = this.dataForm.files[0].fileName
|
||||
// }
|
||||
});
|
||||
} else {
|
||||
// if (this.urlOptions.isGetCode) {
|
||||
@@ -337,4 +381,18 @@ export default {
|
||||
justify-content: flex-end;
|
||||
padding: 18px;
|
||||
}
|
||||
.blodTip {
|
||||
height: 16px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: rgba(0,0,0,0.85);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.lightTip {
|
||||
/* height: 16px; */
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: rgba(102,102,102,0.75);
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
799
src/views/equipment/base/repair/Repair--add.vue
Normal file
799
src/views/equipment/base/repair/Repair--add.vue
Normal file
@@ -0,0 +1,799 @@
|
||||
<!--
|
||||
filename: dialogForm.vue
|
||||
author: liubin
|
||||
date: 2023-08-15 10:32:36
|
||||
description: 弹窗的表单组件
|
||||
-->
|
||||
|
||||
<template>
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="form"
|
||||
:label-position="labelPosition"
|
||||
v-loading="formLoading">
|
||||
<el-row :gutter="20">
|
||||
<!-- 维修单号 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="维修单号"
|
||||
prop="repairOrderNumber"
|
||||
:rules="[
|
||||
{ required: true, message: '维修单号不能为空', trigger: 'blur' },
|
||||
]">
|
||||
<el-input
|
||||
v-model="form.repairOrderNumber"
|
||||
@change="$emit('update', form)"
|
||||
placeholder="请输入维修单号"
|
||||
:disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 产线名 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="产线名" prop="lineId">
|
||||
<el-select
|
||||
v-model="formFilters.lineId"
|
||||
:placeholder="`请选择产线`"
|
||||
:disabled="disabled"
|
||||
clearable
|
||||
filterable
|
||||
@change="initSections">
|
||||
<el-option
|
||||
v-for="opt in lineOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 工段名 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="工段名" prop="sectionId">
|
||||
<el-select
|
||||
v-model="formFilters.sectionId"
|
||||
:placeholder="`请选择工段`"
|
||||
:disabled="disabled"
|
||||
clearable
|
||||
filterable
|
||||
@change="handleEqTypeChange">
|
||||
<el-option
|
||||
v-for="opt in sectionOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 设备名称 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="设备名称"
|
||||
prop="equipmentId"
|
||||
:rules="[
|
||||
{ required: true, message: '设备不能为空', trigger: 'blur' },
|
||||
]">
|
||||
<el-select
|
||||
v-model="form.equipmentId"
|
||||
:placeholder="`请选择设备`"
|
||||
:disabled="disabled"
|
||||
filterable
|
||||
clearable
|
||||
@change="$emit('update', form)">
|
||||
<el-option
|
||||
v-for="opt in equipmentOptions"
|
||||
:key="opt.id"
|
||||
:label="opt.name"
|
||||
:value="opt.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 故障发生时间 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="故障发生时间"
|
||||
prop="faultTime"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '故障发生时间不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]">
|
||||
<el-date-picker
|
||||
v-model="form.faultTime"
|
||||
type="datetime"
|
||||
:disabled="disabled"
|
||||
:placeholder="`请选择故障发生时间`"
|
||||
value-format="timestamp"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
clearable
|
||||
@change="$emit('update', form)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 故障级别 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="故障级别"
|
||||
prop="faultLevel"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '故障级别不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]">
|
||||
<el-select
|
||||
v-model="form.faultLevel"
|
||||
placeholder="故障级别"
|
||||
:disabled="disabled"
|
||||
@change="$emit('update', form)">
|
||||
<el-option
|
||||
v-for="opt in getDictDatas(DICT_TYPE.FAULT_LEVEL)"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 故障类型 - 数据字典 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="故障类型"
|
||||
prop="faultType"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '故障类型不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]">
|
||||
<el-select
|
||||
v-model="form.faultType"
|
||||
placeholder="故障类型"
|
||||
:disabled="disabled"
|
||||
@change="$emit('update', form)">
|
||||
<el-option
|
||||
v-for="opt in getDictDatas(DICT_TYPE.FAULT_TYPE)"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 维修开始时间 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="维修开始时间"
|
||||
prop="maintenanceStartTime"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '维修开始时间不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]">
|
||||
<el-date-picker
|
||||
v-model="form.maintenanceStartTime"
|
||||
type="datetime"
|
||||
:disabled="disabled"
|
||||
:placeholder="`请选择维修开始时间`"
|
||||
value-format="timestamp"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
clearable
|
||||
@change="$emit('update', form)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 维修结束时间 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="维修结束时间"
|
||||
prop="maintenanceFinishTime"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '维修结束时间不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]">
|
||||
<el-date-picker
|
||||
v-model="form.maintenanceFinishTime"
|
||||
type="datetime"
|
||||
:disabled="disabled"
|
||||
:placeholder="`请选择维修结束时间`"
|
||||
value-format="timestamp"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
clearable
|
||||
@change="$emit('update', form)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 维修工 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="维修工"
|
||||
prop="repairman"
|
||||
:rules="[
|
||||
{ required: true, message: '维修工不能为空', trigger: 'blur' },
|
||||
]">
|
||||
<el-select
|
||||
v-model="form.repairman"
|
||||
@change="$emit('update', form)"
|
||||
placeholder="请选择维修工"
|
||||
filterable
|
||||
clearable
|
||||
multiple
|
||||
:disabled="disabled">
|
||||
<el-option
|
||||
v-for="opt in workerOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 联系方式 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="联系方式"
|
||||
prop="repairmanPhone"
|
||||
:rules="[
|
||||
{ required: false, message: '联系方式不能为空', trigger: 'blur' },
|
||||
]">
|
||||
<el-input
|
||||
v-model="form.repairmanPhone"
|
||||
@change="$emit('update', form)"
|
||||
placeholder="请输入联系方式"
|
||||
:disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 维修方式 - 数据字典 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="维修方式"
|
||||
prop="repairMode"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '维修方式不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]">
|
||||
<el-select
|
||||
v-model="form.repairMode"
|
||||
placeholder="维修方式"
|
||||
:disabled="disabled"
|
||||
@change="$emit('update', form)">
|
||||
<el-option
|
||||
v-for="opt in getDictDatas(DICT_TYPE.REPAIR_MODE)"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 维修结果 - 数据字典 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="维修结果"
|
||||
prop="maintenanceResult"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '维修结果不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]">
|
||||
<el-select
|
||||
v-model="form.maintenanceResult"
|
||||
placeholder="维修结果"
|
||||
:disabled="disabled"
|
||||
@change="$emit('update', form)">
|
||||
<el-option
|
||||
v-for="opt in getDictDatas(DICT_TYPE.REPAIR_RESULT)"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 备注 -->
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
@change="$emit('update', form)"
|
||||
placeholder="请输入备注"
|
||||
:disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 故障明细 -->
|
||||
<el-col :span="24">
|
||||
<el-form-item
|
||||
label="故障明细"
|
||||
prop="faultDetail"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '故障明细不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]">
|
||||
<Editor
|
||||
key="fault-detail"
|
||||
:height="200"
|
||||
v-model="form.faultDetail"
|
||||
@on-change="$emit('update', form)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 维修描述 -->
|
||||
<el-col :span="24">
|
||||
<el-form-item label="维修描述" prop="maintenanceDetail">
|
||||
<Editor
|
||||
key="maintenance-detail"
|
||||
:height="200"
|
||||
v-model="form.maintenanceDetail"
|
||||
@on-change="$emit('update', form)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 维修附件 -->
|
||||
<el-col :span="24">
|
||||
<el-form-item label="维修附件" prop="files">
|
||||
<div
|
||||
class="upload-area"
|
||||
:class="uploadOpen ? '' : 'height-48'"
|
||||
ref="uploadArea">
|
||||
<span class="close-icon" :class="uploadOpen ? 'open' : ''">
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-arrow-right"
|
||||
@click="uploadOpen = !uploadOpen" />
|
||||
</span>
|
||||
<!-- :file-list="uploadedFileList" -->
|
||||
<el-upload
|
||||
class="upload-in-dialog"
|
||||
:action="uploadUrl"
|
||||
:headers="uploadHeaders"
|
||||
:show-file-list="false"
|
||||
icon="el-icon-upload2"
|
||||
:disabled="disabled"
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="
|
||||
(response, file, fileList) => {
|
||||
handleUploadSuccess(response, file, 'files');
|
||||
}
|
||||
">
|
||||
<el-button size="mini" :disabled="disabled || false">
|
||||
<svg-icon
|
||||
icon-class="icon-upload"
|
||||
style="color: inherit"></svg-icon>
|
||||
上传文件
|
||||
</el-button>
|
||||
<div class="el-upload__tip" slot="tip">
|
||||
只能上传jpg/png文件, 大小不超过2MB
|
||||
</div>
|
||||
</el-upload>
|
||||
|
||||
<uploadedFile
|
||||
class="file"
|
||||
v-for="file in form.files"
|
||||
:file="file"
|
||||
:key="file.fileUrl"
|
||||
:disabled="disabled"
|
||||
@delete="!disabled && handleDeleteFile(file, col.prop)" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 设备大类 -->
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item
|
||||
label="设备大类"
|
||||
prop="equipmentCategory"
|
||||
:rules="[
|
||||
{ required: true, message: '设备大类不能为空', trigger: 'blur' },
|
||||
]">
|
||||
<el-select
|
||||
v-model="form.equipmentCategory"
|
||||
:placeholder="`请选择设备大类`"
|
||||
:disabled="disabled"
|
||||
clearable
|
||||
filterable
|
||||
@change="handleEqTypeChange">
|
||||
<el-option
|
||||
v-for="opt in equipmentTypeOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Editor from '@/components/Editor';
|
||||
import { getAccessToken } from '@/utils/auth';
|
||||
import tupleImg from '@/assets/images/tuple.png';
|
||||
|
||||
const uploadedFile = {
|
||||
name: 'UploadedFile',
|
||||
props: ['file', 'disabled'],
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
handleDelete() {
|
||||
this.$emit('delete', this.file);
|
||||
},
|
||||
async handleDownload() {
|
||||
const data = await this.$axios({
|
||||
url: this.file.fileUrl,
|
||||
method: 'get',
|
||||
responseType: 'blob',
|
||||
});
|
||||
|
||||
await this.$message.success('开始下载');
|
||||
// create download link
|
||||
const url = window.URL.createObjectURL(data);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = this.file.fileName;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
render: function (h) {
|
||||
return (
|
||||
<div
|
||||
title={this.file.fileName}
|
||||
onClick={this.handleDownload}
|
||||
style={{
|
||||
background: `url(${tupleImg}) no-repeat`,
|
||||
backgroundSize: '14px',
|
||||
backgroundPosition: '0 55%',
|
||||
paddingLeft: '20px',
|
||||
paddingRight: '24px',
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
overflow: 'hidden',
|
||||
cursor: 'pointer',
|
||||
display: 'inline-block',
|
||||
}}>
|
||||
{this.file.fileName}
|
||||
{!this.disabled && (
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-close"
|
||||
style="float: right; position: relative; top: 2px; left: 8px; z-index: 100"
|
||||
class="dialog__upload_component__close"
|
||||
onClick={this.handleDelete}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'DialogForm',
|
||||
model: {
|
||||
prop: 'dataForm',
|
||||
event: 'update',
|
||||
},
|
||||
emits: ['update'],
|
||||
components: { Editor, uploadedFile },
|
||||
props: {
|
||||
dataForm: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
labelPosition: {
|
||||
type: String,
|
||||
default: 'top',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isInit: true,
|
||||
// allSpeicalEquipments: [],
|
||||
form: {},
|
||||
formFilters: {
|
||||
lineId: null,
|
||||
sectionId: null,
|
||||
},
|
||||
formLoading: true,
|
||||
dataLoaded: false,
|
||||
equipmentList: [],
|
||||
equipmentOptions: [],
|
||||
workerOptions: [],
|
||||
planOptions: [],
|
||||
sectionOptions: [],
|
||||
lineOptions: [],
|
||||
uploadOpen: false,
|
||||
uploadUrl: process.env.VUE_APP_BASE_API + '/admin-api/infra/file/upload', // 上传有关的headers,url都是固定的
|
||||
uploadHeaders: { Authorization: 'Bearer ' + getAccessToken() },
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
dataForm: {
|
||||
handler(val) {
|
||||
this.form = JSON.parse(JSON.stringify(val));
|
||||
// if (this.form.equipmentCategory != null) {
|
||||
// setTimeout(() => {
|
||||
// this.equipmentOptions = this.equipmentList
|
||||
// .filter((item) => item.special)
|
||||
// .filter(
|
||||
// (item) => item.specialType === this.form.equipmentCategory
|
||||
// )
|
||||
// .map((item) => ({ label: item.name, value: item.id }));
|
||||
// }, 1000);
|
||||
// }
|
||||
if (this.hasFiles) {
|
||||
if (typeof this.hasFiles == 'boolean' && this.hasFiles) {
|
||||
this.form.files = this.form.files ?? [];
|
||||
} else if (Array.isArray(this.hasFiles)) {
|
||||
this.hasFiles.forEach((prop) => {
|
||||
this.form[prop] = this.form[prop] ?? [];
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initOptions();
|
||||
},
|
||||
methods: {
|
||||
/** 模拟透传 ref */
|
||||
validate(cb) {
|
||||
return this.$refs.form.validate(cb);
|
||||
},
|
||||
resetFields(args) {
|
||||
return this.$refs.form.resetFields(args);
|
||||
},
|
||||
|
||||
// getCode
|
||||
async getCode() {
|
||||
const response = await this.$axios('/base/equipment-repair-log/getCode');
|
||||
this.form.repairOrderNumber = response.data || '';
|
||||
},
|
||||
|
||||
// initialize
|
||||
async initOptions() {
|
||||
this.formLoading = true;
|
||||
await this.getCode();
|
||||
await this.initEquipment();
|
||||
await this.initLines();
|
||||
await this.initWorker();
|
||||
await this.initSections();
|
||||
this.formLoading = false;
|
||||
this.isInit = false;
|
||||
this.setInitWorker();
|
||||
},
|
||||
|
||||
/** 设置默认维修工为用户自己 */
|
||||
setInitWorker() {
|
||||
/** 获取用户自身id */
|
||||
const userId = this.$store.getters.userId;
|
||||
this.$nextTick(() => {
|
||||
this.form.repairman = [userId];
|
||||
});
|
||||
},
|
||||
|
||||
/** 获取产线 */
|
||||
async initLines() {
|
||||
const res = await this.$axios('/base/core-production-line/listAll');
|
||||
this.lineOptions = (res.data || []).map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
|
||||
/** 获取工段 */
|
||||
async initSections(byLineId) {
|
||||
this.formLoading = !this.isInit && true;
|
||||
const res = await this.$axios({
|
||||
url:
|
||||
byLineId && !this.isInit
|
||||
? '/base/core-workshop-section/listByParentId?id=' + byLineId
|
||||
: '/base/core-workshop-section/listAll',
|
||||
});
|
||||
this.sectionOptions = (res.data || []).map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
this.formLoading = !this.isInit && false;
|
||||
},
|
||||
/** 获取设备 */
|
||||
async initEquipment() {
|
||||
const response = await this.$axios('/base/core-equipment/listAll');
|
||||
this.equipmentList = response.data || [];
|
||||
this.equipmentOptions = response.data || [];
|
||||
// this.allSpeicalEquipments = equipmentOptions;
|
||||
},
|
||||
/** 获取维修工 - 同时从用户表和员工表拉取数据 */
|
||||
async initWorker() {
|
||||
let list = [];
|
||||
/** user */
|
||||
const userList = await this.$axios({
|
||||
url: '/system/user/page',
|
||||
params: {
|
||||
pageNo: 1,
|
||||
pageSize: 100,
|
||||
},
|
||||
});
|
||||
list = list.concat(
|
||||
(userList.data?.list || []).map((item) => ({
|
||||
label: item.username,
|
||||
value: item.id,
|
||||
}))
|
||||
);
|
||||
/** worker */
|
||||
const workerList = await this.$axios({
|
||||
url: '/base/core-worker/listAll',
|
||||
});
|
||||
list = list.concat(
|
||||
(workerList.data || []).map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}))
|
||||
);
|
||||
/** setting */
|
||||
this.workerOptions = list;
|
||||
},
|
||||
|
||||
beforeUpload(file) {
|
||||
const checkFileSize = () => {
|
||||
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||
if (!isLt2M) {
|
||||
this.$modal.msgError('上传文件大小不能超过 2MB!');
|
||||
}
|
||||
return isLt2M;
|
||||
};
|
||||
const checkFileType = () => {
|
||||
const isJPG =
|
||||
file.type === 'image/jpeg' ||
|
||||
file.type === 'image/png' ||
|
||||
file.type === 'image/jpg';
|
||||
return isJPG;
|
||||
};
|
||||
return checkFileSize() && checkFileType();
|
||||
},
|
||||
|
||||
// handlers
|
||||
handleEqTypeChange(type) {
|
||||
this.form.equipmentId = null;
|
||||
console.log('111', type)
|
||||
this.equipmentOptions = this.equipmentList
|
||||
// if (type) {
|
||||
// this.equipmentOptions = this.equipmentList
|
||||
// .filter((item) => item.special)
|
||||
// .filter((item) => item.specialType === type)
|
||||
// .map((item) => ({ label: item.name, value: item.id }));
|
||||
// } else
|
||||
// this.equipmentOptions = this.equipmentList.map((item) => ({
|
||||
// label: item.name,
|
||||
// value: item.id,
|
||||
// }));
|
||||
// this.$emit('update', this.form)
|
||||
},
|
||||
|
||||
handleEqChange() {
|
||||
this.$emit('update', this.form);
|
||||
},
|
||||
|
||||
// 修改 是否计划保养 时
|
||||
handlePlanChange(val) {
|
||||
console.log('handlePlanChange', val);
|
||||
// this.form.equipmentCategory = null;
|
||||
this.form.equipmentId = null;
|
||||
this.$emit('update', { ...this.form, relatePlan: val });
|
||||
this.initEquipment(val == 1 ? 'special-equipment' : null);
|
||||
},
|
||||
|
||||
handleEditorInput(html) {
|
||||
this.$emit('update', {
|
||||
...this.form,
|
||||
maintenanceDes: html,
|
||||
});
|
||||
},
|
||||
|
||||
// upload
|
||||
handleFilesOpen() {},
|
||||
|
||||
handleUploadSuccess(response, file, prop) {
|
||||
console.log('response', response);
|
||||
if (response.code != 0) {
|
||||
this.$modal.msgError('上传失败: ', response.msg || '-');
|
||||
return;
|
||||
}
|
||||
this.form.files.push({
|
||||
fileName: file.name,
|
||||
fileUrl: response.data,
|
||||
fileType: prop == 'files' ? 2 : 1,
|
||||
});
|
||||
this.$modal.msgSuccess('上传成功');
|
||||
this.$emit('update', this.form);
|
||||
},
|
||||
|
||||
handleDeleteFile(file, prop) {
|
||||
this.form.files = this.form.files.filter(
|
||||
(item) => item.fileUrl != file.fileUrl
|
||||
);
|
||||
this.$emit('update', this.form);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.el-date-editor,
|
||||
.el-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.upload-area {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: height 0.3s ease-out;
|
||||
}
|
||||
|
||||
.upload-in-dialog {
|
||||
margin-right: 24px;
|
||||
position: relative;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 12px;
|
||||
z-index: 100;
|
||||
transition: transform 0.3s ease-out;
|
||||
}
|
||||
|
||||
.close-icon.open {
|
||||
transform: rotateZ(90deg);
|
||||
}
|
||||
|
||||
.dialog__upload_component__close {
|
||||
color: #ccc;
|
||||
}
|
||||
.dialog__upload_component__close:hover {
|
||||
/* color: #777; */
|
||||
color: red;
|
||||
}
|
||||
|
||||
.height-48 {
|
||||
height: 35px !important;
|
||||
}
|
||||
|
||||
:deep(.record-add__editor) {
|
||||
.ql-picker-label {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -41,9 +41,7 @@
|
||||
v-if="open"
|
||||
ref="form"
|
||||
v-model="form"
|
||||
:disabled="mode == 'detail'"
|
||||
:has-files="true"
|
||||
:rows="rows" />
|
||||
:disabled="mode == 'detail'" />
|
||||
</base-dialog>
|
||||
<CustomDialogForm
|
||||
v-if="addOrUpdateVisible"
|
||||
@@ -59,11 +57,12 @@ import CustomDialogForm from './CustomDialogForm.vue';
|
||||
import { deleteRepair, exportRepairLogExcel } from '@/api/equipment/base/repair'
|
||||
import { parseTime } from '@/utils/ruoyi'
|
||||
import htmls from './htmls.vue'
|
||||
import DialogForm from './Repair--add.vue';
|
||||
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
|
||||
|
||||
export default {
|
||||
name: 'EquipmentRepair',
|
||||
components: { CustomDialogForm },
|
||||
components: { CustomDialogForm, DialogForm },
|
||||
mixins: [basicPageMixin],
|
||||
data() {
|
||||
return {
|
||||
@@ -107,7 +106,7 @@ export default {
|
||||
{ prop: 'lineName', label: '产线名' },
|
||||
{ prop: 'sectionName', label: '工段名' },
|
||||
{ prop: 'equipmentName', label: '设备名称', minWidth: 100, showOverflowtooltip: true },
|
||||
{ prop: 'faultDetail', label: '故障明细' },
|
||||
{ prop: 'faultDetail', label: '故障明细', subcomponent: htmls },
|
||||
// { prop: 'maintenanceDetail', label: '维修明细', subcomponent: htmls, minWidth: 100, showOverflowtooltip: true },
|
||||
{
|
||||
prop: 'maintenanceStartTime',
|
||||
@@ -126,7 +125,7 @@ export default {
|
||||
filter: (v) => (v != null ? ['成功', '失败'][v] : ''),
|
||||
},
|
||||
// { prop: 'maintenanceDuration', label: '维修时长(h)' },
|
||||
{ prop: 'remark', label: '维修描述' }, // 没有参数
|
||||
{ prop: 'maintenanceDetail', label: '维修描述', subcomponent: htmls }, // 没有参数
|
||||
// { prop: 'repairman', label: '维修工', minWidth: 100, showOverflowtooltip: true },
|
||||
// { prop: 'repairmanPhone', label: '联系方式', minWidth: 100, showOverflowtooltip: true },
|
||||
{ prop: 'remark', label: '备注', minWidth: 120, showOverflowtooltip: true }
|
||||
@@ -187,71 +186,6 @@ export default {
|
||||
color: 'success',
|
||||
},
|
||||
],
|
||||
rows: [
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '维修单号',
|
||||
prop: 'repairOrderNumber',
|
||||
rules: [{ required: true, message: '维修单号不能为空', trigger: 'blur' }],
|
||||
},
|
||||
{
|
||||
select: true,
|
||||
label: '设备名称',
|
||||
prop: 'equipmentId',
|
||||
// url: '/base/core-equipment/listAll',
|
||||
url: '/base/core-equipment/page?special=false&pageNo=1&pageSize=99',
|
||||
bind: {
|
||||
filterable: true,
|
||||
clearable: true,
|
||||
},
|
||||
rules: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
// TODO: 和班组联动
|
||||
// select: true,
|
||||
input: true,
|
||||
label: '维修工',
|
||||
prop: 'repairman',
|
||||
// url: '/base/core-worker/listAll',
|
||||
// valueKey: 'name',
|
||||
bind: {
|
||||
filterable: true,
|
||||
clearable: true,
|
||||
// multiple: true,
|
||||
},
|
||||
// options: [{ label: 'test', value: 'test' }],
|
||||
rules: [{ required: true, message: '维修工不能为空', trigger: 'blur' }],
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
label: '联系方式',
|
||||
prop: 'repairmanPhone',
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
datetime: true,
|
||||
label: '故障发生时间',
|
||||
prop: 'faultTime',
|
||||
rules: [{ required: true, message: '故障发生时间不能为空', trigger: 'blur' }],
|
||||
bind: {
|
||||
format: 'yyyy-MM-dd HH:mm:ss',
|
||||
'value-format': 'timestamp',
|
||||
// 'value-format': 'yyyy-MM-dd HH:mm:ss',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
select: true,
|
||||
label: '故障级别',
|
||||
prop: 'faultLevel', // 数据字典
|
||||
options: this.getDictDatas(this.DICT_TYPE.FAULT_LEVEL),
|
||||
},
|
||||
],
|
||||
],
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
@@ -262,6 +196,7 @@ export default {
|
||||
maintenanceResult: null,
|
||||
createTime: null,
|
||||
equipmentId: null,
|
||||
special: false
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@@ -387,7 +322,10 @@ export default {
|
||||
// }
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
this.put(this.form).then((response) => {
|
||||
this.put({
|
||||
...this.form,
|
||||
repairman: this.form.repairman.join(',')
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
@@ -395,7 +333,10 @@ export default {
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
this.post(this.form).then((response) => {
|
||||
this.post({
|
||||
...this.form,
|
||||
repairman: this.form.repairman.join(',')
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
|
||||
Reference in New Issue
Block a user