bug修复

This commit is contained in:
hongchao 2024-12-20 14:10:16 +08:00
parent 460bc81aaf
commit 48b4d6aab6
5 changed files with 255 additions and 13 deletions

View File

@ -287,10 +287,12 @@ const changeFileFn = (ev: any) => {
width: v-bind('props.width') !important;
height: v-bind('props.height') !important;
justify-content: v-bind('props.justifyContent');
justify-content: center;
}
:deep(.el-upload-list__item) {
width: v-bind('props.width') !important;
height: v-bind('props.height') !important;
justify-content: center;
}
</style>
<style></style>

View File

@ -239,6 +239,21 @@
</el-row>
</div>
</div>
<div class="appearance">
<div class="publicTitle">检测记录</div>
<div class="rental-record">
<el-table
:data="pageData.qcList"
style="width: 100%"
:header-cell-style="{ background: '#00a288', color: '#fff' }"
>
<el-table-column align="center" type="index" label="序号" width="80" />
<el-table-column align="center" prop="qcTime" label="检测日期" />
<el-table-column align="center" prop="leaseName" label="有效期" />
<el-table-column align="center" prop="leaseStartTime" label="检测单位" />
</el-table>
</div>
</div>
<div class="appearance">
<div class="publicTitle">出租记录</div>
<div class="rental-record">

View File

