index.js 13 KB

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