问题优化

This commit is contained in:
bb_pan 2025-02-26 15:35:46 +08:00
parent ad64f17c1a
commit f5c4e82a1d
3 changed files with 140 additions and 39 deletions

View File

@ -172,17 +172,41 @@
</div>
</div>
<div class="appearance">
<!-- <div class="publicTitle">证书展示</div> -->
<!-- <div class="certificate"> -->
<!-- <el-row>
<div class="publicTitle">证书展示</div>
<div class="certificate">
<el-row>
<el-col :span="2">
<div>合格证</div>
</el-col>
<el-col :span="22">
<div class="prove-container">
<div v-for="item in pageData.insurancePdf" :key="item.id">
<a
v-if="item.fileUrl.includes('.pdf')"
:href="item.fileUrl"
target="_blank"
>
<img
style="width: 100px; height: 100px"
src="@/assets/img/pdf.png"
/>
</a>
<a
v-else-if="
item.fileUrl.includes('.doc') ||
item.fileUrl.includes('.docx')
"
:href="item.fileUrl"
target="_blank"
>
<img
style="width: 100px; height: 100px"
src="@/assets/img/word.png"
/>
</a>
<el-image
style="width: 100%; height: 100%"
v-else
style="width: 100px; height: 100px"
:src="item.fileUrl"
:zoom-rate="1.2"
:max-scale="7"
@ -196,8 +220,8 @@
</div>
</div>
</el-col>
</el-row> -->
<!-- <el-row>
</el-row>
<!-- <el-row>
<el-col :span="2">
<div>检测证明</div>
</el-col>
@ -220,7 +244,7 @@
</div>
</el-col>
</el-row> -->
<!-- </div> -->
</div>
</div>
<div class="appearance">
<div class="publicTitle">检测记录</div>
@ -1551,8 +1575,8 @@ onMounted(() => {
flex-wrap: wrap;
div {
width: calc((100% - 30px) / 3);
height: 200px;
/* width: calc((100% - 30px) / 3);
height: 200px; */
margin: 0 15px 15px 0;
&:nth-child(3n) {

View File

@ -317,6 +317,12 @@ const getDetailData = async (row: any) => {
e.name = e.fileName
})
}
if (item.insurancePdf && item.insurancePdf.length > 0) {
item.insurancePdf.forEach((e: any) => {
e.url = e.fileUrl
e.name = e.fileName
})
}
equipTableList.value.push({
id: item.id,
identifyCode: item.identifyCode,
@ -355,6 +361,12 @@ const getDetailData = async (row: any) => {
e.name = e.fileName
})
}
if (item.insurancePdf && item.insurancePdf.length > 0) {
item.insurancePdf.forEach((e: any) => {
e.url = e.fileUrl
e.name = e.fileName
})
}
equipTableList.value.push({
id: item.id,
identifyCode: item.identifyCode,
@ -1189,24 +1201,42 @@ const handlePreview = (e: any) => {
window.open(e.fileUrl, '_blank')
}
//
const handleRemove = (file: any, row: any) => {
const handleRemove = (file: any, row: any, type: Number) => {
console.log('🚀 ~ handleRemove ~ handleRemove:', file)
if (row.id) {
const index = row.examinationPdf.findIndex((e: any) => e.fileUrl == file.fileUrl)
if (index > -1) {
row.examinationPdf.splice(index, 1)
if (type == 1) {
const index = row.examinationPdf.findIndex((e: any) => e.fileUrl == file.fileUrl)
if (index > -1) {
row.examinationPdf.splice(index, 1)
}
} else {
const index = row.insurancePdf.findIndex((e: any) => e.fileUrl == file.fileUrl)
if (index > -1) {
row.insurancePdf.splice(index, 1)
}
}
} else {
const index = row.examinationPdf.findIndex((e: any) => e.fileUrl == file.response.data.url)
if (index > -1) {
row.examinationPdf.splice(index, 1)
if (type == 1) {
const index = row.examinationPdf.findIndex(
(e: any) => e.fileUrl == file.response.data.url,
)
if (index > -1) {
row.examinationPdf.splice(index, 1)
}
} else {
const index = row.insurancePdf.findIndex(
(e: any) => e.fileUrl == file.response.data.url,
)
if (index > -1) {
row.insurancePdf.splice(index, 1)
}
}
}
console.log('🚀 ~ handleRemove ~ row:', row.examinationPdf)
}
//
const handleSuccess = (uploadFile: any, row: any) => {
const handleSuccess = (uploadFile: any, row: any, type: Number) => {
console.log('🚀 ~ handleSuccess ~ uploadFile:', uploadFile)
if (uploadFile.code == 200) {
let fileUrl = ''
@ -1219,10 +1249,17 @@ const handleSuccess = (uploadFile: any, row: any) => {
fileUrl = 'http://sgwpdm.ah.sgcc.com.cn/iws/ahbns/' + uploadFile.data.url // -
}
console.log('输出fileUrl----------', fileUrl)
row.examinationPdf.push({
fileName: uploadFile.data.name,
fileUrl: fileUrl,
})
if (type == 1) {
row.examinationPdf.push({
fileName: uploadFile.data.name,
fileUrl: fileUrl,
})
} else {
row.insurancePdf.push({
fileName: uploadFile.data.name,
fileUrl: fileUrl,
})
}
}
console.log('🚀 ~ handleSuccess ~ row:', row)
}
@ -2258,11 +2295,27 @@ const changeNextDate = (row: any) => {
</template>
</el-table-column>
<el-table-column
label="检测证明"
prop="name6"
align="center"
>
<el-table-column label="合格证" prop="name2" align="center">
<template #default="{ row, $index }">
<el-upload
:file-list="row.insurancePdf"
class="upload-demo"
:action="uploadUrl"
:headers="headerInfo"
:before-upload="beforeUpload"
:on-preview="handlePreview"
:on-remove="(file: any) => handleRemove(file, row, 2)"
:on-exceed="handleExceed"
:limit="5"
:on-success="(file: any) => handleSuccess(file, row, 2)"
accept=".jpg,.png,.pdf, .doc, .docx"
>
<el-button v-if="isAdd" type="primary" size="mini">上传</el-button>
</el-upload>
</template>
</el-table-column>
<el-table-column label="检测证明" prop="name6" align="center">
<template #default="{ row, $index }">
<el-upload
:file-list="row.examinationPdf"
@ -2271,10 +2324,10 @@ const changeNextDate = (row: any) => {
:headers="headerInfo"
:before-upload="beforeUpload"
:on-preview="handlePreview"
:on-remove="(file: any) => handleRemove(file, row)"
:on-remove="(file: any) => handleRemove(file, row, 1)"
:on-exceed="handleExceed"
:limit="5"
:on-success="(file: any) => handleSuccess(file, row)"
:on-success="(file: any) => handleSuccess(file, row, 1)"
accept=".jpg,.png,.pdf, .doc, .docx"
>
<el-button v-if="isAdd" type="primary" size="mini">上传</el-button>

View File

@ -4,7 +4,7 @@ import { useRouter } from 'vue-router'
import { useStore } from '../../store/user'
import { useRoute } from 'vue-router'
const store = useStore()
const store: any = useStore()
const router = useRouter()
const route = useRoute()
@ -12,10 +12,27 @@ import imgSrc from '@/assets/img/logo.png'
import { el } from 'element-plus/es/locale'
const handleSelect = (name: any, path: any) => {
store.editcurrentMenuItem(name)
router.push({
name,
})
console.log('🚀 ~ handleSelect ~ name:', name)
console.log('🚀 ~ handleSelect ~ store.token:', store.token)
if (name == 'admin') {
// const host = window.location.origin
// if (host.indexOf('sgwpdm.ah.sgcc.com.cn') > -1) {
// window.open(`${host}/iws/glweb/login?token@${store.token}@`)
// } else {
// // window.open(`${host}/glweb/?token@${store.token}@`)
// if (import.meta.env.VITE_ENV === 'production') {
// window.open(`${host}/glweb/?token@${store.token}@`)
// } else {
// window.open(`${host}/iws/glweb/?token@${store.token}@`)
// }
// }
} else {
store.editcurrentMenuItem(name)
router.push({
name,
})
}
}
const isType: any = computed(() => {
@ -36,26 +53,33 @@ const lessorMenus: MenuItem[] = [
{ title: '接单管理', name: 'accept-orders', permission: ['1'] },
{ title: '质检管理', name: 'quality-manage', permission: ['1'] },
{ title: '合同管理', name: 'contract-manage', permission: ['1'] },
// { title: '', name: 'admin', permission: ['1'] },
]
// ---
const lesseeMenus: MenuItem[] = [
{ title: '需求管理', name: 'sourcingNeed', permission: ['2'] },
{ title: '租赁订单', name: 'orderManagement', permission: ['2'] },
{ title: '收货地址管理', name: 'address-manage', permission: ['2'] },
// { title: '', name: 'admin', permission: ['2'] },
]
//
const allList: MenuItem[] = [...lessorMenus, ...lesseeMenus]
const rolesType = ref(localStorage.getItem('rolesTypeName') || '出租方')
const rolesType: any = ref('')
if (localStorage.getItem('rolesTypeName')) {
rolesType.value = localStorage.getItem('rolesTypeName')
} else {
rolesType.value = '承租方'
}
const menuList: any = computed(() => {
if (rolesType.value == '承租方') return allList.filter((e) => e.permission.includes('2'))
if (rolesType.value == '出租方') return allList.filter((e) => e.permission.includes('1'))
return rolesType.value == '承租方'
? allList.filter((e) => e.permission.includes('2'))
: allList.filter((e) => e.permission.includes('1'))
})
const activeItem = computed(() => {
// return 'sourcingNeed'
if (store.currentMenuItem) {
return store.currentMenuItem
if (rolesType.value == '出租方') {
return 'goodsManagement'
} else {
return 'sourcingNeed'
}