suspendexamine.jsx 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. import React from "react";
  2. import $ from "jquery/src/ajax";
  3. import { AutoComplete, Button, Input, Spin, Table, DatePicker, Select, message, Tabs, Form, Tooltip, Modal } from "antd";
  4. import { ChooseList } from "../../order/orderNew/chooseList"
  5. import moment from "moment";
  6. import ShowModalDiv from "@/showModal.jsx";
  7. import { getStopStatus } from '@/tools';
  8. import Cascaders from "../../../common/cascaders";
  9. import MySuspend from '../../../common/mysuspend';
  10. import MySuspendLog from '../../../common/logPopup/mysuspendlog';
  11. const { TabPane } = Tabs;
  12. const { RangePicker } = DatePicker;
  13. const FormItem = Form.Item;
  14. //项目暂停&重启审核
  15. const SuspendExamine = React.createClass({
  16. //
  17. getInitialState() {
  18. return {
  19. visible: false,
  20. pageNo: 1,
  21. totalPage: 0,
  22. searchValues: {},//查询条件
  23. loading: false,
  24. changeList: undefined,// 子组件改变的表格title数组
  25. pagination: {
  26. defaultCurrent: 1,
  27. defaultPageSize: 10,
  28. showQuickJumper: true,
  29. pageSize: 10,
  30. onChange: function (page) {
  31. this.setState({
  32. pageNo: page,
  33. });
  34. this.loadData(page);
  35. }.bind(this),
  36. showTotal: function (total) {
  37. return "共" + total + "条数据";
  38. },
  39. },
  40. columns: [
  41. {
  42. title: "时间",
  43. dataIndex: "createTimes",
  44. key: "createTimes",
  45. width: 80,
  46. },
  47. {
  48. title: "省份",
  49. dataIndex: "province",
  50. key: "province"
  51. },
  52. {
  53. title: "合同编号",
  54. dataIndex: "contractNo",
  55. key: "contractNo",
  56. render: (text, record) => {
  57. return (
  58. <Tooltip
  59. title={
  60. <Button
  61. type="primary"
  62. onClick={(e) => {
  63. e.stopPropagation();
  64. let input = document.getElementById("copyText");
  65. input.value = text;
  66. input.select();
  67. document.execCommand("copy");
  68. message.success("复制成功");
  69. }}
  70. >
  71. 复制
  72. </Button>
  73. }
  74. >
  75. <div>{text}</div>
  76. </Tooltip>
  77. );
  78. },
  79. },
  80. {
  81. title: "订单编号",
  82. dataIndex: "orderNo",
  83. key: "orderNo"
  84. },
  85. {
  86. title: "签单客户",
  87. dataIndex: "userName",
  88. key: "userName"
  89. },
  90. {
  91. title: "项目类型",
  92. dataIndex: "cname",
  93. key: "cname"
  94. },
  95. {
  96. title: "项目名称",
  97. dataIndex: "projectName",
  98. key: "projectName"
  99. },
  100. {
  101. title: "数量",
  102. dataIndex: "commodityQuantity",
  103. key: "commodityQuantity",
  104. width: 50,
  105. },
  106. {
  107. title: "服务类型",
  108. dataIndex: "serviceType",
  109. key: "serviceType"
  110. },
  111. {
  112. title: "咨询师/咨询经理",
  113. dataIndex: "receiverName",
  114. key: "receiverName"
  115. },
  116. {
  117. title: "项目状态",
  118. dataIndex: "stopStatus",
  119. key: "stopStatus",
  120. render: (value, record) => (
  121. <div>
  122. {getStopStatus(record.stopType, value)}
  123. <div>
  124. {
  125. value == 0 &&
  126. <Button
  127. type="primary"
  128. onClick={() => {
  129. this.setState({
  130. visible: true,
  131. rowData: record,
  132. })
  133. }}
  134. >审核</Button>
  135. }
  136. </div>
  137. </div>
  138. )
  139. },
  140. {
  141. title: "项目金额",
  142. dataIndex: "commodityPrice",
  143. key: "commodityPrice"
  144. },
  145. {
  146. title: "原因",
  147. dataIndex: "reason",
  148. key: "reason",
  149. width: 250,
  150. },
  151. {
  152. title: "日志",
  153. dataIndex: "rz",
  154. key: "rz",
  155. width: 90,
  156. render: (text, record) => (
  157. <div>
  158. <MySuspendLog id={record.id} stopType={record.stopType} />
  159. </div>
  160. )
  161. }
  162. ],
  163. dataSource: [],
  164. rowData: {},
  165. };
  166. },
  167. componentWillMount() {
  168. this.loadData();
  169. },
  170. // 列表数据
  171. loadData(pageNo, pageSize) {
  172. const { searchValues, pagination } = this.state
  173. this.setState({
  174. loading: true,
  175. });
  176. let datas = Object.assign(searchValues, {
  177. pageNo: pageNo || 1,
  178. pageSize: pageSize || 10,
  179. });
  180. $.ajax({
  181. method: "get",
  182. dataType: "json",
  183. crossDomain: false,
  184. url: globalConfig.context + "/api/admin/orderProject/selectProjectStop",
  185. data: datas,
  186. success: function (data) {
  187. this.setState({
  188. loading: false,
  189. });
  190. if (data.error && data.error.length === 0) {
  191. if (data.data.list) {
  192. pagination.current = data.data.pageNo;
  193. pagination.total = data.data.totalCount;
  194. if (data.data && data.data.list && !data.data.list.length) {
  195. pagination.current = 0;
  196. pagination.total = 0;
  197. }
  198. this.setState({
  199. dataSource: data.data.list,
  200. pagination: this.state.pagination,
  201. pageNo: data.data.pageNo,
  202. totalPage: data.data.totalPage,
  203. });
  204. } else {
  205. this.setState({
  206. dataSource: data.data,
  207. pagination: false,
  208. });
  209. }
  210. } else {
  211. message.warning(data.error[0].message);
  212. }
  213. }.bind(this),
  214. }).always(
  215. function () {
  216. this.setState({
  217. loading: false,
  218. });
  219. }.bind(this)
  220. );
  221. },
  222. // 更改表格显示数据
  223. changeList(arr) {
  224. const newArr = [];
  225. this.state.columns.forEach((item) => {
  226. arr.forEach((val) => {
  227. if (val === item.title) {
  228. newArr.push(item);
  229. }
  230. });
  231. });
  232. this.setState({
  233. changeList: newArr,
  234. });
  235. },
  236. // 查询订单负责人列表
  237. followUp(e) {
  238. const { searchValues } = this.state;
  239. this.setState({
  240. searchValues: Object.assign(searchValues, {
  241. aname: e,
  242. }),
  243. });
  244. $.ajax({
  245. method: "get",
  246. dataType: "json",
  247. crossDomain: false,
  248. url: globalConfig.context + "/api/admin/customer/listAdminByName",
  249. data: {
  250. adminName: e,
  251. },
  252. success: function (data) {
  253. let thedata = data.data;
  254. if (!thedata) {
  255. if (data.error && data.error.length) {
  256. message.warning(data.error[0].message);
  257. }
  258. thedata = {};
  259. }
  260. this.setState({
  261. fjlist: thedata,
  262. });
  263. }.bind(this),
  264. }).always(
  265. function () {
  266. this.setState({
  267. loading: false,
  268. });
  269. }.bind(this)
  270. );
  271. },
  272. // 选中订单负责人
  273. selectF(value) {
  274. const { searchValues, fjlist } = this.state;
  275. const newdataSources = JSON.stringify(fjlist) == "{}" ? [] : fjlist;
  276. this.setState({
  277. searchValues: Object.assign(searchValues, {
  278. receiverId: newdataSources.find((item) => item.name == value).id,
  279. }),
  280. });
  281. },
  282. // 失去焦点
  283. blurChange(e) {
  284. let theType = "";
  285. let contactLists = this.state.customerArr || [];
  286. if (e) {
  287. contactLists.map(function (item) {
  288. if (item.name == e.toString()) {
  289. theType = item.id;
  290. }
  291. });
  292. }
  293. this.setState({
  294. theTypes: theType,
  295. });
  296. },
  297. // 双击行
  298. tableRowClick(record) {
  299. this.setState({
  300. visible: true,
  301. rowData: record,
  302. })
  303. },
  304. // 搜索
  305. search() {
  306. this.setState({
  307. selectedRowKeys: []
  308. })
  309. this.loadData();
  310. },
  311. // 重置
  312. reset() {
  313. this.setState({
  314. pageNo: 1,
  315. searchValues: JSON.parse(JSON.stringify({})),
  316. }, () => {
  317. this.Cascaders.empty();
  318. this.loadData();
  319. })
  320. },
  321. render() {
  322. const { searchValues, rowData } = this.state
  323. const dataSources = this.state.fjlist || [];
  324. const options = dataSources.map((group) => (
  325. <Select.Option key={group.id} value={group.name}>
  326. {group.name}
  327. </Select.Option>
  328. ));
  329. return (
  330. <div className="user-content">
  331. <ShowModalDiv ShowModal={this.state.showModal} />
  332. <div className="content-title" style={{ marginBottom: 10 }}>
  333. <span style={{ fontWeight: 900, fontSize: 16 }}>审核暂停&重启项目</span>
  334. </div>
  335. <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
  336. <TabPane tab="搜索" key="1">
  337. <div className="user-search" style={{ marginLeft: 10 }}>
  338. <Input
  339. placeholder="订单编号"
  340. style={{ width: 160 }}
  341. value={searchValues["orderNo"]
  342. ? searchValues["orderNo"]
  343. : ""}
  344. onChange={(e) => {
  345. searchValues["orderNo"] = e.target.value;
  346. this.setState({
  347. searchValues: searchValues,
  348. });
  349. }}
  350. />
  351. <Input
  352. placeholder="客户名称"
  353. style={{ width: 160 }}
  354. value={searchValues["userName"]
  355. ? searchValues["userName"]
  356. : ""}
  357. onChange={(e) => {
  358. searchValues["userName"] = e.target.value;
  359. this.setState({
  360. searchValues: searchValues,
  361. });
  362. }}
  363. />
  364. <Cascaders
  365. ref={node => this.Cascaders = node}
  366. placeholder="订单部门"
  367. id="id"
  368. name="name"
  369. children="list"
  370. height={28}
  371. onSel={(e) => {
  372. searchValues["deps"] = JSON.stringify(e);
  373. this.setState({
  374. searchValues: searchValues,
  375. });
  376. }}
  377. />
  378. <Input
  379. placeholder="合同编号"
  380. style={{ width: 160 }}
  381. value={searchValues["contractNo"]
  382. ? searchValues["contractNo"]
  383. : ""}
  384. onChange={(e) => {
  385. searchValues["contractNo"] = e.target.value;
  386. this.setState({
  387. searchValues: searchValues,
  388. });
  389. }}
  390. />
  391. <Input
  392. placeholder="项目名称"
  393. style={{ width: 160 }}
  394. value={searchValues["projectName"]
  395. ? searchValues["projectName"]
  396. : ""}
  397. onChange={(e) => {
  398. searchValues["projectName"] = e.target.value;
  399. this.setState({
  400. searchValues: searchValues,
  401. });
  402. }}
  403. />
  404. <Select
  405. style={{ width: 120 }}
  406. placeholder="项目暂停状态"
  407. value={searchValues["status"]
  408. ? searchValues["status"]
  409. : undefined}
  410. onChange={(e) => {
  411. searchValues["status"] = e;
  412. this.setState({
  413. searchValues: searchValues,
  414. });
  415. }}
  416. >
  417. <Option value="">全部</Option>
  418. <Option value="0">暂停待审核</Option>
  419. <Option value="1">重启待审核</Option>
  420. <Option value="2">暂停完成</Option>
  421. <Option value="3">重启完成</Option>
  422. <Option value="4">暂停已驳回</Option>
  423. <Option value="5">重启已驳回</Option>
  424. </Select>
  425. <AutoComplete
  426. dropdownMatchSelectWidth={false}
  427. style={{ width: 160 }}
  428. dataSource={options}
  429. placeholder="咨询师/经理"
  430. value={searchValues.aname || undefined}
  431. onChange={this.followUp.bind(this)}
  432. filterOption={true}
  433. onBlur={this.blurChange}
  434. onSelect={this.selectF.bind(this)}
  435. >
  436. <Input />
  437. </AutoComplete>
  438. <RangePicker
  439. style={{ width: 200 }}
  440. value={[
  441. searchValues.startTime
  442. ? moment(searchValues.startTime)
  443. : null,
  444. searchValues.endTime ? moment(searchValues.endTime) : null,
  445. ]}
  446. onChange={(data, dataString) => {
  447. this.setState({
  448. searchValues: Object.assign(searchValues, {
  449. startTime: dataString[0],
  450. endTime: dataString[1],
  451. }),
  452. });
  453. }}
  454. />
  455. <Button
  456. type="primary"
  457. onClick={this.search}
  458. style={{ marginLeft: 10 }}
  459. disabled={this.state.loading ? true : false}
  460. >
  461. 搜索
  462. </Button>
  463. <Button onClick={this.reset}>重置</Button>
  464. </div>
  465. </TabPane>
  466. <TabPane tab="更改表格显示数据" key="2">
  467. <div style={{ marginLeft: 10 }}>
  468. <ChooseList
  469. columns={this.state.columns}
  470. changeFn={this.changeList}
  471. changeList={this.state.changeList}
  472. top={55}
  473. margin={11}
  474. />
  475. </div>
  476. </TabPane>
  477. </Tabs>
  478. <div className="patent-table">
  479. <Spin spinning={this.state.loading}>
  480. <Table
  481. bordered
  482. columns={
  483. this.state.changeList == undefined
  484. ? this.state.columns
  485. : this.state.changeList
  486. }
  487. dataSource={this.state.dataSource}
  488. pagination={this.state.pagination}
  489. onRowDoubleClick={this.tableRowClick.bind(this)}
  490. size="small"
  491. />
  492. </Spin>
  493. </div>
  494. <textarea id="copyText" style={{ opacity: 0 }} />
  495. {
  496. // 项目详情
  497. this.state.visible &&
  498. <MySuspend
  499. isApproved={true} // 审核权限
  500. type="details"
  501. title={rowData.stopType == 0 ? "项目暂停" : "项目重启"}
  502. contractNo={rowData.contractNo}
  503. orderNo={rowData.orderNo}
  504. userName={rowData.userName}
  505. reason={rowData.reason}
  506. annexUrl={rowData.annexUrl}
  507. rowData={rowData}
  508. selectedRows={[{ "commodityName": rowData.projectName, "id": rowData.id }]}
  509. visible={this.state.visible}
  510. subClose={() => {
  511. this.loadData(this.state.pageNo);
  512. this.setState({
  513. visible: false,
  514. rowData: {},
  515. })
  516. }}
  517. />
  518. }
  519. </div>
  520. );
  521. },
  522. });
  523. export default SuspendExamine;