fix: 仓储物流展示除耗材外的数据,耗材物料展示耗材的数据。两边菜单数据需要区分开来。
已修改4个文件
41 ■■■■■ 文件已修改
src/pages/consumablesLogistics/stockManagement/add.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/consumablesLogistics/stockManagement/subtract.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/inventoryManagement/stockManagement/add.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/inventoryManagement/stockManagement/subtract.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/consumablesLogistics/stockManagement/add.vue
@@ -74,7 +74,7 @@
          <text class="popup-title">选择产品</text>
        </view>
        <view class="popup-search">
          <up-input v-model="productQuery.productName" placeholder="产品大类" clearable />
          <up-input v-model="productQuery.productName" placeholder="产品大类" disabled />
          <up-input v-model="productQuery.model" placeholder="型号名称" clearable />
          <view class="popup-search-btn" @click="loadProductList">搜索</view>
        </view>
@@ -138,7 +138,7 @@
const showProductPopup = ref(false);
const productQuery = reactive({
  productName: "",
  productName: "耗材",
  model: "",
});
const productList = ref([]);
src/pages/consumablesLogistics/stockManagement/subtract.vue
@@ -164,6 +164,18 @@
    uni.showToast({ title: `请输入 1~${stockRecord.unLockedQuantity} 之间的数量`, icon: "none" });
    return;
  }
  const net = Number(form.netWeight);
  if (!isNaN(net) && net > 0) {
    const max = Number(stockRecord.unLockedQuantity) || 0;
    if (max > 0 && net > max) {
      uni.showToast({ title: `净重不能大于可用库存 ${max}`, icon: "none" });
      return;
    }
    if (net > outNum) {
      uni.showToast({ title: `净重不能大于出库数量 ${outNum}`, icon: "none" });
      return;
    }
  }
  const api = isQualified.value ? subtractConsumablesIn : subtractConsumablesUnInventory;
  api({
    id: stockRecord.id,
src/pages/inventoryManagement/stockManagement/add.vue
@@ -202,7 +202,12 @@
  })
    .then(res => {
      const data = res?.records || res?.data?.records || []
      productList.value = Array.isArray(data) ? data : []
      const list = Array.isArray(data) ? data : []
      // 过滤耗材:耗材不允许在“产品库存”入库
      productList.value = list.filter(item => {
        const parentName = item?.parentName || item?.parent?.name || ''
        return parentName !== '耗材'
      })
    })
    .finally(() => {
      productLoading.value = false
@@ -210,6 +215,11 @@
}
const selectProduct = (item) => {
  const parentName = item?.parentName || item?.parent?.name || ''
  if (parentName === '耗材') {
    uni.showToast({ title: '耗材请到耗材库存入库', icon: 'none' })
    return
  }
  form.productId = item.productId || item.id
  form.productModelId = item.id
  form.productName = item.productName
src/pages/inventoryManagement/stockManagement/subtract.vue
@@ -87,7 +87,7 @@
</template>
<script setup>
import { ref, reactive, watch } from 'vue'
import { ref, reactive, watch, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import dayjs from 'dayjs'
import PageHeader from '@/components/PageHeader.vue'
@@ -127,6 +127,12 @@
const type = ref('0') // 0 合格库存,1 不合格库存
const showWeighingDatePicker = ref(false)
const weighingDateValue = ref(Date.now())
const maxAllowedNetWeight = computed(() => {
  const v = form.unLockedQuantity ?? form.qualitity
  const n = Number(v)
  return !isNaN(n) ? n : 0
})
onLoad((options) => {
  if (options && options.type != null) {
@@ -183,6 +189,11 @@
    uni.showToast({ title: '记录信息缺失,无法出库', icon: 'none' })
    return
  }
  const net = Number(form.netWeight)
  if (!isNaN(net) && net > 0 && maxAllowedNetWeight.value > 0 && net > maxAllowedNetWeight.value) {
    uni.showToast({ title: `净重不能大于可用库存 ${maxAllowedNetWeight.value}`, icon: 'none' })
    return
  }
  const payload = { ...form }
  const api = type.value === '0' ? subtractStockInventory : subtractStockUnInventory
  api(payload)