From 7af50f0e9e1cfff91a57906bf1c0c962e233a40a Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 26 Oct 2023 22:33:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B4=A2=E5=8A=A1>=E6=96=87=E6=97=85?= =?UTF-8?q?=E5=B1=80=E6=9C=8D=E5=8A=A1=E4=BA=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.jsx | 3 ++ src/mock/2.0/personnum.json | 27 ++++++++++ src/stores/FinancialStore.js | 35 ++++++++++++- src/views/ServicePersonNum.jsx | 96 ++++++++++++++++++++++++++++++++++ 4 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 src/mock/2.0/personnum.json create mode 100644 src/views/ServicePersonNum.jsx diff --git a/src/App.jsx b/src/App.jsx index 7dd8e9c..1109e9b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -39,6 +39,7 @@ import ExchangeRate from './charts/ExchangeRate'; import KPI from './views/KPI'; import Distribution from './views/Distribution'; import Detail from './views/Detail'; +import ServicePersonNum from './views/ServicePersonNum'; const App = () => { const { Content, Footer, Sider } = Layout; @@ -110,6 +111,7 @@ const App = () => { label: 信用卡账单, }, { key: 42, label: 汇率 }, + { key: 'service_person_num', label: 服务人数 }, ], }, { @@ -197,6 +199,7 @@ const App = () => { }> } /> } /> + } /> }> } /> diff --git a/src/mock/2.0/personnum.json b/src/mock/2.0/personnum.json new file mode 100644 index 0000000..0c407e2 --- /dev/null +++ b/src/mock/2.0/personnum.json @@ -0,0 +1,27 @@ +{ + "get|/inbound_person_num/test": { + "errcode": 0, + "errmsg": "", + "data": null, + "loading": null, + "resultTotal": { + "orgz": "@integer(10,99)", + "orgzPDays": "@integer(10,99)", + "hosts": "@integer(10,99)", + "hostsPDays": "@integer(10,99)", + "IndividualService": "@integer(10,99)", + "groupsKey": "0", + "groupsLabel": "总" + }, + "result|10": [ + { + "orgz": "@integer(10,99)", + "orgzPDays": "@integer(10,99)", + "hosts": "@integer(10,99)", + "hostsPDays": "@integer(10,99)", + "groupsKey": "@id", + "groupsLabel": "@region" + } + ] + } +} diff --git a/src/stores/FinancialStore.js b/src/stores/FinancialStore.js index 2557007..476b37a 100644 --- a/src/stores/FinancialStore.js +++ b/src/stores/FinancialStore.js @@ -1,7 +1,7 @@ import {makeAutoObservable, runInAction} from "mobx"; -import * as dd from 'dingtalk-jsapi'; import * as config from "../config"; import * as comm from '../utils/commons'; +import { fetchJSON } from '../utils/request'; // 财务管理 @@ -126,6 +126,39 @@ class FinancialStore { console.log('fetch data failed', error); }); } + + /** + * 服务人数页面 ---- + */ + + servicePersonNum = { curTab: 'inbound', + 'inbound': { loading: false, dataSource: [], total: {} }, + 'outbound': { loading: false, dataSource: [], total: {} }, + 'domestic': { loading: false, dataSource: [], total: {} }, + }; + + setCurTab(v) { + this.servicePersonNum.curTab = v; + } + + /** + * 获取服务人数 + */ + async getPersonNum(queryData) { + this.servicePersonNum[this.servicePersonNum.curTab].loading = true; + const json = await fetchJSON('/inbound_person_num/test', queryData); + if (json.errcode === 0) { + runInAction(() => { + this.servicePersonNum[this.servicePersonNum.curTab].loading = false; + this.servicePersonNum[this.servicePersonNum.curTab].dataSource = [].concat([json.resultTotal], json.result); + this.servicePersonNum[this.servicePersonNum.curTab].total = json.resultTotal; + }); + } + return json; + } + /** + * ---- end 服务人数页面 + */ } diff --git a/src/views/ServicePersonNum.jsx b/src/views/ServicePersonNum.jsx new file mode 100644 index 0000000..0fbd783 --- /dev/null +++ b/src/views/ServicePersonNum.jsx @@ -0,0 +1,96 @@ +import { useContext } from 'react'; +import { observer } from 'mobx-react'; +import { stores_Context } from '../config'; +import { Spin, Table, Row, Col, Tabs } from 'antd'; +import SearchForm from './../components/search/SearchForm'; +import './kpi.css'; + +const apartOptions = [ + { key: 'inbound', value: 'inbound', label: '入境' }, + { key: 'outbound', value: 'outbound', label: '出境' }, + { key: 'domestic', value: 'domestic', label: '国内' }, +]; + +export default observer((props) => { + const { financial_store: financialStore, date_picker_store: searchFormStore } = useContext(stores_Context); + const { formValues, formValuesToSub } = searchFormStore; + const { servicePersonNum } = financialStore; + const { curTab } = servicePersonNum; + + const pageRefresh = (queryData = formValuesToSub) => { + // console.log(queryData, 'qqqq'); + financialStore.getPersonNum(queryData); + }; + + const columns = [ + { title: '名称', dataIndex: 'groupsLabel' }, + { + title: '人次数', + children: [ + { title: '外联', dataIndex: 'orgz' }, + { title: '接待', dataIndex: 'hosts' }, + ], + }, + { + title: '人天', + children: [ + { title: '外联', dataIndex: 'orgzPDays' }, + { title: '接待', dataIndex: 'hostsPDays' }, + ], + }, + ]; + + return ( + <> + + + { + pageRefresh(obj); + }} + /> + + + +
+ { + financialStore.setCurTab(v); + pageRefresh(); + }} + type="card" + items={apartOptions.map((ele) => { + return { + ...ele, + children: ( + + + + ), + }; + })} + /> + + + ); +});