taskCount.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. import React from 'react';
  2. import { Radio, Icon, Button, AutoComplete,Cascader,Input, Select, Spin, Popconfirm, Table, Switch, message,Calendar , DatePicker, Upload, Form ,Modal,Tabs,Card ,Col} from 'antd';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import Jquery from 'jquery/dist/jquery.js';
  6. import moment from 'moment';
  7. import {boutique } from '@/dataDic.js';
  8. import { getLiquidationStatus,getApprovedState,getProcessStatus,splitUrl,getjiedian,getboutique,getNewOrderStatus,getProjectStatus} from '@/tools.js';
  9. const TabPane = Tabs.TabPane;
  10. const Dragger = Upload.Dragger;
  11. //图片组件
  12. const PicturesWall = React.createClass({
  13. getInitialState() {
  14. return {
  15. previewVisible: false,
  16. previewImage: '',
  17. fileList: [],
  18. }
  19. },
  20. handleCancel() {
  21. this.setState({
  22. previewVisible: false
  23. })
  24. },
  25. handlePreview(file) {
  26. this.setState({
  27. previewImage: file.url || file.thumbUrl,
  28. previewVisible: true,
  29. });
  30. },
  31. handleChange(info) {
  32. let fileList = info.fileList;
  33. this.setState({
  34. fileList
  35. });
  36. this.props.fileList(fileList);
  37. },
  38. componentWillReceiveProps(nextProps) {
  39. this.state.fileList = nextProps.pictureUrl;
  40. this.state.pojectApplicationUrl = undefined;
  41. },
  42. render() {
  43. const {
  44. previewVisible,
  45. previewImage,
  46. fileList
  47. } = this.state;
  48. const uploadButton = (
  49. <div>
  50. <Icon type="plus" />
  51. <div className="ant-upload-text">点击上传</div>
  52. </div>
  53. );
  54. return(
  55. <div style={{display:"inline-block"}}>
  56. <Upload
  57. action={globalConfig.context + "/api/admin/customer/uploadCustomerImg"}
  58. data={{ 'sign': '' }}
  59. listType="picture-card"
  60. fileList={fileList}
  61. onPreview={this.handlePreview}
  62. onChange={this.handleChange} >
  63. {fileList.length >= 1 ? null : uploadButton}
  64. </Upload>
  65. <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
  66. <img alt="example" style={{ width: '100%' }} src={previewImage} />
  67. </Modal>
  68. </div>
  69. );
  70. }
  71. });
  72. const IntentionCustomer = Form.create()(React.createClass({
  73. loadData(pageNo, apiUrl) {
  74. this.setState({
  75. visitModul:false,
  76. loading: true,
  77. ispage:pageNo,
  78. modalVisible:false
  79. });
  80. $.ajax({
  81. method: "get",
  82. dataType: "json",
  83. crossDomain: false,
  84. url: globalConfig.context +"/api/admin/orderProject/taskHoursList",
  85. data: {
  86. pageNo: pageNo || 1,
  87. pageSize: this.state.pagination.pageSize,
  88. name: this.state.customerName,//名称
  89. taskId: this.state.orderNo,//订单编号
  90. starTime: this.state.releaseDate[0],//开始时间
  91. endTime: this.state.releaseDate[1],//结束时间
  92. },
  93. success: function(data) {
  94. let theArr = [];
  95. if(data.error.length || data.data.list == "") {
  96. if(data.error && data.error.length) {
  97. message.warning(data.error[0].message);
  98. };
  99. } else {
  100. for(let i = 0; i < data.data.list.length; i++) {
  101. let thisdata = data.data.list[i];
  102. theArr.push({
  103. key: i,
  104. id:thisdata.id,//ID
  105. orderNo: thisdata.orderNo,//订单编号
  106. taskName:thisdata.taskName,//任务名称
  107. userName:thisdata.userName,//客户名称
  108. cname:thisdata.cname,//项目品类
  109. taskStatus:thisdata.taskStatus,//任务状态
  110. receiverName:thisdata.receiverName,//负责人
  111. hours:thisdata.hours,//任务工时
  112. depName:thisdata.depName,//派单公司
  113. });
  114. };
  115. this.state.pagination.total = data.data.totalCount;
  116. };
  117. if(data.data&&data.data.list&&!data.data.list.length){
  118. this.state.pagination.total=0
  119. }
  120. this.setState({
  121. dataSource: theArr,
  122. pageNo: pageNo,
  123. pagination: this.state.pagination,
  124. selectedRowKeys:[]
  125. });
  126. }.bind(this),
  127. }).always(function() {
  128. this.setState({
  129. loading: false
  130. });
  131. }.bind(this));
  132. },
  133. getInitialState() {
  134. return {
  135. page:1,
  136. releaseDate: [],
  137. selectedRowKeys: [],
  138. orgCodeUrl:[],
  139. paginations:false,
  140. pagination: {
  141. defaultCurrent: 1,
  142. defaultPageSize: 10,
  143. showQuickJumper: true,
  144. pageSize: 10,
  145. onChange: function(page) {
  146. this.loadData(page);
  147. }.bind(this),
  148. showTotal: function(total) {
  149. return '共' + total + '条数据';
  150. }
  151. },
  152. columns: [
  153. {
  154. title: '任务编号',
  155. dataIndex: 'id',
  156. key: 'id'
  157. },{
  158. title: '任务名称',
  159. dataIndex: 'taskName',
  160. key: 'taskName'
  161. },{
  162. title: '订单编号',
  163. dataIndex: 'orderNo',
  164. key: 'orderNo'
  165. }, {
  166. title: '业务类别',
  167. dataIndex: 'cname',
  168. key: 'cname'
  169. },{
  170. title: '客户名称',
  171. dataIndex: 'userName',
  172. key: 'userName',
  173. render:(text)=>{
  174. return (text&&text.length>9?text.substr(0,9)+'...':text)
  175. }
  176. },{
  177. title: '任务负责人',
  178. dataIndex: 'receiverName',
  179. key: 'receiverName'
  180. },{
  181. title: '派单公司',
  182. dataIndex: 'depName',
  183. key: 'depName'
  184. },{
  185. title: '任务状态',
  186. dataIndex: 'taskStatus',
  187. key: 'taskStatus',
  188. render:text=>{return getNewOrderStatus(text)}
  189. }, {
  190. title: '工时',
  191. dataIndex: 'hours',
  192. key: 'hours'
  193. }
  194. ],
  195. data: [],
  196. dataSource: [],
  197. columnsX: [
  198. {
  199. title: '催款人',
  200. dataIndex: 'dumBy',
  201. key: 'dumBy'
  202. }, {
  203. title: '催款时间',
  204. dataIndex: 'dumTime',
  205. key: 'dumTime',
  206. },{
  207. title: '催款情况',
  208. dataIndex: 'remarks',
  209. key: 'remarks'
  210. }
  211. ],
  212. dataSources: [],
  213. }
  214. },
  215. //页面加载函数
  216. componentWillMount() {
  217. this.loadData();
  218. },
  219. // //整行点击
  220. tableRowClick(record, index) {
  221. this.setState({
  222. visibles:true,
  223. });
  224. this.loadDatas(record.id);
  225. },
  226. //关闭输入理由框
  227. noCancel(){
  228. this.setState({
  229. noVisible:false
  230. })
  231. },
  232. //搜索
  233. search() {
  234. this.setState({
  235. //signBillVisible:false
  236. })
  237. this.loadData();
  238. },
  239. //重置
  240. reset() {
  241. this.setState({
  242. signBillVisible:false
  243. })
  244. this.state.orderNo='';
  245. this.state.customerName='';
  246. this.state.releaseDate[0] = undefined;
  247. this.state.releaseDate[1] = undefined;
  248. this.loadData(this.state.page);
  249. },
  250. resets(){
  251. this.state.orderNo='';
  252. this.state.customerName='';
  253. this.state.releaseDate[0] = undefined;
  254. this.state.releaseDate[1] = undefined;
  255. },
  256. getOrgCodeUrl(e) {
  257. this.setState({ orgCodeUrl: e });
  258. },
  259. //关闭详情
  260. visitCancel(e){
  261. this.setState({
  262. visible:false
  263. })
  264. this.resets();
  265. },
  266. visitOk(e){
  267. this.setState({
  268. visible:false
  269. })
  270. this.resets();
  271. },
  272. //关闭详情
  273. visitCancels(e){
  274. this.setState({
  275. visibles:false
  276. })
  277. this.resets();
  278. },
  279. //导出
  280. exportExec(){
  281. var data = {
  282. name: this.state.customerName?this.state.customerName:undefined,//订单负责人
  283. taskId: this.state.orderNo?this.state.orderNo:undefined,//订单编号
  284. starTime: this.state.releaseDate[0]?this.state.releaseDate[0]:undefined,
  285. endTime: this.state.releaseDate[1]?this.state.releaseDate[1]:undefined,
  286. }
  287. window.location.href=(globalConfig.context+'/api/admin/orderProject/exportTaskHoursListData?'+$.param(data));
  288. },
  289. visitOks(e){
  290. this.setState({
  291. visibles:false
  292. })
  293. this.resets();
  294. },
  295. render() {
  296. const formItemLayout = {
  297. labelCol: { span: 8 },
  298. wrapperCol: { span: 14 },
  299. };
  300. const FormItem = Form.Item;
  301. const { RangePicker } = DatePicker;
  302. const rowSelection = {
  303. selectedRowKeys: this.state.selectedRowKeys,
  304. onChange: (selectedRowKeys, selectedRows) => {
  305. this.setState({
  306. modalVisible:false,
  307. selectedRows: selectedRows.slice(-1),
  308. selectedRowKeys: selectedRowKeys.slice(-1)
  309. });
  310. },
  311. onSelect: (recordt, selected, selectedRows) => {
  312. this.setState({
  313. modalVisible:false,
  314. recordt: recordt.id
  315. })
  316. },
  317. };
  318. const hasSelected = this.state.selectedRowKeys.length > 0;
  319. return(
  320. <div className="user-content">
  321. <div className="content-title">
  322. <span>工时数据统计</span>
  323. </div>
  324. <div className="user-search">
  325. <Button type="primary" onClick={this.exportExec} style={{float:'right'}}>导出工时数据</Button>
  326. <Input placeholder="客户名称" style={{width:'150px',marginBottom:'10px'}}
  327. value={this.state.customerName}
  328. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  329. <Input placeholder="任务编号" style={{width:'150px'}}
  330. value={this.state.orderNo}
  331. onChange={(e) => { this.setState({ orderNo: e.target.value }); }} />
  332. <span style={{marginRight:"10px"}}>合同签订时间 :</span>
  333. <RangePicker
  334. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  335. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  336. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  337. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
  338. <Button onClick={this.reset}>重置</Button>
  339. <div className="patent-table">
  340. <Spin spinning={this.state.loading}>
  341. <Table columns={this.state.columns}
  342. dataSource={this.state.dataSource}
  343. rowSelection={rowSelection}
  344. pagination={this.state.pagination}
  345. />
  346. </Spin>
  347. </div>
  348. </div>
  349. </div>
  350. );
  351. }
  352. }));
  353. export default IntentionCustomer;