瀏覽代碼

Merge branch 'dev' of http://git.ycjcjy.com/jgz/admin into dev

fangmingyue 2 年之前
父節點
當前提交
b9d9cc8974

+ 22
- 0
src/components/evaluateItem/index.jsx 查看文件

@@ -0,0 +1,22 @@
1
+import React, { useState, useEffect } from "react";
2
+import { Radio } from "antd";
3
+function MyEditor(props) {
4
+  const {
5
+    // value,
6
+    // onChange = (e) => {},
7
+    options = [
8
+      { value: 2, label: "优" },
9
+      { value: 1, label: "良" },
10
+      { value: 0, label: "差" },
11
+    ],
12
+    ...leftProps
13
+  } = props;
14
+
15
+  return (
16
+    <>
17
+      <Radio.Group options={options} {...leftProps} />
18
+    </>
19
+  );
20
+}
21
+
22
+export default MyEditor;

+ 92
- 0
src/pages/evaluate/evaluateList/addeValuate.jsx 查看文件

@@ -0,0 +1,92 @@
1
+import { PlusOutlined } from "@ant-design/icons";
2
+import {
3
+  ModalForm,
4
+  ProForm,
5
+  ProFormDateRangePicker,
6
+  ProFormSelect,
7
+  ProFormText,
8
+} from "@ant-design/pro-components";
9
+import { Button, Form, message } from "antd";
10
+// import { getPostsFilesList, savePostsFiles } from "@/services/posts";
11
+import {
12
+  getEvaluateList,
13
+  saveEvaluate
14
+} from "@/services/evaluate";
15
+import EvaluateItem from "@/components/evaluateItem";
16
+
17
+export default ({ taskId, onsuccess = () => {} }) => {
18
+  const [form] = Form.useForm();
19
+
20
+  const onFinish = async (values) => {
21
+    console.log(values);
22
+    // await waitTime(2000);
23
+
24
+    await saveEvaluate(values);
25
+    onsuccess();
26
+    return true;
27
+  };
28
+
29
+  const itemList = [
30
+    {
31
+      name: "item1",
32
+      label: "服务质量",
33
+    },
34
+    {
35
+      name: "item2",
36
+      label: "供应住宿",
37
+    },
38
+    {
39
+      name: "item3",
40
+      label: "供应餐饮",
41
+    },
42
+    {
43
+      name: "item4",
44
+      label: "洗浴评价",
45
+    },
46
+    {
47
+      name: "item5",
48
+      label: "娱乐评价",
49
+    },
50
+    {
51
+      name: "item6",
52
+      label: "军供文化",
53
+    },
54
+  ];
55
+  
56
+  return (
57
+    <ModalForm
58
+      title="评价"
59
+      trigger={<Button type="primary">新增</Button>}
60
+      form={form}
61
+      // open={true}
62
+      layout={"horizontal"}
63
+      labelCol={{ span: 8 }}
64
+      wrapperCol={{ span: 12 }}
65
+      modalProps={{
66
+        destroyOnClose: true,
67
+        onCancel: () => console.log("run"),
68
+      }}
69
+      initialValues={{ taskId: taskId }}
70
+      submitTimeout={2000}
71
+      onFinish={onFinish}
72
+    >
73
+      <ProFormText
74
+        width="md"
75
+        name="taskId"
76
+        label="任务ID"
77
+        readonly
78
+        hidden={true}
79
+      />
80
+      {itemList?.map((x) => {
81
+       return <ProForm.Item
82
+          key={x.name}
83
+          name={x.name}
84
+          label={x.label}
85
+          rules={[{ required: true, message: "请选择评价" }]}
86
+        >
87
+          <EvaluateItem></EvaluateItem>
88
+        </ProForm.Item>;
89
+      })}
90
+    </ModalForm>
91
+  );
92
+};

+ 103
- 0
src/pages/evaluate/evaluateList/index.jsx 查看文件

