Blame view

src/pages/performance/EvaDataImport/components/Filter.tsx 2.6 KB
2683f431   曾柯   考评数据导入
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
  import React, { useState, useEffect, useCallback } from "react";
  import { Table, Row, Input, Select, DatePicker } from "antd";
  import type { DatePickerProps, RangePickerProps } from "antd/es/date-picker";
  // import { ApprovalType, Approval_Status } from "../entity";
  import _ from "lodash";
  import usePagination from "@/hooks/usePagination";
  import { systemListApi } from "@/pages/admin/Privilege/api";
  import { getStaffApi } from "@/common/api";
  import { evaDataIndApi } from "../api";
  import useInitial from "@/hooks/useInitail";
  import moment from "moment";
  
  const { RangePicker } = DatePicker;
  
  const { Option } = Select;
  interface Props {
    setParams: any;
  }
  
  export default function Filter({ setParams }: Props) {
    // const { list: syslist } = usePagination(systemListApi, {
    //   current: 1,
    //   pageSize: 500,
    // });
    const { list } = usePagination(getStaffApi, { current: 1, pageSize: 1000 });
    const { data } = useInitial(evaDataIndApi, [], {});
  
    // const seachOnchange = useCallback(
    //   _.debounce((param) => {
    //     setParams({ ...param }, true);
    //   }, 800),
    //   [setParams]
    // );
    const onChange = (value: RangePickerProps["value"], dateString: [string, string] | string) => {
      console.log("Selected Time: ", value);
      if (value) {
        setParams({ startTime: moment(value[0]).unix() * 1000, endTime: moment(value[1]).unix() * 1000 }, true);
e66763d9   曾柯   考评bugfix
38
39
        console.log(moment(value[0]).unix() * 1000);
        console.log(moment(value[1]).unix() * 1000);
2683f431   曾柯   考评数据导入
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
      }
    };
  
    return (
      <Row justify="start" style={{ marginBottom: 20 }}>
        <Select
          allowClear
          placeholder="请选择指标名称"
          style={{ width: 150, marginRight: 10, marginBottom: 10 }}
          onChange={(value) => {
            setParams({ indicatorCode: value }, true);
          }}
          showSearch
          optionFilterProp="children"
        >
          {data.map((item: any) => (
            <Option value={item.code} key={item.code}>
              {item.name}
            </Option>
          ))}
        </Select>
        <Select
          allowClear
          placeholder="请选择导入人员"
          style={{ width: 150, marginRight: 10, marginBottom: 10 }}
          onChange={(value) => {
            setParams({ userId: value }, true);
          }}
          showSearch
          optionFilterProp="children"
        >
          {list.map((item) => (
            <Option value={item.id} key={item.id}>
              {item.name}
            </Option>
          ))}
        </Select>
e66763d9   曾柯   考评bugfix
77
        <RangePicker
ccdb0384   曾柯   考评组配置及数据导入
78
79
          // showTime={{ format: "HH:mm:ss" }}
          // format="YYYY-MM-DD HH:mm:ss"
e66763d9   曾柯   考评bugfix
80
81
82
          onChange={onChange}
          style={{ height: 32 }}
        />
2683f431   曾柯   考评数据导入
83
84
85
      </Row>
    );
  }