@easyv-find events abnormal

easyv 查找事件异常组件

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         @easyv-find events abnormal
// @namespace    http://tampermonkey.net/
// @version      0.1.2
// @description  easyv 查找事件异常组件
// @author       You
// @match        https://easyv.cloud/workspace/
// @icon         https://www.google.com/s2/favicons?domain=dtstack.net
// @grant        none
// ==/UserScript==

(async function() {
    'use strict';
    console.info('fetch loading....')
    const result = await fetch('https://easyv.cloud/api/easyv/v3/screen/export?id=356479').then(function(res){  return res.json() });
    console.log(result);
    main(result.data);
    // Your code here...
})();

async function main(data){
    data.componentsConfig && filterComponentsConfig(data.componentsConfig)

    if(data.panelConfig && data.panelConfig.length){
        data.panelConfig.forEach(d=>{
            d.stateConfig?.length && d.stateConfig.forEach(d=>{
                d && main(d);
            })
        })
    }
}



function filterComponentsConfig(componentsConfig){
    const events = componentsConfig.map(d=>{ return { events:JSON.parse(d.events),id:d.id } }).filter(d=>d.events.length);
    const actions = events.map(d=>{
        return {events:d.events.filter(d=> !d.id),id:d.id}
    }).flat(2).filter(d=>d.events.length);
    console.log(actions)
   // const actions
}