Browse Source

2026-04-16

优化
master
fengyuan_yang 7 hours ago
parent
commit
c1dc5d2952
  1. 11
      src/api/warehouse/labelTransactionLog.js
  2. 179
      src/views/modules/warehouse/labelTransactionLog.vue

11
src/api/warehouse/labelTransactionLog.js

@ -45,3 +45,14 @@ export function labelTransactionLogClose(data) {
}) })
} }
/**
* 批量单据回冲
*/
export function labelTransactionLogReverse(data) {
return http({
url: http.adornUrl('/warehouse/labelTransactionLog/reverse'),
method: 'post',
data: http.adornData(data)
})
}

179
src/views/modules/warehouse/labelTransactionLog.vue

@ -148,20 +148,31 @@
<el-col :span="24"> <el-col :span="24">
<div class="search-actions"> <div class="search-actions">
<div class="action-left"> <div class="action-left">
<el-button
type="primary"
icon="el-icon-search"
:loading="dataListLoading"
<button
class="action-btn secondary"
:disabled="dataListLoading"
@click="handleSearch"> @click="handleSearch">
查询
</el-button>
<el-button
icon="el-icon-refresh-left"
<i :class="dataListLoading ? 'el-icon-loading' : 'el-icon-search'"></i> 查询
</button>
<button
class="action-btn secondary"
@click="resetSearch"> @click="resetSearch">
重置
</el-button>
<i class="el-icon-refresh"></i> 重置
</button>
<button
class="action-btn secondary"
@click="exportData">
<i class="el-icon-download"></i> 导出
</button>
</div> </div>
<div class="action-right"> <div class="action-right">
<el-button
v-if="isAuth('105006:reverse')"
class="btn-reverse"
icon="el-icon-refresh-left"
@click="batchReverseHandle">
单据回冲
</el-button>
<el-button <el-button
v-if="isAuth('105006:try')" v-if="isAuth('105006:try')"
type="warning" type="warning"
@ -178,16 +189,10 @@
</el-button> </el-button>
<el-button <el-button
v-if="isAuth('105006:exceptionClose')" v-if="isAuth('105006:exceptionClose')"
type="info"
icon="el-icon-circle-close"
class="btn-exception-close"
@click="exceptionCloseHandle"> @click="exceptionCloseHandle">
异常关闭 异常关闭
</el-button> </el-button>
<el-button
icon="el-icon-download"
@click="exportData">
导出
</el-button>
</div> </div>
</div> </div>
</el-col> </el-col>
@ -269,7 +274,7 @@
</template> </template>
<script> <script>
import { labelTransactionLogList, labelTransactionLogRetry, labelTransactionLogClose } from '@/api/warehouse/labelTransactionLog.js'
import { labelTransactionLogList, labelTransactionLogRetry, labelTransactionLogClose, labelTransactionLogReverse } from '@/api/warehouse/labelTransactionLog.js'
import { getSiteAndBuByUserName2 } from '@/api/qc/qc.js' import { getSiteAndBuByUserName2 } from '@/api/qc/qc.js'
import { getWarehouseList } from '@/api/wms/wms.js' import { getWarehouseList } from '@/api/wms/wms.js'
import excel from '@/utils/excel-util.js' // import excel from '@/utils/excel-util.js' //
@ -573,7 +578,8 @@ export default {
uniqueMap.set(key, { uniqueMap.set(key, {
site: item.site, site: item.site,
buNo: item.buNo, buNo: item.buNo,
transactionId: item.transactionId
transactionId: item.transactionId,
documentType: item.documentType
}) })
} }
}) })
@ -641,7 +647,8 @@ export default {
uniqueMap.set(key, { uniqueMap.set(key, {
site: item.site, site: item.site,
buNo: item.buNo, buNo: item.buNo,
transactionId: item.transactionId
transactionId: item.transactionId,
documentType: item.documentType
}) })
} }
}) })
@ -719,14 +726,15 @@ export default {
uniqueMap.set(key, { uniqueMap.set(key, {
site: item.site, site: item.site,
buNo: item.buNo, buNo: item.buNo,
transactionId: item.transactionId
transactionId: item.transactionId,
documentType: item.documentType
}) })
} }
}) })
const retryList = Array.from(uniqueMap.values()) const retryList = Array.from(uniqueMap.values())
const count = retryList.length const count = retryList.length
this.$confirm(`确定要手动重试这 ${count} 条单据吗?`, '提示', {
this.$confirm(`已自动去重,确定要手动重试这 ${count} 条单据吗?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
@ -772,6 +780,75 @@ export default {
}).catch(() => {}) }).catch(() => {})
}, },
//
batchReverseHandle() {
if (this.dataListSelections.length === 0) {
this.$message.warning('请选择要回冲的记录!')
return
}
// site, buNo, transactionId, documentType
const uniqueMap = new Map()
this.dataListSelections.forEach(item => {
const key = `${item.site}_${item.buNo}_${item.transactionId}_${item.documentType}`
if (!uniqueMap.has(key)) {
uniqueMap.set(key, {
site: item.site,
buNo: item.buNo,
transactionId: item.transactionId,
documentType: item.documentType
})
}
})
const reverseList = Array.from(uniqueMap.values())
const count = reverseList.length
this.$confirm(`确定要回冲这 ${count} 条单据吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const loading = this.$loading({
lock: true,
text: `正在回冲 ${count} 条单据,请稍候...`,
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
//
labelTransactionLogReverse({ reverseList }).then(({ data }) => {
loading.close()
if (data && data.code === 0) {
const result = data.result || {}
const successCount = result.successCount || 0
const failureCount = result.failureCount || 0
let message = `回冲完成!成功:${successCount},失败:${failureCount}`
if (successCount === count) {
this.$message.success(message)
} else if (successCount > 0) {
this.$message.warning(message)
} else {
this.$message.error(message)
}
//
if (result.details && result.details.length > 0) {
this.showRetryResultDialog(result.details)
}
//
this.getDataList()
} else {
this.$message.error(data.msg || '回冲失败')
}
}).catch(error => {
loading.close()
this.$message.error('回冲失败:' + (error.message || '网络错误'))
})
}).catch(() => {})
},
// //
showRetryResultDialog(details) { showRetryResultDialog(details) {
const successList = details.filter(d => d.status === 'success') const successList = details.filter(d => d.status === 'success')
@ -977,6 +1054,64 @@ export default {
transition: all 0.3s ease; transition: all 0.3s ease;
} }
/* 自定义操作按钮样式(参考切换卷操作) */
.action-btn {
min-width: 80px;
padding: 6px 16px;
border-radius: 16px;
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 4px;
outline: none;
}
.action-btn i {
font-size: 13px;
}
.action-btn.secondary {
background: white;
border: 1px solid #17B3A3;
color: #17B3A3;
}
.action-btn.secondary:hover {
background: #17B3A3;
color: white;
}
.action-btn.secondary:active {
transform: scale(0.98);
}
/* 自定义按钮背景色 */
.btn-reverse {
background-color: #386adc !important;
border-color: #386adc !important;
color: #fff !important;
}
.btn-reverse:hover {
background-color: #4a7be8 !important;
border-color: #4a7be8 !important;
}
.btn-exception-close {
background-color: #50c541 !important;
border-color: #50c541 !important;
color: #fff !important;
}
.btn-exception-close:hover {
background-color: #63d154 !important;
border-color: #63d154 !important;
}
/* 页签样式 */ /* 页签样式 */
/deep/ .el-tabs__header { /deep/ .el-tabs__header {
margin-bottom: 10px; margin-bottom: 10px;

Loading…
Cancel
Save