Browse Source

2026-07-21

异常规则配置
master
fengyuan_yang 1 week ago
parent
commit
9ea49e221e
  1. 91
      src/views/modules/yieldReport/com_separate_roll.vue

91
src/views/modules/yieldReport/com_separate_roll.vue

@ -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, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
},
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
}
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(() =>{
//

Loading…
Cancel
Save