|
|
@@ -174,10 +174,12 @@
|
|
|
</div>
|
|
|
<div class="form-item">
|
|
|
<div class="form-label">车牌号 *</div>
|
|
|
- <van-field
|
|
|
- v-model="createForm.vehicleNo"
|
|
|
- placeholder="请输入车牌号"
|
|
|
- />
|
|
|
+ <div class="form-input" @click="showVehiclePicker = true">
|
|
|
+ <span :class="{ placeholder: !createForm.vehicleNo }">
|
|
|
+ {{ createForm.vehicleNo || '请选择车牌号' }}
|
|
|
+ </span>
|
|
|
+ <van-icon name="arrow" class="arrow-icon" />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="form-item">
|
|
|
<div class="form-label">备注</div>
|
|
|
@@ -270,6 +272,13 @@
|
|
|
<div class="copy-overlay__text">图片生成中...</div>
|
|
|
</div>
|
|
|
</van-overlay>
|
|
|
+
|
|
|
+ <DbVehiclePicker
|
|
|
+ v-model:show="showVehiclePicker"
|
|
|
+ public-mode
|
|
|
+ :plan-id="String(route.params.id || '')"
|
|
|
+ @select="onVehicleSelect"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -280,6 +289,7 @@ import dayjs from 'dayjs'
|
|
|
import { showToast } from 'vant'
|
|
|
import { planApi, type ThirdPartyPlanPageData } from '@/api/plansApi'
|
|
|
import { inventoryApi, type InventoryCreate, type InventoryRecord } from '@/api/inventoryApi'
|
|
|
+import DbVehiclePicker from '@/components/pickers/DbVehiclePicker.vue'
|
|
|
import { copyImageBlobToClipboard } from '@/utils/utils'
|
|
|
import html2canvas from 'html2canvas'
|
|
|
|
|
|
@@ -293,6 +303,7 @@ const todayStr = dayjs().format('YYYY-MM-DD')
|
|
|
|
|
|
const createDialogOpen = ref(false)
|
|
|
const creating = ref(false)
|
|
|
+const showVehiclePicker = ref(false)
|
|
|
const createForm = reactive<Pick<InventoryCreate, 'quantity' | 'vehicleNo' | 'remarks'>>({
|
|
|
quantity: 0,
|
|
|
vehicleNo: '',
|
|
|
@@ -310,7 +321,7 @@ const copyingImage = ref(false)
|
|
|
const captureInventory = ref<InventoryRecord | null>(null)
|
|
|
const captureRef = ref<HTMLElement | null>(null)
|
|
|
|
|
|
-const getQrImageUrl = (inventoryId: number) =>
|
|
|
+const getQrImageUrl = (inventoryId: string) =>
|
|
|
`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(
|
|
|
String(inventoryId)
|
|
|
)}`
|
|
|
@@ -321,7 +332,7 @@ const qrImageSrc = computed(() => {
|
|
|
})
|
|
|
|
|
|
const loadPage = async () => {
|
|
|
- const id = Number(route.params.id)
|
|
|
+ const id = String(route.params.id || '')
|
|
|
if (!id) {
|
|
|
errorMessage.value = '链接无效:缺少计划ID'
|
|
|
loading.value = false
|
|
|
@@ -346,6 +357,10 @@ const openCreateDialog = () => {
|
|
|
createDialogOpen.value = true
|
|
|
}
|
|
|
|
|
|
+const onVehicleSelect = (licensePlate: string) => {
|
|
|
+ createForm.vehicleNo = licensePlate
|
|
|
+}
|
|
|
+
|
|
|
const handleCreateSubmit = async () => {
|
|
|
if (!pageData.value) return
|
|
|
const qty = createForm.quantity
|
|
|
@@ -354,6 +369,10 @@ const handleCreateSubmit = async () => {
|
|
|
showToast({ type: 'fail', message: '请填写数量和车牌号' })
|
|
|
return
|
|
|
}
|
|
|
+ if (!pageData.value.plan.productId) {
|
|
|
+ showToast({ type: 'fail', message: '计划缺少产品,无法创建出入库单' })
|
|
|
+ return
|
|
|
+ }
|
|
|
creating.value = true
|
|
|
try {
|
|
|
const p = pageData.value.plan
|
|
|
@@ -361,7 +380,7 @@ const handleCreateSubmit = async () => {
|
|
|
date: todayStr,
|
|
|
partnerCompany: p.customerName || '待填写',
|
|
|
businessType: p.businessType,
|
|
|
- product: p.product,
|
|
|
+ productId: p.productId,
|
|
|
quantity: Number(qty),
|
|
|
planNo: p.planNo,
|
|
|
vehicleNo: vehicle,
|
|
|
@@ -586,6 +605,27 @@ onMounted(() => {
|
|
|
background: #f9fafb;
|
|
|
border: 1px solid #e5e7eb;
|
|
|
}
|
|
|
+
|
|
|
+ .form-input {
|
|
|
+ background: #f9fafb;
|
|
|
+ border: 1px solid #e5e7eb;
|
|
|
+ border-radius: 8px;
|
|
|
+ padding: 10px 12px;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #111827;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ min-height: 40px;
|
|
|
+
|
|
|
+ .placeholder {
|
|
|
+ color: #9ca3af;
|
|
|
+ }
|
|
|
+
|
|
|
+ .arrow-icon {
|
|
|
+ color: #9ca3af;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.dialog-actions {
|