From d84c6b4f29bd044d4f210af2bec64e04e486df93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AD=A3=E6=98=93?= Date: Sat, 5 Jul 2025 17:33:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BF=BD=E6=BA=AF=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../printLabelDataBackV1.vue | 139 ++++++++++-------- 1 file changed, 78 insertions(+), 61 deletions(-) diff --git a/src/views/productManagement/printLabelDataBackV1.vue b/src/views/productManagement/printLabelDataBackV1.vue index 3b7d575..3f6a11c 100644 --- a/src/views/productManagement/printLabelDataBackV1.vue +++ b/src/views/productManagement/printLabelDataBackV1.vue @@ -2,29 +2,34 @@
- - - - - - - - - +
+ + + + + + +
+
+ + + + + + + + + + + +
- - - - - - - - + 搜索 重置 @@ -62,10 +67,9 @@ - + @@ -175,8 +179,8 @@ export default { packingCode: '', label: '', machine: '', - startTime: '', - endTime: '', + startTime: null, + endTime: null, sort: undefined, sortType: undefined, }, @@ -216,42 +220,54 @@ export default { //this.getList() }, methods: { + // 格式化日期 + formatDate(date) { + return date ? this.$dayjs(date).format('YYYY-MM-DD HH:mm:ss') : null + }, + + // 统一错误处理 + handleError(loadingFlag) { + this[loadingFlag] = false + }, + // 查询数据 getList() { this.loading = true - queryPackingDataBackList(this.queryParams) + const params = { ...this.queryParams } + console.log(params) + + params.startTime = this.formatDate(params.startTime) + params.endTime = this.formatDate(params.endTime) + + queryPackingDataBackList(params) .then((res) => { if (res.code === 200) { this.dataList = res.data } this.loading = false }) - .catch(() => { - this.loading = false - }) + .catch(() => this.handleError('loading')) }, + // 自定义排序 sortChange(column) { - if (column.prop === null || column.order === null) { - this.queryParams.sort = undefined - this.queryParams.sortType = undefined - } else { - this.queryParams.sort = column.prop - this.queryParams.sortType = column.order - } - + this.queryParams.sort = column.prop && column.order ? column.prop : undefined + this.queryParams.sortType = column.order || undefined this.handleQuery() }, + /** 搜索按钮操作 */ handleQuery() { this.getList() }, + // 重置查询操作 resetQuery() { this.resetProperties(this.queryParams) this.resetForm('queryForm') this.handleQuery() }, + resetProperties(obj) { for (let key in obj) { if (typeof obj[key] === 'string') { @@ -263,28 +279,40 @@ export default { } } }, + // 显示详情弹窗 showDetail(row) { - this.detailQueryParams.searchType = row.searchType - this.detailQueryParams.workOrder = row.workOrder - this.detailQueryParams.partNumber = row.partNumber - this.detailQueryParams.machine = row.machine - this.detailQueryParams.startTime = this.queryParams.startTime - this.detailQueryParams.endTime = this.queryParams.endTime - this.detailQueryParams.pageNum = 1 + this.detailQueryParams = { + pageNum: 1, + pageSize: 30, + searchType: row.searchType, + workOrder: row.workOrder, + partNumber: row.partNumber, + machine: '', + fillType: -1, + startTime: this.queryParams.startTime, + endTime: this.queryParams.endTime, + } // 重置筛选条件 this.resetDetailFilter() - this.getDetailList() this.detailVisible = true }, + + // 合并筛选参数 + mergeDetailParams() { + return { + ...this.detailQueryParams, + machine: this.detailFilterParams.machine, + packingCode: this.detailFilterParams.packingCode, + fillType: this.detailFilterParams.fillType, + } + }, + // 获取详情列表数据 getDetailList() { this.detailLoading = true - // 将筛选参数合并到详情查询参数中 - this.detailQueryParams.machine = this.detailFilterParams.machine - this.detailQueryParams.packingCode = this.detailFilterParams.packingCode - this.detailQueryParams.fillType = this.detailFilterParams.fillType - queryPackingDataBackRecord(this.detailQueryParams) + const params = this.mergeDetailParams() + queryPackingDataBackRecord(params) .then((res) => { if (res.code === 200) { this.detailDataList = res.data.result @@ -292,29 +320,18 @@ export default { } this.detailLoading = false }) - .catch(() => { - this.detailLoading = false - }) + .catch(() => this.handleError('detailLoading')) }, + // 重置详情筛选条件 resetDetailFilter() { this.detailFilterParams = { machine: '', packingCode: '', + fillType: -1, } this.getDetailList() }, - // 移除前端筛选方法 - // filterDetailData() { - // const { machine, fullMsg, serialNumber } = this.detailFilterParams - // this.filteredDetailDataList = this.detailDataList.filter((item) => { - // const machineMatch = machine === '' || item.machine === machine - // const fullMsgMatch = fullMsg === '' || item.fullMsg === fullMsg - // // 新增流水号匹配逻辑 - // const serialNumberMatch = !serialNumber || (item.packageLabel && item.packageLabel.slice(-5).includes(serialNumber)) - // return machineMatch && fullMsgMatch && serialNumberMatch - // }) - // }, }, }