From be1fce1afe340a72bd1e6856cbef01bf3c602bf0 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 07 四月 2026 16:00:33 +0800
Subject: [PATCH] fix: 不在销售台账处出库。在发货台账处导入excel,匹配客户进行出库。销售台账处的产品列表需要展示已发货/未发货数量。

---
 src/views/salesManagement/deliveryLedger/index.vue |  774 +++++++++--------------------------------------------------
 1 files changed, 124 insertions(+), 650 deletions(-)

diff --git a/src/views/salesManagement/deliveryLedger/index.vue b/src/views/salesManagement/deliveryLedger/index.vue
index 0eb60cc..9c22014 100644
--- a/src/views/salesManagement/deliveryLedger/index.vue
+++ b/src/views/salesManagement/deliveryLedger/index.vue
@@ -2,210 +2,93 @@
   <div class="app-container">
     <div class="search_form">
       <el-form :model="searchForm" :inline="true">
-        <el-form-item label="閿�鍞鍗曞彿锛�">
-          <el-input v-model="searchForm.salesContractNo" placeholder="璇疯緭鍏�" clearable prefix-icon="Search" style="width: 200px"
-            @change="handleQuery" />
+        <el-form-item label="娴佹按鍙凤細">
+          <el-input v-model="searchForm.serialNo" placeholder="璇疯緭鍏�" clearable style="width: 200px" @change="handleQuery" />
         </el-form-item>
-        <el-form-item label="杞︾墝鍙凤細">
-          <el-input v-model="searchForm.shippingCarNumber" placeholder="璇疯緭鍏�" clearable prefix-icon="Search" style="width: 200px"
-            @change="handleQuery" />
+        <el-form-item label="杞﹀彿锛�">
+          <el-input v-model="searchForm.carNo" placeholder="璇疯緭鍏�" clearable style="width: 200px" @change="handleQuery" />
         </el-form-item>
-        <el-form-item label="蹇�掑崟鍙凤細">
-          <el-input v-model="searchForm.expressNumber" placeholder="璇疯緭鍏�" clearable prefix-icon="Search" style="width: 200px"
-            @change="handleQuery" />
+        <el-form-item label="璐у悕锛�">
+          <el-input v-model="searchForm.goodsName" placeholder="璇疯緭鍏�" clearable style="width: 200px" @change="handleQuery" />
+        </el-form-item>
+        <el-form-item label="鏀惰揣鍗曚綅锛�">
+          <el-input v-model="searchForm.receiveUnit" placeholder="璇疯緭鍏�" clearable style="width: 200px" @change="handleQuery" />
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" @click="handleQuery"> 鎼滅储 </el-button>
+          <el-button type="primary" @click="handleQuery">鎼滅储</el-button>
         </el-form-item>
       </el-form>
     </div>
+
     <div class="table_list">
       <div class="actions">
-        <div></div>
+        <div />
         <div>
-          <el-button @click="handleOut">瀵煎嚭</el-button>
+          <el-button type="primary" plain @click="openImportDialog">瀵煎叆</el-button>
           <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
         </div>
       </div>
-      <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange"
-        :row-key="(row) => row.id" style="width: 100%" height="calc(100vh - 21.5em)">
+
+      <el-table
+        :data="tableData"
+        border
+        v-loading="tableLoading"
+        @selection-change="handleSelectionChange"
+        :row-key="(row) => row.id"
+        style="width: 100%"
+        height="calc(100vh - 21.5em)"
+      >
         <el-table-column align="center" type="selection" width="55" />
