From 30b57fb56f9f45e58f289a3554bc7e259fbfec20 Mon Sep 17 00:00:00 2001 From: lisf Date: Thu, 18 Jan 2024 10:57:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat():=20=E8=BF=9D=E6=B3=95=E8=A7=84?= =?UTF-8?q?=E5=88=99=E9=85=8D=E7=BD=AE=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=BC=96=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NewEnergy/ChargingMgm/BillingRule/loadable.jsx | 3 +- .../ChargingMgm/IllegalRuleConfigMgm/index.jsx | 6 + .../ChargingMgm/IllegalRuleConfigMgm/index.scss | 280 +++++++++++++++ .../ChargingMgm/IllegalRuleConfigMgm/loadable.jsx | 396 +++++++++++++++++++++ .../ChargingMgm/OrderRuleMgm/loadable.jsx | 9 +- src/pages/NewEnergy/ChargingMgm/index.jsx | 5 +- src/router/router.config.js | 6 + src/services/NewEnergy/chargingMgm.js | 12 +- 8 files changed, 708 insertions(+), 9 deletions(-) create mode 100644 src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/index.jsx create mode 100644 src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/index.scss create mode 100644 src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/loadable.jsx diff --git a/src/pages/NewEnergy/ChargingMgm/BillingRule/loadable.jsx b/src/pages/NewEnergy/ChargingMgm/BillingRule/loadable.jsx index a9f38d7..3894a55 100644 --- a/src/pages/NewEnergy/ChargingMgm/BillingRule/loadable.jsx +++ b/src/pages/NewEnergy/ChargingMgm/BillingRule/loadable.jsx @@ -139,7 +139,6 @@ function BillingRule() { // 检索 const search = (params) => { - console.log("params",params); let data = { ...params, type:1 @@ -168,6 +167,7 @@ function BillingRule() { // 处理弹框ok按钮 const handleConfirm = () => { + setDetailVisible(true) if(!modalData?.operator_id){ message.warning("运营商名称不能为空") return @@ -229,7 +229,6 @@ function BillingRule() { }} onOk={() => { handleConfirm() - setDetailVisible(false); }} okText="保存" destroyOnClose diff --git a/src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/index.jsx b/src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/index.jsx new file mode 100644 index 0000000..21aad71 --- /dev/null +++ b/src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/index.jsx @@ -0,0 +1,6 @@ +import React from "react" +import loadable from "@loadable/component" +import { LoadingImg } from "@/components" + +const IllegalRuleConfigMgm = loadable(() => import("./loadable")) +export default (pros) => } /> \ No newline at end of file diff --git a/src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/index.scss b/src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/index.scss new file mode 100644 index 0000000..9a67b18 --- /dev/null +++ b/src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/index.scss @@ -0,0 +1,280 @@ +@import "@/assets/css/mixin.scss"; +$color-container-bg: var(--color-container-bg); +$color-user-list-bg: var(--color-user-list-bg); +$color-text: var(--color-text); +$color-primary: var(--color-primary); + +.ant-tabs { + margin-bottom: 16px; + + .ant-tabs-nav { + margin-bottom: 0 !important; + + &::before { + border-bottom: 1px solid var(--color-card-line) !important; + } + } + + .ant-tabs-nav-wrap { + width: 100%; + box-sizing: content-box; + + .ant-tabs-nav-list { + width: 340px; + + .ant-tabs-ink-bar { + height: 3px; + background-color: #00ccff; + } + + .ant-tabs-tab { + flex: 1; + width: 100%; + display: flex; + justify-content: center; + padding-bottom: 10px; + text-align: center; + cursor: pointer; + font-size: 14px !important; + font-family: MicrosoftYaHei; + text-align: center; + letter-spacing: 0.7px; + } + + .ant-tabs-tab-active { + div { + color: #00ccff; + } + } + } + } +} + +.ant-input::-webkit-input-placeholder { + color: var(--color-placeholder); +} + +.ant-input::-moz-placeholder { + color: var(--color-placeholder); +} +.right-list .ant-btn-primary { + width: 68px; + height: 30px; + background: linear-gradient(180deg, #3aa9ff, #59b7ff); + border-radius: 4px; +} +.ant-input:-ms-input-placeholder { + color: var(--color-placeholder); +} +.right-list .cc-result-flow .table-wrap .yisa-table .ant-table-thead th { + background-color: #616b83 !important; +} +.right-list .cc-result-flow .table-wrap .yisa-table .ant-table-tbody td { + background-color: #3e4557 !important; +} +.right-list .cc-result-flow .table-wrap .yisa-table .ant-table-tbody tr:nth-child(even) td { + background-color: #3e4557 !important; +} +.ant-input::placeholder { + color: var(--color-placeholder); +} + +.ant-select-selection-placeholder { + color: var(--color-placeholder); +} + +.ant-select-disabled.ant-select-single:not(.ant-select-customize-input) .ant-select-selector { + background: var(--color-input-disabled-bg); + color: var(--color-placeholder); +} + +.ant-select-disabled .ant-select-arrow { + color: var(--color-placeholder); +} + +.ant-select-disabled.ant-select:not(.ant-select-customize-input) .ant-select-selector { + background-color: var(--color-input-disabled-bg); + color: var(--color-input-disabled-color); + cursor: not-allowed; +} + +.ant-select-multiple { + .ant-select-selector { + .ant-select-selection-item { + background-color: var(--color-bg-body); + border-color: var(--color-border); + + .ant-select-selection-item-remove { + color: var(--color-text); + } + } + } +} + +.ant-select-arrow { + color: var(--color-text); +} + +.ant-select-clear { + border-radius: 50%; +} + +.ant-select-dropdown-menu { + background-color: var(--color-input-bg); + + .ant-select-dropdown-menu-item { + color: var(--color-text); + + &.ant-select-dropdown-menu-item-active { + color: #fff; + // background-color: var(--radio-button-bg-checked); + } + + &.ant-select-dropdown-menu-item-selected { + color: #fff; + // background-color: var(--radio-button-bg-checked); + } + + &:hover { + color: #fff; + // background-color: var(--radio-button-bg-checked); + } + } +} + +.ant-select-selector { + background-color: var(--color-search-list-item-bg) !important; + box-shadow: none !important; + border-radius: 4px; + color: var(--color-search-list-item-value); + border-color: var(--color-search-list-item-bd) !important; +} + +.ant-select-selection { + background-color: var(--color-input-bg); + box-shadow: none; + color: var(--color-text); + // border-color:var(--checkable-tag-border); +} + +.ant-form-horizontal .ant-form-item-label { + label { + display: inline-block; + word-wrap: break-word; + white-space: normal; + } +} + +.ant-picker { + width: 100%; + background-color: var(--color-search-list-item-bg); + border-color: var(--color-border); +} + + +.totalModal { + .ruleTitle { + font-size: 16px; + font-weight: 700; + color: #ffffff; + } + .ant-modal-content{ + width: 796px; + } + .modal-form{ + margin: 20px 0 0 0; + .yisa-search{ + margin-bottom: 20px; + label{ + color: #eeeff1; + } + .ant-input-textarea-show-count:after{ + position: absolute; + bottom: 19%; + right: 7%; + } + textarea{ + position: relative; + } + } + } + + + .ant-modal-footer{ + display: flex; + justify-content: center; + .ant-btn{ + width: 88px; + height: 35px; + color: #fff; + border: none; + border-radius: 4px; + } + .ant-btn:last-child{ + background: #409eff; + } + } +} +.detail-Modal{ + .ruleTitle { + font-size: 16px; + font-weight: 700; + color: #ffffff; + } + .ltc-content { + display: flex; + flex-wrap: wrap; + margin: auto; + padding: 20px; + color: #ffffff; + .ltc-item { + font-size: 14px; + margin: 6px 12px 6px 0; + display: inline-flex; + flex: 1; + //width: 470px; + .new-item { + display: inline-block; + width: 120px; + height: 32px; + line-height: 32px; + background: rgba(150, 161, 192, 0.24); + text-align: center; + } + + .new-value { + display: inline-block; + width: 320px; + height: 32px; + line-height: 32px; + text-align: center; + background: #3E4557; + box-shadow: 0px 3px 8px 0px rgba(0, 0, 0, 0.12); + } + + .ltc-item-input { + display: inline-block; + width: 200px; + } + + div { + width: 150px; + } + } + .rule-description{ + .new-item{ + line-height: 96px; + height: 96px; + } + .new-value{ + width: 780px; + line-height: 96px; + height: 96px; + word-wrap:break-word + } + } + + + } + +} \ No newline at end of file diff --git a/src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/loadable.jsx b/src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/loadable.jsx new file mode 100644 index 0000000..ef250dc --- /dev/null +++ b/src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/loadable.jsx @@ -0,0 +1,396 @@ +import React, { useState, useRef, useEffect } from "react"; +import { + message, + Pagination, + Table, + Space, + Modal, + Button, + Tabs, + Descriptions, + Input, + Steps, + Select, + Image, + Timeline, + Popover, + Popconfirm +} from "antd"; +import { dictionary } from "@/config/common"; +import ajax from "@/services"; +import { TableModule } from "@/components"; +import moment from 'moment' +import "./index.scss"; + +const { TextArea } = Input; +function IllegalRuleConfigMgm() { + // 初始搜索条件 +const initFormData = { + operator_id: "0", + rule_name: "", + }; +const params ={ + operator_id:'', + rule_name:'', + rule_code:'', + time:moment().format("YYYY-MM-DD HH:mm:ss"), + username:'', + status:1, + effective_place:'' +} +// 新增or详细弹框 +const [modalData, setModalData] = useState(params) +// 详情弹窗 +const [detailVisible, setDetailVisible] = useState(false); +// 列表数据 +const [tableData, setTableData] = useState([]); +// 数据总数 +const [total, setTotal] = useState(0); +// 运营商 +const [operatorOption, setOperatorOption] = useState([]) +// 场站 +const [stationOption, setStationOption] = useState([]) + +const tableRef = useRef(null) +const columns = [ + { + title: "运营商名称", + dataIndex: "operator_name", + key: "operator_name", + align: "center", + }, + { + title: "规则名称", + dataIndex: "rule_name", + key: "rule_name", + align: "center", + }, + { + title: "规则编码", + dataIndex: "rule_code", + key: "rule_code", + align: "center", + }, + { + title: "生效场站", + dataIndex: "effective_place", + key: "effective_place", + align: "center", + }, + { + title: "创建人", + dataIndex: "creator", + key: "creator", + width: 100, + align: "center", + }, + { + title: "规则状态", + dataIndex: "status", + key: "status", + width: 100, + align: "center", + render:(_,record) => { + return( + + {record?.status ? "正常" : "停用"} + ) + } + }, + { + title: "创建时间", + dataIndex: "create_time", + key: "create_time", + align: "center", + }, + { + title: "操作", + dataIndex: "operation", + key: "operation", + align: "center", + fixed: "right", + width: 100, + render: (text, record, index) => { + return ( + <> +
+ { handleRuleStatus(record?.id,record?.status ? 0 : 1) }} + okText="是" + cancelText="否"> + {record?.status ? "停用" : "启动"} + + +
+ + ) + + }, + }, +]; + +const formSearch = [ + { + name: "operator_id", + type: "Select", + label: "运营商名称", + defaultValue: "0", + placeholder: "请选择运营商名称", + options:operatorOption.length ? operatorOption : [{value:"0",label:'全部'}] + }, + { + name: "rule_name", + type: "Input", + label: "规则名称", + placeholder: "请输入出场收费员", + }, + { + name: "timePeriod", + type: "RangePicker", + label: "时间段", + defaultValue: [moment().subtract(1,"months"), moment()] + }, +]; + // 更新规则状态 + const handleRuleStatus = (id,status) => { + ajax.updataRule({id,status}).then((res) => { + if (res.status == 20000) { + message.success(res.message) + tableRef.current.fetch() + }else{ + message.success(res.message) + } + }).catch(e => { + console.log(e); + }); + } + + // 获取运营商名字 + const getAllOperator =() => { + ajax.getOperatorList().then((res) => { + if (res.status === 20000) { + setOperatorOption(res.data); + }else{ + setOperatorOption([]) + } + }).catch(e => { + console.log(e); + }); + } + +// 获取场站 +const getAllStation =() => { + ajax.getStation().then((res) => { + if (res.status === 20000) { + setStationOption(res.data); + }else{ + setStationOption([]) + } + }).catch(e => { + console.log(e); + }); +} +// 检索 +const search = (params) => { + let data = { + ...params, + type:3 + } + ajax.getRegularList(data).then((res) => { + if (res.status === 20000) { + setTableData(res.data.list); + setTotal(res.data.total); + setModalData({ + ...modalData, + username:res.data.username, + }) + } else { + message.error(res.message) + } + }); +} + +const handelAdd = () => { + setModalData({ + ...params, + username:modalData?.username + }) + setDetailVisible(true) +} + +// 处理弹框ok按钮 +const handleConfirm = () => { + setDetailVisible(true) + if(!modalData?.operator_id){ + message.warning("运营商名称不能为空") + return + }else if(!modalData?.rule_name){ + message.warning("规则名称不能为空") + return + }else if(!modalData?.rule_code){ + message.warning("规则编码不能为空") + return + }else if(!modalData?.effective_place){ + message.warning("生效场站不能为空") + return + }else if(!modalData?.status){ + message.warning("规则状态不能为空") + return + } + // 发保存请求 + ajax.addRule({...modalData,type:3}).then(res => { + if (res.status === 20000) { + message.success(res.message) + tableRef.current.fetch() + setModalData({ + ...params, + username:modalData?.username + }) + setDetailVisible(false) + } + }).catch(err => { + console.log(err); + }) +} +useEffect(() => { + getAllStation() + getAllOperator() +},[]) +return ( + <> + + 新增 + + } + columns={columns} + ref={tableRef} + tableData={tableData} + formSearch={formSearch} + pagename="停车记录查询" + initFormData={initFormData} + total={total} + search={search} + exportUrl="/api/bpm/record/get_record_export" + /> + { + setModalData({...params,username:modalData?.username}) + setDetailVisible(false); + }} + onOk={() => { + handleConfirm() + }} + okText="保存" + destroyOnClose + > +
+ 新增规则 +
+
+
+ * + + {setModalData({...modalData,rule_name:v.target.value})}} + /> +
+
+ * + + {setModalData({...modalData,rule_code:v.target.value})}} + /> +
+ * + + {setModalData({...modalData,creator:v.target.value})}} + /> +
+
+ + {setModalData({...modalData,creat_time:v.target.value})}} + /> +
+
+ * + +
- * {setModalData({...modalData,creat_time:v.target.value})}} + onChange={(v) => {setModalData({...modalData,status:v})}} />
diff --git a/src/pages/NewEnergy/ChargingMgm/index.jsx b/src/pages/NewEnergy/ChargingMgm/index.jsx index 67bddb3..74c9c32 100644 --- a/src/pages/NewEnergy/ChargingMgm/index.jsx +++ b/src/pages/NewEnergy/ChargingMgm/index.jsx @@ -1,8 +1,9 @@ import BillingRule from './BillingRule' import OrderRuleMgm from './OrderRuleMgm' - +import IllegalRuleConfigMgm from "./IllegalRuleConfigMgm" export default { BillingRule, - OrderRuleMgm + OrderRuleMgm, + IllegalRuleConfigMgm } \ No newline at end of file diff --git a/src/router/router.config.js b/src/router/router.config.js index 98a79e9..02cf035 100644 --- a/src/router/router.config.js +++ b/src/router/router.config.js @@ -1337,6 +1337,12 @@ let routes = [ component: pages.BillingRule, }, { + path: "/newEnergy/illegalRuleConfigMgm", + text: "违法规则配置管理", + name: "illegalRuleConfigMgm", + component: pages.IllegalRuleConfigMgm, + }, + { path: "/newEnergy/orderRuleMgm", text: "预约规则管理", name: "orderRuleMgm", diff --git a/src/services/NewEnergy/chargingMgm.js b/src/services/NewEnergy/chargingMgm.js index 545330d..5abda83 100644 --- a/src/services/NewEnergy/chargingMgm.js +++ b/src/services/NewEnergy/chargingMgm.js @@ -44,10 +44,20 @@ const updataRule = (params) => { data: params, }); }; + +// 更新规则状态 +const getStation = (params) => { + return ajax({ + url: "/api/nes/rule/station", + type: "get", + data: params, + }); +}; export default{ getWechatMenuList, getOperatorList, getRegularList, addRule, - updataRule + updataRule, + getStation } \ No newline at end of file From 1baed1dab1c17464da84646fe1e47a525b20c79d Mon Sep 17 00:00:00 2001 From: chenli Date: Thu, 18 Jan 2024 16:16:54 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat():=20=E5=BC=80=E9=94=81=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=8E=A5=E5=8F=A3=E5=AD=97=E6=AE=B5=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RealtimeMonitor/ChargerMonitor/index.scss | 8 ++ .../RealtimeMonitor/ChargerMonitor/loadable.jsx | 62 +++------ .../RealtimeMonitor/PileMonitor/loadable.jsx | 153 +++------------------ .../RecordsInquiry/Unlocking/loadable.jsx | 89 +++++------- 4 files changed, 88 insertions(+), 224 deletions(-) diff --git a/src/pages/NewEnergy/RealtimeMonitor/ChargerMonitor/index.scss b/src/pages/NewEnergy/RealtimeMonitor/ChargerMonitor/index.scss index 9772ef5..2793eb8 100644 --- a/src/pages/NewEnergy/RealtimeMonitor/ChargerMonitor/index.scss +++ b/src/pages/NewEnergy/RealtimeMonitor/ChargerMonitor/index.scss @@ -27,3 +27,11 @@ } } } + +.custom-modal__charger-monitor{ + .content{ + display: flex; + align-items: center; + justify-content: center; + } +} diff --git a/src/pages/NewEnergy/RealtimeMonitor/ChargerMonitor/loadable.jsx b/src/pages/NewEnergy/RealtimeMonitor/ChargerMonitor/loadable.jsx index e3c82ab..9a63ac1 100644 --- a/src/pages/NewEnergy/RealtimeMonitor/ChargerMonitor/loadable.jsx +++ b/src/pages/NewEnergy/RealtimeMonitor/ChargerMonitor/loadable.jsx @@ -1,52 +1,29 @@ import React, { useState, useRef, useEffect } from "react"; -import { - message, - Pagination, - Table, - Space, - Modal, - Button, - Tabs, - Descriptions, - Input, - Steps, - Select, - Image, - Timeline, - Popover, -} from "antd"; +import { message, Modal, Image } from "antd"; import { dictionary, utils } from "@/config/common"; -// import moment from 'moment' -// import { useSessionStorageState, useUpdateEffect, useSize, useUpdate } from 'ahooks'; import ajax from "@/services"; -import errorImg from "@/assets/images/error-img-new.png"; -import { QuestionCircleOutlined } from "@ant-design/icons"; import { TableModule } from "@/components"; import "./index.scss"; -import { - payRecordColumns, - refundRecordColumns, - operatorRecordColumns, -} from "./dataSource"; -// import errorImg from "@/assets/images/layout/error.png" +import moment from "moment"; function ChargerMonitor() { const [tableData, setTableData] = useState([]); // 列表数据 const [total, setTotal] = useState(0); // 数据总数 const initFormData = { - status: "", // 充电状态 - plate: "", // 车牌号 + station_name: "", // 充电桩 phone: "", // 手机号 - station_name: "", // 充电站 - start_time: "", // 开始时间 - end_time: "", // 结束时间 + plate: "", // 车牌号 + status: sysConfig?.energyChargingStatus[0]?.value ?? 0, // 充电状态 + timePeriod: moment().format("YYYY-MM-DD HH:mm:ss"), + // start_time: "", // 开始时间 + // end_time: "", // 结束时间 }; // 初始数据 const formSearch = [ { label: "充电桩", - name: "charging_pile", + name: "station_name", type: "Input", placeholder: "请输入", }, @@ -64,17 +41,19 @@ function ChargerMonitor() { }, { label: "充电状态", - name: "charging_status", + name: "status", type: "Select", placeholder: "请选择充电状态", - defaultValue: 0, - options: sysConfig.energyChargingStatus, + defaultValue: initFormData.status, + options: sysConfig.energyChargingStatus ?? [], }, { - name: "time", + name: "timePeriod", type: "RangePicker", label: "充电开始时间", + // defaultTitle: ["充电开始时间", "充电结束时间"], defaultTitle: ["充电开始时间", " "], + defaultValue: [moment().subtract(1, "months"), moment()], }, ]; // 检索栏 @@ -198,6 +177,9 @@ function ChargerMonitor() { }) .catch((err) => { console.error(err); + }) + .finally(() => { + utils.tableScrollTop("parent-table-scroll"); }); } @@ -233,17 +215,17 @@ function ChargerMonitor() { /> { closeImgRecordModal(); }} > -
+
{ @@ -163,7 +142,6 @@ function PileMonitor() { console.error(err); }) .finally(() => { - // setLoading(false); }); } @@ -196,12 +174,11 @@ function PileMonitor() { return (
- {/* */}
{num ?? 0} - {label } + {label}
); @@ -220,105 +197,19 @@ function PileMonitor() { return ( <> - {/*
-
-
{"查询条件"}
-
- {renderSearch()} -
- - - {renderAdd()} -
-
-
-
-
- - 共查询到 - {total} - 条结果 - -
- - {true && ( - - total ? ( - 导出} - modalType="noImg" - ref={exportRef} - totalRecords={total} - exportUrl={exportUrl} - imgno={false} - postdata={{ - formData: pageData - }} - isTableModule={true} - onOk={handleExport} - /> - ) : <> - )} -
-
- -
- - -
- `共 ${total_records} 条`} - total={total} - current={pageData.pn} - pageSize={pageData.page_size} - pageSizeOptions={dictionary?.pageSizeOptions} - onChange={onChange} - // onShowSizeChange={onShowSizeChange} - /> -
- - - */} ); } diff --git a/src/pages/NewEnergy/RecordsInquiry/Unlocking/loadable.jsx b/src/pages/NewEnergy/RecordsInquiry/Unlocking/loadable.jsx index 10d87f4..5886fa4 100644 --- a/src/pages/NewEnergy/RecordsInquiry/Unlocking/loadable.jsx +++ b/src/pages/NewEnergy/RecordsInquiry/Unlocking/loadable.jsx @@ -1,39 +1,24 @@ import React, { useState, useRef, useEffect } from "react"; -import { - message, - Pagination, - Table, - Space, - Modal, - Button, - Tabs, - Descriptions, - Input, - Steps, - Select, - Image, - Timeline, - Popover -} from "antd"; -import { dictionary } from "@/config/common"; +import { message as Message } from "antd"; +import { dictionary, utils } from "@/config/common"; import ajax from "@/services"; import { TableModule } from "@/components"; import "./index.scss"; import moment from "moment"; -const { TextArea } = Input; // 开锁记录 function Unlocking() { - const [tableData, setTableData] = useState([]); // 列表数据 const [total, setTotal] = useState(0); // 数据总数 // 初始搜索条件 const initFormData = { - tel: "", - charging_station: "", - ground_lock_name: "", - unlocking_timerange:[moment().subtract(1,"weeks"),moment()] + tel: "", // 手机号 + charging_station: "", // 充电站 + ground_lock_name: "", // 地锁名称 + start_time: "", // 开始时间 + end_time: "", // 结束时间 + unlocking_timerange: [moment().subtract(1, "months"), moment()], // 解锁时间范围 最后返回 start_time, end_time 查看search 函数 }; const formSearch = [ @@ -58,7 +43,8 @@ function Unlocking() { { name: "unlocking_timerange", type: "DateRangePicker", - label: "降锁时间", + label: "降锁时间范围", + defaultValue: initFormData.unlocking_timerange, }, ]; // 搜索栏 @@ -114,45 +100,42 @@ function Unlocking() { // 检索 const search = (params) => { - let temp_obj = {...params} - if(temp_obj.unlocking_timerange?.length){ - temp_obj.unlocking_timerange = temp_obj.unlocking_timerange[0].format('YYYY-MM-DD') + ',' + temp_obj.unlocking_timerange[1].format('YYYY-MM-DD') - }else{ - temp_obj.unlocking_timerange = '' + let temp_obj = { ...params }; + if (temp_obj.unlocking_timerange?.length) { + temp_obj.start_time = + temp_obj.unlocking_timerange[0].format("YYYY-MM-DD"); + temp_obj.end_time = temp_obj.unlocking_timerange[1].format("YYYY-MM-DD"); + } else { + temp_obj.start_time = ""; + temp_obj.end_time = ""; } - ajax.recordsInquiry.getUnlockingList(params).then((res) => { + temp_obj.unlocking_timerange = undefined; + ajax.recordsInquiry.getUnlockingList(temp_obj).then((res) => { if (res.status === 20000) { setTableData(res.data.list); setTotal(res.data.total); } else { - message.error(res.message) + Message.error(res?.message); } - }); - } - + }).finally(()=>{ + utils.tableScrollTop("parent-table-scroll"); + }) + }; return ( <> {}} - > - 新增 - - } - columns={columns} - tableData={tableData} - formSearch={formSearch} - pagename="开锁记录" - pageName={'unlockingRecord'} - initFormData={initFormData} - total={total} - search={search} - exportUrl="/api/new_power/records/unlocking" + showSerial={true} // 显示序号 + isExport={false} // 显示导出按钮 + pagename="开锁记录" // 页面名称 + pageName={"unlockingRecord"} // 页面名称 用户 useSessionStorage 存储记录表单数据 + exportUrl="/api/new_power/records/unlocking" // 导出url + formSearch={formSearch} // 左侧搜索栏 + columns={columns} // 表头 + initFormData={initFormData} // 初始表单数据 + search={search} // 请求函数 + total={total} // 数据总数 + tableData={tableData} // 表格数据 /> {/* Date: Thu, 18 Jan 2024 16:44:08 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix():=20=E8=A7=84=E5=88=99=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/NewEnergy/ChargingMgm/BillingRule/loadable.jsx | 4 ++-- src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/loadable.jsx | 6 +++--- src/pages/NewEnergy/ChargingMgm/OrderRuleMgm/loadable.jsx | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pages/NewEnergy/ChargingMgm/BillingRule/loadable.jsx b/src/pages/NewEnergy/ChargingMgm/BillingRule/loadable.jsx index 3894a55..a026bc1 100644 --- a/src/pages/NewEnergy/ChargingMgm/BillingRule/loadable.jsx +++ b/src/pages/NewEnergy/ChargingMgm/BillingRule/loadable.jsx @@ -114,13 +114,13 @@ function BillingRule() { name: "rule_name", type: "Input", label: "规则名称", - placeholder: "请输入出场收费员", + placeholder: "请输入规则名称", }, { name: "timePeriod", type: "RangePicker", label: "时间段", - defaultValue: [moment().subtract(1,"months"), moment()] + defaultValue: [moment().subtract(1,"months").startOf("day"), moment().endOf("day")] }, ]; // 获取运营商名字 diff --git a/src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/loadable.jsx b/src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/loadable.jsx index ef250dc..1d866dc 100644 --- a/src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/loadable.jsx +++ b/src/pages/NewEnergy/ChargingMgm/IllegalRuleConfigMgm/loadable.jsx @@ -150,13 +150,13 @@ const formSearch = [ name: "rule_name", type: "Input", label: "规则名称", - placeholder: "请输入出场收费员", + placeholder: "请输入规则名称", }, { name: "timePeriod", type: "RangePicker", label: "时间段", - defaultValue: [moment().subtract(1,"months"), moment()] + defaultValue: [moment().subtract(1,"months").startOf("day"), moment().endOf("day")] }, ]; // 更新规则状态 @@ -185,7 +185,7 @@ const formSearch = [ console.log(e); }); } - + // 获取场站 const getAllStation =() => { ajax.getStation().then((res) => { diff --git a/src/pages/NewEnergy/ChargingMgm/OrderRuleMgm/loadable.jsx b/src/pages/NewEnergy/ChargingMgm/OrderRuleMgm/loadable.jsx index 8504862..d45f339 100644 --- a/src/pages/NewEnergy/ChargingMgm/OrderRuleMgm/loadable.jsx +++ b/src/pages/NewEnergy/ChargingMgm/OrderRuleMgm/loadable.jsx @@ -145,13 +145,13 @@ const formSearch = [ name: "rule_name", type: "Input", label: "规则名称", - placeholder: "请输入出场收费员", + placeholder: "请输入规则名称", }, { name: "timePeriod", type: "RangePicker", label: "时间段", - defaultValue: [moment().subtract(1,"months"), moment()] + defaultValue: [moment().subtract(1,"months").startOf("day"), moment().endOf("day")] }, ]; // 更新规则状态 @@ -422,7 +422,7 @@ return (
规则状态
- {detailsData?.status || "--"} + {detailsData?.status ? "正常" : "停用"}