gaoluyang
19 小时以前 c49a9d727dd7620c3a9cb67c512b29bab842b1eb
src/views/inventoryManagement/receiptManagement/index.vue
@@ -5,6 +5,16 @@
        <span class="search_title">供应商名称:</span>
        <el-input v-model="searchForm.supplierName" style="width: 240px" placeholder="请输入" @change="handleQuery"
          clearable prefix-icon="Search" />
        <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"
            />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button>
      </div>
      <div>
@@ -19,11 +29,11 @@
        :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="createDate" width="100" show-overflow-tooltip />
        <el-table-column label="入库时间" prop="createTime" width="100" show-overflow-tooltip />
        <el-table-column label="入库批次" prop="inboundBatches" width="160" show-overflow-tooltip />
        <el-table-column label="供应商名称" prop="supplierName" width="160" show-overflow-tooltip />
        <el-table-column label="供应商名称" prop="supplierName" width="240" show-overflow-tooltip />
        <el-table-column label="产品大类" prop="productCategory" width="100" show-overflow-tooltip />
        <el-table-column label="规格型号" prop="specificationModel" width="160" show-overflow-tooltip />
        <el-table-column label="规格型号" prop="specificationModel" width="200" show-overflow-tooltip />
        <el-table-column label="单位" prop="unit" width="70" show-overflow-tooltip />
        <el-table-column label="入库数量" prop="inboundNum" width="90" show-overflow-tooltip />
        <el-table-column label="含税单价" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />
@@ -33,7 +43,7 @@
        <el-table-column label="入库人" prop="createBy" width="80" show-overflow-tooltip />
        <el-table-column fixed="right" label="操作" min-width="60" align="center">
          <template #default="scope">
            <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">编辑</el-button>
            <el-button link type="primary" size="small" @click="openForm('edit', scope.row);" :disabled="scope.row.createUser !== userStore.id">编辑</el-button>
          </template>
        </el-table-column>
      </el-table>
@@ -80,9 +90,9 @@
          <el-table-column label="供应商" prop="supplierName" width="100" />
          <el-table-column label="采购数量" prop="quantity" width="100" />
          <el-table-column label="待入库数量" prop="quantity0" width="100" />
          <el-table-column label="本次入库数量" prop="quantityStock" width="120">
          <el-table-column label="本次入库数量" prop="quantityStock" width="150">
            <template #default="scope">
              <el-input v-model="scope.row.quantityStock" type="number" :min="0" :max="scope.row.quantity0" />
              <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.quantityStock" :max="scope.row.quantity0" />
            </template>
          </el-table-column>
          <el-table-column label="税率(%)" prop="taxRate" width="120" />
@@ -155,6 +165,7 @@
const data = reactive({
  searchForm: {
    supplierName: '',
      timeStr: '',
  },
  form: {
    id: null,
@@ -240,6 +251,7 @@
  const openForm = async (type, row) => {
    operationType.value = type
    dialogFormVisible.value = true
    selectedRows.value = []
    if (type === 'add') {
      // 新增时初始化表单
@@ -257,7 +269,6 @@
      }
      productList.value = [] // 清空产品列表
    } else {
      form.value = JSON.parse(JSON.stringify(row))
      try {
        loadingProducts.value = true
@@ -268,8 +279,9 @@
        });
        productList.value = res.data.map(item => ({
          ...item,
          quantityStock: item.quantityStock || 0 // 如果已有入库数量则保留
          quantityStock: row.inboundNum // 如果已有入库数量则保留
        }))
        selectedRows.value = productList.value
      } catch (error) {
        console.error('加载产品失败:', error)
        proxy.$modal.msgError('加载产品失败')
@@ -325,6 +337,7 @@
        nickName: userStore.nickName,// 使用新格式化函数
        details: selectedRows.value.map(product => ({
          id: product.id,
          // id: product.salesLedgerProductId,
          inboundQuantity: Number(product.quantityStock)
        })),
      };
@@ -386,6 +399,12 @@
  const handleDelete = () => {
    let ids = []
    if (selectedRows.value.length > 0) {
         // 检查是否有他人维护的数据
         const unauthorizedData = selectedRows.value.filter(item => item.createUser !== userStore.id);
         if (unauthorizedData.length > 0) {
            proxy.$modal.msgWarning("不可删除他人维护的数据");
            return;
         }
      ids = selectedRows.value.map(item => item.id);
    } else {
      proxy.$modal.msgWarning('请选择数据')