@@ -0,0 +1,103 @@
1
+import { getEvaluateList } from "@/services/evaluate";
2
+import { queryTable } from "@/utils/request";
3
+import { PageContainer, ProTable } from "@ant-design/pro-components";
4
+import { Link, useNavigate, useSearchParams } from "react-router-dom";
5
+
6
+import { Button, message, Popconfirm } from "antd";
7
+import moment from "moment";
8
+import { useRef, useState } from "react";
9
+import AddeValuate from "./addeValuate";
10
+
11
+const EvaluateList = (props) => {
12
+  const [searchParams] = useSearchParams();
13
+  const id = searchParams.get("id");
14
+  const navigate = useNavigate();
15
+
16
+  // const [storeTypeDict, setStoreTypeDict] = useState([]);
17
+  const actionRef = useRef();
18
+  const formRef = useRef();
19
+
20
+  const  valueEnum= {
21
+    2: { text: "优", status: "Success" },
22
+    1: { text: "良", status: "Processing" },
23
+    0: { text: "差", status: "Default" },
24
+  }
25
+
26
+  const columns = [
27
+    // {
28
+    //   title: "任务ID",
29
+    //   dataIndex: "taskId",
30
+    // },
31
+
32
+    {
33
+      title: "服务质量",
34
+      dataIndex: "item1",
35
+      search: false,
36
+      valueEnum
37
+    },
38
+    {
39
+      title: "供应住宿",
40
+      dataIndex: "item2",
41
+      search: false,
42
+      valueEnum
43
+    },
44
+    {
45
+      title: "供应餐饮",
46
+      dataIndex: "item3",
47
+      search: false,
48
+      valueEnum
49
+    },
50
+    {
51
+      title: "洗浴评价",
52
+      dataIndex: "item4",
53
+      search: false,
54
+      valueEnum
55
+    },
56
+    {
57
+      title: "娱乐评价",
58
+      dataIndex: "item5",
59
+      search: false,
60
+      valueEnum
61
+    },
62
+    {
63
+      title: "军供文化",
64
+      dataIndex: "item6",
65
+      search: false,
66
+      valueEnum
67
+    },
68
+  ];
69
+
70
+  return (
71
+    <PageContainer>
72
+      <ProTable
73
+        actionRef={actionRef}
74
+        formRef={formRef}
75
+        search={false}
76
+        params={{ taskId: id }}
77
+        rowKey="id"
78
+        toolBarRender={() => [
79
+          <AddeValuate
80
+            taskId={id}
81
+            key="2"
82
+            onsuccess={() => {
83
+              actionRef.current.reload();
84
+            }}
85
+          ></AddeValuate>,
86
+          // <Button
87
+          //   key="2"
88
+          //   type="primary"
89
+          //   onClick={() => {
90
+
91
+          //   }}
92
+          // >
93
+          //   新增评价
94
+          // </Button>,
95
+        ]}
96
+        request={queryTable(getEvaluateList)}
97
+        columns={columns}
98
+      />
99
+    </PageContainer>
100
+  );
101
+};
102
+
103
+export default EvaluateList;

+ 114
- 0
src/pages/evaluate/index.jsx 查看文件

