chenrui
2025-06-06 ece2dfeb926d728b10db38038e4d12e9e9851c24
src/views/salesManagement/salesLedger/index.vue
@@ -25,6 +25,7 @@
                :expand-row-keys="expandedRowKeys"
                :row-key="row => row.id"
                show-summary
                style="width: 100%"
                :summary-method="summarizeMainTable"
                @expand-change="expandChange"
                height="calc(100vh - 18.5em)">
@@ -35,27 +36,27 @@
                      show-summary
                      :summary-method="summarizeChildrenTable">
              <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="productCategory" />
              <el-table-column label="规格型号"  prop="specificationModel" />
              <el-table-column label="单位" prop="unit" />
              <el-table-column label="数量" prop="quantity" />
              <el-table-column label="税率(%)" prop="taxRate" />
              <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" />
              <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" />
              <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" />
              <el-table-column label="数量"  prop="quantity" />
              <el-table-column label="税率(%)"  prop="taxRate" />
              <el-table-column label="含税单价(元)"  prop="taxInclusiveUnitPrice" :formatter="formattedNumber"/>
              <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber"/>
              <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber"/>
            </el-table>
          </template>
        </el-table-column>
        <el-table-column align="center" label="序号" type="index" width="60" />
        <el-table-column label="销售合同号" prop="salesContractNo" show-overflow-tooltip/>
        <el-table-column label="客户合同号" prop="customerContractNo" show-overflow-tooltip/>
        <el-table-column label="客户名称" prop="customerName" show-overflow-tooltip/>
        <el-table-column label="业务员" prop="salesman" show-overflow-tooltip/>
        <el-table-column label="项目名称" prop="projectName" show-overflow-tooltip/>
        <el-table-column label="合同金额(元)" prop="contractAmount" show-overflow-tooltip/>
        <el-table-column label="录入人" prop="entryPersonName" show-overflow-tooltip/>
        <el-table-column label="录入日期" prop="entryDate" show-overflow-tooltip/>
        <el-table-column label="录入日期" prop="executionDate" show-overflow-tooltip/>
        <el-table-column label="销售合同号" prop="salesContractNo" width="180" show-overflow-tooltip/>
        <el-table-column label="客户合同号" prop="customerContractNo" width="180" show-overflow-tooltip/>
        <el-table-column label="客户名称" prop="customerName" width="300" show-overflow-tooltip/>
        <el-table-column label="业务员" prop="salesman" width="100" show-overflow-tooltip/>
        <el-table-column label="项目名称" prop="projectName" width="180" show-overflow-tooltip/>
        <el-table-column label="合同金额(元)" prop="contractAmount" width="180" show-overflow-tooltip :formatter="formattedNumber"/>
        <el-table-column label="录入人" prop="entryPersonName" width="100" show-overflow-tooltip/>
        <el-table-column label="录入日期" prop="entryDate" width="120" show-overflow-tooltip/>
        <el-table-column label="签订日期" prop="executionDate" width="120" 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>
@@ -154,9 +155,9 @@
          <el-table-column label="单位" prop="unit" />
          <el-table-column label="数量" prop="quantity" />
          <el-table-column label="税率(%)" prop="taxRate" />
          <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" />
          <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" />
          <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" />
          <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber"/>
          <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber"/>
          <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber"/>
          <el-table-column fixed="right" label="操作" min-width="60" align="center">
            <template #default="scope">
              <el-button link type="primary" size="small" @click="openProductForm('edit', scope.row);">编辑</el-button>
@@ -306,7 +307,7 @@
import useUserStore from '@/store/modules/user'
import {userListNoPage} from "@/api/system/user.js";
import {
  ledgerList,
  ledgerListPage,
  productList,
  customerList,
  addOrUpdateSalesLedger,
@@ -403,16 +404,16 @@
  page.current = 1
  getList()
}
const paginationChange = ({ current, limit }) => {
  page.current = current;
  page.size = limit;
const paginationChange = (obj) => {
  page.current = obj.page;
  page.size = obj.limit;
  getList()
}
const getList = () => {
  tableLoading.value = true
  ledgerList({...searchForm.value, ...page}).then(res => {
  ledgerListPage({...searchForm.value, ...page}).then(res => {
    tableLoading.value = false
    tableData.value = res.rows
    tableData.value = res.records
    tableData.value.map(item => {
      item.children = []
    })
@@ -427,6 +428,9 @@
    productOptions.value = convertIdToValue(res)
  })
}
const formattedNumber = (row, column, cellValue) => {
  return parseFloat(cellValue).toFixed(2);
};
// 获取tree子数据
const getModels =(value) => {
  productForm.value.productCategory = findNodeById(productOptions.value, value)
@@ -435,11 +439,14 @@
  })
}
const getProductModel =(value) => {
  console.log('value', value)
  const index = modelOptions.value.findIndex(item => item.id === value);
  if (index !== -1) {
    productForm.value.specificationModel = modelOptions.value[index].model;
    productForm.value.unit = modelOptions.value[index].unit;
  } else {
    productForm.value.specificationModel = null;
    productForm.value.unit = null;
  }
}
const findNodeById = (nodes, productId) => {