index.jsx 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import React from 'react';
  2. import Taro from '@tarojs/taro';
  3. import { View } from '@tarojs/components';
  4. import { Tab, Tabs } from '@antmjs/vantui';
  5. import Page from '@/layouts/index';
  6. import PowerList from '@/components/PowerList';
  7. import Card from '@/components/IssueCard';
  8. import { getTaIssueApply } from '@/services/taissueapply';
  9. import { ROLE_MANAGER, ROLE_ORG_MANAGER } from '@/utils/user';
  10. import { useModel } from '@/store';
  11. export default (props) => {
  12. const router = Taro.useRouter();
  13. const { title, applyType = '' } = router.params;
  14. const { duty } = useModel('user');
  15. React.useMemo(() => {
  16. if (title) {
  17. Taro.setNavigationBarTitle({ title });
  18. } else {
  19. Taro.setNavigationBarTitle({ title: '申请列表' });
  20. }
  21. }, [title]);
  22. const { user } = useModel('user');
  23. const onClick = (item) => {
  24. if (!user) return ;
  25. if (!item.verifyDate) {
  26. if (duty != ROLE_MANAGER && duty != ROLE_ORG_MANAGER) {
  27. Taro.navigateTo({
  28. url: `/pages/apply/detail/index?id=${item.applyId}&issueId=${item.issueId}&applyType=${item.applyType}`
  29. })
  30. } else {
  31. Taro.navigateTo({
  32. url: `/pages/apply/verify/index?id=${item.applyId}&issueId=${item.issueId}&applyType=${item.applyType}`
  33. })
  34. }
  35. } else {
  36. Taro.navigateTo({
  37. url: `/pages/apply/detail/index?id=${item.applyId}&issueId=${item.issueId}&applyType=${item.applyType}`
  38. })
  39. }
  40. }
  41. return (
  42. <Page>
  43. <Tabs sticky>
  44. <Tab title="督察员">
  45. <PowerList
  46. request={getTaIssueApply}
  47. params={{applyType, sourceType: 'inspector'}}
  48. renderItem={(item) => (
  49. <Card key={item.applyId} applyInfo={item} stText={title} onClick={() => onClick(item)} />
  50. )}
  51. />
  52. </Tab>
  53. <Tab title="市民">
  54. <PowerList
  55. request={getTaIssueApply}
  56. params={{applyType, sourceType: 'feedback'}}
  57. renderItem={(item) => (
  58. <Card key={item.applyId} applyInfo={item} stText={title} onClick={() => onClick(item)} />
  59. )}
  60. />
  61. </Tab>
  62. </Tabs>
  63. </Page>
  64. )
  65. }