Эх сурвалжийг харах

Squashed commit of the following:

commit c6ae9616dd4762e5cef246898a3c9d8aca886a85
Merge: fd83f7f 1c6a121
Author: Renxy <18510891294@163.com>
Date:   Fri Jul 29 16:36:27 2022 +0800

    Merge branch 'develop' of http://120.55.44.4:10080/xujunjie/WorkloadWeb into develop

commit fd83f7f9bf3f8f9336fb3d7a92f8dd72627bd854
Author: Renxy <18510891294@163.com>
Date:   Fri Jul 29 16:35:36 2022 +0800

    修改上传模板的名称显示/版本树加时间轴

commit 1c6a1218a87bdb5e8837b24ad0ac51ea44cafbeb
Author: xujunjie <645007605@qq.com>
Date:   Fri Jul 29 13:32:41 2022 +0800

    修复图表特定情况下渲染出错

commit 39714cfda5107c7a5f3ecc5c45a7b41495aa1c4a
Merge: 5904c28 af73d12
Author: xujunjie <645007605@qq.com>
Date:   Fri Jul 29 10:13:19 2022 +0800

    Merge branch 'develop' of http://120.55.44.4:10080/xujunjie/WorkloadWeb into develop

commit 5904c2852ece716be335427761ecf442c281ba8d
Author: xujunjie <645007605@qq.com>
Date:   Fri Jul 29 10:13:10 2022 +0800

    chart增加loading

commit af73d12783233b1cdfc12696b74f691626db3824
Author: Renxy <18510891294@163.com>
Date:   Thu Jul 28 18:38:52 2022 +0800

    修改地址

commit c73d7546da57b383f59098436a4582442f053b64
Author: Renxy <18510891294@163.com>
Date:   Thu Jul 28 18:35:08 2022 +0800

    修改清单列表名称

commit cae1ca9e789fbc0501e510f3fc3818d7248a82e2
Merge: be06c29 6164534
Author: Renxy <18510891294@163.com>
Date:   Thu Jul 28 18:24:34 2022 +0800

    Merge branch 'develop' of http://120.55.44.4:10080/xujunjie/WorkloadWeb into develop

