spring
3 天以前 fd3e3b19aaf23c4f68d8b98d514499510b152e39
Merge remote-tracking branch 'origin/dev' into dev
已修改9个文件
372 ■■■■ 文件已修改
src/api/qualityManagement/qualityInspectFile.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/user.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/invoiceEntry/components/Modal.vue 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/invoiceEntry/index.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementInvoiceLedger/Form/EditForm.vue 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementInvoiceLedger/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementLedger/index.vue 81 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/invoiceRegistration/index.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue 183 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/qualityManagement/qualityInspectFile.js
@@ -8,7 +8,7 @@
        params: query,
    })
}
// 查询附件列表
// 保存附件列表
export function qualityInspectFileAdd(query) {
    return request({
        url: '/quality/qualityInspectFile/add',
@@ -16,7 +16,7 @@
        data: query,
    })
}
// 查询附件列表
// 删除附件列表
export function qualityInspectFileDel(query) {
    return request({
        url: '/quality/qualityInspectFile/del',
src/store/modules/user.js
@@ -52,7 +52,7 @@
            this.avatar = avatar
            this.currentFactoryName = user.currentFactoryName
            this.nickName = user.nickName
            this.currentDeptId = user.currentDeptId
            this.currentDeptId = user.tenantId
            resolve(res)
          }).catch(error => {
            reject(error)
src/views/procurementManagement/invoiceEntry/components/Modal.vue
@@ -113,12 +113,14 @@
        rowKey="id"
        :column="columns"
        :tableData="form.productData"
                :summaryMethod="summarizeChildrenTable"
                :isShowSummary="true"
        height="auto"
      >
        <template #ticketsNumRef="{ row }">
          <el-input-number
            v-model="row.ticketsNum"
            placeholder="请选择"
            placeholder="请输入"
            :min="0"
            :step="0.1"
            clearable
@@ -129,7 +131,7 @@
        <template #ticketsAmountRef="{ row }">
          <el-input-number
            v-model="row.ticketsAmount"
            placeholder="请选择"
            placeholder="请输入"
            :min="0"
            :step="0.1"
            clearable
@@ -150,6 +152,7 @@
<script setup>
import { ref, getCurrentInstance } from "vue";
import { defineEmits } from 'vue';
import { useModal } from "@/hooks/useModal";
import useFormData from "@/hooks/useFormData";
import FileUpload from "@/components/Upload/FileUpload.vue";
@@ -210,6 +213,8 @@
} = useModal({
  title: "来票登记",
});
const emit = defineEmits(['refreshList']);
const columns = [
  {
@@ -283,10 +288,12 @@
  {
    label: "未来票数",
    prop: "futureTickets",
        width: 100,
  },
  {
    label: "未来票金额(元)",
    prop: "futureTicketsAmount",
        width: 200,
  },
];
@@ -316,7 +323,19 @@
    form.productData = data.productData;
  }
};
// 子表合计方法
const summarizeChildrenTable = (param) => {
    return proxy.summarizeTable(param, [
        "taxInclusiveUnitPrice",
        "taxInclusiveTotalPrice",
        "taxExclusiveTotalPrice",
        "ticketsNum",
        "ticketsAmount",
        "ticketsAmountRef",
        "futureTickets",
        "futureTicketsAmount",
    ]);
};
//本次来票数失焦操作
const invoiceNumBlur = (row) => {
  if (!row.ticketsNum || row.ticketsNum === "") {
@@ -328,11 +347,11 @@
    return;
  }
  // 计算本次来票金额
  row.ticketsAmount = row.ticketsNum * row.taxInclusiveUnitPrice;
  row.ticketsAmount = (row.ticketsNum * row.taxInclusiveUnitPrice).toFixed(2)
  // 计算未来票数
  row.futureTickets = row.tempFutureTickets - row.ticketsNum;
  row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2)
  // 计算未来票金额
  row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount;
  row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2)
  calculateinvoiceAmount();
};
@@ -351,9 +370,9 @@
    (row.ticketsAmount / row.taxInclusiveUnitPrice).toFixed(2)
  );
  // 计算未来票数
  row.futureTickets = row.tempFutureTickets - row.ticketsNum;
  row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2)
  // 计算未来票金额
  row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount;
  row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2)
  calculateinvoiceAmount();
};
@@ -361,7 +380,7 @@
  let invoiceAmountTotal = 0;
  form.productData.forEach((item) => {
    if (item.ticketsAmount) {
      invoiceAmountTotal += item.ticketsAmount;
      invoiceAmountTotal += Number(item.ticketsAmount);
    }
  });
  form.invoiceAmount = invoiceAmountTotal.toFixed(2);
