123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- import React, { useMemo } from "react";
- import Taro from "@tarojs/taro";
- import { View, Text, Image } from "@tarojs/components";
- import Page from "@/layouts/index";
- import { useModel } from "@/store";
- import MenuIcon from "@/components/MenuIcon";
- import {
- ROLE_CITIZEN,
- ROLE_INSPECTOR,
- ROLE_MANAGER,
- ROLE_ORG_MANAGER,
- ROLE_ORG_USER,
- ROLE_QUERY_PERSON,
- } from "@/utils/user";
- import {
- PROCESS_APPLY_DELAY,
- PROCESS_APPLY_END,
- PROCESS_APPLY_REJECT,
- PROCESS_APPLY_VERIFY,
- PROCESS_ASSIGNED,
- PROCESS_END,
- PROCESS_START,
- APPLY_REJECT,
- } from "@/utils/biz";
- import { getApplyNum } from "@/services/taissueapply";
- import Head from "./components/Head";
- import Banner from "./components/Banner";
- import StatCard from "./components/StatCard";
- import "./index.less";
-
- const getRejctApply = () => getApplyNum({ applyType: PROCESS_APPLY_REJECT });
- const getDelayApply = () => getApplyNum({ applyType: PROCESS_APPLY_DELAY });
- const getVerifyApply = () => getApplyNum({ applyType: PROCESS_APPLY_VERIFY });
- const getEdnApply = (duty) =>
- getApplyNum({ applyType: PROCESS_APPLY_END, duty });
-
- export default (props) => {
- const userModel = useModel("user");
- const { user, duty, signOut, changePwd } = userModel || {};
- const menus = useMemo(() => {
- return {
- // 督查员
- [ROLE_INSPECTOR]: [
- {
- icon: "icon9",
- text: "我的上报",
- link: "/pages/issue/list/index?mine=true",
- },
- { icon: "icon11", text: "消息通知", link: "/pages/message/list/index" },
- { icon: "icon10", text: "模拟测评", link: "/pages/check/list/index" },
- {
- icon: "icon4",
- text: "消单申请",
- request: () => getEdnApply(duty),
- link: `/pages/apply/list/index?title=消单申请&applyType=${PROCESS_APPLY_END}`,
- },
- ],
-
- // 平台管理员
- [ROLE_MANAGER]: [
- {
- icon: "icon1",
- text: "待 交 办",
- link: `/pages/issue/list2/index?title=待交办&bizStatus=${PROCESS_START}`,
- },
- {
- icon: "icon2",
- text: "已 交 办",
- link: `/pages/issue/list2/index?title=已交办&bizStatus=${PROCESS_ASSIGNED}`,
- },
- {
- icon: "icon3",
- text: "已 办 结",
- link: `/pages/issue/list2/index?title=已办结&bizStatus=${PROCESS_END}`,
- },
- {
- icon: "icon4",
- text: "消单申请",
- request: getEdnApply,
- link: `/pages/apply/list/index?title=消单申请&applyType=${PROCESS_APPLY_END}`,
- },
- {
- icon: "icon5",
- text: "逾期警告",
- link: `/pages/issue/list2/index?title=逾期警告&bizStatus=expired`,
- },
- {
- icon: "icon6",
- text: "延期申请",
- request: getDelayApply,
- link: `/pages/apply/list/index?title=延期申请&applyType=${PROCESS_APPLY_DELAY}`,
- },
- {
- icon: "icon12",
- text: "驳回申请",
- request: getRejctApply,
- link: `/pages/apply/list/index?title=驳回申请&applyType=${PROCESS_APPLY_REJECT}`,
- },
- {
- icon: "icon7",
- text: "统计查询",
- link: "/subpkg1/pages/statistics/index",
- },
- {
- icon: "icon9",
- text: "我的上报",
- link: "/pages/issue/list2/index?title=我的上报&mine=true",
- },
- { icon: "icon11", text: "消息通知", link: "/pages/message/list/index" },
- ],
-
- // 责任单位用户
- [ROLE_ORG_USER]: [
- {
- icon: "icon2",
- text: "处 理 中",
- link: `/pages/org/issue/list/index?title=处理中&bizStatus=${PROCESS_ASSIGNED}`,
- },
- {
- icon: "icon3",
- text: "已 办 结",
- link: `/pages/org/issue/list/index?title=已办结&bizStatus=${PROCESS_END}`,
- },
- {
- icon: "icon5",
- text: "已 逾 期",
- link: "/pages/org/issue/list/index?title=已逾期&bizStatus=expired",
- },
- { icon: "icon11", text: "消息通知", link: "/pages/message/list/index" },
- // {
- // icon: "icon10",
- // text: "我的上报",
- // link: `/pages/feedback/issuelist/index?title=我的上报&bizStatus=`,
- // },
- {
- icon: "icon12",
- text: "交办历史",
- link: "/pages/org/issue/list2/index?mine=true",
- },
- ],
-
- // 责任交办单位管理员
- [ROLE_ORG_MANAGER]: [
- {
- icon: "icon2",
- text: "处 理 中",
- link: `/pages/org/issue/list/index?title=处理中&bizStatus=${PROCESS_ASSIGNED}`,
- },
- {
- icon: "icon3",
- text: "已 办 结",
- link: `/pages/org/issue/list/index?title=已办结&bizStatus=${PROCESS_END}`,
- },
- {
- icon: "icon5",
- text: "已 逾 期",
- link: "/pages/org/issue/list/index?title=已逾期&bizStatus=expired",
- },
- {
- icon: "icon9",
- text: "审核申请",
- request: getVerifyApply,
- link: `/pages/apply/list/index?title=审核申请&applyType=${PROCESS_APPLY_VERIFY}`,
- },
- { icon: "icon11", text: "消息通知", link: "/pages/message/list/index" },
- { icon: "person", text: "人员管理", link: "/pages/user/list/index" },
- {
- icon: "icon12",
- text: "交办历史",
- link: "/pages/org/issue/list2/index?mine=true",
- },
- ],
-
- // 查询人员
- [ROLE_QUERY_PERSON]: [
- {
- icon: "icon1",
- text: "未 处 理",
- link: `/pages/issue/list2/index?title=未处理&bizStatus=${PROCESS_START}`,
- },
- {
- icon: "icon2",
- text: "处 理 中",
- link: `/pages/issue/list2/index?title=处理中&bizStatus=${PROCESS_ASSIGNED}`,
- },
- {
- icon: "icon3",
- text: "已 办 结",
- link: `/pages/issue/list2/index?title=已办结&bizStatus=${PROCESS_END}`,
- },
- {
- icon: "icon5",
- text: "逾期警告",
- link: `/pages/issue/list2/index?title=逾期警告&bizStatus=expired`,
- },
- {
- icon: "icon7",
- text: "统计查询",
- link: "/subpkg1/pages/statistics/index",
- },
- ],
-
- // 市民
- [ROLE_CITIZEN]: [
- {
- icon: "icon1",
- text: "未处理",
- link: `/pages/feedback/issuelist/index?title=未处理&bizStatus=${PROCESS_START}`,
- },
- {
- icon: "icon2",
- text: "已处理",
- link: `/pages/feedback/issuelist/index?title=已处理&bizStatus=${PROCESS_ASSIGNED}`,
- },
- {
- icon: "icon12",
- text: "已打回",
- link: `/pages/feedback/issuelist/index?title=已打回&bizStatus=${APPLY_REJECT}`,
- },
- ],
- };
- }, [duty]);
-
- const menuArr = React.useMemo(() => {
- if (!duty) return [];
-
- return menus[duty] || [];
- }, [duty]);
- console.log(menuArr);
- return (
- <Page tabBar="home" className="home-page">
- <Head userModel={userModel} onChangePwd={changePwd} onExit={signOut} />
- <Banner duty={duty} />
- <StatCard duty={duty} />
-
- <View className="menu-icons">
- {menuArr.map((x) => (
- <MenuIcon user={user} key={x.text} {...x} />
- ))}
- </View>
- </Page>
- );
- };
|