From eca47cecf33c93a7cf711f736f9a4d9be48392f9 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期六, 28 三月 2026 14:41:42 +0800
Subject: [PATCH] feat(enterpriseInfo): 新增企业信息管理页面

---
 src/views/procurementManagement/advancedPriceManagement/index.vue |  429 ++++++++++++++++++++++++++---------------------------
 1 files changed, 213 insertions(+), 216 deletions(-)

diff --git a/src/views/procurementManagement/advancedPriceManagement/index.vue b/src/views/procurementManagement/advancedPriceManagement/index.vue
index 89fbc4b..5af8311 100644
--- a/src/views/procurementManagement/advancedPriceManagement/index.vue
+++ b/src/views/procurementManagement/advancedPriceManagement/index.vue
@@ -8,15 +8,7 @@
         </el-form-item>
         <el-form-item label="渚涘簲鍟嗭細">
           <el-select v-model="searchForm.supplierId" placeholder="璇烽�夋嫨渚涘簲鍟�" clearable style="width: 200px">
-            <el-option v-for="supplier in supplierList" :key="supplier.id" :label="supplier.name" :value="supplier.id" />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="浠锋牸鐘舵�侊細">
-          <el-select v-model="searchForm.priceStatus" placeholder="璇烽�夋嫨鐘舵��" clearable style="width: 150px">
-            <el-option label="鏈夋晥" value="active" />
-            <el-option label="寰呯敓鏁�" value="pending" />
-            <el-option label="宸茶繃鏈�" value="expired" />
-            <el-option label="宸叉殏鍋�" value="suspended" />
+            <el-option v-for="supplier in supplierList" :key="supplier.id" :label="supplier.supplierName" :value="supplier.id" />
           </el-select>
         </el-form-item>
         <el-form-item>
@@ -42,10 +34,6 @@
         <el-button type="success" @click="openBatchDiscountDialog">
           <el-icon><Discount /></el-icon>
           鎵归噺鎶樻墸
-        </el-button>
-        <el-button type="warning" @click="openPriceControlDialog">
-          <el-icon><Setting /></el-icon>
-          浠锋牸鎺у埗
         </el-button>
         <el-button type="info" @click="exportData">
           <el-icon><Download /></el-icon>
@@ -74,14 +62,14 @@
             <div class="product-info">
               <div class="product-name">{{ row.productName }}</div>
               <div class="product-spec">{{ row.specification }}</div>
-              <div class="product-code">缂栫爜: {{ row.productCode }}</div>
+              <!-- <div class="product-code">缂栫爜: {{ row.productCode }}</div> -->
             </div>
           </template>
         </el-table-column>
-        <el-table-column label="渚涘簲鍟�" prop="supplierName" width="150" />
+        <el-table-column label="渚涘簲鍟�" prop="supplierName" width="200" />
         <el-table-column label="鍩虹浠锋牸" width="120" align="right">
           <template #default="{ row }">
-            <span class="price-text">楼{{ row.basePrice.toFixed(2) }}</span>
+            <span class="price-text">楼{{ row.basePrice }}</span>
           </template>
         </el-table-column>
         <el-table-column label="鎶樻墸淇℃伅" width="150">
@@ -97,17 +85,17 @@
         </el-table-column>
         <el-table-column label="瀹為檯浠锋牸" width="120" align="right">
           <template #default="{ row }">
-            <span class="final-price">楼{{ calculateFinalPrice(row).toFixed(2) }}</span>
+            <span class="final-price">楼{{ calculateFinalPrice(row) }}</span>
           </template>
         </el-table-column>
         <el-table-column label="浠锋牸鎺у埗" width="120">
           <template #default="{ row }">
             <div class="price-control">
-              <div v-if="row.priceControl?.minPrice" class="control-item">
-                鏈�浣�: 楼{{ row.priceControl.minPrice.toFixed(2) }}
+              <div v-if="row.minPrice" class="control-item">
+                鏈�浣�: 楼{{ row.minPrice }}
               </div>
