/*
|
* @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;
|