|
@@ -0,0 +1,229 @@
|
|
1
|
+import React, { useState, useEffect } from 'react';
|
|
2
|
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker, notification } from 'antd';
|
|
3
|
+import { FormattedMessage } from 'umi-plugin-react/locale';
|
|
4
|
+import router from 'umi/router';
|
|
5
|
+import moment from 'moment';
|
|
6
|
+import styles from '../../style/GoodsList.less';
|
|
7
|
+import SelectCity from '../../../components/SelectButton/CitySelect'
|
|
8
|
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
|
|
9
|
+import apis from '../../../services/apis';
|
|
10
|
+import request from '../../../utils/request';
|
|
11
|
+import AuthButton from '@/components/AuthButton';
|
|
12
|
+// import RaiseHelpDoc from '../edit/components/RaiseHelpDoc';
|
|
13
|
+
|
|
14
|
+const { Option } = Select;
|
|
15
|
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
|
|
16
|
+
|
|
17
|
+const header = props => {
|
|
18
|
+ // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
19
|
+ const [data, setData] = useState({ list: [], total: 0 })
|
|
20
|
+ // const [page, changePage] = useState({})
|
|
21
|
+ const [houseIdList, setHouseIdList] = useState([])
|
|
22
|
+ const [time, setTime] = useState('')
|
|
23
|
+ const [showHelp, setShowHelp] = useState(false)
|
|
24
|
+
|
|
25
|
+ // 查询列表
|
|
26
|
+ const getList = params => {
|
|
27
|
+ request({ ...apis.house.taRaiseList, params: { ...params } }).then(data => {
|
|
28
|
+ console.log(data)
|
|
29
|
+ setData(data)
|
|
30
|
+ })
|
|
31
|
+ }
|
|
32
|
+
|
|
33
|
+ // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
34
|
+ useEffect(() => {
|
|
35
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
36
|
+ }, [])
|
|
37
|
+
|
|
38
|
+ const toAdd = rowData => () => {
|
|
39
|
+ router.push({
|
|
40
|
+ pathname: '/h5SampleManager/contractTemplate/add',
|
|
41
|
+ });
|
|
42
|
+ }
|
|
43
|
+
|
|
44
|
+ function openNotificationWithIcon(type, message) {
|
|
45
|
+ notification[type]({
|
|
46
|
+ message,
|
|
47
|
+ description:
|
|
48
|
+ '',
|
|
49
|
+ });
|
|
50
|
+ }
|
|
51
|
+
|
|
52
|
+ function toDecimal2 (x){
|
|
53
|
+ var f = parseFloat(x);
|
|
54
|
+ if (isNaN(f)) {
|
|
55
|
+ return false;
|
|
56
|
+ }
|
|
57
|
+ var f = Math.round(x * 100) / 100;
|
|
58
|
+ var s = f.toString();
|
|
59
|
+ var rs = s.indexOf('.');
|
|
60
|
+ if (rs < 0) {
|
|
61
|
+ rs = s.length;
|
|
62
|
+ s += '.';
|
|
63
|
+ }
|
|
64
|
+ while (s.length <= rs + 2) {
|
|
65
|
+ s += '0';
|
|
66
|
+ }
|
|
67
|
+ console.log(s)
|
|
68
|
+ return s;
|
|
69
|
+ }
|
|
70
|
+ function regFenToYuan(fen){
|
|
71
|
+ var num = fen;
|
|
72
|
+ num = fen * 0.01;
|
|
73
|
+ num += '';
|
|
74
|
+ var reg = num.indexOf('.') > -1 ? /(\d{1,3})(?=(?:\d{3})+\.)/g : /(\d{1,3})(?=(?:\d{3})+$)/g;
|
|
75
|
+ num = num.replace(reg, '$1');
|
|
76
|
+ console.log(num, 'yuan')
|
|
77
|
+ num = toDecimal2(num)
|
|
78
|
+ return num
|
|
79
|
+ }
|
|
80
|
+
|
|
81
|
+ const toDel = rowData => () =>{
|
|
82
|
+ console.log(houseIdList, 'houseIdListhouseIdList')
|
|
83
|
+ if(houseIdList.length < 1){
|
|
84
|
+ openNotificationWithIcon('error', '请先选择需要删除的合同')
|
|
85
|
+ return
|
|
86
|
+ }
|
|
87
|
+
|
|
88
|
+ Modal.confirm({
|
|
89
|
+ title: '确定删除合同吗',
|
|
90
|
+ okText: '确定',
|
|
91
|
+ cancelText: '取消',
|
|
92
|
+ onOk () {
|
|
93
|
+ console.log(houseIdList,'houseIdListhouseIdList');
|
|
94
|
+ request({ ...apis.house.batchDelRaise, data: houseIdList, }).then((data) => {
|
|
95
|
+ message.info("操作成功")
|
|
96
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
97
|
+ }).catch((err) => {
|
|
98
|
+ // message.info(err.msg)
|
|
99
|
+ })
|
|
100
|
+ },
|
|
101
|
+ });
|
|
102
|
+ }
|
|
103
|
+
|
|
104
|
+ const toDetail = (id) => () => {
|
|
105
|
+ router.push({
|
|
106
|
+ pathname: '/h5SampleManager/contractTemplate/detail',
|
|
107
|
+ query: {
|
|
108
|
+ id
|
|
109
|
+ },
|
|
110
|
+ });
|
|
111
|
+}
|
|
112
|
+
|
|
113
|
+ /**
|
|
114
|
+ *
|
|
115
|
+ *
|
|
116
|
+ * @param {*} props
|
|
117
|
+ * @returns
|
|
118
|
+ */
|
|
119
|
+ const columns = [
|
|
120
|
+ {
|
|
121
|
+ title: '合同标题',
|
|
122
|
+ dataIndex: 'salesBatchName',
|
|
123
|
+ key: 'salesBatchName',
|
|
124
|
+ align: 'center',
|
|
125
|
+ },
|
|
126
|
+ {
|
|
127
|
+ title: '新增时间',
|
|
128
|
+ dataIndex: 'buildingName',
|
|
129
|
+ key: 'buildingName',
|
|
130
|
+ align: 'center',
|
|
131
|
+ },
|
|
132
|
+ {
|
|
133
|
+ title: '操作',
|
|
134
|
+ dataIndex: '',
|
|
135
|
+ key: '',
|
|
136
|
+ align: 'center',
|
|
137
|
+ render: (text, record) => (
|
|
138
|
+ <a style={{ color: '#66B3FF' }} onClick={toDetail(record)} >查看详情</a>
|
|
139
|
+ ),
|
|
140
|
+ },
|
|
141
|
+ ];
|
|
142
|
+ const getSignList = dynamicId => {
|
|
143
|
+ router.push({
|
|
144
|
+ pathname: '/activity/SignList',
|
|
145
|
+ query: {
|
|
146
|
+ dynamicId,
|
|
147
|
+ },
|
|
148
|
+ });
|
|
149
|
+ }
|
|
150
|
+
|
|
151
|
+ const changePageNum = pageNumber => {
|
|
152
|
+ getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
|
|
153
|
+ }
|
|
154
|
+
|
|
155
|
+ const rowSelection = {
|
|
156
|
+ onChange: (selectedRowKeys, selectedRows) => {
|
|
157
|
+ console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
|
|
158
|
+ setHouseIdList(selectedRows)
|
|
159
|
+ },
|
|
160
|
+ };
|
|
161
|
+
|
|
162
|
+ // 提交事件
|
|
163
|
+ const handleSubmit = e => {
|
|
164
|
+ e.preventDefault();
|
|
165
|
+ props.form.validateFields((err, values) => {
|
|
166
|
+ if (!err) {
|
|
167
|
+ console.log('提交数据: ', values)
|
|
168
|
+ if (time) {
|
|
169
|
+ values.time = `${moment(time).format('YYYY-MM-DDT00:00:00.000')}Z`
|
|
170
|
+ } else {
|
|
171
|
+ values.time = null
|
|
172
|
+ }
|
|
173
|
+
|
|
174
|
+ getList({ pageNum: 1, pageSize: 10, ...values })
|
|
175
|
+ }
|
|
176
|
+ });
|
|
177
|
+ }
|
|
178
|
+
|
|
179
|
+ // 重置搜索
|
|
180
|
+ function handleReset () {
|
|
181
|
+ props.form.resetFields();
|
|
182
|
+ setTime('')
|
|
183
|
+ getList({ pageNum: 1, pageSize: 10 })
|
|
184
|
+ }
|
|
185
|
+
|
|
186
|
+ const { getFieldDecorator } = props.form
|
|
187
|
+ return (
|
|
188
|
+
|
|
189
|
+ <>
|
|
190
|
+ {/* style={{ display: 'none' }} */}
|
|
191
|
+ <div id="qrcode"></div>
|
|
192
|
+ <Form layout="inline" onSubmit={e => handleSubmit(e)}>
|
|
193
|
+ <Form.Item>
|
|
194
|
+ {getFieldDecorator('salesBatchName')(
|
|
195
|
+ <Input
|
|
196
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
197
|
+ placeholder="合同标题"
|
|
198
|
+ />,
|
|
199
|
+ )}
|
|
200
|
+ </Form.Item>
|
|
201
|
+ <Form.Item>
|
|
202
|
+ <AuthButton name="admin.buildingDynamic.search" noRight={null}>
|
|
203
|
+ <Button type="primary" htmlType="submit" className={styles.searchBtn}>
|
|
204
|
+ 搜索
|
|
205
|
+ </Button>
|
|
206
|
+ </AuthButton>
|
|
207
|
+ <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
|
208
|
+ 重置
|
|
209
|
+ </Button>
|
|
210
|
+ </Form.Item>
|
|
211
|
+ </Form>
|
|
212
|
+ <AuthButton name="admin.raise.add.post" noRight={null}>
|
|
213
|
+ <Button type="danger" className={styles.addBtn} onClick={toAdd()}>新增</Button>
|
|
214
|
+ </AuthButton>
|
|
215
|
+ <AuthButton name="admin.raise.del" noRight={null}>
|
|
216
|
+ <Button type="primary" className={styles.addBtn} onClick={toDel()} style={{marginLeft:'30px'}}>删除</Button>
|
|
217
|
+ </AuthButton>
|
|
218
|
+ <Table rowSelection={rowSelection}
|
|
219
|
+ dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
|
|
220
|
+ <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
|
221
|
+ <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current}/>
|
|
222
|
+ </div>
|
|
223
|
+ {/* <RaiseHelpDoc visible={showHelp} onCancel={() => setShowHelp(false)} /> */}
|
|
224
|
+ </>
|
|
225
|
+ )
|
|
226
|
+}
|
|
227
|
+const WrappedHeader = Form.create({ name: 'header' })(header);
|
|
228
|
+
|
|
229
|
+export default WrappedHeader
|