-        <el-table-column align="center" label="搴忓彿" type="index" width="60" />
-        <el-table-column label="閿�鍞鍗�" prop="salesContractNo" show-overflow-tooltip />
-        <el-table-column label="鍙戣揣璁㈠崟鍙�" prop="shippingNo" show-overflow-tooltip />
-        <el-table-column label="瀹㈡埛鍚嶇О" prop="customerName" show-overflow-tooltip />
-        <el-table-column label="浜у搧鍚嶇О" prop="productName" show-overflow-tooltip />
-        <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" show-overflow-tooltip />
-        <el-table-column label="鍙戣揣鏃堕棿" prop="shippingDate" show-overflow-tooltip />
-        <el-table-column label="鍙戣揣杞︾墝鍙�" prop="shippingCarNumber" show-overflow-tooltip />
-        <el-table-column label="蹇�掑叕鍙�" prop="expressCompany" show-overflow-tooltip />
-        <el-table-column label="蹇�掑崟鍙�" prop="expressNumber" show-overflow-tooltip />
-        <el-table-column label="瀹℃牳鐘舵��" prop="status" align="center" width="120">
-          <template #default="scope">
-            <el-tag :type="getApprovalStatusType(scope.row.status)">
-              {{ getApprovalStatusText(scope.row.status) }}
-            </el-tag>
-          </template>
-        </el-table-column>
-        <el-table-column fixed="right" label="鎿嶄綔" width="220" align="center">
-          <template #default="scope">
-            <el-button 
-              link 
-              type="primary"
-              :disabled="!isApproved(scope.row.status)"
-              @click="openForm('edit', scope.row)">琛ュ厖鍙戣揣淇℃伅</el-button>
-            <el-button
-              link
-              type="primary"
-							style="color: #67C23A"
-              @click="openDetail(scope.row)"
-            >璇︽儏</el-button>
-            <el-button 
-              link 
-              type="danger"
-              :disabled="isApproving(scope.row.status)"
-              @click="handleDeleteSingle(scope.row)">鍒犻櫎</el-button>
-          </template>
-        </el-table-column>
+        <el-table-column label="娴佹按鍙�" prop="serialNo" show-overflow-tooltip min-width="120" />
+        <el-table-column label="杞﹀彿" prop="carNo" show-overflow-tooltip min-width="120" />
+        <el-table-column label="鍙戣揣鍗曚綅" prop="shipUnit" show-overflow-tooltip min-width="140" />
+        <el-table-column label="鏀惰揣鍗曚綅" prop="receiveUnit" show-overflow-tooltip min-width="140" />
+        <el-table-column label="璐у悕" prop="goodsName" show-overflow-tooltip min-width="120" />
+        <el-table-column label="瑙勬牸" prop="specification" show-overflow-tooltip min-width="120" />
+        <el-table-column label="姣涢噸" prop="grossWeight" show-overflow-tooltip min-width="100" />
+        <el-table-column label="鐨噸" prop="tareWeight" show-overflow-tooltip min-width="100" />
+        <el-table-column label="鍑�閲�" prop="netWeight" show-overflow-tooltip min-width="100" />
+        <el-table-column label="涓�娆¤繃纾呮椂闂�" prop="firstWeighTime" show-overflow-tooltip min-width="180" />
+        <el-table-column label="浜屾杩囩鏃堕棿" prop="secondWeighTime" show-overflow-tooltip min-width="180" />
+        <el-table-column label="鍘熷彂" prop="originalSender" show-overflow-tooltip min-width="100" />
+        <el-table-column label="鏇存柊浜�" prop="updateBy" show-overflow-tooltip min-width="120" />
       </el-table>
-      <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
-        :page="page.current" :limit="page.size" @pagination="paginationChange" />
+
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        layout="total, sizes, prev, pager, next, jumper"
+        :page="page.current"
+        :limit="page.size"
+        @pagination="paginationChange"
+      />
     </div>
