lishenao
10 天以前 fde27654b1b21a8d2c149d3d12f86c3c7314c091
src/views/inventoryManagement/receiptManagement/index.vue
@@ -40,98 +40,54 @@
      <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
        :page="page.current" :limit="page.size" @pagination="paginationChange" />
    </div>
    <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? '新增入库' : '编辑入库'" width="70%"
      @close="closeDia">
      <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="产品大类:" prop="productId">
              <el-select v-model="form.productId" placeholder="请选择" clearable filterable @change="handleProductChange">
                <el-option v-for="item in productList" :key="item.id" :label="item.productName"
                           :value="item.id" />
              </el-select>
        <el-form-item label="采购订单号" prop="salesContractNo">
              <el-input v-model="form.salesContractNo" placeholder="请输入" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="规格型号:" prop="productManageId">
              <el-select v-model="form.productModelId" placeholder="请先选择产品大类" clearable filterable :disabled="!form.productId"
                         @change="handleModelChange">
                <el-option v-for="item in productModelList" :key="item.id" :label="item.model"
                           :value="item.id" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="供应商名称:" prop="salesContractNo">
              <el-select v-model="form.supplierId" placeholder="请选择" clearable>
                <el-option v-for="item in supplierLists" :key="item.id" :label="item.supplierName"
                           :value="item.id" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="单位:" prop="customerId">
              <el-input v-model="form.unit" placeholder="请输入" clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="入库时间:" prop="projectName">
              <el-date-picker style="width: 100%" v-model="form.inboundTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
                type="date" placeholder="请选择" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="入库批次:" prop="entryPerson">
              <el-input v-model="form.inboundBatch" placeholder="请输入" clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="入库数量:" prop="customerContractNo">
              <el-input v-model="form.inboundQuantity" placeholder="请输入" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="含税单价:" prop="customerId">
              <el-input v-model="form.taxInclusiveUnitPrice" placeholder="请输入" clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="含税总价:" prop="customerContractNo">
              <el-input v-model="form.taxInclusiveTotalPrice" placeholder="请输入" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="税率:" prop="customerId">
              <el-input v-model="form.taxRate" placeholder="请输入" clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="不含税总价:" prop="entryDate">
              <el-input v-model="form.taxExclusiveTotalPrice" placeholder="请输入" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="入库人:" prop="entryPerson">
              <el-select v-model="form.nickName" placeholder="请选择" clearable>
                <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-table
          :data="productData"
          border
          @selection-change="productSelected"
        >
          <el-table-column align="center" type="selection" width="55" />
          <el-table-column
            align="center"
            label="序号"
            type="index"
            width="60"
          />
          <el-table-column label="产品大类" prop="productCategory" />
          <el-table-column label="规格型号" prop="specificationModel" />
          <el-table-column label="单位" prop="unit" width="70" />
          <el-table-column label="采购数量" prop="quantity" width="100" />
          <el-table-column label="待入库数量" prop="quantity0" width="100" />
          <el-table-column label="本次入库数量" prop="quantityStock" width="120">
            <template #default="scope">
              <el-input v-model="scope.row.quantityStock" type="number" :min="0" :max="scope.row.quantity0" />
            </template>
          </el-table-column>
          <el-table-column label="税率(%)" prop="taxRate" width="120" />
          <el-table-column
            label="含税单价(元)"
            prop="taxInclusiveUnitPrice"
            :formatter="formattedNumber"
            width="150"
          />
          <el-table-column
            label="含税总价(元)"
            prop="taxInclusiveTotalPrice"
            :formatter="formattedNumber"
            width="150"
          />
          <el-table-column
            label="不含税总价(元)"
            prop="taxExclusiveTotalPrice"
            :formatter="formattedNumber"
            width="150"
          />
        </el-table>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
@@ -160,7 +116,6 @@
import {modelListPage, productTreeList} from "@/api/basicData/product.js";
const userStore = useUserStore()
const { proxy } = getCurrentInstance()
const tableData = ref([])
const selectedRows = ref([])
const userList = ref([])
@@ -177,7 +132,6 @@
  size: 100,
})
const total = ref(0)
// const fileList = ref([])
// 用户信息表单弹框数据
const operationType = ref('')
@@ -228,7 +182,6 @@
    taxRate: [{ required: true, message: "请输入", trigger: "blur" }],
  }
})
const { searchForm, form, rules } = toRefs(data)
// 查询列表
@@ -237,13 +190,11 @@
  page.current = 1
  getList()
}
const paginationChange = (obj) => {
  page.current = obj.page;
  page.size = obj.limit;
  getList()
}
const getList = () => {
  tableLoading.value = true
  getStockInPage({ ...searchForm.value, ...page }).then(res => {
@@ -289,7 +240,10 @@
  } finally {
    loadingProducts.value = false;
  }
  return null; // 没有找到节点,返回null
};
// 表格选择数据
const handleSelectionChange = (selection) => {
// 加载规格型号列表
const loadProductModels = async (productId) => {
@@ -517,6 +471,15 @@
  const day = String(today.getDate()).padStart(2, '0');
  return `${year}-${month}-${day}`;
}
const productSelectedRows = ref([])
const productSelected = (selectedRows) => {
  productSelectedRows.value = selectedRows;
};
const formattedNumber = (row, column, cellValue) => {
  return parseFloat(cellValue).toFixed(2);
};
onMounted(() => {
  getList()
})