index.jsx 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. import React, { useMemo } from "react";
  2. import Taro from "@tarojs/taro";
  3. import { View, Text, Image } from "@tarojs/components";
  4. import Page from "@/layouts/index";
  5. import { useModel } from "@/store";
  6. import MenuIcon from "@/components/MenuIcon";
  7. import {
  8. ROLE_CITIZEN,
  9. ROLE_INSPECTOR,
  10. ROLE_MANAGER,
  11. ROLE_ORG_MANAGER,
  12. ROLE_ORG_USER,
  13. ROLE_QUERY_PERSON,
  14. } from "@/utils/user";
  15. import {
  16. PROCESS_APPLY_DELAY,
  17. PROCESS_APPLY_END,
  18. PROCESS_APPLY_REJECT,
  19. PROCESS_APPLY_VERIFY,
  20. PROCESS_ASSIGNED,
  21. PROCESS_END,
  22. PROCESS_START,
  23. APPLY_REJECT,
  24. } from "@/utils/biz";
  25. import { getApplyNum } from "@/services/taissueapply";
  26. import Head from "./components/Head";
  27. import Banner from "./components/Banner";
  28. import StatCard from "./components/StatCard";
  29. import "./index.less";
  30. const getRejctApply = () => getApplyNum({ applyType: PROCESS_APPLY_REJECT });
  31. const getDelayApply = () => getApplyNum({ applyType: PROCESS_APPLY_DELAY });
  32. const getVerifyApply = () => getApplyNum({ applyType: PROCESS_APPLY_VERIFY });
  33. const getEdnApply = (duty) =>
  34. getApplyNum({ applyType: PROCESS_APPLY_END, duty });
  35. export default (props) => {
  36. const userModel = useModel("user");
  37. const { user, duty, signOut, changePwd } = userModel || {};
  38. const menus = useMemo(() => {
  39. return {
  40. // 督查员
  41. [ROLE_INSPECTOR]: [
  42. {
  43. icon: "icon9",
  44. text: "我的上报",
  45. link: "/pages/issue/list/index?mine=true",
  46. },
  47. { icon: "icon11", text: "消息通知", link: "/pages/message/list/index" },
  48. { icon: "icon10", text: "模拟测评", link: "/pages/check/list/index" },
  49. {
  50. icon: "icon4",
  51. text: "消单申请",
  52. request: () => getEdnApply(duty),
  53. link: `/pages/apply/list/index?title=消单申请&applyType=${PROCESS_APPLY_END}`,
  54. },
  55. ],
  56. // 平台管理员
  57. [ROLE_MANAGER]: [
  58. {
  59. icon: "icon1",
  60. text: "待 交 办",
  61. link: `/pages/issue/list2/index?title=待交办&bizStatus=${PROCESS_START}`,
  62. },
  63. {
  64. icon: "icon2",
  65. text: "已 交 办",
  66. link: `/pages/issue/list2/index?title=已交办&bizStatus=${PROCESS_ASSIGNED}`,
  67. },
  68. {
  69. icon: "icon3",
  70. text: "已 办 结",
  71. link: `/pages/issue/list2/index?title=已办结&bizStatus=${PROCESS_END}`,
  72. },
  73. {
  74. icon: "icon4",
  75. text: "消单申请",
  76. request: getEdnApply,
  77. link: `/pages/apply/list/index?title=消单申请&applyType=${PROCESS_APPLY_END}`,
  78. },
  79. {
  80. icon: "icon5",
  81. text: "逾期警告",
  82. link: `/pages/issue/list2/index?title=逾期警告&bizStatus=expired`,
  83. },
  84. {
  85. icon: "icon6",
  86. text: "延期申请",
  87. request: getDelayApply,
  88. link: `/pages/apply/list/index?title=延期申请&applyType=${PROCESS_APPLY_DELAY}`,
  89. },
  90. {
  91. icon: "icon12",
  92. text: "驳回申请",
  93. request: getRejctApply,
  94. link: `/pages/apply/list/index?title=驳回申请&applyType=${PROCESS_APPLY_REJECT}`,
  95. },
  96. {
  97. icon: "icon7",
  98. text: "统计查询",
  99. link: "/subpkg1/pages/statistics/index",
  100. },
  101. {
  102. icon: "icon9",
  103. text: "我的上报",
  104. link: "/pages/issue/list2/index?title=我的上报&mine=true",
  105. },
  106. { icon: "icon11", text: "消息通知", link: "/pages/message/list/index" },
  107. ],
  108. // 责任单位用户
  109. [ROLE_ORG_USER]: [
  110. {
  111. icon: "icon2",
  112. text: "处 理 中",
  113. link: `/pages/org/issue/list/index?title=处理中&bizStatus=${PROCESS_ASSIGNED}`,
  114. },
  115. {
  116. icon: "icon3",
  117. text: "已 办 结",
  118. link: `/pages/org/issue/list/index?title=已办结&bizStatus=${PROCESS_END}`,
  119. },
  120. {
  121. icon: "icon5",
  122. text: "已 逾 期",
  123. link: "/pages/org/issue/list/index?title=已逾期&bizStatus=expired",
  124. },
  125. { icon: "icon11", text: "消息通知", link: "/pages/message/list/index" },
  126. // {
  127. // icon: "icon10",
  128. // text: "我的上报",
  129. // link: `/pages/feedback/issuelist/index?title=我的上报&bizStatus=`,
  130. // },
  131. {
  132. icon: "icon12",
  133. text: "交办历史",
  134. link: "/pages/org/issue/list2/index?mine=true",
  135. },
  136. ],
  137. // 责任交办单位管理员
  138. [ROLE_ORG_MANAGER]: [
  139. {
  140. icon: "icon2",
  141. text: "处 理 中",
  142. link: `/pages/org/issue/list/index?title=处理中&bizStatus=${PROCESS_ASSIGNED}`,
  143. },
  144. {
  145. icon: "icon3",
  146. text: "已 办 结",
  147. link: `/pages/org/issue/list/index?title=已办结&bizStatus=${PROCESS_END}`,
  148. },
  149. {
  150. icon: "icon5",
  151. text: "已 逾 期",
  152. link: "/pages/org/issue/list/index?title=已逾期&bizStatus=expired",
  153. },
  154. {
  155. icon: "icon9",
  156. text: "审核申请",
  157. request: getVerifyApply,
  158. link: `/pages/apply/list/index?title=审核申请&applyType=${PROCESS_APPLY_VERIFY}`,
  159. },
  160. { icon: "icon11", text: "消息通知", link: "/pages/message/list/index" },
  161. { icon: "person", text: "人员管理", link: "/pages/user/list/index" },
  162. {
  163. icon: "icon12",
  164. text: "交办历史",
  165. link: "/pages/org/issue/list2/index?mine=true",
  166. },
  167. ],
  168. // 查询人员
  169. [ROLE_QUERY_PERSON]: [
  170. {
  171. icon: "icon1",
  172. text: "未 处 理",
  173. link: `/pages/issue/list2/index?title=未处理&bizStatus=${PROCESS_START}`,
  174. },
  175. {
  176. icon: "icon2",
  177. text: "处 理 中",
  178. link: `/pages/issue/list2/index?title=处理中&bizStatus=${PROCESS_ASSIGNED}`,
  179. },
  180. {
  181. icon: "icon3",
  182. text: "已 办 结",
  183. link: `/pages/issue/list2/index?title=已办结&bizStatus=${PROCESS_END}`,
  184. },
  185. {
  186. icon: "icon5",
  187. text: "逾期警告",
  188. link: `/pages/issue/list2/index?title=逾期警告&bizStatus=expired`,
  189. },
  190. {
  191. icon: "icon7",
  192. text: "统计查询",
  193. link: "/subpkg1/pages/statistics/index",
  194. },
  195. ],
  196. // 市民
  197. [ROLE_CITIZEN]: [
  198. {
  199. icon: "icon1",
  200. text: "未处理",
  201. link: `/pages/feedback/issuelist/index?title=未处理&bizStatus=${PROCESS_START}`,
  202. },
  203. {
  204. icon: "icon2",
  205. text: "已处理",
  206. link: `/pages/feedback/issuelist/index?title=已处理&bizStatus=${PROCESS_ASSIGNED}`,
  207. },
  208. {
  209. icon: "icon12",
  210. text: "已打回",
  211. link: `/pages/feedback/issuelist/index?title=已打回&bizStatus=${APPLY_REJECT}`,
  212. },
  213. ],
  214. };
  215. }, [duty]);
  216. const menuArr = React.useMemo(() => {
  217. if (!duty) return [];
  218. return menus[duty] || [];
  219. }, [duty]);
  220. console.log(menuArr);
  221. return (
  222. <Page tabBar="home" className="home-page">
  223. <Head userModel={userModel} onChangePwd={changePwd} onExit={signOut} />
  224. <Banner duty={duty} />
  225. <StatCard duty={duty} />
  226. <View className="menu-icons">
  227. {menuArr.map((x) => (
  228. <MenuIcon user={user} key={x.text} {...x} />
  229. ))}
  230. </View>
  231. </Page>
  232. );
  233. };