周立森 5 years ago
parent
commit
0b91a9884d
1 changed files with 26 additions and 12 deletions
  1. 26
    12
      src/pages/activity/drainage/Detail.jsx

+ 26
- 12
src/pages/activity/drainage/Detail.jsx View File

@@ -8,6 +8,7 @@ import apis from '../../../services/apis';
8 8
 import request from '../../../utils/request';
9 9
 import { SSL_OP_SSLEAY_080_CLIENT_DH_BUG } from 'constants';
10 10
 import AuthButton from '../../../components/AuthButton';
11
+import { timeout } from 'q';
11 12
 
12 13
 
13 14
 const data = []
@@ -61,7 +62,7 @@ const header = (props) => {
61 62
         const r = {
62 63
 
63 64
           key: inx + 1,
64
-          createDate:row.createDate,
65
+          createDate: row.createDate,
65 66
           [`${col.key}`]: col.value,
66 67
           ...acc,
67 68
         }
@@ -72,14 +73,14 @@ const header = (props) => {
72 73
   }
73 74
 
74 75
   function tableTitle (data) {
75
-   tableTitle = eval('(' + data[0].content + ')')
76
+    tableTitle = eval('(' + data[0].content + ')')
76 77
     const cols = [{
77 78
       title: "提交时间",
78 79
       dataIndex: "createDate",
79 80
       key: "createDate",
80 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 84
       const col = {
84 85
         title: item.label,
85 86
         dataIndex: item.key,
@@ -92,28 +93,32 @@ const header = (props) => {
92 93
 
93 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 99
   function fromTime (str) {
99 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 107
   function onChangetime (dates, dateStrings) {
103
-
108
+    console.log(dateStrings[1])
104 109
     setEndDate(dateStrings[1])
105 110
     setStartDate(dateStrings[0])
106 111
 
107 112
   }
108 113
 
109 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 119
   function excelPort () {
115 120
     // const fieldsValue = getFieldsValue()
116
-  
121
+
117 122
     request({ ...apis.activity.exporttaDrainageRecord, params: { drainageId: drainageId, startTime: fromTime(startDate), endTime: fromTime(endDate) } })
118 123
       .then(response => {
119 124
         download(response)
@@ -137,6 +142,12 @@ const header = (props) => {
137 142
     link.click()
138 143
   }
139 144
 
145
+  function handleReset () {
146
+
147
+    onChangetime()
148
+
149
+  }
150
+
140 151
   const { RangePicker } = DatePicker;
141 152
   return (
142 153
     <>
@@ -150,16 +161,19 @@ const header = (props) => {
150 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 162
         showTime
152 163
         onChange={onChangetime}
164
+
153 165
       />
154 166
       <Button type="primary" htmlType="submit" style={{ marginLeft: '30px', float: 'right' }} onClick={datalist}>
155 167
         搜索
156 168
       </Button>
157
-
169
+      {/* <Button style={{ marginLeft: '30px', float: 'right' }} onClick={handleReset}>
170
+              重置
171
+            </Button> */}
158 172
       <div>
159 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 177
           {/* H5项目名称 style={{ float: 'right', margin: '20px 0', zIndex: 1 }} */}
164 178
           <AuthButton name="admin.taDrainageRecord.export.get" noRight={null}>
165 179
             <Button type="primary" style={{ marginLeft: '30px', float: 'right', marginTop: '30px', marginBottom: '30px', zIndex: 1 }} onClick={excelPort}>导出数据</Button>
@@ -167,7 +181,7 @@ const header = (props) => {
167 181
         </div>
168 182
         <Table columns={columns} dataSource={datas} pagination={false} />
169 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 185
         </div>
172 186
       </div>
173 187