taskCount.jsx 10 KB

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