baidu / amis

前端低代码框架,通过 JSON 配置就能生成各种页面。
https://baidu.github.io/amis/
Apache License 2.0
17.22k stars 2.5k forks source link

【table样式bug】-固定列初始化时缺少了阴影样式,要动一下才有 #10278

Closed Icodezhan closed 1 month ago

Icodezhan commented 4 months ago

描述问题:

表格固定列初始化时缺少了阴影样式,要动一下滚动条才有,而且没有边框,导致很容易看混了 https://github.com/baidu/amis/assets/45064164/46291dad-1dba-4025-8344-0ca0646c8d79 我看了一下代码,问题出在这段代码初始化执行时获取到的scrollWidth并不是计算了完整列宽的的宽度 2024-05-21_144103

截图或视频:

可以的话,尽可能提供截图或视频来补充描述你的问题...

如何复现(请务必完整填写下面内容):

  1. 你是如何使用 amis 的? sdknpm其他...

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在

  3. 粘贴有问题的完整 amis schema 代码:

    {
    "type": "page",
    "title": "Hello world",
    "body": [
    {
      "type": "form",
      "id": "u:0a0508ef6de5",
      "body": [
        {
          "type": "table",
          "id": "u:56cb53737902",
          "columns": [
            {
              "tpl": "${index + 1}",
              "name": "sn",
              "width": 60,
              "id": "u:a7571739c82a",
              "label": "CO_SN",
              "type": "text"
            },
            {
              "name": "rsrCode",
              "width": 300,
              "id": "u:4cb49edff1ae",
              "label": "CO_RSR",
              "type": "select",
              "staticInputClassName": "flex justify-center items-center"
            },
            {
              "name": "rsrLocation",
              "width": 200,
              "id": "u:96b061378000",
              "label": "DC_LOCATION",
              "type": "select",
              "wrapperComponent": "",
              "inline": true,
              "source": "${'country' | dict}"
            },
            {
              "name": "rsrCorrespName",
              "width": 300,
              "id": "u:31a0376bc1d8",
              "label": "DC_RSR_CORRESP_NAME",
              "placeholder": "-",
              "tpl": "${rsrCorrespCode + ' - ' + rsrCorrespName}",
              "toggled": false
            },
            {
              "name": "share",
              "width": 100,
              "id": "u:d5486a936f4e",
              "label": "DC_TPRB_SHARE",
              "placeholder": "-",
              "tpl": "${ share | round:4 }%",
              "className": "",
              "innerClassName": "text-right block mr-3"
            },
            {
              "name": "rsrBalance",
              "width": 160,
              "id": "u:1d516a7f0f6f",
              "label": "DC_RSR_BALANCE",
              "placeholder": "-",
              "type": "number",
              "className": "text-right"
            },
            {
              "precision": 2,
              "name": "brkDeduction",
              "width": 160,
              "id": "u:b3761227c89c",
              "label": "DC_BRK_DEDUCTION",
              "type": "number",
              "className": "text-right"
            },
            {
              "precision": 2,
              "name": "rsdBalance",
              "width": 160,
              "id": "u:b496e99d216f",
              "label": "DC_RSD_BALANCE",
              "type": "number",
              "className": "text-right"
            },
            {
              "precision": 2,
              "name": "tprbNetBrokerage",
              "width": 160,
              "id": "u:df10ccb03d2d",
              "label": "DC_TPRB_NET_BROKERAGE",
              "type": "number",
              "toggled": false,
              "className": "text-right"
            },
            {
              "name": "trpbNetBrokerageAmount",
              "id": "u:4ec8ab4d47ad",
              "label": "DC_TPRB_NET_BROKERAGE_AMOUNT",
              "precision": 2,
              "width": 160,
              "toggled": false,
              "className": "text-right",
              "type": "number"
            },
            {
              "precision": 2,
              "label": "DC_RSD_BROKERAGE1",
              "type": "number",
              "name": "rsdBrokerage1",
              "width": 160,
              "id": "u:8b58db8ef095",
              "toggled": false,
              "className": "text-right"
            },
            {
              "precision": 2,
              "name": "rsdBrokerage1Amount",
              "width": 160,
              "id": "u:63ceb4c775b7",
              "label": "DC_RSD_BROKERAGE1_AMOUNT",
              "type": "number",
              "toggled": false,
              "className": "text-right"
            },
            {
              "precision": 2,
              "name": "rsdBrokerage2",
              "width": 160,
              "id": "u:c1f6247ae0c4",
              "label": "DC_RSD_BROKERAGE2",
              "type": "number",
              "toggled": false,
              "className": "text-right"
            },
            {
              "precision": 2,
              "name": "rsdBrokerage2Amount",
              "width": 160,
              "toggled": false,
              "className": "text-right",
              "id": "u:b456d5ed3fbe",
              "label": "DC_RSD_BROKERAGE2_AMOUNT",
              "type": "number"
            },
            {
              "precision": 2,
              "name": "rsrBrokerage1",
              "width": 160,
              "toggled": false,
              "className": "text-right",
              "id": "u:62a17523519e",
              "label": "DC_RSR_BROKERAGE1",
              "type": "number"
            },
            {
              "precision": 2,
              "name": "rsrBrokerage1Amount",
              "width": 160,
              "toggled": false,
              "className": "text-right",
              "id": "u:a938708c5038",
              "label": "DC_RSR_BROKERAGE1_AMOUNT",
              "type": "number"
            },
            {
              "precision": 2,
              "name": "rsrBrokerage2",
              "width": 160,
              "toggled": false,
              "className": "text-right",
              "id": "u:0386e666904c",
              "label": "DC_RSR_BROKERAGE2",
              "type": "number"
            },
            {
              "precision": 2,
              "name": "rsrBrokerage2Amount",
              "width": 160,
              "toggled": false,
              "className": "text-right",
              "id": "u:6359694a7b8e",
              "label": "DC_RSR_BROKERAGE2_AMOUNT",
              "type": "number"
            },
            {
              "precision": 2,
              "name": "taxBrk",
              "width": 160,
              "toggled": false,
              "className": "text-right",
              "id": "u:878bb5f5532d",
              "label": "DC_TAX_ON_BRK",
              "type": "number"
            },
            {
              "precision": 2,
              "name": "vatBrk",
              "width": 160,
              "toggled": false,
              "className": "text-right",
              "id": "u:a1b4570b932d",
              "label": "DC_VAT_ON_BRK",
              "type": "number"
            },
            {
              "precision": 2,
              "name": "vatWhBrk",
              "width": 160,
              "toggled": false,
              "className": "text-right",
              "id": "u:324a412064c1",
              "label": "DC_VAT_W_ON_BRK",
              "type": "number"
            },
            {
              "precision": 2,
              "name": "vatSurWhBrk",
              "width": 160,
              "toggled": false,
              "className": "text-right",
              "id": "u:dbad87b4e582",
              "label": "DC_VAT_SW_ON_BRK",
              "type": "number"
            },
            {
              "precision": 2,
              "name": "vat",
              "width": 160,
              "toggled": false,
              "className": "text-right",
              "id": "u:e8bf367f7bd3",
              "label": "DC_VATP",
              "type": "number"
            },
            {
              "precision": 2,
              "name": "vatWh",
              "width": 160,
              "toggled": false,
              "className": "text-right",
              "id": "u:dd3d625fa2cb",
              "label": "DC_VAT_W",
              "type": "number"
            },
            {
              "precision": 2,
              "name": "vatSwh",
              "width": 160,
              "toggled": false,
              "className": "text-right",
              "id": "u:5b4ba086516f",
              "label": "DC_VAT_WS",
              "type": "number"
            },
            {
              "buttons": [
                {
                  "level": "link",
                  "onEvent": {
                    "click": {
                      "weight": 0,
                      "actions": [
                        {
                          "dialog": {
                            "data": {
                              "&": "$$"
                            },
                            "closeOnEsc": true,
                            "className": "app-popover",
                            "body": [
                              {
                                "tableClassName": "no-padding",
                                "columns": [
                                  {
                                    "tpl": "${index + 1}",
                                    "name": "sn",
                                    "width": 60,
                                    "label": "CO_SN",
                                    "type": "text"
                                  },
                                  {
                                    "static": true,
                                    "quickEdit": false,
                                    "name": "rsdCode",
                                    "label": "CO_RSD",
                                    "placeholder": "-",
                                    "type": "select"
                                  },
                                  {
                                    "kilobitSeparator": true,
                                    "quickEdit": false,
                                    "precision": 2,
                                    "name": "tprbShareAmt",
                                    "width": 200,
                                    "className": "text-right",
                                    "label": "DC_TPRB_SHARE_AMOUNT",
                                    "type": "number"
                                  }
                                ],
                                "rowClassName": "h-8",
                                "source": "${unionBookingRsdList}",
                                "type": "table",
                                "affixHeader": false,
                                "columnsTogglable": false
                              }
                            ],
                            "type": "dialog",
                            "title": "RSD Info-Accounts",
                            "showLoading": true,
                            "withDefaultData": false,
                            "dataMapSwitch": true,
                            "size": "md",
                            "bodyClassName": "mb-0",
                            "showErrorMsg": true,
                            "showCloseButton": true,
                            "actions": [
                              {
                                "actionType": "cancel",
                                "className": "w-24",
                                "label": "CO_CLOSE",
                                "type": "button"
                              }
                            ],
                            "closeOnOutside": false
                          },
                          "actionType": "dialog",
                          "ignoreError": false
                        }
                      ]
                    }
                  },
                  "id": "u:7cf57f401d01",
                  "label": "CO_EXPEND",
                  "type": "button"
                }
              ],
              "name": "operation",
              "width": 150,
              "fixed": "right",
              "id": "u:198e60dd548a",
              "label": "操作",
              "type": "operation"
            }
          ],
          "tableClassName": "r-b no-padding",
          "className": "b-a",
          "rowClassName": "h-8",
          "source": "${rsdInfoList}",
          "affixHeader": false,
          "columnsTogglable": true
        }
      ],
      "actions": [
        {
          "type": "submit",
          "label": "提交",
          "primary": true,
          "id": "u:b75be44674e2"
        }
      ],
      "data": {
        "rsdInfoList": [
          {
            "layer": 1,
            "totalPaidLoss": 20000,
            "preTotalPaidLoss": 20000,
            "thisPaidLossBeforeAad": 20000,
            "thisPaidLossAbsorbedByAad": 20000,
            "thisPaidLossAfterAad": 20000,
            "provOsLoss": 20000,
            "osWithinCapacity": 20000,
            "acNo": "AC123456",
            "share": 56,
            "tprbThisPaidLossAfterAad": 20000,
            "tprbOsWithinCapacity": 20000
          },
          {
            "layer": 2,
            "totalPaidLoss": 30000,
            "preTotalPaidLoss": 30000,
            "thisPaidLossBeforeAad": 30000,
            "thisPaidLossAbsorbedByAad": 30000,
            "thisPaidLossAfterAad": 30000,
            "provOsLoss": 30000,
            "osWithinCapacity": 30000,
            "acNo": "AC123456",
            "share": 36,
            "tprbThisPaidLossAfterAad": 30000,
            "tprbOsWithinCapacity": 30000
          }
        ]
      },
      "title": "表单",
      "feat": "Insert"
    }
    ],
    "id": "u:44c38f4db26d",
    "asideResizor": false,
    "pullRefresh": {
    "disabled": true
    },
    "regions": [
    "body"
    ]
    }
  4. 操作步骤 请简单描述一下复现的操作步骤...

github-actions[bot] commented 4 months ago

👍 Thanks for this! 🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

Icodezhan commented 4 months ago

@2betop

2betop commented 3 months ago

最新版已不能复现

Icodezhan commented 3 months ago

最新版已不能复现

哪个提交修复了?

Icodezhan commented 3 months ago

最新版已不能复现

我看没有修复呀,你看一下我视频里的演示

2betop commented 3 months ago

真的复现不了,怀疑是浏览器兼容性问题,能否提供一下浏览器信息?

2betop commented 2 months ago

发现一个 case,数据加载后,单元格被内容撑开后初始不可见滚动条,#10761 中修复了此问题