123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372 |
- import React from 'react';
- import { Radio, Icon, Button, AutoComplete,Cascader,Input, Select, Spin, Popconfirm, Table, Switch, message,Calendar , DatePicker, Upload, Form ,Modal,Tabs,Card ,Col} from 'antd';
- import ajax from 'jquery/src/ajax/xhr.js';
- import $ from 'jquery/src/ajax';
- import Jquery from 'jquery/dist/jquery.js';
- import moment from 'moment';
- import {boutique } from '@/dataDic.js';
- import { getLiquidationStatus,getApprovedState,getProcessStatus,splitUrl,getjiedian,getboutique,getNewOrderStatus,getProjectStatus} from '@/tools.js';
- const TabPane = Tabs.TabPane;
- const Dragger = Upload.Dragger;
- //图片组件
- const PicturesWall = React.createClass({
- getInitialState() {
- return {
- previewVisible: false,
- previewImage: '',
- fileList: [],
- }
- },
- handleCancel() {
- this.setState({
- previewVisible: false
- })
- },
- handlePreview(file) {
- this.setState({
- previewImage: file.url || file.thumbUrl,
- previewVisible: true,
- });
- },
- handleChange(info) {
- let fileList = info.fileList;
- this.setState({
- fileList
- });
- this.props.fileList(fileList);
- },
- componentWillReceiveProps(nextProps) {
- this.state.fileList = nextProps.pictureUrl;
- this.state.pojectApplicationUrl = undefined;
- },
- render() {
- const {
- previewVisible,
- previewImage,
- fileList
- } = this.state;
- const uploadButton = (
- <div>
- <Icon type="plus" />
- <div className="ant-upload-text">点击上传</div>
- </div>
- );
- return(
- <div style={{display:"inline-block"}}>
- <Upload
- action={globalConfig.context + "/api/admin/customer/uploadCustomerImg"}
- data={{ 'sign': '' }}
- listType="picture-card"
- fileList={fileList}
- onPreview={this.handlePreview}
- onChange={this.handleChange} >
- {fileList.length >= 1 ? null : uploadButton}
- </Upload>
- <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
- <img alt="example" style={{ width: '100%' }} src={previewImage} />
- </Modal>
- </div>
- );
- }
- });
- const IntentionCustomer = Form.create()(React.createClass({
- loadData(pageNo, apiUrl) {
- this.setState({
- visitModul:false,
- loading: true,
- ispage:pageNo,
- modalVisible:false
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context +"/api/admin/orderProject/taskHoursList",
- data: {
- pageNo: pageNo || 1,
- pageSize: this.state.pagination.pageSize,
- name: this.state.customerName,//名称
- taskId: this.state.orderNo,//订单编号
- starTime: this.state.releaseDate[0],//开始时间
- endTime: this.state.releaseDate[1],//结束时间
- },
- success: function(data) {
- let theArr = [];
- if(data.error.length || data.data.list == "") {
- if(data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- } else {
- for(let i = 0; i < data.data.list.length; i++) {
- let thisdata = data.data.list[i];
- theArr.push({
- key: i,
- id:thisdata.id,//ID
- orderNo: thisdata.orderNo,//订单编号
- taskName:thisdata.taskName,//任务名称
- userName:thisdata.userName,//客户名称
- cname:thisdata.cname,//项目品类
- taskStatus:thisdata.taskStatus,//任务状态
- receiverName:thisdata.receiverName,//负责人
- hours:thisdata.hours,//任务工时
- depName:thisdata.depName,//派单公司
- });
- };
- this.state.pagination.total = data.data.totalCount;
- };
- if(data.data&&data.data.list&&!data.data.list.length){
- this.state.pagination.total=0
- }
- this.setState({
- dataSource: theArr,
- pageNo: pageNo,
- pagination: this.state.pagination,
- selectedRowKeys:[]
- });
- }.bind(this),
- }).always(function() {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
-
- getInitialState() {
- return {
- page:1,
- releaseDate: [],
- selectedRowKeys: [],
- orgCodeUrl:[],
- paginations:false,
- pagination: {
- defaultCurrent: 1,
- defaultPageSize: 10,
- showQuickJumper: true,
- pageSize: 10,
- onChange: function(page) {
- this.loadData(page);
- }.bind(this),
- showTotal: function(total) {
- return '共' + total + '条数据';
- }
- },
- columns: [
- {
- title: '任务编号',
- dataIndex: 'id',
- key: 'id'
- },{
- title: '任务名称',
- dataIndex: 'taskName',
- key: 'taskName'
- },{
- title: '订单编号',
- dataIndex: 'orderNo',
- key: 'orderNo'
- }, {
- title: '业务类别',
- dataIndex: 'cname',
- key: 'cname'
- },{
- title: '客户名称',
- dataIndex: 'userName',
- key: 'userName',
- render:(text)=>{
- return (text&&text.length>9?text.substr(0,9)+'...':text)
- }
- },{
- title: '任务负责人',
- dataIndex: 'receiverName',
- key: 'receiverName'
- },{
- title: '派单公司',
- dataIndex: 'depName',
- key: 'depName'
- },{
- title: '任务状态',
- dataIndex: 'taskStatus',
- key: 'taskStatus',
- render:text=>{return getNewOrderStatus(text)}
- }, {
- title: '工时',
- dataIndex: 'hours',
- key: 'hours'
- }
- ],
- data: [],
- dataSource: [],
- columnsX: [
- {
- title: '催款人',
- dataIndex: 'dumBy',
- key: 'dumBy'
- }, {
- title: '催款时间',
- dataIndex: 'dumTime',
- key: 'dumTime',
-
- },{
- title: '催款情况',
- dataIndex: 'remarks',
- key: 'remarks'
- }
- ],
- dataSources: [],
-
- }
- },
-
- //页面加载函数
- componentWillMount() {
- this.loadData();
- },
- // //整行点击
- tableRowClick(record, index) {
- this.setState({
- visibles:true,
- });
- this.loadDatas(record.id);
- },
-
-
-
-
-
-
- //关闭输入理由框
- noCancel(){
- this.setState({
- noVisible:false
- })
- },
- //搜索
- search() {
- this.setState({
- //signBillVisible:false
- })
- this.loadData();
- },
- //重置
- reset() {
- this.setState({
- signBillVisible:false
- })
- this.state.orderNo='';
- this.state.customerName='';
- this.state.releaseDate[0] = undefined;
- this.state.releaseDate[1] = undefined;
- this.loadData(this.state.page);
- },
- resets(){
- this.state.orderNo='';
- this.state.customerName='';
- this.state.releaseDate[0] = undefined;
- this.state.releaseDate[1] = undefined;
- },
- getOrgCodeUrl(e) {
- this.setState({ orgCodeUrl: e });
- },
- //关闭详情
- visitCancel(e){
- this.setState({
- visible:false
- })
- this.resets();
- },
- visitOk(e){
- this.setState({
- visible:false
- })
- this.resets();
- },
- //关闭详情
- visitCancels(e){
- this.setState({
- visibles:false
- })
- this.resets();
- },
- //导出
- exportExec(){
- var data = {
- name: this.state.customerName?this.state.customerName:undefined,//订单负责人
- taskId: this.state.orderNo?this.state.orderNo:undefined,//订单编号
- starTime: this.state.releaseDate[0]?this.state.releaseDate[0]:undefined,
- endTime: this.state.releaseDate[1]?this.state.releaseDate[1]:undefined,
- }
- window.location.href=(globalConfig.context+'/api/admin/orderProject/exportTaskHoursListData?'+$.param(data));
- },
- visitOks(e){
- this.setState({
- visibles:false
- })
- this.resets();
- },
- render() {
- const formItemLayout = {
- labelCol: { span: 8 },
- wrapperCol: { span: 14 },
- };
- const FormItem = Form.Item;
- const { RangePicker } = DatePicker;
- const rowSelection = {
- selectedRowKeys: this.state.selectedRowKeys,
- onChange: (selectedRowKeys, selectedRows) => {
- this.setState({
- modalVisible:false,
- selectedRows: selectedRows.slice(-1),
- selectedRowKeys: selectedRowKeys.slice(-1)
- });
- },
- onSelect: (recordt, selected, selectedRows) => {
- this.setState({
- modalVisible:false,
- recordt: recordt.id
- })
- },
- };
- const hasSelected = this.state.selectedRowKeys.length > 0;
- return(
- <div className="user-content">
- <div className="content-title">
- <span>工时数据统计</span>
- </div>
- <div className="user-search">
- <Button type="primary" onClick={this.exportExec} style={{float:'right'}}>导出工时数据</Button>
- <Input placeholder="客户名称" style={{width:'150px',marginBottom:'10px'}}
- value={this.state.customerName}
- onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
- <Input placeholder="任务编号" style={{width:'150px'}}
- value={this.state.orderNo}
- onChange={(e) => { this.setState({ orderNo: e.target.value }); }} />
- <span style={{marginRight:"10px"}}>合同签订时间 :</span>
- <RangePicker
- value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
- this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
- onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
- <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
- <Button onClick={this.reset}>重置</Button>
- <div className="patent-table">
- <Spin spinning={this.state.loading}>
- <Table columns={this.state.columns}
- dataSource={this.state.dataSource}
- rowSelection={rowSelection}
- pagination={this.state.pagination}
- />
- </Spin>
- </div>
- </div>
- </div>
- );
- }
- }));
- export default IntentionCustomer;
|