|
|
|
@ -608,8 +608,6 @@ export default { |
|
|
|
exceptionRuleClockDate: '', // 锁定页面日期 |
|
|
|
exceptionRuleClockTime: '', // 锁定页面时间 |
|
|
|
exceptionRuleClockTimer: null, // 锁定页面时钟定时器 |
|
|
|
pendingRuleFollowupAction: '', // 提示类规则在成功后需打开的功能动作 |
|
|
|
pendingRuleFollowupResultMap: null, |
|
|
|
scheduleData: { |
|
|
|
site: this.$store.state.user.site, |
|
|
|
username: this.$store.state.user.name, |
|
|
|
@ -864,7 +862,6 @@ export default { |
|
|
|
this.exceptionRuleMatchedRollIndex = null; |
|
|
|
this.exceptionRuleMatchedDefectRate = null; |
|
|
|
this.exceptionRuleMatchedTotalQty = null; |
|
|
|
this.resetPendingRuleFollowup(); |
|
|
|
// 重置缓存数据标记 |
|
|
|
this.hasCachedData = false; |
|
|
|
this.cachedDataCount = 0; |
|
|
|
@ -1630,11 +1627,6 @@ export default { |
|
|
|
this.$message.warning(completeError.message || '回写代办操作状态失败,请联系管理员检查'); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.triggerPendingRuleFollowupIfNeeded()) { |
|
|
|
this.abnormalCutLoading = false; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
// 延时关闭弹窗 |
|
|
|
setTimeout(() => { |
|
|
|
this.closeDialog(); |
|
|
|
@ -1865,7 +1857,6 @@ export default { |
|
|
|
} |
|
|
|
this.stopSplitRuleLockPolling() |
|
|
|
this.clearExceptionRuleVisualMeta() |
|
|
|
this.resetPendingRuleFollowup() |
|
|
|
//刷新报工的页面 |
|
|
|
this.$emit('refreshPageData'); |
|
|
|
//关闭当前的页面 |
|
|
|
@ -2075,29 +2066,53 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
resetPendingRuleFollowup () { |
|
|
|
this.pendingRuleFollowupAction = '' |
|
|
|
this.pendingRuleFollowupResultMap = null |
|
|
|
}, |
|
|
|
|
|
|
|
triggerPendingRuleFollowupIfNeeded () { |
|
|
|
const action = this.pendingRuleFollowupAction |
|
|
|
if (!action) { |
|
|
|
return false |
|
|
|
} |
|
|
|
const resultMap = this.pendingRuleFollowupResultMap || {} |
|
|
|
this.resetPendingRuleFollowup() |
|
|
|
this.$emit('refreshPageData') |
|
|
|
this.$emit('update:visible', false) |
|
|
|
if (action === 'OPEN_DEFECT') { |
|
|
|
this.$emit('openDefectByExceptionRule', resultMap) |
|
|
|
return true |
|
|
|
} |
|
|
|
if (action === 'OPEN_DOWNTIME') { |
|
|
|
this.$emit('openDownTimeByExceptionRule', resultMap) |
|
|
|
escapeHtml (value) { |
|
|
|
return String(value === null || value === undefined ? '' : value) |
|
|
|
.replace(/&/g, '&') |
|
|
|
.replace(/</g, '<') |
|
|
|
.replace(/>/g, '>') |
|
|
|
.replace(/"/g, '"') |
|
|
|
.replace(/'/g, ''') |
|
|
|
}, |
|
|
|
|
|
|
|
buildHintRuleConfirmContent (resultMap, action) { |
|
|
|
const triggerType = action === 'OPEN_DEFECT' ? '异常代码(提示)' : '异常单(提示)' |
|
|
|
const ruleCode = this.escapeHtml(resultMap && resultMap.ruleCode ? resultMap.ruleCode : '--') |
|
|
|
const ruleName = this.escapeHtml(resultMap && resultMap.ruleName ? resultMap.ruleName : '--') |
|
|
|
const conditionNo = this.escapeHtml(resultMap && resultMap.conditionNo ? resultMap.conditionNo : '--') |
|
|
|
const relationField = this.escapeHtml(resultMap && resultMap.relationField ? resultMap.relationField : '--') |
|
|
|
const compareSymbol = this.escapeHtml(resultMap && resultMap.compareSymbol ? resultMap.compareSymbol : '--') |
|
|
|
const conditionParam = this.escapeHtml(this.formatRuleNumber(resultMap && resultMap.conditionParam, 4)) |
|
|
|
const matchedValue = this.escapeHtml(this.formatRuleNumber(resultMap && resultMap.matchedConditionValue, 4)) |
|
|
|
const matchedRollIndex = this.escapeHtml(resultMap && resultMap.matchedRollIndex ? resultMap.matchedRollIndex : '--') |
|
|
|
const tip = this.escapeHtml(resultMap && resultMap.message ? resultMap.message : '触发提示规则,请确认是否继续执行当前操作。') |
|
|
|
return [ |
|
|
|
'<div style="line-height:1.75;">', |
|
|
|
`<div><strong>触发类型:</strong>${this.escapeHtml(triggerType)}</div>`, |
|
|
|
`<div><strong>规则:</strong>${ruleCode} / ${ruleName}</div>`, |
|
|
|
`<div><strong>条件:</strong>${conditionNo}(第${matchedRollIndex}卷) ${relationField} ${compareSymbol} ${conditionParam}</div>`, |
|
|
|
`<div><strong>触发值:</strong>${matchedValue}</div>`, |
|
|
|
`<div><strong>提示:</strong>${tip}</div>`, |
|
|
|
'</div>' |
|
|
|
].join('') |
|
|
|
}, |
|
|
|
|
|
|
|
async confirmContinueForHintRule (resultMap, action) { |
|
|
|
const content = this.buildHintRuleConfirmContent(resultMap || {}, action) |
|
|
|
try { |
|
|
|
await this.$confirm(content, '规则触发确认', { |
|
|
|
confirmButtonText: '继续', |
|
|
|
cancelButtonText: '关闭', |
|
|
|
type: 'warning', |
|
|
|
closeOnClickModal: false, |
|
|
|
closeOnPressEscape: false, |
|
|
|
showClose: false, |
|
|
|
dangerouslyUseHTMLString: true |
|
|
|
}) |
|
|
|
return true |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
return false |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
async completeSplitRuleTodoOperationIfNeeded () { |
|
|
|
@ -2142,7 +2157,6 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
async checkSplitRuleBeforeAction (actionName) { |
|
|
|
this.resetPendingRuleFollowup() |
|
|
|
const payload = this.buildSplitRuleCheckPayload(actionName) |
|
|
|
const { data } = await checkSplitRollExceptionRule(payload) |
|
|
|
if (!data || data.code === 500) { |
|
|
|
@ -2163,16 +2177,10 @@ export default { |
|
|
|
const action = resultMap.action || 'NONE' |
|
|
|
const message = resultMap.message || '触发异常规则,请先处理。' |
|
|
|
if (action === 'OPEN_DEFECT') { |
|
|
|
this.$message.warning(message) |
|
|
|
this.pendingRuleFollowupAction = action |
|
|
|
this.pendingRuleFollowupResultMap = resultMap |
|
|
|
return true |
|
|
|
return await this.confirmContinueForHintRule(resultMap, action) |
|
|
|
} |
|
|
|
if (action === 'OPEN_DOWNTIME') { |
|
|
|
this.$message.warning(message) |
|
|
|
this.pendingRuleFollowupAction = action |
|
|
|
this.pendingRuleFollowupResultMap = resultMap |
|
|
|
return true |
|
|
|
return await this.confirmContinueForHintRule(resultMap, action) |
|
|
|
} |
|
|
|
if (action === 'LOCK_PAGE') { |
|
|
|
this.exceptionRuleLocked = true |
|
|
|
@ -2394,11 +2402,6 @@ export default { |
|
|
|
this.$message.warning(completeError.message || '回写代办操作状态失败,请联系管理员检查') |
|
|
|
} |
|
|
|
|
|
|
|
if (this.triggerPendingRuleFollowupIfNeeded()) { |
|
|
|
this.yieldReportLoading = false |
|
|
|
return true |
|
|
|
} |
|
|
|
|
|
|
|
// 延时关闭弹窗 |
|
|
|
setTimeout(() =>{ |
|
|
|
//关闭当前的页面 |
|
|
|
|