Browse Source

导出

master
han\hanst 3 weeks ago
parent
commit
2c3d169c1a
  1. 13
      src/views/modules/longtron/production-plan-home-order.vue
  2. 118
      src/views/modules/longtron/production-work-report.vue

13
src/views/modules/longtron/production-plan-home-order.vue

@ -141,14 +141,14 @@
<!-- <el-table-column prop="comment" label="备注" min-width="220" show-overflow-tooltip> <!-- <el-table-column prop="comment" label="备注" min-width="220" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.comment || '-' }}</template> <template slot-scope="scope">{{ scope.row.comment || '-' }}</template>
</el-table-column>--> </el-table-column>-->
<el-table-column label="影像" min-width="95" align="center">
<el-table-column label="影像/步骤" min-width="95" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<a <a
v-if="isMediaNodeLog(scope.row)" v-if="isMediaNodeLog(scope.row)"
type="text" type="text"
size="mini" size="mini"
@click="openMediaFileDialog(scope.row)"> @click="openMediaFileDialog(scope.row)">
查看文件
查看
</a> </a>
<span v-else>-</span> <span v-else>-</span>
</template> </template>
@ -469,8 +469,8 @@ export default {
if (row.action && row.action !== '报工完成') { if (row.action && row.action !== '报工完成') {
return false 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 nodeCode = String(row.nodeCode || '').trim()
const nodeName = String(row.nodeName || '').replace(/\s+/g, '') const nodeName = String(row.nodeName || '').replace(/\s+/g, '')
return codeSet.includes(nodeCode) || nameSet.some(item => item.replace(/\s+/g, '') === nodeName) return codeSet.includes(nodeCode) || nameSet.some(item => item.replace(/\s+/g, '') === nodeName)
@ -563,7 +563,10 @@ export default {
}, },
getMediaStepLabel(fileRow) { getMediaStepLabel(fileRow) {
const step = String((fileRow && fileRow.orderRef6) || '').replace(/\s+/g, '') 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 : '-' return stepList.includes(step) ? step : '-'
}, },
buildPreviewMimeType(fileRow, kind) { buildPreviewMimeType(fileRow, kind) {

118
src/views/modules/longtron/production-work-report.vue

@ -199,16 +199,16 @@
</el-row> </el-row>
<el-row :gutter="24" v-if="requiresPackStep(reportData.orderType, reportData.nodeCode, reportData.nodeName)"> <el-row :gutter="24" v-if="requiresPackStep(reportData.orderType, reportData.nodeCode, reportData.nodeName)">
<el-col :span="24"> <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-select v-model="reportData.mediaStep" clearable placeholder="请选择当前上传步骤" style="width: 100%">
<el-option <el-option
v-for="item in packStepOptionList"
v-for="item in getMediaStepOptionList(reportData.orderType, reportData.nodeCode, reportData.nodeName)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </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-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -311,7 +311,7 @@
:loading="reportLoading && reportAction === 'UPLOAD_ONLY'" :loading="reportLoading && reportAction === 'UPLOAD_ONLY'"
:disabled="reportLoading" :disabled="reportLoading"
@click="submitNodeMediaOnly"> @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>
<el-button <el-button
size="mini" size="mini"
@ -320,7 +320,7 @@
:loading="reportLoading && reportAction !== 'UPLOAD_ONLY'" :loading="reportLoading && reportAction !== 'UPLOAD_ONLY'"
:disabled="reportLoading && reportAction === 'UPLOAD_ONLY'" :disabled="reportLoading && reportAction === 'UPLOAD_ONLY'"
@click="submitNodeReport"> @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> </el-button>
</div> </div>
</el-dialog> </el-dialog>
@ -400,6 +400,12 @@ export default {
{ label: '5钣金箱', value: '5钣金箱' }, { label: '5钣金箱', value: '5钣金箱' },
{ label: '6铝型材箱', value: '6铝型材箱' } { label: '6铝型材箱', value: '6铝型材箱' }
], ],
stockingStepOptionList: [
{ label: '1平台组装配料', value: '1平台组装配料' },
{ label: '2门组装配料', value: '2门组装配料' },
{ label: '3背景墙/吊顶配料', value: '3背景墙/吊顶配料' },
{ label: '4打包配料', value: '4打包配料' }
],
reportData: { reportData: {
orderNo: '', orderNo: '',
orderType: '', orderType: '',
@ -634,8 +640,8 @@ export default {
} }
const requiredMap = { const requiredMap = {
HOME_LIFT: { HOME_LIFT: {
codeList: ['platformDebug', 'bgCeiling', 'doorAssy', 'pack'],
nameList: ['平台组装/调试', '背景墙/吊顶组装', '门组装', '打包']
codeList: ['stocking', 'platformDebug', 'bgCeiling', 'doorAssy', 'pack'],
nameList: ['仓库配料', '平台组装/调试', '背景墙/吊顶组装', '门组装', '打包']
}, },
RENOVATION: { RENOVATION: {
codeList: ['inspect', 'pack'], codeList: ['inspect', 'pack'],
@ -666,10 +672,69 @@ export default {
if (orderType === 'RENOVATION') { if (orderType === 'RENOVATION') {
return false return false
} }
if (this.isHomeLiftStockingNode(orderType, nodeCode, nodeName)) {
return true
}
const normalizedCode = String(nodeCode || '').trim() const normalizedCode = String(nodeCode || '').trim()
const normalizedName = String(nodeName || '').replace(/\s+/g, '') const normalizedName = String(nodeName || '').replace(/\s+/g, '')
return normalizedCode === 'pack' || normalizedName === '打包' 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) { directReportNode (order, node) {
this.reportData = { this.reportData = {
orderNo: order.orderNo, orderNo: order.orderNo,
@ -727,6 +792,10 @@ export default {
return 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.requiresMediaUpload(this.reportData.orderType, this.reportData.nodeCode, this.reportData.nodeName)) {
if (this.capturedMediaList.length > 0) { if (this.capturedMediaList.length > 0) {
this.submitNodeReportWithMedia(true) this.submitNodeReportWithMedia(true)
@ -736,7 +805,11 @@ export default {
this.submitNodeReportOnly('REPORT_ONLY') this.submitNodeReportOnly('REPORT_ONLY')
return 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 return
} }
this.submitNodeReportOnly('REPORT') this.submitNodeReportOnly('REPORT')
@ -780,21 +853,27 @@ export default {
}, },
submitNodeReportWithMedia (reportNode = true) { submitNodeReportWithMedia (reportNode = true) {
const pendingMediaList = this.getPendingCapturedMediaList() 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 (!pendingMediaList.length) {
if (reportNode && this.hasUploadedMediaOnly) { if (reportNode && this.hasUploadedMediaOnly) {
this.submitNodeReportOnly('REPORT_ONLY') this.submitNodeReportOnly('REPORT_ONLY')
return return
} }
if (this.capturedMediaList.length > 0) {
if (!allowStepOnlyNoFileUpload && this.capturedMediaList.length > 0) {
this.$message.warning('当前无待上传文件,请先拍照或录像') this.$message.warning('当前无待上传文件,请先拍照或录像')
return 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 formData = new FormData()
const payload = this.buildNodeReportPayload() const payload = this.buildNodeReportPayload()
@ -814,7 +893,7 @@ export default {
this.reportLoading = false this.reportLoading = false
this.reportAction = '' this.reportAction = ''
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message.success(data.msg || (reportNode ? '上传并报工成功' : '影像上传成功'))
this.$message.success(data.msg || (reportNode ? '上传并报工成功' : mediaOnlySuccessLabel))
if (reportNode) { if (reportNode) {
const mediaNodeKey = this.buildMediaNodeKey(this.reportData.orderNo, this.reportData.nodeCode) const mediaNodeKey = this.buildMediaNodeKey(this.reportData.orderNo, this.reportData.nodeCode)
if (mediaNodeKey && this.uploadedMediaNodeFlagMap[mediaNodeKey]) { if (mediaNodeKey && this.uploadedMediaNodeFlagMap[mediaNodeKey]) {
@ -838,12 +917,12 @@ export default {
} }
this.getDataList() this.getDataList()
} else { } else {
this.$message.error((data && data.msg) || (reportNode ? '上传并报工失败' : '影像上传失败'))
this.$message.error((data && data.msg) || (reportNode ? '上传并报工失败' : mediaOnlyFailedLabel))
} }
}).catch(() => { }).catch(() => {
this.reportLoading = false this.reportLoading = false
this.reportAction = '' this.reportAction = ''
this.$message.error(reportNode ? '上传并报工失败' : '影像上传失败')
this.$message.error(reportNode ? '上传并报工失败' : mediaOnlyFailedLabel)
}) })
}, },
buildNodeReportPayload () { buildNodeReportPayload () {
@ -852,7 +931,8 @@ export default {
orderNo: this.reportData.orderNo, orderNo: this.reportData.orderNo,
nodeCode: this.reportData.nodeCode, nodeCode: this.reportData.nodeCode,
reportQty: reportQty, reportQty: reportQty,
remark: this.reportData.remark || ''
remark: this.reportData.remark || '',
mediaStep: this.reportData.mediaStep || ''
} }
}, },
buildMediaNodeKey (orderNo, nodeCode) { buildMediaNodeKey (orderNo, nodeCode) {

Loading…
Cancel
Save