调整预览历史图错误问题 管理端备货单添加删除
This commit is contained in:
+1
-1
@@ -236,7 +236,7 @@
|
|||||||
.el-dialog__footer {
|
.el-dialog__footer {
|
||||||
background: transparent !important;
|
background: transparent !important;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: inherit;
|
||||||
}
|
}
|
||||||
.el-dialog__header {
|
.el-dialog__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -298,6 +298,13 @@ export class manageService {
|
|||||||
params
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
//备货单删除
|
||||||
|
static delectStock(params: any) {
|
||||||
|
return request.get<any>({
|
||||||
|
url: '/admin/stock/order/destroy',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
//打印
|
//打印
|
||||||
static printStock(params: any) {
|
static printStock(params: any) {
|
||||||
return request.get<any>({
|
return request.get<any>({
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<!-- <el-button size="small" type="primary" :href="currentFile?.url" target="_blank"
|
<!-- <el-button size="small" type="primary" :href="currentFile?.url" target="_blank"
|
||||||
>在新标签打开</el-button
|
>在新标签打开</el-button
|
||||||
> -->
|
> -->
|
||||||
<el-button size="small" @click="downloadCurrent">下载</el-button>
|
<!-- <el-button size="small" @click="downloadCurrent">下载</el-button> -->
|
||||||
<el-button size="small" type="danger" @click="handleClose">关闭</el-button>
|
<el-button size="small" type="danger" @click="handleClose">关闭</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -131,6 +131,7 @@
|
|||||||
|
|
||||||
// --- Props ---
|
// --- Props ---
|
||||||
interface FileItem {
|
interface FileItem {
|
||||||
|
file_name: any
|
||||||
name?: string
|
name?: string
|
||||||
url: string
|
url: string
|
||||||
mime?: string // 可选,优先使用
|
mime?: string // 可选,优先使用
|
||||||
@@ -253,8 +254,12 @@
|
|||||||
const fileType = computed(() => {
|
const fileType = computed(() => {
|
||||||
const f = currentFile.value
|
const f = currentFile.value
|
||||||
if (!f) return 'unknown'
|
if (!f) return 'unknown'
|
||||||
const mime = (f.mime || mimeFromName(f.name) || '').toLowerCase()
|
let names = f.name
|
||||||
const ext = getExtension(f.name)
|
if (names == '') {
|
||||||
|
names = f.file_name
|
||||||
|
}
|
||||||
|
const mime = (f.mime || mimeFromName(names) || '').toLowerCase()
|
||||||
|
const ext = getExtension(names)
|
||||||
|
|
||||||
if (mime.startsWith('image/') || ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'webp'].includes(ext))
|
if (mime.startsWith('image/') || ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'webp'].includes(ext))
|
||||||
return 'image'
|
return 'image'
|
||||||
|
|||||||
@@ -85,6 +85,14 @@
|
|||||||
>
|
>
|
||||||
<i class="iconfont-sys"></i> 查看审批
|
<i class="iconfont-sys"></i> 查看审批
|
||||||
</el-link>
|
</el-link>
|
||||||
|
<el-link
|
||||||
|
type="danger"
|
||||||
|
underline="never"
|
||||||
|
@click="stockdeletefn(scope.row)"
|
||||||
|
style="margin-right: 8px"
|
||||||
|
>
|
||||||
|
<i class="iconfont-sys"></i> 删除
|
||||||
|
</el-link>
|
||||||
<!-- <el-link
|
<!-- <el-link
|
||||||
type="primary"
|
type="primary"
|
||||||
underline="never"
|
underline="never"
|
||||||
@@ -376,110 +384,6 @@
|
|||||||
// })
|
// })
|
||||||
// TODO: 跳转或弹窗查看备货单
|
// TODO: 跳转或弹窗查看备货单
|
||||||
}
|
}
|
||||||
// 判断是否为图片文件
|
|
||||||
/* const isImageFile = (file: { name: string; url: string; file_name: string }) => {
|
|
||||||
// 检查文件名
|
|
||||||
if (file.name && /\.(jpg|jpeg|png|gif|webp)$/i.test(file.name)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查file_name字段
|
|
||||||
if (file.file_name && file.file_name.startsWith('image/')) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查URL中的文件扩展名(去除查询参数)
|
|
||||||
if (file.url) {
|
|
||||||
const urlWithoutParams = file.url.split('?')[0] // 移除查询参数
|
|
||||||
if (/\.(jpg|jpeg|png|gif|webp)$/i.test(urlWithoutParams)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
} */
|
|
||||||
|
|
||||||
// 预览图片
|
|
||||||
/* const previewImage = (file: { name: string; url: string; file_name: string }) => {
|
|
||||||
// 创建图片预览弹窗
|
|
||||||
const imagePreview = document.createElement('div')
|
|
||||||
imagePreview.style.cssText = `
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background: rgba(0, 0, 0, 0.8);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
z-index: 9999;
|
|
||||||
cursor: pointer;
|
|
||||||
`
|
|
||||||
|
|
||||||
const image = document.createElement('img')
|
|
||||||
image.src = file.url
|
|
||||||
image.alt = file.name
|
|
||||||
image.style.cssText = `
|
|
||||||
max-width: 90%;
|
|
||||||
max-height: 90%;
|
|
||||||
object-fit: contain;
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
|
|
||||||
`
|
|
||||||
|
|
||||||
const closeBtn = document.createElement('div')
|
|
||||||
closeBtn.innerHTML = '×'
|
|
||||||
closeBtn.style.cssText = `
|
|
||||||
position: absolute;
|
|
||||||
top: 20px;
|
|
||||||
right: 30px;
|
|
||||||
color: white;
|
|
||||||
font-size: 30px;
|
|
||||||
cursor: pointer;
|
|
||||||
z-index: 10000;
|
|
||||||
`
|
|
||||||
|
|
||||||
imagePreview.appendChild(image)
|
|
||||||
imagePreview.appendChild(closeBtn)
|
|
||||||
document.body.appendChild(imagePreview)
|
|
||||||
|
|
||||||
// 点击关闭
|
|
||||||
const closePreview = () => {
|
|
||||||
document.body.removeChild(imagePreview)
|
|
||||||
}
|
|
||||||
|
|
||||||
imagePreview.addEventListener('click', closePreview)
|
|
||||||
closeBtn.addEventListener('click', (e) => {
|
|
||||||
e.stopPropagation()
|
|
||||||
closePreview()
|
|
||||||
})
|
|
||||||
|
|
||||||
// ESC键关闭
|
|
||||||
const handleKeydown = (e: KeyboardEvent) => {
|
|
||||||
if (e.key === 'Escape') {
|
|
||||||
closePreview()
|
|
||||||
document.removeEventListener('keydown', handleKeydown)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document.addEventListener('keydown', handleKeydown)
|
|
||||||
} */
|
|
||||||
|
|
||||||
// 下载文件
|
|
||||||
/* const downloadFile = (file: { name: string; url: string; file_name: string }) => {
|
|
||||||
try {
|
|
||||||
const link = document.createElement('a')
|
|
||||||
link.href = file.url
|
|
||||||
link.download = file.name
|
|
||||||
link.target = '_blank'
|
|
||||||
document.body.appendChild(link)
|
|
||||||
link.click()
|
|
||||||
document.body.removeChild(link)
|
|
||||||
} catch (error) {
|
|
||||||
console.error('下载失败:', error)
|
|
||||||
ElMessage.error('下载失败,请稍后重试')
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
//审批进度
|
//审批进度
|
||||||
const showDialogtimeline = async (row: any) => {
|
const showDialogtimeline = async (row: any) => {
|
||||||
// 审批记录(兼容多种字段)
|
// 审批记录(兼容多种字段)
|
||||||
@@ -504,6 +408,29 @@
|
|||||||
}
|
}
|
||||||
timelineDialogVisible.value = true
|
timelineDialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
//删除
|
||||||
|
const stockdeletefn = (row: any) => {
|
||||||
|
ElMessageBox.confirm('确定要删除此备货单吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
manageService
|
||||||
|
.delectStock({ id: row.id })
|
||||||
|
.then((res) => {
|
||||||
|
ElMessage.success(res?.message || '操作成功')
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
// 你可以在这里调用接口或做后续处理
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// 用户点击了取消
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -93,6 +93,14 @@
|
|||||||
>
|
>
|
||||||
<i class="iconfont-sys"></i> 查看审批
|
<i class="iconfont-sys"></i> 查看审批
|
||||||
</el-link>
|
</el-link>
|
||||||
|
<el-link
|
||||||
|
type="danger"
|
||||||
|
underline="never"
|
||||||
|
@click="stockdeletefn(scope.row)"
|
||||||
|
style="margin-right: 8px"
|
||||||
|
>
|
||||||
|
<i class="iconfont-sys"></i> 删除
|
||||||
|
</el-link>
|
||||||
</ElRow>
|
</ElRow>
|
||||||
</template>
|
</template>
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
@@ -355,110 +363,6 @@
|
|||||||
orderDialog.visible = true
|
orderDialog.visible = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 判断是否为图片文件
|
|
||||||
/* const isImageFile = (file: { name: string; url: string; file_name: string }) => {
|
|
||||||
// 检查文件名
|
|
||||||
if (file.name && /\.(jpg|jpeg|png|gif|webp)$/i.test(file.name)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查file_name字段
|
|
||||||
if (file.file_name && file.file_name.startsWith('image/')) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查URL中的文件扩展名(去除查询参数)
|
|
||||||
if (file.url) {
|
|
||||||
const urlWithoutParams = file.url.split('?')[0] // 移除查询参数
|
|
||||||
if (/\.(jpg|jpeg|png|gif|webp)$/i.test(urlWithoutParams)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
} */
|
|
||||||
|
|
||||||
// 预览图片
|
|
||||||
/* const previewImage = (file: { name: string; url: string; file_name: string }) => {
|
|
||||||
// 创建图片预览弹窗
|
|
||||||
const imagePreview = document.createElement('div')
|
|
||||||
imagePreview.style.cssText = `
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background: rgba(0, 0, 0, 0.8);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
z-index: 9999;
|
|
||||||
cursor: pointer;
|
|
||||||
`
|
|
||||||
|
|
||||||
const image = document.createElement('img')
|
|
||||||
image.src = file.url
|
|
||||||
image.alt = file.name
|
|
||||||
image.style.cssText = `
|
|
||||||
max-width: 90%;
|
|
||||||
max-height: 90%;
|
|
||||||
object-fit: contain;
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
|
|
||||||
`
|
|
||||||
|
|
||||||
const closeBtn = document.createElement('div')
|
|
||||||
closeBtn.innerHTML = '×'
|
|
||||||
closeBtn.style.cssText = `
|
|
||||||
position: absolute;
|
|
||||||
top: 20px;
|
|
||||||
right: 30px;
|
|
||||||
color: white;
|
|
||||||
font-size: 30px;
|
|
||||||
cursor: pointer;
|
|
||||||
z-index: 10000;
|
|
||||||
`
|
|
||||||
|
|
||||||
imagePreview.appendChild(image)
|
|
||||||
imagePreview.appendChild(closeBtn)
|
|
||||||
document.body.appendChild(imagePreview)
|
|
||||||
|
|
||||||
// 点击关闭
|
|
||||||
const closePreview = () => {
|
|
||||||
document.body.removeChild(imagePreview)
|
|
||||||
}
|
|
||||||
|
|
||||||
imagePreview.addEventListener('click', closePreview)
|
|
||||||
closeBtn.addEventListener('click', (e) => {
|
|
||||||
e.stopPropagation()
|
|
||||||
closePreview()
|
|
||||||
})
|
|
||||||
|
|
||||||
// ESC键关闭
|
|
||||||
const handleKeydown = (e: KeyboardEvent) => {
|
|
||||||
if (e.key === 'Escape') {
|
|
||||||
closePreview()
|
|
||||||
document.removeEventListener('keydown', handleKeydown)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document.addEventListener('keydown', handleKeydown)
|
|
||||||
} */
|
|
||||||
|
|
||||||
// 下载文件
|
|
||||||
/* const downloadFile = (file: { name: string; url: string; file_name: string }) => {
|
|
||||||
try {
|
|
||||||
const link = document.createElement('a')
|
|
||||||
link.href = file.url
|
|
||||||
link.download = file.name
|
|
||||||
link.target = '_blank'
|
|
||||||
document.body.appendChild(link)
|
|
||||||
link.click()
|
|
||||||
document.body.removeChild(link)
|
|
||||||
} catch (error) {
|
|
||||||
console.error('下载失败:', error)
|
|
||||||
ElMessage.error('下载失败,请稍后重试')
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
//打印
|
//打印
|
||||||
const printfn = (row: any) => {
|
const printfn = (row: any) => {
|
||||||
if (row.approval_status == 2) {
|
if (row.approval_status == 2) {
|
||||||
@@ -535,6 +439,29 @@
|
|||||||
}))
|
}))
|
||||||
// nqDialogVisible.value = true
|
// nqDialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
//删除
|
||||||
|
const stockdeletefn = (row: any) => {
|
||||||
|
ElMessageBox.confirm('确定要删除此备货单吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
manageService
|
||||||
|
.delectStock({ id: row.id })
|
||||||
|
.then((res) => {
|
||||||
|
ElMessage.success(res?.message || '操作成功')
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
// 你可以在这里调用接口或做后续处理
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// 用户点击了取消
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user