zhangwencui
6 天以前 ba79a3ec46100b75675d0a7b5b9bb1b8a0b6e349
src/views/inventoryManagement/stockManagement/index.vue
@@ -102,61 +102,6 @@
         <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
           :page="page.current" :limit="page.size" @pagination="paginationChange" />
       </div>
     </el-tab-pane>
      <el-tab-pane label="材料库存" name="manual">
        <div class="search_form">
          <div>
            <span class="search_title ml10">入库日期:</span>
            <el-date-picker
              v-model="searchForm.timeStr"
              type="date"
              placeholder="请选择日期"
              value-format="YYYY-MM-DD"
              format="YYYY-MM-DD"
              clearable
              @change="handleQuery"
            />
                     <span class="search_title ml10">产品大类:</span>
                     <el-input
                        v-model="searchForm.productCategory"
                        style="width: 240px"
                        placeholder="请输入"
                        clearable
                     />
            <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button>
          </div>
          <div>
            <el-button @click="handleOut">导出</el-button>
<!--            <el-button type="danger" plain @click="handleDelete">删除</el-button>-->
          </div>
        </div>
        <div class="table_list">
          <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange"
            :expand-row-keys="expandedRowKeys" :row-key="row => row.id" show-summary style="width: 100%"
            :row-class-name="tableRowClassName"
            :summary-method="summarizeMainTable" height="calc(100vh - 18.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="inboundDate" width="100" show-overflow-tooltip />
                  <el-table-column label="批次号" prop="code" width="130" show-overflow-tooltip />
            <el-table-column label="产品大类" prop="productCategory" show-overflow-tooltip />
            <el-table-column label="规格型号" prop="specificationModel" show-overflow-tooltip />
            <el-table-column label="单位" prop="unit" width="80" show-overflow-tooltip />
            <el-table-column label="物品类型" prop="itemType" width="120" show-overflow-tooltip />
                     <el-table-column label="已出库数量" prop="totalInboundNum" width="100" show-overflow-tooltip />
                     <el-table-column label="剩余库存" prop="inboundNum0" width="100" show-overflow-tooltip />
                     <el-table-column label="单价(元)" prop="taxInclusiveUnitPrice" width="150"></el-table-column>
                     <el-table-column label="总价(元)" prop="taxInclusiveTotalPrice" width="150"></el-table-column>
            <el-table-column fixed="right" label="操作" width="100" align="center">
              <template #default="scope">
                <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">编辑</el-button>
              </template>
            </el-table-column>
          </el-table>
          <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
            :page="page.current" :limit="page.size" @pagination="paginationChange" />
        </div>
      </el-tab-pane>
    </el-tabs>
    
@@ -177,15 +122,6 @@
      @submit="submitForm"
      @close="closeDia"
    />
    <!-- 材料库存弹框 -->
    <FormDiaManual
      v-model:dialogFormVisible="manualDialogVisible"
      :operationType="operationType"
      :formData="form"
      @submit="submitForm"
      @close="closeDia"
    />
  </div>
</template>
@@ -199,17 +135,15 @@
import {
  getStockManagePage,
  getStockManagePageByProduction,
  getStockManagePageByCustom,
  delStockManage,
} from "@/api/inventoryManagement/stockManage.js";
import {
   updateManagement, updateManagementByCustom, updateStockIn
} from "@/api/inventoryManagement/stockIn.js";
// 导入三个独立的弹框组件
// 导入两个独立的弹框组件
import FormDiaProduction from './components/FormDiaProduction.vue'
import FormDiaPurchase from './components/FormDiaPurchase.vue'
import FormDiaManual from './components/FormDiaManual.vue'
const userStore = useUserStore()
const { proxy } = getCurrentInstance()
@@ -232,17 +166,16 @@
const operationType = ref('')
const activeTab = ref('production')
// 三个独立的弹框显示状态
// 弹框显示状态
const productionDialogVisible = ref(false)
const purchaseDialogVisible = ref(false)
const manualDialogVisible = ref(false)
const data = reactive({
  searchForm: {
    // supplierName: '',
    productCategory:'',
    customerName: '',
    timeStr: getCurrentDate(),
    timeStr: '',
  },
  form: {
    supplierId: null,
@@ -314,14 +247,9 @@
const getList = () => {
  tableLoading.value = true
  const params = buildQueryParams()
  let apiCall
  if (activeTab.value === 'production') {
    apiCall = getStockManagePageByProduction(params)
  } else if (activeTab.value === 'manual') {
    apiCall = getStockManagePageByCustom(params)
  } else {
    apiCall = getStockManagePage(params)
  }
  const apiCall = activeTab.value === 'production'
    ? getStockManagePageByProduction(params)
    : getStockManagePage(params)
  apiCall.then(res => {
    tableLoading.value = false
    tableData.value = res.data.records
@@ -340,10 +268,6 @@
        item.totalPrice = (unitPrice * remainingStock).toFixed(2)
      } else if (activeTab.value === 'purchase') {
        // 原料库存:含税总价 = 含税单价 × 剩余库存
        const taxInclusiveUnitPrice = parseFloat(item.taxInclusiveUnitPrice) || 0
        item.taxInclusiveTotalPrice = (taxInclusiveUnitPrice * remainingStock).toFixed(2)
      } else if (activeTab.value === 'manual') {
        // 材料库存:含税总价 = 含税单价 × 剩余库存
        const taxInclusiveUnitPrice = parseFloat(item.taxInclusiveUnitPrice) || 0
        item.taxInclusiveTotalPrice = (taxInclusiveUnitPrice * remainingStock).toFixed(2)
      }
@@ -421,8 +345,6 @@
    productionDialogVisible.value = true
  } else if (activeTab.value === 'purchase') {
    purchaseDialogVisible.value = true
  } else if (activeTab.value === 'manual') {
    manualDialogVisible.value = true
  }
}
@@ -440,9 +362,6 @@
  } else if (activeTab.value === 'purchase') {
    // 原料库存:移除含税总价字段
    delete submitData.taxInclusiveTotalPrice
  } else if (activeTab.value === 'manual') {
    // 材料库存:移除含税总价字段
    delete submitData.taxInclusiveTotalPrice
  }
  
  // 移除其他可能的总价字段
@@ -455,9 +374,6 @@
  if (activeTab.value === 'production') {
    // 成品库存使用 updateManagement 接口
    apiCall = updateManagement(submitData)
  } else if (activeTab.value === 'manual') {
    // 材料库存使用 updateManagementByCustom 接口
    apiCall = updateManagementByCustom(submitData)
  } else {
    // 原料库存使用 updateManagementByCustom 接口
    apiCall = updateManagementByCustom(submitData)
@@ -501,7 +417,6 @@
  proxy.resetForm("formRef")
  productionDialogVisible.value = false
  purchaseDialogVisible.value = false
  manualDialogVisible.value = false
}
// 导出
@@ -519,8 +434,6 @@
    let exportUrl = "/stockin/exportCopy"
    if (activeTab.value === 'production') {
      exportUrl = "/stockin/exportCopyOne"
    } else if (activeTab.value === 'manual') {
      exportUrl = "/stockin/exportCopyTwo"
    }
    proxy.download(exportUrl, exportParams, '库存信息.xlsx')
  }).catch(() => {