index.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. import React,{Component} from 'react';
  2. import {Form, message, Modal, Tabs} from "antd";
  3. import ProjectOverview from './projectOverview'
  4. import {splitUrl} from '@/tools'
  5. import CheckProject from "../../../../components/checkProject";
  6. import $ from "jquery";
  7. const { TabPane } = Tabs
  8. class DetailsModal extends Component{
  9. constructor(props) {
  10. super(props);
  11. this.state={
  12. loading: false,
  13. activeKey:'1',
  14. paySubject: [],
  15. orderDtails: {},
  16. }
  17. this.visitCancel = this.visitCancel.bind(this);
  18. }
  19. componentDidMount() {
  20. if(this.props.tid){
  21. this.waiDetail();
  22. this.thirdTable(this.props.tid);
  23. this.payNodeTable(this.props.tid)
  24. }
  25. }
  26. visitOk(){
  27. this.setState({
  28. oldInfor: {}
  29. });
  30. }
  31. visitCancel(){
  32. this.setState({
  33. oldInfor: {}
  34. });
  35. this.props.visitCancel();
  36. }
  37. waiDetail() {
  38. let url = window.location.href.substring(7)
  39. this.setState({
  40. loading: true,
  41. })
  42. $.ajax({
  43. method: 'get',
  44. dataType: 'json',
  45. crossDomain: false,
  46. url:
  47. globalConfig.context + '/api/admin/outsourceOrg/orderOutsourceDtails',
  48. data: {
  49. tid: this.props.tid,
  50. orderNo: this.props.orderNo,
  51. },
  52. }).done(
  53. function (data) {
  54. this.setState({
  55. loading: false,
  56. })
  57. if (!data.error.length && data.data) {
  58. if(data.data.unitNumber){
  59. this.setState({
  60. oldInfor: {
  61. companyName:data.data.companyName,
  62. unitPrice:data.data.unitPrice,
  63. unitNumber:data.data.unitNumber,
  64. amount:data.data.amount,
  65. outsourceRemarks:data.data.outsourceRemarks,
  66. refundStatus: data.data.refundStatus,
  67. pictureUrl: data.data.pictureUrl
  68. ? splitUrl(
  69. data.data.pictureUrl,
  70. ',',
  71. globalConfig.avatarHost + '/upload',
  72. url
  73. )
  74. : [], //图片地址
  75. }
  76. })
  77. }else{
  78. this.setState({
  79. orderDtails: data.data,
  80. startType: data.data.startType, //类型
  81. outsourceRemarks: data.data.outsourceRemarks,
  82. refundStatus: data.data.refundStatus,
  83. pictureUrl: data.data.pictureUrl
  84. ? splitUrl(
  85. data.data.pictureUrl,
  86. ',',
  87. globalConfig.avatarHost + '/upload',
  88. url
  89. )
  90. : [], //图片地址
  91. })
  92. }
  93. } else if (data.error && data.error.length) {
  94. message.warning(data.error[0].message)
  95. } else if (!data.data) {
  96. this.setState({
  97. refundStatus: undefined,
  98. })
  99. }
  100. }.bind(this)
  101. )
  102. }
  103. //查看第三方信息表格
  104. thirdTable(id) {
  105. this.setState({
  106. loadData: true,
  107. })
  108. $.ajax({
  109. method: 'get',
  110. dataType: 'json',
  111. crossDomain: false,
  112. url: globalConfig.context + '/api/admin/company/selectCompany',
  113. data: {
  114. tid: id,
  115. },
  116. success: function (data) {
  117. if (data.error && data.error.length) {
  118. message.warning(data.error[0].message)
  119. } else {
  120. let companyNameArr = []
  121. let theArr = []
  122. let thisData = []
  123. let arr = data.data || []
  124. let allTotalAmount = 0
  125. for (let i = 0; i < arr.length; i++) {
  126. thisData = arr[i]
  127. allTotalAmount =
  128. (allTotalAmount * 10000 + thisData.totalAmount * 10000) / 10000
  129. companyNameArr.push(thisData.companyName);
  130. thisData.key = i;
  131. theArr.push(thisData)
  132. }
  133. for(let d=0;d<theArr.length;d++){
  134. theArr[d].companyName = theArr[d].companyName+ '-' + theArr[d].id;
  135. // companyNameArr[d] = {
  136. // companyName: theArr[d].companyName,
  137. // id: theArr[d].id,
  138. // }
  139. }
  140. if (!allTotalAmount) {
  141. allTotalAmount = 0
  142. }
  143. this.setState({
  144. thirdInfoList: theArr,
  145. allTotalAmount: allTotalAmount,
  146. })
  147. }
  148. }.bind(this),
  149. }).always(
  150. function () {
  151. this.setState({
  152. loading: false,
  153. })
  154. }.bind(this)
  155. )
  156. }
  157. payNodeTable(id) {
  158. this.setState({
  159. loadData: true,
  160. })
  161. $.ajax({
  162. method: 'get',
  163. dataType: 'json',
  164. crossDomain: false,
  165. url: globalConfig.context + '/api/admin/company/selectPaymentNode',
  166. data: {
  167. tid: id,
  168. },
  169. success: function (data) {
  170. if (data.error && data.error.length) {
  171. message.warning(data.error[0].message)
  172. } else {
  173. let payNodeArr = []
  174. let thisData = []
  175. let arr = data.data || []
  176. //对#5283自定义的补充展示
  177. this.state.paySubject.push({ key: '自定义', value: '0' })
  178. for (let i = 0; i < arr.length; i++) {
  179. thisData = arr[i]
  180. //遍历paySubject,获取当前dunType对应的key
  181. this.state.paySubject.map((item) => {
  182. if (item.value == thisData.dunType) {
  183. thisData.dunType = item.key
  184. }
  185. })
  186. payNodeArr.push({
  187. key: i,
  188. id: thisData.id, //付款节点Id
  189. tid: thisData.tid,
  190. companyName: thisData.companyName, //供应商名称
  191. projectType: thisData.projectType, //项目分类
  192. dunType: thisData.dunType, //催款分类
  193. unitPrice: thisData.unitPrice, //单价
  194. quantity: thisData.quantity, //数量
  195. totalAmount: thisData.totalAmount, //总价
  196. partyAmount: thisData.partyAmount, //付款
  197. partyTimes: thisData.partyTimes, //付款时间
  198. cid: thisData.cid, //机构id
  199. })
  200. }
  201. for(let d=0;d<payNodeArr.length;d++){
  202. payNodeArr[d].companyName = payNodeArr[d].companyName+ '-' + payNodeArr[d].cid;
  203. }
  204. this.setState({
  205. payNodeList: payNodeArr,
  206. })
  207. }
  208. }.bind(this),
  209. }).always(
  210. function () {
  211. this.setState({
  212. loading: false,
  213. })
  214. }.bind(this)
  215. )
  216. }
  217. render() {
  218. return(
  219. <Modal
  220. className="customeDetails"
  221. footer=""
  222. title=""
  223. width="900px"
  224. visible={this.props.visible}
  225. onOk={this.visitOk}
  226. onCancel={this.visitCancel}
  227. >
  228. <Tabs
  229. defaultActiveKey='1'
  230. activeKey={this.state.activeKey}
  231. onChange={(e) => {
  232. this.setState({
  233. activeKey: e
  234. })
  235. if(e === '1'){
  236. this.waiDetail();
  237. this.thirdTable(this.props.tid);
  238. this.payNodeTable(this.props.tid);
  239. }
  240. }}
  241. tabBarExtraContent={
  242. <div style={{fontWeight:'bold',paddingRight:'15px'}}>
  243. <span>
  244. 项目名称:
  245. <span style={{color:'#F00',paddingRight:'5px'}}>{this.props.taskName}</span>
  246. </span>
  247. <span style={{marginLeft:'15px'}}>
  248. 项目编号:
  249. <span style={{color:'#F00',paddingRight:'5px'}}>
  250. {this.props.taskID}
  251. </span>
  252. </span>
  253. </div>
  254. }
  255. >
  256. <TabPane tab="外包/供应商信息" key="1">
  257. {this.state.activeKey === '1' ? <CheckProject
  258. {...this.props}
  259. tid={this.props.tid}
  260. oldInfor={this.state.oldInfor}
  261. status={this.state.refundStatus}
  262. patentNameType={this.state.orderDtails.patentNameType}
  263. patentName={this.state.orderDtails.patentName}
  264. patentType={this.state.orderDtails.patentType}
  265. projectType={this.props.projectType}
  266. projectStatus={this.props.projectStatus}
  267. thirdInfoList={this.state.thirdInfoList}
  268. dataSource={this.state.payNodeList}
  269. outsourceRemarks={this.state.outsourceRemarks}
  270. fileList={this.state.pictureUrl}
  271. startType={this.state.startType}
  272. onRefresh={()=>{
  273. this.waiDetail();
  274. this.thirdTable(this.props.tid);
  275. this.payNodeTable(this.props.tid);
  276. this.props.refreshList && this.props.refreshList();
  277. }}
  278. /> : <div/>}
  279. </TabPane>
  280. <TabPane tab="项目概况" key="2">
  281. <ProjectOverview projectStatus={this.props.projectStatus} tid={this.props.tid}/>
  282. </TabPane>
  283. </Tabs>
  284. </Modal>
  285. )
  286. }
  287. }
  288. export default DetailsModal;