projects/mesxc-lb #149

Merged
g7hoo merged 28 commits from projects/mesxc-lb into projects/mesxc-test 2023-12-19 09:02:24 +08:00
Showing only changes of commit cb9132abc1 - Show all commits

View File

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