@@ -0,0 +1,114 @@
1
+import {
2
+  deleteGuaranteeTask,
3
+  getGuaranteeTaskList,
4
+} from "@/services/guaranteeTask";
5
+import { queryTable } from "@/utils/request";
6
+import { PageContainer, ProTable } from "@ant-design/pro-components";
7
+import { Link, useNavigate } from "react-router-dom";
8
+
9
+import { Button, message, Popconfirm } from "antd";
10
+import moment from "moment";
11
+import { useRef, useState } from "react";
12
+
13
+const GuaranteeTaskList = (props) => {
14
+  const navigate = useNavigate();
15
+  const [isOpen, setIsOpen] = useState(false);
16
+  const [modalData, setModalData] = useState({});
17
+  // const [storeTypeDict, setStoreTypeDict] = useState([]);
18
+  const actionRef = useRef();
19
+  const formRef = useRef();
20
+
21
+  const handleDelete = (id) => {
22
+    if (id) {
23
+      deleteGuaranteeTask(id).then((res) => {
24
+        message.success("删除成功");
25
+        actionRef.current.reload();
26
+      });
27
+    }
28
+  };
29
+
30
+  const onCancel = () => {
31
+    setIsOpen(false);
32
+    setModalData({});
33
+  };
34
+
35
+  const columns = [
36
+    {
37
+      title: "保障序号",
38
+      dataIndex: "guaranteeNo",
39
+    },
40
+    {
41
+      title: "受领人",
42
+      dataIndex: "receiver",
43
+    },
44
+    {
45
+      title: "时间区间",
46
+      dataIndex: "dateRange",
47
+      valueType: "dateRange",
48
+      search: {
49
+        transform: (value) => {
50
+          console.log(value, value[0].valueOf(), "valuevalue");
51
+
52
+          return {
53
+            startDate: moment(value[0]).format("yyyy-MM-DD"),
54
+            endDate: moment(value[1]).format("yyyy-MM-DD"),
55
+          };
56
+        },
57
+      },
58
+    },
59
+    {
60
+      title: "保障地点",
61
+      dataIndex: "address",
62
+      search: false,
63
+    },
64
+    {
65
+      title: "保障人数",
66
+      dataIndex: "totalPersonNum",
67
+      search: false,
68
+    },
69
+    {
70
+      title: "伙食标准",
71
+      dataIndex: "standard",
72
+      search: false,
73
+    },
74
+
75
+    {
76
+      title: "操作",
77
+      valueType: "option",
78
+      width: 200,
79
+      render: (_, record) => [
80
+        <Button
81
+          key={2}
82
+          style={{ padding: 0 }}
83
+          type="link"
84
+          onClick={() => {
85
+            navigate(`/task/evaluate/list?id=${record.id}`);
86
+          }}
87
+        >
88
+          评价
89
+        </Button>,
90
+      ],
91
+    },
92
+  ];
93
+
94
+  return (
95
+    <PageContainer>
96
+      <ProTable
97
+        actionRef={actionRef}
98
+        formRef={formRef}
99
+        postData={(data) => {
100
+          return data.map((x) => ({
101
+            dateRange: [x.startDate, x.endDate],
102
+            ...x,
103
+          }));
104
+        }}
105
+        rowKey="id"
106
+       
107
+        request={queryTable(getGuaranteeTaskList)}
108
+        columns={columns}
109
+      />
110
+    </PageContainer>
111
+  );
112
+};
113
+
114
+export default GuaranteeTaskList;

+ 9
- 3
src/pages/statis/components/Filter.jsx 查看文件

@@ -2,7 +2,7 @@ import React from 'react';
2 2
 import { Row, Col, Radio, DatePicker } from 'antd';
3 3
 import moment from 'moment';
4 4
 import 'moment/locale/zh-cn';
5
-import locale from 'antd/es/locale/zh_CN';
5
+import locale from 'antd/es/date-picker/locale/zh_CN';
6 6
 
7 7
 const { RangePicker } = DatePicker;