-              <div v-if="row.priceControl?.maxPrice" class="control-item">
-                鏈�楂�: 楼{{ row.priceControl.maxPrice.toFixed(2) }}
+              <div v-if="row.maxPrice" class="control-item">
+                鏈�楂�: 楼{{ row.maxPrice }}
               </div>
             </div>
           </template>
@@ -115,9 +103,9 @@
         <el-table-column label="鐘舵��" width="100" align="center">
           <template #default="{ row }">
             <el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag>
-            <div v-if="isPriceWarning(row)" class="warning-indicator">
+            <!-- <div v-if="isPriceWarning(row)" class="warning-indicator">
               <el-icon color="#F56C6C"><Warning /></el-icon>
-            </div>
+            </div> -->
           </template>
         </el-table-column>
         <el-table-column label="鐢熸晥鏃堕棿" prop="effectiveTime" width="180" />
@@ -127,10 +115,6 @@
             <el-button type="primary" link @click="openDialog('edit', row)">
               <el-icon><Edit /></el-icon>
               缂栬緫
-            </el-button>
-            <el-button type="success" link @click="openDiscountDialog(row)">
-              <el-icon><Discount /></el-icon>
-              鎶樻墸
             </el-button>
             <el-button type="danger" link @click="handleDelete(row)">
               <el-icon><Delete /></el-icon>
@@ -143,10 +127,10 @@
       <!-- 鍒嗛〉 -->
       <div class="pagination-wrapper">
         <el-pagination
-          v-model:current-page="pagination.currentPage"
-          v-model:page-size="pagination.pageSize"
+          v-model:current-page="pagination.current"
+          v-model:page-size="pagination.size"
           :page-sizes="[10, 20, 50, 100]"
-          :total="pagination.total"
+          :total="total"
           layout="total, sizes, prev, pager, next, jumper"
           @size-change="handleSizeChange"
           @current-change="handleCurrentChange"
@@ -159,10 +143,20 @@
       <el-form :model="formData" :rules="formRules" ref="formRef" label-width="120px">
         <el-row :gutter="20">
           <el-col :span="12">
-            <el-form-item label="鍟嗗搧鍚嶇О" prop="productName">
-              <el-select v-model="formData.productName" placeholder="璇烽�夋嫨鍟嗗搧" style="width: 100%" filterable>
-                <el-option v-for="product in productList" :key="product.id" :label="product.name" :value="product.name" />
-              </el-select>
+            <el-form-item label="鍟嗗搧鍚嶇О" prop="productId">
+              <el-tree-select
+                v-model="formData.productId"
+                placeholder="璇烽�夋嫨鍟嗗搧"
+                clearable
+                filterable
+                check-strictly
+                @change="getModels"
+                :data="productOptions"
+                :props="{ label: 'productName', value: 'id', children: 'children' }"
+                node-key="id"
+                :render-after-expand="false"
+                style="width: 100%"
+              />
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -174,13 +168,35 @@
         <el-row :gutter="20">
           <el-col :span="12">
             <el-form-item label="瑙勬牸鍨嬪彿" prop="specification">
-              <el-input v-model="formData.specification" placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�" />
+              <el-select
+                v-model="formData.specification"
+                placeholder="璇烽�夋嫨"
+                clearable
+                @change="getProductModel"
+              >
+                <el-option
+                  v-for="item in modelOptions"
+                  :key="item.id"
+                  :label="item.model"
+                  :value="item.id"
+                />
+              </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="渚涘簲鍟�" prop="supplierName">
-              <el-select v-model="formData.supplierName" placeholder="璇烽�夋嫨渚涘簲鍟�" style="width: 100%">
-                <el-option v-for="supplier in supplierList" :key="supplier.id" :label="supplier.name" :value="supplier.name" />
+            <el-form-item label="渚涘簲鍟�" prop="supplierId">
+              <el-select
+                v-model="formData.supplierId"
+                placeholder="璇烽�夋嫨渚涘簲鍟�"
+                clearable
+                @change="handleSupplierChange"
+              >
+                <el-option
+                  v-for="item in supplierList"
+                  :key="item.id"
+                  :label="item.supplierName"
+                  :value="item.id"
+                />
               </el-select>
             </el-form-item>
           </el-col>