commit be06c296d6a6e3a9bb5d8d5e82438c2559d8ef35
Author: Renxy <18510891294@163.com>
Date:   Thu Jul 28 18:24:26 2022 +0800

    Squashed commit of the following:
    merge
    commit fb15ff1a9133a283c9a56d8b9d7cc5c7c317dd8f
    Merge: cab6b57 76ac234
    Author: Renxy <18510891294@163.com>
    Date:   Thu Jul 28 18:19:55 2022 +0800

        Merge branch 'develop' into develop_0715

    commit cab6b575840ce3a5b656f8e2d447f73b27ed214b
    Author: Renxy <18510891294@163.com>
    Date:   Thu Jul 28 18:16:32 2022 +0800

        修改地址

    commit 4ee0a55c32cb62c4579396b6c8b311ce6e7eda7c
    Author: Renxy <18510891294@163.com>
    Date:   Thu Jul 28 18:11:54 2022 +0800

        修改查看直接弹出flowDetail流程

    commit 682b16f9a2ff4928ac3abda552e095f994bcef92
    Author: Renxy <18510891294@163.com>
    Date:   Thu Jul 28 09:58:33 2022 +0800

        Squashed commit of the following:

        commit fd25edb40085ee41b7eb73a91ea331192429fae9
        Author: Renxy <18510891294@163.com>
        Date:   Wed Jul 27 18:12:50 2022 +0800

            Squashed commit of the following:
            merge
            commit 4958d8b32176363b868850bec33d27584cee8884
            Author: Renxy <18510891294@163.com>
            Date:   Wed Jul 27 18:08:42 2022 +0800

                修改显示

            commit be1b8de22e9fd2cdf65c951ad2fb82fccebac5a2
            Author: Renxy <18510891294@163.com>
            Date:   Wed Jul 27 16:00:30 2022 +0800

                Squashed commit of the following:
                merge
                commit f5add5c6a7c64414a36e11a71ec58735bb6bd325
                Merge: 616012a ea19888
                Author: Renxy <18510891294@163.com>
                Date:   Wed Jul 27 15:58:37 2022 +0800

                    Merge branch 'develop_0715' into develop
                    merge

                commit 616012a58ec3688f03eeec30dab89d12655a5454
                Author: Renxy <18510891294@163.com>
                Date:   Wed Jul 27 10:05:31 2022 +0800

                    Squashed commit of the following:
                    merge
                    commit 9c3cb6985ba730337971e8a8537730a4e5119ef2
                    Author: Renxy <18510891294@163.com>
                    Date:   Wed Jul 27 10:04:01 2022 +0800

                        查询节点版本接口添加node_type字段

                    commit 307abe6678a74bfa0a0b44a861e1ca024aa22fb2
                    Author: Renxy <18510891294@163.com>
                    Date:   Tue Jul 26 18:08:24 2022 +0800

                        修改bom最新需求

                    commit 6e8a9215ce092ffcd22b75571d4d079b95c3ee60
                    Author: Renxy <18510891294@163.com>
                    Date:   Tue Jul 26 16:13:37 2022 +0800

                        bom版本树/审批流程

                    commit 27239b95ee0f334468e94847879025590de843f8
                    Author: Renxy <18510891294@163.com>
                    Date:   Mon Jul 25 14:22:22 2022 +0800

                        merge develop

                commit 87ec2751172f4ab98a2a92772cf01fb832573ed8
                Author: Renxy <18510891294@163.com>
                Date:   Tue Jul 26 16:14:47 2022 +0800

                    Squashed commit of the following:
                    merge
                    commit 6e8a9215ce092ffcd22b75571d4d079b95c3ee60
                    Author: Renxy <18510891294@163.com>
                    Date:   Tue Jul 26 16:13:37 2022 +0800

                        bom版本树/审批流程

                    commit 27239b95ee0f334468e94847879025590de843f8
                    Author: Renxy <18510891294@163.com>
                    Date:   Mon Jul 25 14:22:22 2022 +0800

                        merge develop

                commit 3db0c23a140a307d70f902b122b25b431f78cfe5
                Author: XuZinan <tony.xu121508b2@yahoo.com>
                Date:   Mon Jul 25 16:46:20 2022 +0800

                    项目列表审核列表 流程缺失 修复

                commit 70e7740d3f6a9af481f65aa1c4c6d660db9c66b6
                Author: XuZinan <tony.xu121508b2@yahoo.com>
                Date:   Mon Jul 25 16:04:38 2022 +0800

                    工时审核 创建人缺失 修复

                commit 0e349e10278422433f7478593c2b4809e4538279
                Merge: 86c7844 6bcae78
                Author: Renxy <18510891294@163.com>
                Date:   Mon Jul 25 14:19:54 2022 +0800

                    Merge branch 'develop_0715' into develop
                    解决冲突

                commit 86c7844828487be838e1795aa76932f56c91d2f6
                Author: XuZinan <tony.xu121508b2@yahoo.com>
                Date:   Mon Jul 25 11:38:29 2022 +0800

                    项目详情 研发项目隐藏多余信息

                commit fe90240aa44690d51acd871a06bc16a3b49ec1f2
                Author: xujunjie <645007605@qq.com>
                Date:   Fri Jul 22 16:05:56 2022 +0800

                    浏览器缓存配置修改

                commit 66bd343da7766fccef3b791d6acf84f0ebc1cfd2
                Author: Renxy <18510891294@163.com>
                Date:   Fri Jul 22 16:00:44 2022 +0800

                    Squashed commit of the following:
                    merge devlop_0715
                    commit 6c38bc02e3ad84491745076a2f5abf2241bbd06f
                    Author: Renxy <18510891294@163.com>
                    Date:   Fri Jul 22 15:57:38 2022 +0800

                        修改地址

                    commit d06b6ae6af266634f7f742559402069e4296d585
                    Author: Renxy <18510891294@163.com>
                    Date:   Fri Jul 22 15:56:03 2022 +0800

                        修改查看流程/历史版本

                    commit 9fdd0969977a5a10205684cb66d4d27b8fcb5a39
                    Author: Renxy <18510891294@163.com>
                    Date:   Wed Jul 20 20:18:38 2022 +0800

                        多节点审批/业务节点权限控制

                    commit b7c21ca5d7abd551ef8913defacd2b834f53a5d3
                    Author: Renxy <18510891294@163.com>
                    Date:   Fri Jul 15 16:44:49 2022 +0800

                        添加业务节点权限配置

                commit 6061f798d045f760116c2221e3d384583e667655
                Author: xujunjie <645007605@qq.com>
                Date:   Fri Jul 22 15:51:23 2022 +0800

                    chart改动

                commit b6e60eae15a717f2938873ed4c1b9a90531fca3b
                Merge: ccff8a2 12407a8
                Author: xujunjie <645007605@qq.com>
                Date:   Fri Jul 22 11:42:09 2022 +0800

                    Merge branch 'feature/mobile' of http://120.55.44.4:10080/xujunjie/WorkloadWeb into feature/mobile

                commit 12407a809c15673c8f288d29d927efa324f80928
                Author: XuZinan <tony.xu121508b2@yahoo.com>
                Date:   Fri Jul 22 10:22:06 2022 +0800

                    样式调整

                commit e007db195a6063090284c29162cb29136d7f09c2
                Author: XuZinan <tony.xu121508b2@yahoo.com>
                Date:   Fri Jul 22 10:19:57 2022 +0800

                    手机移动端图标页面样式

                commit ccff8a230e6ac92a43c4a4b628f513f4c382f856
                Author: xujunjie <645007605@qq.com>
                Date:   Thu Jul 21 14:06:51 2022 +0800

                    移动端引入xflow

                commit 6869f837608fad6527f19d6e7d40d854fafd0015
                Author: XuZinan <tony.xu121508b2@yahoo.com>
                Date:   Wed Jul 20 18:24:58 2022 +0800

                    update

                commit 591b702812ac84f54506bb8a0a5b0c121c5d7f49
                Author: xujunjie <645007605@qq.com>
                Date:   Tue Jul 19 09:13:24 2022 +0800

                    创建文件

        commit f5add5c6a7c64414a36e11a71ec58735bb6bd325
        Merge: 616012a ea19888
        Author: Renxy <18510891294@163.com>
        Date:   Wed Jul 27 15:58:37 2022 +0800

            Merge branch 'develop_0715' into develop
            merge

        commit 616012a58ec3688f03eeec30dab89d12655a5454
        Author: Renxy <18510891294@163.com>
        Date:   Wed Jul 27 10:05:31 2022 +0800

            Squashed commit of the following:
            merge
            commit 9c3cb6985ba730337971e8a8537730a4e5119ef2
            Author: Renxy <18510891294@163.com>
            Date:   Wed Jul 27 10:04:01 2022 +0800

                查询节点版本接口添加node_type字段

            commit 307abe6678a74bfa0a0b44a861e1ca024aa22fb2
            Author: Renxy <18510891294@163.com>
            Date:   Tue Jul 26 18:08:24 2022 +0800

                修改bom最新需求

            commit 6e8a9215ce092ffcd22b75571d4d079b95c3ee60
            Author: Renxy <18510891294@163.com>
            Date:   Tue Jul 26 16:13:37 2022 +0800

                bom版本树/审批流程

            commit 27239b95ee0f334468e94847879025590de843f8
            Author: Renxy <18510891294@163.com>
            Date:   Mon Jul 25 14:22:22 2022 +0800

                merge develop

        commit 87ec2751172f4ab98a2a92772cf01fb832573ed8
        Author: Renxy <18510891294@163.com>
        Date:   Tue Jul 26 16:14:47 2022 +0800

            Squashed commit of the following:
            merge
            commit 6e8a9215ce092ffcd22b75571d4d079b95c3ee60
            Author: Renxy <18510891294@163.com>
            Date:   Tue Jul 26 16:13:37 2022 +0800

                bom版本树/审批流程

            commit 27239b95ee0f334468e94847879025590de843f8
            Author: Renxy <18510891294@163.com>
            Date:   Mon Jul 25 14:22:22 2022 +0800

                merge develop

        commit 3db0c23a140a307d70f902b122b25b431f78cfe5
        Author: XuZinan <tony.xu121508b2@yahoo.com>
        Date:   Mon Jul 25 16:46:20 2022 +0800

            项目列表审核列表 流程缺失 修复

        commit 70e7740d3f6a9af481f65aa1c4c6d660db9c66b6
        Author: XuZinan <tony.xu121508b2@yahoo.com>
        Date:   Mon Jul 25 16:04:38 2022 +0800

            工时审核 创建人缺失 修复

        commit 0e349e10278422433f7478593c2b4809e4538279
        Merge: 86c7844 6bcae78
        Author: Renxy <18510891294@163.com>
        Date:   Mon Jul 25 14:19:54 2022 +0800

            Merge branch 'develop_0715' into develop
            解决冲突

        commit 86c7844828487be838e1795aa76932f56c91d2f6
        Author: XuZinan <tony.xu121508b2@yahoo.com>
        Date:   Mon Jul 25 11:38:29 2022 +0800

            项目详情 研发项目隐藏多余信息

        commit fe90240aa44690d51acd871a06bc16a3b49ec1f2
        Author: xujunjie <645007605@qq.com>
        Date:   Fri Jul 22 16:05:56 2022 +0800

            浏览器缓存配置修改

        commit 66bd343da7766fccef3b791d6acf84f0ebc1cfd2
        Author: Renxy <18510891294@163.com>
        Date:   Fri Jul 22 16:00:44 2022 +0800

            Squashed commit of the following:
            merge devlop_0715
            commit 6c38bc02e3ad84491745076a2f5abf2241bbd06f
            Author: Renxy <18510891294@163.com>
            Date:   Fri Jul 22 15:57:38 2022 +0800

                修改地址

            commit d06b6ae6af266634f7f742559402069e4296d585
            Author: Renxy <18510891294@163.com>
            Date:   Fri Jul 22 15:56:03 2022 +0800

                修改查看流程/历史版本

            commit 9fdd0969977a5a10205684cb66d4d27b8fcb5a39
            Author: Renxy <18510891294@163.com>
            Date:   Wed Jul 20 20:18:38 2022 +0800

                多节点审批/业务节点权限控制

            commit b7c21ca5d7abd551ef8913defacd2b834f53a5d3
            Author: Renxy <18510891294@163.com>
            Date:   Fri Jul 15 16:44:49 2022 +0800

                添加业务节点权限配置

        commit 6061f798d045f760116c2221e3d384583e667655
        Author: xujunjie <645007605@qq.com>
        Date:   Fri Jul 22 15:51:23 2022 +0800

            chart改动

        commit b6e60eae15a717f2938873ed4c1b9a90531fca3b
        Merge: ccff8a2 12407a8
        Author: xujunjie <645007605@qq.com>
        Date:   Fri Jul 22 11:42:09 2022 +0800

            Merge branch 'feature/mobile' of http://120.55.44.4:10080/xujunjie/WorkloadWeb into feature/mobile

        commit 12407a809c15673c8f288d29d927efa324f80928
        Author: XuZinan <tony.xu121508b2@yahoo.com>
        Date:   Fri Jul 22 10:22:06 2022 +0800

            样式调整

        commit e007db195a6063090284c29162cb29136d7f09c2
        Author: XuZinan <tony.xu121508b2@yahoo.com>
        Date:   Fri Jul 22 10:19:57 2022 +0800

            手机移动端图标页面样式

        commit ccff8a230e6ac92a43c4a4b628f513f4c382f856
        Author: xujunjie <645007605@qq.com>
        Date:   Thu Jul 21 14:06:51 2022 +0800

            移动端引入xflow

        commit 6869f837608fad6527f19d6e7d40d854fafd0015
        Author: XuZinan <tony.xu121508b2@yahoo.com>
        Date:   Wed Jul 20 18:24:58 2022 +0800

            update

        commit 591b702812ac84f54506bb8a0a5b0c121c5d7f49
        Author: xujunjie <645007605@qq.com>
        Date:   Tue Jul 19 09:13:24 2022 +0800

            创建文件

    commit 4958d8b32176363b868850bec33d27584cee8884
    Author: Renxy <18510891294@163.com>
    Date:   Wed Jul 27 18:08:42 2022 +0800

        修改显示

    commit be1b8de22e9fd2cdf65c951ad2fb82fccebac5a2
    Author: Renxy <18510891294@163.com>
    Date:   Wed Jul 27 16:00:30 2022 +0800

        Squashed commit of the following:
        merge
        commit f5add5c6a7c64414a36e11a71ec58735bb6bd325
        Merge: 616012a ea19888
        Author: Renxy <18510891294@163.com>
        Date:   Wed Jul 27 15:58:37 2022 +0800

            Merge branch 'develop_0715' into develop
            merge

        commit 616012a58ec3688f03eeec30dab89d12655a5454
        Author: Renxy <18510891294@163.com>
        Date:   Wed Jul 27 10:05:31 2022 +0800

            Squashed commit of the following:
            merge
            commit 9c3cb6985ba730337971e8a8537730a4e5119ef2
            Author: Renxy <18510891294@163.com>
            Date:   Wed Jul 27 10:04:01 2022 +0800

                查询节点版本接口添加node_type字段

            commit 307abe6678a74bfa0a0b44a861e1ca024aa22fb2
            Author: Renxy <18510891294@163.com>
            Date:   Tue Jul 26 18:08:24 2022 +0800

                修改bom最新需求

            commit 6e8a9215ce092ffcd22b75571d4d079b95c3ee60
            Author: Renxy <18510891294@163.com>
            Date:   Tue Jul 26 16:13:37 2022 +0800

                bom版本树/审批流程

            commit 27239b95ee0f334468e94847879025590de843f8
            Author: Renxy <18510891294@163.com>
            Date:   Mon Jul 25 14:22:22 2022 +0800

                merge develop

        commit 87ec2751172f4ab98a2a92772cf01fb832573ed8
        Author: Renxy <18510891294@163.com>
        Date:   Tue Jul 26 16:14:47 2022 +0800

            Squashed commit of the following:
            merge
            commit 6e8a9215ce092ffcd22b75571d4d079b95c3ee60
            Author: Renxy <18510891294@163.com>
            Date:   Tue Jul 26 16:13:37 2022 +0800

                bom版本树/审批流程

            commit 27239b95ee0f334468e94847879025590de843f8
            Author: Renxy <18510891294@163.com>
            Date:   Mon Jul 25 14:22:22 2022 +0800

                merge develop

        commit 3db0c23a140a307d70f902b122b25b431f78cfe5
        Author: XuZinan <tony.xu121508b2@yahoo.com>
        Date:   Mon Jul 25 16:46:20 2022 +0800

            项目列表审核列表 流程缺失 修复

        commit 70e7740d3f6a9af481f65aa1c4c6d660db9c66b6
        Author: XuZinan <tony.xu121508b2@yahoo.com>
        Date:   Mon Jul 25 16:04:38 2022 +0800

            工时审核 创建人缺失 修复

        commit 0e349e10278422433f7478593c2b4809e4538279
        Merge: 86c7844 6bcae78
        Author: Renxy <18510891294@163.com>
        Date:   Mon Jul 25 14:19:54 2022 +0800

            Merge branch 'develop_0715' into develop
            解决冲突

        commit 86c7844828487be838e1795aa76932f56c91d2f6
        Author: XuZinan <tony.xu121508b2@yahoo.com>
        Date:   Mon Jul 25 11:38:29 2022 +0800

            项目详情 研发项目隐藏多余信息

        commit fe90240aa44690d51acd871a06bc16a3b49ec1f2
        Author: xujunjie <645007605@qq.com>
        Date:   Fri Jul 22 16:05:56 2022 +0800

            浏览器缓存配置修改

        commit 66bd343da7766fccef3b791d6acf84f0ebc1cfd2
        Author: Renxy <18510891294@163.com>
        Date:   Fri Jul 22 16:00:44 2022 +0800

            Squashed commit of the following:
            merge devlop_0715
            commit 6c38bc02e3ad84491745076a2f5abf2241bbd06f
            Author: Renxy <18510891294@163.com>
            Date:   Fri Jul 22 15:57:38 2022 +0800

                修改地址

            commit d06b6ae6af266634f7f742559402069e4296d585
            Author: Renxy <18510891294@163.com>
            Date:   Fri Jul 22 15:56:03 2022 +0800

                修改查看流程/历史版本

            commit 9fdd0969977a5a10205684cb66d4d27b8fcb5a39
            Author: Renxy <18510891294@163.com>
            Date:   Wed Jul 20 20:18:38 2022 +0800

                多节点审批/业务节点权限控制

            commit b7c21ca5d7abd551ef8913defacd2b834f53a5d3
            Author: Renxy <18510891294@163.com>
            Date:   Fri Jul 15 16:44:49 2022 +0800

                添加业务节点权限配置

        commit 6061f798d045f760116c2221e3d384583e667655
        Author: xujunjie <645007605@qq.com>
        Date:   Fri Jul 22 15:51:23 2022 +0800

            chart改动

        commit b6e60eae15a717f2938873ed4c1b9a90531fca3b
        Merge: ccff8a2 12407a8
        Author: xujunjie <645007605@qq.com>
        Date:   Fri Jul 22 11:42:09 2022 +0800

            Merge branch 'feature/mobile' of http://120.55.44.4:10080/xujunjie/WorkloadWeb into feature/mobile

        commit 12407a809c15673c8f288d29d927efa324f80928
        Author: XuZinan <tony.xu121508b2@yahoo.com>
        Date:   Fri Jul 22 10:22:06 2022 +0800

            样式调整

        commit e007db195a6063090284c29162cb29136d7f09c2
        Author: XuZinan <tony.xu121508b2@yahoo.com>
        Date:   Fri Jul 22 10:19:57 2022 +0800

            手机移动端图标页面样式

        commit ccff8a230e6ac92a43c4a4b628f513f4c382f856
        Author: xujunjie <645007605@qq.com>
        Date:   Thu Jul 21 14:06:51 2022 +0800

            移动端引入xflow

        commit 6869f837608fad6527f19d6e7d40d854fafd0015
        Author: XuZinan <tony.xu121508b2@yahoo.com>
        Date:   Wed Jul 20 18:24:58 2022 +0800

            update

        commit 591b702812ac84f54506bb8a0a5b0c121c5d7f49
        Author: xujunjie <645007605@qq.com>
        Date:   Tue Jul 19 09:13:24 2022 +0800

            创建文件

