|
|
@ -149,8 +149,8 @@ |
|
|
@selection-change="handleConditionSelection" |
|
|
@selection-change="handleConditionSelection" |
|
|
style="width: 100%;"> |
|
|
style="width: 100%;"> |
|
|
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> |
|
|
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> |
|
|
<el-table-column prop="conditionNo" label="条件编号" header-align="center" align="center" min-width="120"></el-table-column> |
|
|
|
|
|
<el-table-column prop="parentConditionNo" label="父条件编号" header-align="center" align="center" min-width="120"></el-table-column> |
|
|
|
|
|
|
|
|
<el-table-column prop="conditionNo" label="条件编号" header-align="center" align="center" min-width="80"></el-table-column> |
|
|
|
|
|
<el-table-column prop="parentConditionNo" label="父条件编号" header-align="center" align="center" min-width="80"></el-table-column> |
|
|
<el-table-column prop="relationField" label="关系字段" header-align="center" align="center" min-width="120"></el-table-column> |
|
|
<el-table-column prop="relationField" label="关系字段" header-align="center" align="center" min-width="120"></el-table-column> |
|
|
<el-table-column prop="compareSymbol" label="比较符" header-align="center" align="center" min-width="80"></el-table-column> |
|
|
<el-table-column prop="compareSymbol" label="比较符" header-align="center" align="center" min-width="80"></el-table-column> |
|
|
<el-table-column prop="conditionParam" label="条件参数" header-align="center" align="right" min-width="100"></el-table-column> |
|
|
<el-table-column prop="conditionParam" label="条件参数" header-align="center" align="right" min-width="100"></el-table-column> |
|
|
@ -162,12 +162,17 @@ |
|
|
{{ getResponsibilityDeptLabel(scope.row) }} |
|
|
{{ getResponsibilityDeptLabel(scope.row) }} |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column label="触发工序" header-align="center" align="left" min-width="160" show-overflow-tooltip> |
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
{{ formatTriggerWorkCenter(scope.row) }} |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
<el-table-column label="触发异常事件" header-align="center" align="center" min-width="110"> |
|
|
<el-table-column label="触发异常事件" header-align="center" align="center" min-width="110"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
{{ scope.row.parentConditionNo ? scope.row.triggerEvent : '' }} |
|
|
{{ scope.row.parentConditionNo ? scope.row.triggerEvent : '' }} |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
<el-table-column label="操作" header-align="center" align="center" min-width="80"> |
|
|
|
|
|
|
|
|
<el-table-column fixed="right" label="操作" header-align="center" align="center" min-width="80"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<el-link style="cursor: pointer" @click="openConditionEdit(scope.row)">编辑</el-link> |
|
|
<el-link style="cursor: pointer" @click="openConditionEdit(scope.row)">编辑</el-link> |
|
|
</template> |
|
|
</template> |
|
|
@ -249,6 +254,24 @@ |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-form> |
|
|
</el-form> |
|
|
|
|
|
<el-form :inline="true" label-position="top"> |
|
|
|
|
|
<el-form-item label="触发工序"> |
|
|
|
|
|
<el-select |
|
|
|
|
|
v-model="conditionForm.triggerWorkCenterList" |
|
|
|
|
|
multiple |
|
|
|
|
|
clearable |
|
|
|
|
|
filterable |
|
|
|
|
|
style="width: 640px" |
|
|
|
|
|
placeholder="请选择加工中心"> |
|
|
|
|
|
<el-option |
|
|
|
|
|
v-for="item in workCenterList" |
|
|
|
|
|
:key="item.workCenterNo" |
|
|
|
|
|
:label="item.workCenterDesc" |
|
|
|
|
|
:value="item.workCenterNo"> |
|
|
|
|
|
</el-option> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-form> |
|
|
<el-footer style="height: 35px; margin-top: 10px; text-align: center"> |
|
|
<el-footer style="height: 35px; margin-top: 10px; text-align: center"> |
|
|
<el-button type="primary" @click="saveCondition">保存</el-button> |
|
|
<el-button type="primary" @click="saveCondition">保存</el-button> |
|
|
<el-button type="primary" @click="conditionEditVisible = false">关闭</el-button> |
|
|
<el-button type="primary" @click="conditionEditVisible = false">关闭</el-button> |
|
|
@ -269,6 +292,7 @@ import { |
|
|
deleteSceneExceptionRuleCondition |
|
|
deleteSceneExceptionRuleCondition |
|
|
} from '@/api/sys/sceneExceptionRule' |
|
|
} from '@/api/sys/sceneExceptionRule' |
|
|
import { getSiteAndBuByUserName, getUserRoleList } from '@/api/qc/qc' |
|
|
import { getSiteAndBuByUserName, getUserRoleList } from '@/api/qc/qc' |
|
|
|
|
|
import { getWorkCenterList } from '@/api/orderIssure/soIssueNotify' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
data () { |
|
|
data () { |
|
|
@ -290,6 +314,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
buList: [], |
|
|
buList: [], |
|
|
roleList: [], |
|
|
roleList: [], |
|
|
|
|
|
workCenterList: [], |
|
|
mainDialogVisible: false, |
|
|
mainDialogVisible: false, |
|
|
mainDialogTitle: '新增异常规则', |
|
|
mainDialogTitle: '新增异常规则', |
|
|
mainForm: { |
|
|
mainForm: { |
|
|
@ -323,7 +348,9 @@ export default { |
|
|
warningLevel: '一般', |
|
|
warningLevel: '一般', |
|
|
animationEffect: '系统默认', |
|
|
animationEffect: '系统默认', |
|
|
responsibilityDept: '', |
|
|
responsibilityDept: '', |
|
|
triggerEvent: '' |
|
|
|
|
|
|
|
|
triggerEvent: '', |
|
|
|
|
|
triggerWorkCenter: '', |
|
|
|
|
|
triggerWorkCenterList: [] |
|
|
}, |
|
|
}, |
|
|
relationFieldOptions: ['排数', '分切卷数', '总卷数', '良品数', '面损', '性能不良', '不良数', '良率', '不良率', '总数'], |
|
|
relationFieldOptions: ['排数', '分切卷数', '总卷数', '良品数', '面损', '性能不良', '不良数', '良率', '不良率', '总数'], |
|
|
compareSymbolOptions: ['>', '=', '<', '>=', '<='], |
|
|
compareSymbolOptions: ['>', '=', '<', '>=', '<='], |
|
|
@ -349,6 +376,7 @@ export default { |
|
|
created () { |
|
|
created () { |
|
|
this.loadBuList() |
|
|
this.loadBuList() |
|
|
this.loadRoleList() |
|
|
this.loadRoleList() |
|
|
|
|
|
this.loadWorkCenterList() |
|
|
this.getDataList() |
|
|
this.getDataList() |
|
|
}, |
|
|
}, |
|
|
mounted () { |
|
|
mounted () { |
|
|
@ -381,6 +409,16 @@ export default { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
loadWorkCenterList () { |
|
|
|
|
|
const params = { username: this.$store.state.user.name } |
|
|
|
|
|
getWorkCenterList(params).then(({ data }) => { |
|
|
|
|
|
if (data && data.code === 0) { |
|
|
|
|
|
this.workCenterList = data.rows || [] |
|
|
|
|
|
} else { |
|
|
|
|
|
this.workCenterList = [] |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
getResponsibilityDeptLabel (row) { |
|
|
getResponsibilityDeptLabel (row) { |
|
|
if (!row) { |
|
|
if (!row) { |
|
|
return '' |
|
|
return '' |
|
|
@ -394,6 +432,40 @@ export default { |
|
|
const matched = (this.roleList || []).find(item => String(item.roleId) === String(row.responsibilityDept)) |
|
|
const matched = (this.roleList || []).find(item => String(item.roleId) === String(row.responsibilityDept)) |
|
|
return matched ? matched.roleName : row.responsibilityDept |
|
|
return matched ? matched.roleName : row.responsibilityDept |
|
|
}, |
|
|
}, |
|
|
|
|
|
getWorkCenterLabel (workCenterNo) { |
|
|
|
|
|
if (!workCenterNo) { |
|
|
|
|
|
return '' |
|
|
|
|
|
} |
|
|
|
|
|
const matched = (this.workCenterList || []).find(item => item.workCenterNo === workCenterNo) |
|
|
|
|
|
return matched ? matched.workCenterDesc : workCenterNo |
|
|
|
|
|
}, |
|
|
|
|
|
parseTriggerWorkCenterList (triggerWorkCenter) { |
|
|
|
|
|
if (!triggerWorkCenter) { |
|
|
|
|
|
return [] |
|
|
|
|
|
} |
|
|
|
|
|
const rawArr = String(triggerWorkCenter).split(/[,;,;]/) |
|
|
|
|
|
const result = [] |
|
|
|
|
|
rawArr.forEach(item => { |
|
|
|
|
|
const value = item ? item.trim() : '' |
|
|
|
|
|
if (value && result.indexOf(value) === -1) { |
|
|
|
|
|
result.push(value) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
return result |
|
|
|
|
|
}, |
|
|
|
|
|
joinTriggerWorkCenterList (triggerWorkCenterList) { |
|
|
|
|
|
return this.parseTriggerWorkCenterList((triggerWorkCenterList || []).join(';')).join(';') |
|
|
|
|
|
}, |
|
|
|
|
|
formatTriggerWorkCenter (row) { |
|
|
|
|
|
if (!row || !row.triggerWorkCenter) { |
|
|
|
|
|
return '' |
|
|
|
|
|
} |
|
|
|
|
|
const workCenterNoList = this.parseTriggerWorkCenterList(row.triggerWorkCenter) |
|
|
|
|
|
if (workCenterNoList.length === 0) { |
|
|
|
|
|
return '' |
|
|
|
|
|
} |
|
|
|
|
|
return workCenterNoList.map(item => this.getWorkCenterLabel(item)).join('、') |
|
|
|
|
|
}, |
|
|
queryRule () { |
|
|
queryRule () { |
|
|
this.pageIndex = 1 |
|
|
this.pageIndex = 1 |
|
|
this.getDataList() |
|
|
this.getDataList() |
|
|
@ -578,7 +650,9 @@ export default { |
|
|
warningLevel: '一般', |
|
|
warningLevel: '一般', |
|
|
animationEffect: '系统默认', |
|
|
animationEffect: '系统默认', |
|
|
responsibilityDept: '', |
|
|
responsibilityDept: '', |
|
|
triggerEvent: parentConditionNo ? '异常代码' : '' |
|
|
|
|
|
|
|
|
triggerEvent: parentConditionNo ? '异常代码' : '', |
|
|
|
|
|
triggerWorkCenter: '', |
|
|
|
|
|
triggerWorkCenterList: [] |
|
|
} |
|
|
} |
|
|
this.applyConditionRule() |
|
|
this.applyConditionRule() |
|
|
this.conditionEditVisible = true |
|
|
this.conditionEditVisible = true |
|
|
@ -621,7 +695,9 @@ export default { |
|
|
warningLevel: row.warningLevel, |
|
|
warningLevel: row.warningLevel, |
|
|
animationEffect: row.animationEffect, |
|
|
animationEffect: row.animationEffect, |
|
|
responsibilityDept: row.responsibilityDept, |
|
|
responsibilityDept: row.responsibilityDept, |
|
|
triggerEvent: row.parentConditionNo ? row.triggerEvent : '' |
|
|
|
|
|
|
|
|
triggerEvent: row.parentConditionNo ? row.triggerEvent : '', |
|
|
|
|
|
triggerWorkCenter: row.triggerWorkCenter || '', |
|
|
|
|
|
triggerWorkCenterList: this.parseTriggerWorkCenterList(row.triggerWorkCenter) |
|
|
} |
|
|
} |
|
|
this.applyConditionRule() |
|
|
this.applyConditionRule() |
|
|
this.conditionEditVisible = true |
|
|
this.conditionEditVisible = true |
|
|
@ -651,6 +727,10 @@ export default { |
|
|
this.$message.warning('请选择是否强制') |
|
|
this.$message.warning('请选择是否强制') |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
if (!this.conditionForm.triggerWorkCenterList || this.conditionForm.triggerWorkCenterList.length === 0) { |
|
|
|
|
|
this.$message.warning('请选择触发工序') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
if (this.isChildCondition && !this.conditionForm.triggerEvent) { |
|
|
if (this.isChildCondition && !this.conditionForm.triggerEvent) { |
|
|
this.$message.warning('请选择触发异常事件') |
|
|
this.$message.warning('请选择触发异常事件') |
|
|
return |
|
|
return |
|
|
@ -660,8 +740,13 @@ export default { |
|
|
} else if (this.conditionForm.triggerEvent === '异常代码') { |
|
|
} else if (this.conditionForm.triggerEvent === '异常代码') { |
|
|
this.conditionForm.forceType = '提示' |
|
|
this.conditionForm.forceType = '提示' |
|
|
} |
|
|
} |
|
|
|
|
|
const payload = this.buildConditionPayload() |
|
|
|
|
|
if (!payload.triggerWorkCenter) { |
|
|
|
|
|
this.$message.warning('请选择触发工序') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
if (this.conditionForm.mode === 'add') { |
|
|
if (this.conditionForm.mode === 'add') { |
|
|
saveSceneExceptionRuleCondition(this.conditionForm).then(({ data }) => { |
|
|
|
|
|
|
|
|
saveSceneExceptionRuleCondition(payload).then(({ data }) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
this.conditionEditVisible = false |
|
|
this.conditionEditVisible = false |
|
|
this.$message.success('操作成功') |
|
|
this.$message.success('操作成功') |
|
|
@ -671,7 +756,7 @@ export default { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
updateSceneExceptionRuleCondition(this.conditionForm).then(({ data }) => { |
|
|
|
|
|
|
|
|
updateSceneExceptionRuleCondition(payload).then(({ data }) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
this.conditionEditVisible = false |
|
|
this.conditionEditVisible = false |
|
|
this.$message.success('操作成功') |
|
|
this.$message.success('操作成功') |
|
|
@ -682,6 +767,12 @@ export default { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
buildConditionPayload () { |
|
|
|
|
|
const payload = JSON.parse(JSON.stringify(this.conditionForm || {})) |
|
|
|
|
|
payload.triggerWorkCenter = this.joinTriggerWorkCenterList(payload.triggerWorkCenterList || []) |
|
|
|
|
|
delete payload.triggerWorkCenterList |
|
|
|
|
|
return payload |
|
|
|
|
|
}, |
|
|
deleteCondition () { |
|
|
deleteCondition () { |
|
|
if (this.conditionSelection.length === 0) { |
|
|
if (this.conditionSelection.length === 0) { |
|
|
this.$message.warning('请勾选要删除的触发条件') |
|
|
this.$message.warning('请勾选要删除的触发条件') |
|
|
|