index.jsx 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import React, { Component } from "react";
  2. import { Select, } from "antd";
  3. /**
  4. * 驳回位置选择
  5. */
  6. class SelectReject extends Component {
  7. constructor(props) {
  8. super(props);
  9. this.state = {
  10. selValue: 0,
  11. opList: [],
  12. // 0 退单退款
  13. theArr0: [
  14. { value: 0, lable: "营销员", },
  15. { value: 1, lable: "营销经理", },
  16. { value: 2, lable: "营销管理员", },
  17. { value: 3, lable: "技术员", },
  18. { value: 4, lable: "技术经理", },
  19. { value: 5, lable: "技术总监", },
  20. { value: 6, lable: "财务专员", },
  21. { value: 7, lable: "财务总监", },
  22. { value: 8, lable: "总裁", },
  23. { value: 9, lable: "董事长", },
  24. ],
  25. // 1 项目&金额
  26. theArr1: [
  27. { value: 0, lable: "营销员", },
  28. { value: 1, lable: "营销经理", },
  29. { value: 2, lable: "营销管理员", },
  30. { value: 3, lable: "技术员", },
  31. { value: 4, lable: "技术经理", },
  32. { value: 5, lable: "技术总监", },
  33. { value: 6, lable: "财务专员", },
  34. { value: 7, lable: "财务总监", },
  35. { value: 8, lable: "总裁审核", },
  36. ],
  37. // 2 仅项目
  38. theArr2: [
  39. { value: 0, lable: "营销员", },
  40. { value: 1, lable: "营销经理", },
  41. { value: 2, lable: "营销管理员", },
  42. { value: 3, lable: "技术员", },
  43. { value: 4, lable: "技术经理", },
  44. { value: 5, lable: "技术总监", },
  45. { value: 6, lable: "财务专员", },
  46. { value: 7, lable: "财务总监", },
  47. { value: 8, lable: "总裁", },
  48. ],
  49. // 3 仅金额
  50. theArr3: [
  51. { value: 0, lable: "营销员", },
  52. { value: 1, lable: "营销经理", },
  53. { value: 2, lable: "营销管理员", },
  54. { value: 5, lable: "技术总监", },
  55. { value: 6, lable: "财务专员", },
  56. { value: 7, lable: "财务总监", },
  57. { value: 8, lable: "总裁", },
  58. ],
  59. // 4 重报
  60. theArr4: [
  61. { value: 0, lable: "营销员", },
  62. { value: 1, lable: "营销经理", },
  63. { value: 2, lable: "营销管理员", },
  64. { value: 3, lable: "技术员", },
  65. { value: 4, lable: "技术经理", },
  66. { value: 6, lable: "财务专员", },
  67. { value: 7, lable: "财务总监", },
  68. { value: 8, lable: "总裁", },
  69. ],
  70. // 5 赠送
  71. theArr5: [
  72. { value: 0, lable: "营销员", },
  73. { value: 1, lable: "营销经理", },
  74. { value: 2, lable: "营销管理员", },
  75. { value: 6, lable: "财务专员", },
  76. { value: 8, lable: "总裁", },
  77. ],
  78. // 6 退单不退款
  79. theArr6: [
  80. { value: 0, lable: "营销员", },
  81. { value: 1, lable: "营销经理", },
  82. { value: 2, lable: "营销管理员", },
  83. { value: 3, lable: "技术员", },
  84. { value: 4, lable: "技术经理", },
  85. { value: 5, lable: "技术总监", },
  86. { value: 6, lable: "财务专员", },
  87. { value: 7, lable: "财务总监", },
  88. { value: 8, lable: "总裁", },
  89. ],
  90. // 7 仅变更合同
  91. theArr7: [
  92. { value: 0, lable: "营销员发起", },
  93. { value: 2, lable: "营销管理员审核", },
  94. ],
  95. };
  96. this.onChange = this.onChange.bind(this);
  97. }
  98. componentDidMount() {
  99. }
  100. componentWillUnmount() {
  101. }
  102. componentWillReceiveProps(nextProps) {
  103. const { theArr0, theArr1, theArr2, theArr3, theArr4, theArr5, theArr6, theArr7 } = this.state
  104. const { type } = this.props
  105. this.setState({
  106. opList: type == 0
  107. ? theArr0 : type == 1
  108. ? theArr1 : type == 2
  109. ? theArr2 : type == 3
  110. ? theArr3 : type == 4
  111. ? theArr4 : type == 5
  112. ? theArr5 : type == 6
  113. ? theArr6 : type == 7 && theArr7
  114. })
  115. }
  116. onChange(e) {
  117. const { onSelect } = this.props
  118. this.setState({
  119. selValue: e
  120. })
  121. onSelect(e)
  122. }
  123. render() {
  124. const { selValue, opList } = this.state
  125. const { processState } = this.props
  126. return (
  127. opList.length > 0 &&
  128. <Select
  129. value={selValue}
  130. style={{ width: 120 }}
  131. onChange={this.onChange}
  132. >
  133. {
  134. opList.map(item =>
  135. <Option
  136. value={item.value}
  137. key={item.value}
  138. style={{ display: processState > item.value ? "block" : "none", }}
  139. >{item.lable}</Option>
  140. )
  141. }
  142. </Select>
  143. );
  144. }
  145. }
  146. export default SelectReject;