快乐的昕的电脑
2025-10-09 260badfb06dd27573d1002dfad7cd0d5c48c6d0c
components/mold.vue
@@ -104,9 +104,9 @@
   export default {
      data() {
         return {
                pageIndex: 1,
                pageSize: 20,
                total: 0,
            pageIndex: 1,
            pageSize: 18,
            total: 0,
            toolList: [],
            selectedToolNo: '',
            toolName: '',
@@ -121,50 +121,50 @@
            ]
         };
      },
        computed: {
            totalPages() {
                return Math.ceil(this.total / this.pageSize) || 1;
            }
        },
      computed: {
         totalPages() {
            return Math.ceil(this.total / this.pageSize) || 1;
         }
      },
      methods: {
            async fetchTools(searchKey) {
                const res = await this.$post({
                    url: '/MesCutterLedger/QueryTools',
                    data: JSON.stringify({
                        searchKey,
                        pageIndex: this.pageIndex,
                        pageSize: this.pageSize
                    }),
                    headers: { 'Content-Type': 'application/json' }
                });
                if (res.status === 0) {
                    this.filteredTools = res.data.tbBillList.map(t => ({
                        no: t.cutterId || t.no,
                        name: t.cutterName || t.name,
                        model: t.cutterModel || t.model
                    }));
                    this.total = res.data.total || 0; // 假设后端返回总数
                } else {
                    this.$showMessage(res.message || '查询失败');
                }
         async fetchTools(searchKey) {
            const res = await this.$post({
               url: '/MesCutterLedger/QueryTools',
               data: JSON.stringify({
                  searchKey,
                  pageIndex: this.pageIndex,
                  pageSize: this.pageSize
               }),
               headers: { 'Content-Type': 'application/json' }
            });
            if (res.status === 0) {
               this.filteredTools = res.data.tbBillList.map(t => ({
                  no: t.cutterId || t.no,
                  name: t.cutterName || t.name,
                  model: t.cutterModel || t.model
               }));
               this.total = res.data.total || 0; // 假设后端返回总数
            } else {
               this.$showMessage(res.message || '查询失败');
            }
         },
         //翻页
            async prevPage() {
                if (this.pageIndex > 1) {
                    this.pageIndex--;
                    await this.fetchTools(this.searchKey);
                }
            },
            async nextPage() {
                if (this.pageIndex < this.totalPages) {
                    this.pageIndex++;
                    await this.fetchTools(this.searchKey);
                }
            },
            async searchTool() {
                this.pageIndex = 1; // 搜索时重置到第一页
                await this.fetchTools(this.searchKey);
            },
         async prevPage() {
            if (this.pageIndex > 1) {
               this.pageIndex--;
               await this.fetchTools(this.searchKey);
            }
         },
         async nextPage() {
            if (this.pageIndex < this.totalPages) {
               this.pageIndex++;
               await this.fetchTools(this.searchKey);
            }
         },
         async searchTool() {
            this.pageIndex = 1; // 搜索时重置到第一页
            await this.fetchTools(this.searchKey);
         },
         selectTool(tool) {
            this.selectedToolNo = tool.no;
            this.toolName = tool.name;
@@ -289,6 +289,8 @@
      display: flex;
      flex-wrap: wrap;
      margin: 1vh 0;
      max-height: 40vh;
      overflow-y: auto;
   }
   .tool-btn {