提交
This commit is contained in:
1 parent
c3be9d1dce
commit
299609706c
328 files changed
+144899
-13873
No files matched your search
@@ -482,54 +482,7 @@
|
||||
:data="relatedData"
|
||||
/>
|
||||
|
||||
<!-- 磅单二维码:地磅业务 UI 例外,见 openspec dibang-frontend §磅单二维码弹窗业务例外 -->
|
||||
<el-dialog
|
||||
v-model="qrcodeModalOpen"
|
||||
:title="qrcodeDialogTitle"
|
||||
width="400px"
|
||||
align-center
|
||||
class="db-qrcode-dialog"
|
||||
modal-class="db-qrcode-overlay"
|
||||
@close="handleQrcodeDialogClose"
|
||||
>
|
||||
<div v-if="captureRow" class="db-qrcode-body pound-slip-capture-inline">
|
||||
<div class="capture-card">
|
||||
<div class="capture-row capture-row-plate">
|
||||
<div class="vehicle-plate">
|
||||
<span class="vehicle-plate-dot vehicle-plate-dot-lt"></span>
|
||||
<span class="vehicle-plate-dot vehicle-plate-dot-lb"></span>
|
||||
<span class="vehicle-plate-text">{{ captureRow.vehicleNo }}</span>
|
||||
<span class="vehicle-plate-dot vehicle-plate-dot-rt"></span>
|
||||
<span class="vehicle-plate-dot vehicle-plate-dot-rb"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="capture-row capture-row-large">
|
||||
<span class="label">往来单位:</span>
|
||||
<span class="value">{{ captureRow.partnerCompany }}</span>
|
||||
</div>
|
||||
<div class="capture-row capture-row-large">
|
||||
<span class="label">物料名称:</span>
|
||||
<span class="value">
|
||||
{{ formatQrcodeProductLabel(captureRow) }}({{ captureRow.quantity }} 吨)
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="captureRow.remarks" class="capture-row">
|
||||
<span class="label">备注:</span>
|
||||
<span class="value">{{ captureRow.remarks }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="capture-card capture-qrcode">
|
||||
<div class="capture-id">
|
||||
{{ captureRow.date }}
|
||||
{{ captureRow.businessType === '出库' ? '出库单ID:' : '入库单ID:' }}{{ captureRow.id }}
|
||||
</div>
|
||||
<div class="capture-qr-wrap">
|
||||
<img v-if="captureQrObjectUrl" :src="captureQrObjectUrl" alt="二维码" class="capture-qr-img" />
|
||||
</div>
|
||||
<div class="capture-desc">出入库单标识(扫码核验)</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<DbPoundSlipQrcodeDialog v-model:visible="qrcodeModalOpen" :inventory-id="qrcodeInventoryId" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -557,6 +510,7 @@
|
||||
import DbCrmCustomerSelect from '@/components/business/db/DbCrmCustomerSelect.vue'
|
||||
import DbCrmProductSelect from '@/components/business/db/DbCrmProductSelect.vue'
|
||||
import DbInventoryRelatedViewDialog from '@/components/business/db/DbInventoryRelatedViewDialog.vue'
|
||||
import DbPoundSlipQrcodeDialog from '@/components/business/db/DbPoundSlipQrcodeDialog.vue'
|
||||
import DbVehicleSelect from '@/components/business/db/DbVehicleSelect.vue'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
import { $modal } from '@/utils/modal'
|
||||
@@ -614,13 +568,7 @@
|
||||
const isFromPlanJump = ref(false)
|
||||
const openedFromPlan = ref(false)
|
||||
const qrcodeModalOpen = ref(false)
|
||||
const captureRow = ref<InventoryRecord | null>(null)
|
||||
const captureQrObjectUrl = ref('')
|
||||
|
||||
const qrcodeDialogTitle = computed(() => {
|
||||
const date = captureRow.value?.date
|
||||
return date ? `山峡磅单二维码(${date})` : '山峡磅单二维码'
|
||||
})
|
||||
const qrcodeInventoryId = ref('')
|
||||
|
||||
const formRef = ref()
|
||||
const formData = reactive<
|
||||
@@ -966,42 +914,9 @@
|
||||
})
|
||||
}
|
||||
|
||||
const formatQrcodeProductLabel = (row: InventoryRecord) => {
|
||||
const product = (row.product || '').trim()
|
||||
const specification = (row.specification || '').trim()
|
||||
if (!specification) return product
|
||||
if (product.endsWith(specification)) {
|
||||
const base = product.slice(0, -specification.length).trimEnd()
|
||||
return base ? `${base} ${specification}` : specification
|
||||
}
|
||||
return `${product} ${specification}`
|
||||
}
|
||||
|
||||
const getQrImageUrl = (inventoryId: string) =>
|
||||
`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(inventoryId)}`
|
||||
|
||||
const handleCopyFillLink = async (row: InventoryRecord) => {
|
||||
const qrImageUrl = getQrImageUrl(row.id)
|
||||
try {
|
||||
captureRow.value = row
|
||||
captureQrObjectUrl.value = ''
|
||||
qrcodeModalOpen.value = true
|
||||
await nextTick()
|
||||
const res = await fetch(qrImageUrl, { mode: 'cors' })
|
||||
if (!res.ok) throw new Error('二维码图片加载失败')
|
||||
const blob = await res.blob()
|
||||
captureQrObjectUrl.value = URL.createObjectURL(blob)
|
||||
} catch (e: any) {
|
||||
$modal.msgError(e?.message || '加载二维码失败')
|
||||
qrcodeModalOpen.value = false
|
||||
captureRow.value = null
|
||||
}
|
||||
}
|
||||
|
||||
const handleQrcodeDialogClose = () => {
|
||||
if (captureQrObjectUrl.value) URL.revokeObjectURL(captureQrObjectUrl.value)
|
||||
captureRow.value = null
|
||||
captureQrObjectUrl.value = ''
|
||||
qrcodeInventoryId.value = row.id
|
||||
qrcodeModalOpen.value = true
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
|
||||
Reference in new issue
Block a user