commit 61645343cabbedb8e9f8a42c5cb21c7ee20051b7
Merge: 3ca0da6 fd25edb
Author: xujunjie <645007605@qq.com>
Date:   Thu Jul 28 16:38:04 2022 +0800

    Merge branch 'develop' of http://120.55.44.4:10080/xujunjie/WorkloadWeb into develop

commit 3ca0da61d16cd152c9ccc017e88da966ce8d3f96
Author: xujunjie <645007605@qq.com>
Date:   Thu Jul 28 16:37:53 2022 +0800

    驾驶舱图表修改
Renxy 3 жил өмнө
parent
commit
88fbd4878f

+ 5 - 5
public/luckysheet.html

@@ -17,11 +17,11 @@
 
   <!-- 本地开发使用路径 -->
   <!-- <link rel='stylesheet' href='http://localhost:3000/plugins/css/pluginsCss.css' />
-   <link rel='stylesheet' href='http://localhost:3000/plugins/plugins.css' />
-   <link rel='stylesheet' href='http://localhost:3000/css/luckysheet.css' />
-   <link rel='stylesheet' href='http://localhost:3000/assets/iconfont/iconfont.css' />
-   <script src="http://localhost:3000/plugins/js/plugin.js"></script>
-   <script src="http://localhost:3000/luckysheet.umd.js"></script> -->
+  <link rel='stylesheet' href='http://localhost:3000/plugins/plugins.css' />
+  <link rel='stylesheet' href='http://localhost:3000/css/luckysheet.css' />
+  <link rel='stylesheet' href='http://localhost:3000/assets/iconfont/iconfont.css' />
+  <script src="http://localhost:3000/plugins/js/plugin.js"></script>
+  <script src="http://localhost:3000/luckysheet.umd.js"></script> -->
 </head>
 
 <body>

