| | |
| | | @keyup.enter.native="handleSearch" |
| | | ></el-input> |
| | | </div> |
| | | <!-- <div class="search-item">--> |
| | | <!-- <span class="search-label">订单编号:</span>--> |
| | | <!-- <el-input--> |
| | | <!-- v-model="searchForm.orderNo"--> |
| | | <!-- placeholder="请输入订单编号"--> |
| | | <!-- clearable--> |
| | | <!-- style="width: 150px;"--> |
| | | <!-- @keyup.enter.native="handleSearch"--> |
| | | <!-- ></el-input>--> |
| | | <!-- </div>--> |
| | | <div class="search-item"> |
| | | <span class="search-label">状态:</span> |
| | | <el-select |
| | |
| | | style="width: 100%" |
| | | v-loading="loading" |
| | | @sort-change="handleSortChange"> |
| | | <el-table-column prop="itemName" label="组货单号" width="120" align="center" sortable="custom"></el-table-column> |
| | | <!-- <el-table-column prop="orderNo" label="订单编号" min-width="140" align="center"></el-table-column>--> |
| | | <!-- <el-table-column prop="memo" label="备注" min-width="120" align="center"></el-table-column>--> |
| | | <el-table-column prop="itemName" label="组货单号" width="240" align="center" sortable="custom"></el-table-column> |
| | | <el-table-column prop="cstmrName" label="客户名称" min-width="120" align="center"></el-table-column> |
| | | <el-table-column prop="orderCount" label="组货单数" width="80" align="center"></el-table-column> |
| | | <el-table-column prop="settle" label="状态" min-width="100" align="center" :formatter="formatStatus"></el-table-column> |
| | | <!-- <el-table-column prop="totalFee" label="合计金额" min-width="100" align="center" :formatter="formatCurrency"></el-table-column>--> |
| | | <!-- <el-table-column prop="createTime" label="创建时间" min-width="140" align="center" sortable="custom"></el-table-column>--> |
| | | <el-table-column prop="createTime" label="日期" min-width="100" align="center" :formatter="formatDateColumn"></el-table-column> |
| | | <el-table-column prop="updateTime" label="更新日期" min-width="100" align="center" :formatter="formatDateColumn"></el-table-column> |
| | | <el-table-column label="操作" width="150" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <div class="operation-cell"> |
| | |
| | | <div v-if="currentRow"> |
| | | <h3>组货单主表 (组货单号: {{ currentRow.itemName }})</h3> |
| | | <el-descriptions :column="2" border> |
| | | <!-- <el-descriptions-item label="订单编号">{{ currentRow.orderNo }}</el-descriptions-item>--> |
| | | <el-descriptions-item label="客户名称">{{ currentRow.cstmrName }}</el-descriptions-item> |
| | | <el-descriptions-item label="状态">{{ formatStatus(currentRow)}}</el-descriptions-item> |
| | | <el-descriptions-item label="创建时间">{{ formatDate(currentRow.createTime) }}</el-descriptions-item> |
| | |
| | | <el-table-column prop="danger" label="待判" min-width="100" align="center"></el-table-column> |
| | | <el-table-column prop="memo" label="备注" min-width="100" align="center"></el-table-column> |
| | | <el-table-column prop="status" label="状态" min-width="100" align="center" :formatter="formatStatusB"></el-table-column> |
| | | <!-- 可根据实际需求添加更多子表列 --> |
| | | <!-- 新增操作列,根据status值控制显示 --> |
| | | <el-table-column label="是否上报" width="120" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <div class="operation-cell"> |
| | | <el-button v-if="scope.row.status === 2" |
| | | type="primary" |
| | | size="mini" |
| | | @click="handleModifyN(scope.row)"> |
| | | 否 |
| | | </el-button> |
| | | <el-button v-if="scope.row.status === 1" |
| | | type="primary" |
| | | size="mini" |
| | | @click="handleModifyY(scope.row)"> |
| | | 是 |
| | | </el-button> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- 子表分页 --> |
| | |
| | | class="confirm-report-btn" |
| | | @click="showConfirmDialog" |
| | | :loading="reportLoading"> |
| | | 确认上报 |
| | | <!-- 直接在模板中判断 --> |
| | | {{ settleA === 17 ? '再次上报' : '确认上报' }} |
| | | </el-button> |
| | | <el-button @click="closeDetailDialog">关闭</el-button> |
| | | </div> |
| | |
| | | currentRow: null, |
| | | // 子表分页 |
| | | detailCurrentPage: 1, |
| | | settleA: 1, |
| | | detailPageSize: 5, |
| | | detailTotal: 0, |
| | | // 加载状态 |
| | |
| | | |
| | | $.ajax({ |
| | | url: baseUrl + "/order/pakout/order/cargo/grouping/auth/v1", |
| | | // url: baseUrl + "/order/head/page/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | |
| | | // 模拟API调用 - 根据实际业务调整API地址 |
| | | $.ajax({ |
| | | url: baseUrl + "/order/pakout/orderDetl/cargo/grouping/auth", |
| | | // url: baseUrl + "/orderDetl/list/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | |
| | | }); |
| | | }, |
| | | |
| | | // 处理修改按钮点击事件 |
| | | handleModifyY(row) { |
| | | if (!this.currentRow) { |
| | | this.$message.error('没有选择主表数据'); |
| | | return; |
| | | } |
| | | |
| | | const groupOrderNo = this.currentRow.itemName; // 组货单号 |
| | | const batch = row.batch; // 箱号 |
| | | const status = 2; // 箱号 |
| | | |
| | | this.$confirm( |
| | | `确定将组货单号: <strong style="color: #409EFF;">${groupOrderNo}</strong> 中的箱号: <strong style="color: #409EFF;">${batch}</strong> 添加到上报列吗?`, |
| | | '确认修改', |
| | | { |
| | | confirmButtonText: '确认修改', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | dangerouslyUseHTMLString: true |
| | | } |
| | | ).then(() => { |
| | | this.submitModify(groupOrderNo, batch, status); |
| | | }).catch(() => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已取消修改' |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | // 处理修改按钮点击事件 |
| | | handleModifyN(row) { |
| | | if (!this.currentRow) { |
| | | this.$message.error('没有选择主表数据'); |
| | | return; |
| | | } |
| | | |
| | | const groupOrderNo = this.currentRow.itemName; // 组货单号 |
| | | const batch = row.batch; // 箱号 |
| | | const status = 1; // 箱号 |
| | | |
| | | this.$confirm( |
| | | `确定将组货单号: <strong style="color: #409EFF;">${groupOrderNo}</strong> 、箱号: <strong style="color: #409EFF;">${batch}</strong> 添加到上报列吗?`, |
| | | '确认修改', |
| | | { |
| | | confirmButtonText: '确认修改', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | dangerouslyUseHTMLString: true |
| | | } |
| | | ).then(() => { |
| | | this.submitModify(groupOrderNo, batch, status); |
| | | }).catch(() => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已取消修改' |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | // 提交修改到后台 |
| | | submitModify(groupOrderNo, batch, status) { |
| | | // 显示加载状态 |
| | | const loadingInstance = this.$loading({ |
| | | lock: true, |
| | | text: '提交修改中...', |
| | | spinner: 'el-icon-loading', |
| | | background: 'rgba(0, 0, 0, 0.7)' |
| | | }); |
| | | |
| | | $.ajax({ |
| | | url: baseUrl + "/order/pakout/orderDetl/batch/report/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: top.reObject({ |
| | | item_name: groupOrderNo, // 组货单号 |
| | | batch: batch, // 箱号 |
| | | status: status // 箱号 |
| | | }), |
| | | method: 'POST', |
| | | success: (res) => { |
| | | loadingInstance.close(); |
| | | |
| | | if (res.code === 200 || res.success) { |
| | | this.$message({ |
| | | message: `修改成功!组货单号: ${groupOrderNo}, 箱号: ${batch}`, |
| | | type: 'success', |
| | | duration: 3000 |
| | | }); |
| | | |
| | | this.getTableDataB(groupOrderNo); |
| | | } else { |
| | | this.$message.error(res.message || '修改失败'); |
| | | } |
| | | }, |
| | | error: (error) => { |
| | | loadingInstance.close(); |
| | | console.error('修改失败:', error); |
| | | this.$message.error('修改失败,请检查网络连接'); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 表格排序变化 |
| | | handleSortChange(column) { |
| | | if (column.prop) { |
| | |
| | | this.getTableDataA(); |
| | | }, |
| | | |
| | | // 显示二次确认对话框 |
| | | showConfirmDialog() { |
| | | if (!this.currentRow) { |
| | | this.$message.error('没有选择要上报的数据'); |
| | |
| | | |
| | | // 调用后台API上报数据 |
| | | $.ajax({ |
| | | url: baseUrl + "/api/report/confirm", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | url: baseUrl + "/order/pakout/actual/shipment/order/report/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | itemName: groupOrderNo // 传递组货单号 |
| | | }, |
| | | data: JSON.stringify({ |
| | | item_name: groupOrderNo // 传递组货单号 |
| | | }), |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'post', |
| | | method: 'POST', |
| | | success: (res) => { |
| | | this.reportLoading = false; |
| | | if (typeof done === 'function') { |
| | | done(); |
| | | } |
| | | |
| | | if (res.code === 200 || res.success) { |
| | | this.$message({ |
| | | message: `组货单号 ${groupOrderNo} 上报成功`, |
| | |
| | | this.currentRow = row; |
| | | this.detailDialogVisible = true; |
| | | this.detailCurrentPage = 1; |
| | | this.settleA = row.settle; |
| | | this.getTableDataB(row.itemName); |
| | | }, |
| | | |
| | |
| | | if (row.status === 0) { |
| | | return '异常'; |
| | | } else if (row.status === 1) { |
| | | return '正常'; |
| | | return '不上报'; |
| | | } else if (row.status === 2) { |
| | | return '待上报'; |
| | | } else if (row.status === 3) { |
| | |
| | | return '¥0.00'; |
| | | }, |
| | | |
| | | // 格式化日期显示 |
| | | formatDate(dateStr) { |
| | | if (!dateStr) return ''; |
| | | // 简单的日期格式化,可以根据实际格式调整 |
| | | return dateStr; |
| | | }, |
| | | |
| | | // 模拟主表数据 - 实际项目中应删除 |
| | | mockTableAData() { |
| | | this.tableDataA = [ |
| | | { |
| | | itemName: 'ZH1001', |
| | | itemName: 'zh20251110', |
| | | orderNo: 'ORDER2024001', |
| | | cstmrName: '示例客户A', |
| | | settle: 1, |
| | | cstmrName: 'zh20251110', |
| | | settle: 10, |
| | | totalFee: 1500.00, |
| | | createTime: '2024-01-15 10:30:00', |
| | | memo: '测试数据' |
| | | }, |
| | | { |
| | | itemName: 'ZH1002', |
| | | orderNo: 'ORDER2024002', |
| | | cstmrName: '示例客户B', |
| | | settle: 1, |
| | | totalFee: 2300.50, |
| | | createTime: '2024-01-16 14:20:00', |
| | | createTime: '2025-11-10T09:50:16.343+0000', |
| | | memo: '测试数据' |
| | | } |
| | | ]; |
| | | this.total = 2; |
| | | this.total = 1; |
| | | this.loading = false; |
| | | }, |
| | | |
| | | // 模拟子表数据 - 实际项目中应删除 |
| | | mockTableBData(itemName) { |
| | | this.tableDataB = [ |
| | | { productName: `产品A-${itemName}`, quantity: 2, price: 500.00, totalPrice: 1000.00 }, |
| | | { productName: `产品B-${itemName}`, quantity: 1, price: 300.50, totalPrice: 300.50 } |
| | | { |
| | | matnr: '6μm×436mm', |
| | | batch: 'L241034114', |
| | | model: '24092501D01A6', |
| | | origin: '1', |
| | | danger: '1', |
| | | memo: '', |
| | | status: 1 // 状态为1,会显示修改按钮 |
| | | } |
| | | ]; |
| | | this.detailTotal = 2; |
| | | this.detailTotal = 1; |
| | | this.detailLoading = false; |
| | | }, |
| | | |
| | | // 为表格列添加格式化方法 |
| | | formatDateColumn(row, column, cellValue) { |
| | | return this.formatDate(cellValue); |
| | | }, |
| | | |
| | | |
| | | |
| | | // // 格式化日期显示 |
| | | // formatDate(dateStr) { |
| | | // if (!dateStr) return ''; |
| | | // // 简单的日期格式化,可以根据实际格式调整 |
| | | // return dateStr; |
| | | // }, |
| | | |
| | | // 在Vue实例的methods中添加或修改formatDate方法 |
| | | formatDate(dateStr) { |
| | | if (!dateStr) return ''; |
| | | |
| | | try { |
| | | // 创建Date对象 |
| | | const date = new Date(dateStr); |
| | | |
| | | // 检查日期是否有效 |
| | | if (isNaN(date.getTime())) { |
| | | return dateStr; // 如果解析失败,返回原字符串 |
| | | } |
| | | |
| | | // 获取各个时间组件 |
| | | const year = date.getFullYear(); |
| | | const month = String(date.getMonth() + 1).padStart(2, '0'); |
| | | const day = String(date.getDate()).padStart(2, '0'); |
| | | const hours = String(date.getHours()).padStart(2, '0'); |
| | | const minutes = String(date.getMinutes()).padStart(2, '0'); |
| | | const seconds = String(date.getSeconds()).padStart(2, '0'); |
| | | |
| | | // 返回格式化后的字符串:YYYY-MM-DD HH:mm:ss |
| | | return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
| | | } catch (error) { |
| | | console.error('日期格式化错误:', error); |
| | | return dateStr; // 如果出错,返回原字符串 |
| | | } |
| | | }, |
| | | |
| | | //本地时区的时间 |
| | | formatDate2(dateStr) { |
| | | if (!dateStr) return ''; |
| | | |
| | | try { |
| | | const date = new Date(dateStr); |
| | | |
| | | if (isNaN(date.getTime())) { |
| | | return dateStr; |
| | | } |
| | | |
| | | // 使用本地时区 |
| | | const year = date.getFullYear(); |
| | | const month = String(date.getMonth() + 1).padStart(2, '0'); |
| | | const day = String(date.getDate()).padStart(2, '0'); |
| | | const hours = String(date.getHours()).padStart(2, '0'); |
| | | const minutes = String(date.getMinutes()).padStart(2, '0'); |
| | | const seconds = String(date.getSeconds()).padStart(2, '0'); |
| | | |
| | | return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
| | | } catch (error) { |
| | | console.error('日期格式化错误:', error); |
| | | return dateStr; |
| | | } |
| | | }, |
| | | //保持UTC时间但转换为更易读的格式 |
| | | formatDate3(dateStr) { |
| | | if (!dateStr) return ''; |
| | | |
| | | try { |
| | | // 直接解析字符串,不转换时区 |
| | | const date = new Date(dateStr); |
| | | |
| | | if (isNaN(date.getTime())) { |
| | | return dateStr; |
| | | } |
| | | |
| | | // 使用UTC时间组件 |
| | | const year = date.getUTCFullYear(); |
| | | const month = String(date.getUTCMonth() + 1).padStart(2, '0'); |
| | | const day = String(date.getUTCDate()).padStart(2, '0'); |
| | | const hours = String(date.getUTCHours()).padStart(2, '0'); |
| | | const minutes = String(date.getUTCMinutes()).padStart(2, '0'); |
| | | const seconds = String(date.getUTCSeconds()).padStart(2, '0'); |
| | | |
| | | return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
| | | } catch (error) { |
| | | console.error('日期格式化错误:', error); |
| | | return dateStr; |
| | | } |
| | | } |
| | | } |
| | | }); |