|
@@ -78,72 +78,138 @@ const handleOpenContent = async ({ id, category, reason:title }) => {
|
|
|
flowParams.simulate = '{}';
|
|
|
|
|
|
answerLoading.value = false;
|
|
|
+
|
|
|
+ answerResult.value = [];
|
|
|
|
|
|
const { data } = await waterApi.getWaringDetails(id);
|
|
|
-
|
|
|
- const answer = JSON.parse(data.answer);
|
|
|
const showVal = JSON.parse(data.showVal);
|
|
|
const { basic, jsData, csData } = showVal;
|
|
|
-
|
|
|
- cancelFetch();
|
|
|
|
|
|
- answerResult.value = [];
|
|
|
+ try {
|
|
|
+ const answer = JSON.parse(data.answer);
|
|
|
+ const reportList = [];
|
|
|
+ const alertList = [];
|
|
|
+ let simulateObj = null;
|
|
|
+
|
|
|
+ answer.map(item => {
|
|
|
+ const answerObjItem = JSON.parse(item);
|
|
|
+ switch(answerObjItem.biz) {
|
|
|
+ case "DECISION_REPORT":
|
|
|
+ reportList.push(answerObjItem.message);
|
|
|
+ break
|
|
|
+ case "DECISION_ALERT":
|
|
|
+ alertList.push(answerObjItem);
|
|
|
+ break
|
|
|
+ case "DECISION_SIMULATE":
|
|
|
+ console.log( "DECISION_SIMULATE", answerObjItem.message );
|
|
|
+ if (warningActive.value === 1) return;
|
|
|
+ const { off, on, pred } = JSON.parse(answerObjItem.message);
|
|
|
+ simulateObj = {
|
|
|
+ biz: 'DECISION_SIMULATE',
|
|
|
+ off,
|
|
|
+ on,
|
|
|
+ pred,
|
|
|
+ isDisable: false
|
|
|
+ }
|
|
|
+ modalData.value = simulateObj;
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
- const reportList = [];
|
|
|
- const alertList = [];
|
|
|
- let simulateObj = null;
|
|
|
-
|
|
|
- answer.map(item => {
|
|
|
- const answerObjItem = JSON.parse(item);
|
|
|
- switch(answerObjItem.biz) {
|
|
|
- case "DECISION_REPORT":
|
|
|
- reportList.push(answerObjItem.message);
|
|
|
- break
|
|
|
- case "DECISION_ALERT":
|
|
|
- alertList.push(answerObjItem);
|
|
|
- break
|
|
|
- case "DECISION_SIMULATE":
|
|
|
- console.log( "DECISION_SIMULATE", answerObjItem.message );
|
|
|
- if (warningActive.value === 1) return;
|
|
|
- const { off, on, pred } = JSON.parse(answerObjItem.message);
|
|
|
- console.log( JSON.parse(answerObjItem.message) );
|
|
|
- simulateObj = {
|
|
|
- biz: 'DECISION_SIMULATE',
|
|
|
- off,
|
|
|
- on,
|
|
|
- pred,
|
|
|
- isDisable: false
|
|
|
- }
|
|
|
- modalData.value = simulateObj;
|
|
|
+ if ( reportList.length ) {
|
|
|
+ answerResult.value.push({
|
|
|
+ biz: 'DECISION_REPORT',
|
|
|
+ answer: reportList.join(""),
|
|
|
+ loading: false,
|
|
|
+ delayLoading: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( alertList.length ) {
|
|
|
+ const [ parseAnswer ] = alertList.map(item => {
|
|
|
+ item.message = Object.keys(item.message).map(key => ({ ...item.message[key], isActive: null }));
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ answerResult.value.push({
|
|
|
+ biz: 'DECISION_ALERT',
|
|
|
+ loading: false,
|
|
|
+ delayLoading: false,
|
|
|
+ isAllSelect: false,
|
|
|
+ list: parseAnswer?.message
|
|
|
+ })
|
|
|
}
|
|
|
- })
|
|
|
|
|
|
- if ( reportList.length ) {
|
|
|
+ if (simulateObj) {
|
|
|
+ answerResult.value.push(simulateObj);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (error) {
|
|
|
answerResult.value.push({
|
|
|
biz: 'DECISION_REPORT',
|
|
|
- answer: reportList.join(""),
|
|
|
+ answer: data.answer,
|
|
|
loading: false,
|
|
|
delayLoading: false
|
|
|
})
|
|
|
+ console.log("error", error);
|
|
|
}
|
|
|
|
|
|
- if ( alertList.length ) {
|
|
|
- const [ parseAnswer ] = alertList.map(item => {
|
|
|
- item.message = Object.keys(item.message).map(key => ({ ...item.message[key], isActive: null }));
|
|
|
- return item;
|
|
|
- })
|
|
|
- answerResult.value.push({
|
|
|
- biz: 'DECISION_ALERT',
|
|
|
- loading: false,
|
|
|
- delayLoading: false,
|
|
|
- isAllSelect: false,
|
|
|
- list: parseAnswer?.message
|
|
|
- })
|
|
|
- }
|
|
|
+ cancelFetch();
|
|
|
|
|
|
- if (simulateObj) {
|
|
|
- answerResult.value.push(simulateObj);
|
|
|
- }
|
|
|
+ // answerResult.value = [];
|
|
|
+
|
|
|
+ // const reportList = [];
|
|
|
+ // const alertList = [];
|
|
|
+ // let simulateObj = null;
|
|
|
+
|
|
|
+ // answer.map(item => {
|
|
|
+ // const answerObjItem = JSON.parse(item);
|
|
|
+ // switch(answerObjItem.biz) {
|
|
|
+ // case "DECISION_REPORT":
|
|
|
+ // reportList.push(answerObjItem.message);
|
|
|
+ // break
|
|
|
+ // case "DECISION_ALERT":
|
|
|
+ // alertList.push(answerObjItem);
|
|
|
+ // break
|
|
|
+ // case "DECISION_SIMULATE":
|
|
|
+ // console.log( "DECISION_SIMULATE", answerObjItem.message );
|
|
|
+ // if (warningActive.value === 1) return;
|
|
|
+ // const { off, on, pred } = JSON.parse(answerObjItem.message);
|
|
|
+ // simulateObj = {
|
|
|
+ // biz: 'DECISION_SIMULATE',
|
|
|
+ // off,
|
|
|
+ // on,
|
|
|
+ // pred,
|
|
|
+ // isDisable: false
|
|
|
+ // }
|
|
|
+ // modalData.value = simulateObj;
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+
|
|
|
+ // if ( reportList.length ) {
|
|
|
+ // answerResult.value.push({
|
|
|
+ // biz: 'DECISION_REPORT',
|
|
|
+ // answer: reportList.join(""),
|
|
|
+ // loading: false,
|
|
|
+ // delayLoading: false
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if ( alertList.length ) {
|
|
|
+ // const [ parseAnswer ] = alertList.map(item => {
|
|
|
+ // item.message = Object.keys(item.message).map(key => ({ ...item.message[key], isActive: null }));
|
|
|
+ // return item;
|
|
|
+ // })
|
|
|
+ // answerResult.value.push({
|
|
|
+ // biz: 'DECISION_ALERT',
|
|
|
+ // loading: false,
|
|
|
+ // delayLoading: false,
|
|
|
+ // isAllSelect: false,
|
|
|
+ // list: parseAnswer?.message
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (simulateObj) {
|
|
|
+ // answerResult.value.push(simulateObj);
|
|
|
+ // }
|
|
|
|
|
|
basic.title = title;
|
|
|
textDataSources.value = formatToData(basic, '报警值');
|