CD配唱片
2025-05-08 e3e17a37d85f50bace525ed019ee0cd8d39143eb
src/views/basicData/processRoute/index.vue
@@ -70,6 +70,7 @@
    <HxlhTable
      style="width: 100%"
      :columns="columns"
      :showOverflow="true"
      :virtualYConfig="virtualYConfig"
      :data="processRouteList"
      :loading="loading"
@@ -77,6 +78,9 @@
      @bottomAutoLoadMore="handleAutoLoadMore"
      @on-checkbox="handleCheckboxChange"
    >
      <template #rowIndex="{ rowIndex }">
        {{ rowIndex }}
      </template>
    </HxlhTable>
    <!-- 用户导入对话框 -->
    <el-dialog
@@ -200,10 +204,11 @@
  processRouteTempList,
  confirmProcessRoute,
} from "@/api/basicData/processRoute";
import { throttle } from "@/utils/throttle";
import HxlhTable from "@/components/HxlhTable";
import { getToken } from "@/utils/auth";
import { ref } from "vue";
import { ElMessage } from "element-plus";
// import { ElMessage } from "element-plus";
const { proxy } = getCurrentInstance();
const processRouteList = ref([]);
@@ -217,7 +222,7 @@
const title = ref("");
const daterangeIntegrationDay = ref([]);
//弹窗相关
const height = ref(document.documentElement.clientHeight - 260 + "px;");
const height = ref(document.documentElement.clientHeight - 230 + "px;");
const isVisible = ref(false);
const isError = ref(false);
const planned = ref(true);
@@ -325,7 +330,7 @@
// 表格配置-弹窗
const exampleColumns = ref([
  { type: "seq", title: "序号", width: 60 },
  { type: "seq", title: "序号", width: 60, slots: { default: "rowIndex" } },
  {
    title: "料号",
    field: "itemNo",
@@ -399,11 +404,12 @@
  //   align:"center",
  // }
]);
const hasMore = ref(true);
const data = reactive({
  form: {},
  queryParams: {
    pageNum: 1,
    pageSize: 10000,
    pageSize: 100,
    itemNo: null,
    integrationDay: null,
  },
@@ -413,7 +419,7 @@
const { queryParams, form, rules } = toRefs(data);
/** 查询工艺路线列表 */
function getList() {
async function getList() {
  loading.value = true;
  queryParams.value.params = {};
  if (null != daterangeIntegrationDay && "" != daterangeIntegrationDay) {
@@ -422,16 +428,39 @@
    queryParams.value.params["endIntegrationDay"] =
      daterangeIntegrationDay.value[1];
  }
  listProcessRoute(queryParams.value).then((response) => {
    processRouteList.value = response.rows;
    total.value = response.total;
    loading.value = false;
  });
}
function handleAutoLoadMore(){
  const response = await listProcessRoute(queryParams.value);
  // processRouteList.value = response.rows;
  if (processRouteList.value.length < queryParams.value.pageSize) {
    hasMore.value = false;
    processRouteList.value = response.rows;
  } else {
    processRouteList.value = [...processRouteList.value, ...response.rows];
  }
  // total.value = response.total;
  loading.value = false;
}
// async function loadData() {
//   try {
//     const response = await fetch(`https://api.example.com/products?page=${this.page}&limit=${this.pageSize}`);
//     const data = await response.json();
//     if (data.length < this.pageSize) {
//       this.hasMore = false;
//     }
//     this.products.push(...data);
//     this.page++;
//   } catch (error) {
//     console.error('Error fetching data:', error);
//   }
// }
const throttledScroll = throttle(() => {
  queryParams.value.pageNum++;
  getList();
  console.log("1111")
}, 200);
function handleAutoLoadMore() {
  throttledScroll()
}
// 取消按钮
function cancel() {