zouyu
8 天以前 e03ff28fb1dbaa19571b7ea0414e0161f178cf26
src/views/inventoryManagement/stockWarningLedger/index.vue
@@ -18,18 +18,6 @@
            style="width: 200px"
          />
        </el-form-item>
        <el-form-item label="预警级别:">
          <el-select
            v-model="searchForm.warningLevel"
            placeholder="请选择预警级别"
            clearable
            style="width: 150px"
          >
            <el-option label="紧急" value="紧急" />
            <el-option label="重要" value="重要" />
            <el-option label="一般" value="一般" />
          </el-select>
        </el-form-item>
        <el-form-item label="预警状态:">
          <el-select
            v-model="searchForm.warningStatus"
@@ -134,7 +122,6 @@
const searchForm = reactive({
  productCategory: '',
  specificationModel: '',
  warningLevel: '',
  warningStatus: ''
})
@@ -151,13 +138,13 @@
      if (res.code === 200) {
        tableData.value = res.data.records || []
        total.value = res.data.total || 0
        // 计算预警级别和状态
        tableData.value = tableData.value.map(item => {
          const currentStock = parseFloat(item.inboundNum0 || item.currentStock || 0)
          const warnNum = parseFloat(item.warnNum || 0)
          const safetyStock = parseFloat(item.safetyStock || warnNum * 1.2)
          // 计算预警级别
          if (currentStock <= 0) {
            item.warningLevel = '紧急'
@@ -172,7 +159,7 @@
            item.warningLevel = ''
            item.warningStatus = '正常'
          }
          // 计算预计缺货时间(基于日均消耗量,这里简化处理)
          if (item.warningStatus === '已预警' && currentStock > 0 && warnNum > 0) {
            const dailyConsumption = warnNum / 30 // 假设30天消耗完最低库存
@@ -183,10 +170,10 @@
              item.expectedShortageTime = date.toISOString().split('T')[0]
            }
          }
          item.currentStock = currentStock
          item.safetyStock = safetyStock
          return item
        })
      }
@@ -222,7 +209,7 @@
const getStockClass = (row) => {
  const currentStock = parseFloat(row.currentStock || row.inboundNum0 || 0)
  const warnNum = parseFloat(row.warnNum || 0)
  if (currentStock <= 0) {
    return 'text-danger'
  } else if (currentStock < warnNum) {