{
  "id": "scene-attendance",
  "version": "2024-12-24",
  "name": "考勤汇总：打卡记录变成月度表",
  "category": "场景模板",
  "description": "一张打卡记录、一张员工表。出勤天数、加班小时、请假与调休天数、出勤率，全是从打卡记录跨表算的。下个月把新的打卡导出导进来，这张月度汇总自己更新，不用再一个个 COUNTIFS。",
  "locale": "zh_CN",
  "imageSrc": "",
  "vipOnly": false,
  "author": "TableDI",
  "tags": {
    "functions": []
  },
  "resourceCount": {
    "Sheet": 2,
    "Component": 3,
    "Dashboard": 1
  },
  "installations": 0,
  "resources": {
    "sheet1": {
      "key": "sheet1",
      "type": "Sheet",
      "name": "打卡记录",
      "content": {
        "sheet": {
          "name": "打卡记录",
          "uniqueIndex": {
            "uniqueHeaders": []
          },
          "headers": [
            {
              "title": "#",
              "meta": {
                "AUTO_SCALE": 3,
                "thousandPoint": false,
                "type": "Number",
                "decimal": 0
              }
            },
            {
              "title": "日期",
              "meta": {
                "type": "Text"
              }
            },
            {
              "title": "工号",
              "meta": {
                "type": "Text"
              }
            },
            {
              "title": "类型",
              "meta": {
                "type": "Text"
              }
            },
            {
              "title": "时长",
              "meta": {
                "type": "Number",
                "decimal": 0,
                "unit": "none",
                "thousandPoint": true
              }
            },
            {
              "title": "出勤",
              "formula": "IF(TRIM({{$sheet1.headers[3].code}}) = \"正常\", 1, 0)",
              "meta": {
                "type": "Number",
                "decimal": 0,
                "unit": "none",
                "thousandPoint": true
              }
            },
            {
              "title": "加班小时",
              "formula": "IF(TRIM({{$sheet1.headers[3].code}}) = \"加班\", {{$sheet1.headers[4].code}}, 0)",
              "meta": {
                "type": "Number",
                "decimal": 0,
                "unit": "none",
                "thousandPoint": true
              }
            },
            {
              "title": "请假",
              "formula": "IF(TRIM({{$sheet1.headers[3].code}}) = \"请假\", 1, 0)",
              "meta": {
                "type": "Number",
                "decimal": 0,
                "unit": "none",
                "thousandPoint": true
              }
            },
            {
              "title": "调休",
              "formula": "IF(TRIM({{$sheet1.headers[3].code}}) = \"调休\", 1, 0)",
              "meta": {
                "type": "Number",
                "decimal": 0,
                "unit": "none",
                "thousandPoint": true
              }
            }
          ]
        },
        "entries": {
          "csv": "日期,工号,类型,时长\n2026-09-01,E-01,正常,8\n2026-09-01,E-02,正常,8\n2026-09-01,E-03,正常,8\n2026-09-01,E-04,请假,8\n2026-09-01,E-05,正常,8\n2026-09-01,E-06,正常,8\n2026-09-01,E-07,正常,8\n2026-09-01,E-08,正常,8\n2026-09-02,E-01,正常,8\n2026-09-02,E-02,加班,3\n2026-09-02,E-03,正常,8\n2026-09-02,E-04,正常,8\n2026-09-02,E-05,正常,8\n2026-09-02,E-06,加班,2\n2026-09-02,E-07,正常,8\n2026-09-02,E-08,调休,8\n2026-09-03,E-01,加班,2\n2026-09-03,E-02,正常,8\n2026-09-03,E-03,请假,8\n2026-09-03,E-04,正常,8\n2026-09-03,E-05,正常,8\n2026-09-03,E-06,正常,8\n2026-09-03,E-07,加班,4\n2026-09-03,E-08,正常,8\n2026-09-04,E-01,正常,8\n2026-09-04,E-02,正常,8\n2026-09-04,E-03,正常,8\n2026-09-04,E-04,加班,3\n2026-09-04,E-05,调休,8\n2026-09-04,E-06,正常,8\n2026-09-04,E-07,正常,8\n2026-09-04,E-08,正常,8\n2026-09-07,E-01,正常,8\n2026-09-07,E-02,请假,8\n2026-09-07,E-03,正常,8\n2026-09-07,E-04,正常,8\n2026-09-07,E-05,正常,8\n2026-09-07,E-06,加班,3\n2026-09-07,E-07,正常,8\n2026-09-07,E-08,正常,8\n2026-09-08,E-01,正常,8\n2026-09-08,E-02,正常,8\n2026-09-08,E-03,加班,2\n2026-09-08,E-04,正常,8\n2026-09-08,E-05,正常,8\n2026-09-08,E-06,正常,8\n2026-09-08,E-07,调休,8\n2026-09-08,E-08,加班,2"
        }
      }
    },
    "sheet2": {
      "key": "sheet2",
      "type": "Sheet",
      "name": "员工",
      "content": {
        "sheet": {
          "name": "员工",
          "uniqueIndex": {
            "uniqueHeaders": []
          },
          "headers": [
            {
              "title": "#",
              "meta": {
                "AUTO_SCALE": 3,
                "thousandPoint": false,
                "type": "Number",
                "decimal": 0
              }
            },
            {
              "title": "工号",
              "meta": {
                "type": "Text"
              }
            },
            {
              "title": "姓名",
              "meta": {
                "type": "Text"
              }
            },
            {
              "title": "部门",
              "meta": {
                "type": "Text"
              }
            },
            {
              "title": "应出勤天数",
              "meta": {
                "type": "Number",
                "decimal": 0,
                "unit": "none",
                "thousandPoint": true
              }
            },
            {
              "title": "出勤天数",
              "formula": "SUMIF({{$sheet1.headers[5].code}}, {{$sheet2.headers[1].code}} = {{$sheet1.headers[2].code}})",
              "meta": {
                "type": "Number",
                "decimal": 0,
                "unit": "none",
                "thousandPoint": true
              }
            },
            {
              "title": "加班小时",
              "formula": "SUMIF({{$sheet1.headers[6].code}}, {{$sheet2.headers[1].code}} = {{$sheet1.headers[2].code}})",
              "meta": {
                "type": "Number",
                "decimal": 0,
                "unit": "none",
                "thousandPoint": true
              }
            },
            {
              "title": "请假天数",
              "formula": "SUMIF({{$sheet1.headers[7].code}}, {{$sheet2.headers[1].code}} = {{$sheet1.headers[2].code}})",
              "meta": {
                "type": "Number",
                "decimal": 0,
                "unit": "none",
                "thousandPoint": true
              }
            },
            {
              "title": "调休天数",
              "formula": "SUMIF({{$sheet1.headers[8].code}}, {{$sheet2.headers[1].code}} = {{$sheet1.headers[2].code}})",
              "meta": {
                "type": "Number",
                "decimal": 0,
                "unit": "none",
                "thousandPoint": true
              }
            },
            {
              "title": "出勤率",
              "formula": "{{$sheet2.headers[5].code}} / {{$sheet2.headers[4].code}}",
              "meta": {
                "type": "Percent",
                "decimal": "auto",
                "unit": "none",
                "thousandPoint": false
              }
            }
          ]
        },
        "entries": {
          "csv": "工号,姓名,部门,应出勤天数\nE-01,王丹,运营部,22\nE-02,李明,运营部,22\nE-03,周雅,客服部,22\nE-04,陈涛,客服部,22\nE-05,张岚,财务部,22\nE-06,赵宇,仓储部,22\nE-07,孙悦,仓储部,22\nE-08,吴桐,行政部,22"
        }
      }
    },
    "component1": {
      "key": "component1",
      "type": "Component",
      "name": "各人加班小时",
      "content": {
        "@t": "next.component.mixmap",
        "sheetId": "{{$sheet2.id}}",
        "type": "MixMap",
        "title": "各人加班小时",
        "config": {
          "@t": "next.component.mixmap.config",
          "xAxis": {
            "@t": "next.component.mixmap.config.x.axis",
            "headerId": "{{$sheet2.headers[2].id}}",
            "renderDirection": "Right"
          },
          "yAxis": {
            "@t": "next.component.mixmap.config.y.axis",
            "coordinates": [
              {
                "@t": "next.component.mixmap.config.coordinate",
                "headerId": "{{$sheet2.headers[6].id}}",
                "defaultColor": "#F2B950",
                "colorRules": [],
                "chartType": "Bar"
              }
            ],
            "yRange": {
              "@t": "next.component.mixmap.config.coordinate.range",
              "rightHeaderIds": []
            }
          },
          "noneValueFillZero": true,
          "pageSize": 48,
          "filters": {
            "@t": "core.or.filter",
            "filters": [],
            "type": "OR"
          },
          "orders": [
            {
              "@t": "core.order.simple",
              "referenceKey": "{{$sheet2.headers[2].id}}",
              "op": "ASC"
            }
          ],
          "configType": "MixMap"
        },
        "css": {
          "@t": "next.component.mixmap.css",
          "horizontalDisplay": false,
          "dataLabel": {
            "@t": "next.component.mixmap.css.datalable",
            "showRule": "AllShow",
            "fontSize": 12,
            "placement": "outSideTop",
            "intervalNumber": 0
          },
          "titleSize": 15,
          "legendSize": 13,
          "axisLabel": {
            "@t": "next.component.mixmap.css.axis",
            "fontSize": 12,
            "interval": 0,
            "rotate": 0
          },
          "cssType": "MixMap",
          "background": {
            "@t": "next.component.css.background",
            "color": "#ffffff",
            "opacity": 1
          },
          "border": {
            "@t": "next.component.css.border",
            "opacity": 0,
            "color": "#CAD0D5"
          },
          "showTitle": true
        },
        "actions": []
      }
    },
    "component2": {
      "key": "component2",
      "type": "Component",
      "name": "各部门出勤天数",
      "content": {
        "@t": "next.component.pivot.table",
        "sheetId": "{{$sheet2.id}}",
        "type": "Pivot",
        "title": "各部门出勤天数",
        "config": {
          "@t": "next.component.pivot.config",
          "pivotDataOption": {
            "@t": "next.component.pivot.config.data.option",
            "filters": {
              "@t": "core.or.filter",
              "filters": [],
              "type": "OR"
            },
            "simpleFilters": [],
            "orders": [],
            "rows": [],
            "columns": [
              {
                "@t": "next.component.pivot.config.textHeader.item",
                "headerId": "{{$sheet2.headers[3].id}}",
                "dataItemType": "TextHeader",
                "label": "部门",
                "showTotal": false,
                "meta": {
                  "@t": "next.component.pivot.table.meta.text",
                  "type": "Text"
                }
              }
            ],
            "values": [
              {
                "@t": "next.component.pivot.config.formula.item",
                "headerId": "{{$sheet2.headers[5].id}}",
                "calcType": "Sum",
                "formula": "",
                "dataItemType": "FormulaHeader",
                "label": "出勤天数",
                "showTotal": false,
                "meta": {
                  "@t": "next.component.pivot.table.meta.number",
                  "type": "Number",
                  "decimal": 0,
                  "unit": "none",
                  "thousandPoint": true
                }
              }
            ],
            "aggregated": true
          },
          "displayType": "ChartColumnar",
          "configType": "Pivot"
        },
        "css": {
          "@t": "next.component.pivot.css",
          "titleSize": 15,
          "dataLabel": {
            "@t": "next.component.mixmap.css.datalable",
            "showRule": "AllShow",
            "fontSize": 12,
            "placement": "outSideTop",
            "intervalNumber": 0
          },
          "legendSize": 12,
          "axisLabel": {
            "@t": "next.component.pivot.css.axis",
            "fontSize": 12,
            "interval": 0,
            "rotate": 0
          },
          "horizontalDisplay": false,
          "chartPieDisplay": "Ring",
          "cssType": "Pivot",
          "background": {
            "@t": "next.component.css.background",
            "color": "#ffffff",
            "opacity": 1
          },
          "border": {
            "@t": "next.component.css.border",
            "opacity": 0,
            "color": "#CAD0D5"
          },
          "showTitle": true
        },
        "actions": []
      }
    },
    "component3": {
      "key": "component3",
      "type": "Component",
      "name": "月度考勤汇总",
      "content": {
        "@t": "next.component.workbook",
        "sheetId": "{{$sheet2.id}}",
        "type": "Workbook",
        "title": "月度考勤汇总",
        "config": {
          "@t": "next.component.workbookConfig",
          "headers": [
            {
              "@t": "next.component.workbook.header",
              "id": "{{$sheet2.headers[1].id}}",
              "width": 90
            },
            {
              "@t": "next.component.workbook.header",
              "id": "{{$sheet2.headers[2].id}}",
              "width": 90
            },
            {
              "@t": "next.component.workbook.header",
              "id": "{{$sheet2.headers[3].id}}",
              "width": 110
            },
            {
              "@t": "next.component.workbook.header",
              "id": "{{$sheet2.headers[5].id}}",
              "width": 110
            },
            {
              "@t": "next.component.workbook.header",
              "id": "{{$sheet2.headers[6].id}}",
              "width": 110
            },
            {
              "@t": "next.component.workbook.header",
              "id": "{{$sheet2.headers[7].id}}",
              "width": 110
            },
            {
              "@t": "next.component.workbook.header",
              "id": "{{$sheet2.headers[8].id}}",
              "width": 110
            }
          ],
          "page": 0,
          "pageSize": 12,
          "editable": true,
          "filters": {
            "@t": "core.or.filter",
            "filters": [],
            "type": "OR"
          },
          "orders": [],
          "configType": "Workbook"
        },
        "css": {
          "@t": "next.component.workbook.css",
          "titleSize": 15,
          "headerSize": 14,
          "paginationSize": 11,
          "cssType": "Workbook",
          "background": {
            "@t": "next.component.css.background",
            "color": "#ffffff",
            "opacity": 1
          },
          "border": {
            "@t": "next.component.css.border",
            "opacity": 0,
            "color": "#CAD0D5"
          },
          "showTitle": true
        },
        "actions": []
      }
    },
    "dashboard1": {
      "key": "dashboard1",
      "type": "Dashboard",
      "name": "月度考勤总览",
      "content": {
        "@t": "net.thingworks.jarvis.dashboard",
        "name": "月度考勤总览",
        "components": [
          {
            "@t": "dashboard.component",
            "innerComponentId": "{{$component1.id}}",
            "position": {
              "@t": "dashboard.component.position",
              "x": 0,
              "y": 0,
              "w": 14,
              "h": 10
            }
          },
          {
            "@t": "dashboard.component",
            "innerComponentId": "{{$component2.id}}",
            "position": {
              "@t": "dashboard.component.position",
              "x": 14,
              "y": 0,
              "w": 10,
              "h": 10
            }
          },
          {
            "@t": "dashboard.component",
            "innerComponentId": "{{$component3.id}}",
            "position": {
              "@t": "dashboard.component.position",
              "x": 0,
              "y": 10,
              "w": 24,
              "h": 11
            }
          }
        ]
      }
    }
  }
}