-    <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? '鏂板鍙戣揣鍙拌处' : '缂栬緫鍙戣揣鍙拌处'" width="40%"
-      @close="closeDia">
-      <el-form :model="form" label-width="120px" label-position="top" :rules="rules" ref="formRef">
-        <el-row :gutter="30">
-          <el-col :span="24">
-            <el-form-item label="鍙戣揣绫诲瀷锛�" prop="type">
-              <el-select
-                v-model="form.type"
-                placeholder="璇烽�夋嫨鍙戣揣绫诲瀷"
-                style="width: 100%"
-                @change="handleShippingTypeChange"
-              >
-                <el-option label="璐ц溅" value="璐ц溅" />
-                <el-option label="蹇��" value="蹇��" />
-              </el-select>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row :gutter="30">
-          <el-col :span="24">
-            <el-form-item label="鍙戣揣鏃ユ湡锛�" prop="shippingDate">
-              <el-date-picker
-                style="width: 100%"
-                v-model="form.shippingDate"
-                value-format="YYYY-MM-DD"
-                format="YYYY-MM-DD"
-                type="date"
-                placeholder="璇烽�夋嫨鍙戣揣鏃ユ湡"
-                clearable
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row :gutter="30">
-          <el-col :span="24" v-if="form.type === '璐ц溅'">
-            <el-form-item label="鍙戣揣杞︾墝鍙凤細" prop="shippingCarNumber">
-              <el-input
-                v-model="form.shippingCarNumber"
-                placeholder="璇疯緭鍏ュ彂璐ц溅鐗屽彿"
-                clearable
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="24" v-else>
-            <el-form-item label="蹇�掑叕鍙革細" prop="expressCompany">
-              <el-input
-                v-model="form.expressCompany"
-                placeholder="璇疯緭鍏ュ揩閫掑叕鍙�"
-                clearable
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row :gutter="30" v-if="form.type === '蹇��'">
-          <el-col :span="24">
-            <el-form-item label="蹇�掑崟鍙凤細" prop="expressNumber">
-              <el-input
-                v-model="form.expressNumber"
-                placeholder="璇疯緭鍏ュ揩閫掑崟鍙�"
-                clearable
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row :gutter="30">
-          <el-col :span="24">
-            <el-form-item label="鍙戣揣鍥剧墖锛�">
-              <el-upload 
-                v-model:file-list="deliveryFileList" 
-                :action="upload.url" 
-                multiple 
-                ref="deliveryFileUpload" 
-                auto-upload
-                :headers="upload.headers" 
-                :data="{ type: 9 }"
-                :before-upload="handleDeliveryBeforeUpload" 
-                :on-error="handleDeliveryUploadError"
-                :on-success="handleDeliveryUploadSuccess" 
-                :on-remove="handleDeliveryRemove"
-                list-type="picture-card"
-                :limit="9"
-                accept="image/png,image/jpeg,image/jpg"
-              >
-                <el-icon class="avatar-uploader-icon"><Plus /></el-icon>
-                <template #tip>
-                  <div class="el-upload__tip">
-                    鏀寔 jpg銆乯peg銆乸ng 鏍煎紡锛屾渶澶氫笂浼� 9 寮狅紝鍗曞紶澶у皬涓嶈秴杩� 10MB
-                  </div>
-                </template>
-              </el-upload>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
+
+    <el-dialog v-model="importUpload.open" :title="importUpload.title" width="500px" append-to-body>
+      <el-upload
+        ref="importUploadRef"
+        drag
+        :limit="1"
+        :action="importUpload.url"
+        :headers="importUpload.headers"
+        :before-upload="importUpload.beforeUpload"
+        :on-success="importUpload.onSuccess"
+        :on-error="importUpload.onError"
+        :auto-upload="false"
+        accept=".xlsx,.xls"
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em>
+        </div>
+        <template #tip>
+          <div class="el-upload__tip">浠呮敮鎸� xlsx/xls 鏂囦欢</div>
+        </template>
+      </el-upload>
       <template #footer>
         <div class="dialog-footer">
-          <el-button type="primary" @click="submitForm">纭</el-button>
-          <el-button @click="closeDia">鍙栨秷</el-button>
-        </div>
-      </template>
-    </el-dialog>
-
-    <!-- 璇︽儏寮规 -->
-    <el-dialog v-model="detailDialogVisible" title="鍙戣揣鍙拌处璇︽儏" width="55%" @close="closeDetail">
-      <div v-if="detailRow" class="detail-wrapper">
-        <el-descriptions :column="2" border>
-          <el-descriptions-item label="閿�鍞鍗�">{{ detailRow.salesContractNo || '--' }}</el-descriptions-item>
-          <el-descriptions-item label="鍙戣揣璁㈠崟鍙�">{{ detailRow.shippingNo || '--' }}</el-descriptions-item>
-          <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ detailRow.customerName || '--' }}</el-descriptions-item>
-          <el-descriptions-item label="浜у搧鍚嶇О">{{ detailRow.productName || '--' }}</el-descriptions-item>
-          <el-descriptions-item label="瑙勬牸鍨嬪彿">{{ detailRow.specificationModel || '--' }}</el-descriptions-item>
-          <el-descriptions-item label="鍙戣揣绫诲瀷">{{ detailRow.type || '--' }}</el-descriptions-item>
-          <el-descriptions-item label="鍙戣揣鏃ユ湡">{{ detailRow.shippingDate || '--' }}</el-descriptions-item>
-          <el-descriptions-item label="瀹℃牳鐘舵��">{{ getApprovalStatusText(detailRow.status) }}</el-descriptions-item>
-          <el-descriptions-item label="鍙戣揣杞︾墝鍙�">{{ detailRow.shippingCarNumber || '--' }}</el-descriptions-item>
-          <el-descriptions-item label="蹇�掑叕鍙�">{{ detailRow.expressCompany || '--' }}</el-descriptions-item>
-          <el-descriptions-item label="蹇�掑崟鍙�" :span="2">{{ detailRow.expressNumber || '--' }}</el-descriptions-item>
-        </el-descriptions>
-
-        <div class="detail-images" v-if="detailImages.length">
-          <div class="detail-images-title">鍙戣揣鍥剧墖</div>
-          <el-image
-            v-for="img in detailImages"
-            :key="img.url"
-            :src="img.url"
-            :preview-src-list="detailImages.map(i => i.url)"
-            fit="cover"
-            class="detail-image"
-          />
-        </div>
-        <div v-else class="detail-images-empty">鏆傛棤鍙戣揣鍥剧墖</div>
-      </div>
-      <template #footer>
-        <div class="dialog-footer">
-          <el-button @click="closeDetail">鍏抽棴</el-button>
+          <el-button type="primary" :loading="importUpload.isUploading" @click="submitImport">纭畾</el-button>
+          <el-button @click="importUpload.open = false">鍙栨秷</el-button>
         </div>
       </template>
     </el-dialog>
