123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- import React, { Component } from 'react';
- import Taro from '@tarojs/taro';
- import { View, Picker, ScrollView, Button } from '@tarojs/components'
- import { getProjectList, listRecord } from '../../utils/servers/servers';
- import dayjs from 'dayjs';
- import {
- AtTabs,
- AtTabsPane,
- AtIcon,
- } from 'taro-ui';
- import './index.less';
- import 'taro-ui/dist/style/components/tabs.scss';
- import "taro-ui/dist/style/components/flex.scss";
- import "taro-ui/dist/style/components/action-sheet.scss";
- import "taro-ui/dist/style/components/icon.scss";
- import "taro-ui/dist/style/components/list.scss";
- import "taro-ui/dist/style/components/icon.scss";
- import "taro-ui/dist/style/components/modal.scss";
- import MyList from './myList';
- class Examine extends Component {
- constructor(props) {
- super(props);
- this.state = {
- typeList: [
- { title: '全部', type: 0 },
- { title: '待审核', type: 1 },
- { title: '已审核', type: 2 },
- { title: '已驳回', type: 3 }],
- seltype: {},
- current: 0,
- tlist: [{ title: '我的打卡', type: 0 }],
- tabs: 0,
- list: [],
- pageNum: 1,
- listState: 'LOADING',
- isPickerRender: false,
- rangeEndMinuteVal: '',
- rangeStartMinuteVal: '',
- }
- this.getPublicReleaseList = this.getPublicReleaseList.bind(this);
- this.getMyList = this.getMyList.bind(this);
- }
- componentDidShow() {
- let roles = Taro.getStorageSync('roles');
- // 项目经理 技术总监
- if (roles.includes("manage") || roles.includes("Inspector")) {
- this.setState({
- tlist: [{ title: '我的打卡', type: 0 }, { title: '审核', type: 1 }]
- })
- }
- this.getPublicReleaseList();
- }
- async componentDidMount() {
- await this.getPublicReleaseList();
- }
- onPullDownRefresh() {
- this.getPublicReleaseList();
- }
- onReachBottom() {
- this.getPublicReleaseList(true);
- }
- onTabItemTap(obj) {
- if (obj.index === 1) {
- this.onTabTap();
- }
- }
- async onTabTap() {
- await this.getMyList(1);
- }
- async getPublicReleaseList(lv) {
- await this.getMyList(lv ? this.state.pageNum + 1 : 1);
- Taro.stopPullDownRefresh();
- }
- async getMyList(pageNum) {
- const { current } = this.state
- this.setState({
- listState: 'LOADING'
- })
- let data = {
- processStatus: this.state.current != 0 ? this.state.current : "",
- pageNum: pageNum,
- pageSize: 10,
- roleType: this.state.tabs,
- startTime: this.state.rangeStartMinuteVal || undefined,
- endTime: this.state.rangeEndMinuteVal || undefined,
- }
- for (let i in data) {
- if (!data[i] && data[i] != 0) {
- delete data[i]
- }
- }
- let msg = await listRecord(data);
- if (msg.code === 200) {
- if (msg.total === 0) {
- this.setState({
- listState: 'NO_DATA'
- })
- } else if (msg.total === this.state.list.length && pageNum !== 1) {
- !this.state.isOpen && Taro.showToast({ title: '没有更多数据了', icon: 'none' });
- this.setState({
- listState: 'NO_MORE_DATA'
- })
- } else {
- if (msg.total === (pageNum === 1 ? msg.rows : this.state.list.concat(msg.rows)).length) {
- this.setState({
- listState: 'NO_MORE_DATA'
- })
- }
- }
- this.setState({
- list: pageNum === 1 ? msg.rows : this.state.list.concat(msg.rows),
- pageNum: msg.rows.length === 0 ? this.state.pageNum : msg.next - 1
- })
- } else {
- Taro.showToast({ title: msg.msg, icon: 'none' });
- this.setState({
- // listState: msg.error[0].field === '403' ? 'NO_DATA' : 'RELOAD'
- })
- }
- Taro.stopPullDownRefresh();
- }
- onPickerHide() {
- this.setState({
- isPickerRender: false,
- });
- }
- async onSetPickerTime(val) {
- let data = val.detail;
- await this.setState({
- rangeStartMinuteVal: dayjs(data.selectStartTime).format("YYYY-MM-DD"),
- rangeEndMinuteVal: dayjs(data.selectEndTime).format("YYYY-MM-DD")
- })
- await this.getMyList(1);
- }
- render() {
- return (
- <View className='indexPage' >
- <View className='searchContent'>
- <View className='searchTop'>
- {/* <AtSearchBar
- showActionButton
- placeholder='请输入企业/渠道'
- value={this.state.searchValue}
- onActionClick={() => {
- this.getPublicReleaseList();
- }}
- onChange={(value) => {
- this.setState({
- searchValue: value
- })
- }}
- onClear={() => {
- this.setState({
- searchValue: ''
- })
- }}
- /> */}
- </View>
- <AtTabs
- swipeable={false}
- current={this.state.tabs || 0}
- tabList={this.state.tlist}
- onClick={(tabs) => {
- this.setState({
- list: [],
- pageNum: 1,
- tabs: this.state.tlist[tabs].type,
- }, () => {
- this.getPublicReleaseList();
- })
- }}
- >
- </AtTabs>
- <ScrollView className={this.state.openSearch ? 'searchBottomLOL' : ''} scrollX style={{ width: '100%' }}>
- <View className='searchBottom'>
- <View className='searchItem' style={{ paddingLeft: '5px' }}>
- <Picker
- value={this.state.seltype.type}
- range={this.state.typeList} rangeKey='title' mode='selector'
- onChange={(e) => {
- this.setState({
- seltype: this.state.typeList[e.detail.value],
- current: this.state.typeList[e.detail.value].type,
- }, () => {
- this.getPublicReleaseList();
- })
- }}>
- {
- !this.state.seltype.title ?
- <View className='shortValuecontent'>
- <View className='selectTitle'>审核状态</View>
- <View className='iconContent'><AtIcon value='chevron-down' size='10' color='#FFFFFF' /></View>
- </View> :
- <View className='shortValuecontent'>
- <View className='selectValue'>
- {this.state.seltype.title}
- </View>
- <View className='iconContent' />
- </View>
- }
- </Picker>
- {
- this.state.seltype.title &&
- <View className='searchSelectContent'>
- <View className='selectIcon'
- onClick={(e) => {
- e.stopPropagation();
- this.setState({
- seltype: {},
- current: 0,
- }, () => {
- this.getPublicReleaseList();
- })
- }}>
- <AtIcon value='close-circle' size='10' color='#FFFFFF' />
- </View>
- </View>
- }
- </View>
- {/* 多选时间框 */}
- <View className='searchItem'
- onClick={() => {
- this.setState({
- isPickerRender: true
- })
- }}>
- <View>
- {
- !this.state.rangeStartMinuteVal ?
- <View className='valuecontent' style={{ width: '200px' }}>
- <View className='selectTitle' style={{ paddingLeft: '50px' }}>开始及结束时间</View>
- <View className='iconContent' style={{ paddingLeft: '20px' }}><AtIcon value='chevron-down' size='10' color='#FFFFFF' /></View>
- </View> :
- <View className='valuecontent' style={{ width: '200px' }}>
- <View className='selectValue' >
- {this.state.rangeStartMinuteVal + "~" + this.state.rangeEndMinuteVal}
- </View>
- <View className='iconContent' />
- </View>
- }
- </View>
- {
- this.state.rangeStartMinuteVal &&
- <View className='searchSelectContent'>
- <View className='selectIcon'
- onClick={(e) => {
- e.stopPropagation();
- this.setState({
- rangeStartMinuteVal: '',
- rangeEndMinuteVal: '',
- }, () => {
- this.getPublicReleaseList();
- })
- }}>
- <AtIcon value='close-circle' size='10' color='#FFFFFF' />
- </View>
- </View>
- }
- </View>
- </View>
- </ScrollView>
- {
- this.state.typeList?.map((item, index) =>
- <MyList
- type={this.state.tabs}
- title={item.title}
- typelist={this.state.typeList}
- seeView={this.state.current}
- list={this.state.list}
- listState={this.state.listState}
- onRefresh={() => {
- this.getProjectList(true);
- }}
- />
- )
- }
- </View>
- <timePicker
- config={{
- endDate: true,
- column: "day",
- dateLimit: false,
- limitStartTime: dayjs().subtract(3, 'year').format('YYYY-MM-DD '),
- limitEndTime: dayjs().add(3, 'year').format('YYYY-MM-DD ')
- }}
- isPartition
- pickerShow={this.state.isPickerRender}
- onconditionaljudgment={(v) => {
- }}
- onhidepicker={() => {
- this.onPickerHide()
- }}
- onsetpickertime={(v) => {
- this.onSetPickerTime(v)
- }}>
- </timePicker>
- </View>
- )
- }
- }
- export default Examine
|