This commit is contained in:
zlwu committed 2026-06-23 23:30:57 +08:00
1 parent c90f72fd34
commit 6b6c80f182
100 files changed
+18631 -6278

No files matched your search

+8 -2
View File
@@ -337,7 +337,7 @@
/>
<el-table-column
label="操作"
min-width="480"
min-width="520"
align="center"
header-align="center"
fixed="right"
@@ -353,6 +353,7 @@
编辑
</el-button>
<el-button
v-if="row.purchasePlanId"
class="btn-op-item"
:disabled="row.hasWeighingSlip"
@click="handleGenerateWeighing(row)"
@@ -360,7 +361,11 @@
<el-icon><Plus /></el-icon>
{{ row.hasWeighingSlip ? '已生成地磅单' : '生成地磅单' }}
</el-button>
<el-button class="btn-op-item" @click="handleCopyFillLink(row)">
<el-button
v-if="row.purchasePlanId"
class="btn-op-item"
@click="handleCopyFillLink(row)"
>
<el-icon><Link /></el-icon>
磅单二维码
</el-button>
@@ -497,6 +502,7 @@
ArrowUpBold,
Check,
Close,
CopyDocument,
Delete,
Download,
Edit,
+10 -2
View File
@@ -176,8 +176,16 @@
<el-button v-if="plan.archiveStatus !== 'archived'" type="primary" @click="handleEdit">
<el-icon><Edit /></el-icon>编辑
</el-button>
<el-button v-if="plan.transportStatus === 'pending'" type="warning" @click="handleArrange">
<el-icon><Van /></el-icon>安排运输
<el-button
v-if="
(plan.transportStatus === 'pending' || plan.transportStatus === 'arranged') &&
plan.archiveStatus !== 'archived' &&
plan.followStatus !== 'cancelled'
"
type="warning"
@click="handleArrange"
>
<el-icon><Van /></el-icon>{{ plan.transportStatus === 'arranged' ? '调整运输' : '安排运输' }}
</el-button>
<el-button v-if="plan.archiveStatus !== 'archived'" type="info" @click="handleArchive">
<el-icon><FolderChecked /></el-icon>归档
+6 -2
View File
@@ -194,7 +194,7 @@
v-if="canArrangeTransport(row)"
@click="handleArrange(row)"
>
<el-icon><Van /></el-icon>安排运输
<el-icon><Van /></el-icon>{{ arrangeTransportLabel(row) }}
</el-button>
<el-button
link
@@ -414,12 +414,16 @@ function handleEdit(row: Plan) {
function canArrangeTransport(row: Plan) {
return (
row.transportStatus === 'pending' &&
(row.transportStatus === 'pending' || row.transportStatus === 'arranged') &&
row.archiveStatus !== 'archived' &&
row.followStatus !== 'cancelled'
)
}
function arrangeTransportLabel(row: Plan) {
return row.transportStatus === 'arranged' ? '调整运输' : '安排运输'
}
function canVoidPlan(row: Plan) {
return row.archiveStatus !== 'archived' && row.followStatus !== 'cancelled'
}
@@ -0,0 +1,195 @@
<template>
<PublicMobileShell>
<div class="public-db-inventory-page">
<van-nav-bar title="出入库单" :border="false" />
<van-loading v-if="loading" vertical class="page-loading">加载中...</van-loading>
<van-empty v-else-if="errorMessage" :description="errorMessage" />
<van-empty v-else-if="page?.voided" description="运输计划已作废" />
<template v-else-if="page">
<van-cell-group inset class="section-card">
<van-cell title="出入库单号" :value="page.batchNo || '—'" />
<van-cell title="业务类型" :value="page.businessType || '—'" />
<van-cell title="日期" :value="page.date || '—'" />
<van-cell title="往来单位" :value="page.partnerCompany || '—'" />
<van-cell
title="产品"
:value="productDisplay"
class="product-cell"
/>
<van-cell title="数量(吨)" :value="String(page.quantity ?? '—')" />
<van-cell title="车牌" :value="page.vehicleNo || '—'" />
<van-cell title="计划号" :value="page.planNo || '—'" />
<van-cell v-if="page.remark" title="系统备注" :value="page.remark" class="remark-cell" />
</van-cell-group>
<van-cell-group v-if="!page.readOnly" inset class="section-card" title="回执上传">
<div class="uploader-wrap">
<van-uploader
v-model="uploaderFiles"
multiple
:max-count="9"
:after-read="handleAfterRead"
:before-delete="handleBeforeDelete"
/>
</div>
</van-cell-group>
<van-cell-group v-else-if="feedbackImages.length" inset class="section-card" title="已上传附件">
<div class="uploader-wrap uploader-wrap--readonly">
<van-uploader v-model="uploaderFiles" multiple disabled :show-upload="false" />
</div>
</van-cell-group>
<van-cell-group inset class="section-card" title="现场备注">
<van-field
v-model="feedbackRemark"
rows="4"
autosize
type="textarea"
maxlength="500"
show-word-limit
:readonly="page.readOnly"
placeholder="填写现场备注"
/>
</van-cell-group>
<van-cell-group v-if="page.siteFeedbackTime" inset class="section-card">
<van-cell title="上次保存" :value="page.siteFeedbackTime" />
</van-cell-group>
<footer v-if="!page.readOnly" class="page-footer">
<van-button type="primary" block round :loading="saving" @click="handleSave">
保存回执
</van-button>
</footer>
</template>
</div>
</PublicMobileShell>
</template>
<script setup lang="ts">
import type { UploaderFileListItem } from 'vant'
import { showFailToast, showSuccessToast } from 'vant'
import { publicInventoryApi, type PublicInventoryPage } from '@/api/db/public-inventory'
import PublicMobileShell from '@/layouts/PublicMobileShell.vue'
import 'vant/es/toast/style'
import '@/styles/public-mobile-vant.scss'
const route = useRoute()
const token = computed(() => String(route.params.token || ''))
const loading = ref(true)
const saving = ref(false)
const errorMessage = ref('')
const page = ref<PublicInventoryPage | null>(null)
const feedbackRemark = ref('')
const feedbackImages = ref<string[]>([])
const uploaderFiles = ref<UploaderFileListItem[]>([])
const productDisplay = computed(() => {
if (!page.value) return '—'
const spec = page.value.specification?.trim()
return spec ? `${page.value.product}(${spec})` : page.value.product
})
function resolveFileUrl(url: string) {
if (!url) return ''
if (/^https?:\/\//i.test(url)) return url
const base = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
return base ? `${base}/${url.replace(/^\//, '')}` : url
}
function syncUploaderFromImages() {
uploaderFiles.value = feedbackImages.value.map((url, index) => ({
url: resolveFileUrl(url),
isImage: /\.(png|jpe?g|gif|webp|bmp)$/i.test(url),
name: `附件${index + 1}`,
fileUrl: url
})) as UploaderFileListItem[]
}
async function loadPage() {
loading.value = true
errorMessage.value = ''
try {
const data = await publicInventoryApi.getPage(token.value)
page.value = data
feedbackRemark.value = data.siteFeedbackRemark || ''
feedbackImages.value = [...(data.siteFeedbackImages || [])]
syncUploaderFromImages()
} catch (e: any) {
errorMessage.value = e?.message || '链接无效或已失效'
page.value = null
} finally {
loading.value = false
}
}
async function handleAfterRead(item: UploaderFileListItem | UploaderFileListItem[]) {
const files = Array.isArray(item) ? item : [item]
for (const fileItem of files) {
if (!fileItem.file) continue
fileItem.status = 'uploading'
fileItem.message = '上传中...'
try {
const res = await publicInventoryApi.uploadAttachment(token.value, fileItem.file as File)
if (res.fileUrl) {
feedbackImages.value.push(res.fileUrl)
;(fileItem as UploaderFileListItem & { fileUrl?: string }).fileUrl = res.fileUrl
fileItem.url = resolveFileUrl(res.fileUrl)
fileItem.status = 'done'
fileItem.message = ''
}
} catch (e: any) {
fileItem.status = 'failed'
fileItem.message = e?.message || '上传失败'
showFailToast(fileItem.message)
}
}
}
function handleBeforeDelete(_file: UploaderFileListItem, detail: { index: number }) {
feedbackImages.value.splice(detail.index, 1)
return true
}
async function handleSave() {
saving.value = true
try {
await publicInventoryApi.saveFeedback(token.value, {
siteFeedbackRemark: feedbackRemark.value,
siteFeedbackImages: feedbackImages.value
})
showSuccessToast('保存成功')
await loadPage()
} catch (e: any) {
showFailToast(e?.message || '保存失败')
} finally {
saving.value = false
}
}
onMounted(loadPage)
</script>
<style scoped lang="scss">
.page-loading {
display: flex;
justify-content: center;
padding: 48px 0;
}
.section-card {
margin-bottom: 12px;
}
.uploader-wrap {
padding: 12px 16px 16px;
}
.remark-cell :deep(.van-cell__value) {
text-align: left;
}
</style>
@@ -0,0 +1,183 @@
<template>
<PublicMobileShell>
<div class="public-pl-site-page">
<van-nav-bar title="运输现场" :border="false" />
<van-loading v-if="loading" vertical class="page-loading">加载中...</van-loading>
<van-empty v-else-if="errorMessage" :description="errorMessage" />
<van-empty v-else-if="page?.voided" description="运输计划已作废" />
<template v-else-if="page">
<van-cell-group inset class="section-card">
<van-cell title="业务类型" :value="page.businessType || '—'" />
<van-cell title="日期" :value="page.date || '—'" />
<van-cell title="往来单位" :value="page.partnerCompany || '—'" />
<van-cell title="产品" :value="productDisplay" class="product-cell" />
<van-cell title="数量(吨)" :value="String(page.quantity ?? '—')" />
<van-cell title="车牌" :value="page.vehicleNo || '—'" />
<van-cell title="计划号" :value="page.planNo || '—'" />
<van-cell v-if="page.remark" title="备注" :value="page.remark" class="remark-cell" />
</van-cell-group>
<van-cell-group inset class="section-card" title="回执上传">
<div class="uploader-wrap">
<van-uploader
v-model="uploaderFiles"
multiple
:max-count="9"
:after-read="handleAfterRead"
:before-delete="handleBeforeDelete"
/>
</div>
</van-cell-group>
<van-cell-group inset class="section-card" title="现场备注">
<van-field
v-model="feedbackRemark"
rows="4"
autosize
type="textarea"
maxlength="500"
show-word-limit
placeholder="填写现场备注"
/>
</van-cell-group>
<van-cell-group v-if="page.siteFeedbackTime" inset class="section-card">
<van-cell title="上次保存" :value="page.siteFeedbackTime" />
</van-cell-group>
<footer class="page-footer">
<van-button type="primary" block round :loading="saving" @click="handleSave">
保存回执
</van-button>
</footer>
</template>
</div>
</PublicMobileShell>
</template>
<script setup lang="ts">
import type { UploaderFileListItem } from 'vant'
import { showFailToast, showSuccessToast } from 'vant'
import { publicPlSiteApi, type PublicTransportSitePage } from '@/api/pl/public-site'
import PublicMobileShell from '@/layouts/PublicMobileShell.vue'
import 'vant/es/toast/style'
import '@/styles/public-mobile-vant.scss'
const route = useRoute()
const token = computed(() => String(route.params.token || ''))
const loading = ref(true)
const saving = ref(false)
const errorMessage = ref('')
const page = ref<PublicTransportSitePage | null>(null)
const feedbackRemark = ref('')
const feedbackImages = ref<string[]>([])
const uploaderFiles = ref<UploaderFileListItem[]>([])
const productDisplay = computed(() => {
if (!page.value) return '—'
const spec = page.value.specification?.trim()
return spec ? `${page.value.product}(${spec})` : page.value.product
})
function resolveFileUrl(url: string) {
if (!url) return ''
if (/^https?:\/\//i.test(url)) return url
const base = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
return base ? `${base}/${url.replace(/^\//, '')}` : url
}
function syncUploaderFromImages() {
uploaderFiles.value = feedbackImages.value.map((url, index) => ({
url: resolveFileUrl(url),
isImage: /\.(png|jpe?g|gif|webp|bmp)$/i.test(url),
name: `附件${index + 1}`,
fileUrl: url
})) as UploaderFileListItem[]
}
async function loadPage() {
loading.value = true
errorMessage.value = ''
try {
const data = await publicPlSiteApi.getPage(token.value)
page.value = data
feedbackRemark.value = data.siteFeedbackRemark || ''
feedbackImages.value = [...(data.siteFeedbackImages || [])]
syncUploaderFromImages()
} catch (e: any) {
errorMessage.value = e?.message || '链接无效或已失效'
page.value = null
} finally {
loading.value = false
}
}
async function handleAfterRead(item: UploaderFileListItem | UploaderFileListItem[]) {
const files = Array.isArray(item) ? item : [item]
for (const fileItem of files) {
if (!fileItem.file) continue
fileItem.status = 'uploading'
fileItem.message = '上传中...'
try {
const res = await publicPlSiteApi.uploadAttachment(token.value, fileItem.file as File)
if (res.fileUrl) {
feedbackImages.value.push(res.fileUrl)
;(fileItem as UploaderFileListItem & { fileUrl?: string }).fileUrl = res.fileUrl
fileItem.url = resolveFileUrl(res.fileUrl)
fileItem.status = 'done'
fileItem.message = ''
}
} catch (e: any) {
fileItem.status = 'failed'
fileItem.message = e?.message || '上传失败'
showFailToast(fileItem.message)
}
}
}
function handleBeforeDelete(_file: UploaderFileListItem, detail: { index: number }) {
feedbackImages.value.splice(detail.index, 1)
return true
}
async function handleSave() {
saving.value = true
try {
await publicPlSiteApi.saveFeedback(token.value, {
siteFeedbackRemark: feedbackRemark.value,
siteFeedbackImages: feedbackImages.value
})
showSuccessToast('保存成功')
await loadPage()
} catch (e: any) {
showFailToast(e?.message || '保存失败')
} finally {
saving.value = false
}
}
onMounted(loadPage)
</script>
<style scoped lang="scss">
.page-loading {
display: flex;
justify-content: center;
padding: 48px 0;
}
.section-card {
margin-bottom: 12px;
}
.uploader-wrap {
padding: 12px 16px 16px;
}
.remark-cell :deep(.van-cell__value) {
text-align: left;
}
</style>