|
|
@ -197,9 +197,24 @@ |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</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-select v-model="reportData.mediaStep" clearable placeholder="请选择当前上传步骤" style="width: 100%"> |
|
|
|
|
|
<el-option |
|
|
|
|
|
v-for="item in packStepOptionList" |
|
|
|
|
|
:key="item.value" |
|
|
|
|
|
:label="item.label" |
|
|
|
|
|
:value="item.value"> |
|
|
|
|
|
</el-option> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
<div class="media-capture-tip">请按步骤分别上传影像,便于在“查看文件”中区分每一步。</div> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
</el-row> |
|
|
<el-row :gutter="24" v-if="requiresMediaUpload(reportData.orderType, reportData.nodeCode, reportData.nodeName)"> |
|
|
<el-row :gutter="24" v-if="requiresMediaUpload(reportData.orderType, reportData.nodeCode, reportData.nodeName)"> |
|
|
<el-col :span="24"> |
|
|
<el-col :span="24"> |
|
|
<el-form-item label="报工影像(支持拍照和录像,可多次采集)"> |
|
|
|
|
|
|
|
|
<el-form-item label="报工影像(支持拍照和录像,可多次采集,可仅上传不报工)"> |
|
|
<div class="media-layout"> |
|
|
<div class="media-layout"> |
|
|
<div class="media-layout-left"> |
|
|
<div class="media-layout-left"> |
|
|
<div class="camera-preview-wrap"> |
|
|
<div class="camera-preview-wrap"> |
|
|
@ -285,8 +300,24 @@ |
|
|
</el-form> |
|
|
</el-form> |
|
|
<div slot="footer" class="dialog-footer"> |
|
|
<div slot="footer" class="dialog-footer"> |
|
|
<el-button size="mini" class="reset-btn" plain @click="closeReportDialog">取消</el-button> |
|
|
<el-button size="mini" class="reset-btn" plain @click="closeReportDialog">取消</el-button> |
|
|
<el-button size="mini" type="primary" plain :loading="reportLoading" @click="submitNodeReport"> |
|
|
|
|
|
{{ reportLoading ? (requiresMediaUpload(reportData.orderType, reportData.nodeCode, reportData.nodeName) ? '上传中...' : '提交中...') : (requiresMediaUpload(reportData.orderType, reportData.nodeCode, reportData.nodeName) ? '上传并报工' : '确认报工') }} |
|
|
|
|
|
|
|
|
<el-button |
|
|
|
|
|
v-if="requiresMediaUpload(reportData.orderType, reportData.nodeCode, reportData.nodeName)" |
|
|
|
|
|
size="mini" |
|
|
|
|
|
type="warning" |
|
|
|
|
|
plain |
|
|
|
|
|
:loading="reportLoading && reportAction === 'UPLOAD_ONLY'" |
|
|
|
|
|
:disabled="reportLoading" |
|
|
|
|
|
@click="submitNodeMediaOnly"> |
|
|
|
|
|
{{ reportLoading && reportAction === 'UPLOAD_ONLY' ? '上传中...' : '仅上传影像' }} |
|
|
|
|
|
</el-button> |
|
|
|
|
|
<el-button |
|
|
|
|
|
size="mini" |
|
|
|
|
|
type="primary" |
|
|
|
|
|
plain |
|
|
|
|
|
: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 ? '确认报工' : '上传并报工') : '确认报工') }} |
|
|
</el-button> |
|
|
</el-button> |
|
|
</div> |
|
|
</div> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
@ -355,6 +386,17 @@ export default { |
|
|
historyDialogVisible: false, |
|
|
historyDialogVisible: false, |
|
|
historyOrder: {}, |
|
|
historyOrder: {}, |
|
|
reportLoading: false, |
|
|
reportLoading: false, |
|
|
|
|
|
reportAction: '', |
|
|
|
|
|
hasUploadedMediaOnly: false, |
|
|
|
|
|
uploadedMediaNodeFlagMap: {}, |
|
|
|
|
|
packStepOptionList: [ |
|
|
|
|
|
{ label: '1平台箱', value: '1平台箱' }, |
|
|
|
|
|
{ label: '2门箱', value: '2门箱' }, |
|
|
|
|
|
{ label: '3背景墙箱', value: '3背景墙箱' }, |
|
|
|
|
|
{ label: '4框架箱', value: '4框架箱' }, |
|
|
|
|
|
{ label: '5钣金箱', value: '5钣金箱' }, |
|
|
|
|
|
{ label: '6铝型材箱', value: '6铝型材箱' } |
|
|
|
|
|
], |
|
|
reportData: { |
|
|
reportData: { |
|
|
orderNo: '', |
|
|
orderNo: '', |
|
|
orderType: '', |
|
|
orderType: '', |
|
|
@ -363,7 +405,8 @@ export default { |
|
|
nodeName: '', |
|
|
nodeName: '', |
|
|
reportQty: 1, |
|
|
reportQty: 1, |
|
|
reportBy: '', |
|
|
reportBy: '', |
|
|
remark: '' |
|
|
|
|
|
|
|
|
remark: '', |
|
|
|
|
|
mediaStep: '' |
|
|
}, |
|
|
}, |
|
|
cameraActive: false, |
|
|
cameraActive: false, |
|
|
cameraStream: null, |
|
|
cameraStream: null, |
|
|
@ -573,6 +616,14 @@ export default { |
|
|
const normalizedName = String(nodeName).replace(/\s+/g, '') |
|
|
const normalizedName = String(nodeName).replace(/\s+/g, '') |
|
|
return config.nameList.some(name => name.replace(/\s+/g, '') === normalizedName) |
|
|
return config.nameList.some(name => name.replace(/\s+/g, '') === normalizedName) |
|
|
}, |
|
|
}, |
|
|
|
|
|
requiresPackStep (orderType, nodeCode, nodeName) { |
|
|
|
|
|
if (!this.requiresMediaUpload(orderType, nodeCode, nodeName)) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
const normalizedCode = String(nodeCode || '').trim() |
|
|
|
|
|
const normalizedName = String(nodeName || '').replace(/\s+/g, '') |
|
|
|
|
|
return normalizedCode === 'pack' || normalizedName === '打包' |
|
|
|
|
|
}, |
|
|
directReportNode (order, node) { |
|
|
directReportNode (order, node) { |
|
|
this.reportData = { |
|
|
this.reportData = { |
|
|
orderNo: order.orderNo, |
|
|
orderNo: order.orderNo, |
|
|
@ -582,11 +633,13 @@ export default { |
|
|
nodeName: node.nodeName, |
|
|
nodeName: node.nodeName, |
|
|
reportQty: 1, |
|
|
reportQty: 1, |
|
|
reportBy: this.$store.state.user.userDisplay || this.$store.state.user.name || '当前用户', |
|
|
reportBy: this.$store.state.user.userDisplay || this.$store.state.user.name || '当前用户', |
|
|
remark: '' |
|
|
|
|
|
|
|
|
remark: '', |
|
|
|
|
|
mediaStep: '' |
|
|
} |
|
|
} |
|
|
this.submitNodeReport() |
|
|
this.submitNodeReport() |
|
|
}, |
|
|
}, |
|
|
openReportDialog (order, node, forceManualQty = false) { |
|
|
openReportDialog (order, node, forceManualQty = false) { |
|
|
|
|
|
const mediaNodeKey = this.buildMediaNodeKey(order.orderNo, node.nodeCode) |
|
|
this.reportData = { |
|
|
this.reportData = { |
|
|
orderNo: order.orderNo, |
|
|
orderNo: order.orderNo, |
|
|
orderType: order.orderType, |
|
|
orderType: order.orderType, |
|
|
@ -595,14 +648,19 @@ export default { |
|
|
nodeName: node.nodeName, |
|
|
nodeName: node.nodeName, |
|
|
reportQty: forceManualQty ? '' : 1, |
|
|
reportQty: forceManualQty ? '' : 1, |
|
|
reportBy: this.$store.state.user.userDisplay || this.$store.state.user.name || '当前用户', |
|
|
reportBy: this.$store.state.user.userDisplay || this.$store.state.user.name || '当前用户', |
|
|
remark: '' |
|
|
|
|
|
|
|
|
remark: '', |
|
|
|
|
|
mediaStep: '' |
|
|
} |
|
|
} |
|
|
this.reportDialogVisible = true |
|
|
this.reportDialogVisible = true |
|
|
|
|
|
this.reportAction = '' |
|
|
|
|
|
this.hasUploadedMediaOnly = !!this.uploadedMediaNodeFlagMap[mediaNodeKey] |
|
|
this.releaseMediaResources() |
|
|
this.releaseMediaResources() |
|
|
this.captureIndex = 1 |
|
|
this.captureIndex = 1 |
|
|
}, |
|
|
}, |
|
|
closeReportDialog () { |
|
|
closeReportDialog () { |
|
|
this.reportDialogVisible = false |
|
|
this.reportDialogVisible = false |
|
|
|
|
|
this.reportAction = '' |
|
|
|
|
|
this.hasUploadedMediaOnly = false |
|
|
this.releaseMediaResources() |
|
|
this.releaseMediaResources() |
|
|
}, |
|
|
}, |
|
|
handleReportDialogClose (done) { |
|
|
handleReportDialogClose (done) { |
|
|
@ -624,9 +682,21 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (this.requiresMediaUpload(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName)) { |
|
|
if (this.requiresMediaUpload(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName)) { |
|
|
this.submitNodeReportWithMedia() |
|
|
|
|
|
|
|
|
if (this.capturedMediaList.length > 0) { |
|
|
|
|
|
this.submitNodeReportWithMedia(true) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
if (this.hasUploadedMediaOnly) { |
|
|
|
|
|
this.submitNodeReportOnly('REPORT_ONLY') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.$message.warning('请先拍照或录像,或先点击“仅上传影像”') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.submitNodeReportOnly('REPORT') |
|
|
|
|
|
}, |
|
|
|
|
|
submitNodeReportOnly (action = 'REPORT') { |
|
|
|
|
|
const mediaNodeKey = this.buildMediaNodeKey(this.reportData.orderNo, this.reportData.nodeCode) |
|
|
const apiMap = { |
|
|
const apiMap = { |
|
|
HOME_LIFT: reportHomeLiftOrderNode, |
|
|
HOME_LIFT: reportHomeLiftOrderNode, |
|
|
CABLE_COP: reportCableCopTaskNode, |
|
|
CABLE_COP: reportCableCopTaskNode, |
|
|
@ -639,9 +709,14 @@ export default { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
this.reportLoading = true |
|
|
this.reportLoading = true |
|
|
|
|
|
this.reportAction = action |
|
|
apiFn(this.buildNodeReportPayload()).then(({ data }) => { |
|
|
apiFn(this.buildNodeReportPayload()).then(({ data }) => { |
|
|
this.reportLoading = false |
|
|
this.reportLoading = false |
|
|
|
|
|
this.reportAction = '' |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
|
|
|
if (mediaNodeKey && this.uploadedMediaNodeFlagMap[mediaNodeKey]) { |
|
|
|
|
|
this.$delete(this.uploadedMediaNodeFlagMap, mediaNodeKey) |
|
|
|
|
|
} |
|
|
this.$message.success(data.msg || '报工成功') |
|
|
this.$message.success(data.msg || '报工成功') |
|
|
this.closeReportDialog() |
|
|
this.closeReportDialog() |
|
|
this.getDataList() |
|
|
this.getDataList() |
|
|
@ -650,12 +725,20 @@ export default { |
|
|
} |
|
|
} |
|
|
}).catch(() => { |
|
|
}).catch(() => { |
|
|
this.reportLoading = false |
|
|
this.reportLoading = false |
|
|
|
|
|
this.reportAction = '' |
|
|
this.$message.error('报工失败') |
|
|
this.$message.error('报工失败') |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
submitNodeReportWithMedia () { |
|
|
|
|
|
|
|
|
submitNodeMediaOnly () { |
|
|
|
|
|
this.submitNodeReportWithMedia(false) |
|
|
|
|
|
}, |
|
|
|
|
|
submitNodeReportWithMedia (reportNode = true) { |
|
|
if (!this.capturedMediaList.length) { |
|
|
if (!this.capturedMediaList.length) { |
|
|
this.$message.warning('请先上传检验照片或视频') |
|
|
|
|
|
|
|
|
this.$message.warning('请先拍照或录制视频') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (this.requiresPackStep(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName) && !this.reportData.mediaStep) { |
|
|
|
|
|
this.$message.warning('请选择打包步骤后再上传') |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
const formData = new FormData() |
|
|
const formData = new FormData() |
|
|
@ -665,22 +748,42 @@ export default { |
|
|
formData.append('nodeCode', payload.nodeCode) |
|
|
formData.append('nodeCode', payload.nodeCode) |
|
|
formData.append('reportQty', String(payload.reportQty || 1)) |
|
|
formData.append('reportQty', String(payload.reportQty || 1)) |
|
|
formData.append('remark', payload.remark || '') |
|
|
formData.append('remark', payload.remark || '') |
|
|
|
|
|
formData.append('mediaStep', this.reportData.mediaStep || '') |
|
|
|
|
|
formData.append('reportNode', String(reportNode)) |
|
|
this.capturedMediaList.forEach(item => { |
|
|
this.capturedMediaList.forEach(item => { |
|
|
formData.append('file', item.raw, item.name) |
|
|
formData.append('file', item.raw, item.name) |
|
|
}) |
|
|
}) |
|
|
this.reportLoading = true |
|
|
this.reportLoading = true |
|
|
|
|
|
this.reportAction = reportNode ? 'REPORT' : 'UPLOAD_ONLY' |
|
|
reportWorkNodeWithMedia(formData).then(({ data }) => { |
|
|
reportWorkNodeWithMedia(formData).then(({ data }) => { |
|
|
this.reportLoading = false |
|
|
this.reportLoading = false |
|
|
|
|
|
this.reportAction = '' |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
this.$message.success(data.msg || '上传并报工成功') |
|
|
|
|
|
|
|
|
this.$message.success(data.msg || (reportNode ? '上传并报工成功' : '影像上传成功')) |
|
|
|
|
|
if (reportNode) { |
|
|
|
|
|
const mediaNodeKey = this.buildMediaNodeKey(this.reportData.orderNo, this.reportData.nodeCode) |
|
|
|
|
|
if (mediaNodeKey && this.uploadedMediaNodeFlagMap[mediaNodeKey]) { |
|
|
|
|
|
this.$delete(this.uploadedMediaNodeFlagMap, mediaNodeKey) |
|
|
|
|
|
} |
|
|
this.closeReportDialog() |
|
|
this.closeReportDialog() |
|
|
|
|
|
} else { |
|
|
|
|
|
this.hasUploadedMediaOnly = true |
|
|
|
|
|
const mediaNodeKey = this.buildMediaNodeKey(this.reportData.orderNo, this.reportData.nodeCode) |
|
|
|
|
|
if (mediaNodeKey) { |
|
|
|
|
|
this.$set(this.uploadedMediaNodeFlagMap, mediaNodeKey, true) |
|
|
|
|
|
} |
|
|
|
|
|
this.resetCapturedMedia() |
|
|
|
|
|
this.captureIndex = 1 |
|
|
|
|
|
this.reportData.mediaStep = '' |
|
|
|
|
|
} |
|
|
this.getDataList() |
|
|
this.getDataList() |
|
|
} else { |
|
|
} else { |
|
|
this.$message.error((data && data.msg) || '上传失败') |
|
|
|
|
|
|
|
|
this.$message.error((data && data.msg) || (reportNode ? '上传并报工失败' : '影像上传失败')) |
|
|
} |
|
|
} |
|
|
}).catch(() => { |
|
|
}).catch(() => { |
|
|
this.reportLoading = false |
|
|
this.reportLoading = false |
|
|
this.$message.error('上传失败') |
|
|
|
|
|
|
|
|
this.reportAction = '' |
|
|
|
|
|
this.$message.error(reportNode ? '上传并报工失败' : '影像上传失败') |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
buildNodeReportPayload () { |
|
|
buildNodeReportPayload () { |
|
|
@ -692,6 +795,12 @@ export default { |
|
|
remark: this.reportData.remark || '' |
|
|
remark: this.reportData.remark || '' |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
buildMediaNodeKey (orderNo, nodeCode) { |
|
|
|
|
|
if (!orderNo || !nodeCode) { |
|
|
|
|
|
return '' |
|
|
|
|
|
} |
|
|
|
|
|
return `${orderNo}#${nodeCode}` |
|
|
|
|
|
}, |
|
|
async startCamera () { |
|
|
async startCamera () { |
|
|
if (!this.requiresMediaUpload(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName)) { |
|
|
if (!this.requiresMediaUpload(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName)) { |
|
|
return |
|
|
return |
|
|
|