ソースを参照

时间选择改为月份

XuZinan 2 年 前
コミット
634e97cea2

+ 3 - 3
src/pages/PurchaseAdmin/PurchaseList/Report/Department.js

@@ -90,8 +90,8 @@ function Department(props) {
   const filterRef = useRef({ pageSize: 99999 });
   const handleSearch = () => {
     const { time } = form.getFieldsValue();
-    filterRef.current.s_time = time[0] ? moment(time[0]).format('YYYY-MM-DD') : null;
-    filterRef.current.e_time = time[1] ? moment(time[1]).format('YYYY-MM-DD') : null;
+    filterRef.current.s_time = time[0] ? moment(time[0]).format('YYYY-MM') : null;
+    filterRef.current.e_time = time[1] ? moment(time[1]).format('YYYY-MM') : null;
 
     dispatch({
       type: 'report/queryDepReport',
@@ -113,7 +113,7 @@ function Department(props) {
     return (
       <Form layout="inline" form={form}>
         <Form.Item label="时间" name="time" initialValue={initData}>
-          <RangePicker placeholder="选择时间" allowClear={false} />
+          <RangePicker placeholder="选择时间" allowClear={false} picker="month" />
         </Form.Item>
         <Form.Item>
           <Button type="primary" loading={loading} onClick={handleSearch}>

+ 8 - 4
src/pages/PurchaseAdmin/PurchaseList/Report/Finance/Project.js

@@ -45,8 +45,8 @@ function FinanceProject(props) {
   };
   const handleSearch = () => {
     const { time } = form.getFieldsValue();
-    filterRef.current.s_time = time[0] ? moment(time[0]).format('YYYY-MM-DD') : null;
-    filterRef.current.e_time = time[1] ? moment(time[1]).format('YYYY-MM-DD') : null;
+    filterRef.current.s_time = time[0] ? moment(time[0]).format('YYYY-MM') : null;
+    filterRef.current.e_time = time[1] ? moment(time[1]).format('YYYY-MM') : null;
 
     dispatch({
       type: 'finance/queryFinanceProjReport',
@@ -70,8 +70,12 @@ function FinanceProject(props) {
   const renderSearch = () => {
     return (
       <Form layout="inline" form={form}>
-        <Form.Item label="时间" name="time" initialValue={[moment().startOf('years'), moment()]}>
-          <RangePicker placeholder="选择时间" allowClear={false} />
+        <Form.Item
+          label="时间"
+          name="time"
+          initialValue={[moment().subtract(1, 'month'), moment().subtract(1, 'month')]}
+        >
+          <RangePicker placeholder="选择时间" allowClear={false} picker="month" />
         </Form.Item>
         <Form.Item>
           <Button type="primary" loading={loading} onClick={handleSearch}>

+ 6 - 2
src/pages/PurchaseAdmin/PurchaseList/Report/Finance/Resources.js

@@ -42,8 +42,12 @@ function FinanceResource(props) {
   const renderSearch = () => {
     return (
       <Form layout="inline" form={form}>
-        <Form.Item label="时间" name="time" initialValue={[moment().startOf('years'), moment()]}>
-          <RangePicker placeholder="选择时间" allowClear={false} />
+        <Form.Item
+          label="时间"
+          name="time"
+          initialValue={[moment().subtract(1, 'month'), moment().subtract(1, 'month')]}
+        >
+          <RangePicker placeholder="选择时间" allowClear={false} picker="month" />
         </Form.Item>
         <Form.Item>
           <Button type="primary" loading={loading} onClick={handleSearch}>

+ 14 - 11
src/pages/PurchaseAdmin/PurchaseList/Report/ProjectTree.js

@@ -52,8 +52,8 @@ function ProjectTree(props) {
   };
   const handleSearch = () => {
     const { time } = form.getFieldsValue();
-    filterRef.current.s_time = time[0] ? moment(time[0]).format('YYYY-MM-DD') : null;
-    filterRef.current.e_time = time[1] ? moment(time[1]).format('YYYY-MM-DD') : null;
+    filterRef.current.s_time = time[0] ? moment(time[0]).format('YYYY-MM') : null;
+    filterRef.current.e_time = time[1] ? moment(time[1]).format('YYYY-MM') : null;
 
     dispatch({
       type: 'report/queryProjectReportNew',
@@ -83,7 +83,7 @@ function ProjectTree(props) {
     const fn = data => {
       data.forEach(record => {
         // 判断是否展开
-        if(expandedRows.includes(record.key)) {
+        if (expandedRows.includes(record.key)) {
           // 执行项目被展开则显示预算
           if (record.cond.status == 0) {
             budget = true;
@@ -92,21 +92,24 @@ function ProjectTree(props) {
           if (record.child[0]?.dep_name) {
             dep = true;
           }
-          if(record.child) fn(record.child)
+          if (record.child) fn(record.child);
         }
-      })
-      
-    }
-    fn(projectNew)
-    
+      });
+    };
+    fn(projectNew);
+
     setColumnsFilter({ budget, dep });
   };
 
   const renderSearch = () => {
     return (
       <Form layout="inline" form={form}>
-        <Form.Item label="时间" name="time" initialValue={[moment().startOf('years'), moment()]}>
-          <RangePicker placeholder="选择时间" allowClear={false} />
+        <Form.Item
+          label="时间"
+          name="time"
+          initialValue={[moment().subtract(1, 'month'), moment().subtract(1, 'month')]}
+        >
+          <RangePicker placeholder="选择时间" allowClear={false} picker="month" />
         </Form.Item>
         <Form.Item>
           <Button type="primary" loading={loading} onClick={handleSearch}>