@@ -201,20 +217,20 @@
         <!-- 鎶樻墸璁剧疆 -->
         <el-divider content-position="left">鎶樻墸璁剧疆</el-divider>
         <el-row :gutter="20">
-          <el-col :span="8">
+          <el-col :span="12">
             <el-form-item label="鎶樻墸绫诲瀷">
               <el-select v-model="formData.discountType" placeholder="璇烽�夋嫨鎶樻墸绫诲瀷" style="width: 100%">
                 <el-option label="鏃犳姌鎵�" value="" />
                 <el-option label="鐧惧垎姣旀姌鎵�" value="percentage" />
                 <el-option label="鍥哄畾閲戦" value="fixed" />
-                <el-option label="闃舵鎶樻墸" value="tiered" />
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="8">
-            <el-form-item label="鎶樻墸鍊�" v-if="formData.discountType && formData.discountType !== 'tiered'">
+          <el-col :span="12">
+            <el-form-item label="鎶樻墸鍊�">
               <el-input-number 
                 v-model="formData.discountValue" 
+                :disabled="!(formData.discountType && formData.discountType !== 'tiered')"
                 :min="0" 
                 :max="formData.discountType === 'percentage' ? 100 : undefined"
                 :precision="2" 
@@ -223,10 +239,11 @@
               />
             </el-form-item>
           </el-col>
-          <el-col :span="8">
+          <el-col :span="12">
             <el-form-item label="鎶樻墸鏈夋晥鏈�">
               <el-date-picker 
                 v-model="formData.discountEndTime" 
+                :disabled="!(formData.discountType && formData.discountType !== 'tiered')"
                 type="datetime" 
                 placeholder="閫夋嫨缁撴潫鏃堕棿" 
                 style="width: 100%" 
@@ -235,51 +252,17 @@
           </el-col>
         </el-row>
 
-        <!-- 闃舵鎶樻墸璁剧疆 -->
-        <div v-if="formData.discountType === 'tiered'">
-          <el-form-item label="闃舵鎶樻墸">
-            <el-table :data="formData.tieredDiscount" border size="small">
-              <el-table-column label="鏈�灏忔暟閲�" width="120">
-                <template #default="{ row, $index }">
-                  <el-input-number v-model="row.minQty" :min="0" size="small" />
-                </template>
-              </el-table-column>
-              <el-table-column label="鏈�澶ф暟閲�" width="120">
-                <template #default="{ row, $index }">
-                  <el-input-number v-model="row.maxQty" :min="0" size="small" />
-                </template>
-              </el-table-column>
-              <el-table-column label="鎶樻墸鐜�(%)" width="120">
-                <template #default="{ row, $index }">
-                  <el-input-number v-model="row.discount" :min="0" :max="100" :precision="2" size="small" />
-                </template>
-              </el-table-column>
-              <el-table-column label="鎿嶄綔" width="80">
-                <template #default="{ row, $index }">
-                  <el-button type="danger" link @click="removeTieredRow($index)">鍒犻櫎</el-button>
-                </template>
-              </el-table-column>
-            </el-table>
-            <el-button type="primary" link @click="addTieredRow" class="mt-2">娣诲姞闃舵</el-button>
-          </el-form-item>
-        </div>
-
         <!-- 浠锋牸鎺у埗 -->
         <el-divider content-position="left">浠锋牸鎺у埗</el-divider>
         <el-row :gutter="20">
-          <el-col :span="8">
+          <el-col :span="12">
             <el-form-item label="鏈�浣庝环鏍�">
               <el-input-number v-model="formData.minPrice" :min="0" :precision="2" placeholder="鏈�浣庝环鏍�" style="width: 100%" />
             </el-form-item>
           </el-col>