@@ -381,6 +400,11 @@
const removeFile = (file) => {
  const { tempId } = file.response.data;
  form.tempFileIds = form.tempFileIds.filter((item) => item !== tempId);
};
const closeAndRefresh = () => {
  closeModal();
  emit('refreshList');
};
const submitForm = () => {
@@ -406,7 +430,7 @@
      });
      modalLoading.value = false;
      if (code == 200) {
        closeModal();
        closeAndRefresh();
      }
    } else {
      modalLoading.value = false;
@@ -416,6 +440,7 @@
defineExpose({
  open,
  closeAndRefresh,
});
</script>
src/views/procurementManagement/invoiceEntry/index.vue
@@ -24,8 +24,8 @@
          <el-button type="primary" @click="handleAdd('add')">
            新增登记
          </el-button>
          <el-button @click="handleOut">导出</el-button>
          <el-button type="danger" plain @click="handleDelete">删除</el-button>
<!--          <el-button @click="handleOut">导出</el-button>-->
<!--          <el-button type="danger" plain @click="handleDelete">删除</el-button>-->
        </div>
      </div>
      <PIMTable
@@ -61,7 +61,7 @@
        </template>
      </PIMTable>
    </div>
    <Modal ref="modalRef"></Modal>
    <Modal ref="modalRef" @refreshList="getTableData"></Modal>
  </div>
</template>
@@ -203,7 +203,13 @@
const handleDelete = () => {
    let ids = [];
    if (selectedRows.value.length > 0) {
        ids = selectedRows.value.map((item) => item.id);
    // 新增判断:如果有选中的数据没有ticketRegistrationId,提示并终止
    const noTicket = selectedRows.value.some(item => !item.ticketRegistrationId);
    if (noTicket) {
      proxy.$modal.msgWarning("采购台账还未进行来票登记,无法进行删除操作");
      return;
    }
        ids = selectedRows.value.map((item) => item.ticketRegistrationId);
    } else {
        proxy.$modal.msgWarning("请选择数据");
        return;
src/views/procurementManagement/procurementInvoiceLedger/Form/EditForm.vue
@@ -28,12 +28,12 @@
      </el-col>
      <el-col :span="12">
        <el-form-item label="来票数:">
          <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.ticketsNum" @input="inputTicketsNum" />
          <el-input-number :step="0.1" :min="0" style="width: 100%" v-model="form.ticketsNum" @change="inputTicketsNum" />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="本次来票金额(元):">
          <el-text type="success">{{ form.ticketsAmount }}</el-text>
                    <el-input-number :step="0.1" :min="0" style="width: 100%" v-model="form.ticketsAmount" @change="inputTicketsAmount" />
        </el-form-item>
      </el-col>
      <el-col :span="12">
@@ -81,12 +81,40 @@
};
const inputTicketsNum = (val) => {
    // 确保含税单价存在且不为零
    if (!form.taxInclusiveUnitPrice || Number(form.taxInclusiveUnitPrice) === 0) {
        proxy.$modal.msgWarning("含税单价不能为零或未定义");
        return;
    }
    if (Number(form.ticketsNum) > Number(form.futureTickets)) {
        proxy.$modal.msgWarning("开票数不得大于未开票数");
        form.ticketsNum = form.futureTickets
        return;
    }
  form.ticketsAmount = (val * form.taxInclusiveUnitPrice).toFixed(2);
    // 确保所有数值都转换为数字类型进行计算
    const ticketsAmount = Number(val) * Number(form.taxInclusiveUnitPrice);
    form.ticketsAmount = Number(ticketsAmount.toFixed(2));
};
const inputTicketsAmount = (val) => {
    // 确保含税单价存在且不为零
    if (!form.taxInclusiveUnitPrice || Number(form.taxInclusiveUnitPrice) === 0) {
        proxy.$modal.msgWarning("含税单价不能为零或未定义");
        return;
    }
    if (Number(val) > Number(form.futureTickets*form.taxInclusiveUnitPrice)) {
        proxy.$modal.msgWarning("本次来票金额不得大于总金额");
        form.ticketsAmount = (form.futureTickets*form.taxInclusiveUnitPrice).toFixed(2)
        const ticketsNum = Number(form.ticketsAmount) / Number(form.taxInclusiveUnitPrice);
        form.ticketsNum = Number(ticketsNum.toFixed(2))
        return;
    }
    // 确保所有数值都转换为数字类型进行计算
    const ticketsNum = Number(val) / Number(form.taxInclusiveUnitPrice);
    form.ticketsNum = Number(ticketsNum.toFixed(2));
};
defineExpose({
src/views/procurementManagement/procurementInvoiceLedger/index.vue
@@ -193,7 +193,7 @@
    {
      label: "不含税金额",
      prop: "unTicketsPrice",
      width: 100,
      width: 200,
      formatData: (cell) => {
        return cell ? parseFloat(cell).toFixed(2) : 0;
      },
@@ -201,7 +201,7 @@
    {
      label: "增值税",
      prop: "invoiceAmount",
      width: 100,
      width: 200,
    },
    {
      label: "附件",
src/views/procurementManagement/procurementLedger/index.vue
@@ -430,15 +430,17 @@
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="数量:" prop="quantity">
              <el-input-number
              :step="0.1"
                        <el-form-item label="税率(%):" prop="taxRate">
                            <el-select
                                v-model="productForm.taxRate"
                                placeholder="请选择"
                clearable
                style="width: 100%"
                v-model="productForm.quantity"
                placeholder="请输入"
                @change="mathNum"
              />
                            >
                                <el-option label="1" value="1" />
                                <el-option label="6" value="6" />
                                <el-option label="13" value="13" />
                            </el-select>
            </el-form-item>
          </el-col>
        </el-row>
@@ -456,17 +458,15 @@
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="税率(%):" prop="taxRate">
              <el-select
                v-model="productForm.taxRate"
                placeholder="请选择"
                        <el-form-item label="数量:" prop="quantity">
                            <el-input-number
                                :step="0.1"
                clearable
                                style="width: 100%"
                                v-model="productForm.quantity"
                                placeholder="请输入"
                @change="mathNum"
              >
                <el-option label="1" value="1" />
                <el-option label="6" value="6" />
                <el-option label="13" value="13" />
              </el-select>
                            />
            </el-form-item>
          </el-col>
        </el-row>
@@ -479,7 +479,7 @@
                :step="0.1"
                clearable
                style="width: 100%"
                disabled
                @change="reverseMathNum('taxInclusiveTotalPrice')"
              />
            </el-form-item>
          </el-col>
@@ -488,7 +488,10 @@
              label="不含税总价(元):"
              prop="taxExclusiveTotalPrice"
            >
              <el-input v-model="productForm.taxExclusiveTotalPrice" disabled />
              <el-input
                v-model="productForm.taxExclusiveTotalPrice"
                @change="reverseMathNum('taxExclusiveTotalPrice')"
              />
            </el-form-item>
          </el-col>
        </el-row>
@@ -1010,7 +1013,10 @@
  return `${year}-${month}-${day}`;
}
const mathNum = () => {
  console.log("productForm.value", productForm.value);
    if (!productForm.value.taxRate) {
        proxy.$modal.msgWarning("请先选择税率");
        return;
    }
  if (!productForm.value.taxInclusiveUnitPrice) {
    return;
  }
@@ -1032,6 +1038,43 @@
      );
  }
};
const reverseMathNum = (field) => {
    if (!productForm.value.taxRate) {
        proxy.$modal.msgWarning("请先选择税率");
        return;
    }
  const taxRate = Number(productForm.value.taxRate);
  if (!taxRate) return;
  if (field === 'taxInclusiveTotalPrice') {
    // 已知含税总价和数量,反算含税单价
    if (productForm.value.quantity) {
      productForm.value.taxInclusiveUnitPrice =
        (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2);
    }
    // 已知含税总价和含税单价,反算数量
    else if (productForm.value.taxInclusiveUnitPrice) {
      productForm.value.quantity =
        (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2);
    }
    // 反算不含税总价
    productForm.value.taxExclusiveTotalPrice =
      (Number(productForm.value.taxInclusiveTotalPrice) / (1 + taxRate / 100)).toFixed(2);
  } else if (field === 'taxExclusiveTotalPrice') {
    // 反算含税总价
    productForm.value.taxInclusiveTotalPrice =
      (Number(productForm.value.taxExclusiveTotalPrice) * (1 + taxRate / 100)).toFixed(2);
    // 已知数量,反算含税单价
    if (productForm.value.quantity) {
      productForm.value.taxInclusiveUnitPrice =
        (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2);
    }
    // 已知含税单价,反算数量
    else if (productForm.value.taxInclusiveUnitPrice) {
      productForm.value.quantity =
        (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2);
    }
  }
};
// 销售合同选择改变方法
const salesLedgerChange = async (row) => {
  console.log("row", row);
src/views/salesManagement/invoiceRegistration/index.vue
@@ -320,7 +320,7 @@
            <template #default="scope">
              <el-input-number :step="0.1" :min="0" style="width: 100%"
                v-model="scope.row.currentInvoiceNum"
                @blur="invoiceNumBlur(scope.row)"
                @change="invoiceNumBlur(scope.row)"
              ></el-input-number>
            </template>
          </el-table-column>
@@ -332,7 +332,7 @@
            <template #default="scope">
              <el-input-number :step="0.01" :min="0" style="width: 100%"
                v-model="scope.row.currentInvoiceAmount"
                @blur="invoiceAmountBlur(scope.row)"
                @change="invoiceAmountBlur(scope.row)"
              ></el-input-number>
            </template>
          </el-table-column>
@@ -539,6 +539,7 @@
    "currentInvoiceAmount",
    "noInvoiceNum",
    "noInvoiceAmount",
    "currentInvoiceNum",
  ]);
};
// 打开弹框
src/views/salesManagement/salesLedger/index.vue
@@ -236,21 +236,8 @@
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="数量:" prop="quantity">
              <el-input-number  :step="0.1" :min="0" v-model="productForm.quantity" placeholder="请输入" clearable
                @change="mathNum" style="width: 100%" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="含税单价(元):" prop="taxInclusiveUnitPrice">
              <el-input-number :step="0.01" :min="0" v-model="productForm.taxInclusiveUnitPrice" style="width: 100%" placeholder="请输入" clearable @change="mathNum" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="税率(%):" prop="taxRate">
              <el-select v-model="productForm.taxRate" placeholder="请选择" clearable @change="mathNum">
                            <el-select v-model="productForm.taxRate" placeholder="请选择" clearable @change="calculateFromTaxRate">
                <el-option label="1" value="1" />
                <el-option label="6" value="6" />
                <el-option label="13" value="13" />
@@ -260,13 +247,27 @@
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="含税单价(元):" prop="taxInclusiveUnitPrice">
              <el-input-number :step="0.01" :min="0" v-model="productForm.taxInclusiveUnitPrice" style="width: 100%"
                                                             placeholder="请输入" clearable @change="calculateFromUnitPrice" />
            </el-form-item>
          </el-col>
                    <el-col :span="12">
                        <el-form-item label="数量:" prop="quantity">
                            <el-input-number  :step="0.1" :min="0" v-model="productForm.quantity" placeholder="请输入" clearable
                                                                @change="calculateFromQuantity" style="width: 100%" />
                        </el-form-item>
                    </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="含税总价(元):" prop="taxInclusiveTotalPrice">
              <el-input v-model="productForm.taxInclusiveTotalPrice" placeholder="请输入" clearable disabled />
              <el-input v-model="productForm.taxInclusiveTotalPrice" placeholder="请输入" clearable @change="calculateFromTotalPrice" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="不含税总价(元):" prop="taxExclusiveTotalPrice">
              <el-input v-model="productForm.taxExclusiveTotalPrice" placeholder="请输入" clearable disabled />
              <el-input v-model="productForm.taxExclusiveTotalPrice" placeholder="请输入" clearable @change="calculateFromExclusiveTotalPrice" />
            </el-form-item>
          </el-col>
        </el-row>
@@ -413,6 +414,8 @@
  },
});
const { productForm, productRules } = toRefs(productFormData);
// 防止循环计算的标志
const isCalculating = ref(false);
const upload = reactive({
  // 上传的地址
  url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
@@ -808,6 +811,154 @@
      );
  }
};
// 根据含税总价计算含税单价和数量
const calculateFromTotalPrice = () => {
  if (isCalculating.value) return;
  const totalPrice = parseFloat(productForm.value.taxInclusiveTotalPrice);
  const quantity = parseFloat(productForm.value.quantity);
  if (!totalPrice || !quantity || quantity <= 0) {
    return;
  }
  isCalculating.value = true;
  // 计算含税单价 = 含税总价 / 数量
  productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2);
  // 如果有税率,计算不含税总价
  if (productForm.value.taxRate) {
    productForm.value.taxExclusiveTotalPrice =
      proxy.calculateTaxExclusiveTotalPrice(
        totalPrice,
        productForm.value.taxRate
      );
  }
  isCalculating.value = false;
};
// 根据不含税总价计算含税单价和数量
const calculateFromExclusiveTotalPrice = () => {
    if (!productForm.value.taxRate) {
        proxy.$modal.msgWarning("请先选择税率");
        return;
    }
  if (isCalculating.value) return;
  const exclusiveTotalPrice = parseFloat(productForm.value.taxExclusiveTotalPrice);
  const quantity = parseFloat(productForm.value.quantity);
  const taxRate = parseFloat(productForm.value.taxRate);
  if (!exclusiveTotalPrice || !quantity || quantity <= 0 || !taxRate) {
    return;
  }
  isCalculating.value = true;
  // 先计算含税总价 = 不含税总价 / (1 - 税率/100)
  const taxRateDecimal = taxRate / 100;
  const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
  productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
  // 计算含税单价 = 含税总价 / 数量
  productForm.value.taxInclusiveUnitPrice = (inclusiveTotalPrice / quantity).toFixed(2);
  isCalculating.value = false;
};
// 根据数量变化计算总价
const calculateFromQuantity = () => {
    if (!productForm.value.taxRate) {
        proxy.$modal.msgWarning("请先选择税率");
        return;
    }
  if (isCalculating.value) return;
  const quantity = parseFloat(productForm.value.quantity);
  const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice);
  if (!quantity || quantity <= 0 || !unitPrice) {
    return;
  }
  isCalculating.value = true;
  // 计算含税总价
  productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
  // 如果有税率,计算不含税总价
  if (productForm.value.taxRate) {
    productForm.value.taxExclusiveTotalPrice =
      proxy.calculateTaxExclusiveTotalPrice(
        productForm.value.taxInclusiveTotalPrice,
        productForm.value.taxRate
      );
  }
  isCalculating.value = false;
};
// 根据含税单价变化计算总价
const calculateFromUnitPrice = () => {
    if (!productForm.value.taxRate) {
        proxy.$modal.msgWarning("请先选择税率");
        return;
    }
  if (isCalculating.value) return;
  const quantity = parseFloat(productForm.value.quantity);
  const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice);
  if (!quantity || quantity <= 0 || !unitPrice) {
    return;
  }
  isCalculating.value = true;
  // 计算含税总价
  productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
  // 如果有税率,计算不含税总价
  if (productForm.value.taxRate) {
    productForm.value.taxExclusiveTotalPrice =
      proxy.calculateTaxExclusiveTotalPrice(
        productForm.value.taxInclusiveTotalPrice,
        productForm.value.taxRate
      );
  }
  isCalculating.value = false;
};
// 根据税率变化计算不含税总价
const calculateFromTaxRate = () => {
    if (!productForm.value.taxRate) {
        proxy.$modal.msgWarning("请先选择税率");
        return;
    }
  if (isCalculating.value) return;
  const inclusiveTotalPrice = parseFloat(productForm.value.taxInclusiveTotalPrice);
  const taxRate = parseFloat(productForm.value.taxRate);
  if (!inclusiveTotalPrice || !taxRate) {
    return;
  }
  isCalculating.value = true;
  // 计算不含税总价
  productForm.value.taxExclusiveTotalPrice =
    proxy.calculateTaxExclusiveTotalPrice(
      inclusiveTotalPrice,
      taxRate
    );
  isCalculating.value = false;
};
/**
 * 下载文件
 *