ZN
2 天以前 5fc4e0f0cd2554eeaa911384ed87373aa4ee3c5f
src/views/salesManagement/salesLedger/index.vue
@@ -51,7 +51,9 @@
                                              width="100px"
                                              align="center">
                <template #default="scope">
                           <el-tag v-if="scope.row.approveStatus === 1"
               <el-tag v-if="getShippingStatusText(scope.row) === '已发货'"
                                       type="success">已出库</el-tag>
                           <el-tag v-else-if="scope.row.approveStatus === 2"
                                       type="success">充足</el-tag>
                           <el-tag v-else
                                       type="danger">不足</el-tag>
@@ -118,10 +120,11 @@
        <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">
        <el-table-column label="其它说明事项" prop="remarks" width="200" show-overflow-tooltip />
        <el-table-column fixed="right" label="操作" min-width="200" align="center">
          <template #default="scope">
            <el-button link type="primary" size="small" @click="openForm('edit', scope.row)">编辑</el-button>
            <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="exportSalesContracts(scope.row)">导出销售合同</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>-->
@@ -213,6 +216,11 @@
                              type="date" placeholder="请选择" clearable />
            </el-form-item>
          </el-col>
        <el-col :span="12">
            <el-form-item label="签订地点:" prop="placeOfSinging">
            <el-input v-model="form.placeOfSinging" placeholder="请输入" clearable :disabled="operationType === 'view'" />
            </el-form-item>
          </el-col>
        </el-row>
            <el-row>
               <el-form-item label="产品信息:" prop="entryDate">
@@ -243,7 +251,7 @@
            </el-table>
            <el-row :gutter="30">
               <el-col :span="24">
                  <el-form-item label="备注:" prop="remarks">
                  <el-form-item label="其它说明事项:" prop="remarks">
                     <el-input v-model="form.remarks" placeholder="请输入" clearable type="textarea" :rows="2" :disabled="operationType === 'view'" />
                  </el-form-item>
               </el-col>
@@ -318,6 +326,15 @@
               </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"
         />
         
         <template #footer>
            <el-button @click="quotationDialogVisible = false">关闭</el-button>
@@ -472,7 +489,7 @@
               <div v-for="(item, index) in printData" :key="index" class="print-page">
                  <div class="delivery-note">
                     <div class="header">
                        <div class="company-name">鼎诚瑞实业有限责任公司</div>
                        <div class="company-name">阳光印刷有限责任公司</div>
                        <div class="document-title">零售发货单</div>
                     </div>
                     
@@ -666,6 +683,7 @@
   addOrUpdateSalesLedgerProduct,
   delProduct,
   delLedgerFile, getProductInventory,
   exportSalesContract
} from "@/api/salesManagement/salesLedger.js";
import { modelList, productTreeList } from "@/api/basicData/product.js";
import useFormData from "@/hooks/useFormData.js";
@@ -719,6 +737,7 @@
      entryDate: [{ required: true, message: "请选择", trigger: "change" }],
    deliveryDate: [{ required: true, message: "请选择", trigger: "change" }],
      executionDate: [{ required: true, message: "请选择", trigger: "change" }],
      placeOfSinging: [{ required: true, message: "请输入", trigger: "blur" }],
   },
});
const { form, rules } = toRefs(data);
@@ -780,6 +799,12 @@
const quotationSearchForm = reactive({
   quotationNo: "",
   customer: "",
});
// 报价单弹框分页
const quotationPage = reactive({
   current: 1,
   size: 10,
   total: 0,
});
const selectedQuotation = ref(null);
@@ -1005,6 +1030,7 @@
// 添加表行类名方法
const tableRowClassName = ({ row }) => {
  if (!row.deliveryDate) return '';
  if (row.isFh) return '';
  const diff = row.deliveryDaysDiff;
@@ -1074,6 +1100,8 @@
const openQuotationDialog = async () => {
   if (operationType.value === "view") return;
   quotationDialogVisible.value = true;
   // 打开弹窗时重置分页到第一页
   quotationPage.current = 1;
   // 先确保客户列表已加载,便于后续回填 customerId
   if (!customerOption.value || customerOption.value.length === 0) {
      try {
@@ -1090,14 +1118,15 @@
   quotationLoading.value = true;
   try {
      const params = {
         // 兼容后端分页字段:这里沿用报价页面已有可用的字段命名
         currentPage: 1,
         pageSize: 100,
         // 后端分页字段:current / size
         current: quotationPage.current,
         size: quotationPage.size,
         ...quotationSearchForm,
         status: "通过",
      };
      const res = await getQuotationList(params);
      quotationList.value = res?.data?.records || [];
      quotationPage.total = res?.data?.total || 0;
   } finally {
      quotationLoading.value = false;
   }
@@ -1106,7 +1135,15 @@
const resetQuotationSearch = async () => {
   quotationSearchForm.quotationNo = "";
   quotationSearchForm.customer = "";
   quotationPage.current = 1;
   await fetchQuotationList();
};
// 报价单弹框分页切换
const quotationPaginationChange = (obj) => {
   quotationPage.current = obj.page;
   quotationPage.size = obj.limit;
   fetchQuotationList();
};
// 选中报价单后回填到台账表单
@@ -1384,6 +1421,7 @@
/** 判断单个产品是否已发货(根据shippingStatus判断,已发货或审核通过不可编辑和删除) */
const isProductShipped = (product) => {
   if (!product) return false;
   const status = String(product.shippingStatus || "").trim();
   // 如果发货状态是"已发货"或"审核通过",则不可编辑和删除
   return status === "已发货" || status === "审核通过";
@@ -1643,7 +1681,7 @@
      <div class="print-page">
        <div class="delivery-note">
          <div class="header">
            <div class="company-name">鼎诚瑞实业有限责任公司</div>
            <div class="company-name">阳光彩印有限责任公司</div>
            <div class="document-title">零售发货单</div>
          </div>
          
@@ -2065,6 +2103,34 @@
};
/**
 * 导出销售合同
 *
 * @param row 导出销售合同的相关信息对象
 */
const exportSalesContracts = (row) => {
   exportSalesContract({ id: row.id }).then((res) => {
      if (res) {
         const downloadUrl = window.URL.createObjectURL(res);
      const link = document.createElement('a');
      link.href = downloadUrl;
     console.log(row.executionDate)
      link.download = row.projectName+row.executionDate + "销售合同.docx"; // 设置下载文件名
      link.style.display = 'none'; // 隐藏a标签
      document.body.appendChild(link);
      link.click(); // 触发点击下载
      // 4. 清理资源(避免内存泄漏)
      document.body.removeChild(link);
      window.URL.revokeObjectURL(downloadUrl);
      // 5. 提示导出成功
      proxy.$modal.msgSuccess("导出销售合同成功");
      } else {
         proxy.$modal.msgError(res.msg || "导出销售合同失败");
      }
   });
}
/**
 * 下载文件
 *
 * @param row 下载文件的相关信息对象