|
|
|
@ -199,16 +199,16 @@ |
|
|
|
</el-row> |
|
|
|
<el-row :gutter="24" v-if="requiresPackStep(reportData.orderType, reportData.nodeCode, reportData.nodeName)"> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="打包步骤" required> |
|
|
|
<el-form-item :label="getMediaStepLabel(reportData.orderType, reportData.nodeCode, reportData.nodeName)" required> |
|
|
|
<el-select v-model="reportData.mediaStep" clearable placeholder="请选择当前上传步骤" style="width: 100%"> |
|
|
|
<el-option |
|
|
|
v-for="item in packStepOptionList" |
|
|
|
v-for="item in getMediaStepOptionList(reportData.orderType, reportData.nodeCode, reportData.nodeName)" |
|
|
|
:key="item.value" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
<div class="media-capture-tip">请按步骤分别上传影像,便于在“查看文件”中区分每一步。</div> |
|
|
|
<div class="media-capture-tip">{{ getMediaStepTip(reportData.orderType, reportData.nodeCode, reportData.nodeName) }}</div> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
@ -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) }} |
|
|
|
</el-button> |
|
|
|
<el-button |
|
|
|
size="mini" |
|
|
|
@ -320,7 +320,7 @@ |
|
|
|
:loading="reportLoading && reportAction !== 'UPLOAD_ONLY'" |
|
|
|
:disabled="reportLoading && reportAction === 'UPLOAD_ONLY'" |
|
|
|
@click="submitNodeReport"> |
|
|
|
{{ 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) }} |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
@ -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 |
|
|
|
} |
|
|
|
if (!allowStepOnlyNoFileUpload) { |
|
|
|
this.$message.warning('请先拍照或录制视频') |
|
|
|
return |
|
|
|
} |
|
|
|
if (this.requiresPackStep(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName) && !this.reportData.mediaStep) { |
|
|
|
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) { |
|
|
|
|