From cf436d3e3558b26802cf2145e69a74eec1f92a6e Mon Sep 17 00:00:00 2001 From: lisf Date: Tue, 16 Jan 2024 17:52:37 +0800 Subject: [PATCH] =?UTF-8?q?feat():=20=E5=85=85=E7=94=B5=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2=E7=BC=96=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NewEnergy/ChargingMgm/BillingRule/index.scss | 165 ++++--- .../NewEnergy/ChargingMgm/BillingRule/loadable.jsx | 255 ++++++++-- .../NewEnergy/ChargingMgm/OrderRuleMgm/index.scss | 162 ++++--- .../ChargingMgm/OrderRuleMgm/loadable.jsx | 531 ++++++++++++++++----- src/services/NewEnergy/chargingMgm.js | 41 +- src/services/index.js | 4 + 6 files changed, 875 insertions(+), 283 deletions(-) diff --git a/src/pages/NewEnergy/ChargingMgm/BillingRule/index.scss b/src/pages/NewEnergy/ChargingMgm/BillingRule/index.scss index 9a8202a..23f35ce 100644 --- a/src/pages/NewEnergy/ChargingMgm/BillingRule/index.scss +++ b/src/pages/NewEnergy/ChargingMgm/BillingRule/index.scss @@ -171,68 +171,113 @@ $color-primary: var(--color-primary); border-color: var(--color-border); } -// .yisa-table { -// width: 100%; - -// .ant-table-thead { -// th { -// background: var(--color-table-header-bg) !important; -// } -// } - -// .ant-table-tbody { -// td { -// background: var(--color-table-body-bg) !important; -// border-bottom-color: var(--color-table-border-bottom-color); -// } - -// tr:nth-child(even) { -// td { -// background: var(--color-table-body-bg-nth-child-even) !important; -// } -// } - -// tr:nth-child(odd) { -// td { -// background: var(--color-table-body-bg-nth-child-even) !important; -// } -// } -// } -// } -.totalModal{ - .ant-modal-footer{ - display: none; +.totalModal { + .ruleTitle { + font-size: 16px; + font-weight: 700; + color: #ffffff; } - position: absolute; - top: 40px; - right: 174px; -} -.ltc-item-img { - width: 390px; - height: 300px; - border: 1px solid; - background: #6565656b; - margin-right: 20px !important; - img { - height: 295px; - width: 387px; - // object-fit: contain; + .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; + } } } -.hanleHistoyModal{ - max-height: 700px; - overflow: auto; -} -.hanleHistoyModal::-webkit-scrollbar { - width: 5px; -} -.hanleHistoyModal::-webkit-scrollbar-thumb { - background-color: #9da2ab; - border-radius: 10px; -} -.modal-img{ - img{ - width: 200px; - height: 200px; +.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; + } + } + .last-row{ + width: 100%; + display: flex; + flex-direction: column; + .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/BillingRule/loadable.jsx b/src/pages/NewEnergy/ChargingMgm/BillingRule/loadable.jsx index 4ef6d7b..a9f38d7 100644 --- a/src/pages/NewEnergy/ChargingMgm/BillingRule/loadable.jsx +++ b/src/pages/NewEnergy/ChargingMgm/BillingRule/loadable.jsx @@ -18,55 +18,67 @@ import { import { dictionary } from "@/config/common"; import ajax from "@/services"; import { TableModule } from "@/components"; +import moment from 'moment' import "./index.scss"; const { TextArea } = Input; function BillingRule() { + // 初始搜索条件 + const initFormData = { + operator_id: "0", + rule_name: "", + }; + const params ={ + operator_id:'', + rule_name:'', + rule_code:'', + rule_description:'', + time:moment().format("YYYY-MM-DD HH:mm:ss"), + username:'' + } + // 新增or详细弹框 + const [modalData, setModalData] = useState(params) // 详情弹窗 const [detailVisible, setDetailVisible] = useState(false); // 列表数据 const [tableData, setTableData] = useState([]); // 数据总数 const [total, setTotal] = useState(0); - // 详情数据 - const [detailData, setDetailData] = useState({}); - // 初始搜索条件 - const initFormData = { - operator: "0", - rule_name: "", - }; - + const [operatorOption, setOperatorOption] = useState([]) + const [ruleDetailVisible, setRuleDetailVisible] = useState(false) + const [detailsData, setDetailsData] = useState({}) + const tableRef = useRef(null) const columns = [ { title: "运营商名称", - dataIndex: "operator", - key: "operator", + dataIndex: "operator_name", + key: "operator_name", align: "center", }, { title: "规则名称", - dataIndex: "plate", - key: "plate", + dataIndex: "rule_name", + key: "rule_name", align: "center", }, { title: "规则编码", - dataIndex: "plate_color", - key: "plate_color", + dataIndex: "rule_code", + key: "rule_code", align: "center", }, { title: "创建人", - dataIndex: "berth_id", - key: "berth_id", + dataIndex: "creator", + key: "creator", width: 100, align: "center", }, { title: "创建时间", - dataIndex: "in_time", - key: "in_time", + dataIndex: "create_time", + key: "create_time", align: "center", }, { @@ -79,9 +91,9 @@ function BillingRule() { render: (text, record, index) => { return ( <> - + ) @@ -91,11 +103,12 @@ function BillingRule() { const formSearch = [ { - name: "operator", + name: "operator_id", type: "Select", - label: "商户名称", + label: "运营商名称", defaultValue: "0", - placeholder: "请选择商户名称", + placeholder: "请选择运营商名称", + options:operatorOption.length ? operatorOption : [{value:"0",label:'全部'}] }, { name: "rule_name", @@ -107,21 +120,38 @@ function BillingRule() { name: "timePeriod", type: "RangePicker", label: "时间段", + defaultValue: [moment().subtract(1,"months"), moment()] }, ]; - + // 获取运营商名字 + const getAllOperator =() => { + ajax.getOperatorList().then((res) => { + if (res.status === 20000) { + setOperatorOption(res.data); + } + }); + } // 打开弹窗 const openModal = (index, record) => { - setDetailData(record) - setDetailVisible(true); + setDetailsData(record) + setRuleDetailVisible(true); } // 检索 const search = (params) => { - ajax.getParkingList(params).then((res) => { + console.log("params",params); + let data = { + ...params, + type:1 + } + 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) } @@ -129,9 +159,43 @@ function BillingRule() { } const handelAdd = () => { + setModalData({ + ...params, + username:modalData?.username + }) setDetailVisible(true) } +// 处理弹框ok按钮 + const handleConfirm = () => { + if(!modalData?.operator_id){ + message.warning("运营商名称不能为空") + return + }else if(!modalData?.rule_name){ + message.warning("规则名称不能为空") + return + }else if(!modalData?.rule_code){ + message.warning("规则编码不能为空") + return + } + // 发保存请求 + ajax.addRule({...modalData,type:1}).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(() => { + getAllOperator() + },[]) return ( <> } columns={columns} + ref={tableRef} tableData={tableData} formSearch={formSearch} pagename="停车记录查询" - pageName={'billingRule'} initFormData={initFormData} total={total} search={search} @@ -157,14 +221,145 @@ function BillingRule() { /> { + setModalData({...params,username:modalData?.username}) + setDetailVisible(false); + }} + onOk={() => { + handleConfirm() setDetailVisible(false); }} + 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})}} + /> +
+
+ +