reactComponent.js 5.41 KB
Newer Older
DarkForst's avatar
DarkForst committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
const columns = [
    {
        title: '等级',
        dataIndex: 'level',
    },
    {
        title: '来源',
        dataIndex: 'source',
    },
    {
        title: '参数',
        dataIndex: 'attr',
    },
    {
        title: '报警值',
        dataIndex: 'value',
    },
    {
        title: '时间',
        dataIndex: 'time',
    }
];

const data = [
    {
        level: '一级',
        source: '自动上报',
        attr: '电压过高',
        value: '245V',
        time: '2021-03-02'
    }
];



export default [
    // {
    //     text: '按钮',
    //     icon: 'icontopologyfont icon-topology-anniu',
    //     name: 'button',
    //     color: '#f50',
    //     data: {
    //         text: '',
    //         autoRect: true,
    //         strokeStyle: '#fff',
    //         rect: {
    //             x: 100,
    //             y: 200,
    //             width: 100,
    //             height: 35
    //         },
    //         hideAnchor: true,
    //         name: 'button',
    //         data: {
    //             // 组件属性配置
    //             props: {
    //                 type: 'primary',
    //                 children: '查询'
    //             },
    //             // 异步请求配置
    //             http: {
    //                 api: '/api/topologies?',
    //                 type: 'get',
    //                 paramsGetStyle: 'subscribe',
    //                 paramsArr: []
    //             },
    //             // 绑定如图表图例id
    //             bind: []
    //         },
    //         events: [
    //             // {
    //             //   type: 'doFn',
    //             //   action: 'Function',
    //             //   value: `let fun = (a) =>  params + a; fun(123); return 1231;  `,
    //             //   params: 123,
    //             //   name: 'onClick'
    //             // }
    //         ]
    //     }
    // },
    {
      name: '属性值',
      icon: 'icontopologyfont icon-topology-comment_lines',
      title: 'title',
      data: {
        rect: {
          width: 200,
          height: 30,
          direction: '空调2'
        },
        name: 'testImg',
      }
    },
    // {
    //     name: '属性值2',
    //     icon: 'icontopologyfont icon-topology-comment_lines',
    //     title: 'title',
    //     data: {
    //       rect: {
    //         width: 120,
    //         height: 23,
    //         direction: '空调2'
    //       },
    //       name: 'flowTest',
    //     }
    //   },
    {
        text: '统计',
        icon: 'icontopologyfont icon-topology-structured_data',
        name: '设备状态统计',
        color: '#f50',
        data: {
            text: '',
            autoRect: true,
            strokeStyle: '#fff',
            rect: {
                x: 100,
                y: 200,
                width: 276,
                height: 168
            },
            hideAnchor: true,
            name: 'reactStatistics',
            data: {
                // 组件属性配置
                props: {
                    columns: [{
                        title: '正常设备',
                        dataIndex: 'normal'
                    },{
                        title: '故障设备',
                        dataIndex: 'malfunction'
                    },{
                        title: '报警设备',
                        dataIndex: 'alert'
                    },{
                        title: '检修设备',
                        dataIndex: 'overhaul'
                    },{
                        title: '停用设备',
                        dataIndex: 'deactivate'
                    },{
                        title: '离线设备',
                        dataIndex: 'offline'
                    }],
                    dataSource: {}
                },
                // 异步请求配置
                http: {
                    api: '/device-service/device/device-status-count',
                    type: 'post',
                    paramsGetStyle: 'subscribe',
                    paramsArr: []
                },
                // 绑定如图表图例id
                bind: []
            }
        }
    },
    {
        text: '表格',
        icon: 'icontopologyfont icon-topology-calculator',
        name: 'table',
        data: {
            strokeStyle: '#fff',
            hideAnchor: true,
            rect: {
                x: 100,
                y: 200,
                width: 600,
                height: 400
            },
            name: 'table',
            data: {
                props: {
                    columns: columns,
                    dataSource: data,
                    bordered: true,
                    pagination: false,
                    size: 'small',
                },
                // 异步请求配置
                http: {
                    api: '/device-extend/device/alarm/_query?',
                    type: 'get',
                    handleResult: 'result.data',
                    paramsGetStyle: 'subscribe',
                    paramsArr: [{ title: 'pageIndex', value: 1 }, { title: 'pageSize', value: 6 }]
                }
            },
            events: [
                {
                    type: 'doFn',
                    action: 'Function',
                    value: `let fun = (a) =>  console.log(params + a); fun(123);`,
                    params: 123,
                    name: 'onClick'
                }
            ]
        }
    }
]