import React from 'react';
import Page from '@/layouts/index';
import { Tab, Tabs, Button } from '@antmjs/vantui';
import { ROLE_INSPECTOR, ROLE_MANAGER } from '@/utils/user';
import { View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import PowerList from '@/components/PowerList';
import { getTaCheck } from '@/services/tacheck';
import Card from './components/Card';

const queryParams = {isValid: true};
export default (props) => {

  const onClick = (typ, item) => {
    if (typ == 'loc') {
      Taro.navigateTo({
        url: `/pages/check/loc/list/index?checkId=${item.checkId}`
      })
    } else {
      Taro.navigateTo({
        url: `/pages/check/edit/index?checkId=${item.checkId}&typ=${typ}`
      })
    }
  }

  return (
    <Page roles={[ROLE_INSPECTOR]}>
      <PowerList
        request={getTaCheck}
        params={queryParams}
        renderItem={item => (
          <Card key={item.checkId} detail={item} onClick={(e) => onClick(e, item)} />
        )}
      />
    </Page>
  )
}