This commit is contained in:
lb 2023-12-18 15:47:54 +08:00
parent 5886875770
commit cb9132abc1

View File

@ -1,10 +1,3 @@
<!--
filename: dialogForm.vue
author: liubin
date: 2023-10-31 15:55:13
description:
-->
<template>
<el-drawer
:visible.sync="visible"
@ -15,7 +8,9 @@
size="65%"
@closed="$emit('destroy')">
<small-title slot="title" :no-padding="true">
{{ disabled ? '查看详情' : !dataForm.maintenanceStatus ? '修改' : '完成' }}
{{
disabled ? '查看详情' : !dataForm.maintenanceStatus ? '修改' : '完成'
}}
</small-title>
<div class="drawer-body flex">
<div class="drawer-body__content">
@ -31,6 +26,17 @@
<span>{{ dataForm.repairOrderNumber }}</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备大类" prop="equipmentCategory">
<span>
{{
['-', '安全设备', '消防设备', '特种设备'][
dataForm.equipmentCategory || 0
]
}}
</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备名称" prop="equipmentName">
<span>{{ dataForm.equipmentName }}</span>
@ -41,8 +47,6 @@
<span>{{ dataForm.repairman }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="故障发生时间" prop="faultTime">
<span>{{ parseTime(dataForm.faultTime) }}</span>
@ -50,7 +54,9 @@
</el-col>
<el-col :span="8">
<el-form-item label="故障级别" prop="faultLevel">
<span>{{ getDictDataLabel('fault-level', dataForm.faultLevel) }}</span>
<span>
{{ getDictDataLabel('fault-level', dataForm.faultLevel) }}
</span>
</el-form-item>
</el-col>
<el-col :span="8">
@ -61,9 +67,18 @@
</el-row>
<el-divider />
<div v-if=" disabled && dataForm.maintenanceStatus === 1 ? true : !disabled ? true : false">
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
<div
v-if="
disabled && dataForm.maintenanceStatus === 1
? true
: !disabled
? true
: false
">
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
{{ '设备维修信息' }}
</small-title>
<el-row :gutter="20">
@ -71,7 +86,13 @@
<el-form-item
label="维修开始时间"
prop="maintenanceStartTime"
:rules="[{ required: true, message: '维修开始时间不能为空', trigger: 'blur' }]">
:rules="[
{
required: true,
message: '维修开始时间不能为空',
trigger: 'blur',
},
]">
<el-date-picker
v-model="dataForm.maintenanceStartTime"
type="datetime"
@ -84,7 +105,13 @@
<el-form-item
label="维修结束时间"
prop="maintenanceFinishTime"
:rules="[{ required: true, message: '维修结束时间不能为空', trigger: 'blur' }]">
:rules="[
{
required: true,
message: '维修结束时间不能为空',
trigger: 'blur',
},
]">
<el-date-picker
v-model="dataForm.maintenanceFinishTime"
type="datetime"
@ -97,7 +124,13 @@
<el-form-item
label="维修方式"
prop="repairMode"
:rules="[{ required: true, message: '维修方式不能为空', trigger: 'blur' }]">
:rules="[
{
required: true,
message: '维修方式不能为空',
trigger: 'blur',
},
]">
<el-select
:disabled="disabled"
v-model="dataForm.repairMode"
@ -131,9 +164,18 @@
<el-form-item
label="故障明细"
prop="faultDetail"
:rules="[{ required: true, message: '故障明细不能为空', trigger: 'blur' }]">
:rules="[
{
required: true,
message: '故障明细不能为空',
trigger: 'blur',
},
]">
<!-- // -->
<editor v-model="dataForm.faultDetail" :read-only="disabled" :min-height="150"/>
<editor
v-model="dataForm.faultDetail"
:read-only="disabled"
:min-height="150" />
</el-form-item>
</el-col>
</el-row>
@ -142,7 +184,10 @@
<el-col>
<el-form-item label="维修记录" prop="maintenanceDetail">
<!-- // -->
<editor v-model="dataForm.maintenanceDetail" :read-only="disabled" :min-height="150"/>
<editor
v-model="dataForm.maintenanceDetail"
:read-only="disabled"
:min-height="150" />
</el-form-item>
</el-col>
</el-row>
@ -150,7 +195,12 @@
<el-row :gutter="20">
<el-col>
<el-form-item label="维修附件" prop="file">
<FileUpload v-model="file" :limit="1" :f-name="fileName" :disabled="disabled" @name="setFileName" />
<FileUpload
v-model="file"
:limit="1"
:f-name="fileName"
:disabled="disabled"
@name="setFileName" />
</el-form-item>
</el-col>
</el-row>
@ -179,11 +229,11 @@
<script>
import SmallTitle from './SmallTitle.vue';
import { getEqRepair, updateEqRepair } from '@/api/equipment/base/repair'
import Editor from "@/components/Editor";
import FileUpload from "@/components/FileUpload";
import { getDictDatas } from "@/utils/dict";
import { parseTime } from '@/utils/ruoyi'
import { getEqRepair, updateEqRepair } from '@/api/equipment/base/repair';
import Editor from '@/components/Editor';
import FileUpload from '@/components/FileUpload';
import { getDictDatas } from '@/utils/dict';
import { parseTime } from '@/utils/ruoyi';
import { getDictDataLabel } from '@/utils/dict';
export default {
@ -211,13 +261,13 @@ export default {
disabled: false,
dataForm: {},
file: '',
fileName: ''
fileName: '',
};
},
mounted() {},
methods: {
setFileName(val) {
this.fileName = val
this.fileName = val;
},
goback() {
this.$emit('refreshDataList');
@ -234,8 +284,8 @@ export default {
return this.$refs.form.resetFields(args);
},
initData() {
this.file = ''
this.fileName = ''
this.file = '';
this.fileName = '';
},
init(row, isdetail) {
this.initData();
@ -248,57 +298,59 @@ export default {
if (this.dataForm.id) {
//
getEqRepair(this.dataForm.id).then(response => {
this.formLoading = false
this.dataForm = response.data;
this.dataForm.maintenanceStatus = this.dataForm.maintenanceStatus || 0
getEqRepair(this.dataForm.id).then((response) => {
this.formLoading = false;
this.dataForm = response.data;
debugger;
this.dataForm.maintenanceStatus =
this.dataForm.maintenanceStatus || 0;
if (this.dataForm.files.length > 0) {
this.file = this.dataForm.files[0].fileUrl
this.fileName = this.dataForm.files[0].fileName
this.file = this.dataForm.files[0].fileUrl;
this.fileName = this.dataForm.files[0].fileName;
}
});
});
} else {
// if (this.urlOptions.isGetCode) {
// this.getCode()
// }
// this.getCode()
// }
}
});
},
//
dataFormSubmit() {
this.$refs["form"].validate((valid) => {
if (!valid) {
return false;
}
//
dataFormSubmit() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.file) {
const temp = this.file.split(',') //
let arry = []
temp.forEach(item => {
const temp = this.file.split(','); //
let arry = [];
temp.forEach((item) => {
arry.push({
fileName: this.fileName,
fileType: 2,
fileUrl: item
})
})
this.dataForm.files = arry
fileUrl: item,
});
});
this.dataForm.files = arry;
}
if (this.dataForm.id) {
updateEqRepair(this.dataForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
//
// this.urlOptions.createURL(this.dataForm).then(response => {
// this.$modal.msgSuccess("");
// this.visible = false;
// this.$emit("refreshDataList");
// });
});
},
if (this.dataForm.id) {
updateEqRepair(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
// this.urlOptions.createURL(this.dataForm).then(response => {
// this.$modal.msgSuccess("");
// this.visible = false;
// this.$emit("refreshDataList");
// });
});
},
},
};
</script>