index.js 13 KB

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