taskCount.jsx 11 KB

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