@ -12,6 +12,7 @@ import { ref } from 'vue'
import { useStore } from 'store/user'
const store = useStore()
import { mainStore } from 'store/main'
import { InfoFilled, UploadFilled } from '@element-plus/icons-vue'
const store2 = mainStore()
const isViewForm = ref(false)
@ -167,6 +168,11 @@ const equipmentDeployment = () => {
detailsFileList.value = []
insurancePdf.value = []
examinationPdf.value = []
//table
equipTableList.value = [],
//
dialogFormVisibleSettlein.value = true
}
@ -431,6 +437,16 @@ const dialogTypeChange = async () => {
addAndEditForm.unitName = deviceTypeList[0].data.unitName
addAndEditForm.dayLeasePrice = deviceTypeList[0].data.leasePrice
addAndEditFormRef.value.clearValidate(['unitName', 'dayLeasePrice'])
equipTableList.value = []
equipTableList.value.push({
name1: '',
name2: '',
name3: '',
name4: '',
name5: '',
name6: '',
fileListEquip: [],
})
}
//
const getCompanyList = async () => {
@ -984,6 +1000,20 @@ const onExaminationPdfChange = (fileList: any, index: number) => {
descriptionFormList.value[index].examinationTempPdf.push(...fileListTemp)
}
const onFileChangeEquip = (fileList: any,row:any,index:number) => {
equipTableList.value[index].fileListEquip = []
const fileListTemp = fileList.map((e: any) => {
return {
fileName: e.name,
fileUrl: e.url,
}
})
console.log('11111',fileListTemp[0].fileUrl)
equipTableList.value[index].name2 = fileListTemp[0].fileUrl
console.log('333',equipTableList.value[index].name2)
equipTableList.value[index].fileListEquip.push(fileListTemp[0])
}
// const onDeleteImgInDetails = () => {}
const onDeleteImgInMain = (index: any) => {
@ -1044,6 +1074,31 @@ const chunkedItems = computed(() => {
}
return result;
})
const equipTableList = ref<any>([])
const handleAddBack = () => {
let obj = {
name1: '',
name2: '',
name3: '',
name4: '',
name5: '',
name6: '',
fileListEquip: [],
};
equipTableList.value.push(obj);
}
const handleDeleteBack = (index:number) => {
equipTableList.value.splice(index, 1);
}
const fileListEquip = ref<any>([])
const viewCertificate = (url:string) => {
console.log('2233',url)
window.open(url, '_blank');
};
</script>
<template>
@ -1613,16 +1668,16 @@ const chunkedItems = computed(() => {
</el-col>
</el-row>
<TitleTip :titleText="`装备证书`" />
<el-row :gutter="20" v-if="!isEditForm && !isViewForm">
<!-- <el-row :gutter="20" v-if="!isEditForm && !isViewForm">
<el-col :span="24">
<el-button class="primary-lease" type="primary" @click="onAddDescription">
添加装备证书
</el-button>
</el-col>
</el-row>
</el-row> -->
</el-form>
<el-form
<!-- <el-form
label-width="140px"
label-position="right"
:rules="descriptionRules"
@ -1656,8 +1711,8 @@ const chunkedItems = computed(() => {
支持格式.jpg.png 单个文件大小不能超过5M
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
</el-row> -->
<!-- <el-row :gutter="20">
<el-col :span="24">
<el-form-item
style="font-weight: bold"
@ -1792,8 +1847,145 @@ const chunkedItems = computed(() => {
移除
</el-button>
</el-col>
</el-row>
</el-form>
</el-row> -->
<!-- </el-form> -->
<el-table :data="equipTableList" width="100%" height="450px">
<el-table-column label="序号" type="index" width="55" align="center" />
<el-table-column
label="唯一标识符"
prop="name1"
align="center"
:show-overflow-tooltip="true"
>
<template v-slot="scope">
<el-input
v-model="scope.row.partName"
style="width: 100%"
maxlength="20"
></el-input>
</template>
</el-table-column>
<el-table-column
label="合格证"
prop="name2"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{row,$index}">
<div v-if="row.name2==''">
<UploadComponentNew
:maxSize="10"
:max-limit="1"
width="100%"
height="100%"
:multiple="true"
:autoUpload="true"
:actionUrl="uploadUrl"
:minLimit="row.fileListEquip.length"
listType="text"
:justifyContent="`flex-start`"
:acceptTypeList="['.jpg', '.png']"
@onFileChange="(fileList) =>onFileChangeEquip(fileList,row,$index)"
>
<div style="display: flex; justify-content: center;align-items: center;">
<el-button
type="text"
style="color: #00a288; text-decoration: underline"
>上传</el-button>
</div>
</UploadComponentNew>
<!-- <el-button size="mini" type="primary" @click="uploadTestReport(row)">上传</el-button> -->
</div>
<div v-else>
<el-button
type="text"
style="color: #00a288; text-decoration: underline"
@click="viewCertificate(row.fileListEquip[0].fileUrl)"
>查看</el-button
>
</div>
</template>
</el-table-column>
<el-table-column
label="检修人"
prop="name3"
align="center"
:show-overflow-tooltip="true"
>
<template v-slot="scope">
<el-input
v-model="scope.row.backCost"
controls-position="right"
style="width: 100%"
:min="0"
></el-input>
</template>
</el-table-column>
<el-table-column
label="检修时间"
prop="name4"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{row}">
<el-date-picker
v-model="row.name4"
type="date"
placeholder="请选择"
style="width: 100%"
></el-date-picker>
</template>
</el-table-column>
<el-table-column
label="下次检测时间"
prop="name5"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{row}">
<el-date-picker
v-model="row.name5"
type="date"
placeholder="请选择"
style="width: 100%"
></el-date-picker>
</template>
</el-table-column>
<el-table-column
label="检测证明"
prop="name6"
align="center"
:show-overflow-tooltip="true"
>
<template v-slot="scope">
<el-input
v-model="scope.row.backCost"
controls-position="right"
style="width: 100%"
:min="0"
></el-input>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="150px">
<template #default="{row,$index}">
<div
style="
width: 100%;
height: 40px;
display: flex;
align-items: center;
justify-content: space-between;
"
>
<el-button size="mini" type="primary" @click="handleAddBack">添加</el-button>
<el-button size="mini" type="danger" @click="handleDeleteBack($index)">删除</el-button>
</div>
</template>
</el-table-column>
</el-table>
</el-dialog>
<!-- 图片查看弹窗 -->

View File

@ -291,7 +291,7 @@
}"
>
<el-table-column prop="fileName" align="center" label="文件名称" />
<el-table-column align="center" label="操作" width="120">
<el-table-column align="center" label="文件" width="120">
<template #default="{ row }">
<el-image
style="width: 60px; height: 60px"
@ -307,6 +307,13 @@
/>
</template>
</el-table-column>
<el-table-column align="center" label="文件" width="120">
<template #default="{ row }">
<el-button type="primary" size="mini" @click="onDownload(row)">
下载
</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
</el-dialog>
@ -324,6 +331,7 @@ import {
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus } from '@element-plus/icons-vue'
const uploadUrl = import.meta.env.VITE_API_URL + '/file/upload'
import axios from 'axios';
const dialogTitle = ref('')
const repairFormRefList = ref<any>([])
const lossFormRefList = ref<any>([])
@ -701,8 +709,16 @@ const onClose = () => {
}
const onViewFileImg = (row: any, index: number) => {
console.log('11111111111')
viewFileInfoList.value = []
viewFileInfoList.value = fileListAll.value.filter((e: any) => e.fileType == index)
if(fileListAll.value){
fileListAll.value.forEach((e) => {
if (e.fileType == index) {
viewFileInfoList.value.push(e);
}
});
}
// viewFileInfoList.value = fileListAll.value.filter((e: any) => e.fileType == index)
console.log(viewFileInfoList.value, ' viewFileInfoList.value')
innerVisible.value = true
@ -766,6 +782,23 @@ const onSubmitChangePrice = () => {
.catch(async () => {})
}
//
const onDownload = async (row) => {
try {
const response = await axios.get(row.fileUrl, {
responseType: 'blob',
});
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', row.fileName);
document.body.appendChild(link);
link.click();
} catch (error) {
ElMessage.error('下载失败,请稍后重试');
}
};
watch(
() => props.orderId,
(newValue) => {

View File

@ -513,14 +513,14 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<!-- <el-row :gutter="20">
<el-col :span="24">
<el-form-item label="1" style="margin-bottom: 0" class="upload-tip">
支持格式.jpg.png 单个文件大小不能超过2M最多可上传4张
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
</el-row> -->
<!-- <el-row :gutter="24">
<el-col :span="20">
<el-form-item label="参考图片/样式">
<div class="img-list" v-if="item.fileInfoList.length > 0">
@ -570,7 +570,7 @@
移除
</el-button>
</el-col>
</el-row>
</el-row> -->
</el-form>
<template #footer>
<div class="dialog-footer">