广州矛调粤政易端
xusd
7 days ago d27794814b69d18aeb8ee96a46cae91d5613570c
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
/*
 * @Company: hugeInfo
 * @Author: lwh
 * @Date: 2023-02-18 10:23:36
 * @LastEditTime: 2024-01-26 09:43:34
 * @LastEditors: dminyi 1301963064@qq.com
 * @Version: 1.0.0
 * @Description: 
 */
import React, { useState, useEffect } from 'react';
import { useHistory } from 'react-router-dom';
import { DownArrow2Outlined } from 'dd-icons';
import { Button, Empty, Picker } from 'dingtalk-design-mobile';
import NavBarPage from '../../components/NavBarPage';
import CalendarRange from '../../components/CalendarRange';
import CalendarRangeDay from '../../components/CalendarRangeDay';
import ModalDown from '../../components/ModalDown';
import ModalContent from '../../components/workLog/ModalContent';
import MyList from '../../components/MyList';
import ImgShow from '../../components/ImgShow';
import { workLog_img_1 } from '../../assets/img';
import { room_1 } from './../../assets/icon';
import { ax, myTimeFormat, moment, getweekTime } from '../../utils/utility';
 
 
const years = new Array(new Date().getFullYear() - (new Date().getFullYear() - 10)).fill(0).map((item, i) => ({ label: String(new Date().getFullYear() - 9 + i) + '年', value: new Date().getFullYear() - 9 + i }))
const typeList = [{ label: '年', value: 1 }, { label: '月', value: 2 }, { label: '日', value: 3 }]
const SearchHead = () => {
 
  const [visibleData, setVisibleData] = useState({ typeVisible: false, typeValue: 1, yearsVisible: false, yearsValue: new Date().getFullYear() });
 
  const [nowTime, setNowTime] = useState(moment().format('YYYY-MM-DD'))
  // 搜索
  function handleSearch(value) {
    if (value == '1') {
      setVisibleData({ ...visibleData, typeVisible: true })
    }
    if (value == '2') {
      if (visibleData.typeValue == 1) {
        setVisibleData({ ...visibleData, yearsVisible: true, yearsValue: visibleData.yearsValue ? visibleData.yearsValue : new Date().getFullYear() })
      }
      if (visibleData.typeValue == 2) {
        setVisibleData({ ...visibleData, monthVisible: true })
      }
      if (visibleData.typeValue == 3) {
        setVisibleData({ ...visibleData, dayVisible: true })
      }
    }
  }
 
  return (
    <></>
    // <>
    //   <div className='workLog-searchBar'>
    //     <div className='workLog-searchBar-l' onClick={() => handleSearch('1')}>
    //       <div>{searchData.label}</div>
    //       <div><DownArrow2Outlined /></div>
    //     </div>
    //     <div className='workLog-searchBar-r' onClick={() => handleSearch('2')}>
    //       <div>{searchData.logTime}</div>
    //       <img className='workLog-searchBar-r-img' src={workLog_img_1} alt="" />
    //     </div>
    //   </div>
    //   {/* 日选择器 */}
    //   <ModalDown
    //     extraContent={<CalendarRangeDay activeTime={moment(nowTime).format('YYYY-M-D')} onClickDate={onClickDate} onChangeMonth={changeMonth} CalendaronClick={CalendaronClick} />}
    //     headContent={true}
    //     visible={visibleData.dayVisible}
    //     visibleOnClick={() => setVisibleData({ ...visibleData, dayVisible: false })}
    //     isAction={false}
    //     onConfirm={(data, list) => { }}
    //   />
 
    //   {/* 月选择器 */}
    //   <ModalDown
    //     extraContent={<CalendarRange activeTime={moment(nowTime).format('YYYY-M')} onChangeMonth={changeMonth} CalendaronClick={CalendaronClick} />}
    //     headContent={true}
    //     visible={visibleData.monthVisible}
    //     visibleOnClick={() => setVisibleData({ ...visibleData, monthVisible: false })}
    //     isAction={false}
    //     onConfirm={(data, list) => { }}
    //   />
    //   {/* 年选择器 */}
    //   <Picker
    //     data={years}
    //     cols={1}
    //     visible={visibleData.yearsVisible}
    //     title=""
    //     okText="确定"
    //     onDismiss={() => setVisibleData({ ...visibleData, yearsVisible: false })}
    //     value={[visibleData.yearsValue]}
    //     onChange={(e) => {
    //       setVisibleData({ ...visibleData, yearsValue: e[0], yearsLabel: years.find(i => i.value === e[0]).label, yearsVisible: false })
    //       let data = { ...searchData, logTime: e[0] }
    //       setSearchData(data);
    //       getLogBookData({
    //         type: data.type,
    //         logTime: data.logTime,
    //         page: data.page,
    //         size: data.size
    //       }, 'spin');
    //     }}
    //   >
    //   </Picker>
    //   {/* 类型选择器 */}
    //   <Picker
    //     data={typeList}
    //     cols={1}
    //     visible={visibleData.typeVisible}
    //     title=""
    //     okText="确定"
    //     onDismiss={() => setVisibleData({ ...visibleData, typeVisible: false })}
    //     value={[visibleData.typeValue]}
    //     onChange={(e) => {
    //       setVisibleData({ ...visibleData, typeValue: e[0], typeLabel: typeList.find(i => i.value === e[0]).label, typeVisible: false })
    //       let data = { ...searchData, type: e[0], label: typeList.find(i => i.value === e[0]).label, logTime: myTimeFormat(new Date(), e[0] == 1 ? 'YYYY' : e[0] == 2 ? 'YYYY-M' : e[0] == 3 ? 'YYYY-M-D' : 'YYYY-MM-DD') }
    //       setSearchData(data)
    //       getLogBookData({
    //         type: data.type,
    //         logTime: data.logTime,
    //         page: data.page,
    //         size: data.size
    //       }, 'spin');
    //     }}
    //   >
    //   </Picker>
    // </>
  )
}
export default SearchHead;