From 49921150cbdcf2ec681486f36bc78411ea1ff035 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期二, 03 十一月 2026 13:28:57 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_tide_wrzs_xinlan' into dev_tide_wrzs_xinlan
---
src/views/environmentAccess/unattendedWeighbridgeSystem/index.vue | 1480 +++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 927 insertions(+), 553 deletions(-)
diff --git a/src/views/environmentAccess/unattendedWeighbridgeSystem/index.vue b/src/views/environmentAccess/unattendedWeighbridgeSystem/index.vue
index 5b981f9..0badb5d 100644
--- a/src/views/environmentAccess/unattendedWeighbridgeSystem/index.vue
+++ b/src/views/environmentAccess/unattendedWeighbridgeSystem/index.vue
@@ -1,616 +1,990 @@
<template>
<div class="app-container weighbridge-page">
- <!-- 椤靛ご -->
- <div class="page-head">
- <div class="head-text">
- <h2>鏃犱汉鍊煎畧鍦扮</h2>
- <p>鑷姩閲囬泦鐨噸銆佹瘺閲嶏紝绾㈠闃蹭綔寮婏紝鍖归厤閲囪喘/閿�鍞鍗曞苟鎺ㄩ�� ERP銆�</p>
- </div>
- <el-button type="primary" :icon="VideoPlay" @click="openWeigh">寮�濮嬭嚜鍔ㄧО閲�</el-button>
- </div>
-
<!-- 姒傝 -->
- <div class="stat-row">
- <div class="stat">
- <span class="stat-label">杩囩璁板綍</span>
- <span class="stat-value">{{ total }}<i>鏉�</i></span>
+ <div class="overview-row">
+ <div class="overview-card">
+ <div class="label">浠婃棩杩囩杞︽</div>
+ <div class="value">{{ overview.todayCount || 0 }}</div>
</div>
- <div class="stat">
- <span class="stat-label">鏈〉寮傚父</span>
- <span class="stat-value warn">{{ pageAbnormal }}<i>鏉�</i></span>
+ <div class="overview-card">
+ <div class="label">寰呭畬鎴愮О閲�</div>
+ <div class="value warning">{{ overview.pendingCount || 0 }}</div>
</div>
- <div class="stat">
- <span class="stat-label">鏈〉鏈尮閰嶈鍗�</span>
- <span class="stat-value">{{ pageUnmatched }}<i>鏉�</i></span>
+ <div class="overview-card">
+ <div class="label">浠婃棩绾㈠寮傚父/浣滃紛</div>
+ <div class="value danger">{{ overview.cheatCount || 0 }}</div>
</div>
- <div class="stat">
- <span class="stat-label">鏈〉寰呮帹閫� ERP</span>
- <span class="stat-value">{{ pagePendingErp }}<i>鏉�</i></span>
+ <div class="overview-card">
+ <div class="label">寰呬笂浼燛RP</div>
+ <div class="value">{{ overview.erpPendingCount || 0 }}</div>
</div>
</div>
- <!-- 鏌ヨ -->
- <div class="filter-card">
- <span class="filter-label">杞︾墝鍙�</span>
- <el-input
- v-model="query.plateNumber"
- placeholder="璇疯緭鍏ヨ溅鐗屽彿"
- clearable
- :prefix-icon="Search"
- style="width: 240px"
- @keyup.enter="handleSearch"
- @clear="handleSearch"
- />
- <el-button type="primary" :icon="Search" @click="handleSearch">鏌ヨ</el-button>
- <el-button :icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
- </div>
-
- <!-- 琛ㄦ牸 -->
- <div class="table-card">
- <el-table :data="rows" v-loading="loading" border stripe row-key="id">
- <el-table-column prop="weighNo" label="纾呭崟鍙�" min-width="170" />
- <el-table-column prop="plateNumber" label="杞︾墝鍙�" width="110" />
- <el-table-column prop="carrierName" label="鎵胯繍鍟�" min-width="130" show-overflow-tooltip />
- <el-table-column prop="weightTime" label="绉伴噸鏃堕棿" width="170" />
- <el-table-column prop="tareWeight" label="鐨噸(kg)" width="100" align="right" />
- <el-table-column prop="grossWeight" label="姣涢噸(kg)" width="100" align="right" />
- <el-table-column label="鍑�閲�(kg)" width="100" align="right">
- <template #default="{ row }">{{ netOf(row) }}</template>
- </el-table-column>
- <el-table-column label="绾㈠妫�娴�" width="110" align="center">
- <template #default="{ row }">
- <el-tag v-if="row.infraredStatus" :type="row.infraredStatus === 'normal' ? 'success' : 'danger'" effect="plain" size="small">
- {{ row.infraredStatus === 'normal' ? '姝e父' : '鍋忕Щ鎶ヨ' }}
- </el-tag>
- <span v-else class="muted-cell">鈥�</span>
- </template>
- </el-table-column>
- <el-table-column label="璁㈠崟鍖归厤" width="120" align="center">
- <template #default="{ row }">
- <el-tag :type="row.orderMatched ? 'success' : 'info'" effect="plain" size="small">
- {{ row.orderMatched ? (row.orderNo || '宸插尮閰�') : '鏈尮閰�' }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="ERP" width="100" align="center">
- <template #default="{ row }">
- <el-tag :type="row.erpPushStatus === 'success' ? 'success' : 'info'" effect="plain" size="small">
- {{ row.erpPushStatus === 'success' ? '宸蹭笂浼�' : '寰呬笂浼�' }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="鎿嶄綔" width="190" fixed="right" align="center">
- <template #default="{ row }">
- <el-button link type="primary" :icon="Printer" @click="printTicket(row)">纾呭崟</el-button>
- <el-button
- v-if="row.erpPushStatus !== 'success'"
- link
- type="success"
- :icon="Upload"
- :loading="pushingId === row.id"
- @click="pushErp(row)"
- >鎺ㄩ�� ERP</el-button>
- </template>
- </el-table-column>
- <template #empty>
- <div class="table-empty">鏆傛棤杩囩璁板綍锛岀偣鍑诲彸涓婅鈥滃紑濮嬭嚜鍔ㄧО閲嶁�濆垱寤虹涓�鏉�</div>
- </template>
- </el-table>
-
- <el-pagination
- v-model:current-page="query.current"
- v-model:page-size="query.size"
- :total="total"
- :page-sizes="[10, 20, 50]"
- layout="total, sizes, prev, pager, next"
- class="pager"
- @current-change="load"
- @size-change="handleSearch"
- />
- </div>
-
- <!-- 鑷姩绉伴噸 -->
- <el-dialog v-model="dialog" title="鑷姩绉伴噸" width="640px" destroy-on-close>
- <el-alert
- title="绾㈠妫�娴嬮槇鍊间负 5%锛岃溅杈嗘湭瀹屽叏涓婄浼氳嚜鍔ㄦ姤璀﹀苟鏍囪寮傚父"
- type="info"
- :closable="false"
- show-icon
- class="weigh-tip"
- />
- <el-form ref="formRef" :model="form" :rules="rules" label-width="110px" class="weigh-form">
- <el-row :gutter="16">
- <el-col :span="12">
- <el-form-item label="杞︾墝鍙�" prop="plateNumber">
- <el-input v-model="form.plateNumber" placeholder="璇疯緭鍏ヨ溅鐗屽彿" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鎵胯繍鍟�">
- <el-input v-model="form.carrierName" placeholder="鐢ㄤ簬鍖归厤璁㈠崟涓庣哗鏁�" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="16">
- <el-col :span="12">
- <el-form-item label="鐨噸(kg)" prop="tareWeight">
- <el-input-number v-model="form.tareWeight" :min="0" :controls="false" style="width: 100%" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="姣涢噸(kg)" prop="grossWeight">
- <el-input-number v-model="form.grossWeight" :min="0" :controls="false" style="width: 100%" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="16">
- <el-col :span="12">
- <el-form-item label="杞﹁締鍋忕Щ(%)">
- <el-input-number v-model="form.positionOffset" :min="0" :max="100" style="width: 100%" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鍦扮缂栧彿">
- <el-input v-model="form.weighbridgeNumber" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-form-item label="璐х墿鍚嶇О">
- <el-input v-model="form.cargoName" />
- </el-form-item>
- <div class="net-preview">
- 棰勮鍑�閲嶏細<b>{{ netPreview }}</b> kg
+ <el-tabs v-model="activeTab" @tab-change="handleTabChange">
+ <!-- ==================== 鑷姩绉伴噸 ==================== -->
+ <el-tab-pane label="鑷姩绉伴噸" name="auto">
+ <div class="search_form">
+ <div>
+ <span class="search_title">杞︾墝鍙凤細</span>
+ <el-input v-model="recordQuery.plateNumber" style="width: 130px" placeholder="璇疯緭鍏�" clearable
+ @keyup.enter="loadRecord" />
+ <span class="search_title ml10">纾呭崟鍙凤細</span>
+ <el-input v-model="recordQuery.recordNo" style="width: 150px" placeholder="璇疯緭鍏�" clearable
+ @keyup.enter="loadRecord" />
+ <span class="search_title ml10">鎵胯繍鍟嗭細</span>
+ <el-input v-model="recordQuery.carrierName" style="width: 130px" placeholder="璇疯緭鍏�" clearable
+ @keyup.enter="loadRecord" />
+ <span class="search_title ml10">鐘舵�侊細</span>
+ <el-select v-model="recordQuery.weighStatus" style="width: 120px" placeholder="鍏ㄩ儴" clearable
+ @change="loadRecord">
+ <el-option label="寰呯毊閲�" value="0" />
+ <el-option label="寰呮瘺閲�" value="1" />
+ <el-option label="宸插畬鎴�" value="2" />
+ </el-select>
+ <span class="search_title ml10">浣滃紛鏍囪锛�</span>
+ <el-select v-model="recordQuery.cheatFlag" style="width: 110px" placeholder="鍏ㄩ儴" clearable
+ @change="loadRecord">
+ <el-option label="姝e父" value="0" />
+ <el-option label="浣滃紛瀚岀枒" value="1" />
+ </el-select>
+ <el-button type="primary" style="margin-left: 10px" @click="loadRecord">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button type="primary" @click="openFirstWeight">鐨噸绉伴噸</el-button>
+ <el-button @click="openVerifyDialog">鎵爜鏍搁獙纾呭崟</el-button>
+ </div>
</div>
+ <el-table :data="recordList" border stripe v-loading="recordLoading" style="width: 100%">
+ <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+ <el-table-column prop="recordNo" label="纾呭崟鍙�" width="160" align="center" />
+ <el-table-column prop="plateNumber" label="杞︾墝鍙�" width="110" align="center" />
+ <el-table-column prop="carrierName" label="鎵胯繍鍟�" width="140" show-overflow-tooltip />
+ <el-table-column prop="cargoName" label="璐х墿" width="110" show-overflow-tooltip />
+ <el-table-column label="鍏宠仈璁㈠崟" min-width="180">
+ <template #default="{ row }">
+ <template v-if="row.orderNo">
+ <el-tag size="small" :type="row.orderType === '0' ? 'success' : 'warning'">
+ {{ row.orderType === '0' ? '閲囪喘' : (row.orderType === '1' ? '閿�鍞�' : '鏈尮閰�') }}
+ </el-tag>
+ <span class="order-no">{{ row.orderNo }}</span>
+ <div v-if="row.orderParty" class="sub-text">{{ row.orderParty }}</div>
+ </template>
+ <span v-else class="sub-text">-</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="tareWeight" label="鐨噸(kg)" width="110" align="center" />
+ <el-table-column prop="grossWeight" label="姣涢噸(kg)" width="110" align="center" />
+ <el-table-column prop="netWeight" label="鍑�閲�(kg)" width="110" align="center" />
+ <el-table-column label="鍋忓樊鐜�" width="100" align="center">
+ <template #default="{ row }">
+ <span v-if="row.orderDeviation != null" :class="deviationClass(row.orderDeviation)">
+ {{ row.orderDeviation }}%
+ </span>
+ <span v-else class="sub-text">-</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="绾㈠/浣滃紛" width="120" align="center">
+ <template #default="{ row }">
+ <el-tag v-if="row.cheatFlag === '1'" type="danger" size="small">浣滃紛瀚岀枒</el-tag>
+ <el-tag v-else-if="row.irStatus === '2'" type="warning" size="small">浣嶇疆鍋忕Щ</el-tag>
+ <el-tag v-else type="success" size="small">姝e父</el-tag>
+ <div v-if="row.positionOffset != null" class="sub-text">鍋忕Щ{{ row.positionOffset }}cm</div>
+ </template>
+ </el-table-column>
+ <el-table-column label="ERP" width="110" align="center">
+ <template #default="{ row }">
+ <el-tag :type="row.erpSyncStatus === '1' ? 'success' : 'info'" size="small">
+ {{ row.erpSyncStatus === '1' ? '宸蹭笂浼�' : '寰呬笂浼�' }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column label="绉伴噸鐘舵��" width="100" align="center">
+ <template #default="{ row }">
+ <el-tag :type="row.weighStatus === '2' ? 'success' : 'warning'" size="small">
+ {{ weighStatusText(row.weighStatus) }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column label="绉伴噸鏃堕棿" width="170" align="center">
+ <template #default="{ row }">{{ formatDateTime(row.secondWeightTime || row.firstWeightTime) }}</template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔" width="300" align="center" fixed="right">
+ <template #default="{ row }">
+ <el-button v-if="row.weighStatus !== '2'" link type="primary" @click="openSecondWeight(row)">
+ 姣涢噸绉伴噸
+ </el-button>
+ <el-button link type="primary" @click="openInfraredDialog(row)">绾㈠妫�娴�</el-button>
+ <el-button link type="primary" @click="openPrintDialog(row)">鎵撳嵃纾呭崟</el-button>
+ <el-button v-if="row.erpSyncStatus !== '1'" link type="primary" @click="syncErp(row)">涓婁紶ERP</el-button>
+ <el-button link type="primary" @click="openDetail(row)">璇︽儏</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-tab-pane>
+
+ <!-- ==================== 鎵嬪伐杩囩璁板綍 ==================== -->
+ <el-tab-pane label="鎵嬪伐杩囩璁板綍" name="manual">
+ <div class="search_form">
+ <div>
+ <span class="search_title">杞︾墝鍙凤細</span>
+ <el-input v-model="manualQuery.plateNumber" style="width: 200px" placeholder="璇疯緭鍏ヨ溅鐗屽彿" clearable
+ @keyup.enter="loadManual" />
+ <el-button type="primary" style="margin-left: 10px" @click="loadManual">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button type="primary" @click="openManualForm()">鏂板璁板綍</el-button>
+ </div>
+ </div>
+ <el-table :data="manualList" border stripe v-loading="manualLoading" style="width: 100%">
+ <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+ <el-table-column prop="plateNumber" label="杞︾墝鍙�" width="130" align="center" />
+ <el-table-column prop="weightTime" label="绉伴噸鏃堕棿" width="180" align="center">
+ <template #default="{ row }">{{ formatDateTime(row.weightTime) }}</template>
+ </el-table-column>
+ <el-table-column prop="tareWeight" label="鐨噸(kg)" width="110" align="center" />
+ <el-table-column prop="grossWeight" label="姣涢噸(kg)" width="110" align="center" />
+ <el-table-column prop="positionOffset" label="鍋忕搴�" width="100" align="center" />
+ <el-table-column prop="driverName" label="鍙告満" width="110" align="center" />
+ <el-table-column prop="contactPhone" label="鑱旂郴鐢佃瘽" width="130" align="center" />
+ <el-table-column prop="cargoName" label="璐х墿鍚嶇О" width="130" />
+ <el-table-column prop="weighbridgeNumber" label="鍦扮缂栧彿" width="110" align="center" />
+ <el-table-column label="鎿嶄綔" width="140" align="center" fixed="right">
+ <template #default="{ row }">
+ <el-button link type="primary" @click="openManualForm(row)">缂栬緫</el-button>
+ <el-button link type="danger" @click="removeManual(row)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-tab-pane>
+
+ <!-- ==================== ERP涓婁紶鏃ュ織 ==================== -->
+ <el-tab-pane label="ERP涓婁紶鏃ュ織" name="erpLog">
+ <el-table :data="erpLogList" border stripe v-loading="erpLogLoading" style="width: 100%">
+ <el-table-column type="index" label="搴忓彿" width="60" align="center" />
+ <el-table-column prop="recordNo" label="纾呭崟鍙�" width="170" align="center" />
+ <el-table-column label="鍚屾鐘舵��" width="110" align="center">
+ <template #default="{ row }">
+ <el-tag :type="row.syncStatus === '1' ? 'success' : 'warning'" size="small">
+ {{ row.syncStatus === '1' ? '鎴愬姛' : '寰呬笂浼�' }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="syncTime" label="鍚屾鏃堕棿" width="180" align="center">
+ <template #default="{ row }">{{ formatDateTime(row.syncTime) }}</template>
+ </el-table-column>
+ <el-table-column prop="remark" label="璇存槑" min-width="220" show-overflow-tooltip />
+ <el-table-column prop="responseBody" label="ERP杩斿洖" min-width="240" show-overflow-tooltip />
+ <el-table-column label="鎿嶄綔" width="100" align="center">
+ <template #default="{ row }">
+ <el-button link type="primary" @click="viewErpPayload(row)">鏌ョ湅鎶ユ枃</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-tab-pane>
+ </el-tabs>
+
+ <!-- ==================== 鐨噸绉伴噸 ==================== -->
+ <el-dialog v-model="firstWeightDialog" title="绗竴娆$О閲嶏紙鐨噸锛�" width="720px" @close="resetFirstWeight">
+ <el-form ref="firstWeightRef" :model="firstWeightForm" :rules="firstWeightRules" label-position="top">
+ <el-row :gutter="20">
+ <el-col :span="8">
+ <el-form-item label="杞︾墝鍙�(杞︾墝璇嗗埆)锛�" prop="plateNumber">
+ <el-input v-model="firstWeightForm.plateNumber" placeholder="璇疯緭鍏ヨ溅鐗屽彿" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鍦扮缂栧彿锛�">
+ <el-input v-model="firstWeightForm.weighbridgeCode" placeholder="濡� DB-01" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鐨噸鑷姩閲囬泦(kg)锛�" prop="tareWeight">
+ <el-input-number v-model="firstWeightForm.tareWeight" :precision="2" :min="0" style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="8">
+ <el-form-item label="鎵胯繍鍟嗭細">
+ <el-input v-model="firstWeightForm.carrierName" placeholder="鍙暀绌鸿嚜鍔ㄥ甫鍑�" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鍙告満锛�">
+ <el-input v-model="firstWeightForm.driverName" placeholder="鍙告満濮撳悕" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鑱旂郴鐢佃瘽锛�">
+ <el-input v-model="firstWeightForm.driverPhone" placeholder="鑱旂郴鐢佃瘽" clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="8">
+ <el-form-item label="璐х墿鍚嶇О锛�">
+ <el-input v-model="firstWeightForm.cargoName" placeholder="濡� 鍘熺叅" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="璁㈠崟鍙�(閲囪喘/閿�鍞悎鍚屽彿)锛�">
+ <el-input v-model="firstWeightForm.orderNo" placeholder="杈撳叆鍚庤嚜鍔ㄥ尮閰嶈鍗�" clearable
+ @blur="autoMatchOrder" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="璁㈠崟閲嶉噺(kg)锛�">
+ <el-input-number v-model="firstWeightForm.orderWeight" :precision="2" :min="0" style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="8">
+ <el-form-item label="棰勭害鍒板満鏃堕棿(鐢ㄤ簬鍑嗘椂鐜囩粺璁�)锛�">
+ <el-date-picker v-model="firstWeightForm.appointmentTime" type="datetime" style="width: 100%"
+ value-format="YYYY-MM-DD HH:mm:ss" placeholder="璁″垝鍒板満鏃堕棿" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-alert v-if="orderMatchMessage" :title="orderMatchMessage" :type="orderMatchSuccess ? 'success' : 'warning'"
+ :closable="false" show-icon style="margin-bottom: 12px" />
+ <el-row :gutter="20">
+ <el-col :span="8">
+ <el-form-item label="绾㈠瀵瑰皠鐘舵�侊細">
+ <el-select v-model="firstWeightForm.irStatus" style="width: 100%">
+ <el-option label="姝e父" value="0" />
+ <el-option label="閬尅" value="1" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="杞﹁締鍋忕Щ閲�(cm)锛�">
+ <el-input-number v-model="firstWeightForm.positionOffset" :precision="2" :min="0" style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鍏佽鍋忕Щ闃堝��(cm)锛�">
+ <el-input-number v-model="firstWeightForm.offsetLimit" :precision="2" :min="0" style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-alert title="杞﹁締鏈畬鍏ㄤ笂纾呮垨鍋忕Щ瓒呴檺鏃讹紝绯荤粺灏嗘爣璁颁綔寮婂珜鐤戝苟鎻愮ず鎶ヨ锛岄槻姝㈠帇纾呬綔寮娿��"
+ type="info" :closable="false" show-icon />
</el-form>
<template #footer>
- <el-button @click="dialog = false">鍙栨秷</el-button>
- <el-button type="primary" :loading="saving" @click="submit">瀹屾垚绉伴噸</el-button>
+ <el-button @click="firstWeightDialog = false">鍙栨秷</el-button>
+ <el-button type="primary" :loading="submitLoading" @click="submitFirstWeight">纭閲囬泦鐨噸</el-button>
</template>
</el-dialog>
- <!-- 鐢靛瓙纾呭崟 -->
- <el-dialog v-model="ticketDialog" title="鐢靛瓙纾呭崟" width="520px">
- <div class="ticket">
- <h2>鏃犱汉鍊煎畧鐢靛瓙纾呭崟</h2>
- <p class="ticket-no">纾呭崟鍙凤細{{ ticket.weighNo }}</p>
- <el-descriptions :column="2" border>
- <el-descriptions-item label="杞︾墝">{{ ticket.plateNumber }}</el-descriptions-item>
- <el-descriptions-item label="鎵胯繍鍟�">{{ ticket.carrierName || '鈥�' }}</el-descriptions-item>
- <el-descriptions-item label="鐨噸">{{ ticket.tareWeight }} kg</el-descriptions-item>
- <el-descriptions-item label="姣涢噸">{{ ticket.grossWeight }} kg</el-descriptions-item>
- <el-descriptions-item label="鍑�閲�">{{ ticket.netWeight }} kg</el-descriptions-item>
- <el-descriptions-item label="璁㈠崟">{{ ticket.orderNo || '鏈尮閰�' }}</el-descriptions-item>
- </el-descriptions>
- <img v-if="qrUrl" :src="qrUrl" class="qr" alt="纾呭崟浜岀淮鐮�" />
- <p class="qr-tip">鎵弿浜岀淮鐮佸彲鏍搁獙鏈纾呭崟</p>
+ <!-- ==================== 姣涢噸绉伴噸 ==================== -->
+ <el-dialog v-model="secondWeightDialog" title="绗簩娆$О閲嶏紙姣涢噸锛�" width="620px">
+ <el-descriptions :column="2" border size="small" style="margin-bottom: 14px">
+ <el-descriptions-item label="纾呭崟鍙�">{{ currentRecord.recordNo }}</el-descriptions-item>
+ <el-descriptions-item label="杞︾墝鍙�">{{ currentRecord.plateNumber }}</el-descriptions-item>
+ <el-descriptions-item label="鐨噸">{{ currentRecord.tareWeight }} kg</el-descriptions-item>
+ <el-descriptions-item label="鎵胯繍鍟�">{{ currentRecord.carrierName || '-' }}</el-descriptions-item>
+ </el-descriptions>
+ <el-form label-position="top">
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="姣涢噸鑷姩閲囬泦(kg)锛�">
+ <el-input-number v-model="secondWeightForm.grossWeight" :precision="2" :min="0" style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="绾㈠瀵瑰皠鐘舵�侊細">
+ <el-select v-model="secondWeightForm.irStatus" style="width: 100%">
+ <el-option label="姝e父" value="0" />
+ <el-option label="閬尅" value="1" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="杞﹁締鍋忕Щ閲�(cm)锛�">
+ <el-input-number v-model="secondWeightForm.positionOffset" :precision="2" :min="0" style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鍑�閲�(kg)锛�">
+ <el-input :model-value="computedNetWeight" disabled />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <template #footer>
+ <el-button @click="secondWeightDialog = false">鍙栨秷</el-button>
+ <el-button type="primary" :loading="submitLoading" @click="submitSecondWeight">纭閲囬泦姣涢噸骞跺畬鎴愯繃纾�</el-button>
+ </template>
+ </el-dialog>
+
+ <!-- ==================== 绾㈠妫�娴� ==================== -->
+ <el-dialog v-model="infraredDialog" title="绾㈠鍋忕Щ妫�娴�" width="480px">
+ <el-form label-position="top">
+ <el-form-item label="纾呭崟鍙凤細">
+ <el-input :model-value="currentRecord.recordNo" disabled />
+ </el-form-item>
+ <el-form-item label="绾㈠瀵瑰皠鐘舵�侊細">
+ <el-select v-model="infraredForm.irStatus" style="width: 100%">
+ <el-option label="姝e父" value="0" />
+ <el-option label="閬尅" value="1" />
+ <el-option label="浣嶇疆鍋忕Щ" value="2" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="杞﹁締鍋忕Щ閲�(cm)锛�">
+ <el-input-number v-model="infraredForm.positionOffset" :precision="2" :min="0" style="width: 100%" />
+ </el-form-item>
+ </el-form>
+ <el-alert v-if="infraredResult.message" :title="infraredResult.message"
+ :type="infraredResult.alarm ? 'error' : 'success'" :closable="false" show-icon />
+ <template #footer>
+ <el-button @click="infraredDialog = false">鍏抽棴</el-button>
+ <el-button type="primary" @click="submitInfrared">妫�娴�</el-button>
+ </template>
+ </el-dialog>
+
+ <!-- ==================== 鎵撳嵃纾呭崟 ==================== -->
+ <el-dialog v-model="printDialog" title="纾呭崟鎵撳嵃" width="520px">
+ <div ref="printArea" class="ticket">
+ <div class="ticket-title">鏃犱汉鍊煎畧鍦扮绉伴噸鍗�</div>
+ <div class="ticket-no">纾呭崟鍙凤細{{ printData.recordNo }}</div>
+ <div class="ticket-body">
+ <div class="ticket-left">
+ <p><span>杞︾墝鍙凤細</span>{{ printData.plateNumber }}</p>
+ <p><span>鎵胯繍鍟嗭細</span>{{ printData.carrierName || '-' }}</p>
+ <p><span>璐х墿锛�</span>{{ printData.cargoName || '-' }}</p>
+ <p><span>璁㈠崟鍙凤細</span>{{ printData.orderNo || '-' }}</p>
+ <p><span>鐨噸锛�</span>{{ printData.tareWeight }} kg</p>
+ <p><span>姣涢噸锛�</span>{{ printData.grossWeight }} kg</p>
+ <p class="net"><span>鍑�閲嶏細</span>{{ printData.netWeight }} kg</p>
+ <p><span>绉伴噸鏃堕棿锛�</span>{{ formatDateTime(printData.secondWeightTime) }}</p>
+ <p><span>鍦扮缂栧彿锛�</span>{{ printData.weighbridgeCode || '-' }}</p>
+ </div>
+ <div class="ticket-right">
+ <img v-if="qrCodeUrl" :src="qrCodeUrl" alt="纾呭崟浜岀淮鐮�" class="qr-img" />
+ <div class="qr-tip">鎵爜鏍搁獙纾呭崟</div>
+ </div>
+ </div>
+ <div class="ticket-footer">鏈鍗曠敱鏃犱汉鍊煎畧绯荤粺鑷姩鐢熸垚锛屾壂鎻忎簩缁寸爜鍙牳楠岀湡浼�</div>
</div>
<template #footer>
- <el-button @click="ticketDialog = false">鍏抽棴</el-button>
- <el-button type="primary" :icon="Printer" @click="print">鎵撳嵃纾呭崟</el-button>
+ <el-button @click="printDialog = false">鍏抽棴</el-button>
+ <el-button type="primary" @click="doPrint">鎵撳嵃纾呭崟</el-button>
+ </template>
+ </el-dialog>
+
+ <!-- ==================== 鎵爜鏍搁獙 ==================== -->
+ <el-dialog v-model="verifyDialog" title="鎵爜鏍搁獙纾呭崟" width="560px">
+ <el-form label-position="top">
+ <el-form-item label="浜岀淮鐮佸唴瀹癸細">
+ <el-input v-model="verifyCode" type="textarea" :rows="3" placeholder="鎵爜鏋壂鎻忔垨鎵嬪伐绮樿创浜岀淮鐮佸唴瀹�" />
+ </el-form-item>
+ </el-form>
+ <el-alert v-if="verifyResult.message" :title="verifyResult.message"
+ :type="verifyResult.valid ? 'success' : 'error'" :closable="false" show-icon />
+ <el-descriptions v-if="verifyResult.record" :column="2" border size="small" style="margin-top: 12px">
+ <el-descriptions-item label="纾呭崟鍙�">{{ verifyResult.record.recordNo }}</el-descriptions-item>
+ <el-descriptions-item label="杞︾墝鍙�">{{ verifyResult.record.plateNumber }}</el-descriptions-item>
+ <el-descriptions-item label="鍑�閲�">{{ verifyResult.record.netWeight }} kg</el-descriptions-item>
+ <el-descriptions-item label="鎵胯繍鍟�">{{ verifyResult.record.carrierName || '-' }}</el-descriptions-item>
+ </el-descriptions>
+ <template #footer>
+ <el-button @click="verifyDialog = false">鍏抽棴</el-button>
+ <el-button type="primary" @click="doVerify">鏍搁獙</el-button>
+ </template>
+ </el-dialog>
+
+ <!-- ==================== 璇︽儏 ==================== -->
+ <el-dialog v-model="detailDialog" title="杩囩璇︽儏" width="760px">
+ <el-descriptions :column="3" border size="small">
+ <el-descriptions-item label="纾呭崟鍙�">{{ detail.recordNo }}</el-descriptions-item>
+ <el-descriptions-item label="杞︾墝鍙�">{{ detail.plateNumber }}</el-descriptions-item>
+ <el-descriptions-item label="鎵胯繍鍟�">{{ detail.carrierName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璐х墿">{{ detail.cargoName || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璁㈠崟绫诲瀷">
+ {{ detail.orderType === '0' ? '閲囪喘' : (detail.orderType === '1' ? '閿�鍞�' : '-') }}
+ </el-descriptions-item>
+ <el-descriptions-item label="璁㈠崟鍙�">{{ detail.orderNo || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鏉ュ線鍗曚綅">{{ detail.orderParty || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="璁㈠崟閲嶉噺">{{ detail.orderWeight || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鍋忓樊鐜�">{{ detail.orderDeviation != null ? detail.orderDeviation + '%' : '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鐨噸">{{ detail.tareWeight }}</el-descriptions-item>
+ <el-descriptions-item label="姣涢噸">{{ detail.grossWeight }}</el-descriptions-item>
+ <el-descriptions-item label="鍑�閲�">{{ detail.netWeight }}</el-descriptions-item>
+ <el-descriptions-item label="绾㈠鐘舵��">{{ irStatusText(detail.irStatus) }}</el-descriptions-item>
+ <el-descriptions-item label="鍋忕Щ閲�">{{ detail.positionOffset != null ? detail.positionOffset + ' cm' : '-' }}</el-descriptions-item>
+ <el-descriptions-item label="浣滃紛鏍囪">
+ <el-tag :type="detail.cheatFlag === '1' ? 'danger' : 'success'" size="small">
+ {{ detail.cheatFlag === '1' ? '浣滃紛瀚岀枒' : '姝e父' }}
+ </el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="浣滃紛鍘熷洜" :span="3">{{ detail.cheatReason || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="鐨噸鏃堕棿">{{ formatDateTime(detail.firstWeightTime) }}</el-descriptions-item>
+ <el-descriptions-item label="姣涢噸鏃堕棿">{{ formatDateTime(detail.secondWeightTime) }}</el-descriptions-item>
+ <el-descriptions-item label="ERP鐘舵��">{{ detail.erpSyncStatus === '1' ? '宸蹭笂浼�' : '寰呬笂浼�' }}</el-descriptions-item>
+ <el-descriptions-item label="鎵撳嵃娆℃暟">{{ detail.printCount || 0 }}</el-descriptions-item>
+ <el-descriptions-item label="浜岀淮鐮佸唴瀹�" :span="2">{{ detail.qrCode || '-' }}</el-descriptions-item>
+ </el-descriptions>
+ <template #footer>
+ <el-button @click="detailDialog = false">鍏抽棴</el-button>
+ </template>
+ </el-dialog>
+
+ <!-- ==================== 鎵嬪伐璁板綍寮圭獥 ==================== -->
+ <el-dialog v-model="manualDialog" :title="manualForm.id ? '缂栬緫杩囩璁板綍' : '鏂板杩囩璁板綍'" width="720px"
+ @close="resetManualForm">
+ <el-form ref="manualFormRef" :model="manualForm" :rules="manualRules" label-position="top">
+ <el-row :gutter="20">
+ <el-col :span="8">
+ <el-form-item label="杞︾墝鍙凤細" prop="plateNumber">
+ <el-input v-model="manualForm.plateNumber" placeholder="璇疯緭鍏ヨ溅鐗屽彿" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="绉伴噸鏃堕棿锛�" prop="weightTime">
+ <el-date-picker v-model="manualForm.weightTime" type="datetime" style="width: 100%"
+ value-format="YYYY-MM-DD HH:mm:ss" placeholder="閫夋嫨鏃堕棿" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鍦扮缂栧彿锛�">
+ <el-input v-model="manualForm.weighbridgeNumber" placeholder="璇疯緭鍏ュ湴纾呯紪鍙�" clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="8">
+ <el-form-item label="鐨噸(kg)锛�" prop="tareWeight">
+ <el-input-number v-model="manualForm.tareWeight" :precision="2" :min="0" style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="姣涢噸(kg)锛�" prop="grossWeight">
+ <el-input-number v-model="manualForm.grossWeight" :precision="2" :min="0" style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鍋忕搴︼細">
+ <el-input-number v-model="manualForm.positionOffset" :precision="2" :min="0" style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="8">
+ <el-form-item label="鍙告満濮撳悕锛�">
+ <el-input v-model="manualForm.driverName" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鑱旂郴鐢佃瘽锛�">
+ <el-input v-model="manualForm.contactPhone" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="璐х墿鍚嶇О锛�">
+ <el-input v-model="manualForm.cargoName" placeholder="璇疯緭鍏�" clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-form-item label="澶囨敞锛�">
+ <el-input v-model="manualForm.remark" type="textarea" :rows="2" placeholder="璇疯緭鍏ュ娉�" />
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <el-button @click="manualDialog = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="submitManual">纭</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup>
-import { computed, getCurrentInstance, onMounted, reactive, ref } from "vue";
+import { computed, onMounted, reactive, ref } from "vue";
+import { ElMessage, ElMessageBox } from "element-plus";
import QRCode from "qrcode";
-import { Search, Refresh, Printer, Upload, VideoPlay } from "@element-plus/icons-vue";
-import { autoWeigh, listWeighbridgeSystem, pushWeighbridgeToErp } from "@/api/environmentAccess/unattendedWeighbridgeSystem";
+import {
+ addWeighbridgeSystem,
+ delWeighbridgeSystem,
+ firstWeighbridgeWeight,
+ getWeighbridgeOverview,
+ getWeighbridgePrintInfo,
+ getWeighbridgeRecord,
+ getWeighbridgeSystem,
+ infraredCheck,
+ listWeighbridgeErpLog,
+ listWeighbridgeRecord,
+ listWeighbridgeSystem,
+ matchWeighbridgeOrder,
+ secondWeighbridgeWeight,
+ syncWeighbridgeErp,
+ updateWeighbridgeRecord,
+ updateWeighbridgeSystem,
+ verifyWeighbridgeQr,
+} from "@/api/environmentAccess/unattendedWeighbridgeSystem.js";
const { proxy } = getCurrentInstance();
-const rows = ref([]);
-const loading = ref(false);
-const saving = ref(false);
-const pushingId = ref(null);
-const total = ref(0);
-const dialog = ref(false);
-const ticketDialog = ref(false);
-const ticket = ref({});
-const qrUrl = ref("");
-const formRef = ref(null);
-const query = reactive({ plateNumber: "", current: 1, size: 20 });
-const emptyForm = {
- plateNumber: "",
- carrierName: "",
- tareWeight: null,
- grossWeight: null,
- positionOffset: 0,
- weighbridgeNumber: "WB-01",
- cargoName: "",
+const activeTab = ref("auto");
+const overview = ref({});
+const submitLoading = ref(false);
+
+const formatDateTime = (val) => {
+ if (!val) return "-";
+ return String(val).replace("T", " ").substring(0, 19);
};
-const form = reactive({ ...emptyForm });
+const weighStatusText = (status) => ({ "0": "寰呯毊閲�", "1": "寰呮瘺閲�", "2": "宸插畬鎴�" }[status] || "-");
+const irStatusText = (status) => ({ "0": "姝e父", "1": "閬尅", "2": "浣嶇疆鍋忕Щ" }[status] || "-");
+const deviationClass = (value) => {
+ const num = Number(value);
+ if (num <= 1) return "text-success";
+ if (num <= 3) return "text-warning";
+ return "text-danger";
+};
-const rules = {
+// ==================== 鑷姩绉伴噸璁板綍 ====================
+const recordQuery = reactive({ plateNumber: "", recordNo: "", carrierName: "", weighStatus: "", cheatFlag: "" });
+const recordList = ref([]);
+const recordLoading = ref(false);
+
+const loadOverview = () => {
+ getWeighbridgeOverview().then((res) => {
+ overview.value = res.data || {};
+ });
+};
+const loadRecord = () => {
+ recordLoading.value = true;
+ listWeighbridgeRecord({ ...recordQuery, current: 1, size: 300 })
+ .then((res) => {
+ recordList.value = res.data?.records || [];
+ })
+ .finally(() => {
+ recordLoading.value = false;
+ });
+};
+
+// ==================== 鐨噸绉伴噸 ====================
+const firstWeightDialog = ref(false);
+const firstWeightRef = ref();
+const firstWeightForm = ref({});
+const firstWeightRules = {
plateNumber: [{ required: true, message: "璇疯緭鍏ヨ溅鐗屽彿", trigger: "blur" }],
- tareWeight: [{ required: true, message: "璇疯緭鍏ョ毊閲�", trigger: "change" }],
- grossWeight: [{ required: true, message: "璇疯緭鍏ユ瘺閲�", trigger: "change" }],
+ tareWeight: [{ required: true, message: "璇疯緭鍏ョ毊閲�", trigger: "blur" }],
+};
+const orderMatchMessage = ref("");
+const orderMatchSuccess = ref(false);
+
+const openFirstWeight = () => {
+ firstWeightForm.value = { irStatus: "0", offsetLimit: 30, positionOffset: 0 };
+ orderMatchMessage.value = "";
+ orderMatchSuccess.value = false;
+ firstWeightDialog.value = true;
+};
+const resetFirstWeight = () => {
+ firstWeightRef.value?.resetFields();
+ firstWeightForm.value = {};
+};
+const autoMatchOrder = () => {
+ const orderNo = firstWeightForm.value.orderNo;
+ if (!orderNo) {
+ orderMatchMessage.value = "";
+ return;
+ }
+ matchWeighbridgeOrder(orderNo).then((res) => {
+ const data = res.data || {};
+ orderMatchSuccess.value = !!data.matched;
+ orderMatchMessage.value = data.matched
+ ? `${data.message}锛�${data.orderParty || ''}锛�${data.projectName || '鏃犻」鐩�'}锛塦
+ : data.message;
+ });
+};
+const submitFirstWeight = () => {
+ firstWeightRef.value.validate((valid) => {
+ if (!valid) return;
+ submitLoading.value = true;
+ firstWeighbridgeWeight(firstWeightForm.value)
+ .then((res) => {
+ const record = res.data || {};
+ if (record.cheatFlag === "1") {
+ ElMessage({ message: `绾㈠妫�娴嬪紓甯革細${record.cheatReason}`, type: "error", duration: 6000 });
+ } else {
+ proxy.$modal.msgSuccess(`鐨噸閲囬泦鎴愬姛锛岀鍗曞彿 ${record.recordNo}`);
+ }
+ firstWeightDialog.value = false;
+ loadRecord();
+ loadOverview();
+ if (record.cheatFlag !== "1") {
+ openSecondWeight(record);
+ }
+ })
+ .finally(() => {
+ submitLoading.value = false;
+ });
+ });
};
-const netPreview = computed(() => {
- const t = Number(form.tareWeight);
- const g = Number(form.grossWeight);
- if (!t || !g || g <= t) return "鈥�";
- return (g - t).toFixed(2);
+// ==================== 姣涢噸绉伴噸 ====================
+const secondWeightDialog = ref(false);
+const secondWeightForm = reactive({ grossWeight: null, irStatus: "0", positionOffset: 0 });
+const currentRecord = ref({});
+const computedNetWeight = computed(() => {
+ const tare = Number(currentRecord.value.tareWeight || 0);
+ const gross = Number(secondWeightForm.grossWeight || 0);
+ if (!gross) return "";
+ return (gross - tare).toFixed(2);
});
-function netOf(row) {
- if (row.netWeight !== null && row.netWeight !== undefined) return Number(row.netWeight).toFixed(2);
- if (row.grossWeight !== null && row.tareWeight !== null) {
- return (Number(row.grossWeight) - Number(row.tareWeight)).toFixed(2);
- }
- return "鈥�";
-}
-
-const pageAbnormal = computed(() => rows.value.filter(r => r.infraredStatus && r.infraredStatus !== "normal").length);
-const pageUnmatched = computed(() => rows.value.filter(r => !r.orderMatched).length);
-const pagePendingErp = computed(() => rows.value.filter(r => r.erpPushStatus !== "success").length);
-
-async function load() {
- loading.value = true;
- try {
- const res = await listWeighbridgeSystem({ ...query });
- const data = res?.data ?? res;
- rows.value = data?.records || [];
- total.value = Number(data?.total) || 0;
- } catch (e) {
- rows.value = [];
- total.value = 0;
- } finally {
- loading.value = false;
- }
-}
-
-function handleSearch() {
- query.current = 1;
- load();
-}
-
-function resetQuery() {
- query.plateNumber = "";
- handleSearch();
-}
-
-function openWeigh() {
- Object.assign(form, emptyForm);
- dialog.value = true;
-}
-
-async function submit() {
- try {
- await formRef.value.validate();
- } catch (e) {
+const openSecondWeight = (row) => {
+ currentRecord.value = { ...row };
+ secondWeightForm.grossWeight = null;
+ secondWeightForm.irStatus = "0";
+ secondWeightForm.positionOffset = row.positionOffset != null ? Number(row.positionOffset) : 0;
+ secondWeightDialog.value = true;
+};
+const submitSecondWeight = () => {
+ if (!secondWeightForm.grossWeight) {
+ proxy.$modal.msgWarning("璇疯緭鍏ユ瘺閲�");
return;
}
- if (Number(form.grossWeight) <= Number(form.tareWeight)) {
- proxy.$modal.msgError("姣涢噸蹇呴』澶т簬鐨噸");
+ submitLoading.value = true;
+ secondWeighbridgeWeight({
+ id: currentRecord.value.id,
+ grossWeight: secondWeightForm.grossWeight,
+ irStatus: secondWeightForm.irStatus,
+ positionOffset: secondWeightForm.positionOffset,
+ })
+ .then((res) => {
+ const record = res.data || {};
+ if (record.cheatFlag === "1") {
+ ElMessage({ message: `绾㈠妫�娴嬪紓甯革細${record.cheatReason}`, type: "error", duration: 6000 });
+ } else {
+ proxy.$modal.msgSuccess(`杩囩瀹屾垚锛屽噣閲� ${record.netWeight} kg`);
+ }
+ secondWeightDialog.value = false;
+ loadRecord();
+ loadOverview();
+ if (record.weighStatus === "2") {
+ openPrintDialog(record);
+ }
+ })
+ .finally(() => {
+ submitLoading.value = false;
+ });
+};
+
+// ==================== 绾㈠妫�娴� ====================
+const infraredDialog = ref(false);
+const infraredForm = reactive({ irStatus: "0", positionOffset: 0 });
+const infraredResult = ref({});
+
+const openInfraredDialog = (row) => {
+ currentRecord.value = { ...row };
+ infraredForm.irStatus = row.irStatus || "0";
+ infraredForm.positionOffset = row.positionOffset != null ? Number(row.positionOffset) : 0;
+ infraredResult.value = {};
+ infraredDialog.value = true;
+};
+const submitInfrared = () => {
+ infraredCheck({
+ recordId: currentRecord.value.id,
+ positionOffset: infraredForm.positionOffset,
+ irStatus: infraredForm.irStatus,
+ }).then((res) => {
+ infraredResult.value = res.data || {};
+ loadRecord();
+ loadOverview();
+ });
+};
+
+// ==================== 鎵撳嵃纾呭崟 ====================
+const printDialog = ref(false);
+const printData = ref({});
+const qrCodeUrl = ref("");
+const printArea = ref();
+
+const openPrintDialog = (row) => {
+ getWeighbridgePrintInfo(row.id).then(async (res) => {
+ const data = res.data || {};
+ printData.value = data.record || {};
+ qrCodeUrl.value = await QRCode.toDataURL(data.qrCode || "", { width: 180, margin: 1 });
+ printDialog.value = true;
+ loadRecord();
+ });
+};
+const doPrint = () => {
+ const html = printArea.value?.innerHTML || "";
+ const win = window.open("", "_blank", "width=520,height=680");
+ if (!win) {
+ proxy.$modal.msgWarning("娴忚鍣ㄦ嫤鎴簡鎵撳嵃绐楀彛锛岃鍏佽寮圭獥鍚庨噸璇�");
return;
}
- saving.value = true;
- try {
- const res = await autoWeigh({ ...form });
- const result = res?.data || {};
- dialog.value = false;
- if (result.cheatFlag) {
- proxy.$modal.msgWarning("绉伴噸瀹屾垚锛岀孩澶栨娴嬪彂鐜拌溅杈嗗亸绉伙紝宸叉爣璁板紓甯�");
- } else {
- proxy.$modal.msgSuccess("绉伴噸瀹屾垚锛岀鍗曞凡鐢熸垚");
- }
- load();
- } catch (e) {
- proxy.$modal.msgError("绉伴噸澶辫触锛岃绋嶅悗閲嶈瘯");
- } finally {
- saving.value = false;
- }
-}
+ win.document.write(`<!DOCTYPE html><html><head><title>纾呭崟鎵撳嵃</title>
+ <style>
+ body{font-family:"Microsoft YaHei",Arial,sans-serif;padding:16px;}
+ .ticket{border:1px solid #333;padding:14px;}
+ .ticket-title{text-align:center;font-size:20px;font-weight:bold;margin-bottom:6px;}
+ .ticket-no{text-align:right;font-size:12px;margin-bottom:8px;}
+ .ticket-body{display:flex;justify-content:space-between;}
+ .ticket-left p{margin:4px 0;font-size:13px;}
+ .ticket-left p span{display:inline-block;width:76px;color:#555;}
+ .ticket-left p.net{font-weight:bold;font-size:15px;}
+ .qr-img{width:150px;height:150px;}
+ .qr-tip{text-align:center;font-size:12px;color:#666;}
+ .ticket-footer{margin-top:10px;font-size:12px;color:#666;text-align:center;}
+ </style></head><body><div class="ticket">${html}</div></body></html>`);
+ win.document.close();
+ win.focus();
+ setTimeout(() => {
+ win.print();
+ }, 300);
+};
-async function pushErp(row) {
- pushingId.value = row.id;
- try {
- await pushWeighbridgeToErp(row.id);
- proxy.$modal.msgSuccess("绉伴噸鏁版嵁宸叉帹閫佽嚦 ERP");
- load();
- } catch (e) {
- proxy.$modal.msgError("ERP 鎺ㄩ�佸け璐�");
- } finally {
- pushingId.value = null;
- }
-}
+// ==================== 鎵爜鏍搁獙 ====================
+const verifyDialog = ref(false);
+const verifyCode = ref("");
+const verifyResult = ref({});
-async function printTicket(row) {
- const netWeight = row.netWeight ?? (
- row.grossWeight != null && row.tareWeight != null
- ? Number(row.grossWeight) - Number(row.tareWeight)
- : ""
+const openVerifyDialog = () => {
+ verifyCode.value = "";
+ verifyResult.value = {};
+ verifyDialog.value = true;
+};
+const doVerify = () => {
+ if (!verifyCode.value) {
+ proxy.$modal.msgWarning("璇锋壂鎻忔垨绮樿创浜岀淮鐮佸唴瀹�");
+ return;
+ }
+ verifyWeighbridgeQr(verifyCode.value.trim()).then((res) => {
+ verifyResult.value = res.data || {};
+ });
+};
+
+// ==================== ERP ====================
+const syncErp = (row) => {
+ ElMessageBox.confirm(`纭灏嗙鍗� ${row.recordNo} 涓婁紶鑷� ERP锛焋, "涓婁紶ERP", { type: "info" }).then(() => {
+ syncWeighbridgeErp(row.id).then((res) => {
+ const data = res.data || {};
+ if (data.success) {
+ proxy.$modal.msgSuccess(data.message);
+ } else {
+ ElMessage({ message: data.message, type: "warning", duration: 6000 });
+ }
+ loadRecord();
+ loadErpLog();
+ loadOverview();
+ });
+ }).catch(() => {});
+};
+
+const erpLogList = ref([]);
+const erpLogLoading = ref(false);
+const loadErpLog = () => {
+ erpLogLoading.value = true;
+ listWeighbridgeErpLog({ current: 1, size: 200 })
+ .then((res) => {
+ erpLogList.value = res.data?.records || [];
+ })
+ .finally(() => {
+ erpLogLoading.value = false;
+ });
+};
+const viewErpPayload = (row) => {
+ ElMessageBox.alert(
+ `<div style="max-height:400px;overflow:auto;white-space:pre-wrap;font-size:12px">${row.requestBody || ""}</div>`,
+ "涓婁紶鎶ユ枃",
+ { dangerouslyUseHTMLString: true }
);
- const weighNo = cleanQrValue(row.weighNo) || `WB${formatQrTime(row.weightTime)}${String(row.id || 0).padStart(3, "0")}`;
- ticket.value = { ...row, weighNo, netWeight };
- // 濮嬬粓鏍规嵁褰撳墠璁板綍閲嶅缓浜岀淮鐮侊紝閬垮厤鍘嗗彶 qrCode 涓畫鐣欏瓧绗︿覆 "null"銆�
- const content = [
- weighNo,
- cleanQrValue(row.plateNumber),
- cleanQrValue(netWeight),
- cleanQrValue(row.weightTime),
- cleanQrValue(row.carrierName),
- cleanQrValue(row.weighbridgeNumber),
- ].join("|");
- qrUrl.value = await QRCode.toDataURL(content, { width: 180, margin: 1 });
- ticketDialog.value = true;
-}
+};
-function cleanQrValue(value) {
- return value == null || String(value).toLowerCase() === "null" ? "" : String(value);
-}
+// ==================== 璇︽儏 ====================
+const detailDialog = ref(false);
+const detail = ref({});
+const openDetail = (row) => {
+ getWeighbridgeRecord(row.id).then((res) => {
+ detail.value = res.data || {};
+ detailDialog.value = true;
+ });
+};
-function formatQrTime(value) {
- const digits = cleanQrValue(value).replace(/\D/g, "");
- return (digits || String(Date.now())).slice(0, 14).padEnd(14, "0");
-}
+// ==================== 鎵嬪伐杩囩璁板綍 ====================
+const manualQuery = reactive({ plateNumber: "" });
+const manualList = ref([]);
+const manualLoading = ref(false);
+const manualDialog = ref(false);
+const manualFormRef = ref();
+const manualForm = ref({});
+const manualRules = {
+ plateNumber: [{ required: true, message: "璇疯緭鍏ヨ溅鐗屽彿", trigger: "blur" }],
+ weightTime: [{ required: true, message: "璇烽�夋嫨绉伴噸鏃堕棿", trigger: "change" }],
+ tareWeight: [{ required: true, message: "璇疯緭鍏ョ毊閲�", trigger: "blur" }],
+ grossWeight: [{ required: true, message: "璇疯緭鍏ユ瘺閲�", trigger: "blur" }],
+};
-function print() {
- const t = ticket.value;
- const rowsHtml = [
- ["杞︾墝", t.plateNumber],
- ["鎵胯繍鍟�", t.carrierName || "鈥�"],
- ["鐨噸", `${t.tareWeight ?? "鈥�"} kg`],
- ["姣涢噸", `${t.grossWeight ?? "鈥�"} kg`],
- ["鍑�閲�", `${t.netWeight ?? "鈥�"} kg`],
- ["璁㈠崟", t.orderNo || "鏈尮閰�"],
- ["绉伴噸鏃堕棿", t.weightTime || "鈥�"],
- ].map(([k, v]) => `<tr><th>${k}</th><td>${v}</td></tr>`).join("");
-
- const html = `<!DOCTYPE html><html><head><meta charset="utf-8"><title>鐢靛瓙纾呭崟 ${t.weighNo || ""}</title>
- <style>
- body{font-family:"Microsoft YaHei",Arial,sans-serif;padding:32px;color:#1b2733}
- h1{text-align:center;font-size:22px;letter-spacing:4px;margin:0 0 8px}
- .no{text-align:center;color:#666;font-size:13px;margin-bottom:22px}
- table{width:100%;border-collapse:collapse;font-size:14px}
- th,td{border:1px solid #d9dde3;padding:10px 12px;text-align:left}
- th{width:28%;background:#f5f7fa;font-weight:500;color:#5c6b7a}
- .qr{text-align:center;margin-top:24px}
- .qr img{width:170px;height:170px}
- .tip{text-align:center;color:#98a4b0;font-size:12px;margin-top:6px}
- </style></head><body>
- <h1>鏃犱汉鍊煎畧鐢靛瓙纾呭崟</h1>
- <div class="no">纾呭崟鍙凤細${t.weighNo || "鈥�"}</div>
- <table>${rowsHtml}</table>
- <div class="qr"><img src="${qrUrl.value}" alt="浜岀淮鐮�"></div>
- <div class="tip">鎵弿浜岀淮鐮佸彲鏍搁獙鏈纾呭崟</div>
- </body></html>`;
-
- const w = window.open("", "_blank", "width=760,height=860");
- if (!w) {
- proxy.$modal.msgWarning("璇峰厑璁稿脊鍑虹獥鍙e悗閲嶈瘯鎵撳嵃");
- return;
+const loadManual = () => {
+ manualLoading.value = true;
+ listWeighbridgeSystem({ ...manualQuery, current: 1, size: 300 })
+ .then((res) => {
+ manualList.value = res.data?.records || [];
+ })
+ .finally(() => {
+ manualLoading.value = false;
+ });
+};
+const openManualForm = (row) => {
+ if (row) {
+ getWeighbridgeSystem(row.id).then((res) => {
+ manualForm.value = { ...res.data };
+ manualDialog.value = true;
+ });
+ } else {
+ const now = new Date();
+ const pad = (n) => String(n).padStart(2, "0");
+ manualForm.value = {
+ weightTime: `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`,
+ };
+ manualDialog.value = true;
}
- w.document.write(html);
- w.document.close();
- w.focus();
- setTimeout(() => w.print(), 300);
-}
+};
+const resetManualForm = () => {
+ manualFormRef.value?.resetFields();
+ manualForm.value = {};
+};
+const submitManual = () => {
+ manualFormRef.value.validate((valid) => {
+ if (!valid) return;
+ if (Number(manualForm.value.grossWeight) <= Number(manualForm.value.tareWeight)) {
+ proxy.$modal.msgError("姣涢噸蹇呴』澶т簬鐨噸");
+ return;
+ }
+ const api = manualForm.value.id ? updateWeighbridgeSystem : addWeighbridgeSystem;
+ api(manualForm.value).then(() => {
+ proxy.$modal.msgSuccess("淇濆瓨鎴愬姛");
+ manualDialog.value = false;
+ loadManual();
+ });
+ });
+};
+const removeManual = (row) => {
+ ElMessageBox.confirm(`纭畾鍒犻櫎杞︾墝銆�${row.plateNumber}銆嶇殑杩囩璁板綍鍚楋紵`, "鍒犻櫎鎻愮ず", { type: "warning" }).then(() => {
+ delWeighbridgeSystem([row.id]).then(() => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ loadManual();
+ });
+ }).catch(() => {});
+};
-onMounted(load);
+const handleTabChange = (name) => {
+ if (name === "auto") loadRecord();
+ if (name === "manual") loadManual();
+ if (name === "erpLog") loadErpLog();
+};
+
+onMounted(() => {
+ loadOverview();
+ loadRecord();
+ loadManual();
+ loadErpLog();
+});
</script>
<style scoped lang="scss">
-$line: #e3e8ed;
-$paper: #f4f6f8;
-$text: #1b2733;
-$muted: #5c6b7a;
-$brand: #2c51d9;
-$alert: #e0a02e;
-
.weighbridge-page {
- background: $paper;
- min-height: calc(100vh - 84px);
-}
-
-/* 椤靛ご */
-.page-head {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 20px;
- padding: 20px 22px;
- background: linear-gradient(150deg, #14191f 0%, #1e252c 100%);
- border-radius: 6px;
- margin-bottom: 16px;
-
- h2 {
- margin: 0 0 6px;
- font-size: 20px;
- font-weight: 700;
- color: #fff;
- letter-spacing: 0.03em;
- }
-
- p {
- margin: 0;
- font-size: 13px;
- color: rgba(234, 240, 245, 0.66);
- }
-
- :deep(.el-button--primary) {
- background: #fff;
- border-color: #fff;
- color: #14191f;
- font-weight: 600;
-
- &:hover {
- background: #e9eef5;
- border-color: #e9eef5;
- color: #14191f;
+ .overview-row {
+ display: flex;
+ gap: 14px;
+ margin-bottom: 16px;
+ .overview-card {
+ flex: 1;
+ background: #f7f9fc;
+ border-radius: 6px;
+ padding: 14px 18px;
+ .label {
+ color: #909399;
+ font-size: 13px;
+ }
+ .value {
+ font-size: 24px;
+ font-weight: 600;
+ color: #303133;
+ margin-top: 6px;
+ &.warning {
+ color: #e6a23c;
+ }
+ &.danger {
+ color: #f56c6c;
+ }
+ }
}
}
-}
-
-/* 姒傝 */
-.stat-row {
- display: grid;
- grid-template-columns: repeat(4, minmax(0, 1fr));
- gap: 14px;
- margin-bottom: 16px;
-}
-
-.stat {
- position: relative;
- background: #fff;
- border: 1px solid $line;
- border-radius: 6px;
- padding: 14px 18px 12px;
-
- &::before {
- content: "";
- position: absolute;
- left: 0;
- top: 0;
- bottom: 0;
- width: 3px;
- background: #c7d0da;
+ .ml10 {
+ margin-left: 10px;
}
-}
-
-.stat-label {
- display: block;
- font-size: 12.5px;
- color: $muted;
- margin-bottom: 8px;
-}
-
-.stat-value {
- font-family: "MyCustomFont", "Helvetica Neue", Arial, sans-serif;
- font-size: 26px;
- font-weight: 700;
- color: $text;
- line-height: 1;
-
- i {
- font-style: normal;
+ .sub-text {
+ color: #909399;
font-size: 12px;
- color: #98a4b0;
- margin-left: 4px;
- font-family: "Microsoft YaHei", Arial, sans-serif;
- font-weight: 400;
}
-
- &.warn {
- color: $alert;
- }
-}
-
-/* 鏌ヨ */
-.filter-card {
- display: flex;
- align-items: center;
- gap: 10px;
- padding: 14px 18px;
- background: #fff;
- border: 1px solid $line;
- border-radius: 6px;
- margin-bottom: 16px;
-
- .filter-label {
+ .order-no {
+ margin-left: 6px;
font-size: 13px;
- color: $muted;
}
-}
-
-/* 琛ㄦ牸 */
-.table-card {
- background: #fff;
- border: 1px solid $line;
- border-radius: 6px;
- padding: 14px 16px;
-}
-
-.pager {
- justify-content: flex-end;
- margin-top: 14px;
-}
-
-.table-empty {
- padding: 26px 0;
- color: #a7b2bd;
- font-size: 13px;
-}
-
-.muted-cell {
- color: #a7b2bd;
-}
-
-/* 寮圭獥 */
-.weigh-tip {
- margin-bottom: 16px;
-}
-
-.weigh-form {
- :deep(.el-form-item) {
- margin-bottom: 16px;
+ .text-success {
+ color: #67c23a;
}
-}
-
-.net-preview {
- margin: 4px 0 0 110px;
- padding: 10px 14px;
- background: #f3f6fa;
- border: 1px dashed #d5dde4;
- border-radius: 4px;
- font-size: 13px;
- color: $muted;
-
- b {
- font-family: "MyCustomFont", "Helvetica Neue", Arial, sans-serif;
- font-size: 18px;
- color: $brand;
- margin: 0 4px;
+ .text-warning {
+ color: #e6a23c;
}
-}
-
-/* 纾呭崟 */
-.ticket {
- text-align: center;
-
- h2 {
- margin: 0 0 8px;
- font-size: 18px;
- letter-spacing: 0.16em;
- color: $text;
+ .text-danger {
+ color: #f56c6c;
}
-
- .ticket-no {
- margin: 0 0 16px;
- font-size: 12.5px;
- color: $muted;
- }
-
- :deep(.el-descriptions__label) {
- width: 90px;
- color: $muted;
- }
-}
-
-.qr {
- width: 170px;
- height: 170px;
- margin: 20px auto 0;
- display: block;
-}
-
-.qr-tip {
- margin: 6px 0 0;
- font-size: 12px;
- color: #98a4b0;
-}
-
-@media (max-width: 900px) {
- .stat-row {
- grid-template-columns: repeat(2, minmax(0, 1fr));
- }
-
- .page-head {
- flex-direction: column;
- align-items: flex-start;
+ .ticket {
+ border: 1px solid #333;
+ padding: 14px;
+ .ticket-title {
+ text-align: center;
+ font-size: 20px;
+ font-weight: bold;
+ margin-bottom: 6px;
+ }
+ .ticket-no {
+ text-align: right;
+ font-size: 12px;
+ margin-bottom: 8px;
+ }
+ .ticket-body {
+ display: flex;
+ justify-content: space-between;
+ .ticket-left p {
+ margin: 4px 0;
+ font-size: 13px;
+ span {
+ display: inline-block;
+ width: 76px;
+ color: #555;
+ }
+ &.net {
+ font-weight: bold;
+ font-size: 15px;
+ }
+ }
+ .ticket-right {
+ text-align: center;
+ .qr-img {
+ width: 150px;
+ height: 150px;
+ }
+ .qr-tip {
+ font-size: 12px;
+ color: #666;
+ }
+ }
+ }
+ .ticket-footer {
+ margin-top: 10px;
+ font-size: 12px;
+ color: #666;
+ text-align: center;
+ }
}
}
</style>
--
Gitblit v1.9.3