fix null ref of performance issue

This commit is contained in:
renxiaoyin 2023-02-09 14:19:13 +08:00
parent 1d9b2eb6bb
commit e03b6c2d3f
2 changed files with 18 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{
"name": "maintain_tool",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",

View File

@ -1,7 +1,7 @@
<template>
<div>
<!-- <div>
<button v-if="true" @click="testBreakPoint">TestBreakPoint</button>
</div>
</div> -->
<el-row>
@ -156,6 +156,7 @@ export default {
workflows: this.workflows,
mobilePhone: this.mobilePhone,
};
console.log(this.env)
var ipcReceiverName = "query-" + this.env;
var encodedRequest = JSON.stringify(request);
@ -163,9 +164,10 @@ export default {
window.ipcRenderer.receive("get-result", (param) => {
console.log("ipc receive");
console.log(param);
this.processMsgs = JSON.parse(param.rs);
var normalizedMsgs = this.reformMsgs(this.processMsgs);
this.normalizedMsgs.forEach(item => {
var rawProcessMsgs = JSON.parse(param.rs);
this.processMsgs = this.reformMsgs(rawProcessMsgs);
console.log(this.processMsgs);
this.processMsgs.forEach(item => {
if (Array.isArray(item.data)) {
// extract data title
@ -220,6 +222,7 @@ export default {
},
reformMsgs(msgs) {
var normalizedMsgs = [];
console.log("begin reform")
msgs.forEach(msg => {
if (Array.isArray(msg.data) || typeof (msg.data) == "string" || typeof (msg.data) == "number" || typeof (msg.data) == "bigint" || typeof (msg.data) == "boolean") {
normalizedMsgs.push(msg);
@ -227,21 +230,25 @@ export default {
else {
if (this.isMixed(msg.data)) {
if (msg.message == '业绩与模板相匹配') {
console.log(1);
var template = msg.data.template;
var newMsg = {
message: `业绩与模板相匹配:basicTemplateId=${template.basicId},templateCode=${template.paymentCode} subTemplateId=${template.subTemplateId}` ,
data:[msg.data.performance],
data:msg.data.performance,
component:msg.component
}
console.log(2);
normalizedMsgs.push(newMsg);
}
else if (msg.message == '业绩与模板不匹配') {
var subTemplates = msg.data.template.subTemplates;
console.log(3);
var templateMsg = {
message:`业绩与模板不匹配: basicTemplateId=${msg.data.template.basicId}`,
data:subTemplates,
component:msg.component
};
console.log(4);
normalizedMsgs.push(templateMsg);
var perfMsg = {
message:`未匹配业绩`,
@ -258,10 +265,14 @@ export default {
}
}
});
console.log("end reform")
return normalizedMsgs;
},
isMixed(data) {
console.log('ismixed')
if (data == null || data ==undefined) return false;
if (data.performance != null && data.performance != undefined && data.template != null && data.template != undefined)
return true;
return false;