diff --git a/src/views/modules/longtron/production-plan-home-order.vue b/src/views/modules/longtron/production-plan-home-order.vue index 4f23d265..0210d419 100644 --- a/src/views/modules/longtron/production-plan-home-order.vue +++ b/src/views/modules/longtron/production-plan-home-order.vue @@ -141,14 +141,14 @@ - + @@ -469,8 +469,8 @@ export default { if (row.action && row.action !== '报工完成') { return false } - const codeSet = ['platformDebug', 'bgCeiling', 'doorAssy', 'pack'] - const nameSet = ['平台组装/调试', '背景墙/吊顶组装', '门组装', '打包'] + const codeSet = ['stocking', 'platformDebug', 'bgCeiling', 'doorAssy', 'pack'] + const nameSet = ['仓库配料', '平台组装/调试', '背景墙/吊顶组装', '门组装', '打包'] const nodeCode = String(row.nodeCode || '').trim() const nodeName = String(row.nodeName || '').replace(/\s+/g, '') return codeSet.includes(nodeCode) || nameSet.some(item => item.replace(/\s+/g, '') === nodeName) @@ -563,7 +563,10 @@ export default { }, getMediaStepLabel(fileRow) { const step = String((fileRow && fileRow.orderRef6) || '').replace(/\s+/g, '') - const stepList = ['1平台箱', '2门箱', '3背景墙箱', '4框架箱', '5钣金箱', '6铝型材箱'] + const stepList = [ + '1平台箱', '2门箱', '3背景墙箱', '4框架箱', '5钣金箱', '6铝型材箱', + '1平台组装配料', '2门组装配料', '3背景墙/吊顶配料', '4打包配料' + ] return stepList.includes(step) ? step : '-' }, buildPreviewMimeType(fileRow, kind) { diff --git a/src/views/modules/longtron/production-work-report.vue b/src/views/modules/longtron/production-work-report.vue index d217baa2..2ed79fcc 100644 --- a/src/views/modules/longtron/production-work-report.vue +++ b/src/views/modules/longtron/production-work-report.vue @@ -199,16 +199,16 @@ - + -
请按步骤分别上传影像,便于在“查看文件”中区分每一步。
+
{{ getMediaStepTip(reportData.orderType, reportData.nodeCode, reportData.nodeName) }}
@@ -311,7 +311,7 @@ :loading="reportLoading && reportAction === 'UPLOAD_ONLY'" :disabled="reportLoading" @click="submitNodeMediaOnly"> - {{ reportLoading && reportAction === 'UPLOAD_ONLY' ? '上传中...' : '仅上传影像' }} + {{ reportLoading && reportAction === 'UPLOAD_ONLY' ? getMediaOnlyActionLoadingLabel(reportData.orderType, reportData.nodeCode, reportData.nodeName) : getMediaOnlyActionLabel(reportData.orderType, reportData.nodeCode, reportData.nodeName) }} - {{ reportLoading ? (requiresMediaUpload(reportData.orderType, reportData.nodeCode, reportData.nodeName) ? (reportAction === 'REPORT_ONLY' ? '提交中...' : '上传并报工中...') : '提交中...') : (requiresMediaUpload(reportData.orderType, reportData.nodeCode, reportData.nodeName) ? (hasUploadedMediaOnly && capturedMediaList.length === 0 ? '确认报工' : '上传并报工') : '确认报工') }} + {{ reportLoading ? getReportSubmitActionLoadingLabel(reportData.orderType, reportData.nodeCode, reportData.nodeName) : getReportSubmitActionLabel(reportData.orderType, reportData.nodeCode, reportData.nodeName) }} @@ -400,6 +400,12 @@ export default { { label: '5钣金箱', value: '5钣金箱' }, { label: '6铝型材箱', value: '6铝型材箱' } ], + stockingStepOptionList: [ + { label: '1平台组装配料', value: '1平台组装配料' }, + { label: '2门组装配料', value: '2门组装配料' }, + { label: '3背景墙/吊顶配料', value: '3背景墙/吊顶配料' }, + { label: '4打包配料', value: '4打包配料' } + ], reportData: { orderNo: '', orderType: '', @@ -634,8 +640,8 @@ export default { } const requiredMap = { HOME_LIFT: { - codeList: ['platformDebug', 'bgCeiling', 'doorAssy', 'pack'], - nameList: ['平台组装/调试', '背景墙/吊顶组装', '门组装', '打包'] + codeList: ['stocking', 'platformDebug', 'bgCeiling', 'doorAssy', 'pack'], + nameList: ['仓库配料', '平台组装/调试', '背景墙/吊顶组装', '门组装', '打包'] }, RENOVATION: { codeList: ['inspect', 'pack'], @@ -666,10 +672,69 @@ export default { if (orderType === 'RENOVATION') { return false } + if (this.isHomeLiftStockingNode(orderType, nodeCode, nodeName)) { + return true + } const normalizedCode = String(nodeCode || '').trim() const normalizedName = String(nodeName || '').replace(/\s+/g, '') return normalizedCode === 'pack' || normalizedName === '打包' }, + isHomeLiftStockingNode (orderType, nodeCode, nodeName) { + if (orderType !== 'HOME_LIFT') { + return false + } + const normalizedCode = String(nodeCode || '').trim() + const normalizedName = String(nodeName || '').replace(/\s+/g, '') + return normalizedCode === 'stocking' || normalizedName === '仓库配料' + }, + getMediaStepOptionList (orderType, nodeCode, nodeName) { + if (this.isHomeLiftStockingNode(orderType, nodeCode, nodeName)) { + return this.stockingStepOptionList + } + return this.packStepOptionList + }, + getMediaStepLabel (orderType, nodeCode, nodeName) { + return this.isHomeLiftStockingNode(orderType, nodeCode, nodeName) ? '仓库配料步骤' : '打包步骤' + }, + getMediaStepTip (orderType, nodeCode, nodeName) { + if (this.isHomeLiftStockingNode(orderType, nodeCode, nodeName)) { + return '请按配料步骤分别上传影像,便于在“查看文件”中区分每一步。' + } + return '请按步骤分别上传影像,便于在“查看文件”中区分每一步。' + }, + getMediaOnlyActionLabel (orderType, nodeCode, nodeName) { + return this.isHomeLiftStockingNode(orderType, nodeCode, nodeName) ? '记录步骤' : '仅上传影像' + }, + getMediaOnlyActionLoadingLabel (orderType, nodeCode, nodeName) { + return this.isHomeLiftStockingNode(orderType, nodeCode, nodeName) ? '记录中...' : '上传中...' + }, + getMediaOnlyActionSuccessLabel (orderType, nodeCode, nodeName) { + return this.isHomeLiftStockingNode(orderType, nodeCode, nodeName) ? '步骤记录成功' : '影像上传成功' + }, + getMediaOnlyActionFailedLabel (orderType, nodeCode, nodeName) { + return this.isHomeLiftStockingNode(orderType, nodeCode, nodeName) ? '步骤记录失败' : '影像上传失败' + }, + getReportSubmitActionLabel (orderType, nodeCode, nodeName) { + if (!this.requiresMediaUpload(orderType, nodeCode, nodeName)) { + return '确认报工' + } + if (this.isHomeLiftStockingNode(orderType, nodeCode, nodeName)) { + return '确认报工' + } + return this.hasUploadedMediaOnly && this.capturedMediaList.length === 0 ? '确认报工' : '上传并报工' + }, + getReportSubmitActionLoadingLabel (orderType, nodeCode, nodeName) { + if (!this.requiresMediaUpload(orderType, nodeCode, nodeName)) { + return '提交中...' + } + if (this.reportAction === 'REPORT_ONLY') { + return '提交中...' + } + if (this.isHomeLiftStockingNode(orderType, nodeCode, nodeName)) { + return '确认报工中...' + } + return '上传并报工中...' + }, directReportNode (order, node) { this.reportData = { orderNo: order.orderNo, @@ -727,6 +792,10 @@ export default { return } } + if (this.isHomeLiftStockingNode(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName) && !this.reportData.mediaStep) { + this.$message.warning(`请选择${this.getMediaStepLabel(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName)}后再报工`) + return + } if (this.requiresMediaUpload(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName)) { if (this.capturedMediaList.length > 0) { this.submitNodeReportWithMedia(true) @@ -736,7 +805,11 @@ export default { this.submitNodeReportOnly('REPORT_ONLY') return } - this.$message.warning('请先拍照或录像,或先点击“仅上传影像”') + if (this.isHomeLiftStockingNode(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName)) { + this.submitNodeReportOnly('REPORT') + return + } + this.$message.warning(`请先拍照或录像,或先点击“${this.getMediaOnlyActionLabel(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName)}”`) return } this.submitNodeReportOnly('REPORT') @@ -780,21 +853,27 @@ export default { }, submitNodeReportWithMedia (reportNode = true) { const pendingMediaList = this.getPendingCapturedMediaList() + const mediaOnlySuccessLabel = this.getMediaOnlyActionSuccessLabel(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName) + const mediaOnlyFailedLabel = this.getMediaOnlyActionFailedLabel(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName) + const allowStepOnlyNoFileUpload = !reportNode && this.isHomeLiftStockingNode(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName) + if (this.requiresPackStep(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName) && !this.reportData.mediaStep) { + const actionVerb = reportNode ? '上传' : (this.isHomeLiftStockingNode(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName) ? '记录' : '上传') + this.$message.warning(`请选择${this.getMediaStepLabel(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName)}后再${actionVerb}`) + return + } if (!pendingMediaList.length) { if (reportNode && this.hasUploadedMediaOnly) { this.submitNodeReportOnly('REPORT_ONLY') return } - if (this.capturedMediaList.length > 0) { + if (!allowStepOnlyNoFileUpload && this.capturedMediaList.length > 0) { this.$message.warning('当前无待上传文件,请先拍照或录像') return } - this.$message.warning('请先拍照或录制视频') - return - } - if (this.requiresPackStep(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName) && !this.reportData.mediaStep) { - this.$message.warning('请选择打包步骤后再上传') - return + if (!allowStepOnlyNoFileUpload) { + this.$message.warning('请先拍照或录制视频') + return + } } const formData = new FormData() const payload = this.buildNodeReportPayload() @@ -814,7 +893,7 @@ export default { this.reportLoading = false this.reportAction = '' if (data && data.code === 0) { - this.$message.success(data.msg || (reportNode ? '上传并报工成功' : '影像上传成功')) + this.$message.success(data.msg || (reportNode ? '上传并报工成功' : mediaOnlySuccessLabel)) if (reportNode) { const mediaNodeKey = this.buildMediaNodeKey(this.reportData.orderNo, this.reportData.nodeCode) if (mediaNodeKey && this.uploadedMediaNodeFlagMap[mediaNodeKey]) { @@ -838,12 +917,12 @@ export default { } this.getDataList() } else { - this.$message.error((data && data.msg) || (reportNode ? '上传并报工失败' : '影像上传失败')) + this.$message.error((data && data.msg) || (reportNode ? '上传并报工失败' : mediaOnlyFailedLabel)) } }).catch(() => { this.reportLoading = false this.reportAction = '' - this.$message.error(reportNode ? '上传并报工失败' : '影像上传失败') + this.$message.error(reportNode ? '上传并报工失败' : mediaOnlyFailedLabel) }) }, buildNodeReportPayload () { @@ -852,7 +931,8 @@ export default { orderNo: this.reportData.orderNo, nodeCode: this.reportData.nodeCode, reportQty: reportQty, - remark: this.reportData.remark || '' + remark: this.reportData.remark || '', + mediaStep: this.reportData.mediaStep || '' } }, buildMediaNodeKey (orderNo, nodeCode) {