parent
dc0ce9b8df
commit
ec175159cf
36 changed files with 1204 additions and 798 deletions
@ -1,58 +0,0 @@ |
||||
import axios from '../axios'; |
||||
|
||||
/* |
||||
* 公告列表 |
||||
*/ |
||||
export function getNoticeList(targetId: number | string, type: number) { |
||||
return axios({ |
||||
url: '/seller/na/wx/setting/notice/' + targetId + '/' + type, |
||||
method: 'get' |
||||
}); |
||||
} |
||||
|
||||
/* |
||||
* 公告添加 |
||||
*/ |
||||
export function addNotice(targetId: number | string, type: number, obj: any) { |
||||
return axios({ |
||||
url: '/seller/na/wx/setting/notice/' + targetId + '/' + type, |
||||
method: 'post', |
||||
data: obj |
||||
}); |
||||
} |
||||
|
||||
/* |
||||
* 公告启用 |
||||
*/ |
||||
export function enable(targetId: number | string, type: number, id: number | string, status: number) { |
||||
return axios({ |
||||
url: '/seller/na/wx/setting/notice/' + targetId + '/' + type + '/' + id, |
||||
method: 'put', |
||||
params: { |
||||
status: status |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/* |
||||
* 公告禁用 |
||||
*/ |
||||
export function disable(targetId: number | string, type: number, id: number | string, status: number) { |
||||
return axios({ |
||||
url: '/seller/na/wx/setting/notice/' + targetId + '/' + type + '/' + id, |
||||
method: 'put', |
||||
params: { |
||||
status: status |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/* |
||||
* 公告删除 |
||||
*/ |
||||
export function delNotice(targetId: number | string, type: number, id: number | string) { |
||||
return axios({ |
||||
url: '/seller/na/wx/setting/notice/' + targetId + '/' + type + '/' + id, |
||||
method: 'delete', |
||||
}); |
||||
} |
@ -1,21 +0,0 @@ |
||||
import axios from '../axios'; |
||||
|
||||
/* |
||||
* 金币回显 |
||||
*/ |
||||
export function getCoin(targetId: number|string) { |
||||
return axios({ |
||||
url: '/seller/na/member/gold/coin/gold/coin/' + targetId, |
||||
method: 'get' |
||||
}); |
||||
} |
||||
|
||||
/* |
||||
* 金币添加 |
||||
*/ |
||||
export function addCoin(targetId: number|string, count: number) { |
||||
return axios({ |
||||
url: '/seller/na/member/gold/coin/gold/coin/' + targetId + '/' + count, |
||||
method: 'post', |
||||
}); |
||||
} |
After Width: | Height: | Size: 652 B |
@ -0,0 +1,74 @@ |
||||
import html2canvas from 'html2canvas'; |
||||
import { jsPDF } from 'jspdf'; |
||||
export const downPdf = (title,className) => { |
||||
return new Promise((resolve, reject) => { |
||||
window.scrollTo(0,1); |
||||
// 要导出pdf的节点
|
||||
var elements = document.getElementsByClassName(className); // 需要转换的页面节点
|
||||
var imgMap = new Map(); |
||||
for (var index = 0; index < elements.length; index++) { |
||||
var mapIndex = index; |
||||
html2canvas(elements[index], { |
||||
useCORS: true, // 是否允许网页中img元素跨域,这个设置需要img元素支持及服务器支持
|
||||
scale: 1, // 这个影响生成图片的清晰度
|
||||
// background: "#F5F5F5" //背景
|
||||
}).then((canvas) => { |
||||
var img = new Image(); |
||||
img.setAttribute("crossOrigin", "anonymous"); |
||||
img.width = canvas.width; |
||||
img.height = canvas.height; |
||||
img.src = canvas.toDataURL('image/jpeg', 1.0); |
||||
imgMap.set(mapIndex, img); // 按照顺序保存图片
|
||||
if(imgMap.size == elements.length) { // 当所有图片都转化完毕,则进行保存操作
|
||||
var pdf = new jsPDF('', 'pt', 'a4'); |
||||
for(var i = 0; i < imgMap.size; i++) { |
||||
// canvas尺寸
|
||||
var canvasWidth = imgMap.get(i).width; |
||||
var canvasHeight = imgMap.get(i).height; |
||||
var pageData = imgMap.get(i).src; |
||||
addOneImg(pdf, pageData, canvasWidth, canvasHeight); |
||||
if(i < imgMap.size-1) { |
||||
pdf.addPage(); // 如果还有图片未添加到pdf,则增加一个页面
|
||||
} |
||||
} |
||||
// 所有图片添加完毕,保存
|
||||
pdf.save(title+".pdf"); |
||||
} |
||||
}); |
||||
}; |
||||
return true; |
||||
}); |
||||
} |
||||
|
||||
// 递归的方式对页面进行截取并添加到pdf中
|
||||
var addPages = function (pdf, pageData, position, imgWidth, imgHeight, canvasHeight, pageHeight, a4Height, margin) { |
||||
// pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
|
||||
pdf.addImage(pageData, 'JPEG', margin + 10, position + margin, imgWidth - 2 * margin, imgHeight - 2 * margin); // **改动标注 2**
|
||||
// 减去已经绘制的区域
|
||||
canvasHeight -= pageHeight; |
||||
position -= a4Height; |
||||
// 当还有内容未生成pdf,则新加页面,并添加图片
|
||||
if (canvasHeight > 0) { |
||||
pdf.addPage(); |
||||
addPages(pdf, pageData, position, imgWidth, imgHeight, canvasHeight, pageHeight, a4Height, margin); |
||||
} |
||||
} |
||||
// img转化为pdf并保存
|
||||
var addOneImg = function (pdf, pageData, canvasWidth, canvasHeight) { |
||||
|
||||
// a4纸的尺寸[595.28,841.89]
|
||||
var a4Width = 595.28; |
||||
var a4Height = 841.89; |
||||
|
||||
// 设置页面四周的间距,单位是毫米,10mm是默认间距 // **改动标注 4**
|
||||
var margin = 10; |
||||
|
||||
//html页面生成的canvas在pdf中图片的宽高
|
||||
var imgWidth = a4Width - 2 * margin; // 减去左右的间距 // **改动标注 5**
|
||||
var imgHeight = a4Width / canvasWidth * canvasHeight; |
||||
|
||||
//一页pdf显示html页面生成的canvas高度;
|
||||
var pageHeight = canvasWidth / a4Width * a4Height; |
||||
|
||||
addPages(pdf, pageData, 0, imgWidth, imgHeight, canvasHeight, pageHeight, a4Height, margin); // **改动标注 6**
|
||||
} |
@ -1,181 +0,0 @@ |
||||
import React, { Component } from "react"; |
||||
import { Button, Empty, Modal, notification, Popconfirm } from "antd"; |
||||
import { getSellerId } from 'utils/storage'; |
||||
import { delNotice, disable, enable, getNoticeList } from "api/configuration/announcement"; |
||||
import AnnounceCreate from "./compoents/announceCreate"; |
||||
|
||||
interface States { |
||||
noticeData: any |
||||
visible: boolean |
||||
title: string |
||||
current: any |
||||
} |
||||
|
||||
class Announcement extends Component<any, States> { |
||||
type = 1; // 单店
|
||||
constructor(props: any) { |
||||
super(props); |
||||
this.state = { |
||||
noticeData: undefined, |
||||
visible: false, |
||||
title: '新增公告', |
||||
current: {} |
||||
} |
||||
} |
||||
|
||||
componentDidMount() { |
||||
this.getList() |
||||
} |
||||
|
||||
getList() { |
||||
getNoticeList(getSellerId(), this.type).then((res) => { |
||||
if(res.data){ |
||||
this.setState({ noticeData: res.data[0] }) |
||||
}else{ |
||||
this.setState({ noticeData: undefined }) |
||||
} |
||||
}).catch(() => { }) |
||||
} |
||||
|
||||
getStatusText(status: number): string { |
||||
if (status === 1) { |
||||
return "启用"; |
||||
} else if (status === 0) { |
||||
return "禁用"; |
||||
} else { |
||||
return ''; |
||||
} |
||||
} |
||||
|
||||
handelCreate() { |
||||
this.setState({ visible: true }) |
||||
} |
||||
|
||||
handelUpdate(item: any) { |
||||
this.setState({ |
||||
visible: true, |
||||
title: '编辑公告', |
||||
current: item |
||||
}) |
||||
} |
||||
|
||||
handleEnable(item: any) { |
||||
enable(getSellerId(), this.type, item.id, 1).then((res) => { |
||||
notification.success({ |
||||
message: '成功', |
||||
description: '启用成功' |
||||
}) |
||||
this.getList() |
||||
}).catch(() => { }) |
||||
} |
||||
|
||||
handleDisable(item: any) { |
||||
disable(getSellerId(), this.type, item.id, 0).then((res) => { |
||||
notification.success({ |
||||
message: '成功', |
||||
description: '禁用成功' |
||||
}); |
||||
this.getList() |
||||
}).catch(() => { }) |
||||
} |
||||
|
||||
handleDel(item: any) { |
||||
delNotice(getSellerId(), this.type, item.id).then(res => { |
||||
notification.success({ |
||||
message: '成功', |
||||
description: '删除公告成功', |
||||
}); |
||||
this.getList() |
||||
}).catch(() => { }) |
||||
} |
||||
|
||||
render() { |
||||
const { noticeData, visible, title, current } = this.state; |
||||
const handleCancel = () => { |
||||
this.setState({ visible: false }) |
||||
}; |
||||
|
||||
return ( |
||||
<div className="container"> |
||||
<div className="ikd-page-header"><div className="title">公告管理</div></div> |
||||
{ |
||||
noticeData ? null : |
||||
<Button type="primary" style={{ marginBottom: 15 }} onClick={this.handelCreate.bind(this)}>添加公告</Button> |
||||
} |
||||
<table className="ikd-input-table no-first"> |
||||
<thead> |
||||
<th className="tc" style={{ width: 200 }}>公司标题名称</th> |
||||
<th className="tc" style={{ width: 300 }}>内容</th> |
||||
<th className="tc" style={{ width: 140 }}>发布时间</th> |
||||
<th className="tc" style={{ width: 100 }}>状态</th> |
||||
<th className="tc" style={{ width: 240 }}>操作</th> |
||||
</thead> |
||||
<tbody> |
||||
{ |
||||
noticeData ? |
||||
<tr> |
||||
<td className="tc">{noticeData.name}</td> |
||||
<td className="tc" dangerouslySetInnerHTML={{ __html: noticeData.content }}></td> |
||||
<td className="tc">{noticeData.statusAt ? new Date(noticeData.statusAt * 1000).toLocaleString() : '-----'}</td> |
||||
<td className="tc">{this.getStatusText(noticeData.status)}</td> |
||||
<td className="tc"> |
||||
{ |
||||
noticeData.status === 0 ? |
||||
<Popconfirm |
||||
title="您正在进行启用操作,是否继续进行?" |
||||
onConfirm={() => this.handleEnable(noticeData)} |
||||
okText="确定" |
||||
cancelText="取消"> |
||||
<Button type="link">启用</Button> |
||||
</Popconfirm> : null |
||||
} |
||||
{ |
||||
noticeData.status === 1 ? |
||||
<Popconfirm |
||||
title="禁用后改公告将不再前台展示,是否继续进行?" |
||||
onConfirm={() => this.handleDisable(noticeData)} |
||||
okText="确定" |
||||
cancelText="取消"> |
||||
<Button type="link">禁用</Button> |
||||
</Popconfirm> : null |
||||
} |
||||
{ |
||||
noticeData.status === 0 ? |
||||
<Button type="link" onClick={() => this.handelUpdate(noticeData)}>编辑</Button> : null |
||||
} |
||||
<Popconfirm |
||||
title="此操作将永久删除, 是否继续?" |
||||
onConfirm={() => this.handleDel(noticeData)} |
||||
okText="确定" |
||||
cancelText="取消"> |
||||
<Button type="link">删除</Button> |
||||
</Popconfirm> |
||||
</td> |
||||
</tr> : |
||||
<tr> |
||||
<td colSpan={5}> |
||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> |
||||
</td> |
||||
</tr> |
||||
} |
||||
</tbody> |
||||
</table> |
||||
|
||||
<Modal title={title} |
||||
width={'70%'} |
||||
bodyStyle={{ lineHeight: '2.8' }} |
||||
visible={visible} |
||||
maskClosable={false} |
||||
onCancel={handleCancel} |
||||
footer={null}> |
||||
<AnnounceCreate |
||||
current={current} |
||||
onCancel={() => handleCancel()} |
||||
onData={() => this.getList()} /> |
||||
</Modal> |
||||
</div> |
||||
) |
||||
} |
||||
} |
||||
|
||||
export default Announcement; |
@ -1,101 +0,0 @@ |
||||
import React, { Component } from "react"; |
||||
import { Button, Form, Input, notification } from "antd"; |
||||
import { getSellerId } from 'utils/storage'; |
||||
import { addNotice } from "api/configuration/announcement"; |
||||
import { FormInstance } from "antd/lib/form"; |
||||
import ReactQillWrap from 'components/reactQuill'; |
||||
|
||||
interface Props { |
||||
current?: any |
||||
onCancel: () => void |
||||
onData: () => void |
||||
} |
||||
interface States { |
||||
content: string |
||||
} |
||||
|
||||
class AnnounceCreate extends Component<Props, States>{ |
||||
type = 1; |
||||
reactQuillRef: any = null; |
||||
form = React.createRef<FormInstance>() |
||||
constructor(props: Props) { |
||||
super(props); |
||||
this.state = { |
||||
content: '' |
||||
} |
||||
} |
||||
|
||||
componentDidMount() { |
||||
const currentItem = this.props.current; |
||||
if (currentItem) { |
||||
this.form.current?.setFieldsValue({ |
||||
name: currentItem.name, |
||||
content: currentItem.content |
||||
}) |
||||
} |
||||
} |
||||
|
||||
handleChange(value: string) { |
||||
this.setState({ content: value }) |
||||
} |
||||
|
||||
render() { |
||||
const layout = { |
||||
labelCol: { span: 3 }, |
||||
wrapperCol: { span: 21 }, |
||||
}; |
||||
const tailLayout = { |
||||
wrapperCol: { offset: 20, span: 4 }, |
||||
}; |
||||
|
||||
const onFinish = (values: any) => { |
||||
let msg: string; |
||||
const obj = { targetId: getSellerId(), type: this.type, ...values } |
||||
if (this.props.current) { |
||||
msg = '更新公告成功' |
||||
} else { |
||||
msg = '添加公告成功' |
||||
} |
||||
addNotice(getSellerId(), this.type, obj).then(res => { |
||||
notification.success({ |
||||
message:'成功', |
||||
description: msg |
||||
}) |
||||
this.props.onCancel(); |
||||
this.props.onData(); |
||||
}).catch(() => { }) |
||||
} |
||||
|
||||
return ( |
||||
<Form |
||||
{...layout} |
||||
ref={this.form} |
||||
onFinish={onFinish}> |
||||
<Form.Item |
||||
label="公司标题名称" |
||||
name="name" |
||||
rules={[{ required: true }]}> |
||||
<Input className="w300" placeholder="15个字以内" /> |
||||
</Form.Item> |
||||
<Form.Item |
||||
label="公司内容" |
||||
name="content" |
||||
initialValue="" |
||||
rules={[{ required: true }]} |
||||
> |
||||
<ReactQillWrap value={this.state.content} onChange={this.handleChange.bind(this)} /> |
||||
</Form.Item> |
||||
<Form.Item {...tailLayout}> |
||||
<Button onClick={() => this.props.onCancel()}>取消</Button> |
||||
{ |
||||
this.props.current ? |
||||
<Button className="ml20" type="primary" htmlType="submit">保存</Button> : |
||||
<Button className="ml20" type="primary" htmlType="submit">确定</Button> |
||||
} |
||||
</Form.Item> |
||||
</Form> |
||||
) |
||||
} |
||||
} |
||||
|
||||
export default AnnounceCreate; |
@ -1,73 +0,0 @@ |
||||
import React, { Component } from 'react'; |
||||
import { Form, Input, Button, notification } from 'antd'; |
||||
import { getSellerId } from 'utils/storage'; |
||||
import { getCoin, addCoin } from 'api/configuration/gold'; |
||||
class Gold extends Component<any, any> { |
||||
componentDidMount() { |
||||
this.getCoin() |
||||
} |
||||
//金币配置回显
|
||||
getCoin() { |
||||
getCoin(getSellerId()).then(res => { |
||||
const [form] = Form.useForm(); |
||||
const { coinCredit, coinMoney } = res.data; |
||||
form.setFieldsValue({ |
||||
coinCredit, |
||||
coinMoney |
||||
}) |
||||
}) |
||||
} |
||||
render() { |
||||
const layout = { |
||||
labelCol: { span: 3 }, |
||||
wrapperCol: { span: 21 }, |
||||
}; |
||||
const onFinish = (values: object) => { |
||||
console.log(JSON.parse(JSON.stringify(values))) |
||||
const { coinCredit } = JSON.parse(JSON.stringify(values)) |
||||
addCoin(getSellerId(), coinCredit).then((res: any) => { |
||||
notification.open({ |
||||
message: '成功', |
||||
description: '登录成功', |
||||
type: 'success' |
||||
}) |
||||
}).catch(() => { }) |
||||
}; |
||||
const onFinishFailed = (errorInfo: object) => { |
||||
console.log('Failed:', errorInfo); |
||||
}; |
||||
return ( |
||||
<div className="container"> |
||||
<div className="ikd-page-header"><div className="title">金币规则配置</div></div> |
||||
<Form |
||||
{...layout} |
||||
name="basic" |
||||
labelAlign="left" |
||||
onFinish={onFinish} |
||||
onFinishFailed={onFinishFailed}> |
||||
<h3 style={{ margin: '15px 0 20px 20px' }}>1、金币兑换积分规则</h3> |
||||
<Form.Item |
||||
label="1金币 = ?积分" |
||||
className="ml20" |
||||
name="coinCredit" |
||||
rules={[{ required: true }]}> |
||||
<Input className="w200" placeholder="请输入" suffix="积分" /> |
||||
</Form.Item> |
||||
<h3 style={{ margin: '0 0 20px 20px' }}>2、金币提现规则</h3> |
||||
<Form.Item |
||||
label="1金币 = ?元" |
||||
className="ml20" |
||||
name="coinMoney" |
||||
rules={[{ required: true }]}> |
||||
<Input className="w200" placeholder="请输入" suffix="元" disabled /> |
||||
</Form.Item> |
||||
<Form.Item> |
||||
<Button className="ml20" shape="round" type="primary" htmlType="submit">保存</Button> |
||||
</Form.Item> |
||||
</Form> |
||||
</div> |
||||
) |
||||
} |
||||
} |
||||
|
||||
export default Gold; |
@ -0,0 +1,252 @@ |
||||
import React, { useState, useEffect } from 'react'; |
||||
import {Table, Button, Spin, Radio, DatePicker, Select, Form, Modal} from 'antd'; |
||||
import {getServiceStatPage} from "../../api/statistical"; |
||||
import type { RadioChangeEvent } from 'antd'; |
||||
import {dictionary} from "../../api/dict"; |
||||
import {serverUrl} from "../../api/axios"; |
||||
|
||||
interface Enterprise { |
||||
key: string; |
||||
policyNumber: string; |
||||
insuranceName: string; |
||||
serviceStatusName: string; |
||||
remarks: string; |
||||
} |
||||
|
||||
interface FormData { |
||||
num: number; |
||||
page: number; |
||||
} |
||||
|
||||
const App: React.FC = () => { |
||||
|
||||
const [data, setData] = useState<Enterprise[]>([]); |
||||
const [loading, setLoading] = useState<boolean>(false); |
||||
const [query, setQuery] = useState<FormData | null>(null); |
||||
const [total, setTotal] = useState<number | null>(0); |
||||
const [dictData, setDictData] = useState<any>([]); |
||||
const [form] = Form.useForm(); |
||||
|
||||
useEffect(() => { |
||||
const query = {page: 1, num: 20}; |
||||
setQuery(query); |
||||
getListApi({}, query.page, query.num) |
||||
dictionary('service_status').then((res) => { |
||||
if(res.data){ |
||||
const formattedData = res.data.map((item: { dictValue: any; dictKey: any; }) => ({ |
||||
label: item.dictValue, |
||||
value: item.dictKey |
||||
})); |
||||
setDictData(formattedData) |
||||
} |
||||
}) |
||||
}, []); |
||||
|
||||
const columns: any = [ |
||||
{ |
||||
title: '序号', |
||||
dataIndex: 'key', |
||||
width: 50, |
||||
align: 'center', |
||||
render: (text: string, record: any, index: number) => index + 1 |
||||
}, |
||||
{ |
||||
title: '保单号', |
||||
dataIndex: 'policyNumber', |
||||
align: 'center', |
||||
key: 'policyNumber', |
||||
}, |
||||
{ |
||||
title: '归属中支', |
||||
dataIndex: 'insuranceName', |
||||
align: 'center', |
||||
key: 'insuranceName', |
||||
}, |
||||
{ |
||||
title: '事故预防状态', |
||||
dataIndex: 'serviceStatusName', |
||||
align: 'center', |
||||
key: 'serviceStatusName', |
||||
}, |
||||
{ |
||||
title: '备注', |
||||
dataIndex: 'remarks', |
||||
align: 'center', |
||||
key: 'remarks', |
||||
} |
||||
]; |
||||
|
||||
// 多少每页
|
||||
const selectChange = (page: number, num: number) => { |
||||
const query = { page, num } |
||||
setQuery(query); |
||||
getListApi({}, query.page, query.num) |
||||
} |
||||
|
||||
// 条数切换
|
||||
const changePage = (current: number, pageSize?: number) => { |
||||
const query = { page: current, num: pageSize || 20 } |
||||
setTimeout(() => { |
||||
setQuery(query); |
||||
getListApi({}, query.page, query.num) |
||||
}, 0) |
||||
} |
||||
|
||||
// 列表接口
|
||||
const getListApi = (formData: object, page: number, num: number) => { |
||||
setLoading(true); |
||||
var formObj = JSON.parse(JSON.stringify(formData)); |
||||
getServiceStatPage(formObj, page, num).then(res => { |
||||
setData(res.data.records); |
||||
setTotal(res.data.total); |
||||
setLoading(false); |
||||
}).catch(() => { }) |
||||
} |
||||
|
||||
const onChange = (e: RadioChangeEvent) => { |
||||
console.log(`radio checked:${e.target.value}`); |
||||
}; |
||||
|
||||
const onReset = () => { |
||||
const form = formRef.current; |
||||
form.resetFields(); |
||||
}; |
||||
|
||||
const formRef = React.createRef<any>(); |
||||
|
||||
const { RangePicker } = DatePicker; |
||||
|
||||
const onFinish = (values: object) => { |
||||
const form = formRef.current; |
||||
const safeQuery = query ?? {page: 1, num: 20}; |
||||
getListApi({ |
||||
dateFilter: form.getFieldValue('dateFilter'), |
||||
startDate: form.getFieldValue('selectDateTime') ? formatDate(form.getFieldValue('selectDateTime')[0]) : null, |
||||
doneDate: form.getFieldValue('selectDateTime') ? formatDate(form.getFieldValue('selectDateTime')[1]) : null, |
||||
serviceStatus: form.getFieldValue('serviceStatus') |
||||
}, safeQuery.page, safeQuery.num) |
||||
} |
||||
|
||||
const goExport = () => { |
||||
showModal(); |
||||
} |
||||
|
||||
const [isModalOpen, setIsModalOpen] = useState(false); |
||||
|
||||
const showModal = () => { |
||||
setIsModalOpen(true); |
||||
}; |
||||
|
||||
const formatDate = (dateString: string | number | Date) => { |
||||
const date = new Date(dateString); |
||||
const year = date.getFullYear(); |
||||
const month = String(date.getMonth() + 1).padStart(2, '0'); |
||||
const day = String(date.getDate()).padStart(2, '0'); |
||||
const hours = String(date.getHours()).padStart(2, '0'); |
||||
const minutes = String(date.getMinutes()).padStart(2, '0'); |
||||
const seconds = String(date.getSeconds()).padStart(2, '0'); |
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
||||
} |
||||
|
||||
|
||||
const handleOk = () => { |
||||
const params = {}; |
||||
const dateFilter = form.getFieldValue('dateFilter'); |
||||
if (dateFilter) { |
||||
params['dateFilter'] = dateFilter; |
||||
} |
||||
const selectDateTime = form.getFieldValue('selectDateTime'); |
||||
if (selectDateTime && selectDateTime[0]) { |
||||
console.log(selectDateTime) |
||||
params['startDate'] = formatDate(selectDateTime[0]); |
||||
} |
||||
if (selectDateTime && selectDateTime[1]) { |
||||
params['doneDate'] = formatDate(selectDateTime[1]); |
||||
} |
||||
const serviceStatus = form.getFieldValue('serviceStatus'); |
||||
if (serviceStatus) { |
||||
params['serviceStatus'] = serviceStatus; |
||||
} |
||||
const urlParams = new URLSearchParams(params).toString(); |
||||
window.open(serverUrl + `./ex/statistics/exportServiceStatList?` + urlParams); |
||||
setIsModalOpen(false); |
||||
}; |
||||
|
||||
const handleCancel = () => { |
||||
setIsModalOpen(false); |
||||
}; |
||||
|
||||
return ( |
||||
<div className="container"> |
||||
<div> |
||||
<div className="list-filter" style={{display: 'flex'}}> |
||||
<Form |
||||
form={form} |
||||
ref={formRef} |
||||
className="filter" |
||||
layout="inline" |
||||
name="basic" |
||||
onFinish={onFinish} |
||||
> |
||||
<Form.Item label="" name="dateFilter"> |
||||
<Radio.Group onChange={onChange}> |
||||
<Radio.Button value="lastWeek">近一周</Radio.Button> |
||||
<Radio.Button value="lastMonth">近一月</Radio.Button> |
||||
<Radio.Button value="last3Months">近三月</Radio.Button> |
||||
</Radio.Group> |
||||
</Form.Item> |
||||
<Form.Item label="保单数据日期" name="selectDateTime"> |
||||
<RangePicker showTime style={{ width: 350 }} onChange={(value, dateString) => {}}/> |
||||
</Form.Item> |
||||
<Form.Item label="事故预防状态" name="serviceStatus"> |
||||
<Select |
||||
style={{ width: 280 }} |
||||
allowClear |
||||
options={ dictData } |
||||
placeholder="全部" |
||||
/> |
||||
</Form.Item> |
||||
<Form.Item> |
||||
<Button htmlType="button" onClick={onReset}> |
||||
重置 |
||||
</Button> |
||||
</Form.Item> |
||||
<Form.Item> |
||||
<Button type="primary" htmlType="submit">搜索</Button> |
||||
</Form.Item> |
||||
</Form> |
||||
</div> |
||||
<Button type="primary" style={{ marginBottom: 10, float: 'right' }} onClick={goExport}>导出</Button> |
||||
{loading ? ( |
||||
<Spin tip="Loading..." /> |
||||
) : ( |
||||
<Table |
||||
dataSource={data} |
||||
columns={columns} |
||||
rowKey="key" |
||||
loading={loading} |
||||
bordered={true} |
||||
size={'small'} |
||||
pagination={{ |
||||
total: total || 0, |
||||
current: query?.page || 1, |
||||
pageSize: query?.num || 10, |
||||
showQuickJumper: true, |
||||
showSizeChanger: true, |
||||
showTotal: total => `共 ${total} 条`, |
||||
onShowSizeChange: selectChange, |
||||
onChange: changePage |
||||
}} |
||||
scroll={{ y: 500 }} |
||||
sticky |
||||
/> |
||||
)} |
||||
</div> |
||||
<Modal title="提示" open={isModalOpen} onOk={handleOk} onCancel={handleCancel} centered width={400}> |
||||
<p>确定要导出文件?</p> |
||||
</Modal> |
||||
</div> |
||||
); |
||||
}; |
||||
|
||||
export default App; |
Loading…
Reference in new issue