Browse Source

2026-11-19

上传订单班次调整
master
fengyuan_yang 4 hours ago
parent
commit
bd6009d6d4
  1. 70
      src/views/modules/yieldReport/com_tid_upload_order.vue

70
src/views/modules/yieldReport/com_tid_upload_order.vue

@ -78,7 +78,18 @@
</el-col>
<el-col :span="8">
<el-form-item label="班次">
<el-input v-model="uploadForm.shift" readonly></el-input>
<el-select
v-model="uploadForm.shift"
placeholder="请选择班次"
style="width: 100%;"
@change="handleShiftChange">
<el-option
v-for="item in shiftOptions"
:key="item.shiftNo"
:label="item.shiftLabel"
:value="item.shiftNo">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
@ -199,6 +210,7 @@
<script>
import { getMesShiftData, uploadMesOrderLog, getScheduleDateShift } from '@/api/yieldReport/produce_report_normal.js'
import { getShiftData } from '@/api/base.js'
import { getOperatorList2 } from '@/api/yieldReport/produce_order.js'
export default {
@ -230,6 +242,7 @@ export default {
date: ''
},
operatorOptions: [],
shiftOptions: [],
mesShiftData: {},
mesShiftLogs: [],
uploadOrderFileList: [],
@ -271,7 +284,7 @@ export default {
this.uploadForm.machineNo = scheduleData.resourceId || scheduleData.resourceDesc || ''
this.uploadForm.process = this.getDefaultProcessByMachineNo(this.uploadForm.machineNo)
this.uploadForm.shift = scheduleData.shiftNo || ''
this.uploadForm.shift = scheduleData.shiftNo ? String(scheduleData.shiftNo).trim() : ''
this.uploadForm.operatorNo = ''
this.uploadForm.date = this.getTodayDateString()
this.uploadResults = []
@ -280,9 +293,11 @@ export default {
this.mesShiftData = {}
this.mesShiftLogs = []
this.operatorOptions = []
this.shiftOptions = []
this.updateDialogLayout()
await this.loadCurrentScheduleShift()
await this.loadShiftOptions()
await this.loadOperatorOptions()
await this.loadMesShiftData(false)
},
@ -337,13 +352,62 @@ export default {
const map = (data && data.map) || {}
const shiftNo = map.ShiftNo || map.shiftNo || ''
if (shiftNo) {
this.uploadForm.shift = shiftNo
this.uploadForm.shift = String(shiftNo).trim()
}
} catch (e) {
// keep fallback values from schedule data when lookup fails
}
},
async loadShiftOptions () {
const optionList = []
const optionMap = {}
if (this.pageData.site) {
try {
const { data } = await getShiftData({ site: this.pageData.site })
const rowList = (data && data.rows) || []
for (let i = 0; i < rowList.length; i++) {
const row = rowList[i] || {}
const shiftNo = row.shiftno || row.shiftNo || row.ShiftNo || ''
const shiftValue = shiftNo ? String(shiftNo).trim() : ''
if (!shiftValue || optionMap[shiftValue]) {
continue
}
optionMap[shiftValue] = true
const shiftDesc = row.shiftdesc || row.shiftDesc || row.ShiftDesc || ''
const descValue = shiftDesc ? String(shiftDesc).trim() : ''
optionList.push({
shiftNo: shiftValue,
shiftLabel: descValue && descValue !== shiftValue ? shiftValue + ' ' + descValue : shiftValue
})
}
} catch (e) {
// keep the stored-procedure shift as the only option when the list cannot be loaded
}
}
this.ensureShiftOption(optionList, this.uploadForm.shift)
optionList.sort((left, right) => left.shiftNo.localeCompare(right.shiftNo))
this.shiftOptions = optionList
},
ensureShiftOption (optionList, shiftNo) {
const shiftValue = shiftNo ? String(shiftNo).trim() : ''
if (!shiftValue) {
return
}
const exists = optionList.some(item => item.shiftNo === shiftValue)
if (!exists) {
optionList.unshift({
shiftNo: shiftValue,
shiftLabel: shiftValue
})
}
},
handleShiftChange () {
this.loadMesShiftData(false)
},
extractDatePart (dateValue) {
if (!dateValue) {
return this.getTodayDateString()

Loading…
Cancel
Save