Browse Source

2026-07-30

优化
master
fengyuan_yang 2 days ago
parent
commit
9cbe9de383
  1. 188
      src/views/modules/boxManage/saleBoxManage.vue
  2. 6
      src/views/modules/qc/inboundNotification.vue

188
src/views/modules/boxManage/saleBoxManage.vue

@ -348,7 +348,7 @@
</el-tabs>
<!-- 盒清单新增对话框 -->
<el-dialog title="装盒扫描" :visible.sync="caseDialogVisible" width="70%" :close-on-click-modal="false" @close="closeCaseDialog">
<el-dialog title="装盒扫描" :visible.sync="caseDialogVisible" width="70%" :close-on-click-modal="false" :before-close="handleCaseDialogBeforeClose" @close="closeCaseDialog">
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;" @submit.native.prevent>
<el-form-item label="卷标签">
<el-input ref="rollNoInput" v-model="caseForm.rollNo" @keyup.enter.native="scanCaseRoll" placeholder="请扫描卷标签" style="width: 200px"></el-input>
@ -373,19 +373,22 @@
<!-- 中部分扫描列表 -->
<el-table
ref="caseRollTable"
:data="caseRollList"
:data="caseRollPageData"
:row-key="getCaseRollTableRowKey"
border
height="300"
@selection-change="handleCaseRollSelectionChange"
style="width: 100%; margin-top: 10px;">
<el-table-column
type="selection"
:reserve-selection="true"
width="55"
header-align="center"
align="center">
</el-table-column>
<el-table-column
type="index"
:index="getCaseRollIndex"
label="序号"
width="50"
header-align="center"
@ -451,11 +454,22 @@
</template>
</el-table-column>
</el-table>
<div style="margin-top: 10px; text-align: right;">
<el-pagination
@size-change="handleCaseDialogSizeChange"
@current-change="handleCaseDialogCurrentChange"
:current-page="caseDialogPageIndex"
:page-sizes="caseDialogPageSizes"
:page-size="caseDialogPageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="caseRollList.length">
</el-pagination>
</div>
<el-footer style="height:35px;margin-top: 15px;text-align:center">
<el-button type="primary" :loading="printLoading" @click="printCaseRolls">打印</el-button>
<el-button type="primary" @click="applyCaseScan">应用</el-button>
<el-button type="success" @click="saveCaseScan">保存</el-button>
<el-button @click="closeCaseDialog">关闭</el-button>
<el-button type="primary" :loading="caseSaving" :disabled="caseSaving" @click="applyCaseScan">应用</el-button>
<el-button type="success" :loading="caseSaving" :disabled="caseSaving" @click="saveCaseScan">保存</el-button>
<el-button :disabled="caseSaving" @click="closeCaseDialog">关闭</el-button>
</el-footer>
</el-dialog>
@ -495,8 +509,10 @@ export default {
searchExpanded: true,
currentRow: {},
selectedCaseRolls: [], //
selectedCaseRollMap: {}, //
printLoading: false, // loading
printCasesLoading: false, // loading
caseSaving: false, //
searchData:{
orderNo:'',
customerId:'',
@ -540,12 +556,16 @@ export default {
partNo: ''
},
caseRollList: [],
caseRollKeyMap: {},
caseStatistics: {
casesCount: 0,
rollCount: 0,
totalQty: 0
},
selectedCaseRecords: [],
caseDialogPageIndex: 1,
caseDialogPageSize: 100,
caseDialogPageSizes: [50, 100, 200],
//
casesPageIndex: 1,
casesPageSize: 50,
@ -903,6 +923,14 @@ export default {
pallet
},
computed: {
caseRollPageData(){
const start = (this.caseDialogPageIndex - 1) * this.caseDialogPageSize
const end = start + this.caseDialogPageSize
return this.caseRollList.slice(start, end)
}
},
mounted() {
this.$nextTick(() => {
this.calculateTableHeight();
@ -929,6 +957,51 @@ export default {
this.calculateTableHeight();
},
buildCaseRollKey(site, rollNo){
return `${site || ''}|${rollNo || ''}`
},
getCaseRollTableRowKey(row){
return this.buildCaseRollKey(row.site, row.rollNo)
},
getCaseRollIndex(index){
return (this.caseDialogPageIndex - 1) * this.caseDialogPageSize + index + 1
},
rebuildSelectedCaseRolls(){
this.selectedCaseRolls = Object.keys(this.selectedCaseRollMap).map(key => this.selectedCaseRollMap[key]).filter(item => !!item)
},
syncCaseRollPageSelection(){
this.$nextTick(() => {
if (!this.$refs.caseRollTable || typeof this.$refs.caseRollTable.clearSelection !== 'function') {
return
}
this.$refs.caseRollTable.clearSelection()
if (typeof this.$refs.caseRollTable.toggleRowSelection !== 'function') {
return
}
this.caseRollPageData.forEach(row => {
const rowKey = this.buildCaseRollKey(row.site, row.rollNo)
if (this.selectedCaseRollMap[rowKey]) {
this.$refs.caseRollTable.toggleRowSelection(row, true)
}
})
})
},
handleCaseDialogSizeChange(val){
this.caseDialogPageSize = val
this.caseDialogPageIndex = 1
this.syncCaseRollPageSelection()
},
handleCaseDialogCurrentChange(val){
this.caseDialogPageIndex = val
this.syncCaseRollPageSelection()
},
getMainData(){
this.dataListLoading = true
this.searchData.limit = this.pageSize
@ -1149,7 +1222,10 @@ export default {
partNo: ''
}
this.caseRollList = []
this.caseRollKeyMap = {}
this.selectedCaseRolls = []
this.selectedCaseRollMap = {}
this.caseDialogPageIndex = 1
this.updateCaseStatistics()
},
@ -1185,15 +1261,24 @@ export default {
const newRolls = []
rollList.forEach(rollInfo => {
// site rollNo
const isDuplicate = this.caseRollList.some(item =>
item.site === this.caseForm.site && item.rollNo === rollInfo.rollNo
)
const rollKey = this.buildCaseRollKey(this.caseForm.site, rollInfo.rollNo)
const isDuplicate = !!this.caseRollKeyMap[rollKey]
if (isDuplicate) {
duplicateRolls.push(rollInfo.rollNo)
} else {
newRolls.push(rollInfo)
newRolls.push({
casesNo: this.caseForm.casesNo,
rollNo: rollInfo.rollNo,
packingList: rollInfo.packingList || '',
rollQty: rollInfo.rollQty,
partNo: rollInfo.partNo,
partDesc: rollInfo.partDesc,
batchNo: rollInfo.batchNo,
notifyNo: this.caseForm.notifyNo,
site: this.caseForm.site,
buNo: this.caseForm.buNo
})
}
})
@ -1204,20 +1289,16 @@ export default {
//
newRolls.forEach(rollInfo => {
this.caseRollList.unshift({
casesNo: this.caseForm.casesNo,
rollNo: rollInfo.rollNo,
packingList: rollInfo.packingList || '',
rollQty: rollInfo.rollQty,
partNo: rollInfo.partNo,
partDesc: rollInfo.partDesc,
batchNo: rollInfo.batchNo,
notifyNo: this.caseForm.notifyNo,
site: this.caseForm.site,
buNo: this.caseForm.buNo
})
this.caseRollList.unshift(rollInfo)
const rollKey = this.buildCaseRollKey(rollInfo.site, rollInfo.rollNo)
this.caseRollKeyMap[rollKey] = true
})
if (newRolls.length > 0) {
this.caseDialogPageIndex = 1
this.syncCaseRollPageSelection()
}
//
this.updateCaseStatistics()
@ -1266,13 +1347,29 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.caseRollList.splice(index, 1)
const actualIndex = (this.caseDialogPageIndex - 1) * this.caseDialogPageSize + index
const deletedRow = this.caseRollList[actualIndex]
if (deletedRow) {
const rollKey = this.buildCaseRollKey(deletedRow.site, deletedRow.rollNo)
delete this.caseRollKeyMap[rollKey]
delete this.selectedCaseRollMap[rollKey]
this.caseRollList.splice(actualIndex, 1)
}
const maxPage = Math.max(1, Math.ceil(this.caseRollList.length / this.caseDialogPageSize))
if (this.caseDialogPageIndex > maxPage) {
this.caseDialogPageIndex = maxPage
}
this.rebuildSelectedCaseRolls()
this.syncCaseRollPageSelection()
this.updateCaseStatistics()
this.$message.success('删除成功')
}).catch(() => {})
},
async applyCaseScan(){
if (this.caseSaving) {
return
}
if(this.caseRollList.length === 0){
this.$message.warning('请先扫描卷标签')
return
@ -1284,10 +1381,13 @@ export default {
}
//
this.saveCaseData(false)
await this.saveCaseData(false)
},
async saveCaseScan(){
if (this.caseSaving) {
return
}
if(this.caseRollList.length === 0){
this.$message.warning('请先扫描卷标签')
return
@ -1299,7 +1399,7 @@ export default {
}
//
this.saveCaseData(true)
await this.saveCaseData(true)
},
//
@ -1348,6 +1448,10 @@ export default {
},
async saveCaseData(closeDialog){
if (this.caseSaving) {
return
}
this.caseSaving = true
try {
const {data} = await saveCaseRollList(this.caseRollList)
if(data && data.code === 0){
@ -1360,7 +1464,9 @@ export default {
//
this.resetCaseForm()
this.$nextTick(() => {
this.$refs.caseNoInput.focus()
if (this.$refs.rollNoInput) {
this.$refs.rollNoInput.focus()
}
})
}
@ -1370,22 +1476,48 @@ export default {
this.$message.error(data.msg || '保存失败')
}
} catch (error) {
this.$message.error(error.msg || '保存失败')
const errMsg = (error && error.response && error.response.data && error.response.data.msg)
|| error.msg
|| error.message
|| '保存失败'
this.$message.error(errMsg)
} finally {
this.caseSaving = false
}
},
closeCaseDialog(){
if (this.caseSaving) {
this.$message.warning('正在保存,请稍后')
return
}
this.caseDialogVisible = false
this.resetCaseForm()
},
handleCaseDialogBeforeClose(done){
if (this.caseSaving) {
this.$message.warning('正在保存,请稍后')
return
}
done()
},
handleCaseSelectionChange(selection){
this.selectedCaseRecords = selection
},
//
handleCaseRollSelectionChange(selection){
this.selectedCaseRolls = selection
const currentPageKeyList = this.caseRollPageData.map(item => this.buildCaseRollKey(item.site, item.rollNo))
currentPageKeyList.forEach(key => {
delete this.selectedCaseRollMap[key]
})
selection.forEach(item => {
const key = this.buildCaseRollKey(item.site, item.rollNo)
this.selectedCaseRollMap[key] = item
})
this.rebuildSelectedCaseRolls()
},
//

6
src/views/modules/qc/inboundNotification.vue

@ -1864,9 +1864,10 @@
this.pageSize2 = 20
this.totalPage2 = 0
if (this.currentRow.orderType === '生产入库') {
this.detailSearchData.status = '已开工'
this.detailSearchData.status = ''
}
this.handleGetProjectPartList()
//
this.detailModal = true
},
handleGetProjectPartList () {
@ -1878,7 +1879,6 @@
this.pageIndex2 = data.page.currPage
this.pageSize2 = data.page.pageSize
this.totalPage2 = data.page.totalCount
this.detailModal = true
}
})
},

Loading…
Cancel
Save