8 8
 const radioOptions = [
@@ -11,6 +11,11 @@ const radioOptions = [
11 11
   { label: '本年', value: '3' },
12 12
 ];
13 13
 
14
+export const last30Days = [
15
+  moment().subtract(30, 'days'),
16
+  moment(),
17
+];
18
+
14 19
 export const yearRange = [
15 20
   moment().startOf('year'),
16 21
   moment(),
@@ -29,6 +34,7 @@ export default (props) => {
29 34
   const [radioValue, setRadioValue] = React.useState();
30 35
 
31 36
   const onChange = (val) => {
37
+    console.log(val);
32 38
     if (typeof props.onChange === 'function') {
33 39
       props.onChange(getStrValue(val));
34 40
     }
@@ -37,7 +43,7 @@ export default (props) => {
37 43
   const onPickerChange = val => {
38 44
     setDateRange(val);
39 45
     setRadioValue();
40
-    onChange(getStrValue(val));
46
+    onChange(val);
41 47
   }
42 48
 
43 49
   const onRadioChange = e => {
@@ -59,7 +65,7 @@ export default (props) => {
59 65
     }
60 66
     
61 67
     setDateRange(dateRange);
62
-    onChange(getStrValue(dateRange));
68
+    onChange(dateRange);
63 69
   }
64 70
 
65 71
   return (

+ 19
- 7
src/pages/statis/components/Sumary.jsx 查看文件

@@ -1,6 +1,7 @@
1 1
 import React from 'react';
2 2
 import { Row, Col } from 'antd';
3 3
 import classNames from 'classnames';
4
+import { getSummary } from '@/services/statis';
4 5
 import icon1 from '@/assets/images/statistic/数字统计.png';
5 6
 import icon2 from '@/assets/images/statistic/接待军人总数.png';
6 7
 import icon3 from '@/assets/images/statistic/保障机构数.png';
@@ -8,33 +9,44 @@ import icon4 from '@/assets/images/statistic/设备数量.png';
8 9
 import Styles from './style.module.less';
9 10
 
10 11
 const DataCard = (props) => {
11
-  const { className, icon } = props;
12
+  const { className, icon, title, value = 0, size } = props;
12 13
 
13 14
   const cls = classNames(Styles['data-card'], className);
14 15
 
16
+  const valStyle = React.useMemo(() => {
17
+    return size ? { fontSize: size } : {}
18
+  }, [size]);
19
+
15 20
   return (
16 21
     <dl className={cls}>
17
-      <dt>0</dt>
18
-      <dd>任务总数</dd>
22
+      <dt style={valStyle}>{value}</dt>
23
+      <dd>{title}</dd>
19 24
       <img src={icon} alt="" />
20 25
     </dl>
21 26
   )
22 27
 }
23 28
 
24 29
 export default (props) => {
30
+  
31
+  const [data, setData] = React.useState({});
32
+
33
+  React.useEffect(() => {
34
+    getSummary().then(setData);
35
+  }, []);
36
+
25 37
   return (
26 38
     <Row gutter={props.gutter} justify="space-between">
27 39
       <Col span={6}>
28
-        <DataCard icon={icon1} className={Styles['bk1']} />
40
+        <DataCard title="任务总数" value={data.taskCount} icon={icon1} className={Styles['bk1']} />
29 41
       </Col>
30 42
       <Col span={6}>
31
-        <DataCard icon={icon2} className={Styles['bk2']} />
43
+        <DataCard title="接待军人总数" value={data.personNum} icon={icon2} className={Styles['bk2']} />
32 44
       </Col>
33 45
       <Col span={6}>
34
-        <DataCard icon={icon3} className={Styles['bk3']} />
46
+        <DataCard title="总体评价" value={data.evaValue} icon={icon3} className={Styles['bk3']} size="24px" />
35 47
       </Col>
36 48
       <Col span={6}>
37
-        <DataCard icon={icon4} className={Styles['bk4']} />
49
+        <DataCard title="设备数量" value={data.deviceNum} icon={icon4} className={Styles['bk4']} />
38 50
       </Col>
39 51
     </Row>
40 52
   )

+ 25
- 5
src/pages/statis/components/Task.jsx 查看文件

@@ -2,18 +2,33 @@ import React from 'react';
2 2
 import * as echarts from 'echarts/core';
3 3
 import icon from '@/assets/images/statistic/任务统计.png';
4 4
 import Chart from '@/components/chart';
5
+import { getTaskInfo } from '@/services/statis';
5 6
 import StatisCard from './StatisCard';
6
-import Filter from './Filter';
7
+import Filter, { last30Days, getStrValue } from './Filter';
7 8
 
9
+const defaultValue = getStrValue(last30Days);
8 10
 export default (props) => {
9 11
 
10
-  const option = getOption(["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], [0, 0, 0, 0, 0, 0, 8, 9, 10, 1, 1, 6])
12
+  const [dateRange, setDateRange] = React.useState(defaultValue);
13
+  const [option, setOption] = React.useState({});
14
+  // const option = getOption(["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], [0, 0, 0, 0, 0, 0, 8, 9, 10, 1, 1, 6])
15
+
16
+  React.useEffect(() => {
17
+    getTaskInfo({ startDate: dateRange[0], endDate: dateRange[1] }).then(res => {
18
+      const keys = res.map(x => x.dt);
19
+      const vals = res.map(x => x.cnt);
20
+
21
+      const opt = getOption(keys, vals);
22
+
23
+      setOption(res.length > 30 ? { ...opt, dataZoom: { height: 20, bottom: 6 } } : opt);
24
+    });
25
+  }, [dateRange]);
11 26
 
12 27
   return (
13 28
     <StatisCard
14 29
       title="任务统计"
15 30
       icon={icon}
16
-      extra={<Filter />}
31
+      extra={<Filter onChange={setDateRange} />}
17 32
     >
18 33
       <Chart option={option} style={{ height: '300px' }} />
19 34
     </StatisCard>
@@ -39,7 +54,7 @@ function getOption(xAxisData, seriesData) {
39 54
     },
40 55
     xAxis: {
41 56
       type: 'category',
42
-      axisLabel: axisLabel,
57
+      axisLabel: { ...axisLabel, rotate: 45 },
43 58
       axisLine: {
44 59
         show: true,
45 60
         lineStyle: lineStyle
@@ -57,11 +72,16 @@ function getOption(xAxisData, seriesData) {
57 72
       },
58 73
       type: 'value'
59 74
     },
75
+    // dataZoom: [
76
+    //   {
77
+    //     show: true,
78
+    //   }
79
+    // ],
60 80
     grid: {
61 81
       top: 20,
62 82
       left: 50,
63 83
       right: 20,
64
-      bottom: 50,
84
+      bottom: 100,
65 85
     },
66 86
     series: [
67 87
       {

+ 2
- 1
src/pages/statis/components/style.module.less 查看文件

@@ -14,17 +14,18 @@
14 14
 
15 15
   dt {
16 16
     font-size: 36px;
17
+    line-height: 55px;
17 18
   }
18 19
 
19 20
   dd {
20 21
     font-size: 16px;
22
+    line-height: 1.53846;
21 23
   }
22 24
 
23 25
   dt, dd {
24 26
     padding: 0;
25 27
     font-weight: 400;
26 28
     color: rgb(255, 255, 255);
27
-    line-height: 1.53846;
28 29
   }
29 30
 
30 31
   img {

+ 13
- 3
src/routes/routes.jsx 查看文件

@@ -18,6 +18,8 @@ import BasicTable from '@/pages/sample/table';
18 18
 import GuaranteeTaskList from '@/pages/guaranteeTask';
19 19
 import GuaranteeTaskEdit from '@/pages/guaranteeTask/Edit';
20 20
 import GuaranteeTaskPrint from '@/pages/guaranteeTask/print';
21
+import GuaranteeTaskEvaluate from "@/pages/evaluate";
22
+import GuaranteeTaskEvaluateList from "@/pages/evaluate/evaluateList";
21 23
 import DishList from '@/pages/dish/list';
22 24
 import DishEdit from '@/pages/dish/edit';
23 25
 import PackageList from '@/pages/package/List';
@@ -77,7 +79,7 @@ export const authRoutes = [
77 79
         path: "guaranteeTask",
78 80
         element: <GuaranteeTaskList />,
79 81
         meta: {
80
-          title: "军供通报",
82
+          title: "任务通报",
81 83
         },
82 84
       },
83 85
       {
@@ -98,10 +100,18 @@ export const authRoutes = [
98 100
         },
99 101
       },
100 102
       {
101
-        path: "guaranteeTask/print",
102
-        element: <GuaranteeTaskPrint />,
103
+        path: "evaluate",
104
+        element: <GuaranteeTaskEvaluate />,
105
+        meta: {
106
+          title: "任务评价",
107
+        },
108
+      },
109
+      {
110
+        path: "evaluate/list",
111
+        element: <GuaranteeTaskEvaluateList />,
103 112
         meta: {
104 113
           title: "任务评价",
114
+          hideInMenu: true,
105 115
         },
106 116
       },
107 117
     ],

+ 21
- 0
src/services/evaluate.js 查看文件

@@ -0,0 +1,21 @@
1
+import { restful } from "@/utils/request";
2
+
3
+/**
4
+ * 构造 Service
5
+ * @returns
6
+ */
7
+const [
8
+  getEvaluateList,
9
+  geEvaluateDetail,
10
+  saveEvaluate,
11
+  updateEvaluate,
12
+  deleteEvaluate,
13
+] = restful("/evaluate");
14
+
15
+export {
16
+  getEvaluateList,
17
+  geEvaluateDetail,
18
+  saveEvaluate,
19
+  updateEvaluate,
20
+  deleteEvaluate,
21
+};

+ 5
- 0
src/services/statis.js 查看文件

@@ -0,0 +1,5 @@
1
+import request from '@/utils/request';
2
+
3
+export const getSummary = () => request('/statis/summary', { successTip: false });
4
+
5
+export const getTaskInfo = (params) => request('/statis/taskInfo', { params, successTip: false });