zhangwencui
8 天以前 7ffd709598b1e44289d9f7bb23ae6b8583aebc3a
src/views/procurementManagement/procurementLedger/index.vue
@@ -624,8 +624,11 @@
                          prop="taxRate"
                          v-if="currentSupplierType === 1">
              <el-select v-model="productForm.taxRate"
                         placeholder="请选择"
                         placeholder="请选择或输入"
                         clearable
                         filterable
                         remote
                         :remote-method="handleTaxRateRemote"
                         @change="mathNum">
                <el-option label="1"
                           value="1" />
@@ -633,6 +636,9 @@
                           value="6" />
                <el-option label="13"
                           value="13" />
                <el-option v-if="customTaxRate"
                           :label="customTaxRate"
                           :value="customTaxRate" />
              </el-select>
            </el-form-item>
          </el-col>
@@ -1049,6 +1055,7 @@
  const productOperationType = ref("");
  const productOperationIndex = ref("");
  const currentId = ref("");
  const customTaxRate = ref("");
  const productFormData = reactive({
    productForm: {
      productId: "",
@@ -1917,6 +1924,20 @@
    const day = String(today.getDate()).padStart(2, "0");
    return `${year}-${month}-${day}`;
  }
  // 处理税率远程搜索
  const handleTaxRateRemote = query => {
    if (query) {
      // 验证输入是否为数字且在0-100之间
      const num = parseFloat(query);
      if (!isNaN(num) && num > 0 && num < 100) {
        customTaxRate.value = query;
      } else {
        customTaxRate.value = "";
      }
    } else {
      customTaxRate.value = "";
    }
  };
  const mathNum = () => {
    if (!productForm.value.taxRate) {
      proxy.$modal.msgWarning("请先选择税率");