@@ -215,106 +98,62 @@
 <script setup>
 import pagination from "@/components/PIMTable/Pagination.vue";
 import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue";
-import { ElMessageBox } from "element-plus";
-import { Plus } from "@element-plus/icons-vue";
 import { getToken } from "@/utils/auth";
-import { getCurrentDate } from "@/utils/index.js";
-import {
-	deliveryLedgerListPage,
-	addOrUpdateDeliveryLedger,
-	delDeliveryLedger, deductStock,
-} from "@/api/salesManagement/deliveryLedger.js";
-import { delLedgerFile } from "@/api/salesManagement/salesLedger.js";
- 
+import { weighbridgeLedgerListPage, delWeighbridgeLedger } from "@/api/salesManagement/deliveryLedger.js";
 
 const { proxy } = getCurrentInstance();
+
 const tableData = ref([]);
 const selectedRows = ref([]);
 const tableLoading = ref(false);
-const salesOrderOptions = ref([]);
 const page = reactive({
   current: 1,
   size: 100,
 });
 const total = ref(0);
-const deliveryFileList = ref([]);
-const javaApi = proxy.javaApi;
-// 璇︽儏寮规
-const detailDialogVisible = ref(false);
-const detailRow = ref(null);
-const detailImages = ref([]);
 
-const normalizeFileUrl = (rawUrl = '') => {
-  let fileUrl = rawUrl || '';
-  // Windows 璺緞杞� URL
-  if (fileUrl && fileUrl.indexOf('\\') > -1) {
-    const uploadsIndex = fileUrl.toLowerCase().indexOf('uploads');
-    if (uploadsIndex > -1) {
-      const relativePath = fileUrl.substring(uploadsIndex).replace(/\\/g, '/');
-      fileUrl = '/' + relativePath;
-    } else {
-      const parts = fileUrl.split('\\');
-      const fileName = parts[parts.length - 1];
-      fileUrl = '/uploads/' + fileName;
-    }
-  }
-  if (fileUrl && !fileUrl.startsWith('http')) {
-    if (!fileUrl.startsWith('/')) fileUrl = '/' + fileUrl;
-    fileUrl = javaApi + fileUrl;
-  }
-  return fileUrl;
-};
-
-// 涓婁紶閰嶇疆
-const upload = reactive({
-  // 涓婁紶鐨勫湴鍧�
-  url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
-  // 璁剧疆涓婁紶鐨勮姹傚ご閮�
-  headers: { Authorization: "Bearer " + getToken() },
-});
-
-// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
-const operationType = ref("");
-const dialogFormVisible = ref(false);
 const data = reactive({
   searchForm: {
-    salesContractNo: "", // 閿�鍞鍗曞彿
-    shippingCarNumber: "", // 杞︾墝鍙�
-    expressNumber: "", // 蹇�掑崟鍙�
-  },
-  form: {
-    id: null,
-    salesContractNo: "",
-    customerName: "",
-    specificationModel: "",
-    productName: "",
-    type: "璐ц溅", // 璐ц溅, 蹇��
-    shippingDate: "",
-    shippingCarNumber: "",
-    expressCompany: "",
-    expressNumber: "", // 蹇�掑崟鍙�
-  },
-  rules: {
-    salesContractNo: [{ required: true, message: "璇烽�夋嫨閿�鍞鍗�", trigger: "change" }],
-    customerName: [{ required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: "blur" }],
-    type: [
-      { required: true, message: "璇烽�夋嫨鍙戣揣绫诲瀷", trigger: "change" }
-    ],
-    shippingDate: [{ required: true, message: "璇烽�夋嫨鍙戣揣鏃堕棿", trigger: "change" }],
-    shippingCarNumber: [
-      { validator: (_, value, callback) => validateShippingCarNumber(value, callback), trigger: "blur" }
-    ],
-    expressCompany: [
-      { validator: (_, value, callback) => validateExpressCompany(value, callback), trigger: "blur" }
-    ],
+    serialNo: "",
+    carNo: "",
+    goodsName: "",
+    receiveUnit: "",
   },
 });
-const { form, rules } = toRefs(data);
 const { searchForm } = toRefs(data);
 
