suspendexamine.jsx 15 KB

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