+ 248 - 209
src/components/ChartUtils/utils.js

@@ -43,146 +43,184 @@ const computePrefixExpression = (function() {
   };
 })();
 
-const getFunctionValue = child => {
-  let data = {};
-  data.data = [];
-  let expression = child.tempExpression;
-  let first = child.data[0];
-  let indexArr = child.indexArr;
-  first.data.forEach(item => {
-    // firstDevice.device
-    let resObj = {
-      [first.device.deviceName]: item,
-    };
-    let htime = item.htime;
-    for (let i = 1; i < child.data.length; i++) {
-      let element = child.data[i];
-      // deviceName = element.name
-      let result = element.data.find(item => item.htime === htime);
-      if (!result) return;
-      resObj[element.device.deviceName] = result;
+export async function getOptions(values, datas, formula, projectId) {
+  let allDatas = getAllParams(datas, formula);
+
+  let optionsData = getOptionsData(datas, formula, values);
+
+  // 请求接口
+  const { plcData, formData } = await queryData(values, allDatas, projectId);
+
+  optionsData = optionsData.map(item => {
+    const paramsInfo = item.paramsInfo;
+    let res;
+    if (paramsInfo.data_type == 0) {
+      // plc数据
+      res = findPlcData(paramsInfo, plcData, values.timeType);
+    } else if (paramsInfo.data_type == 1) {
+      // form数据
+      res = findFormData(paramsInfo, formData, values.timeType);
+    } else if (paramsInfo.data_type == 2) {
+      // 获取公式的值
+      res = getFormulaData(item.paramsInfo, plcData, formData, values.timeType);
     }
-    Object.keys(resObj).forEach(key => {
-      var result = indexArr.find(item => key === item.deviceName);
-      if (result) expression[result.index] = resObj[key].val;
-    });
-    // console.log(expression);
-    data.data.push({
-      htime: moment(htime).format('YYYY-MM-DD HH:mm:ss'),
-      val: computePrefixExpression([...expression]),
+    return { ...item, ...res };
+  });
+  return {
+    ...values,
+    data: optionsData,
+  };
+}
+
+// 根据表单的数据项获取请求参数
+function getFormParams(datas, projectId) {
+  let params = {};
+  datas.forEach(item => {
+    if (!params[item.data_name]) params[item.data_name] = [];
+    params[item.data_name].push(item.data_title);
+  });
+  return Object.keys(params).map(data_name => ({
+    formName: data_name,
+    titles: params[data_name],
+    projectId,
+  }));
+}
+
+async function queryData(values, datas, projectId) {
+  let plcDatas = [],
+    formDatas = [];
+  datas.forEach(item => {
+    if (item.data_type == 0) {
+      plcDatas.push(item);
+    } else {
+      formDatas.push(item);
+    }
+  });
+
+  // 根据params获取form的数据
+  var formData = await getFormData(values, formDatas, projectId);
+  var plcData = await getPlcData(values, plcDatas);
+  if (values.timeType) {
+    // 获得时间轴全集
+    let times = getTimes(plcData[0]?.data, formData[0]?.data);
+
+    // 根据时间全集补填数据
+    formatData(plcData, times);
+    formatData(formData, times);
+  }
+  return {
+    plcData,
+    formData,
+  };
+}
+
+// 根据时间进行格式化数据
+function formatData(datas, times) {
+  datas.forEach(item => {
+    // 默认数据
+    let newItemData = [];
+    let i = 0;
+    times.forEach(t => {
+      if (item.data[i]?.htime != t) {
+        // 空缺时间要补0
+        newItemData.push({
+          htime: t,
+          val: 0,
+        });
+      } else {
+        newItemData.push(item.data[i]);
+        i++;
+      }
     });
-    // console.log(indexArr, resObj, expression);
-    //  indexArr   resObj     expression
+    // 使用新值
+    item.data = newItemData;
+  });
+}
+function getTimes(plcTimes = [], formTimes = []) {
+  let times = {};
+
+  plcTimes.forEach(item => {
+    times[item.htime] = true;
+  });
+  formTimes.forEach(item => {
+    times[item.htime] = true;
   });
-  data.name = child.name;
+  return Object.keys(times).sort((a, b) => new Date(a) - new Date(b));
+}
+async function getFormData(values, datas, projectId) {
+  let arrtData = values.data || [];
+  const params = getFormParams(datas, projectId);
+  if (!values.timeType) {
+    // 请求最新数据
+    return await getFormCurrentData(params, values);
+  } else {
+    // 请求历史数据
+    return await getFormHistoryData(params, values);
+  }
+}
+// 请求表单最新数据
+async function getFormCurrentData(params, values) {
+  const { timeType, date } = values;
+  let data = [];
+  for (let i = 0; i < params.length; i++) {
+    const resData = await queryFormCurrentData(params[i]);
+    data = [...data, ...resData];
+  }
   return data;
-};
+}
+
+// 请求表单历史数据
+async function getFormHistoryData(params, values) {
+  const { timeType, date } = values;
+  let sTime, eTime;
+  let data = [];
+  // -1为自选日期  从date内获取时间
+  if (timeType == -1) {
+    let clear = { hour: 0, minute: 0, second: 0, millisecond: 0 };
+    eTime = moment(date[1])
+      .set(clear)
+      .format('YYYY-MM-DD HH:mm:ss');
+    sTime = moment(date[0])
+      .set(clear)
+      .format('YYYY-MM-DD HH:mm:ss');
+  } else {
+    let currentDate = moment();
+    eTime = currentDate.format('YYYY-MM-DD HH:mm:ss');
+    sTime = currentDate.add(-1 * timeType, 'hour').format('YYYY-MM-DD HH:mm:ss');
+  }
 
-/**
- * 获取图表的options
- * @param {object} values 表单数据
- * @param {array} datas 数据项
- * @param {array} formula 数据公式
- * @returns
- */
-export async function getPlcOptions(values, datas, formula) {
+  for (let i = 0; i < params.length; i++) {
+    const resData = await queryFormHistoryData({ ...params[i], eTime, sTime });
+    data = [...data, ...resData];
+  }
+  return data;
+}
+async function getPlcData(values, datas) {
   let arrtData = values.data || [];
   let params = getSingleData(datas);
-  let multiParams = getFormula(formula);
   if (!values.timeType) {
     let res = await getData(params, values);
-    for (let i = 0; i < multiParams.length; i++) {
-      let device = multiParams[i].paramsDevice;
-      let indexArr = multiParams[i].indexArr;
-      let tempExpression = [...multiParams[i].expression];
-      let formulaRes = await getData(device, values);
-      formulaRes.data.map(res => {
-        let temp = device.find(child => child.deviceName === res.alias);
-        console.log(temp);
-        if (temp) {
-          var indexObj = indexArr.find(item => item.deviceName === temp.deviceName);
-          if (indexObj) {
-            tempExpression[indexObj.index] = res.val;
-          }
-        }
-      });
-      let tempValue = computePrefixExpression([...tempExpression]);
-      multiParams[i].formatExpression = tempExpression;
-      multiParams[i].value = tempValue;
-    }
-    let resData = res.data.map((item, index) => {
-      let attrDataItem = arrtData[index + formula.length] || {};
-      return {
-        ...attrDataItem,
-        name: item.alias,
-        value: item.val * 1,
-      };
-    });
-    let formulaData = multiParams.map((item, index) => {
-      let attrDataItem = arrtData[index] || {};
-      return {
-        ...attrDataItem,
-        name: item.FormulaName,
-        value: item.value * 1,
-      };
-    });
-
-    return {
-      ...values,
-      data: [...resData, ...formulaData],
-    };
+    return res.data;
   } else {
     let singleData = [];
     for (let i = 0; i < params.length; i++) {
       const item = params[i];
       let res = await getData(item, values);
-      let attrDataItem = arrtData[i + multiParams.length] || {};
       singleData.push({
-        ...attrDataItem,
+        paramsInfo: item,
         name: item.deviceName,
         data: (res.data || []).map(item => {
           return {
-            val: item.val,
+            val: Number(item.val),
             htime: moment(item.htime_at).format('YYYY-MM-DD HH:mm:ss'),
           };
         }),
       });
     }
-
-    let firstHTimeArr = [];
-    let formulaData = [];
-    for (let i = 0; i < multiParams.length; i++) {
-      const element = multiParams[i];
-      let indexArr = element.indexArr;
-      let tempExpression = [...element.expression];
-      let device = element.paramsDevice;
-      let child = {};
-      child.tempExpression = tempExpression;
-      child.name = element.FormulaName;
-      child.data = [];
-      child.indexArr = indexArr;
-      for (let j = 0; j < device.length; j++) {
-        const tempDevice = device[j];
-        let res = await getData(tempDevice, values);
-        child.data.push({
-          data: res.data,
-          device: tempDevice,
-        });
-      }
-      formulaData.push(child);
-    }
-
-    let data = [];
-
-    formulaData.map((item, index) => {
-      let attrDataItem = arrtData[index] || {};
-      data.push({ ...attrDataItem, ...getFunctionValue(item) });
-    });
-
-    values.data = [...singleData, ...data];
-    return values;
+    return singleData;
   }
 }
+
 // 根据数据项获取请求参数
 function getSingleData(datas) {
   let params = [];
@@ -197,29 +235,65 @@ function getSingleData(datas) {
   });
   return params;
 }
-// 根据公式获得请求参数
-function getFormula(formula) {
-  let params = [];
-  formula.forEach(item => {
-    let tempItem = item;
-    let tempDeviceArr = [];
-    let indexArr = [];
-    item.Device.map(device => {
-      if (device.Id && device.ItemAlias && device.ItemName) {
-        tempDeviceArr.push({
-          deviceName: device.ItemAlias,
-          deviceId: String(device.PlcDeviceId),
-          deviceItems: device.ItemName,
-        });
+function findPlcData(paramsInfo, plcData, timeType) {
+  // 实时数据与历史数据结构不一致  需判断
+  if (timeType) {
+    return plcData.find(resItem => resItem.paramsInfo.deviceName == paramsInfo.seq);
+  } else {
+    let res = plcData.find(resItem => resItem.alias == paramsInfo.seq);
+    return {
+      name: res.alias,
+      value: res.val,
+    };
+  }
+}
+function findFormData(paramsInfo, formData, timeType) {
+  // 实时数据与历史数据结构不一致  需判断
+  if (timeType) {
+    return formData.find(resItem => resItem.name == paramsInfo.data_title);
+  } else {
+    let res = formData.find(resItem => resItem.title == paramsInfo.data_title);
+    return {
+      name: res.title,
+      value: res.value,
+    };
+  }
+}
 
-        indexArr.push({ index: device.index, deviceName: device.ItemAlias });
+function getAllParams(datas, formula) {
+  let allDatas = [...datas];
+  formula.forEach(f => {
+    f.params.forEach(params => {
+      if (params.data_type == 0) {
+        if (!datas.find(item => item.seq == params.seq)) {
+          allDatas.push(params);
+        }
+      } else {
+        if (!datas.find(item => item.data_title == params.data_title)) {
+          allDatas.push(params);
+        }
       }
     });
-    tempItem.paramsDevice = tempDeviceArr;
-    tempItem.indexArr = indexArr;
-    params.push(tempItem);
   });
-  return params;
+  return allDatas;
+}
+
+function getOptionsData(datas, formula, values) {
+  let valuesData = values.data || [];
+
+  let optionsData = [];
+  formula.forEach((item, index) => {
+    var arrData = valuesData[index] || {};
+    item.data_type = 2;
+    arrData.paramsInfo = item;
+    optionsData.push(arrData);
+  });
+  datas.forEach((data, index) => {
+    var arrData = valuesData[index + formula.length] || {};
+    arrData.paramsInfo = data;
+    optionsData.push(arrData);
+  });
+  return optionsData;
 }
 
 var DATA_CACHE = {};
@@ -239,9 +313,7 @@ async function getData(params, values) {
   }
   if (!DATA_CACHE[key]) {
     if (!timeType) {
-      DATA_CACHE[key] = await getDeviceRealData({
-        ...params,
-      });
+      DATA_CACHE[key] = await getDeviceRealData(params);
     } else {
       if (timeType != -1) {
         let currentDate = moment();
@@ -262,84 +334,51 @@ async function getData(params, values) {
   return DATA_CACHE[key];
 }
 
-// 获取表单的options
-export async function getFormOptions(values, datas, projectId) {
-  let arrtData = values.data || [];
-  const params = getFormParams(datas, projectId);
-  if (!values.timeType) {
-    // 请求最新数据
-    let data = await getFormCurrentData(params, values);
-    let resData = data.map((item, index) => {
-      let attrDataItem = arrtData[index] || {};
+function getFormulaData(formula, plcData, formData, timeType) {
+  let expression = [...formula.expression];
+  let resDatas = formula.params.map(params => {
+    let res;
+    if (params.data_type == 0) {
+      res = findPlcData(params, plcData, timeType);
       return {
-        ...attrDataItem,
-        name: item.title,
-        value: item.value * 1,
+        ...params,
+        ...res,
       };
-    });
-    return {
-      ...values,
-      data: resData,
-    };
-  } else {
-    // 请求历史数据
-    let data = await getFormHistoryData(params, values);
-    values.data = data.map((item, i) => {
-      let attrDataItem = arrtData[i] || {};
+    } else {
+      res = findFormData(params, formData, timeType);
       return {
-        ...attrDataItem,
-        ...item,
+        ...params,
+        ...res,
       };
-    });
-
-    return values;
-  }
-}
-
-// 根据表单的数据项获取请求参数
-function getFormParams(datas, projectId) {
-  let params = {};
-  datas.forEach(item => {
-    if (!params[item.data_name]) params[item.data_name] = [];
-    params[item.data_name].push(item.data_title);
+    }
   });
-  return Object.keys(params).map(data_name => ({
-    formName: data_name,
-    titles: params[data_name],
-    projectId,
-  }));
-}
-
-// 请求表单最新数据
-async function getFormCurrentData(params, values) {
-  const { timeType, date } = values;
-  let data = [];
-  for (let i = 0; i < params.length; i++) {
-    const resData = await queryFormCurrentData(params[i]);
-    data = [...data, ...resData];
-  }
-  return data;
-}
 
-// 请求表单历史数据
-async function getFormHistoryData(params, values) {
-  const { timeType, date } = values;
-  let sTime, eTime;
-  let data = [];
-  // -1为自选日期  从date内获取时间
-  if (timeType == -1) {
-    let clear = { hour: 0, minute: 0, second: 0, millisecond: 0 };
-    eTime = moment(date[1]).set(clear) * 1;
-    sTime = moment(date[0]).set(clear) * 1;
+  if (timeType) {
+    let optionsData = [];
+    // 获取时间
+    let time = resDatas[0].data.map(item => item.htime);
+    time.forEach((htime, index) => {
+      resDatas.forEach(params => {
+        // 根据index去替换表达式中对应的值
+        expression[params.index] = params.data[index].val || 0;
+      });
+      optionsData.push({
+        htime: moment(htime).format('YYYY-MM-DD HH:mm:ss'),
+        val: computePrefixExpression([...expression]),
+      });
+    });
+    return {
+      data: optionsData,
+      name: formula.FormulaName,
+    };
   } else {
-    let currentDate = moment();
-    eTime = currentDate * 1;
-    sTime = currentDate.add(-1 * timeType, 'hour') * 1;
-  }
-
-  for (let i = 0; i < params.length; i++) {
-    const resData = await queryFormHistoryData({ ...params[i], eTime, sTime });
-    data = [...data, ...resData];
+    resDatas.forEach(params => {
+      // 根据index去替换表达式中对应的值
+      expression[params.index] = params.value || 0;
+    });
+    return {
+      value: computePrefixExpression([...expression]),
+      name: formula.FormulaName,
+    };
   }
-  return data;
 }

+ 42 - 20
src/components/Flow/node/rect/mapServe.tsx

@@ -15,6 +15,11 @@ import { PREFIX } from '../constants';
 import { UnityAction } from '@/utils/utils';
 import { connect } from 'dva';
 
+interface ExcelInfo {
+  file_name?: string;
+  excel_cols?: any;
+}
+
 export interface IConfig {
   label?: string;
   x?: number;
@@ -31,19 +36,21 @@ export interface IConfig {
   bom_template?: string;
   version_name?: string;
   data?: any;
-  excel_info?: any;
-  role_list?:string;
+  excel_info?: ExcelInfo;
+  role_list?: string;
 }
 
 const defaultConfig: IConfig = {
   muti_version: 1,
   is_start_node: 0,
+  excel_info: { file_name: '' },
 };
 
 const Component = (props: any) => {
   const { config, plugin = {}, roleList } = props;
   const { updateNode } = plugin;
-  const [options, setOptions] = useState([])
+  const [options, setOptions] = useState([]);
+  const [fileName, setFileName] = useState('');
   const [nodeConfig, setNodeConfig] = useState<IConfig>({
     ...defaultConfig,
     ...config,
@@ -82,13 +89,13 @@ const Component = (props: any) => {
       const sheet = exportJson.sheets[0];
       let titleCell = [];
       sheet.celldata.forEach(item => {
-        if(item.r == 0) {
+        if (item.r == 0) {
           // 标题头
-          titleCell.push(item)
+          titleCell.push(item);
         }
         // 生成cid
-        item.v.cid = `${item.r}-${item.c}`
-      })
+        item.v.cid = `${item.r}-${item.c}`;
+      });
       let cell = titleCell.map(item => {
         let value = '';
         if (item.v?.v) {
@@ -114,18 +121,31 @@ const Component = (props: any) => {
       ...config,
     });
   }, [config]);
+
+  const updataFileName = (name: string) => {
+    var idx = name?.lastIndexOf('/');
+    let str = name.substring(idx + 1, name.length);
+    setFileName(str);
+  };
+
+  useEffect(() => {
+    if (config.bom_template) updataFileName(config.bom_template);
+    if (nodeConfig.excel_info?.file_name) updataFileName(nodeConfig.excel_info.file_name);
+  }, [nodeConfig.bom_template, nodeConfig.excel_info.file_name]);
   // console.log(nodeConfig, config)
 
   useEffect(() => {
-    if(!roleList || roleList.length <= 0) return;
-    let op = []
-    console.log(roleList)
-    roleList.filter(cur=>cur.RoleType == 4).forEach(item => {
-      op.push({label:`${item.Name}(${item.ID})`, value:item.ID})
-    })
+    if (!roleList || roleList.length <= 0) return;
+    let op = [];
+    console.log(roleList);
+    roleList
+      .filter(cur => cur.RoleType == 4)
+      .forEach(item => {
+        op.push({ label: `${item.Name}(${item.ID})`, value: item.ID });
+      });
     setOptions(op);
-    console.log(op)
-  },[roleList])
+    console.log(op);
+  }, [roleList]);
 
   return (
     <div className={`${PREFIX}-panel-body`}>
@@ -177,19 +197,21 @@ const Component = (props: any) => {
               onChange={url => onNodeConfigChange('bom_template', url)}
               beforeUpload={beforeUpload}
             />
-            <div>{nodeConfig.excel_info?.file_name}</div>
+            <div>{fileName}</div>
           </>
         )}
-        <div className='group'>
+        <div className="group">
           <label>权限</label>
           <Select
-            value= {nodeConfig.role_list ? nodeConfig.role_list.split(",").map(item=>Number(item)) : []}
+            value={
+              nodeConfig.role_list ? nodeConfig.role_list.split(',').map(item => Number(item)) : []
+            }
             mode="multiple"
             allowClear
             style={{ width: '100%' }}
             placeholder="选择权限"
             onChange={(v: number[]) => {
-              onNodeConfigChange('role_list', v.join(','))
+              onNodeConfigChange('role_list', v.join(','));
             }}
             options={options}
           />
@@ -265,4 +287,4 @@ function RecthServe(props: any) {
   );
 }
 
-export default connect(({ flow }) => ({ roleList: flow.roleList }))(RecthServe);
+export default connect(({ flow }) => ({ roleList: flow.roleList }))(RecthServe);

+ 1 - 1
src/models/dataMeterNew.js

@@ -68,7 +68,7 @@ export default {
         config_json: [],
       },
     },
-    chartConfigList: false,
+    chartConfigList: [],
     realProgress: {},
     progress: {},
     // currentChart: {}

+ 62 - 53
src/pages/Mobile/DataMeter/Chart.js

@@ -1,26 +1,33 @@
 import React, { useState, useEffect, useRef } from 'react';
-import echarts from 'echarts';
 import { connect } from 'dva';
 import moment from 'moment';
 import style from './Chart.less';
-import { getPlcOptions, getFormOptions } from '@/components/ChartUtils/utils';
+import { Card, Empty, Spin } from 'antd';
+import { getOptions } from '@/components/ChartUtils/utils';
 const dataCache = {};
-console.log(style);
+let timer;
 function DataCenter(props) {
   const [chart, setChart] = useState();
-  const [timer, setTimer] = useState();
-  const [chartOptions, setChartOptions] = useState(false);
+  // const [timer, setTimer] = useState();
+  const [chartOptions, setChartOptions] = useState({});
   const chartEle = useRef();
-  const iframeRef = useRef();
   const signalRef = useRef();
   const [loading, setLoading] = useState(false);
-  const { chartConfigList, dispatch ,location:{query:{projectId}}} = props;
+  const {
+    chartConfigList,
+    dispatch,
+    location: {
+      query: { projectId },
+    },
+  } = props;
   // const { projectId } = props.location; //?
   // const projectId = 92;
 
   const handleClickTabs = id => {
+    if (loading) return;
     let item = chartConfigList.find(c => c.id == id);
-    getOptionsForConfig(item);
+    setLoading(true);
+    setChartOptions({ ...item });
   };
 
   useEffect(() => {
@@ -35,42 +42,35 @@ function DataCenter(props) {
     }
   }, [projectId]);
 
-  useEffect(() => {
-    const chartWindow = iframeRef.current?.contentWindow;
-    console.log(chartOptions);
-    if (!chartWindow || !chartOptions) return;
-    renderChart();
-  }, [chartOptions]);
+  // useEffect(() => {
+  //   if (!chartOptions) return;
+  //   renderChart();
+  // }, [chartOptions]);
 
   useEffect(() => {
-    chartConfigList && handleClickTabs(chartConfigList[0].id);
+    if (chartConfigList && chartConfigList.length > 0) {
+      handleClickTabs(chartConfigList[0].id);
+    }
   }, [chartConfigList]);
 
-  const getOptionsForConfig = item => {
-    console.log(item);
-    setChartOptions(item);
-    clearTimeout(timer);
-    let t = setTimeout(() => {
-      getOptionsForConfig({ ...item });
-    }, 1000 * 60);
-    setTimer(t);
-  };
+  // const getOptionsForConfig = item => {
+  //   setChartOptions(item);
+  //   clearTimeout(timer);
+  //   let t = setTimeout(() => {
+  //     getOptionsForConfig({ ...item });
+  //   }, 1000 * 60);
+  //   setTimer(t);
+  // };
 
-  const renderChart = async () => {
+  const renderChart = async e => {
+    var chartWindow = e.target.contentWindow;
     let datas = chartOptions.configs;
     let values = chartOptions.options;
     let formula = JSON.parse(chartOptions.formula || '[]');
-    setLoading(true);
+    if (!datas) return;
     try {
-      if (chartOptions.source === 0) {
-        // plc渲染数据
-        let options = await getPlcOptions(values, datas, formula);
-        iframeRef.current.contentWindow.render(options);
-      } else {
-        // 图表渲染数据
-        let options = await getFormOptions(values, datas, projectId);
-        iframeRef.current.contentWindow.render(options);
-      }
+      let options = await getOptions(values, datas, formula, projectId);
+      chartWindow.render(options);
     } catch (error) {
       console.log(error);
     }
@@ -79,27 +79,36 @@ function DataCenter(props) {
 
   return (
     <div className={style.body}>
-      <div className={style.title}>数据项</div>
-      <div className={style.listWrapper}>
-        <div className={style.list}>
+      <Card title="数据项" bodyStyle={{ padding: 0 }}>
+        <ul className={style.list}>
           {(chartConfigList || []).map(item => (
-            <div key={item.id} onClick={() => handleClickTabs(item.id)} className={style.listItem}>
+            <li
+              key={item.id}
+              style={{
+                border: chartOptions.id == item.id ? '1px solid #008dff' : '1px solid #fff',
+              }}
+              onClick={() => handleClickTabs(item.id)}
+            >
               {item.name}
-            </div>
+            </li>
           ))}
-        </div>
-      </div>
-      <div className={style.title}>图表</div>
-      <div className={style.chartWrapper} style={{ height: '43vh' }}>
-        <div style={{ paddingTop: '0.3rem', paddingRight: '0.6rem', overflow: 'hidden' }}>
-          <iframe
-            ref={iframeRef}
-            style={{ width: '100%', height: '43vh', border: 'none' }}
-            onLoad={renderChart}
-            srcDoc={chartOptions?.template?.Content}
-          ></iframe>
-        </div>
-      </div>
+        </ul>
+        {chartConfigList.length == 0 && (
+          <Empty style={{ color: '#fff', fontSize: 20, marginTop: 40 }} />
+        )}
+      </Card>
+      <Card title="图表" bodyStyle={{ paddingBottom: 0 }}>
+        <Spin spinning={loading}>
+          {chartOptions.template?.Content && (
+            <iframe
+              style={{ width: '100%', height: 'calc(50vh - 80px)', border: 'none' }}
+              // srcDoc拼上id  防止当模板一致时无法触发onLoad
+              srcDoc={chartOptions?.template?.Content + `<div id="${chartOptions.id}"></div>`}
+              onLoad={renderChart}
+            ></iframe>
+          )}
+        </Spin>
+      </Card>
     </div>
   );
 }

+ 31 - 4
src/pages/Mobile/DataMeter/Chart.less

@@ -1,7 +1,18 @@
 .body {
   background-color: #0d1a2b;
   color: #fff;
-  height: 100%;
+  height: 100vh;
+  display: flex;
+  flex-direction: column;
+  :global {
+    .ant-card {
+      background: transparent;
+      flex: 1;
+    }
+    .ant-card-head {
+      color: #fff;
+    }
+  }
 }
 
 .title {
@@ -16,8 +27,24 @@
 
 .list {
   display: flex;
-  justify-content: center;
+  justify-content: space-evenly;
   flex-wrap: wrap;
+  height: 100%;
+  max-height: calc(50vh - 74px);
+  overflow-y: auto;
+  padding: 10px;
+  margin: 0;
+  li {
+    width: 100%;
+    padding: 6px;
+    text-align: center;
+    color: #fff;
+    font-size: 14px;
+    margin-bottom: 10px;
+    &:last-child {
+      margin-bottom: 0;
+    }
+  }
 }
 
 .listItem {
@@ -29,6 +56,6 @@
   padding: 5px 0px;
 }
 
-.chartWrapper{
-	height: 40vh;
+.chartWrapper {
+  height: 40vh;
 }

+ 13 - 9
src/pages/PurchaseAdmin/PurchaseList/Detail/FlowModal.js

@@ -221,15 +221,19 @@ function FlowModal(props) {
             <Flow meta={{ type: 'view' }} flowDetail={graphData} onSelectNode={handleSelectNode} />
           </Col>
           <Col span={8}>
-            {isOut && data.length == 1 && !data[0].children && (
-              <Button
-                type="primary"
-                style={{ float: 'right', marginBottom: '10px' }}
-                onClick={() => setVersionVisible(true)}
-              >
-                新建清单
-              </Button>
-            )}
+            <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
+              <div style={{ fontSize: '16px' }}>清单列表</div>
+              {isOut && (
+                <Button
+                  type="primary"
+                  style={{ float: 'right', marginBottom: '10px' }}
+                  onClick={() => setVersionVisible(true)}
+                >
+                  新建清单
+                </Button>
+              )}
+            </div>
+
             <div style={{ width: '100%' }}>
               <Table
                 style={{ maxHeight: '90%' }}

+ 35 - 35
src/pages/PurchaseAdmin/PurchaseList/Detail/HistoryDrawer.js

@@ -2,10 +2,11 @@ import React, { useEffect, useState, useRef, useMemo } from 'react';
 import { UserOutlined } from '@ant-design/icons';
 import { Form } from '@ant-design/compatible';
 import '@ant-design/compatible/assets/index.css';
-import { Drawer, Descriptions, Card, Table } from 'antd';
+import { Drawer, Descriptions, Card, Table, Timeline, Button, Space } from 'antd';
 import moment from 'moment';
 import { connect } from 'dva';
 import CommentContent from '@/components/CommentContent';
+import TimelineItem from 'antd/lib/timeline/TimelineItem';
 
 // 评论
 function HistoryDrawer(props) {
@@ -24,7 +25,7 @@ function HistoryDrawer(props) {
       {
         title: '名称',
         render: item => (
-          <div style={{ color: '#9b9b9b'}}>
+          <div style={{ color: '#9b9b9b' }}>
             {item.version_no ? `${item.version_name}.${item.version_no}` : item.version_name}
           </div>
         ),
@@ -33,16 +34,20 @@ function HistoryDrawer(props) {
         title: '业务节点',
         width: '20%',
         render: item => {
-          let node = flowDetail.Nodes.find(cur => cur.Id == item.template_node_id)
-          return <span style={{ color: '#9b9b9b'}}>{node?.label ? node.label : '-'}</span>;
+          let node = flowDetail.Nodes.find(cur => cur.Id == item.template_node_id);
+          return <span style={{ color: '#9b9b9b' }}>{node?.label ? node.label : '-'}</span>;
         },
       },
       {
-        title:'提交人',
+        title: '提交人',
         width: '20%',
         render: item => {
-          return <span style={{ color: '#9b9b9b'}}>{item.AuthorInfo?.UserName ? item.AuthorInfo?.UserName : '-'}</span>
-        }
+          return (
+            <span style={{ color: '#9b9b9b' }}>
+              {item.AuthorInfo?.UserName ? item.AuthorInfo?.UserName : '-'}
+            </span>
+          );
+        },
       },
       {
         title: '操作',
@@ -61,34 +66,28 @@ function HistoryDrawer(props) {
       },
     ];
   }, [version]);
-  // const [commentList, setCommentList] = useState([]);
-
-  // const handleSubmitBom = (value, callback) => {
-  //   if (!value) return;
-  //   dispatch({
-  //     type: 'detail/addBomComment',
-  //     payload: {
-  //       excel_id: version.id,
-  //       comment: value,
-  //     },
-  //     callback,
-  //   });
-  // };
-  // const handleSubmitCell = (value, callback) => {
-  //   if (!value) return;
-  //   dispatch({
-  //     type: 'detail/addComment',
-  //     payload: {
-  //       ...cellPosition.current,
-  //       comment: value,
-  //     },
-  //     callback,
-  //   });
-  // };
 
-  useEffect(() => {
-    console.log("====================================",versionTree)
-  }, [version.id]);
+  const TimeLineItemRender = item => {
+    let time = item.m_time ? item.m_time.split('T')[0] : '-';
+    let node = flowDetail.Nodes.find(cur => cur.Id == item.template_node_id);
+    return (
+      <TimelineItem>
+        <Space>
+          <a
+            onClick={() => {
+              onChangeVersion(item);
+              onClose();
+            }}
+          >
+            {item.version_no ? `${item.version_name}.${item.version_no}` : item.version_name}
+          </a>
+          <span>{node?.label ? node.label : '-'}</span>
+          <span>提交人: {item.AuthorInfo?.UserName ? item.AuthorInfo?.UserName : '-'}</span>
+          <span>时间: {time}</span>
+        </Space>
+      </TimelineItem>
+    );
+  };
 
   return (
     <Drawer
@@ -99,7 +98,8 @@ function HistoryDrawer(props) {
       onClose={onClose}
       visible={visible}
     >
-      <Table columns={columns} dataSource={versionTree} bordered={false} />
+      {/* <Table columns={columns} dataSource={versionTree} bordered={false} /> */}
+      <Timeline>{versionTree.map(item => TimeLineItemRender(item))}</Timeline>
     </Drawer>
   );
 }