maven
2025-12-03 067a7119d3175c9ea9b7c0d46b59df6e8ccb994c
src/views/salesManagement/salesLedger/index.vue
@@ -41,7 +41,7 @@
      </div>
      <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange"
        :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)">
        :summary-method="summarizeMainTable" @expand-change="expandChange" height="calc(100vh - 21em)">
        <el-table-column align="center" type="selection" width="55" />
        <el-table-column type="expand">
          <template #default="props">
@@ -72,7 +72,7 @@
        <el-table-column label="签订日期" prop="executionDate" width="120" show-overflow-tooltip />
        <el-table-column fixed="right" label="操作" min-width="200" align="center">
          <template #default="scope">
            <el-button link type="primary" size="small" :disabled="scope.row.invoiceTotal>0 || scope.row.entryPersonName !== userStore.nickName" @click="openForm('edit', scope.row)">编辑</el-button>
            <el-button link type="primary" size="small" @click="openForm('edit', 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>
@@ -93,7 +93,9 @@
          </el-col>
          <el-col :span="12">
            <el-form-item label="业务员:" prop="salesman">
              <el-select v-model="form.salesman" placeholder="请选择" clearable :disabled="operationType === 'view'">
              <el-select v-model="form.salesman"                 filterable
                         default-first-option
                         :reserve-keyword="false" placeholder="请选择" clearable :disabled="operationType === 'view'">
                <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
                  :value="item.nickName" />
              </el-select>
@@ -134,7 +136,9 @@
        <el-row :gutter="30">
               <el-col :span="12">
                  <el-form-item label="录入人:" prop="entryPerson">
                     <el-select v-model="form.entryPerson" placeholder="请选择" clearable @change="changs" disabled>
                     <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>
@@ -142,7 +146,7 @@
          <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 disabled />
                type="date" placeholder="请选择" clearable />
            </el-form-item>
          </el-col>
        </el-row>
@@ -165,6 +169,7 @@
          <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="speculativeTradingName" />
          <el-table-column label="单位" prop="unit" />
          <el-table-column label="数量" prop="quantity" />
          <el-table-column label="税率(%)" prop="taxRate" />
@@ -229,6 +234,13 @@
              <el-select v-model="productForm.productModelId" placeholder="请选择" clearable @change="getProductModel">
                <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="24">
            <el-form-item label="绑定机器:">
              <el-input v-model="productForm.speculativeTradingName" placeholder="请先选择规格型号" clearable disabled />
            </el-form-item>
          </el-col>
        </el-row>
@@ -551,6 +563,7 @@
    taxInclusiveTotalPrice: "",
    taxExclusiveTotalPrice: "",
    invoiceType: "",
    speculativeTradingName: "",
  },
  productRules: {
    productCategory: [{ required: true, message: "请选择", trigger: "change" }],
@@ -619,7 +632,11 @@
// 查询列表
/** 搜索按钮操作 */
const handleQuery = () => {
  page.current = 1;
  // 只有在点击搜索按钮时才重置页码到第一页
  // 避免表单字段change事件干扰分页
  if (arguments.length === 0) {
    page.current = 1;
  }
   expandedRowKeys.value = [];
  getList();
};
@@ -631,7 +648,11 @@
const getList = () => {
  tableLoading.value = true;
  const { entryDate, ...rest } = searchForm;
  ledgerListPage({ ...rest, ...page })
  // 将范围日期字段传递给后端
  const params = { ...rest, ...page };
  // 移除录入日期的默认值设置,只保留范围日期字段
  delete params.entryDate;
  ledgerListPage(params)
    .then((res) => {
      tableLoading.value = false;
      tableData.value = res.records;
@@ -666,9 +687,11 @@
  if (index !== -1) {
    productForm.value.specificationModel = modelOptions.value[index].model;
    productForm.value.unit = modelOptions.value[index].unit;
    productForm.value.speculativeTradingName = modelOptions.value[index].speculativeTradingName || "";
  } else {
    productForm.value.specificationModel = null;
    productForm.value.unit = null;
    productForm.value.speculativeTradingName = "";
  }
};
const findNodeById = (nodes, productId) => {
@@ -770,7 +793,7 @@
  //     form.value.entryPerson = userAll.user.userId // 设置默认业务员为当前用户
  //   }
  // });
  form.value.entryDate = getCurrentDate(); // 设置默认录入日期为当前日期
  // 移除录入日期默认值设置,只处理范围日期字段
  dialogFormVisible.value = true;
};
function changs(val) {
@@ -1526,7 +1549,7 @@
const openDeliveryForm = (row) => {
  currentDeliveryRow.value = row;
  deliveryForm.value = {
    shippingDate: getCurrentDate(),
    shippingDate: "", // 移除默认值设置
    shippingCarNumber: "",
  };
  deliveryFormVisible.value = true;
@@ -1561,7 +1584,13 @@
};
onMounted(() => {
   getList();
  // 设置录入日期范围默认值为当天
  const today = dayjs().format('YYYY-MM-DD');
  searchForm.entryDate = [today, today];
  // 设置范围日期字段的起始和结束时间
  searchForm.entryDateStart = today;
  searchForm.entryDateEnd = today;
  getList();
});
</script>