-          <el-col :span="8">
+          <el-col :span="12">
             <el-form-item label="鏈�楂樹环鏍�">
               <el-input-number v-model="formData.maxPrice" :min="0" :precision="2" placeholder="鏈�楂樹环鏍�" style="width: 100%" />
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="棰勮闃堝��(%)">
-              <el-input-number v-model="formData.warningThreshold" :min="0" :max="100" :precision="1" placeholder="棰勮闃堝��" style="width: 100%" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -378,13 +361,16 @@
 </template>
 
 <script setup>
-import { ref, reactive, computed, onMounted } from 'vue'
+import {ref, reactive, computed, onMounted, getCurrentInstance} from 'vue'
 import { ElMessage, ElMessageBox } from 'element-plus'
+import { productTreeList, modelList } from "@/api/basicData/product.js";
 import {
   Search, Refresh, Plus, Discount, Setting, Download, Delete, Edit, 
-  Warning
 } from '@element-plus/icons-vue'
-
+import { listPage, update, del, add } from '@/api/procurementManagement/advancedPriceManagement'
+import {
+  getOptions,
+} from "@/api/procurementManagement/procurementLedger.js";
 // 鍝嶅簲寮忔暟鎹�
 const loading = ref(false)
 const submitLoading = ref(false)
@@ -392,30 +378,35 @@
 const batchDiscountVisible = ref(false)
 const priceControlVisible = ref(false)
 const dialogType = ref('add')
+const productOptions = ref([]);
+const modelOptions = ref([]);
 const selectedRows = ref([])
 const formRef = ref()
 
 // 鎼滅储琛ㄥ崟
 const searchForm = reactive({
   productName: '',
-  supplierId: '',
-  priceStatus: ''
+  supplierId: ''
 })
+
+const total = ref(0)
 
 // 鍒嗛〉
 const pagination = reactive({
-  currentPage: 1,
-  pageSize: 20,
-  total: 0
+  current: 1,
+  size: 10
 })
 
 
 // 琛ㄥ崟鏁版嵁
 const formData = reactive({
+  productId: null,
   productName: '',
   productCode: '',
   specification: '',
+  supplierId: null,
   supplierName: '',
+  specificationId: null,
   basePrice: 0,
   unit: '',
   discountType: '',
@@ -430,6 +421,8 @@
   reason: '',
   remark: ''
 })
