Yansen hace 2 años
padre
commit
5e17275ebf

+ 12
- 3672
package-lock.json
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 1
- 1
package.json Ver fichero

@@ -13,7 +13,7 @@
13 13
     "@ant-design/pro-components": "^2.3.51",
14 14
     "@wangeditor/editor": "^5.1.23",
15 15
     "@wangeditor/editor-for-react": "^1.0.6",
16
-    "@zjxpcyc/react-tiny-store": "^2.0.1",
16
+    "@zjxpcyc/react-tiny-store": "^2.0.3",
17 17
     "antd": "^5.1.2",
18 18
     "axios": "^1.2.0",
19 19
     "classnames": "^2.3.2",

+ 1
- 1
src/layouts/AuthLayout/components/Header/index.jsx Ver fichero

@@ -18,7 +18,7 @@ export default (props) => {
18 18
 
19 19
   return (
20 20
     <Header className={className}>
21
-      <Logo />
21
+      <Logo user={user} />
22 22
       <Space>
23 23
         <User user={user} />
24 24
         <Exit />

+ 5
- 1
src/layouts/AuthLayout/components/Logo.jsx Ver fichero

@@ -2,12 +2,16 @@ import React from 'react';
2 2
 import { Typography } from 'antd';
3 3
 import { NavLink } from "react-router-dom";
4 4
 import { useModel } from '@/store';
5
+import useOrgResponsible from '@/utils/hooks/useOrgResponsible';
5 6
 
6 7
 export default (props) => {
7 8
   const { app } = useModel('system');
8 9
 
10
+  const [isResponsible] = useOrgResponsible();
11
+  const url = isResponsible ? '/issue' : '/';
12
+
9 13
   return (
10
-    <NavLink className='logo'  to="/">
14
+    <NavLink className='logo' to={url}>
11 15
       <img src="./logo.png" alt="" />
12 16
       <h3>{app.shorName}</h3>
13 17
     </NavLink>

+ 6
- 1
src/layouts/AuthLayout/index.jsx Ver fichero

@@ -1,6 +1,6 @@
1 1
 import React, { useEffect } from 'react';
2 2
 import { Layout, Spin } from 'antd';
3
-import { useLocation, Outlet } from "react-router-dom";
3
+import { useLocation, Outlet, Navigate } from "react-router-dom";
4 4
 import { useModel } from '@/store';
5 5
 import useRoute from '@/utils/hooks/useRoute';
6 6
 import RequireLogin from './components/RequireLogin';
@@ -18,6 +18,11 @@ export default (props) => {
18 18
   const { meta } = useRoute() || {};
19 19
   const { noLayout = false, noSiderBar = false, noFooter = false } = meta || {};
20 20
 
21
+  const { org } = user || {};
22
+  if (location.pathname == '/' && org?.isResponsible) {
23
+    return <Navigate to="/issue" replace />
24
+  }
25
+
21 26
   return (
22 27
     <Spin spinning={!user} size="large">
23 28
       <HtmlTitle />

+ 1
- 1
src/pages/home/index.jsx Ver fichero

@@ -1,11 +1,11 @@
1 1
 import React from 'react'
2 2
 import { Row, Col } from 'antd';
3
+import Page from '@/components/Page';
3 4
 import Banner from './components/Banner';
4 5
 import EscalationCharts from './components/EscalationCharts';
5 6
 import AssignedCharts from './components/AssignedCharts';
6 7
 import ProblemCharts from './components/ProblemCharts';
7 8
 import SpotCharts from './components/SpotCharts';
8
-import Page from '@/components/Page';
9 9
 
10 10
 export default (props) => {
11 11
 

+ 19
- 6
src/pages/issue/index.jsx Ver fichero

@@ -2,13 +2,13 @@ import React from 'react';
2 2
 import { Button, Badge } from 'antd';
3 3
 import { useNavigate } from 'react-router-dom';
4 4
 import List from '@/components/Page/List';
5
-import { getTaIssue } from '@/service/taissue';
5
+import { getTaIssue, getTaOrgIssue, exportTaIssue, exportTaOrgIssue } from '@/service/taissue';
6 6
 import { getTdLocType } from '@/service/tdloctype';
7 7
 import { getSysOrg } from '@/service/sysorg';
8 8
 import { queryDict } from '@/utils/request';
9 9
 import { processEnum, processStatus } from '@/utils/biz';
10
-import { exportTaIssue } from '@/service/taissue';
11 10
 import useBool from '@/utils/hooks/useBool';
11
+import useOrgResponsible from '@/utils/hooks/useOrgResponsible';
12 12
 
13 13
 const queryOrg = queryDict(getSysOrg, { labelKey: 'name', valueKey: 'orgId' });
14 14
 const queryLocType = queryDict(getTdLocType, { labelKey: 'name', valueKey: 'typeId' });
@@ -16,12 +16,24 @@ const queryLocType = queryDict(getTdLocType, { labelKey: 'name', valueKey: 'type
16 16
 const today = (new Date()).toJSON().substring(0, 10);
17 17
 
18 18
 export default (props) => {
19
-
20 19
   const [loading, startLoading, stopLoading] = useBool();
21 20
   const navigate = useNavigate();
22 21
   const paramsRef = React.useRef();
23 22
 
23
+  const [isResponsible, org] = useOrgResponsible();
24
+  const [request, params, exportFn] = React.useMemo(() => {
25
+    return [
26
+      isResponsible ? getTaOrgIssue : getTaIssue,
27
+      isResponsible ? { orgId: org?.orgId } : { all: true },
28
+      isResponsible ? exportTaOrgIssue : exportTaIssue,
29
+    ]
30
+  }, [isResponsible, org]);
31
+
24 32
   const columns = [
33
+    {
34
+      title: "问题单号",
35
+      dataIndex: "issueId",
36
+    },
25 37
     {
26 38
       title: "上报日期",
27 39
       dataIndex: "createDate",
@@ -50,6 +62,7 @@ export default (props) => {
50 62
       dataIndex: "orgId",
51 63
       valueType: 'select',
52 64
       request: queryOrg,
65
+      hideInSearch: isResponsible,
53 66
     },
54 67
     {
55 68
       title: "流程状态",
@@ -74,7 +87,7 @@ export default (props) => {
74 87
 
75 88
   const onExport = () => {
76 89
     startLoading();
77
-    exportTaIssue(paramsRef.current).then(() => {
90
+    exportFn(paramsRef.current).then(() => {
78 91
       stopLoading();
79 92
     }).catch(() => {
80 93
       stopLoading();
@@ -92,9 +105,9 @@ export default (props) => {
92 105
   return (
93 106
     <List
94 107
       rowKey="issueId"
95
-      request={getTaIssue}
108
+      request={request}
96 109
       columns={columns}
97
-      params={{ all: true }}
110
+      params={params}
98 111
       beforeSearchSubmit={beforeSearchSubmit}
99 112
       optionRender={(_, row) => [
100 113
         <Button key="detail" type="link" onClick={() => navigate(`/issue/detail?id=${row.issueId}`)}>详情</Button>

+ 13
- 2
src/pages/org/components/Form.jsx Ver fichero

@@ -1,5 +1,5 @@
1 1
 import React from 'react';
2
-import { Button, Card, Form, Input, Select } from 'antd';
2
+import { Button, Radio, Form, Input, Select } from 'antd';
3 3
 import useBool from '@/utils/hooks/useBool';
4 4
 import { postSysOrg, putSysOrg, getSysOrgById } from "@/service/sysorg";
5 5
 import { formItemLayout, tailFormItemLayout } from '@/utils/form';
@@ -32,11 +32,12 @@ export default (props) => {
32 32
   }
33 33
 
34 34
   React.useEffect(() => {
35
+    form.resetFields();
35 36
     if (org) {
36 37
       form.setFieldsValue(org);
37 38
     } else {
38
-      form.resetFields();
39 39
       form.setFieldValue('orgPId', parentId);
40
+      form.setFieldValue('isResponsible', true);
40 41
     }
41 42
 
42 43
     console.log(org, parentId);
@@ -68,6 +69,16 @@ export default (props) => {
68 69
         </Select>
69 70
       </Form.Item>
70 71
 
72
+      <Form.Item
73
+        name="isResponsible"
74
+        label="责任单位"
75
+      >
76
+        <Radio.Group>
77
+          <Radio value={true}>是</Radio>
78
+          <Radio value={false}>否</Radio>
79
+        </Radio.Group>
80
+      </Form.Item>
81
+
71 82
       <Form.Item
72 83
         name="sortNo"
73 84
         label="排序"

+ 7
- 2
src/routes/routes.jsx Ver fichero

@@ -121,6 +121,7 @@ export const authRoutes = [
121 121
         meta: {
122 122
           title: "答题记录",
123 123
           icon: <FileTextOutlined />,
124
+          permission: "check.answer",
124 125
         },
125 126
         children: [
126 127
           {
@@ -129,6 +130,7 @@ export const authRoutes = [
129 130
             meta: {
130 131
               title: "实地测评",
131 132
               icon: <HddOutlined />,
133
+              permission: "check.answer.loc",
132 134
             },
133 135
           },
134 136
           {
@@ -136,7 +138,8 @@ export const authRoutes = [
136 138
             element: <CheckLocAnswerDetail />,
137 139
             meta: {
138 140
               title: "实地答题明细",
139
-              hideInMenu: true
141
+              hideInMenu: true,
142
+              permission: "check.answer.loc.detail",
140 143
             },
141 144
           },
142 145
           {
@@ -145,6 +148,7 @@ export const authRoutes = [
145 148
             meta: {
146 149
               title: "问卷调查",
147 150
               icon: <HddOutlined />,
151
+              permission: "check.answer.survery",
148 152
             },
149 153
           },
150 154
           {
@@ -152,7 +156,8 @@ export const authRoutes = [
152 156
             element: <CheckSurveyAnswerDetail />,
153 157
             meta: {
154 158
               title: "问卷答题明细",
155
-              hideInMenu: true
159
+              hideInMenu: true,
160
+              permission: "check.answer.survery.detail",
156 161
             },
157 162
           },
158 163
         ],

+ 6
- 0
src/service/taissue.js Ver fichero

@@ -15,6 +15,11 @@ export const postTaIssue = (data) => request('/api/taIssue', { data, method: 'po
15 15
  */
16 16
 export const getTaIssueById = (id) => request(`/api/taIssue/${id}`);
17 17
 
18
+/*
19
+ * 分页查询
20
+ */
21
+export const getTaOrgIssue = (params) => request('/api/taOrgIssue', { params });
22
+
18 23
 /*
19 24
  * 通过ID查询单条数据
20 25
  */
@@ -34,3 +39,4 @@ export const deleteTaIssue = (id) => request(`/api/taIssue/${id}`, { method: 'de
34 39
  * 导出
35 40
  */
36 41
 export const exportTaIssue = (params) => request(`/api/taIssue/export`, { params, method: 'post', download: true });
42
+export const exportTaOrgIssue = (params) => request(`/api/taOrgIssue/export`, { params, method: 'post', download: true });

+ 1
- 2
src/store/index.js Ver fichero

@@ -9,6 +9,5 @@ const store = createStore({
9 9
 
10 10
 export default store
11 11
 export const useModel = store.useModel
12
-export const addModel = store.addModel
13
-export const removeModel = store.removeModel
12
+export const getState = store.getState
14 13
 export const Provider = store.Provider

+ 16
- 0
src/utils/hooks/useOrgResponsible.js Ver fichero

@@ -0,0 +1,16 @@
1
+import React from 'react';
2
+import { useModel } from "@/store";
3
+
4
+export default function useOrgResponsible() {
5
+  const { user } = useModel('user');
6
+
7
+  const isResponsible = React.useMemo(() => {
8
+    const { org } = user || {};
9
+    return org?.isResponsible || false;
10
+  }, [user]);
11
+
12
+  return [
13
+    isResponsible,
14
+    user?.org,
15
+  ]
16
+}

+ 0
- 29
vite.config.js.timestamp-1670921280997.mjs Ver fichero

@@ -1,29 +0,0 @@
1
-// vite.config.js
2
-import { defineConfig } from "file:///E:/work/civilized_city/pc-admin/node_modules/.pnpm/registry.npmmirror.com+vite@3.2.5_less@4.1.3/node_modules/vite/dist/node/index.js";
3
-import path from "path";
4
-import react from "file:///E:/work/civilized_city/pc-admin/node_modules/.pnpm/registry.npmmirror.com+@vitejs+plugin-react@2.2.0_vite@3.2.5/node_modules/@vitejs/plugin-react/dist/index.mjs";
5
-var __vite_injected_original_dirname = "E:\\work\\civilized_city\\pc-admin";
6
-var vite_config_default = defineConfig({
7
-  server: {
8
-    port: 3e3
9
-  },
10
-  plugins: [
11
-    react()
12
-  ],
13
-  resolve: {
14
-    alias: [
15
-      { find: "@", replacement: path.resolve(__vite_injected_original_dirname, "src") }
16
-    ]
17
-  },
18
-  css: {
19
-    preprocessorOptions: {
20
-      less: {
21
-        javascriptEnabled: true
22
-      }
23
-    }
24
-  }
25
-});
26
-export {
27
-  vite_config_default as default
28
-};
29
-//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcuanMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCJFOlxcXFx3b3JrXFxcXGNpdmlsaXplZF9jaXR5XFxcXHBjLWFkbWluXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCJFOlxcXFx3b3JrXFxcXGNpdmlsaXplZF9jaXR5XFxcXHBjLWFkbWluXFxcXHZpdGUuY29uZmlnLmpzXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ltcG9ydF9tZXRhX3VybCA9IFwiZmlsZTovLy9FOi93b3JrL2NpdmlsaXplZF9jaXR5L3BjLWFkbWluL3ZpdGUuY29uZmlnLmpzXCI7aW1wb3J0IHsgZGVmaW5lQ29uZmlnIH0gZnJvbSAndml0ZSdcbmltcG9ydCBwYXRoIGZyb20gXCJwYXRoXCJcbmltcG9ydCByZWFjdCBmcm9tICdAdml0ZWpzL3BsdWdpbi1yZWFjdCdcblxuLy8gaHR0cHM6Ly92aXRlanMuZGV2L2NvbmZpZy9cbmV4cG9ydCBkZWZhdWx0IGRlZmluZUNvbmZpZyh7XG4gIHNlcnZlcjoge1xuICAgIHBvcnQ6IDMw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