This commit is contained in:
PC-202306242200\Administrator
2024-09-19 18:28:02 +08:00
parent 9ea99f1dda
commit 2081393a33
39 changed files with 821 additions and 194 deletions

View File

@@ -77,11 +77,20 @@ export default defineConfig({
* @name layout 插件 * @name layout 插件
* @doc https://umijs.org/docs/max/layout-menu * @doc https://umijs.org/docs/max/layout-menu
*/ */
title: '云充电管理后台', title: '广东星动',
layout: { layout: {
locale: false, locale: false,
...defaultSettings, ...defaultSettings,
}, },
define: {
'process.env': {
// API_URL: "https://iadminapi.zhongshuai2023.com",
API_URL: "http://192.168.1.54:1002",
WS_URL: "ws://lv.com",
STATIC_URL: "http://lv.com",
WEMAP_KEY: 'ZFDBZ-YUTWB-353UZ-NYKEY-JTVIZ-Q3F6X'
}
},
/** /**
* @name moment2dayjs 插件 * @name moment2dayjs 插件
* @description 将项目中的 moment 替换为 dayjs * @description 将项目中的 moment 替换为 dayjs

View File

@@ -77,14 +77,14 @@ export default defineConfig({
* @name layout 插件 * @name layout 插件
* @doc https://umijs.org/docs/max/layout-menu * @doc https://umijs.org/docs/max/layout-menu
*/ */
title: '云充电管理后台', title: '广东星动',
layout: { layout: {
locale: false, locale: false,
...defaultSettings, ...defaultSettings,
}, },
define: { define: {
'process.env': { 'process.env': {
API_URL: "https://iadminapi.zhongshuai2023.com", API_URL: "http://guangdongapp.zhongshuai2023.com",
// API_URL: "http://192.168.1.32:1002", // API_URL: "http://192.168.1.32:1002",
WS_URL: "ws://lv.com", WS_URL: "ws://lv.com",
STATIC_URL: "http://lv.com", STATIC_URL: "http://lv.com",

View File

@@ -15,7 +15,7 @@ const Settings: ProLayoutProps & {
fixedHeader: false, fixedHeader: false,
fixSiderbar: true, fixSiderbar: true,
colorWeak: false, colorWeak: false,
title: '云充电管理后台', title: '广东星动管理后台',
pwa: true, pwa: true,
logo: false, logo: false,
iconfontUrl: '', iconfontUrl: '',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

6
dist/index.html vendored
View File

@@ -2,12 +2,12 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>云充电管理后台</title> <title>广东星动</title>
<link rel="stylesheet" href="/umi.77a65f21.css"> <link rel="stylesheet" href="/umi.d4b01ce4.css">
<script async="" src="/scripts/loading.js"></script> <script async="" src="/scripts/loading.js"></script>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="/umi.3c917597.js"></script> <script src="/umi.5de21d31.js"></script>
</body></html> </body></html>

View File

@@ -0,0 +1 @@
(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[7579],{3891:function(){}}]);

View File

@@ -1 +0,0 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[5351],{986:function(I,c,e){e.r(c),e.d(c,{default:function(){return C}});var h=e(90228),s=e.n(h),p=e(87999),v=e.n(p),g=e(7485);function y(o){return u.apply(this,arguments)}function u(){return u=v()(s()().mark(function o(d){return s()().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,g.request)("/api/device/amount/page",{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8"},data:d||{}}));case 1:case"end":return a.stop()}},o)})),u.apply(this,arguments)}var T=e(50959),x=e(16030),R=e(35384),l=e(11527),j=function(){var d=(0,T.useRef)(),f=[{title:"ID",dataIndex:"id",valueType:"text",search:!1},{title:"\u670D\u52A1\u8D39\u91D1\u989D",dataIndex:"amout",valueType:"text",search:!1},{title:"\u670D\u52A1\u8D39\u4EA7\u751F\u65E5\u671F",dataIndex:"incomeDay",valueType:"dateRange",render:function(n,r){return r==null?void 0:r.incomeDay},search:{transform:function(n){return{incomeDayBegin:n[0],incomeDayEnd:n[1]}}}},{title:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createTime",valueType:"text",search:!1}];return(0,l.jsx)(x._z,{children:(0,l.jsx)("div",{style:{width:"100%",float:"right"},children:(0,l.jsx)(R.Z,{actionRef:d,rowKey:"id",search:{labelWidth:120},request:function(){var a=v()(s()().mark(function n(r,D,L){var m,t;return s()().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,y(r);case 2:return m=i.sent,t=m.data,i.abrupt("return",{data:(t==null?void 0:t.records)||[],total:t==null?void 0:t.total});case 5:case"end":return i.stop()}},n)}));return function(n,r,D){return a.apply(this,arguments)}}(),columns:f},"logList")})})},C=j}}]);

View File

@@ -0,0 +1 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[5351],{80971:function(P,f,t){t.r(f);var y=t(90228),a=t.n(y),v=t(87999),i=t.n(v),s=t(19451),D=t(50959),l=t(16030),E=t(35384),u=t(11527),T=function(){var g=(0,D.useRef)(),c=[{title:"ID",dataIndex:"id",valueType:"text",search:!1},{title:"\u670D\u52A1\u8D39\u91D1\u989D",dataIndex:"amout",valueType:"text",search:!1},{title:"\u670D\u52A1\u8D39\u4EA7\u751F\u65E5\u671F",dataIndex:"incomeDay",valueType:"dateRange",render:function(_,n){return n==null?void 0:n.incomeDay},search:{transform:function(_){return{incomeDayBegin:_[0],incomeDayEnd:_[1]}}}},{title:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createTime",valueType:"text",search:!1}];return(0,u.jsx)(l._z,{children:(0,u.jsx)("div",{style:{width:"100%",float:"right"},children:(0,u.jsx)(E.Z,{actionRef:g,rowKey:"id",search:{labelWidth:120},request:function(){var m=i()(a()().mark(function _(n,r,p){var e,d;return a()().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,(0,s.ow)(n);case 2:return e=o.sent,d=e.data,o.abrupt("return",{data:(d==null?void 0:d.records)||[],total:d==null?void 0:d.total});case 5:case"end":return o.stop()}},_)}));return function(_,n,r){return m.apply(this,arguments)}}(),columns:c},"logList")})})};f.default=T},19451:function(P,f,t){t.d(f,{In:function(){return T},UG:function(){return g},ju:function(){return m},ow:function(){return D},s4:function(){return E}});var y=t(90228),a=t.n(y),v=t(87999),i=t.n(v),s=t(7485);function D(n){return l.apply(this,arguments)}function l(){return l=i()(a()().mark(function n(r){return a()().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,s.request)("/api/device/amount/page",{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8"},data:r||{}}));case 1:case"end":return e.stop()}},n)})),l.apply(this,arguments)}function E(n){return u.apply(this,arguments)}function u(){return u=i()(a()().mark(function n(r){return a()().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,s.request)("/device/subsidy/config/findList",{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8"},data:r||{}}));case 1:case"end":return e.stop()}},n)})),u.apply(this,arguments)}function T(n){return h.apply(this,arguments)}function h(){return h=i()(a()().mark(function n(r){return a()().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,s.request)("/device/subsidy/config/update",{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8"},data:r||{}}));case 1:case"end":return e.stop()}},n)})),h.apply(this,arguments)}function g(n){return c.apply(this,arguments)}function c(){return c=i()(a()().mark(function n(r){return a()().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,s.request)("/device/subsidy/config/deleteBatchByIds",{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8"},data:r||{}}));case 1:case"end":return e.stop()}},n)})),c.apply(this,arguments)}function m(n){return _.apply(this,arguments)}function _(){return _=i()(a()().mark(function n(r){return a()().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,s.request)("/device/subsidy/config/add",{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8"},data:r||{}}));case 1:case"end":return e.stop()}},n)})),_.apply(this,arguments)}}}]);