- 
+const importUploadRef = ref(null);
+const importUpload = reactive({
+  title: "瀵煎叆鍙拌处",
+  open: false,
+  isUploading: false,
+  url: import.meta.env.VITE_APP_BASE_API + "/sales/weighbridgeLedger/import",
+  headers: { Authorization: "Bearer " + getToken() },
+  beforeUpload: (file) => {
+    const isExcel = file.name.endsWith(".xlsx") || file.name.endsWith(".xls");
+    if (!isExcel) {
+      proxy.$modal.msgError("涓婁紶鏂囦欢鍙兘鏄� xlsx/xls 鏍煎紡");
+      return false;
+    }
+    return true;
+  },
+  onSuccess: (res) => {
+    importUpload.isUploading = false;
+    if (res?.code === 200) {
+      proxy.$modal.msgSuccess("瀵煎叆鎴愬姛");
+      importUpload.open = false;
+      importUploadRef.value?.clearFiles();
+      getList();
+      return;
+    }
+    proxy.$modal.msgError(res?.msg || "瀵煎叆澶辫触");
+  },
+  onError: () => {
+    importUpload.isUploading = false;
+    proxy.$modal.msgError("瀵煎叆澶辫触锛岃閲嶈瘯");
+  },
+});
 
-// 鏌ヨ鍒楄〃
 const handleQuery = () => {
   page.current = 1;
   getList();
@@ -328,381 +167,45 @@
 
 const getList = () => {
   tableLoading.value = true;
-  deliveryLedgerListPage({ ...searchForm.value, ...page })
+  weighbridgeLedgerListPage({ ...searchForm.value, ...page })
     .then((res) => {
-      tableLoading.value = false;
-      tableData.value = res.data.records || [];
-      total.value = res.data.total || 0;
+      tableData.value = res?.data?.records || res?.records || [];
+      total.value = res?.data?.total || res?.total || 0;
     })
-    .catch(() => {
+    .finally(() => {
       tableLoading.value = false;
     });
 };
 
-// 閿�鍞鍗曞彉鍖栨椂鑷姩濉厖瀹㈡埛鍚嶇О
-const handleSalesOrderChange = (value) => {
-  const selectedOrder = salesOrderOptions.value.find(item => item.salesContractNo === value);
-  if (selectedOrder) {
-    form.value.customerName = selectedOrder.customerName;
-  }
-};
-
-// 琛ㄦ牸閫夋嫨鏁版嵁
 const handleSelectionChange = (selection) => {
   selectedRows.value = selection;
 };
 
-// 鎵撳紑寮规
-const openForm = async (type, row) => {
-  // 琛ュ厖鍙戣揣淇℃伅锛氫粎鈥滃鏍搁�氳繃鈥濆厑璁哥紪杈�
-  if (type === 'edit' && row && !isApproved(row.status)) {
-    proxy.$modal.msgWarning("鍙湁瀹℃牳閫氳繃鐨勬暟鎹墠鍙互琛ュ厖鍙戣揣淇℃伅");
-    return;
-  }
-  
-  operationType.value = type;
-  const baseUrl = import.meta.env.VITE_APP_BASE_API;
-  
-  if (type === 'edit' && row) {
-    form.value = {
-      id: row.id ?? null,
-      salesContractNo: row.salesContractNo ?? "",
-      customerName: row.customerName ?? "",
-      type: row.type || "璐ц溅",
-      shippingDate: row.shippingDate || getCurrentDate(),
-      shippingCarNumber: row.shippingCarNumber ?? "",
-      expressCompany: row.expressCompany ?? "",
-      expressNumber: row.expressNumber ?? "",
-    };
-    // 濡傛灉鏈夊浘鐗囷紝灏� commonFileList 杞崲涓烘枃浠跺垪琛ㄦ牸寮�
-    if (row.commonFileList && Array.isArray(row.commonFileList) && row.commonFileList.length > 0) {
-      deliveryFileList.value = row.commonFileList.map((file, index) => {
-        const fileUrl = normalizeFileUrl(file.url || '');
-        
-        return {
-          uid: file.id || Date.now() + index,
-          name: file.name || `image_${index + 1}.jpg`,
-          url: fileUrl,
-          status: 'success',
-          response: {
-            code: 200,
-            data: {
-              tempId: file.id,
-              url: fileUrl
-            }
-          },
-          tempId: file.id // 淇濆瓨鏂囦欢ID锛岀敤浜庢彁浜ゆ椂浣跨敤
-        };
-      });
-    } else {
-      deliveryFileList.value = [];
-    }
-  } else {
-    form.value = {
-      id: null,
-      salesContractNo: "",
-      customerName: "",
-      type: "璐ц溅",
-      shippingDate: getCurrentDate(),
-      shippingCarNumber: "",
-      expressCompany: "",
-      expressNumber: "",
-    };
-    deliveryFileList.value = [];
-  }
-  
-  dialogFormVisible.value = true;
-};
-
-// 鎵撳紑璇︽儏寮规
-const openDetail = (row) => {
-  detailRow.value = row || null;
-  const list = Array.isArray(row?.commonFileList) ? row.commonFileList : [];
-  detailImages.value = list
-    .map((f) => ({ url: normalizeFileUrl(f?.url || '') }))
-    .filter((i) => !!i.url);
-  detailDialogVisible.value = true;
-};
-const closeDetail = () => {
-  detailDialogVisible.value = false;
-  detailRow.value = null;
-  detailImages.value = [];
-};
-
-// 鎻愪氦琛ㄥ崟
-const submitForm = () => {
-  proxy.$refs["formRef"].validate((valid) => {
-    if (valid) {
-      let tempFileIds = [];
-      if (deliveryFileList.value !== null && deliveryFileList.value.length > 0) {
-        tempFileIds = deliveryFileList.value.map((item) => item.tempId);
-      }
-      const payload = {
-        id: form.value.id,
-        type: form.value.type,
-        shippingDate: form.value.shippingDate,
-        shippingCarNumber: form.value.type === "璐ц溅" ? form.value.shippingCarNumber : "",
-        expressCompany: form.value.type === "蹇��" ? form.value.expressCompany : "",
-        expressNumber: form.value.type === "蹇��" ? form.value.expressNumber : "",
-        tempFileIds: tempFileIds,
-      };
-			deductStock(payload).then((res) => {
-        proxy.$modal.msgSuccess("鎿嶄綔鎴愬姛");
-        closeDia();
-        getList();
-      });
-    }
-  });
-};
-
-// 鍏抽棴寮规
-const closeDia = () => {
-  proxy.resetForm("formRef");
-  deliveryFileList.value = []; // 娓呯┖鏂囦欢鍒楄〃
-  dialogFormVisible.value = false;
-};
-
-// 瀵煎嚭
-const handleOut = () => {
-  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
-    confirmButtonText: "纭",
-    cancelButtonText: "鍙栨秷",
-    type: "warning",
-  })
-    .then(() => {
-      proxy.download("/shippingInfo/export", {}, "鍙戣揣鍙拌处.xlsx");
-    })
-    .catch(() => {
-      proxy.$modal.msg("宸插彇娑�");
-    });
-};
-
-// 鎵归噺鍒犻櫎
 const handleDelete = () => {
-  if (selectedRows.value.length === 0) {
+  if (!selectedRows.value.length) {
     proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
     return;
   }
-  
-  // 妫�鏌ラ�変腑鐨勮鏄惁鏈�"瀹℃牳涓�"鐘舵��
-  const approvingRows = selectedRows.value.filter(row => isApproving(row.status));
-  if (approvingRows.length > 0) {
-    proxy.$modal.msgWarning("瀹℃牳涓殑鏁版嵁涓嶈兘鍒犻櫎");
-    return;
-  }
-  
   const ids = selectedRows.value.map((item) => item.id);
-  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎", {
-    confirmButtonText: "纭",
-    cancelButtonText: "鍙栨秷",
-    type: "warning",
-  })
+  proxy.$modal
+    .confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭锛�")
+    .then(() => delWeighbridgeLedger(ids))
     .then(() => {
-      delDeliveryLedger(ids).then((res) => {
-        proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-        getList();
-      });
-    })
-    .catch(() => {
-      proxy.$modal.msg("宸插彇娑�");
-    });
-};
-
-// 鍗曚釜鍒犻櫎
-const handleDeleteSingle = (row) => {
-  // 妫�鏌ユ槸鍚︿负"瀹℃牳涓�"鐘舵��
-  if (isApproving(row.status)) {
-    proxy.$modal.msgWarning("瀹℃牳涓殑鏁版嵁涓嶈兘鍒犻櫎");
-    return;
-  }
-  
-  ElMessageBox.confirm("姝ゆ搷浣滃皢鍒犻櫎璇ヨ褰曪紝鏄惁纭锛�", "鍒犻櫎", {
-    confirmButtonText: "纭",
-    cancelButtonText: "鍙栨秷",
-    type: "warning",
-  })
-    .then(() => {
-      delDeliveryLedger([row.id]).then((res) => {
-        proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-        getList();
-      });
-    })
-    .catch(() => {
-      proxy.$modal.msg("宸插彇娑�");
-    });
-};
-
-// 鍙戣揣绫诲瀷鏍¢獙锛氳揣杞︽椂瑕佹眰杞︾墝锛屽揩閫掓椂瑕佹眰蹇�掑叕鍙�
-const validateShippingCarNumber = (value, callback) => {
-  if (form.value.type === "璐ц溅") {
-    if (!value) return callback(new Error("璇疯緭鍏ュ彂璐ц溅鐗屽彿"));
-  }
-  callback();
-};
-const validateExpressCompany = (value, callback) => {
-  if (form.value.type === "蹇��") {
-    if (!value) return callback(new Error("璇疯緭鍏ュ揩閫掑叕鍙�"));
-  }
-  callback();
-};
-
-// 鍙戣揣鍥剧墖涓婁紶鍓嶆牎妫�
-function handleDeliveryBeforeUpload(file) {
-  // 鏍℃鏂囦欢绫诲瀷
-  const isImage = file.type === 'image/png' || file.type === 'image/jpeg' || file.type === 'image/jpg';
-  if (!isImage) {
-    proxy.$modal.msgError("鍙兘涓婁紶 jpg銆乯peg銆乸ng 鏍煎紡鐨勫浘鐗�!");
-    return false;
-  }
-  // 鏍℃鏂囦欢澶у皬
-  const isLt10M = file.size / 1024 / 1024 < 10;
-  if (!isLt10M) {
-    proxy.$modal.msgError("涓婁紶鍥剧墖澶у皬涓嶈兘瓒呰繃 10MB!");
-    return false;
-  }
-  proxy.$modal.loading("姝e湪涓婁紶鍥剧墖锛岃绋嶅��...");
-  return true;
-}
-// 鍙戣揣鍥剧墖涓婁紶澶辫触
-function handleDeliveryUploadError(err) {
-  proxy.$modal.msgError("涓婁紶鍥剧墖澶辫触");
-  proxy.$modal.closeLoading();
-}
-// 鍙戣揣鍥剧墖涓婁紶鎴愬姛鍥炶皟
-function handleDeliveryUploadSuccess(res, file, uploadFiles) {
-  proxy.$modal.closeLoading();
-  if (res.code === 200) {
-    file.tempId = res.data.tempId;
-    proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
-  } else {
-    proxy.$modal.msgError(res.msg);
-    proxy.$refs.deliveryFileUpload.handleRemove(file);
-  }
-}
-// 绉婚櫎鍙戣揣鍥剧墖
-function handleDeliveryRemove(file) {
-  console.log('file--', file)
-  // 濡傛灉鏄紪杈戞ā寮忎笖鏂囦欢鏈� id锛岄渶瑕佽皟鐢ㄦ帴鍙e垹闄�
-  if (operationType.value === "edit") {
-    let ids = [];
-    ids.push(file.uid);
-    delLedgerFile(ids).then((res) => {
       proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      // 浠庢枃浠跺垪琛ㄤ腑绉婚櫎
-      const index = deliveryFileList.value.findIndex(item => item.uid === file.uid);
-      if (index > -1) {
-        deliveryFileList.value.splice(index, 1);
-      }
-    }).catch(() => {
-      proxy.$modal.msgError("鍒犻櫎澶辫触");
-    });
-  } else {
-    // 鏂板妯″紡鎴栨病鏈� id 鐨勬枃浠讹紝鐩存帴浠庡垪琛ㄤ腑绉婚櫎
-    const index = deliveryFileList.value.findIndex(item => item.uid === file.uid);
-    if (index > -1) {
-      deliveryFileList.value.splice(index, 1);
-    }
-  }
-}
-
-// 鍙戣揣绫诲瀷鍒囨崲鏃舵竻绌哄搴斿瓧娈�
-const handleShippingTypeChange = (val) => {
-  if (val === "璐ц溅") {
-    form.value.expressCompany = "";
-    form.value.expressNumber = "";
-  } else {
-    form.value.shippingCarNumber = "";
-  }
+      getList();
+    })
+    .catch(() => {});
 };
 