+
+const tableData = ref([])
 
 // 鎵归噺鎶樻墸琛ㄥ崟
 const batchDiscountForm = reactive({
@@ -448,75 +441,21 @@
 
 // 琛ㄥ崟楠岃瘉瑙勫垯
 const formRules = {
-  productName: [{ required: true, message: '璇烽�夋嫨鍟嗗搧鍚嶇О', trigger: 'change' }],
+  productId: [{ required: true, message: '璇烽�夋嫨鍟嗗搧鍚嶇О', trigger: 'change' }],
   productCode: [{ required: true, message: '璇疯緭鍏ュ晢鍝佺紪鐮�', trigger: 'blur' }],
-  supplierName: [{ required: true, message: '璇烽�夋嫨渚涘簲鍟�', trigger: 'change' }],
+  supplierId: [{ required: true, message: '璇烽�夋嫨渚涘簲鍟�', trigger: 'change' }],
   basePrice: [{ required: true, message: '璇疯緭鍏ュ熀纭�浠锋牸', trigger: 'blur' }],
   effectiveTime: [{ required: true, message: '璇烽�夋嫨鐢熸晥鏃堕棿', trigger: 'change' }],
   reason: [{ required: true, message: '璇烽�夋嫨璋冧环鍘熷洜', trigger: 'change' }]
 }
 
-// 妯℃嫙鏁版嵁
-const tableData = ref([
-  {
-    id: 1,
-    productName: '楂樺己搴﹁灪鏍�',
-    productCode: 'HQ001',
-    specification: 'M12脳80',
-    supplierName: '浼樿川浜旈噾渚涘簲鍟�',
-    basePrice: 2.50,
-    discountType: 'percentage',
-    discountValue: 10,
-    priceControl: { minPrice: 2.00, maxPrice: 3.00 },
-    status: 'active',
-    effectiveTime: '2025-01-01 00:00:00',
-    updateTime: '2025-09-17 10:30:00',
-    unit: '涓�',
-    reason: 'market',
-    remark: '甯傚満浠锋牸璋冩暣'
-  },
-  {
-    id: 2,
-    productName: '涓嶉攬閽㈢',
-    productCode: 'BXG002',
-    specification: '桅25脳2.0',
-    supplierName: '閽㈡潗璐告槗鍏徃',
-    basePrice: 45.80,
-    discountType: 'fixed',
-    discountValue: 5,
-    priceControl: { minPrice: 40.00, maxPrice: 50.00 },
-    status: 'pending',
-    effectiveTime: '2025-10-01 00:00:00',
-    updateTime: '2025-09-16 14:20:00',
-    unit: '绫�',
-    reason: 'cost',
-    remark: '鍘熸潗鏂欐垚鏈笂娑�'
-  }
-])
+getOptions().then((res) => {
+    supplierList.value = res.data;
+  });
 
 const supplierList = ref([
-  { id: 1, name: '浼樿川浜旈噾渚涘簲鍟�' },
-  { id: 2, name: '閽㈡潗璐告槗鍏徃' },
-  { id: 3, name: '寤烘潗鎵瑰彂鍟�' }
 ])
 
-const productList = ref([
-  { id: 1, name: '楂樺己搴﹁灪鏍�' },
-  { id: 2, name: '涓嶉攬閽㈢' },
-  { id: 3, name: '閾濆悎閲戝瀷鏉�' }
-])
-
-
-// 璁$畻灞炴��
-const finalTableData = computed(() => {
-  return tableData.value.filter(item => {
-    if (searchForm.productName && !item.productName.includes(searchForm.productName)) return false
-    if (searchForm.supplierId && item.supplierId !== searchForm.supplierId) return false
-    if (searchForm.priceStatus && item.status !== searchForm.priceStatus) return false
-    
-    return true
-  })
-})
 
 // 鏂规硶
 const calculateFinalPrice = (row) => {
@@ -526,7 +465,8 @@
   } else if (row.discountType === 'fixed') {
     finalPrice = row.basePrice - row.discountValue
   }
-  return Math.max(finalPrice, 0)
+  let man = Math.max(finalPrice, 0)
+  return man.toFixed(2)
 }
 
 const getDiscountTagType = (discountType) => {
@@ -541,52 +481,98 @@
 const getDiscountText = (discountType) => {
   const textMap = {
     percentage: '鐧惧垎姣�',
-    fixed: '鍥哄畾閲戦',
-    tiered: '闃舵鎶樻墸'
+    fixed: '鍥哄畾閲戦'
   }
   return textMap[discountType] || '鏈煡'
 }
+
+const getProductOptions = () => {
+  productTreeList().then((res) => {
+    productOptions.value = res;
+  });
+};
+
+const findNodeById = (data, id) => {
+  for (const item of data) {
+    if (item.id === id) return item;
+    if (item.children) {
+      const found = findNodeById(item.children, id);
+      if (found) return found;
+    }
+  }
+  return null;
+};
+
+const getModels = (value) => {
+  if (value) {
+    const selectedProduct = findNodeById(productOptions.value, value);
+    if (selectedProduct) {
+      formData.productName = selectedProduct.productName;
+      formData.productCode = selectedProduct.productCode;
+    }
+    modelList({ id: value }).then((res) => {
+      modelOptions.value = res;
+    });
+  } else {
+    formData.productName = "";
+    formData.productCode = "";
+    modelOptions.value = [];
+  }
+};
 
 const getStatusType = (status) => {
   const statusMap = {
     active: 'success',
     pending: 'warning',
-    expired: 'info',
-    suspended: 'danger'
+    expired: 'info'
   }
   return statusMap[status] || 'info'
+}
+
+const getProductModel = (value) => {
+  const index = modelOptions.value.findIndex((item) => item.id === value);
+  if (index !== -1) {
+    formData.specification = modelOptions.value[index].model;
+    formData.specificationId = modelOptions.value[index].id;
+    formData.unit = modelOptions.value[index].unit;
+  } else {
+    formData.specification = null;
+    formData.specificationId = null;
+    formData.unit = null;
+  }
+};
+
+const handleSupplierChange = (value) => {
+  const supplier = supplierList.value.find(supplier => supplier.id === value)
+  if (supplier) {
+      formData.supplierId = supplier.id
+      formData.supplierName = supplier.supplierName
+  }
 }
 
 const getStatusText = (status) => {
   const statusMap = {
     active: '鏈夋晥',
     pending: '寰呯敓鏁�',
-    expired: '宸茶繃鏈�',
-    suspended: '宸叉殏鍋�'
+    expired: '宸茶繃鏈�'
   }
   return statusMap[status] || '鏈煡'
 }
 
-const isPriceWarning = (row) => {
-  if (!row.priceControl) return false
-  const finalPrice = calculateFinalPrice(row)
-  return finalPrice < row.priceControl.minPrice || finalPrice > row.priceControl.maxPrice
-}
-
-
 const handleSearch = () => {
   loading.value = true
   // 妯℃嫙API璋冪敤
-  setTimeout(() => {
+  listPage({ ...searchForm, ...pagination}).then(res => {
+    tableData.value = res.data.records
+    total.value = res.data.total
     loading.value = false
-  }, 500)
+  })
 }
 
 const resetSearch = () => {
   Object.assign(searchForm, {
     productName: '',
-    supplierId: '',
-    priceStatus: ''
+    supplierId: ''
   })
   handleSearch()
 }
@@ -595,10 +581,14 @@
 const openDialog = (type, row = {}) => {
   dialogType.value = type
   if (type === 'edit' && row.id) {
+    // 澶嶅埗琛屾暟鎹埌琛ㄥ崟
     Object.assign(formData, {
       ...row,
-      minPrice: row.priceControl?.minPrice,
-      maxPrice: row.priceControl?.maxPrice,
+      // 鍏煎涓ょ鏁版嵁缁撴瀯锛氬钩閾虹殑瀛楁鎴栧祵濂楀湪 priceControl 涓殑瀛楁
+      minPrice: row.minPrice ?? row.priceControl?.minPrice,
+      maxPrice: row.maxPrice ?? row.priceControl?.maxPrice,
+      // 纭繚鎶樻墸鏈夋晥鏈熶篃琚祴鍊� (濡傛灉 row.discountEndTime 瀛樺湪鐨勮瘽)
+      discountEndTime: row.discountEndTime || row.discountEndTime,
       tieredDiscount: row.tieredDiscount || []
     })
   } else {
@@ -609,9 +599,11 @@
 
 const resetFormData = () => {
   Object.assign(formData, {
+    productId: null,
     productName: '',
     productCode: '',
     specification: '',
+    supplierId: null,
     supplierName: '',
     basePrice: 0,
     unit: '',
@@ -637,42 +629,38 @@
   })
 }
 
-const removeTieredRow = (index) => {
-  formData.tieredDiscount.splice(index, 1)
-}
-
 const handleSubmit = async () => {
   if (!formRef.value) return
+    formData.actualPrice = calculateFinalPrice(formData)
+    if( formData.discountType === ''){
+      formData.discountEndTime = '2099-12-31 23:59:59'
+    }
   
   try {
     await formRef.value.validate()
     submitLoading.value = true
-    
-    // 妯℃嫙API璋冪敤
-    setTimeout(() => {
-      if (dialogType.value === 'add') {
-        const newItem = {
-          id: Date.now(),
-          ...formData,
-          priceControl: {
-            minPrice: formData.minPrice,
-            maxPrice: formData.maxPrice
-          },
-          status: 'pending',
-          updateTime: new Date().toLocaleString()
+
+    if (dialogType.value === 'add') {
+      add(formData).then(res => {
+        if (res.code === 200){
+          ElMessage.success('鏂板鎴愬姛')
+          handleSearch()
         }
-        tableData.value.unshift(newItem)
-        ElMessage.success('鏂板鎴愬姛')
-      } else {
-        // 缂栬緫閫昏緫
-        ElMessage.success('缂栬緫鎴愬姛')
-      }
-      
-      dialogVisible.value = false
-      submitLoading.value = false
-    }, 1000)
+      })
+    } else {
+      update(formData).then(res => {
+        if (res.code === 200){
+          ElMessage.success('缂栬緫鎴愬姛')
+          handleSearch()
+        }
+      })
+    }
+
   } catch (error) {
     console.error('琛ㄥ崟楠岃瘉澶辫触:', error)
+  }finally {
+    dialogVisible.value = false
+    submitLoading.value = false
   }
 }
 
@@ -689,10 +677,13 @@
   selectedRows.value.forEach(row => {
     row.discountType = batchDiscountForm.discountType
     row.discountValue = batchDiscountForm.discountValue
+    update(row).then(res => {
+      handleSearch()
+    })
   })
-  
-  ElMessage.success(`宸蹭负 ${selectedRows.value.length} 涓晢鍝佽缃姌鎵)
+  ElMessage.success('鎶樻墸璁剧疆鎴愬姛')
   batchDiscountVisible.value = false
+
 }
 
 const openPriceControlDialog = () => {
@@ -704,23 +695,19 @@
   priceControlVisible.value = false
 }
 
-const openDiscountDialog = (row) => {
-  // 鍗曚釜鍟嗗搧鎶樻墸璁剧疆
-  openDialog('edit', row)
-}
-
-
 const handleDelete = (row) => {
   ElMessageBox.confirm('纭畾瑕佸垹闄よ繖鏉¤褰曞悧锛�', '鎻愮ず', {
     confirmButtonText: '纭畾',
     cancelButtonText: '鍙栨秷',
     type: 'warning'
   }).then(() => {
-    const index = tableData.value.findIndex(item => item.id === row.id)
-    if (index !== -1) {
-      tableData.value.splice(index, 1)
-      ElMessage.success('鍒犻櫎鎴愬姛')
-    }
+   let ids = [row.id]
+    del(ids).then(res => {
+      if(res.code === 200){
+        ElMessage.success('鍒犻櫎鎴愬姛')
+        handleSearch()
+      }
+    })
   })
 }
 
@@ -735,14 +722,12 @@
     cancelButtonText: '鍙栨秷',
     type: 'warning'
   }).then(() => {
-    selectedRows.value.forEach(row => {
-      const index = tableData.value.findIndex(item => item.id === row.id)
-      if (index !== -1) {
-        tableData.value.splice(index, 1)
+     del(selectedRows.value.map(item => item.id)).then(i =>{
+       if(i.code === 200){
+        ElMessage.success('鍒犻櫎鎴愬姛')
+        handleSearch()
       }
-    })
-    ElMessage.success('鎵归噺鍒犻櫎鎴愬姛')
-    selectedRows.value = []
+     })
   })
 }
 
@@ -751,22 +736,34 @@
 }
 
 const handleSizeChange = (size) => {
-  pagination.pageSize = size
+  pagination.size = size
   handleSearch()
 }
 
 const handleCurrentChange = (page) => {
-  pagination.currentPage = page
+  pagination.current = page
   handleSearch()
 }
+const { proxy } = getCurrentInstance();
 
 const exportData = () => {
-  ElMessage.success('鏁版嵁瀵煎嚭鍔熻兘寮�鍙戜腑...')
+  ElMessageBox.confirm("鍐呭灏嗚瀵煎嚭锛屾槸鍚︾‘璁ゅ鍑猴紵", "瀵煎嚭", {
+    confirmButtonText: "纭",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  })
+      .then(() => {
+        proxy.download("/procurementPriceManagement/export", {}, "閲囪喘浠锋牸绠$悊.xlsx");
+      })
+      .catch(() => {
+        proxy.$modal.msg("宸插彇娑�");
+      });
 }
 
 // 鐢熷懡鍛ㄦ湡
 onMounted(() => {
   handleSearch()
+  getProductOptions()
 })
 </script>
 

--
Gitblit v1.9.3