View File

@@ -0,0 +1 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[542],{35748:function(x,a,_){var o=_(35361),s=_(56929),i=_(50959),u=_(20734),m=_(11527),E=["fieldProps","min","proFieldProps","max"],D=function(t,P){var r=t.fieldProps,A=t.min,e=t.proFieldProps,h=t.max,c=(0,s.Z)(t,E);return(0,m.jsx)(u.Z,(0,o.Z)({valueType:"digit",fieldProps:(0,o.Z)({min:A,max:h},r),ref:P,filedConfig:{defaultProps:{width:"100%"}},proFieldProps:e},c))},n=i.forwardRef(D);a.Z=n},39687:function(x,a,_){_.r(a);var o=_(90228),s=_.n(o),i=_(87999),u=_.n(i),m=_(48305),E=_.n(m),D=_(50959),n=_(49547),M=_(35748),t=_(50925),P=_(94675),r=_(3598),A=_(7485),e=_(11527),h=function(l){var C=t.Z.useForm(),F=E()(C,1),d=F[0],f=l.values;(0,D.useEffect)(function(){console.log(f,"values"),d.resetFields(),d.setFieldsValue(f)},[d,l]);var R=(0,A.useIntl)(),B=function(){d.submit()},b=function(){l.onCancel()},I=function(){var O=u()(s()().mark(function p(j){return s()().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:l.onSubmit(j);case 1:case"end":return v.stop()}},p)}));return function(j){return O.apply(this,arguments)}}();return(0,e.jsx)(P.Z,{width:640,title:"\u8BBE\u5907\u8865\u8D34",open:l.open,forceRender:!0,destroyOnClose:!0,onOk:B,onCancel:b,children:(0,e.jsxs)(n.A,{form:d,submitter:!1,layout:"horizontal",onFinish:I,children:[(0,e.jsx)(M.Z,{name:"id",label:"ID",disabled:!0,hidden:!0}),(0,e.jsxs)(n.A.Group,{children:[(0,e.jsx)(n.A.Item,{label:"\u8BBE\u5907\u7C7B\u578B",name:"deviceType",children:(0,e.jsx)(r.Z,{addonAfter:"W",style:{width:150}})}),(0,e.jsx)(n.A.Item,{label:"\u8865\u8D34\u91D1\u989D",name:"amount",children:(0,e.jsx)(r.Z,{addonBefore:"\uFFE5",style:{width:150}})})]}),(0,e.jsxs)(n.A.Group,{children:[(0,e.jsx)(n.A.Item,{label:"\u4E0A\u4E0B\u6D6E\u52A8\u6BD4\u4F8B",name:"earingsFloat",children:(0,e.jsx)(r.Z,{addonAfter:"%",style:{width:150}})}),(0,e.jsx)(n.A.Item,{label:"\u57FA\u7840\u6536\u5165\u670D\u52A1\u8D39",name:"baseAmount",children:(0,e.jsx)(r.Z,{style:{width:150}})}),(0,e.jsx)(n.A.Item,{label:"\u4EA4\u4ED8\u65F6\u95F4",name:"deliverDate",children:(0,e.jsx)(r.Z,{addonAfter:"\u5929",style:{width:150}})})]})]})})};a.default=h}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[3342],{35748:function(R,a,_){var l=_(35361),d=_(56929),s=_(50959),i=_(20734),m=_(11527),u=["fieldProps","min","proFieldProps","max"],E=function(n,P){var D=n.fieldProps,O=n.min,M=n.proFieldProps,e=n.max,v=(0,d.Z)(n,u);return(0,m.jsx)(i.Z,(0,l.Z)({valueType:"digit",fieldProps:(0,l.Z)({min:O,max:e},D),ref:P,filedConfig:{defaultProps:{width:"100%"}},proFieldProps:M},v))},o=s.forwardRef(E);a.Z=o},20859:function(R,a,_){_.r(a);var l=_(90228),d=_.n(l),s=_(87999),i=_.n(s),m=_(48305),u=_.n(m),E=_(50959),o=_(49547),c=_(35748),n=_(19014),P=_(50925),D=_(94675),O=_(3598),M=_(7485),e=_(11527),v=function(r){var j=P.Z.useForm(),F=u()(j,1),t=F[0],A=r.values;(0,E.useEffect)(function(){console.log(A,"values"),t.resetFields(),t.setFieldsValue(A)},[t,r]);var B=(0,M.useIntl)(),T=function(){t.submit()},I=function(){r.onCancel()},x=function(){var p=i()(d()().mark(function f(C){return d()().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:r.onSubmit(C);case 1:case"end":return h.stop()}},f)}));return function(C){return p.apply(this,arguments)}}();return(0,e.jsx)(D.Z,{width:640,title:"\u8F6E\u64AD\u56FE",open:r.open,forceRender:!0,destroyOnClose:!0,onOk:T,onCancel:I,children:(0,e.jsxs)(o.A,{form:t,submitter:!1,layout:"horizontal",onFinish:x,children:[(0,e.jsx)(c.Z,{name:"id",label:"ID",disabled:!0,hidden:!0}),(0,e.jsx)(o.A.Group,{children:(0,e.jsx)(n.Z,{name:"name",label:"\u540D\u79F0",placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"})}),(0,e.jsx)(o.A.Group,{children:(0,e.jsx)(o.A.Item,{label:"\u6392\u5E8F",name:"sort",children:(0,e.jsx)(O.Z,{style:{width:200}})})})]})})};a.default=v}}]); "use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[3342],{35748:function(R,a,_){var l=_(35361),d=_(56929),s=_(50959),i=_(20734),m=_(11527),u=["fieldProps","min","proFieldProps","max"],E=function(n,P){var D=n.fieldProps,O=n.min,M=n.proFieldProps,e=n.max,v=(0,d.Z)(n,u);return(0,m.jsx)(i.Z,(0,l.Z)({valueType:"digit",fieldProps:(0,l.Z)({min:O,max:e},D),ref:P,filedConfig:{defaultProps:{width:"100%"}},proFieldProps:M},v))},o=s.forwardRef(E);a.Z=o},20859:function(R,a,_){_.r(a);var l=_(90228),d=_.n(l),s=_(87999),i=_.n(s),m=_(48305),u=_.n(m),E=_(50959),o=_(49547),c=_(35748),n=_(19014),P=_(50925),D=_(94675),O=_(3598),M=_(7485),e=_(11527),v=function(r){var j=P.Z.useForm(),F=u()(j,1),t=F[0],A=r.values;(0,E.useEffect)(function(){console.log(A,"values"),t.resetFields(),t.setFieldsValue(A)},[t,r]);var B=(0,M.useIntl)(),T=function(){t.submit()},I=function(){r.onCancel()},x=function(){var p=i()(d()().mark(function f(C){return d()().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:r.onSubmit(C);case 1:case"end":return h.stop()}},f)}));return function(C){return p.apply(this,arguments)}}();return(0,e.jsx)(D.Z,{width:640,title:"\u516C\u544A\u5206\u7C7B",open:r.open,forceRender:!0,destroyOnClose:!0,onOk:T,onCancel:I,children:(0,e.jsxs)(o.A,{form:t,submitter:!1,layout:"horizontal",onFinish:x,children:[(0,e.jsx)(c.Z,{name:"id",label:"ID",disabled:!0,hidden:!0}),(0,e.jsx)(o.A.Group,{children:(0,e.jsx)(n.Z,{name:"name",label:"\u540D\u79F0",placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"})}),(0,e.jsx)(o.A.Group,{children:(0,e.jsx)(o.A.Item,{label:"\u6392\u5E8F",name:"sort",children:(0,e.jsx)(O.Z,{style:{width:200}})})})]})})};a.default=v}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -86,7 +86,7 @@ export default (props: any) => {
"fixedHeader": false, "fixedHeader": false,
"fixSiderbar": true, "fixSiderbar": true,
"colorWeak": false, "colorWeak": false,
"title": "云充电管理后台", "title": "广东星动管理后台",
"pwa": true, "pwa": true,
"logo": false, "logo": false,
"iconfontUrl": "", "iconfontUrl": "",

View File

@@ -214,6 +214,10 @@
display: block display: block
} }
.inline-block {
display: inline-block
}
.flex { .flex {
display: -webkit-box; display: -webkit-box;
display: -ms-flexbox; display: -ms-flexbox;

File diff suppressed because one or more lines are too long

View File

@@ -86,7 +86,7 @@ export default (props: any) => {
"fixedHeader": false, "fixedHeader": false,
"fixSiderbar": true, "fixSiderbar": true,
"colorWeak": false, "colorWeak": false,
"title": "云充电管理后台", "title": "广东星动管理后台",
"pwa": true, "pwa": true,
"logo": false, "logo": false,
"iconfontUrl": "", "iconfontUrl": "",

View File

@@ -8,12 +8,12 @@ const Footer: React.FC = () => {
style={{ style={{
background: 'none', background: 'none',
}} }}
copyright="Powered by Ant Desgin" copyright="中帅新能源"
links={[ links={[
{ {
key: 'Ant Design Pro', key: 'Ant Design Pro',
title: '云充电管理后台', title: '中帅新能源提供技术支持',
href: 'https://pro.ant.design', href: '',
blankTarget: true, blankTarget: true,
}, },
// { // {

View File

View File

@@ -0,0 +1,97 @@
import React, { useEffect, useState } from 'react';
import {
ProForm,
ProFormDigit,
ProFormText,
ProFormSwitch,
ProFormSelect
} from '@ant-design/pro-components';
import { Form, Modal, InputNumber } from 'antd';
import { useIntl } from '@umijs/max';
import FilesManager from '@/components/FilesManage/index';
const RoleForm: React.FC = (props: any) => {
const [form] = Form.useForm();
const { values } = props;
useEffect(() => {
console.log(values, 'values');
form.resetFields();
form.setFieldsValue(values);
}, [form, props]);
const intl = useIntl();
const handleOk = () => {
form.submit();
};
const handleCancel = () => {
props.onCancel();
};
const handleFinish = async (values: any) => {
props.onSubmit(values);
};
return (
<Modal
width={640}
title={'设备补贴'}
open={props.open}
forceRender
destroyOnClose
onOk={handleOk}
onCancel={handleCancel}
>
<ProForm
form={form}
submitter={false}
layout="horizontal"
onFinish={handleFinish}>
<ProFormDigit
name="id"
label={'ID'}
disabled
hidden={true}
/>
<ProForm.Group>
<ProForm.Item
label="设备类型"
name={'deviceType'}
>
<InputNumber addonAfter="W" style={{ width: 150 }} />
</ProForm.Item>
<ProForm.Item
label="补贴金额"
name={'amount'}
>
<InputNumber addonBefore="¥" style={{ width: 150 }} />
</ProForm.Item>
</ProForm.Group>
<ProForm.Group>
<ProForm.Item
label="上下浮动比例"
name={'earingsFloat'}
>
<InputNumber addonAfter="%" style={{ width: 150 }} />
</ProForm.Item>
<ProForm.Item
label="基础收入服务费"
name={'baseAmount'}
>
<InputNumber style={{ width: 150 }} />
</ProForm.Item>
<ProForm.Item
label="交付时间"
name={'deliverDate'}
>
<InputNumber addonAfter="天" style={{ width: 150 }} />
</ProForm.Item>
</ProForm.Group>
</ProForm>
</Modal>
);
};
export default RoleForm;

View File

@@ -0,0 +1,187 @@
import { findList, configUpdate, configAdd, configDeleteBatchByIds } from '@/services/facility/index';
import React, { useRef, useEffect, useState } from 'react';
import { useIntl, useAccess } from '@umijs/max';
import { message, Tag, Select, Button, Modal } from 'antd';
import { ActionType, PageContainer, ProTable } from '@ant-design/pro-components';
import UpdateForm from './edit';
const LogTableList: React.FC = () => {
const actionRef = useRef<ActionType>();
const [modalVisible, setModalVisible] = useState<boolean>(false);
const [currentRow, setCurrentRow] = useState();
const columns = [
{
title: 'ID',
dataIndex: 'id',
valueType: 'text',
search: false,
},
{
title: '设备类型',
dataIndex: 'deviceType',
valueType: 'text',
render: (_, record) => {
return record?.deviceType + 'W'
},
// renderFormItem: (
// _,
// { type, defaultRender, formItemProps, fieldProps, ...rest },
// form,
// ) => {
// const statusMap = [
// { label: '7W', value: 7 },
// { label: '20W', value: 20 },
// { label: '30W', value: 30 },
// ]
// return <Select
// {...fieldProps}
// allowClear
// style={{ width: "100%" }}
// filterOption={false}
// fieldNames={{
// label: "label",
// value: "value"
// }}
// options={statusMap}
// />
// },
},
{
title: '补贴金额',
dataIndex: 'amount',
valueType: 'text',
search: false,
},
{
title: '上下浮动比例',
dataIndex: 'earingsFloat',
valueType: 'text',
search: true,
},
{
title: '基础收入服务费',
dataIndex: 'baseAmount',
valueType: 'text',
search: false,
},
{
title: '交付时间',
dataIndex: 'deliverDate',
valueType: 'text',
search: false,
},
{
title: '创建时间',
dataIndex: 'createTime',
valueType: 'text',
search: false,
},
{
title: '操作',
dataIndex: 'option',
width: '220px',
valueType: 'option',
render: (_, record) => [
<Button
type="link"
size="small"
onClick={() => {
setModalVisible(true);
setCurrentRow(record);
}}
>
</Button>,
<Button
type="link"
size="small"
danger
// hidden={!access.hasPerms('admin:banner:update')}
onClick={async () => {
Modal.confirm({
title: '删除',
content: '确定删除该项吗?',
okText: '确认',
cancelText: '取消',
onOk: async () => {
const success = await configDeleteBatchByIds([record.id]);
if (success) {
if (actionRef.current) {
actionRef.current.reload();
}
}
},
});
}}
>
</Button>,
],
},
];
return (
<PageContainer>
<div style={{ width: '100%', float: 'right' }}>
<ProTable
actionRef={actionRef}
rowKey="id"
key="logList"
search={{
labelWidth: 120,
}}
toolBarRender={() => [
<Button
type="primary"
key="add"
onClick={async () => {
setCurrentRow(undefined);
setModalVisible(true);
}}
>
</Button>
]}
request={async (params, sorter, filter) => {
let { data } = await findList(params)
return {
data: data || [],
total: data.length,
};
}}
columns={columns}
/>
</div>
<UpdateForm
onSubmit={async (values) => {
let success = false;
if (values.id) {
success = await configUpdate({ ...values });
} else {
success = await configAdd({ ...values });
}
if (success) {
setModalVisible(false);
setCurrentRow(undefined);
if (actionRef.current) {
actionRef.current.reload();
}
}
}}
onCancel={() => {
setModalVisible(false);
setCurrentRow(undefined);
}}
open={modalVisible}
values={currentRow || {}}
/>
</PageContainer>
);
};
export default LogTableList;

123
src/pages/home/index.tsx Normal file
View File

@@ -0,0 +1,123 @@
import React, { useState, useEffect } from 'react';
import { PageContainer, ProTable } from '@ant-design/pro-components';
import { Card, Col, Row, Statistic, Divider, Tag, Image } from 'antd';
import { ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons';
export default () => {
const [deviceData, setDeviceData] = useState([]);
const [profit, setProfit] = useState([]);
const [shop, setShop] = useState([]);
const deviceConfig = {
data: deviceData,
xField: 'name',
yField: 'value',
seriesField: 'category',
xAxis: {
type: 'time',
},
yAxis: {
label: {
// 数值格式化为千分位
formatter: (v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`),
},
},
};
useEffect(() => {
}, []);
return (
<>
<Divider></Divider>
<Row gutter={10}>
<Col span={6}>
<Card>
<Statistic
title="今日充电"
value={profit?.device_count?.today}
precision={2}
prefix="¥"
/>
</Card>
</Col>
<Col span={6}>
<Card>
<Statistic
title="昨日充电"
value={profit?.device_count?.yesterday}
precision={2}
prefix="¥"
/>
</Card>
</Col>
<Col span={6}>
<Card>
<Statistic
title="上周充电"
value={profit?.device_count?.week}
precision={2}
prefix="¥"
/>
</Card>
</Col>
<Col span={6}>
<Card>
<Statistic
title="上月充电"
value={profit?.device_count?.month}
precision={2}
prefix="¥"
/>
</Card>
</Col>
</Row>
<Divider></Divider>
<Row gutter={10}>
<Col span={6}>
<Card>
<Statistic
title="今天成交"
value={profit?.shop_count?.today}
precision={2}
prefix="¥"
/>
</Card>
</Col>
<Col span={6}>
<Card>
<Statistic
title="昨天成交"
value={profit?.shop_count?.yesterday}
precision={2}
prefix="¥"
/>
</Card>
</Col>
<Col span={6}>
<Card>
<Statistic
title="上周成交"
value={profit?.shop_count?.week}
precision={2}
prefix="¥"
/>
</Card>
</Col>
<Col span={6}>
<Card>
<Statistic
title="上月成交"
value={profit?.shop_count?.month}
precision={2}
prefix="¥"
/>
</Card>
</Col>
</Row>
{/* <Divider>商城(商品数量/金额)-折线图</Divider> */}
</>
);
};

View File

@@ -35,7 +35,7 @@ const RoleForm: React.FC = (props: any) => {
return ( return (
<Modal <Modal
width={640} width={640}
title={'轮播图'} title={'公告分类'}
open={props.open} open={props.open}
forceRender forceRender
destroyOnClose destroyOnClose

View File

@@ -3,7 +3,7 @@ import { logPage } from '@/services/system/log';
import React, { useRef, useEffect } from 'react'; import React, { useRef, useEffect } from 'react';
import { useIntl, useAccess } from '@umijs/max'; import { useIntl, useAccess } from '@umijs/max';
import { message, Tag } from 'antd'; import { message, Tag, Select, Tooltip } from 'antd';
import { ActionType, PageContainer, ProTable } from '@ant-design/pro-components'; import { ActionType, PageContainer, ProTable } from '@ant-design/pro-components';
@@ -23,7 +23,7 @@ const LogTableList: React.FC = () => {
title: '标题', title: '标题',
dataIndex: 'title', dataIndex: 'title',
valueType: 'text', valueType: 'text',
search: false, search: true,
}, },
{ {
title: '类型', title: '类型',
@@ -31,27 +31,78 @@ const LogTableList: React.FC = () => {
valueType: 'text', valueType: 'text',
search: false, search: false,
render: (_: any, record: any) => { render: (_: any, record: any) => {
let color = record.businessType == 1 ? 'volcano' : record.businessType == 2 ? 'orange' : 'red' let color = record.businessType == 1 ? 'purple' : record.businessType == 2 ? 'blue' : record.businessType == 3 ? 'magenta' : 'red'
return <Tag color={color}>{record.businessType}</Tag> let statusMap = [
} { label: '其它', value: 0 },
{ label: '新增', value: 1 },
{ label: '修改', value: 2 },
{ label: '删除', value: 3 },
]
return <Tag color={color}>{statusMap.find((val) => val.value == record.businessType)?.label}</Tag>
},
// 0其它 1新增 2修改 3删除
// renderFormItem: (
// _,
// { type, defaultRender, formItemProps, fieldProps, ...rest },
// form,
// ) => {
// const statusMap = [
// { label: '其它', value: 0 },
// { label: '新增', value: 1 },
// { label: '修改', value: 2 },
// { label: '删除', value: 3 },
// ]
// return <Select
// {...fieldProps}
// allowClear
// style={{ width: "100%" }}
// filterOption={false}
// fieldNames={{
// label: "label",
// value: "value"
// }}
// options={statusMap}
// />
// },
}, },
{ {
title: '方法', title: '方法',
dataIndex: 'method', dataIndex: 'method',
valueType: 'text', valueType: 'text',
search: false, search: true,
render: (data) => {
return (
<div className="ellipsis" style={{
float: 'left',
maxWidth: '100px',
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
}} title={data}>
<Tooltip placement="topLeft" title={data}>{data}</Tooltip>
</div>
)
},
}, },
{ {
title: '请求方式', title: '请求方式',
dataIndex: 'requestMethod', dataIndex: 'requestMethod',
valueType: 'text', valueType: 'text',
search: false, search: true,
}, },
{ {
title: '操作类别', title: '操作类别',
dataIndex: 'operatorType', dataIndex: 'operatorType',
valueType: 'text', valueType: 'text',
search: false, search: false,
render: (_: any, record: any) => {
let statusMap = [
{ label: '其它', value: 0 },
{ label: '后台用户', value: 1 },
{ label: '手机端用户', value: 2 },
]
return statusMap.find((val) => val.value == record.operatorType)?.label
},
}, },
{ {
title: '操作人员', title: '操作人员',
@@ -64,6 +115,19 @@ const LogTableList: React.FC = () => {
dataIndex: 'operUrl', dataIndex: 'operUrl',
valueType: 'text', valueType: 'text',
search: false, search: false,
render: (data) => {
return (
<div className="ellipsis" style={{
float: 'left',
maxWidth: '100px',
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
}} title={data}>
<Tooltip placement="topLeft" title={data}>{data}</Tooltip>
</div>
)
},
}, },
{ {
@@ -71,36 +135,105 @@ const LogTableList: React.FC = () => {
dataIndex: 'operIp', dataIndex: 'operIp',
valueType: 'text', valueType: 'text',
search: false, search: false,
render: (data) => {
return (
<div className="ellipsis" style={{
float: 'left',
maxWidth: '100px',
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
}} title={data}>
<Tooltip placement="topLeft" title={data}>{data}</Tooltip>
</div>
)
},
}, },
{ {
title: '操作地点', title: '操作地点',
dataIndex: 'operLocation', dataIndex: 'operLocation',
valueType: 'text', valueType: 'text',
search: false, search: false,
render: (data) => {
return (
<div className="ellipsis" style={{
float: 'left',
maxWidth: '100px',
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
}} title={data}>
<Tooltip placement="topLeft" title={data}>{data}</Tooltip>
</div>
)
},
}, },
{ {
title: '请求参数', title: '请求参数',
dataIndex: 'operParam', dataIndex: 'operParam',
valueType: 'text', valueType: 'text',
search: false, search: false,
render: (data) => {
return (
<div className="ellipsis" style={{
float: 'left',
maxWidth: '100px',
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
}} title={data}>
<Tooltip placement="topLeft" title={data}>{data}</Tooltip>
</div>
)
},
}, },
{ {
title: '返回参数', title: '返回参数',
dataIndex: 'jsonResult', dataIndex: 'jsonResult',
valueType: 'text', valueType: 'text',
search: false, search: false,
render: (data) => {
return (
<div className="ellipsis" style={{
float: 'left',
maxWidth: '100px',
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
}} title={data}>
<Tooltip placement="topLeft" title={data}>{data}</Tooltip>
</div>
)
},
}, },
{ {
title: '状态', title: '状态',
dataIndex: 'status', dataIndex: 'status',
valueType: 'text', valueType: 'text',
search: false, search: false,
render: (_: any, record: any) => {
let color = record.status == 0 ? 'green' : 'red'
return <Tag color={color}>{record.status == 0 ? '正常' : '异常'}</Tag>
},
}, },
{ {
title: '错误消息', title: '错误消息',
dataIndex: 'errorMsg', dataIndex: 'errorMsg',
valueType: 'text', valueType: 'text',
search: false, search: false,
render: (data) => {
return (
<div className="ellipsis" style={{
float: 'left',
maxWidth: '100px',
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
}} title={data}>
<Tooltip placement="topLeft" title={data}>{data}</Tooltip>
</div>
)
},
}, },
{ {
title: '操作时间', title: '操作时间',

View File

@@ -1,23 +1,17 @@
import { Footer } from '@/components'; import { Footer } from '@/components';
import { login } from '@/services/user/index'; import { login, validateCode } from '@/services/user/index';
import { import {
AlipayCircleOutlined,
LockOutlined, LockOutlined,
MobileOutlined,
TaobaoCircleOutlined,
UserOutlined, UserOutlined,
WeiboCircleOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { import {
LoginForm, LoginForm,
ProFormCaptcha,
ProFormCheckbox,
ProFormText, ProFormText,
} from '@ant-design/pro-components'; } from '@ant-design/pro-components';
import { FormattedMessage, Helmet, SelectLang, useIntl, useModel } from '@umijs/max'; import { FormattedMessage, Helmet, useIntl, useModel } from '@umijs/max';
import { Alert, message, Tabs } from 'antd'; import { message, Row, Col, Image } from 'antd';
import { createStyles } from 'antd-style'; import { createStyles } from 'antd-style';
import React, { useState } from 'react'; import React, { useState, useEffect } from 'react';
import { flushSync } from 'react-dom'; import { flushSync } from 'react-dom';
import Settings from '../../../../config/defaultSettings'; import Settings from '../../../../config/defaultSettings';
import "./index.css"; import "./index.css";
@@ -58,48 +52,24 @@ const useStyles = createStyles(({ token }) => {
}; };
}); });
const ActionIcons = () => {
const { styles } = useStyles();
return (
<>
<AlipayCircleOutlined key="AlipayCircleOutlined" className={styles.action} />
<TaobaoCircleOutlined key="TaobaoCircleOutlined" className={styles.action} />
<WeiboCircleOutlined key="WeiboCircleOutlined" className={styles.action} />
</>
);
};
const Lang = () => {
const { styles } = useStyles();
return (
<div className={styles.lang} data-lang>
{SelectLang && <SelectLang />}
</div>
);
};
const LoginMessage: React.FC<{
content: string;
}> = ({ content }) => {
return (
<Alert
style={{
marginBottom: 24,
}}
message={content}
type="error"
showIcon
/>
);
};
const Login: React.FC = () => { const Login: React.FC = () => {
const [userLoginState, setUserLoginState] = useState<API.LoginResult>({});
const { initialState, setInitialState } = useModel('@@initialState'); const { initialState, setInitialState } = useModel('@@initialState');
const { styles } = useStyles(); const { styles } = useStyles();
const intl = useIntl(); const intl = useIntl();
const [captchaCode, setCaptchaCode] = useState<string>('');
const [uuid, setUuid] = useState<string>('');
const getCaptchaCode = async () => {
const { data } = await validateCode();
const imgdata = `data:image/png;base64,${data.img}`;
setCaptchaCode(imgdata);
setUuid(data.uuid);
};
const fetchUserInfo = async () => { const fetchUserInfo = async () => {
const userInfo = await initialState?.fetchUserInfo?.(); const userInfo = await initialState?.fetchUserInfo?.();
@@ -118,26 +88,26 @@ const Login: React.FC = () => {
const handleSubmit = async (values: API.LoginParams) => { const handleSubmit = async (values: API.LoginParams) => {
try { try {
// 登录 // 登录
const msg = await login({ ...values }); const msg = await login({ ...values, uuid });
console.log(msg);
if (msg.success || msg.status == 'ok') { if (msg.success || msg.status == 'ok') {
localStorage.setItem('token', msg.data?.token) localStorage.setItem('token', msg.data?.token)
const defaultLoginSuccessMessage = intl.formatMessage({ const defaultLoginSuccessMessage = '登录成功!';
id: 'pages.login.success',
defaultMessage: '登录成功!',
});
message.success(defaultLoginSuccessMessage); message.success(defaultLoginSuccessMessage);
await fetchUserInfo(); await fetchUserInfo();
const urlParams = new URL(window.location.href).searchParams; const urlParams = new URL(window.location.href).searchParams;
window.location.href = urlParams.get('redirect') || '/'; window.location.href = urlParams.get('redirect') || '/';
return; return;
} }
setUserLoginState(msg);
} catch (error) { } catch (error) {
getCaptchaCode()
} }
}; };
useEffect(() => {
getCaptchaCode();
}, []);
return ( return (
<div className={styles.container}> <div className={styles.container}>
<Helmet> <Helmet>
@@ -161,9 +131,9 @@ const Login: React.FC = () => {
minWidth: 280, minWidth: 280,
maxWidth: '75vw', maxWidth: '75vw',
}} }}
logo={<img alt="logo" src="/logo.svg" />} // logo={<img alt="logo" src="/logo.svg" />}
title="云充电 管理后台" title="广东星动 管理后台"
subTitle={'云充电 管理后台'} subTitle={'广东星动 管理后台'}
initialValues={{ initialValues={{
autoLogin: true, autoLogin: true,
}} }}
@@ -201,6 +171,38 @@ const Login: React.FC = () => {
}, },
]} ]}
/> />
<Row>
<Col flex={3}>
<ProFormText
style={{
float: 'right',
}}
name="code"
placeholder={'请输入验证码'}
rules={[
{
required: true,
message: '请输入验证码',
},
]}
/>
</Col>
<Col flex={2}>
<Image
src={captchaCode}
alt="验证码"
style={{
display: 'inline-block',
verticalAlign: 'top',
cursor: 'pointer',
paddingLeft: '10px',
width: '100px',
}}
preview={false}
onClick={() => getCaptchaCode()}
/>
</Col>
</Row>
</> </>
</LoginForm> </LoginForm>
</div> </div>

View File

@@ -8,4 +8,47 @@ export async function deviceAmountPage(body) {
}, },
data: body || {}, data: body || {},
}); });
} }
export async function findList(body) {
return request('/device/subsidy/config/findList', {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=UTF-8',
},
data: body || {},
});
}
export async function configUpdate(body) {
return request('/device/subsidy/config/update', {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=UTF-8',
},
data: body || {},
});
}
export async function configDeleteBatchByIds(body) {
return request('/device/subsidy/config/deleteBatchByIds', {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=UTF-8',
},
data: body || {},
});
}
export async function configAdd(body) {
return request('/device/subsidy/config/add', {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=UTF-8',
},
data: body || {},
});
}

View File

@@ -2,7 +2,7 @@ import { request } from '@umijs/max';
// 查询菜单权限列表 // 查询菜单权限列表
export async function logPage(body) { export async function logPage(body) {
return request('/api/sys/oper/log/page', { return request('/sys/oper/log/page', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json;charset=UTF-8', 'Content-Type': 'application/json;charset=UTF-8',

View File

@@ -26,4 +26,12 @@ export async function currentUser(options?: {}) {
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}); });
} }
export async function validateCode(options?: {}) {
return request('/sys/validate/code', {
method: 'GET',
...(options || {}),
});
}

View File

@@ -9,6 +9,7 @@ interface Item {
menuType?: string; menuType?: string;
disabledTooltip?: boolean; disabledTooltip?: boolean;
access?: any; access?: any;
orderNum?: number;
} }
@@ -37,6 +38,5 @@ export const childrenRemove = (data: Item[] | undefined): Item[] => {
list.push(i); list.push(i);
} }
}); });
return list.sort((a, b) => (a.orderNum === 0 ? -1 : b.orderNum === 0 ? 1 : a.orderNum - b.orderNum));
return list; // 返回处理后的列表
}; };