-// 鑾峰彇瀹℃牳鐘舵�佹枃鏈�
-const getApprovalStatusText = (status) => {
-  if (status === null || status === undefined || status === '') {
-    return '寰呭鏍�';
-  }
-  // 濡傛灉鏄暟瀛�
-  if (typeof status === 'number') {
-    const statusMap = {
-      0: '寰呭鏍�',
-      1: '瀹℃牳涓�',
-      2: '瀹℃牳鎷掔粷',
-      3: '瀹℃牳閫氳繃'
-    };
-    return statusMap[status] || '寰呭鏍�';
-  }
-  // 濡傛灉鏄瓧绗︿覆锛岀洿鎺ヨ繑鍥炴垨鏄犲皠
-  const statusStr = String(status).trim();
-  const statusTextMap = {
-    '寰呭鏍�': '寰呭鏍�',
-    '瀹℃牳涓�': '瀹℃牳涓�',
-    '瀹℃牳鎷掔粷': '瀹℃牳鎷掔粷',
-    '瀹℃牳閫氳繃': '瀹℃牳閫氳繃',
-    '宸插彂璐�': '宸插彂璐�',
-    '0': '寰呭鏍�',
-    '1': '瀹℃牳涓�',
-    '2': '瀹℃牳鎷掔粷',
-    '3': '瀹℃牳閫氳繃'
-  };
-  return statusTextMap[statusStr] || statusStr || '寰呭鏍�';
+const openImportDialog = () => {
+  importUpload.open = true;
+  importUploadRef.value?.clearFiles();
 };
 
-// 鑾峰彇瀹℃牳鐘舵�佹爣绛剧被鍨嬶紙棰滆壊锛�
-const getApprovalStatusType = (status) => {
-  if (status === null || status === undefined || status === '') {
-    return 'info';
-  }
-  // 濡傛灉鏄暟瀛�
-  if (typeof status === 'number') {
-    const typeMap = {
-      0: 'info',      // 寰呭鏍� - 鐏拌壊
-      1: 'warning',   // 瀹℃牳涓� - 榛勮壊
-      2: 'danger',    // 瀹℃牳鎷掔粷 - 绾㈣壊
-      3: 'success'    // 瀹℃牳閫氳繃 - 缁胯壊
-    };
-    return typeMap[status] || 'info';
-  }
-  // 濡傛灉鏄瓧绗︿覆
-  const statusStr = String(status).trim();
-  const typeTextMap = {
-    '寰呭鏍�': 'info',
-    '瀹℃牳涓�': 'warning',
-    '瀹℃牳鎷掔粷': 'danger',
-    '瀹℃牳閫氳繃': 'success',
-    '宸插彂璐�': 'success',
-    '0': 'info',
-    '1': 'warning',
-    '2': 'danger',
-    '3': 'success'
-  };
-  return typeTextMap[statusStr] || 'info';
-};
-
-// 妫�鏌ュ鏍哥姸鎬佹槸鍚︿负"瀹℃牳閫氳繃"
-const isApproved = (status) => {
-  if (status === null || status === undefined || status === '') {
-    return false;
-  }
-  // 濡傛灉鏄暟瀛楋紝3 琛ㄧず瀹℃牳閫氳繃
-  if (typeof status === 'number') {
-    return status === 3;
-  }
-  // 濡傛灉鏄瓧绗︿覆
-  const statusStr = String(status).trim();
-  return statusStr === '瀹℃牳閫氳繃' || statusStr === '3';
-};
-
-// 妫�鏌ュ鏍哥姸鎬佹槸鍚︿负"瀹℃牳涓�"
-const isApproving = (status) => {
-  if (status === null || status === undefined || status === '') {
-    return false;
-  }
-  // 濡傛灉鏄暟瀛楋紝1 琛ㄧず瀹℃牳涓�
-  if (typeof status === 'number') {
-    return status === 1;
-  }
-  // 濡傛灉鏄瓧绗︿覆
-  const statusStr = String(status).trim();
-  return statusStr === '瀹℃牳涓�' || statusStr === '1';
+const submitImport = () => {
+  if (!importUploadRef.value) return;
+  importUpload.isUploading = true;
+  importUploadRef.value.submit();
 };
 
 onMounted(() => {
@@ -719,35 +222,6 @@
   display: flex;
   justify-content: space-between;
   margin-bottom: 10px;
-}
-
-// 闅愯棌鍥剧墖涓婁紶缁勪欢鐨勯瑙堟寜閽紙鏀惧ぇ闀滐級
-:deep(.el-upload-list--picture-card .el-upload-list__item-actions) {
-  .el-upload-list__item-preview {
-    display: none;
-  }
-}
-.detail-wrapper {
-  padding: 8px 0;
-}
-.detail-images {
-  margin-top: 16px;
-}
-.detail-images-title {
-  font-weight: 600;
-  margin-bottom: 10px;
-  color: #303133;
-}
-.detail-image {
-  width: 120px;
-  height: 120px;
-  margin-right: 10px;
-  margin-bottom: 10px;
-  border-radius: 6px;
-}
-.detail-images-empty {
-  margin-top: 16px;
-  color: #909399;
 }
 </style>
 

--
Gitblit v1.9.3