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", "name": "maintain_tool",
"version": "0.1.0", "version": "0.1.1",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",

View File

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