liding
2026-04-10 c05b81c7f50df80ab247a05f9f92af2d799e77cd
feat:1.销售添加是否生产
2.生产订单添加备注
已修改3个文件
1146 ■■■■ 文件已修改
src/views/productionManagement/productionOrder/New.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionOrder/index.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue 1133 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionOrder/New.vue
@@ -90,6 +90,12 @@
          <el-input-number v-model="formState.quantity" :step="1" :min="1" style="width: 100%" />
        </el-form-item>
        <el-form-item
            label="备注"
            prop="remark"
        >
          <el-input v-model="formState.remark" placeholder="备注" />
        </el-form-item>
      </el-form>
      <!-- 产品选择弹窗 -->
@@ -140,6 +146,7 @@
  priority: undefined,
  quantity: 0,
  batchNo: "",
  remark: "",
});
const isShow = computed({
@@ -173,6 +180,7 @@
    priority: priority_type.value && priority_type.value.length > 0 ? priority_type.value[2].value : undefined,
    quantity: '',
    batchNo: "",
    remark: "",
  };
  isShow.value = false;
};
src/views/productionManagement/productionOrder/index.vue
@@ -211,6 +211,11 @@
      width: 120,
    },
    {
      label: "备注",
      prop: "remark",
      width: 120,
    },
    {
      dataType: "action",
      label: "操作",
      align: "center",
src/views/salesManagement/salesLedger/index.vue
@@ -1,63 +1,61 @@
<template>
  <div class="app-container">
    <div class="search_form">
      <el-form :model="searchForm" :inline="true">
        <el-form-item label="客户名称:">
          <el-input v-model="searchForm.customerName" placeholder="请输入" clearable prefix-icon="Search"
            @change="handleQuery" />
        </el-form-item>
        <el-form-item label="销售合同号:">
          <el-input v-model="searchForm.salesContractNo" placeholder="请输入" clearable prefix-icon="Search"
            @change="handleQuery" />
        </el-form-item>
        <el-form-item label="项目名称:">
          <el-input v-model="searchForm.projectName" placeholder="请输入" clearable prefix-icon="Search"
            @change="handleQuery" />
        </el-form-item>
        <el-form-item label="录入日期:">
          <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
            placeholder="请选择" clearable @change="changeDaterange" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleQuery"> 搜索 </el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="table_list">
      <div class="actions">
        <div></div>
        <div>
          <el-button type="primary" @click="openForm('add')">
            新增台账
          </el-button>
          <el-button type="primary" plain @click="handleImport">导入</el-button>
          <el-button @click="handleOut">导出</el-button>
          <el-button type="danger" plain @click="handleDelete">删除</el-button>
          <el-button type="primary" plain @click="handlePrint">打印</el-button>
        </div>
      </div>
      <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange"
        :expand-row-keys="expandedRowKeys" :row-key="(row) => row.id" :row-class-name="tableRowClassName" show-summary style="width: 100%"
        :summary-method="summarizeMainTable" @expand-change="expandChange" height="calc(100vh - 18.5em)">
        <el-table-column align="center" type="selection" width="55" fixed="left"/>
        <el-table-column type="expand" width="60" fixed="left">
          <template #default="props">
            <el-table :data="props.row.children" border show-summary :summary-method="summarizeChildrenTable">
              <el-table-column align="center" label="序号" type="index"/>
              <el-table-column label="产品大类" prop="productCategory" />
              <el-table-column label="规格型号" prop="specificationModel" />
              <el-table-column label="单位" prop="unit" />
              <el-table-column label="料号" prop="materialCode" />
                            <el-table-column label="产品状态"
                                                             width="100px"
                                                             align="center">
                <template #default="scope">
                                    <el-tag v-if="scope.row.approveStatus === 1"
                                                    type="success">充足</el-tag>
                                    <el-tag v-else
                                                    type="danger">不足</el-tag>
                </template>
              </el-table-column>
    <div class="app-container">
        <div class="search_form">
            <el-form :model="searchForm" :inline="true">
                <el-form-item label="客户名称:">
                    <el-input v-model="searchForm.customerName" placeholder="请输入" clearable prefix-icon="Search"
                        @change="handleQuery" />
                </el-form-item>
                <el-form-item label="销售合同号:">
                    <el-input v-model="searchForm.salesContractNo" placeholder="请输入" clearable prefix-icon="Search"
                        @change="handleQuery" />
                </el-form-item>
                <el-form-item label="项目名称:">
                    <el-input v-model="searchForm.projectName" placeholder="请输入" clearable prefix-icon="Search"
                        @change="handleQuery" />
                </el-form-item>
                <el-form-item label="录入日期:">
                    <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
                        type="daterange" placeholder="请选择" clearable @change="changeDaterange" />
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="handleQuery"> 搜索 </el-button>
                </el-form-item>
            </el-form>
        </div>
        <div class="table_list">
            <div class="actions">
                <div></div>
                <div>
                    <el-button type="primary" @click="openForm('add')">
                        新增台账
                    </el-button>
                    <el-button type="primary" plain @click="handleImport">导入</el-button>
                    <el-button @click="handleOut">导出</el-button>
                    <el-button type="danger" plain @click="handleDelete">删除</el-button>
                    <el-button type="primary" plain @click="handlePrint">打印</el-button>
                </div>
            </div>
            <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange"
                :expand-row-keys="expandedRowKeys" :row-key="(row) => row.id" :row-class-name="tableRowClassName"
                show-summary style="width: 100%" :summary-method="summarizeMainTable" @expand-change="expandChange"
                height="calc(100vh - 18.5em)">
                <el-table-column align="center" type="selection" width="55" fixed="left" />
                <el-table-column type="expand" width="60" fixed="left">
                    <template #default="props">
                        <el-table :data="props.row.children" border show-summary
                            :summary-method="summarizeChildrenTable">
                            <el-table-column align="center" label="序号" type="index" />
                            <el-table-column label="产品大类" prop="productCategory" />
                            <el-table-column label="规格型号" prop="specificationModel" />
                            <el-table-column label="单位" prop="unit" />
                            <el-table-column label="料号" prop="materialCode" />
                            <el-table-column label="产品状态" width="100px" align="center">
                                <template #default="scope">
                                    <el-tag v-if="scope.row.approveStatus === 1" type="success">充足</el-tag>
                                    <el-tag v-else type="danger">不足</el-tag>
                                </template>
                            </el-table-column>
                            <el-table-column label="发货状态" width="140" align="center">
                                <template #default="scope">
                                    <el-tag :type="getShippingStatusType(scope.row)" size="small">
@@ -67,74 +65,72 @@
                            </el-table-column>
                            <el-table-column label="快递公司" prop="expressCompany" show-overflow-tooltip />
                            <el-table-column label="快递单号" prop="expressNumber" show-overflow-tooltip />
              <el-table-column label="发货车牌" minWidth="100px" align="center">
                <template #default="scope">
                  <div>
                    <el-tag type="success" v-if="scope.row.shippingCarNumber">{{ scope.row.shippingCarNumber }}</el-tag>
                    <el-tag v-else type="info">-</el-tag>
                  </div>
                </template>
              </el-table-column>
                            <el-table-column label="发货日期"
                                                             minWidth="100px"
                                                             align="center">
                <template #default="scope">
                  <div>
                    <div v-if="scope.row.shippingDate">{{ scope.row.shippingDate }}</div>
                                        <el-tag v-else
                                                        type="info">-</el-tag>
                  </div>
                </template>
              </el-table-column>
              <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-column Width="60px" label="操作" align="center">
                <template #default="scope">
                  <el-button
                    link
                    type="primary"
                    size="small"
                    :disabled="!canShip(scope.row)"
                    @click="openDeliveryForm(scope.row)">
                    发货
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </template>
        </el-table-column>
        <el-table-column align="center" label="序号" type="index" width="60" />
        <el-table-column label="销售合同号" prop="salesContractNo" 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="paymentMethod" show-overflow-tooltip />
        <el-table-column label="合同金额(元)" prop="contractAmount" width="220" 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 label="交付日期" prop="deliveryDate" width="120" show-overflow-tooltip />
        <el-table-column label="备注" prop="remarks" width="200" show-overflow-tooltip />
        <el-table-column fixed="right" label="操作" min-width="100" align="center">
          <template #default="scope">
            <el-button link type="primary" size="small" @click="openForm('edit', scope.row)" :disabled="!scope.row.isEdit">编辑</el-button>
<!--            <el-button link type="primary" size="small" @click="openForm('view', scope.row)">详情</el-button>-->
            <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">附件</el-button>
<!--            <el-button link type="primary" size="small" @click="openDeliveryForm(scope.row)">发货</el-button>-->
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
        :page="page.current" :limit="page.size" @pagination="paginationChange" />
    </div>
    <FormDialog v-model="dialogFormVisible" :title="operationType === 'add' ? '新增销售台账页面' : '编辑销售台账页面'" :width="'70%'"
      :operation-type="operationType" @close="closeDia" @confirm="submitForm" @cancel="closeDia">
      <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
                            <el-table-column label="发货车牌" minWidth="100px" align="center">
                                <template #default="scope">
                                    <div>
                                        <el-tag type="success" v-if="scope.row.shippingCarNumber">{{
                                            scope.row.shippingCarNumber }}</el-tag>
                                        <el-tag v-else type="info">-</el-tag>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column label="发货日期" minWidth="100px" align="center">
                                <template #default="scope">
                                    <div>
                                        <div v-if="scope.row.shippingDate">{{ scope.row.shippingDate }}</div>
                                        <el-tag v-else type="info">-</el-tag>
                                    </div>
                                </template>
                            </el-table-column>
                            <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-column Width="60px" label="操作" align="center">
                                <template #default="scope">
                                    <el-button link type="primary" size="small" :disabled="!canShip(scope.row)"
                                        @click="openDeliveryForm(scope.row)">
                                        发货
                                    </el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="序号" type="index" width="60" />
                <el-table-column label="销售合同号" prop="salesContractNo" 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="paymentMethod" show-overflow-tooltip />
                <el-table-column label="合同金额(元)" prop="contractAmount" width="220" 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 label="交付日期" prop="deliveryDate" width="120" show-overflow-tooltip />
                <el-table-column label="备注" prop="remarks" width="200" show-overflow-tooltip />
                <el-table-column fixed="right" label="操作" min-width="100" align="center">
                    <template #default="scope">
                        <el-button link type="primary" size="small" @click="openForm('edit', scope.row)"
                            :disabled="!scope.row.isEdit">编辑</el-button>
                        <!--            <el-button link type="primary" size="small" @click="openForm('view', scope.row)">详情</el-button>-->
                        <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">附件</el-button>
                        <!--            <el-button link type="primary" size="small" @click="openDeliveryForm(scope.row)">发货</el-button>-->
                    </template>
                </el-table-column>
            </el-table>
            <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
                :page="page.current" :limit="page.size" @pagination="paginationChange" />
        </div>
        <FormDialog v-model="dialogFormVisible" :title="operationType === 'add' ? '新增销售台账页面' : '编辑销售台账页面'"
            :width="'70%'" :operation-type="operationType" @close="closeDia" @confirm="submitForm" @cancel="closeDia">
            <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
                <!-- 报价单导入入口:放在表单顶部,选择后反显客户/业务员等 -->
                <el-row v-if="operationType === 'add'" style="margin-bottom: 10px;">
                    <el-col :span="24" style="text-align: right;">
@@ -143,86 +139,101 @@
                        </el-button>
                    </el-col>
                </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="销售合同号:" prop="salesContractNo">
              <el-input v-model="form.salesContractNo" placeholder="自动生成" clearable disabled />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="业务员:" prop="salesman">
              <el-select v-model="form.salesman" placeholder="请选择" clearable :disabled="operationType === 'view'">
                <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
                  :value="item.nickName" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="客户名称:" prop="customerId">
              <el-select v-model="form.customerId" placeholder="请选择" clearable :disabled="operationType === 'view'">
                <el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" :value="item.id">
                  {{
                    item.customerName + "——" + item.taxpayerIdentificationNumber
                  }}
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
                <el-row :gutter="30">
                    <el-col :span="12">
                        <el-form-item label="项目名称:" prop="projectName">
                            <el-input v-model="form.projectName" placeholder="请输入" clearable :disabled="operationType === 'view'" />
                        <el-form-item label="销售合同号:" prop="salesContractNo">
                            <el-input v-model="form.salesContractNo" placeholder="自动生成" clearable disabled />
                        </el-form-item>
                    </el-col>
        </el-row>
        <el-row :gutter="30">
                    <el-col :span="12">
                        <el-form-item label="业务员:" prop="salesman">
                            <el-select v-model="form.salesman" placeholder="请选择" clearable
                                :disabled="operationType === 'view'">
                                <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
                                    :value="item.nickName" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="12">
                        <el-form-item label="客户名称:" prop="customerId">
                            <el-select v-model="form.customerId" placeholder="请选择" clearable
                                :disabled="operationType === 'view'">
                                <el-option v-for="item in customerOption" :key="item.id" :label="item.customerName"
                                    :value="item.id">
                                    {{
                                        item.customerName + "——" + item.taxpayerIdentificationNumber
                                    }}
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="项目名称:" prop="projectName">
                            <el-input v-model="form.projectName" placeholder="请输入" clearable
                                :disabled="operationType === 'view'" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="12">
                        <el-form-item label="签订日期:" prop="executionDate">
                            <el-date-picker style="width: 100%" v-model="form.executionDate" value-format="YYYY-MM-DD"
                                                            format="YYYY-MM-DD" type="date" placeholder="请选择" clearable :disabled="operationType === 'view'" />
                                format="YYYY-MM-DD" type="date" placeholder="请选择" clearable
                                :disabled="operationType === 'view'" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="付款方式">
                            <el-input v-model="form.paymentMethod" placeholder="请输入" clearable :disabled="operationType === 'view'" />
                            <el-input v-model="form.paymentMethod" placeholder="请输入" clearable
                                :disabled="operationType === 'view'" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="12">
                        <el-form-item label="录入人:" prop="entryPerson">
                            <el-select v-model="form.entryPerson"
                                                 filterable
                                                 default-first-option
                                                 :reserve-keyword="false" placeholder="请选择" clearable @change="changs">
                                <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" />
                            <el-select v-model="form.entryPerson" filterable default-first-option
                                :reserve-keyword="false" placeholder="请选择" clearable @change="changs">
                                <el-option v-for="item in userList" :key="item.userId" :label="item.nickName"
                                    :value="item.userId" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="录入日期:" prop="entryDate">
                            <el-date-picker style="width: 100%" v-model="form.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
                                                            type="date" placeholder="请选择" clearable />
                            <el-date-picker style="width: 100%" v-model="form.entryDate" value-format="YYYY-MM-DD"
                                format="YYYY-MM-DD" type="date" placeholder="请选择" clearable />
                        </el-form-item>
                    </el-col>
                </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="交货日期:" prop="entryDate">
              <el-date-picker style="width: 100%" v-model="form.deliveryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
                              type="date" placeholder="请选择" clearable />
            </el-form-item>
          </el-col>
        </el-row>
                <el-row :gutter="30">
                    <el-col :span="12">
                        <el-form-item label="交货日期:" prop="entryDate">
                            <el-date-picker style="width: 100%" v-model="form.deliveryDate" 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="produce">
                            <el-radio-group v-model="form.produce">
                                <el-radio :label="true">是</el-radio>
                                <el-radio :label="false">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-form-item label="产品信息:" prop="entryDate">
                        <el-button v-if="operationType !== 'view'" type="primary" @click="openProductForm('add')">添加</el-button>
                        <el-button v-if="operationType !== 'view'" plain type="danger" @click="deleteProduct" >删除</el-button>
                        <el-button v-if="operationType !== 'view'" type="primary"
                            @click="openProductForm('add')">添加</el-button>
                        <el-button v-if="operationType !== 'view'" plain type="danger"
                            @click="deleteProduct">删除</el-button>
                    </el-form-item>
                </el-row>
                <el-table :data="productData" border @selection-change="productSelected" show-summary
                                    :summary-method="summarizeMainTable">
                    :summary-method="summarizeMainTable">
                    <el-table-column align="center" type="selection" width="55" v-if="operationType !== 'view'"
                        :selectable="(row) => !isProductShipped(row)" />
                    <el-table-column align="center" label="序号" type="index" width="60" />
@@ -235,27 +246,29 @@
                    <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" v-if="operationType !== 'view'">
                    <el-table-column fixed="right" label="操作" min-width="60" align="center"
                        v-if="operationType !== 'view'">
                        <template #default="scope">
                            <el-button link type="primary" size="small"
                                :disabled="isProductShipped(scope.row)"
                                @click="openProductForm('edit', scope.row,scope.$index)">编辑</el-button>
                            <el-button link type="primary" size="small" :disabled="isProductShipped(scope.row)"
                                @click="openProductForm('edit', scope.row, scope.$index)">编辑</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <el-row :gutter="30">
                    <el-col :span="24">
                        <el-form-item label="备注:" prop="remarks">
                            <el-input v-model="form.remarks" placeholder="请输入" clearable type="textarea" :rows="2" :disabled="operationType === 'view'" />
                            <el-input v-model="form.remarks" placeholder="请输入" clearable type="textarea" :rows="2"
                                :disabled="operationType === 'view'" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="24">
                        <el-form-item label="附件材料:" prop="salesLedgerFiles">
                            <el-upload v-model:file-list="fileList" :action="upload.url" multiple ref="fileUpload" auto-upload
                                                 :headers="upload.headers" :before-upload="handleBeforeUpload" :on-error="handleUploadError"
                                                 :on-success="handleUploadSuccess" :on-remove="handleRemove">
                            <el-upload v-model:file-list="fileList" :action="upload.url" multiple ref="fileUpload"
                                auto-upload :headers="upload.headers" :before-upload="handleBeforeUpload"
                                :on-error="handleUploadError" :on-success="handleUploadSuccess"
                                :on-remove="handleRemove">
                                <el-button type="primary" v-if="operationType !== 'view'">上传</el-button>
                                <template #tip v-if="operationType !== 'view'">
                                    <div class="el-upload__tip">
@@ -271,38 +284,17 @@
        </FormDialog>
        <!-- 从报价单导入(仅审批通过) -->
        <el-dialog
            v-model="quotationDialogVisible"
            title="选择审批通过的销售报价单"
            width="80%"
            :close-on-click-modal="false"
        >
        <el-dialog v-model="quotationDialogVisible" title="选择审批通过的销售报价单" width="80%" :close-on-click-modal="false">
            <div style="margin-bottom: 12px; display:flex; gap: 12px; align-items:center;">
                <el-input
                    v-model="quotationSearchForm.quotationNo"
                    placeholder="请输入报价单号"
                    clearable
                    style="max-width: 260px;"
                    @change="fetchQuotationList"
                />
                <el-input
                    v-model="quotationSearchForm.customer"
                    placeholder="请输入客户名称"
                    clearable
                    style="max-width: 260px;"
                    @change="fetchQuotationList"
                />
                <el-input v-model="quotationSearchForm.quotationNo" placeholder="请输入报价单号" clearable
                    style="max-width: 260px;" @change="fetchQuotationList" />
                <el-input v-model="quotationSearchForm.customer" placeholder="请输入客户名称" clearable
                    style="max-width: 260px;" @change="fetchQuotationList" />
                <el-button type="primary" @click="fetchQuotationList">搜索</el-button>
                <el-button @click="resetQuotationSearch">重置</el-button>
            </div>
            <el-table
                :data="quotationList"
                border
                stripe
                v-loading="quotationLoading"
                height="420px"
            >
            <el-table :data="quotationList" border stripe v-loading="quotationLoading" height="420px">
                <el-table-column align="center" label="序号" type="index" width="60" />
                <el-table-column prop="quotationNo" label="报价单号" width="180" show-overflow-tooltip />
                <el-table-column prop="customer" label="客户名称" min-width="220" show-overflow-tooltip />
@@ -320,56 +312,47 @@
                    </template>
                </el-table-column>
            </el-table>
            <pagination
                v-show="quotationPage.total > 0"
                :total="quotationPage.total"
                layout="total, sizes, prev, pager, next, jumper"
                :page="quotationPage.current"
                :limit="quotationPage.size"
                @pagination="quotationPaginationChange"
            />
            <pagination v-show="quotationPage.total > 0" :total="quotationPage.total"
                layout="total, sizes, prev, pager, next, jumper" :page="quotationPage.current"
                :limit="quotationPage.size" @pagination="quotationPaginationChange" />
            <template #footer>
                <el-button @click="quotationDialogVisible = false">关闭</el-button>
            </template>
        </el-dialog>
        <FormDialog
            v-model="productFormVisible"
            :title="productOperationType === 'add' ? '新增产品' : '编辑产品'"
            :width="'40%'"
            :operation-type="productOperationType"
            @close="closeProductDia"
            @confirm="submitProduct"
        <FormDialog v-model="productFormVisible" :title="productOperationType === 'add' ? '新增产品' : '编辑产品'"
            :width="'40%'" :operation-type="productOperationType" @close="closeProductDia" @confirm="submitProduct"
            @cancel="closeProductDia">
            <el-form :model="productForm" label-width="140px" label-position="top" :rules="productRules" ref="productFormRef">
            <el-form :model="productForm" label-width="140px" label-position="top" :rules="productRules"
                ref="productFormRef">
                <el-row :gutter="30">
                    <el-col :span="24">
                        <el-form-item label="产品大类:" prop="productCategory">
                            <!-- <el-select v-model="productForm.productCategory" placeholder="请选择" clearable>
                                <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/>
                            </el-select> -->
                            <el-tree-select v-model="productForm.productCategory" placeholder="请选择" clearable check-strictly
                                                            @change="getModels" :data="productOptions" :render-after-expand="false" style="width: 100%" />
                            <el-tree-select v-model="productForm.productCategory" placeholder="请选择" clearable
                                check-strictly @change="getModels" :data="productOptions" :render-after-expand="false"
                                style="width: 100%" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="24">
                        <el-form-item label="规格型号:" prop="productModelId">
                            <el-select v-model="productForm.productModelId" placeholder="请选择" clearable @change="getProductModel" filterable>
                                <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id" />
                            <el-select v-model="productForm.productModelId" placeholder="请选择" clearable
                                @change="getProductModel" filterable>
                                <el-option v-for="item in modelOptions" :key="item.id" :label="item.model"
                                    :value="item.id" />
                            </el-select>
                        </el-form-item>
                    </el-col>
          <el-col :span="24">
            <el-form-item label="料号:"
                          prop="materialCode">
              <el-input v-model="productForm.materialCode"
                        placeholder="请输入"
                        disabled />
            </el-form-item>
          </el-col>
                    <el-col :span="24">
                        <el-form-item label="料号:" prop="materialCode">
                            <el-input v-model="productForm.materialCode" placeholder="请输入" disabled />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="12">
@@ -379,7 +362,8 @@
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="税率(%):" prop="taxRate">
                            <el-select v-model="productForm.taxRate" placeholder="请选择" clearable @change="calculateFromTaxRate">
                            <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" />
@@ -390,28 +374,29 @@
                <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%"
                                                             :precision="2"
                                                             placeholder="请输入" clearable @change="calculateFromUnitPrice" />
                            <el-input-number :step="0.01" :min="0" v-model="productForm.taxInclusiveUnitPrice"
                                style="width: 100%" :precision="2" 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
                                                                :precision="2"
                                                                @change="calculateFromQuantity" style="width: 100%" />
                            <el-input-number :step="0.1" :min="0" v-model="productForm.quantity" placeholder="请输入"
                                clearable :precision="2" @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 @change="calculateFromTotalPrice" />
                            <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 @change="calculateFromExclusiveTotalPrice" />
                            <el-input v-model="productForm.taxExclusiveTotalPrice" placeholder="请输入" clearable
                                @change="calculateFromExclusiveTotalPrice" />
                        </el-form-item>
                    </el-col>
                </el-row>
@@ -428,28 +413,12 @@
            </el-form>
        </FormDialog>
        <!-- 导入弹窗 -->
        <FormDialog
            v-model="importUpload.open"
            :title="importUpload.title"
            :width="'600px'"
            @close="importUpload.open = false"
            @confirm="submitImportFile"
            @cancel="importUpload.open = false"
        >
            <el-upload
                ref="importUploadRef"
                :limit="1"
                accept=".xlsx,.xls"
                :action="importUpload.url"
                :headers="importUpload.headers"
                :before-upload="importUpload.beforeUpload"
                :on-success="importUpload.onSuccess"
                :on-error="importUpload.onError"
                :on-progress="importUpload.onProgress"
                :on-change="importUpload.onChange"
                :auto-upload="false"
                drag
            >
        <FormDialog v-model="importUpload.open" :title="importUpload.title" :width="'600px'"
            @close="importUpload.open = false" @confirm="submitImportFile" @cancel="importUpload.open = false">
            <el-upload ref="importUploadRef" :limit="1" accept=".xlsx,.xls" :action="importUpload.url"
                :headers="importUpload.headers" :before-upload="importUpload.beforeUpload"
                :on-success="importUpload.onSuccess" :on-error="importUpload.onError"
                :on-progress="importUpload.onProgress" :on-change="importUpload.onChange" :auto-upload="false" drag>
                <i class="el-icon-upload"></i>
                <div class="el-upload__text">
                    将文件拖到此处,或<em>点击上传</em>
@@ -463,19 +432,10 @@
            </el-upload>
        </FormDialog>
        <!-- 附件列表弹窗 -->
        <FileListDialog
            ref="fileListRef"
            v-model="fileListDialogVisible"
            title="附件列表"
        />
        <FileListDialog ref="fileListRef" v-model="fileListDialogVisible" title="附件列表" />
        <!-- 打印预览弹窗 -->
        <el-dialog
            v-model="printPreviewVisible"
            title="打印预览"
            width="90%"
            :close-on-click-modal="false"
            class="print-preview-dialog"
        >
        <el-dialog v-model="printPreviewVisible" title="打印预览" width="90%" :close-on-click-modal="false"
            class="print-preview-dialog">
            <div class="print-preview-container">
                <div class="print-preview-header">
                    <el-button type="primary" @click="executePrint">执行打印</el-button>
@@ -485,7 +445,8 @@
                    <div v-if="printData.length === 0" style="text-align: center; padding: 50px; color: #999;">
                        暂无打印数据
                    </div>
                    <div v-else style="text-align: center; padding: 10px; color: #666; font-size: 14px; background: #e8f4fd; margin-bottom: 10px;">
                    <div v-else
                        style="text-align: center; padding: 10px; color: #666; font-size: 14px; background: #e8f4fd; margin-bottom: 10px;">
                        共 {{ printData.length }} 条数据待打印
                    </div>
                    <div v-for="(item, index) in printData" :key="index" class="print-page">
@@ -494,126 +455,120 @@
                                <div class="company-name">湖南鹏创电子有限公司</div>
                                <div class="document-title">送货单</div>
                            </div>
                            <div class="info-section">
                                <div class="info-row">
                  <div>
                    <span class="label">客户名称:</span>
                    <span class="value">{{ item.customerName }}</span>
                  </div>
                  <div>
                    <span class="label">送货地址:</span>
                    <span class="value">{{ item.companyAddress }}</span>
                  </div>
                                    <div>
                                        <span class="label">客户名称:</span>
                                        <span class="value">{{ item.customerName }}</span>
                                    </div>
                                    <div>
                                        <span class="label">送货地址:</span>
                                        <span class="value">{{ item.companyAddress }}</span>
                                    </div>
                                </div>
                                <div class="info-row">
                  <div>
                    <span class="label">单据编号:</span>
                    <span class="value">{{ item.salesContractNo }}</span>
                  </div>
                                    <div>
                                        <span class="label">单据编号:</span>
                                        <span class="value">{{ item.salesContractNo }}</span>
                                    </div>
                  <div>
                    <span class="label">送货日期:</span>
                    <span class="value">{{ formatDate(null) }}</span>
                  </div>
                                    <div>
                                        <span class="label">送货日期:</span>
                                        <span class="value">{{ formatDate(null) }}</span>
                                    </div>
                  <div>
                    <span class="label">联系电话:</span>
                    <span class="value">{{ item.contactPhone }}</span>
                  </div>
                                    <div>
                                        <span class="label">联系电话:</span>
                                        <span class="value">{{ item.contactPhone }}</span>
                                    </div>
                                </div>
                            </div>
              <div class="info-section">
                <div class="info-row">
                  <div>
                    <span class="label">联系方式:</span>
                    <span class="value"></span>
                  </div>
                  <div>
                    <span class="label">送货单位:</span>
                    <span class="value">湖南鹏创电子有限公司</span>
                  </div>
                  <div>
                    <span class="label">地址:</span>
                    <span class="value">湖南耒阳市创新创业园A1栋</span>
                  </div>
                </div>
              </div>
                            <div class="info-section">
                                <div class="info-row">
                                    <div>
                                        <span class="label">联系方式:</span>
                                        <span class="value"></span>
                                    </div>
                                    <div>
                                        <span class="label">送货单位:</span>
                                        <span class="value">湖南鹏创电子有限公司</span>
                                    </div>
                                    <div>
                                        <span class="label">地址:</span>
                                        <span class="value">湖南耒阳市创新创业园A1栋</span>
                                    </div>
                                </div>
                            </div>
              <span style="font-size: 16px;">货物详细信息:</span>
                            <span style="font-size: 16px;">货物详细信息:</span>
                            <div class="table-section">
                                <table class="product-table">
                                    <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>料号</th>
                                        <th>品名/规格</th>
                                        <th>单位</th>
                                        <th>数量</th>
                                        <th>订单号</th>
                                    </tr>
                                        <tr>
                                            <th>序号</th>
                                            <th>料号</th>
                                            <th>品名/规格</th>
                                            <th>单位</th>
                                            <th>数量</th>
                                            <th>订单号</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    <tr v-for="(product, index) in item.products" :key="product.id">
                                        <td>{{ index + 1 }}</td>
                                        <td>{{ product.materialCode || '' }}</td>
                                        <td>{{`${product.productCategory || ''}/${product.specificationModel || ''}` }}</td>
                                        <td>{{ product.unit || '' }}</td>
                                        <td>{{ product.quantity || '0' }}</td>
                                        <td>{{ item.salesContractNo || '' }}</td>
                                    </tr>
                                    <tr v-if="!item.products || item.products.length === 0">
                                        <td colspan="6" style="text-align: center; color: #999;">暂无产品数据</td>
                                    </tr>
                                        <tr v-for="(product, index) in item.products" :key="product.id">
                                            <td>{{ index + 1 }}</td>
                                            <td>{{ product.materialCode || '' }}</td>
                                            <td>{{ `${product.productCategory || ''}/${product.specificationModel || ''}`
                                                }}</td>
                                            <td>{{ product.unit || '' }}</td>
                                            <td>{{ product.quantity || '0' }}</td>
                                            <td>{{ item.salesContractNo || '' }}</td>
                                        </tr>
                                        <tr v-if="!item.products || item.products.length === 0">
                                            <td colspan="6" style="text-align: center; color: #999;">暂无产品数据</td>
                                        </tr>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td class="label"></td>
                                        <td class="label">合计</td>
                                        <td class="total-value"></td>
                                        <td class="total-value"></td>
                                        <td class="total-value">{{ getTotalQuantity(item.products) }}</td>
                                        <td class="total-value"></td>
                                    </tr>
                                        <tr>
                                            <td class="label"></td>
                                            <td class="label">合计</td>
                                            <td class="total-value"></td>
                                            <td class="total-value"></td>
                                            <td class="total-value">{{ getTotalQuantity(item.products) }}</td>
                                            <td class="total-value"></td>
                                        </tr>
                                    </tfoot>
                                </table>
                <div style="width: 30px;">
                  共四联存根回单客户仓库
                </div>
                                <div style="width: 30px;">
                                    共四联存根回单客户仓库
                                </div>
                            </div>
              <el-descriptions :column="1">
                <el-descriptions-item label="备注:">贵公司在收货后请即刻核实数量及品质,若有异议,请在3日内提出,否则视为收妥。</el-descriptions-item>
              </el-descriptions>
              <el-descriptions :column="2">
                <el-descriptions-item label="送货单位(签章):"/>
                <el-descriptions-item label="收货单位:"/>
                <el-descriptions-item label="送货人:"/>
                <el-descriptions-item label="收货人:"/>
              </el-descriptions>
                            <el-descriptions :column="1">
                                <el-descriptions-item
                                    label="备注:">贵公司在收货后请即刻核实数量及品质,若有异议,请在3日内提出,否则视为收妥。</el-descriptions-item>
                            </el-descriptions>
                            <el-descriptions :column="2">
                                <el-descriptions-item label="送货单位(签章):" />
                                <el-descriptions-item label="收货单位:" />
                                <el-descriptions-item label="送货人:" />
                                <el-descriptions-item label="收货人:" />
                            </el-descriptions>
                        </div>
                    </div>
                </div>
            </div>
        </el-dialog>
        <!-- 发货弹框 -->
        <el-dialog
            v-model="deliveryFormVisible"
            title="发货信息"
        width="40%"
            @close="closeDeliveryDia"
        >
            <el-form :model="deliveryForm" label-width="120px" label-position="top" :rules="deliveryRules" ref="deliveryFormRef">
        <el-dialog v-model="deliveryFormVisible" title="发货信息" width="40%" @close="closeDeliveryDia">
            <el-form :model="deliveryForm" label-width="120px" label-position="top" :rules="deliveryRules"
                ref="deliveryFormRef">
                <el-row :gutter="30">
                    <el-col :span="24">
                        <el-form-item label="发货类型:" prop="type">
                            <el-select
                                v-model="deliveryForm.type"
                                placeholder="请选择发货类型"
                                style="width: 100%"
                            >
                            <el-select v-model="deliveryForm.type" placeholder="请选择发货类型" style="width: 100%">
                                <el-option label="货车" value="货车" />
                                <el-option label="快递" value="快递" />
                            </el-select>
@@ -621,50 +576,36 @@
                    </el-col>
                </el-row>
        <!-- 审批人选择(仿协同审批里的审批人节点选择) -->
        <el-row>
          <el-col :span="24">
            <el-form-item>
              <template #label>
                <span>审批人选择:</span>
                <el-button type="primary" @click="addApproverNode" style="margin-left: 8px;">新增节点</el-button>
              </template>
              <div style="display: flex; align-items: flex-end; flex-wrap: wrap;">
                <div
                  v-for="(node, index) in approverNodes"
                  :key="node.id"
                  style="margin-right: 20px; text-align: center; margin-bottom: 10px;"
                >
                  <div>
                    <span>审批人</span>
                    →
                  </div>
                  <el-select
                    v-model="node.userId"
                    placeholder="选择人员"
                    filterable
                    style="width: 140px; margin-bottom: 8px;"
                  >
                    <el-option
                      v-for="user in userList"
                      :key="user.userId"
                      :label="user.nickName"
                      :value="user.userId"
                    />
                  </el-select>
                  <div>
                    <el-button
                      type="danger"
                      size="small"
                      @click="removeApproverNode(index)"
                      v-if="approverNodes.length > 1"
                    >删除</el-button>
                  </div>
                </div>
              </div>
            </el-form-item>
          </el-col>
        </el-row>
                <!-- 审批人选择(仿协同审批里的审批人节点选择) -->
                <el-row>
                    <el-col :span="24">
                        <el-form-item>
                            <template #label>
                                <span>审批人选择:</span>
                                <el-button type="primary" @click="addApproverNode"
                                    style="margin-left: 8px;">新增节点</el-button>
                            </template>
                            <div style="display: flex; align-items: flex-end; flex-wrap: wrap;">
                                <div v-for="(node, index) in approverNodes" :key="node.id"
                                    style="margin-right: 20px; text-align: center; margin-bottom: 10px;">
                                    <div>
                                        <span>审批人</span>
                                        →
                                    </div>
                                    <el-select v-model="node.userId" placeholder="选择人员" filterable
                                        style="width: 140px; margin-bottom: 8px;">
                                        <el-option v-for="user in userList" :key="user.userId" :label="user.nickName"
                                            :value="user.userId" />
                                    </el-select>
                                    <div>
                                        <el-button type="danger" size="small" @click="removeApproverNode(index)"
                                            v-if="approverNodes.length > 1">删除</el-button>
                                    </div>
                                </div>
                            </div>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <template #footer>
                <div class="dialog-footer">
@@ -679,7 +620,7 @@
<script setup>
import { getToken } from "@/utils/auth";
import pagination from "@/components/PIMTable/Pagination.vue";
import {onMounted, ref, getCurrentInstance} from "vue";
import { onMounted, ref, getCurrentInstance } from "vue";
import { addShippingInfo } from "@/api/salesManagement/deliveryLedger.js";
import { ElMessageBox, ElMessage } from "element-plus";
import { UploadFilled, Download } from "@element-plus/icons-vue";
@@ -739,7 +680,8 @@
        customerId: "",
        entryPerson: "",
        entryDate: "",
    deliveryDate: "",
        deliveryDate: "",
        produce: false,
        maintenanceTime: "",
        productData: [],
        executionDate: "",
@@ -749,7 +691,7 @@
        customerId: [{ required: true, message: "请选择", trigger: "change" }],
        entryPerson: [{ required: true, message: "请选择", trigger: "change" }],
        entryDate: [{ required: true, message: "请选择", trigger: "change" }],
    deliveryDate: [{ required: true, message: "请选择", trigger: "change" }],
        deliveryDate: [{ required: true, message: "请选择", trigger: "change" }],
        executionDate: [{ required: true, message: "请选择", trigger: "change" }],
    },
});
@@ -763,7 +705,7 @@
    productForm: {
        productCategory: "",
        specificationModel: "",
    materialCode: "",
        materialCode: "",
        unit: "",
        quantity: "",
        taxInclusiveUnitPrice: "",
@@ -826,14 +768,14 @@
const deliveryFormVisible = ref(false);
const currentDeliveryRow = ref(null);
const deliveryFormData = reactive({
  deliveryForm: {
    type: "货车", // 货车, 快递
  },
  deliveryRules: {
    type: [
      { required: true, message: "请选择发货类型", trigger: "change" }
    ]
  },
    deliveryForm: {
        type: "货车", // 货车, 快递
    },
    deliveryRules: {
        type: [
            { required: true, message: "请选择发货类型", trigger: "change" }
        ]
    },
});
const { deliveryForm, deliveryRules } = toRefs(deliveryFormData);
@@ -841,10 +783,10 @@
const approverNodes = ref([{ id: 1, userId: null }]);
let nextApproverId = 2;
const addApproverNode = () => {
  approverNodes.value.push({ id: nextApproverId++, userId: null });
    approverNodes.value.push({ id: nextApproverId++, userId: null });
};
const removeApproverNode = (index) => {
  approverNodes.value.splice(index, 1);
    approverNodes.value.splice(index, 1);
};
// 导入相关
@@ -966,11 +908,11 @@
    if (index !== -1) {
        productForm.value.specificationModel = modelOptions.value[index].model;
        productForm.value.unit = modelOptions.value[index].unit;
    productForm.value.materialCode = modelOptions.value[index].materialCode;
        productForm.value.materialCode = modelOptions.value[index].materialCode;
    } else {
        productForm.value.specificationModel = null;
        productForm.value.unit = null;
    productForm.value.materialCode = null;
        productForm.value.materialCode = null;
    }
};
const findNodeById = (nodes, productId) => {
@@ -997,7 +939,7 @@
        if (children && children.length > 0) {
            newItem.children = convertIdToValue(children);
        }
        return newItem;
    });
}
@@ -1046,19 +988,19 @@
// 添加表行类名方法
const tableRowClassName = ({ row }) => {
  if (!row.deliveryDate) return '';
  if (row.isFh) return '';
    if (!row.deliveryDate) return '';
    if (row.isFh) return '';
  const diff = row.deliveryDaysDiff;
  if (diff === 15) {
    return 'yellow';
  } else if (diff === 10) {
    return 'pink';
  } else if (diff === 2) {
    return 'purple';
  } else if (diff < 2) {
    return 'red';
  }
    const diff = row.deliveryDaysDiff;
    if (diff === 15) {
        return 'yellow';
    } else if (diff === 10) {
        return 'pink';
    } else if (diff === 2) {
        return 'purple';
    } else if (diff < 2) {
        return 'red';
    }
};
// 主表合计方法
const summarizeMainTable = (param) => {
@@ -1093,6 +1035,8 @@
        form.value.entryDate = getCurrentDate();
        // 签订日期默认为当天
        form.value.executionDate = getCurrentDate();
        // 是否生产默认为否
        form.value.produce = false;
    } else {
        currentId.value = row.id;
        getSalesLedgerWithProducts({ id: row.id, type: 1 }).then((res) => {
@@ -1166,10 +1110,10 @@
const applyQuotation = (row) => {
    if (!row) return;
    selectedQuotation.value = row;
    // 业务员
    form.value.salesman = (row.salesperson || "").trim();
    // 客户名称 -> customerId
    const qCustomerName = String(row.customer || "").trim();
    const customer = (customerOption.value || []).find((c) => {
@@ -1182,7 +1126,7 @@
        // 如果找不到,保留原值(允许用户手动选择/不打断已有输入)
        form.value.customerId = form.value.customerId || "";
    }
    // 产品信息映射:报价 products -> 台账 productData
    const products = Array.isArray(row.products) ? row.products : [];
    productData.value = products.map((p) => {
@@ -1204,7 +1148,7 @@
            invoiceType: "增普票",
        };
    });
    quotationDialogVisible.value = false;
};
function changs(val) {
@@ -1285,7 +1229,7 @@
        proxy.$modal.msgWarning("已发货或审核通过的产品不能编辑");
        return;
    }
    productOperationType.value = type;
    productForm.value = {};
    proxy.resetForm("productFormRef");
@@ -1325,9 +1269,9 @@
            if (operationType.value === "edit") {
                submitProductEdit();
            } else {
                if(productOperationType.value === "add"){
                if (productOperationType.value === "add") {
                    productData.value.push({ ...productForm.value });
                }else{
                } else {
                    productData.value[productIndex.value] = { ...productForm.value }
                }
                closeProductDia();
@@ -1352,14 +1296,14 @@
        proxy.$modal.msgWarning("请选择数据");
        return;
    }
    // 检查是否有已发货或审核通过的产品
    const shippedProducts = productSelectedRows.value.filter(row => isProductShipped(row));
    if (shippedProducts.length > 0) {
        proxy.$modal.msgWarning("已发货或审核通过的产品不能删除");
        return;
    }
    if (operationType.value === "add") {
        productSelectedRows.value.forEach((selectedRow) => {
            const index = productData.value.findIndex(
@@ -1505,25 +1449,25 @@
        proxy.$modal.msgWarning("请选择要打印的数据");
        return;
    }
    // 显示加载状态
    proxy.$modal.loading("正在获取产品数据,请稍候...");
    try {
        // 为每个选中的销售台账记录查询对应的产品数据
        const printDataWithProducts = [];
        for (const row of selectedRows.value) {
            try {
                // 调用productList接口查询产品数据
                const productRes = await productList({ salesLedgerId: row.id, type: 1 });
                // 将产品数据整合到销售台账记录中
                const rowWithProducts = {
                    ...row,
                    products: productRes.data || []
                };
                printDataWithProducts.push(rowWithProducts);
            } catch (error) {
                console.error(`获取销售台账 ${row.id} 的产品数据失败:`, error);
@@ -1534,11 +1478,11 @@
                });
            }
        }
        printData.value = printDataWithProducts;
        console.log('打印数据(包含产品):', printData.value);
        printPreviewVisible.value = true;
    } catch (error) {
        console.error('获取产品数据失败:', error);
        proxy.$modal.msgError("获取产品数据失败,请重试");
@@ -1550,10 +1494,10 @@
const executePrint = () => {
    console.log('开始执行打印,数据条数:', printData.value.length);
    console.log('打印数据:', printData.value);
    // 创建一个新的打印窗口
    const printWindow = window.open('', '_blank', 'width=800,height=600');
    // 构建打印内容
    let printContent = `
    <!DOCTYPE html>
@@ -1743,7 +1687,7 @@
    </head>
    <body>
  `;
    // 为每条数据生成打印页面
    printData.value.forEach((item, index) => {
        printContent += `
@@ -1772,7 +1716,7 @@
                <div>
                  <span class="label">送货日期:</span>
                  <span class="value">${ formatDate(null)}</span>
                  <span class="value">${formatDate(null)}</span>
                </div>
                <div>
@@ -1814,7 +1758,7 @@
              </thead>
                  <tbody>
                ${item.products && item.products.length > 0 ?
        item.products.map((product, index) => `
                item.products.map((product, index) => `
                    <tr>
                      <td>${index + 1}</td>
                      <td>${product.materialCode || ''}</td>
@@ -1824,8 +1768,8 @@
                      <td>${item.salesContractNo || ''}</td>
                    </tr>
                  `).join('') :
        '<tr><td colspan="6" style="text-align: center; color: #999;">暂无产品数据</td></tr>'
    }
                '<tr><td colspan="6" style="text-align: center; color: #999;">暂无产品数据</td></tr>'
            }
              </tbody>
              <tfoot>
                <tr>
@@ -1833,7 +1777,7 @@
                  <td class="label">合计</td>
                  <td class="total-value"></td>
                  <td class="total-value"></td>
                  <td class="total-value">${ getTotalQuantity(item.products) || '0'}</td>
                  <td class="total-value">${getTotalQuantity(item.products) || '0'}</td>
                  <td class="total-value"></td>
                </tr>
              </tfoot>
@@ -1873,16 +1817,16 @@
      </div>
    `;
    });
    printContent += `
    </body>
    </html>
  `;
    // 写入内容到新窗口
    printWindow.document.write(printContent);
    printWindow.document.close();
    // 等待内容加载完成后打印
    printWindow.onload = () => {
        setTimeout(() => {
@@ -1974,19 +1918,19 @@
// 根据含税总价计算含税单价和数量
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 =
@@ -1995,7 +1939,7 @@
                productForm.value.taxRate
            );
    }
    isCalculating.value = false;
};
@@ -2006,25 +1950,25 @@
        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;
};
@@ -2035,19 +1979,19 @@
        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 =
@@ -2056,7 +2000,7 @@
                productForm.value.taxRate
            );
    }
    isCalculating.value = false;
};
@@ -2067,19 +2011,19 @@
        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 =
@@ -2088,7 +2032,7 @@
                productForm.value.taxRate
            );
    }
    isCalculating.value = false;
};
@@ -2099,23 +2043,23 @@
        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;
};
/**
@@ -2127,15 +2071,15 @@
    if (row.shippingDate || row.shippingCarNumber) {
        return '已发货';
    }
    // 获取发货状态字段
    const status = row.shippingStatus;
    // 如果状态为空或未定义,默认为"待发货"
    if (status === null || status === undefined || status === '') {
        return '待发货';
    }
    // 状态是字符串
    const statusStr = String(status).trim();
    const statusTextMap = {
@@ -2158,15 +2102,15 @@
    if (row.shippingDate || row.shippingCarNumber) {
        return 'success';
    }
    // 获取发货状态字段
    const status = row.shippingStatus;
    // 如果状态为空或未定义,默认为灰色(待发货)
    if (status === null || status === undefined || status === '') {
        return 'info';
    }
    // 状态是字符串
    const statusStr = String(status).trim();
    const typeTextMap = {
@@ -2190,15 +2134,15 @@
    if (row.approveStatus !== 1) {
        return false;
    }
    // 获取发货状态
    const shippingStatus = row.shippingStatus;
    // 如果已发货(有发货日期或车牌号),不能再次发货
    if (row.shippingDate || row.shippingCarNumber) {
        return false;
    }
    // 发货状态必须是"待发货"或"审核拒绝"
    const statusStr = shippingStatus ? String(shippingStatus).trim() : '';
    return statusStr === '待发货' || statusStr === '审核拒绝';
@@ -2226,69 +2170,69 @@
        proxy.$modal.msgWarning("只有在产品状态是充足,发货状态是待发货或审核拒绝的时候才可以发货");
        return;
    }
    currentDeliveryRow.value = row;
  deliveryForm.value = {
    type: "货车",
  };
  // 重置审批人节点(默认一个空节点)
  approverNodes.value = [{ id: 1, userId: null }];
  nextApproverId = 2;
    deliveryForm.value = {
        type: "货车",
    };
    // 重置审批人节点(默认一个空节点)
    approverNodes.value = [{ id: 1, userId: null }];
    nextApproverId = 2;
    deliveryFormVisible.value = true;
};
// 提交发货表单
const submitDelivery = () => {
  proxy.$refs["deliveryFormRef"].validate((valid) => {
    if (valid) {
      // 审批人必填校验(所有节点都要选人)
      const hasEmptyApprover = approverNodes.value.some(node => !node.userId);
      if (hasEmptyApprover) {
        proxy.$modal.msgError("请为所有审批节点选择审批人!");
        return;
      }
      const approveUserIds = approverNodes.value.map(node => node.userId).join(",");
      // 保存当前展开的行ID,以便发货后重新加载子表格数据
      const currentExpandedKeys = [...expandedRowKeys.value];
      const salesLedgerId = currentDeliveryRow.value.salesLedgerId;
      addShippingInfo({
        salesLedgerId: salesLedgerId,
        salesLedgerProductId: currentDeliveryRow.value.id,
        type: deliveryForm.value.type,
    proxy.$refs["deliveryFormRef"].validate((valid) => {
        if (valid) {
            // 审批人必填校验(所有节点都要选人)
            const hasEmptyApprover = approverNodes.value.some(node => !node.userId);
            if (hasEmptyApprover) {
                proxy.$modal.msgError("请为所有审批节点选择审批人!");
                return;
            }
            const approveUserIds = approverNodes.value.map(node => node.userId).join(",");
            // 保存当前展开的行ID,以便发货后重新加载子表格数据
            const currentExpandedKeys = [...expandedRowKeys.value];
            const salesLedgerId = currentDeliveryRow.value.salesLedgerId;
            addShippingInfo({
                salesLedgerId: salesLedgerId,
                salesLedgerProductId: currentDeliveryRow.value.id,
                type: deliveryForm.value.type,
                approveUserIds,
      })
        .then(() => {
          proxy.$modal.msgSuccess("发货成功");
          closeDeliveryDia();
          // 刷新主表数据
          getList().then(() => {
            // 如果之前有展开的行,重新加载这些行的子表格数据
            if (currentExpandedKeys.length > 0) {
              // 使用 Promise.all 并行加载所有展开行的子表格数据
              const loadPromises = currentExpandedKeys.map(ledgerId => {
                return productList({ salesLedgerId: ledgerId, type: 1 }).then((res) => {
                  const index = tableData.value.findIndex((item) => item.id === ledgerId);
                  if (index > -1) {
                    tableData.value[index].children = res.data;
                  }
                });
              });
              Promise.all(loadPromises).then(() => {
                // 恢复展开状态
                expandedRowKeys.value = currentExpandedKeys;
              });
            }
          });
        })
    }
  });
            })
                .then(() => {
                    proxy.$modal.msgSuccess("发货成功");
                    closeDeliveryDia();
                    // 刷新主表数据
                    getList().then(() => {
                        // 如果之前有展开的行,重新加载这些行的子表格数据
                        if (currentExpandedKeys.length > 0) {
                            // 使用 Promise.all 并行加载所有展开行的子表格数据
                            const loadPromises = currentExpandedKeys.map(ledgerId => {
                                return productList({ salesLedgerId: ledgerId, type: 1 }).then((res) => {
                                    const index = tableData.value.findIndex((item) => item.id === ledgerId);
                                    if (index > -1) {
                                        tableData.value[index].children = res.data;
                                    }
                                });
                            });
                            Promise.all(loadPromises).then(() => {
                                // 恢复展开状态
                                expandedRowKeys.value = currentExpandedKeys;
                            });
                        }
                    });
                })
        }
    });
};
// 关闭发货弹框
const closeDeliveryDia = () => {
  proxy.resetForm("deliveryFormRef");
  deliveryFormVisible.value = false;
  currentDeliveryRow.value = null;
    proxy.resetForm("deliveryFormRef");
    deliveryFormVisible.value = false;
    currentDeliveryRow.value = null;
};
const currentFactoryName = ref("");
const getCurrentFactoryName = async () => {
@@ -2310,19 +2254,19 @@
}
::v-deep .yellow {
  background-color: #FAF0DE;
    background-color: #FAF0DE;
}
::v-deep .pink {
  background-color: #FAE1DE;
    background-color: #FAE1DE;
}
::v-deep .red {
  background-color: #FAE1DE;
    background-color: #FAE1DE;
}
::v-deep .purple{
  background-color: #F4DEFA;
::v-deep .purple {
    background-color: #F4DEFA;
}
.table_list {
@@ -2334,6 +2278,7 @@
    justify-content: space-between;
    margin-bottom: 10px;
}
.print-preview-dialog {
    .el-dialog__body {
        padding: 0;
@@ -2347,12 +2292,12 @@
        padding: 15px;
        border-bottom: 1px solid #e4e7ed;
        text-align: center;
        .el-button {
            margin: 0 10px;
        }
    }
    .print-preview-content {
        padding: 20px;
        background-color: #f5f5f5;
@@ -2384,13 +2329,13 @@
.header {
    text-align: center;
    margin-bottom: 8px;
    .company-name {
        font-size: 18px;
        font-weight: bold;
        margin-bottom: 4px;
    }
    .document-title {
        font-size: 16px;
        font-weight: bold;
@@ -2402,16 +2347,16 @@
    display: flex;
    justify-content: space-between;
    align-items: center;
    .info-row {
        line-height: 20px;
        .label {
            font-weight: bold;
            width: 60px;
            font-size: 14px;
        }
        .value {
            margin-right: 20px;
            min-width: 80px;
@@ -2423,30 +2368,31 @@
.table-section {
    margin-bottom: 4px;
    flex: 1;
  display: flex;
    display: flex;
    .product-table {
        width: 100%;
        border-collapse: collapse;
        border: 1px solid #000;
        th, td {
        th,
        td {
            border: 1px solid #000;
            padding: 6px;
            text-align: center;
            font-size: 14px;
            line-height: 1.4;
        }
        th {
            font-weight: bold;
        }
        .total-label {
            text-align: right;
            font-weight: bold;
        }
        .total-value {
            font-weight: bold;
        }
@@ -2459,24 +2405,24 @@
        margin-bottom: 3px;
        line-height: 20px;
        justify-content: flex-start;
        .footer-item {
            display: flex;
      align-items: center;
            align-items: center;
            margin-right: 20px;
            .label {
                font-weight: bold;
        white-space: nowrap;
        margin-right: 10px;
                white-space: nowrap;
                margin-right: 10px;
                font-size: 14px;
            }
            .value {
                min-width: 300px;
                font-size: 14px;
            }
            &.address-item {
                .address-value {
                    min-width: 200px;
@@ -2490,7 +2436,7 @@
    .app-container {
        display: none;
    }
    .print-page {
        box-shadow: none;
        margin: 0;
@@ -2499,6 +2445,7 @@
        page-break-inside: avoid;
        page-break-after: always;
    }
    .print-page:last-child {
        page-break-after: avoid;
    }