taskCount.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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. },
  91. success: function(data) {
  92. let theArr = [];
  93. if(data.error.length || data.data.list == "") {
  94. if(data.error && data.error.length) {
  95. message.warning(data.error[0].message);
  96. };
  97. } else {
  98. for(let i = 0; i < data.data.list.length; i++) {
  99. let thisdata = data.data.list[i];
  100. theArr.push({
  101. key: i,
  102. id:thisdata.id,//ID
  103. orderNo: thisdata.orderNo,//订单编号
  104. taskName:thisdata.taskName,//任务名称
  105. userName:thisdata.userName,//客户名称
  106. cname:thisdata.cname,//项目品类
  107. taskStatus:thisdata.taskStatus,//任务状态
  108. receiverName:thisdata.receiverName,//负责人
  109. hours:thisdata.hours,//任务工时
  110. depName:thisdata.depName,//派单公司
  111. });
  112. };
  113. this.state.pagination.total = data.data.totalCount;
  114. };
  115. if(data.data&&data.data.list&&!data.data.list.length){
  116. this.state.pagination.total=0
  117. }
  118. this.setState({
  119. dataSource: theArr,
  120. pageNo: pageNo,
  121. pagination: this.state.pagination,
  122. selectedRowKeys:[]
  123. });
  124. }.bind(this),
  125. }).always(function() {
  126. this.setState({
  127. loading: false
  128. });
  129. }.bind(this));
  130. },
  131. getInitialState() {
  132. return {
  133. page:1,
  134. releaseDate: [],
  135. selectedRowKeys: [],
  136. orgCodeUrl:[],
  137. paginations:false,
  138. pagination: {
  139. defaultCurrent: 1,
  140. defaultPageSize: 10,
  141. showQuickJumper: true,
  142. pageSize: 10,
  143. onChange: function(page) {
  144. this.loadData(page);
  145. }.bind(this),
  146. showTotal: function(total) {
  147. return '共' + total + '条数据';
  148. }
  149. },
  150. columns: [
  151. {
  152. title: '任务编号',
  153. dataIndex: 'id',
  154. key: 'id'
  155. },{
  156. title: '任务名称',
  157. dataIndex: 'taskName',
  158. key: 'taskName'
  159. },{
  160. title: '订单编号',
  161. dataIndex: 'orderNo',
  162. key: 'orderNo'
  163. }, {
  164. title: '业务类别',
  165. dataIndex: 'cname',
  166. key: 'cname'
  167. },{
  168. title: '客户名称',
  169. dataIndex: 'userName',
  170. key: 'userName',
  171. render:(text)=>{
  172. return (text&&text.length>9?text.substr(0,9)+'...':text)
  173. }
  174. },{
  175. title: '任务负责人',
  176. dataIndex: 'receiverName',
  177. key: 'receiverName'
  178. },{
  179. title: '派单公司',
  180. dataIndex: 'depName',
  181. key: 'depName'
  182. },{
  183. title: '任务状态',
  184. dataIndex: 'taskStatus',
  185. key: 'taskStatus',
  186. render:text=>{return getNewOrderStatus(text)}
  187. }, {
  188. title: '工时',
  189. dataIndex: 'hours',
  190. key: 'hours'
  191. }
  192. ],
  193. data: [],
  194. dataSource: [],
  195. columnsX: [
  196. {
  197. title: '催款人',
  198. dataIndex: 'dumBy',
  199. key: 'dumBy'
  200. }, {
  201. title: '催款时间',
  202. dataIndex: 'dumTime',
  203. key: 'dumTime',
  204. },{
  205. title: '催款情况',
  206. dataIndex: 'remarks',
  207. key: 'remarks'
  208. }
  209. ],
  210. dataSources: [],
  211. }
  212. },
  213. //页面加载函数
  214. componentWillMount() {
  215. this.loadData();
  216. },
  217. // //整行点击
  218. tableRowClick(record, index) {
  219. this.setState({
  220. visibles:true,
  221. });
  222. this.loadDatas(record.id);
  223. },
  224. //关闭输入理由框
  225. noCancel(){
  226. this.setState({
  227. noVisible:false
  228. })
  229. },
  230. //搜索
  231. search() {
  232. this.setState({
  233. //signBillVisible:false
  234. })
  235. this.loadData();
  236. },
  237. //重置
  238. reset() {
  239. this.setState({
  240. signBillVisible:false
  241. })
  242. this.state.orderNo='';
  243. this.state.customerName='';
  244. this.state.releaseDate[0] = undefined;
  245. this.state.releaseDate[1] = undefined;
  246. this.loadData(this.state.page);
  247. },
  248. resets(){
  249. this.state.orderNo='';
  250. this.state.customerName='';
  251. this.state.releaseDate[0] = undefined;
  252. this.state.releaseDate[1] = undefined;
  253. },
  254. getOrgCodeUrl(e) {
  255. this.setState({ orgCodeUrl: e });
  256. },
  257. //关闭详情
  258. visitCancel(e){
  259. this.setState({
  260. visible:false
  261. })
  262. this.resets();
  263. },
  264. visitOk(e){
  265. this.setState({
  266. visible:false
  267. })
  268. this.resets();
  269. },
  270. //关闭详情
  271. visitCancels(e){
  272. this.setState({
  273. visibles:false
  274. })
  275. this.resets();
  276. },
  277. //导出
  278. exportExec(){
  279. var data = {
  280. name: this.state.customerName?this.state.customerName:undefined,//订单负责人
  281. taskId: this.state.orderNo?this.state.orderNo:undefined,//订单编号
  282. startTime: this.state.releaseDate[0]?this.state.releaseDate[0]:undefined,
  283. endTime: this.state.releaseDate[1]?this.state.releaseDate[1]:undefined,
  284. }
  285. window.location.href=(globalConfig.context+'/api/admin/orderProject/exportTaskHoursListData?'+$.param(data));
  286. },
  287. visitOks(e){
  288. this.setState({
  289. visibles:false
  290. })
  291. this.resets();
  292. },
  293. render() {
  294. const formItemLayout = {
  295. labelCol: { span: 8 },
  296. wrapperCol: { span: 14 },
  297. };
  298. const FormItem = Form.Item;
  299. const { RangePicker } = DatePicker;
  300. const rowSelection = {
  301. selectedRowKeys: this.state.selectedRowKeys,
  302. onChange: (selectedRowKeys, selectedRows) => {
  303. this.setState({
  304. modalVisible:false,
  305. selectedRows: selectedRows.slice(-1),
  306. selectedRowKeys: selectedRowKeys.slice(-1)
  307. });
  308. },
  309. onSelect: (recordt, selected, selectedRows) => {
  310. this.setState({
  311. modalVisible:false,
  312. recordt: recordt.id
  313. })
  314. },
  315. };
  316. const hasSelected = this.state.selectedRowKeys.length > 0;
  317. return(
  318. <div className="user-content">
  319. <div className="content-title">
  320. <span>工时数据统计</span>
  321. </div>
  322. <div className="user-search">
  323. <Button type="primary" onClick={this.exportExec} style={{float:'right'}}>导出工时数据</Button>
  324. <Input placeholder="客户名称" style={{width:'150px',marginBottom:'10px'}}
  325. value={this.state.customerName}
  326. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  327. <Input placeholder="任务编号" style={{width:'150px'}}
  328. value={this.state.orderNo}
  329. onChange={(e) => { this.setState({ orderNo: e.target.value }); }} />
  330. <span style={{marginRight:"10px"}}>合同签订时间 :</span>
  331. <RangePicker
  332. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  333. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  334. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  335. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
  336. <Button onClick={this.reset}>重置</Button>
  337. <div className="patent-table">
  338. <Spin spinning={this.state.loading}>
  339. <Table columns={this.state.columns}
  340. dataSource={this.state.dataSource}
  341. rowSelection={rowSelection}
  342. pagination={this.state.pagination}
  343. />
  344. </Spin>
  345. </div>
  346. </div>
  347. </div>
  348. );
  349. }
  350. }));
  351. export default IntentionCustomer;