周立森 5 gadus atpakaļ
vecāks
revīzija
0b91a9884d
1 mainītis faili ar 26 papildinājumiem un 12 dzēšanām
  1. 26
    12
      src/pages/activity/drainage/Detail.jsx

+ 26
- 12
src/pages/activity/drainage/Detail.jsx Parādīt failu

8
 import request from '../../../utils/request';
8
 import request from '../../../utils/request';
9
 import { SSL_OP_SSLEAY_080_CLIENT_DH_BUG } from 'constants';
9
 import { SSL_OP_SSLEAY_080_CLIENT_DH_BUG } from 'constants';
10
 import AuthButton from '../../../components/AuthButton';
10
 import AuthButton from '../../../components/AuthButton';
11
+import { timeout } from 'q';
11
 
12
 
12
 
13
 
13
 const data = []
14
 const data = []
61
         const r = {
62
         const r = {
62
 
63
 
63
           key: inx + 1,
64
           key: inx + 1,
64
-          createDate:row.createDate,
65
+          createDate: row.createDate,
65
           [`${col.key}`]: col.value,
66
           [`${col.key}`]: col.value,
66
           ...acc,
67
           ...acc,
67
         }
68
         }
72
   }
73
   }
73
 
74
 
74
   function tableTitle (data) {
75
   function tableTitle (data) {
75
-   tableTitle = eval('(' + data[0].content + ')')
76
+    tableTitle = eval('(' + data[0].content + ')')
76
     const cols = [{
77
     const cols = [{
77
       title: "提交时间",
78
       title: "提交时间",
78
       dataIndex: "createDate",
79
       dataIndex: "createDate",
79
       key: "createDate",
80
       key: "createDate",
80
       render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
81
       render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
81
     }]
82
     }]
82
-    return cols.concat( tableTitle.map((item) => {
83
+    return cols.concat(tableTitle.map((item) => {
83
       const col = {
84
       const col = {
84
         title: item.label,
85
         title: item.label,
85
         dataIndex: item.key,
86
         dataIndex: item.key,
92
 
93
 
93
   function datalist () {
94
   function datalist () {
94
 
95
 
95
-    gettaDrainageRecord({ pageNum: 1, pageSize: 10, drainageId: drainageId, startTime: fromTime(startDate), endTime: fromTime(endDate) })
96
+    gettaDrainageRecord({ pageNum: 1, pageSize: 10, drainageId: drainageId, startTime: Time(startDate), endTime: Time(endDate) })
96
   }
97
   }
97
 
98
 
98
   function fromTime (str) {
99
   function fromTime (str) {
99
     return str === '' ? null : `${moment(str).format('YYYY-MM-DDT00:00:00.000')}Z`
100
     return str === '' ? null : `${moment(str).format('YYYY-MM-DDT00:00:00.000')}Z`
100
   }
101
   }
101
 
102
 
103
+  function Time (str) {
104
+    return str === '' ? null : `${moment(str).format('YYYY-MM-DD')}`
105
+  }
106
+  // 2019-10-30T11:04:49
102
   function onChangetime (dates, dateStrings) {
107
   function onChangetime (dates, dateStrings) {
103
-
108
+    console.log(dateStrings[1])
104
     setEndDate(dateStrings[1])
109
     setEndDate(dateStrings[1])
105
     setStartDate(dateStrings[0])
110
     setStartDate(dateStrings[0])
106
 
111
 
107
   }
112
   }
108
 
113
 
109
   const changePageNum = pageNumber => {
114
   const changePageNum = pageNumber => {
110
-    gettaDrainageRecord({ pageNum: pageNumber, pageSize: 10, drainageId: drainageId, startTime: fromTime(startDate), endTime: fromTime(endDate) })
115
+    gettaDrainageRecord({ pageNum: pageNumber, pageSize: 10, drainageId: drainageId, startTime: Time(startDate), endTime: Time(endDate) })
111
   }
116
   }
112
 
117
 
113
 
118
 
114
   function excelPort () {
119
   function excelPort () {
115
     // const fieldsValue = getFieldsValue()
120
     // const fieldsValue = getFieldsValue()
116
-  
121
+
117
     request({ ...apis.activity.exporttaDrainageRecord, params: { drainageId: drainageId, startTime: fromTime(startDate), endTime: fromTime(endDate) } })
122
     request({ ...apis.activity.exporttaDrainageRecord, params: { drainageId: drainageId, startTime: fromTime(startDate), endTime: fromTime(endDate) } })
118
       .then(response => {
123
       .then(response => {
119
         download(response)
124
         download(response)
137
     link.click()
142
     link.click()
138
   }
143
   }
139
 
144
 
145
+  function handleReset () {
146
+
147
+    onChangetime()
148
+
149
+  }
150
+
140
   const { RangePicker } = DatePicker;
151
   const { RangePicker } = DatePicker;
141
   return (
152
   return (
142
     <>
153
     <>
150
         // defaultValue={[moment(new Date(new Date().setDate((new Date().getDate() - 6))), 'YYYY-MM-DD HH:MM:SS'), moment(new Date(), 'YYYY-MM-DD HH:MM:SS')]}
161
         // defaultValue={[moment(new Date(new Date().setDate((new Date().getDate() - 6))), 'YYYY-MM-DD HH:MM:SS'), moment(new Date(), 'YYYY-MM-DD HH:MM:SS')]}
151
         showTime
162
         showTime
152
         onChange={onChangetime}
163
         onChange={onChangetime}
164
+
153
       />
165
       />
154
       <Button type="primary" htmlType="submit" style={{ marginLeft: '30px', float: 'right' }} onClick={datalist}>
166
       <Button type="primary" htmlType="submit" style={{ marginLeft: '30px', float: 'right' }} onClick={datalist}>
155
         搜索
167
         搜索
156
       </Button>
168
       </Button>
157
-
169
+      {/* <Button style={{ marginLeft: '30px', float: 'right' }} onClick={handleReset}>
170
+              重置
171
+            </Button> */}
158
       <div>
172
       <div>
159
         <div style={{ display: 'flex', justifyContent: 'space-between' }}>
173
         <div style={{ display: 'flex', justifyContent: 'space-between' }}>
160
-         <div style={{ lineHeight: '92px', width: '600px', fontWeight: 'bold', fontSize: '18px' }}>
161
-            H5项目:{ name }
162
-         </div>
174
+          <div style={{ lineHeight: '92px', width: '600px', fontWeight: 'bold', fontSize: '18px' }}>
175
+            H5项目:{name}
176
+          </div>
163
           {/* H5项目名称 style={{ float: 'right', margin: '20px 0', zIndex: 1 }} */}
177
           {/* H5项目名称 style={{ float: 'right', margin: '20px 0', zIndex: 1 }} */}
164
           <AuthButton name="admin.taDrainageRecord.export.get" noRight={null}>
178
           <AuthButton name="admin.taDrainageRecord.export.get" noRight={null}>
165
             <Button type="primary" style={{ marginLeft: '30px', float: 'right', marginTop: '30px', marginBottom: '30px', zIndex: 1 }} onClick={excelPort}>导出数据</Button>
179
             <Button type="primary" style={{ marginLeft: '30px', float: 'right', marginTop: '30px', marginBottom: '30px', zIndex: 1 }} onClick={excelPort}>导出数据</Button>
167
         </div>
181
         </div>
168
         <Table columns={columns} dataSource={datas} pagination={false} />
182
         <Table columns={columns} dataSource={datas} pagination={false} />
169
         <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
183
         <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
170
-          <Pagination showQuickJumper defaultCurrent={1} total={total.total} onChange={(e) => changePageNum(e)} current={total.current}/>
184
+          <Pagination showQuickJumper defaultCurrent={1} total={total.total} onChange={(e) => changePageNum(e)} current={total.current} />
171
         </div>
185
         </div>
172
       </div>
186
       </div>
173
 
187