Browse Source

取消报工BUG

master
han\hanst 4 weeks ago
parent
commit
b8fbb1c15f
  1. 33
      src/views/modules/longtron/production-report-cancel.vue
  2. 23
      src/views/modules/longtron/production-work-report.vue
  3. 60
      src/views/modules/longtron/screen-factory-overview.vue

33
src/views/modules/longtron/production-report-cancel.vue

@ -141,18 +141,29 @@ export default {
this.$confirm('确定取消该条报工记录吗?取消后需要重新报工。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
cancelReportLog({ logNo: row.logNo }).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success(data.msg || '取消报工成功')
this.getDataList()
} else {
this.$message.error((data && data.msg) || '取消报工失败')
type: 'warning',
beforeClose: (action, instance, done) => {
if (action !== 'confirm') {
done()
return
}
}).catch(() => {
this.$message.error('取消报工失败')
})
instance.confirmButtonLoading = true
instance.confirmButtonText = '取消中...'
cancelReportLog({ logNo: row.logNo }).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success(data.msg || '取消报工成功')
this.getDataList()
done()
} else {
this.$message.error((data && data.msg) || '取消报工失败')
}
}).catch(() => {
this.$message.error('取消报工失败')
}).finally(() => {
instance.confirmButtonLoading = false
instance.confirmButtonText = '确定'
})
}
}).catch(() => {})
},
sizeChangeHandle(val) {

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

@ -483,7 +483,7 @@ export default {
const currentNode = row.currentNode || fallbackCurrentNodeObj.nodeName || '全部完成'
return {
...row,
nodeReportMode: row.nodeReportMode || 'PARALLEL',
nodeReportMode: this.resolveNodeReportMode(row.orderType, row.nodeReportMode),
currentNodeCode: row.currentNodeCode || fallbackCurrentNodeObj.nodeCode || '',
orderTypeName: this.getOrderTypeName(row.orderType),
productName: row.taskNo || row.projectNo || '-',
@ -571,11 +571,30 @@ export default {
if (!order || !node) {
return false
}
if ((order.nodeReportMode || 'PARALLEL') !== 'SEQUENTIAL') {
if (this.resolveNodeReportMode(order.orderType, order.nodeReportMode) !== 'SEQUENTIAL') {
return true
}
return !!order.currentNodeCode && order.currentNodeCode === node.nodeCode
},
resolveNodeReportMode (orderType, nodeReportMode) {
const mode = String(nodeReportMode || '').trim().toUpperCase()
if (mode === 'SEQUENTIAL') {
return 'SEQUENTIAL'
}
if (mode === 'PARALLEL') {
return 'PARALLEL'
}
return this.isSequentialDefaultOrderType(orderType) ? 'SEQUENTIAL' : 'PARALLEL'
},
isSequentialDefaultOrderType (orderType) {
const rawType = String(orderType || '').trim()
const type = rawType.toUpperCase()
return type === 'MACHINING' ||
type === 'RENOVATION' ||
rawType === '机加工生产' ||
rawType === '机加工生产任务单' ||
rawType === '改造项目'
},
handleReportNode (order, node) {
if (!order || !node) {
return

60
src/views/modules/longtron/screen-factory-overview.vue

@ -75,6 +75,25 @@ import echarts from 'echarts'
import { getFactoryOverviewBoardData } from '@/api/longchuang/productionPlan'
const STATUS_ALLOW_LIST = ['已排产', '进行中', '已完成']
const KEY_NODE_NAME_ORDER = ['仓库配料', 'VL2.5组装', '检验', '打包', '线缆/COP', '机加工生产', '机加工检验']
const NODE_NAME_BY_CODE = {
stocking: '仓库配料',
assy: 'VL2.5组装',
inspect: '检验',
pack: '打包',
lineProduction: '线缆/COP',
copProduction: '线缆/COP',
machiningProduction: '机加工生产',
machiningInspection: '机加工检验',
platformDebug: '平台组装/调试',
bgCeiling: '背景墙/吊顶组装',
doorAssy: '门组装'
}
const NODE_DISPLAY_NAME_ALIAS = {
组装: 'VL2.5组装',
线缆生产: '线缆/COP',
COP生产: '线缆/COP'
}
export default {
name: 'ScreenFactoryOverview',
@ -158,6 +177,7 @@ export default {
},
normalizeNodeList(sourceList) {
return (sourceList || []).map(node => ({
nodeCode: node && node.nodeCode ? node.nodeCode : '',
nodeName: node && node.nodeName ? node.nodeName : '',
status: node && node.status ? node.status : ''
}))
@ -239,21 +259,49 @@ export default {
all.forEach(item => {
const list = item.nodeList || []
list.forEach(node => {
if (!nodeMap[node.nodeName]) nodeMap[node.nodeName] = { total: 0, done: 0 }
nodeMap[node.nodeName].total += 1
if (node.status === '已完成') nodeMap[node.nodeName].done += 1
const nodeName = this.resolveNodeName(node)
if (!nodeName) return
if (!nodeMap[nodeName]) nodeMap[nodeName] = { total: 0, done: 0 }
nodeMap[nodeName].total += 1
if (node.status === '已完成') nodeMap[nodeName].done += 1
})
})
return Object.keys(nodeMap).map((name) => {
KEY_NODE_NAME_ORDER.forEach(name => {
if (!nodeMap[name]) {
nodeMap[name] = { total: 0, done: 0 }
}
})
const keyNodeRateList = KEY_NODE_NAME_ORDER.map((name) => {
const total = nodeMap[name].total
const done = nodeMap[name].done
return {
name,
total,
done,
rate: total ? Math.round((done / total) * 100) : 0,
rate: total ? Math.round((done / total) * 100) : 0
}
}).sort((a, b) => b.rate - a.rate)
})
const extraNodeRateList = Object.keys(nodeMap)
.filter(name => !KEY_NODE_NAME_ORDER.includes(name))
.map((name) => {
const total = nodeMap[name].total
const done = nodeMap[name].done
return {
name,
total,
done,
rate: total ? Math.round((done / total) * 100) : 0
}
})
.sort((a, b) => b.rate - a.rate)
return keyNodeRateList.concat(extraNodeRateList)
},
resolveNodeName(node) {
if (!node) return ''
const nodeName = String(node.nodeName || '').trim()
if (nodeName) return NODE_DISPLAY_NAME_ALIAS[nodeName] || nodeName
const nodeCode = String(node.nodeCode || '').trim()
return NODE_NAME_BY_CODE[nodeCode] || ''
},
getNodeRateClass(rate) {
if (rate >= 85) return 'is-high'

Loading…
Cancel
Save