Browse Source

2026-07-30

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

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

@ -348,7 +348,7 @@
</el-tabs> </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 :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;" @submit.native.prevent>
<el-form-item label="卷标签"> <el-form-item label="卷标签">
<el-input ref="rollNoInput" v-model="caseForm.rollNo" @keyup.enter.native="scanCaseRoll" placeholder="请扫描卷标签" style="width: 200px"></el-input> <el-input ref="rollNoInput" v-model="caseForm.rollNo" @keyup.enter.native="scanCaseRoll" placeholder="请扫描卷标签" style="width: 200px"></el-input>
@ -373,19 +373,22 @@
<!-- 中部分扫描列表 --> <!-- 中部分扫描列表 -->
<el-table <el-table
ref="caseRollTable" ref="caseRollTable"
:data="caseRollList"
:data="caseRollPageData"
:row-key="getCaseRollTableRowKey"
border border
height="300" height="300"
@selection-change="handleCaseRollSelectionChange" @selection-change="handleCaseRollSelectionChange"
style="width: 100%; margin-top: 10px;"> style="width: 100%; margin-top: 10px;">
<el-table-column <el-table-column
type="selection" type="selection"
:reserve-selection="true"
width="55" width="55"
header-align="center" header-align="center"
align="center"> align="center">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
type="index" type="index"
:index="getCaseRollIndex"
label="序号" label="序号"
width="50" width="50"
header-align="center" header-align="center"
@ -451,11 +454,22 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </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-footer style="height:35px;margin-top: 15px;text-align:center">
<el-button type="primary" :loading="printLoading" @click="printCaseRolls">打印</el-button> <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-footer>
</el-dialog> </el-dialog>
@ -495,8 +509,10 @@ export default {
searchExpanded: true, searchExpanded: true,
currentRow: {}, currentRow: {},
selectedCaseRolls: [], // selectedCaseRolls: [], //
selectedCaseRollMap: {}, //
printLoading: false, // loading printLoading: false, // loading
printCasesLoading: false, // loading printCasesLoading: false, // loading
caseSaving: false, //
searchData:{ searchData:{
orderNo:'', orderNo:'',
customerId:'', customerId:'',
@ -540,12 +556,16 @@ export default {
partNo: '' partNo: ''
}, },
caseRollList: [], caseRollList: [],
caseRollKeyMap: {},
caseStatistics: { caseStatistics: {
casesCount: 0, casesCount: 0,
rollCount: 0, rollCount: 0,
totalQty: 0 totalQty: 0
}, },
selectedCaseRecords: [], selectedCaseRecords: [],
caseDialogPageIndex: 1,
caseDialogPageSize: 100,
caseDialogPageSizes: [50, 100, 200],
// //
casesPageIndex: 1, casesPageIndex: 1,
casesPageSize: 50, casesPageSize: 50,
@ -903,6 +923,14 @@ export default {
pallet pallet
}, },
computed: {
caseRollPageData(){
const start = (this.caseDialogPageIndex - 1) * this.caseDialogPageSize
const end = start + this.caseDialogPageSize
return this.caseRollList.slice(start, end)
}
},
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.calculateTableHeight(); this.calculateTableHeight();
@ -929,6 +957,51 @@ export default {
this.calculateTableHeight(); 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(){ getMainData(){
this.dataListLoading = true this.dataListLoading = true
this.searchData.limit = this.pageSize this.searchData.limit = this.pageSize
@ -1149,7 +1222,10 @@ export default {
partNo: '' partNo: ''
} }
this.caseRollList = [] this.caseRollList = []
this.caseRollKeyMap = {}
this.selectedCaseRolls = [] this.selectedCaseRolls = []
this.selectedCaseRollMap = {}
this.caseDialogPageIndex = 1
this.updateCaseStatistics() this.updateCaseStatistics()
}, },
@ -1185,26 +1261,13 @@ export default {
const newRolls = [] const newRolls = []
rollList.forEach(rollInfo => { 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) { if (isDuplicate) {
duplicateRolls.push(rollInfo.rollNo) duplicateRolls.push(rollInfo.rollNo)
} else { } else {
newRolls.push(rollInfo)
}
})
//
if (duplicateRolls.length > 0) {
this.$message.warning(`以下卷标签已存在,不能重复添加:${duplicateRolls.join(', ')}`)
}
//
newRolls.forEach(rollInfo => {
this.caseRollList.unshift({
newRolls.push({
casesNo: this.caseForm.casesNo, casesNo: this.caseForm.casesNo,
rollNo: rollInfo.rollNo, rollNo: rollInfo.rollNo,
packingList: rollInfo.packingList || '', packingList: rollInfo.packingList || '',
@ -1216,8 +1279,26 @@ export default {
site: this.caseForm.site, site: this.caseForm.site,
buNo: this.caseForm.buNo buNo: this.caseForm.buNo
}) })
}
}) })
//
if (duplicateRolls.length > 0) {
this.$message.warning(`以下卷标签已存在,不能重复添加:${duplicateRolls.join(', ')}`)
}
//
newRolls.forEach(rollInfo => {
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() this.updateCaseStatistics()
@ -1266,13 +1347,29 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).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.updateCaseStatistics()
this.$message.success('删除成功') this.$message.success('删除成功')
}).catch(() => {}) }).catch(() => {})
}, },
async applyCaseScan(){ async applyCaseScan(){
if (this.caseSaving) {
return
}
if(this.caseRollList.length === 0){ if(this.caseRollList.length === 0){
this.$message.warning('请先扫描卷标签') this.$message.warning('请先扫描卷标签')
return return
@ -1284,10 +1381,13 @@ export default {
} }
// //
this.saveCaseData(false)
await this.saveCaseData(false)
}, },
async saveCaseScan(){ async saveCaseScan(){
if (this.caseSaving) {
return
}
if(this.caseRollList.length === 0){ if(this.caseRollList.length === 0){
this.$message.warning('请先扫描卷标签') this.$message.warning('请先扫描卷标签')
return return
@ -1299,7 +1399,7 @@ export default {
} }
// //
this.saveCaseData(true)
await this.saveCaseData(true)
}, },
// //
@ -1348,6 +1448,10 @@ export default {
}, },
async saveCaseData(closeDialog){ async saveCaseData(closeDialog){
if (this.caseSaving) {
return
}
this.caseSaving = true
try { try {
const {data} = await saveCaseRollList(this.caseRollList) const {data} = await saveCaseRollList(this.caseRollList)
if(data && data.code === 0){ if(data && data.code === 0){
@ -1360,7 +1464,9 @@ export default {
// //
this.resetCaseForm() this.resetCaseForm()
this.$nextTick(() => { 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 || '保存失败') this.$message.error(data.msg || '保存失败')
} }
} catch (error) { } 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(){ closeCaseDialog(){
if (this.caseSaving) {
this.$message.warning('正在保存,请稍后')
return
}
this.caseDialogVisible = false this.caseDialogVisible = false
this.resetCaseForm() this.resetCaseForm()
}, },
handleCaseDialogBeforeClose(done){
if (this.caseSaving) {
this.$message.warning('正在保存,请稍后')
return
}
done()
},
handleCaseSelectionChange(selection){ handleCaseSelectionChange(selection){
this.selectedCaseRecords = selection this.selectedCaseRecords = selection
}, },
// //
handleCaseRollSelectionChange(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.pageSize2 = 20
this.totalPage2 = 0 this.totalPage2 = 0
if (this.currentRow.orderType === '生产入库') { if (this.currentRow.orderType === '生产入库') {
this.detailSearchData.status = '已开工'
this.detailSearchData.status = ''
} }
this.handleGetProjectPartList()
//
this.detailModal = true
}, },
handleGetProjectPartList () { handleGetProjectPartList () {
@ -1878,7 +1879,6 @@
this.pageIndex2 = data.page.currPage this.pageIndex2 = data.page.currPage
this.pageSize2 = data.page.pageSize this.pageSize2 = data.page.pageSize
this.totalPage2 = data.page.totalCount this.totalPage2 = data.page.totalCount
this.detailModal = true
} }
}) })
}, },

Loading…
Cancel
Save