周立森 5 年之前
父節點
當前提交
bd09fd8a20
共有 1 個檔案被更改,包括 16 行新增7 行删除
  1. 16
    7
      src/pages/activity/drainage/Detail.jsx

+ 16
- 7
src/pages/activity/drainage/Detail.jsx 查看文件

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