suspendexamine.jsx 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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 { ShowModal, 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. shiroType: 1, // 审核
  180. });
  181. $.ajax({
  182. method: "get",
  183. dataType: "json",
  184. crossDomain: false,
  185. url: globalConfig.context + "/api/admin/orderProject/selectProjectStop",
  186. data: datas,
  187. success: function (data) {
  188. ShowModal(this);
  189. this.setState({
  190. loading: false,
  191. });
  192. if (data.error && data.error.length === 0) {
  193. if (data.data.list) {
  194. pagination.current = data.data.pageNo;
  195. pagination.total = data.data.totalCount;
  196. if (data.data && data.data.list && !data.data.list.length) {
  197. pagination.current = 0;
  198. pagination.total = 0;
  199. }
  200. this.setState({
  201. dataSource: data.data.list,
  202. pagination: this.state.pagination,
  203. pageNo: data.data.pageNo,
  204. totalPage: data.data.totalPage,
  205. });
  206. } else {
  207. this.setState({
  208. dataSource: data.data,
  209. pagination: false,
  210. });
  211. }
  212. } else {
  213. message.warning(data.error[0].message);
  214. }
  215. }.bind(this),
  216. }).always(
  217. function () {
  218. this.setState({
  219. loading: false,
  220. });
  221. }.bind(this)
  222. );
  223. },
  224. // 更改表格显示数据
  225. changeList(arr) {
  226. const newArr = [];
  227. this.state.columns.forEach((item) => {
  228. arr.forEach((val) => {
  229. if (val === item.title) {
  230. newArr.push(item);
  231. }
  232. });
  233. });
  234. this.setState({
  235. changeList: newArr,
  236. });
  237. },
  238. // 查询订单负责人列表
  239. followUp(e) {
  240. const { searchValues } = this.state;
  241. this.setState({
  242. searchValues: Object.assign(searchValues, {
  243. aname: e,
  244. }),
  245. });
  246. $.ajax({
  247. method: "get",
  248. dataType: "json",
  249. crossDomain: false,
  250. url: globalConfig.context + "/api/admin/customer/listAdminByName",
  251. data: {
  252. adminName: e,
  253. },
  254. success: function (data) {
  255. let thedata = data.data;
  256. if (!thedata) {
  257. if (data.error && data.error.length) {
  258. message.warning(data.error[0].message);
  259. }
  260. thedata = {};
  261. }
  262. this.setState({
  263. fjlist: thedata,
  264. });
  265. }.bind(this),
  266. }).always(
  267. function () {
  268. this.setState({
  269. loading: false,
  270. });
  271. }.bind(this)
  272. );
  273. },
  274. // 选中订单负责人
  275. selectF(value) {
  276. const { searchValues, fjlist } = this.state;
  277. const newdataSources = JSON.stringify(fjlist) == "{}" ? [] : fjlist;
  278. this.setState({
  279. searchValues: Object.assign(searchValues, {
  280. receiverId: newdataSources.find((item) => item.name == value).id,
  281. }),
  282. });
  283. },
  284. // 失去焦点
  285. blurChange(e) {
  286. let theType = "";
  287. let contactLists = this.state.customerArr || [];
  288. if (e) {
  289. contactLists.map(function (item) {
  290. if (item.name == e.toString()) {
  291. theType = item.id;
  292. }
  293. });
  294. }
  295. this.setState({
  296. theTypes: theType,
  297. });
  298. },
  299. // 双击行
  300. tableRowClick(record) {
  301. this.setState({
  302. visible: true,
  303. rowData: record,
  304. })
  305. },
  306. // 搜索
  307. search() {
  308. this.setState({
  309. selectedRowKeys: []
  310. })
  311. this.loadData();
  312. },
  313. // 重置
  314. reset() {
  315. this.setState({
  316. pageNo: 1,
  317. searchValues: JSON.parse(JSON.stringify({})),
  318. }, () => {
  319. this.Cascaders.empty();
  320. this.loadData();
  321. })
  322. },
  323. render() {
  324. const { searchValues, rowData } = this.state
  325. const dataSources = this.state.fjlist || [];
  326. const options = dataSources.map((group) => (
  327. <Select.Option key={group.id} value={group.name}>
  328. {group.name}
  329. </Select.Option>
  330. ));
  331. return (
  332. <div className="user-content">
  333. <ShowModalDiv ShowModal={this.state.showModal} onClose={() => { this.setState({ showModal: false }) }} />
  334. <div className="content-title" style={{ marginBottom: 10 }}>
  335. <span style={{ fontWeight: 900, fontSize: 16 }}>审核暂停&重启项目</span>
  336. </div>
  337. <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
  338. <TabPane tab="搜索" key="1">
  339. <div className="user-search" style={{ marginLeft: 10 }}>
  340. <Input
  341. placeholder="订单编号"
  342. style={{ width: 160 }}
  343. value={searchValues["orderNo"]
  344. ? searchValues["orderNo"]
  345. : ""}
  346. onChange={(e) => {
  347. searchValues["orderNo"] = e.target.value;
  348. this.setState({
  349. searchValues: searchValues,
  350. });
  351. }}
  352. />
  353. <Input
  354. placeholder="合同编号"
  355. style={{ width: 160 }}
  356. value={searchValues["contractNo"]
  357. ? searchValues["contractNo"]
  358. : ""}
  359. onChange={(e) => {
  360. searchValues["contractNo"] = e.target.value;
  361. this.setState({
  362. searchValues: searchValues,
  363. });
  364. }}
  365. />
  366. <Input
  367. placeholder="客户名称"
  368. style={{ width: 160 }}
  369. value={searchValues["userName"]
  370. ? searchValues["userName"]
  371. : ""}
  372. onChange={(e) => {
  373. searchValues["userName"] = e.target.value;
  374. this.setState({
  375. searchValues: searchValues,
  376. });
  377. }}
  378. />
  379. <Cascaders
  380. ref={node => this.Cascaders = node}
  381. placeholder="订单部门"
  382. id="id"
  383. name="name"
  384. children="list"
  385. height={28}
  386. onSel={(e) => {
  387. searchValues["deps"] = JSON.stringify(e);
  388. this.setState({
  389. searchValues: searchValues,
  390. });
  391. }}
  392. />
  393. <Input
  394. placeholder="项目名称"
  395. style={{ width: 160 }}
  396. value={searchValues["projectName"]
  397. ? searchValues["projectName"]
  398. : ""}
  399. onChange={(e) => {
  400. searchValues["projectName"] = e.target.value;
  401. this.setState({
  402. searchValues: searchValues,
  403. });
  404. }}
  405. />
  406. <Select
  407. style={{ width: 120 }}
  408. placeholder="项目暂停状态"
  409. value={searchValues["status"]
  410. ? searchValues["status"]
  411. : undefined}
  412. onChange={(e) => {
  413. searchValues["status"] = e;
  414. this.setState({
  415. searchValues: searchValues,
  416. });
  417. }}
  418. >
  419. <Option value="">全部</Option>
  420. <Option value="0">暂停待审核</Option>
  421. <Option value="1">重启待审核</Option>
  422. <Option value="2">暂停完成</Option>
  423. <Option value="3">重启完成</Option>
  424. <Option value="4">暂停已驳回</Option>
  425. <Option value="5">重启已驳回</Option>
  426. </Select>
  427. <AutoComplete
  428. dropdownMatchSelectWidth={false}
  429. style={{ width: 160 }}
  430. dataSource={options}
  431. placeholder="咨询师/经理"
  432. value={searchValues.aname || undefined}
  433. onChange={this.followUp.bind(this)}
  434. filterOption={true}
  435. onBlur={this.blurChange}
  436. onSelect={this.selectF.bind(this)}
  437. >
  438. <Input />
  439. </AutoComplete>
  440. <RangePicker
  441. style={{ width: 200 }}
  442. value={[
  443. searchValues.startTime
  444. ? moment(searchValues.startTime)
  445. : null,
  446. searchValues.endTime ? moment(searchValues.endTime) : null,
  447. ]}
  448. onChange={(data, dataString) => {
  449. this.setState({
  450. searchValues: Object.assign(searchValues, {
  451. startTime: dataString[0],
  452. endTime: dataString[1],
  453. }),
  454. });
  455. }}
  456. />
  457. <Button
  458. type="primary"
  459. onClick={this.search}
  460. style={{ marginLeft: 10 }}
  461. disabled={this.state.loading ? true : false}
  462. >
  463. 搜索
  464. </Button>
  465. <Button onClick={this.reset}>重置</Button>
  466. </div>
  467. </TabPane>
  468. <TabPane tab="更改表格显示数据" key="2">
  469. <div style={{ marginLeft: 10 }}>
  470. <ChooseList
  471. columns={this.state.columns}
  472. changeFn={this.changeList}
  473. changeList={this.state.changeList}
  474. top={55}
  475. margin={11}
  476. />
  477. </div>
  478. </TabPane>
  479. </Tabs>
  480. <div className="patent-table">
  481. <Spin spinning={this.state.loading}>
  482. <Table
  483. bordered
  484. columns={
  485. this.state.changeList == undefined
  486. ? this.state.columns
  487. : this.state.changeList
  488. }
  489. dataSource={this.state.dataSource}
  490. pagination={this.state.pagination}
  491. onRowDoubleClick={this.tableRowClick.bind(this)}
  492. size="small"
  493. />
  494. </Spin>
  495. </div>
  496. <textarea id="copyText" style={{ opacity: 0 }} />
  497. {
  498. // 项目详情
  499. this.state.visible &&
  500. <MySuspend
  501. isApproved={true} // 审核权限
  502. type="details"
  503. title={rowData.stopType == 0 ? "项目暂停" : "项目重启"}
  504. contractNo={rowData.contractNo}
  505. orderNo={rowData.orderNo}
  506. userName={rowData.userName}
  507. reason={rowData.reason}
  508. annexUrl={rowData.annexUrl}
  509. rowData={rowData}
  510. selectedRows={[{ "commodityName": rowData.projectName, "id": rowData.tid }]}
  511. visible={this.state.visible}
  512. subClose={() => {
  513. this.loadData(this.state.pageNo);
  514. this.setState({
  515. visible: false,
  516. rowData: {},
  517. })
  518. }}
  519. />
  520. }
  521. </div>
  522. );
  523. },
  524. });
  525. export default SuspendExamine;