周立森 5 年 前
コミット
bd09fd8a20
共有1 個のファイルを変更した16 個の追加7 個の削除を含む
  1. 16
    7
      src/pages/activity/drainage/Detail.jsx

+ 16
- 7
src/pages/activity/drainage/Detail.jsx ファイルの表示

@@ -36,13 +36,11 @@ const header = (props) => {
36 36
       console.log(data, '3333333333333')
37 37
       if (data.total != 0) {
38 38
         setTotal(data)
39
-        // console.log(data.total, '3333333333333')
40
-
41 39
         setDatas(tableData(data.records))
42 40
         // content = data.records[0]
43 41
         console.log('json: ', eval('(' + data.records[0].content + ')'))
44 42
         setContent(eval('(' + data.records[0].content + ')'))
45
-        setColumns(tableTitle(eval('(' + data.records[0].content + ')')))
43
+        setColumns(tableTitle(data.records))
46 44
       }
47 45
       else {
48 46
         message.info('数据为空')
@@ -56,11 +54,13 @@ const header = (props) => {
56 54
     })
57 55
   }
58 56
   function tableData (data) {
59
-    console.log('data', data)
57
+    console.log('tabledata', data)
60 58
     return data.map((row, inx) => {
61 59
       return eval('(' + row.content + ')').reduce((acc, col) => {
62 60
         const r = {
61
+
63 62
           key: inx + 1,
63
+          createDate:row.createDate,
64 64
           [`${col.key}`]: col.value,
65 65
           ...acc,
66 66
         }
@@ -71,14 +71,21 @@ const header = (props) => {
71 71
   }
72 72
 
73 73
   function tableTitle (data) {
74
-    return data.map((item) => {
74
+   tableTitle = eval('(' + data[0].content + ')')
75
+    const cols = [{
76
+      title: "提交时间",
77
+      dataIndex: "createDate",
78
+      key: "createDate",
79
+      render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD')}`}</span></>,
80
+    }]
81
+    return cols.concat( tableTitle.map((item) => {
75 82
       const col = {
76 83
         title: item.label,
77 84
         dataIndex: item.key,
78 85
         key: item.key
79 86
       }
80 87
       return col
81
-    })
88
+    }))
82 89
   }
83 90
 
84 91
 
@@ -105,7 +112,7 @@ const header = (props) => {
105 112
 
106 113
   function excelPort () {
107 114
     // const fieldsValue = getFieldsValue()
108
-    console.log("111111")
115
+  
109 116
     request({ ...apis.activity.exporttaDrainageRecord, params: { drainageId: drainageId, startTime: fromTime(startDate), endTime: fromTime(endDate) } })
110 117
       .then(response => {
111 118
         download(response)
@@ -152,6 +159,8 @@ const header = (props) => {
152 159
         <AuthButton name="admin.taDrainageRecord.export.get" noRight={null}>
153 160
           <Button type="primary" style={{ marginLeft: '30px', float: 'right', marginTop: '30px', marginBottom: '30px', zIndex: 1 }} onClick={excelPort}>导出数据</Button>
154 161
         </AuthButton>
162
+        {
163
+         console.log("datas", datas)}
155 164
         <Table columns={columns} dataSource={datas} pagination={false} />
156 165
         <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
157 166
           <Pagination showQuickJumper defaultCurrent={1} total={total.total} onChange={(e) => changePageNum(e)} current={total.current}