| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842 | import React from "react";import $ from "jquery/src/ajax";import { AutoComplete, Button, Input, Spin, Table, Select, message, Tabs, Tag, Tooltip, Modal } from "antd";import OrderDesc from "../../financialManage/orderDetail/orderDesc"import ResolutionDetail from "@/resolutionDetail";import { ChooseList } from "../../order/orderNew/chooseList"import ReactToPrint from "react-to-print";import OrderItemStatus from "../../../common/orderItemStatus";import { salesList } from "@/dataDic.js";import ProjectOperationVip from ".././../../common/projectOperation/vip";import ShowModalDiv from "@/showModal.jsx";import VipLogs from "../../../common/logPopup/viplogs";//会员日志import { splitUrl } from "@/tools";import ImgList from "../../../common/imgList";const { TabPane } = Tabs;//我的会员项目列表const MyProjectVip = React.createClass({  //  getInitialState() {    return {      dvisible: false,      pageNo: 1,      totalPage: 0,      searchValues: {},//查询条件      loading: false,      changeList: undefined,// 子组件改变的表格title数组      pagination: {        defaultCurrent: 1,        defaultPageSize: 10,        showQuickJumper: true,        pageSize: 10,        onChange: function (page) {          this.setState({            pageNo: page,          });          this.loadData(page);        }.bind(this),        showTotal: function (total) {          return "共" + total + "条数据";        },      },      columns: [        {          title: "销售类型",          dataIndex: "salesType",          key: "salesType",          render: (text, record) => {            return (              <Tooltip                title={salesList[text] + ((text == 3 || text == 4 || text == 5) ? (!record.other ? "" : "," + record.other) : "")}              >                <span>                  {salesList[text]}                </span>              </Tooltip>            );          },        },        {          title: "合同编号",          dataIndex: "contractNo",          key: "contractNo",          width: 160,          render: (text, record) => {            return (              <Tooltip                title={                  <Button                    type="primary"                    onClick={(e) => {                      e.stopPropagation();                      let input = document.getElementById("copyText");                      input.value = text;                      input.select();                      document.execCommand("copy");                      message.success("复制成功");                    }}                  >                    复制                  </Button>                }              >                <div>                  {text}                  <div style={{ display: "flex" }}>                    <OrderItemStatus deleteSign={record.deleteSign} />                    {                      record.approval == 1                        ? <Tag color="#faa755">特批待审</Tag> :                        record.approval == 2 && <Tag color="#ff0000">特批通过</Tag>                    }                  </div>                </div>              </Tooltip>            );          },        },        {          title: "客户名称",          dataIndex: "userName",          key: "userName",          width: 200,          render: text => {            return (              <Tooltip title={text}>                <div>{text}</div>              </Tooltip>            )          }        },        {          title: "订单编号",          dataIndex: "orderNo",          key: "orderNo",          width: 140,          render: (text, record) => {            return (              <Tooltip                title={                  <Button                    type="primary"                    onClick={(e) => {                      e.stopPropagation();                      let input = document.getElementById("copyText");                      input.value = text;                      input.select();                      document.execCommand("copy");                      message.success("复制成功");                    }}                  >                    复制                  </Button>                }              >                <div>                  {text}                  <div>                    {record.totalAmount >= 10 && <Tag color="#ef7207">大客户</Tag>}                    {record.projectType == 1 && <Tag color="rgb(22, 155, 213)">会员</Tag>}                  </div>                </div>              </Tooltip>            );          },        },        {          title: "订单部门",          dataIndex: "depName",          key: "depName",          className: "title-table",        },        {          title: "订单负责人",          dataIndex: "salesmanName",          key: "salesmanName",          className: "title-table",        },        {          title: "财务负责人",          dataIndex: "financeName",          key: "financeName",          className: "title-table",        },        {          title: "会员项目",          dataIndex: "projectName",          key: "projectName",          className: "title-table",          render: (text, record) => {            return (              <div>                {text}                {(record.memberType == 1 || record.memberType == 2) && <Tag color="#ff0000">特批项目</Tag>}              </div>            )          }        },        {          title: "数量",          dataIndex: "commodityQuantity",          key: "commodityQuantity",          className: "title-table",        },        {          title: "项目说明",          dataIndex: "taskComment",          key: "taskComment",          className: "title-table",          width: 300,        },        {          title: "状态",          dataIndex: "status",          key: "status",          className: "title-table",          render: (text) => {            return (              <div style={{ maxWidth: 115, color: text == 4 && "red" }}>                {["", "财务审核", "特批审核", "通过", "驳回"][text]}              </div>            );          }        },        {          title: "操作",          dataIndex: "pictureUrl",          key: "pictureUrl",          className: "title-table",          render: (text, recard) => {            return (              <div>                {                  recard.status == 4 &&                  <Button                    style={{ margin: 5 }}                    type="primary"                    onClick={() => {                      this.setState({                        vipVisible: true,                        dataInfor: recard,                      })                    }}                  >                    重新提交                  </Button>                }                <Button                  type="primary"                  style={{ margin: 5 }}                  onClick={(e) => {                    e.stopPropagation();                    let arr = text || [];                    this.setState({                      pictureUrlArr: splitUrl(arr, ",", globalConfig.avatarHost + "/upload"),                    }, () => {                      this.setState({                        imgListVisible: true,                      })                    })                  }}                >                  查看附件                </Button>                <VipLogs id={recard.id} />              </div>            );          },        },      ],      dataSource: [],      fjlist: [],// 营销员列表      checkOrderNo: "",//操作订单编号      checkData: "",//操作描述      checkVisible: "",//审核弹窗开关      checkId: "",//会员项目编号      result: -1,//1同意 0驳回      vipVisible: false,//编辑弹窗      dataInfor: {},//编辑的数据      imgListVisible: false,//附件弹窗      pictureUrlArr: [],//附件    };  },  componentWillMount() {    this.loadData();    this.departmentList();  },  // 关闭编辑弹窗  vipClose() {    this.setState({      vipVisible: false    }, () => {      this.loadData(this.state.pageNo);    })  },  // 获取订单部门  departmentList() {    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/organization/selectSuperId",      data: {},      success: function (data) {        let thedata = data.data;        let theArr = [];        if (!thedata) {          if (data.error && data.error.length) {            message.warning(data.error[0].message);          }        } else {          thedata.map(function (item, index) {            theArr.push({              key: index,              name: item.name,              id: item.id,            });          });        }        this.setState({          departmentArr: theArr,        });      }.bind(this),    }).always(      function () {      }.bind(this)    );  },  // 列表数据  loadData(pageNo, pageSize) {    const { searchValues, pagination } = this.state    this.setState({      loading: true,    });    let datas = Object.assign(searchValues, {      pageNo: pageNo || 1,      pageSize: pageSize || 10,      shiroType: 1, //营销员    });    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/orderProject/memberList",      data: datas,      success: function (data) {        this.setState({          loading: false,        });        if (data.error && data.error.length === 0) {          if (data.data.list) {            pagination.current = data.data.pageNo;            pagination.total = data.data.totalCount;            if (data.data && data.data.list && !data.data.list.length) {              pagination.current = 0;              pagination.total = 0;            }            this.setState({              dataSource: data.data.list,              pagination: this.state.pagination,              pageNo: data.data.pageNo,              totalPage: data.data.totalPage,            });          } else {            this.setState({              dataSource: data.data,              pagination: false,            });          }        } else {          message.warning(data.error[0].message);        }      }.bind(this),    }).always(      function () {        this.setState({          loading: false,        });      }.bind(this)    );  },  // 点击行  tableRowClick(record) {    this.state.RowData = record;    this.setState({      showDesc: true,    });  },  // 关闭  closeDesc(e, s) {    this.state.showDesc = e;    if (s) {      this.loadData(this.state.pageNo);    }  },  // 搜索  search() {    this.setState({      selectedRowKeys: []    })    this.loadData();  },  // 重置  reset() {    this.setState({      searchValues: JSON.parse(JSON.stringify({})),    }, () => {      this.loadData();    })  },  // 更改表格显示数据  changeList(arr) {    const newArr = [];    this.state.columns.forEach((item) => {      arr.forEach((val) => {        if (val === item.title) {          newArr.push(item);        }      });    });    this.setState({      changeList: newArr,    });  },  // 导出当前列表  exportAll() {    message.config({      duration: 20,    });    let loading = message.loading("下载中...");    this.setState({      exportPendingLoading: true,    });    let data = {      shiroType: 1, //我的    };    let obj1 = JSON.parse(JSON.stringify(this.state.searchValues));    data = Object.assign(data, obj1);    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: "/api/admin/orderProject/memberList/export",      data,      success: function (data) {        if (data.error.length === 0) {          this.download(data.data);        } else {          message.warning(data.error[0].message);        }      }.bind(this),    }).always(      function () {        loading();        this.setState({          exportPendingLoading: false,        });      }.bind(this)    );  },  // 打印  printAll() {    this.setState({      dvisible: true,    });    this.loadData(1, 9999999);  },  // 下载  download(fileName) {    window.location.href =      globalConfig.context + "/open/download?fileName=" + fileName;  },  // 查询订单负责人列表  followUp(e) {    const { searchValues } = this.state;    this.setState({      searchValues: Object.assign(searchValues, {        aname: e,      }),    });    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/customer/listAdminByName",      data: {        adminName: e,      },      success: function (data) {        let thedata = data.data;        if (!thedata) {          if (data.error && data.error.length) {            message.warning(data.error[0].message);          }          thedata = {};        }        this.setState({          fjlist: thedata,        });      }.bind(this),    }).always(      function () {        this.setState({          loading: false,        });      }.bind(this)    );  },  // 选中订单负责人  selectF(value) {    const { searchValues, fjlist } = this.state;    const newdataSources = JSON.stringify(fjlist) == "{}" ? [] : fjlist;    this.setState({      searchValues: Object.assign(searchValues, {        salesmanId: newdataSources.find((item) => item.name == value).id,      }),    });  },  // 失去焦点  blurChange(e) {    let theType = "";    let contactLists = this.state.customerArr || [];    if (e) {      contactLists.map(function (item) {        if (item.name == e.toString()) {          theType = item.id;        }      });    }    this.setState({      theTypes: theType,    });  },  // 删除数组最后一项(删除操作列)  truncate(arr) {    return arr.filter(function (v, i, ar) {      return i !== ar.length - 1    })  },  render() {    const { TextArea } = Input    const { searchValues, departmentArr = [] } = this.state    const dataSources = this.state.fjlist || [];    const options = dataSources.map((group) => (      <Select.Option key={group.id} value={group.name}>        {group.name}      </Select.Option>    ));    return (      <div className="user-content">        <ShowModalDiv ShowModal={this.state.showModal} />        <div className="content-title" style={{ marginBottom: 10 }}>          <span style={{ fontWeight: 900, fontSize: 16 }}>我的会员项目</span>        </div>        <Tabs defaultActiveKey="2" onChange={this.callback} className="test">          <TabPane tab="更改表格显示数据" key="1">            <div style={{ marginLeft: 10 }}>              <ChooseList                columns={this.state.columns}                changeFn={this.changeList}                changeList={this.state.changeList}                top={55}                margin={11}              />            </div>          </TabPane>          <TabPane tab="搜索" key="2">            <div className="user-search" style={{ marginLeft: 10 }}>              <Input                placeholder="订单编号"                value={searchValues["orderNo"]                  ? searchValues["orderNo"]                  : ""}                onChange={(e) => {                  searchValues["orderNo"] = e.target.value;                  this.setState({                    searchValues: searchValues,                  });                }}              />              <Input                placeholder="客户名称"                value={searchValues["userName"]                  ? searchValues["userName"]                  : ""}                onChange={(e) => {                  searchValues["userName"] = e.target.value;                  this.setState({                    searchValues: searchValues,                  });                }}              />              <Select                placeholder="订单部门"                style={{ width: 190, marginRight: 10 }}                value={searchValues["depId"]                  ? searchValues["depId"]                  : undefined}                onChange={(e) => {                  searchValues["depId"] = e;                  this.setState({                    searchValues: searchValues,                  });                }}              >                {departmentArr.map(function (item) {                  return (                    <Select.Option key={item.id}>{item.name}</Select.Option>                  );                })}              </Select>              <Input                placeholder="合同编号"                value={searchValues["contractNo"]                  ? searchValues["contractNo"]                  : ""}                onChange={(e) => {                  searchValues["contractNo"] = e.target.value;                  this.setState({                    searchValues: searchValues,                  });                }}              />              <AutoComplete                className="certain-category-search"                dropdownClassName="certain-category-search-dropdown"                dropdownMatchSelectWidth={false}                style={{ width: "120px" }}                dataSource={options}                placeholder="订单负责人"                value={searchValues.aname || undefined}                onChange={this.followUp.bind(this)}                filterOption={true}                onSelect={this.selectF.bind(this)}              >                <Input />              </AutoComplete>              <Input                placeholder="项目名称"                value={searchValues["projectName"]                  ? searchValues["projectName"]                  : ""}                onChange={(e) => {                  searchValues["projectName"] = e.target.value;                  this.setState({                    searchValues: searchValues,                  });                }}              />              <Select                style={{ width: 120 }}                placeholder="签单金额"                value={searchValues["amountStatus"]                  ? searchValues["amountStatus"]                  : undefined}                onChange={(e) => {                  searchValues["amountStatus"] = e;                  this.setState({                    searchValues: searchValues,                  });                }}              >                <Option value="0">10万元以下</Option>                <Option value="1">10~20万元</Option>                <Option value="2">20~30万元</Option>                <Option value="3">30~40万元</Option>                <Option value="4">40万元以上</Option>              </Select>              <Select                style={{ width: 120 }}                placeholder="特批状态"                value={searchValues["approval"]                  ? searchValues["approval"]                  : undefined}                onChange={(e) => {                  searchValues["approval"] = e;                  this.setState({                    searchValues: searchValues,                  });                }}              >                <Option value="0">非特批</Option>                <Option value="1">特批待审</Option>                <Option value="2">特批通过</Option>                <Option value="4">全部特批</Option>              </Select>              <Select                style={{ width: 120 }}                placeholder="审核状态"                value={searchValues["status"]                  ? searchValues["status"]                  : undefined}                onChange={(e) => {                  searchValues["status"] = e;                  this.setState({                    searchValues: searchValues,                  });                }}              >                <Option value="1">财务审核</Option>                <Option value="2">特批审核</Option>                <Option value="3">通过</Option>                <Option value="4">驳回</Option>                <Option value="5">全部</Option>              </Select>              <Button                type="primary"                onClick={this.search}                style={{ marginLeft: 10 }}                disabled={this.state.loading ? true : false}              >                搜索              </Button>              <Button onClick={this.reset}>重置</Button>            </div>          </TabPane>          <TabPane tab="打印" key="3">            <Button              type="primary"              style={{ margin: "11px 0px 10px 10px" }}              onClick={this.printAll}            >              打印当前列表            </Button>          </TabPane>          <TabPane tab="导出Excel" key="4">            <Button              type="primary"              style={{ margin: "11px 0px 10px 10px" }}              onClick={this.exportAll}            >              导出当前列表            </Button>          </TabPane>        </Tabs>        <div className="patent-table">          <Spin spinning={this.state.loading}>            <Table              bordered              columns={                this.state.changeList == undefined                  ? this.state.columns                  : this.state.changeList              }              dataSource={this.state.dataSource}              pagination={this.state.pagination}              onRowDoubleClick={this.tableRowClick.bind(this)}              size="small"            />          </Spin>        </div>        <textarea id="copyText" style={{ opacity: 0 }} />        {/* 订单详情 */}        <OrderDesc          data={this.state.RowData}          showDesc={this.state.showDesc}          closeDesc={this.closeDesc.bind(this)}        />        {          //打印预览          this.state.dvisible &&          <Modal            visible={this.state.dvisible}            footer=""            title="所有列表信息"            className="admin-desc-content"            width="1300px"            onCancel={() => {              this.loadData();              this.setState({                dvisible: false,              });            }}          >            <Spin spinning={this.state.loading}>              <div                className="patent-table"                style={{                  padding: "25px 0 30px 30px",                }}                ref={(e) => {                  this.refs.all = e;                }}              >                <Table                  columns={this.truncate(this.state.columns)}                  dataSource={this.state.dataSource}                  pagination={false}                  bordered                  size="small"                />              </div>            </Spin>            <ReactToPrint              trigger={() => (                <Button                  type="primary"                  style={{                    float: "right",                    marginTop: 10,                    position: "absolute",                    top: 0,                    right: 30,                  }}                >                  打印                </Button>              )}              content={() => this.refs.all}            />          </Modal>        }        {          // 会员项目添加编辑          this.state.vipVisible &&          <ProjectOperationVip            readOnly={false}            orderNo={this.state.dataInfor.orderNo}            visible={this.state.vipVisible}            dataInfor={this.state.dataInfor}            onCancel={this.vipClose}          />        }        {          //查看附件          this.state.imgListVisible &&          <Modal            maskClosable={false}            visible={this.state.imgListVisible}            onOk={() => {              this.setState({                imgListVisible: false,              });            }}            onCancel={() => {              this.setState({                imgListVisible: false,              });            }}            width="600px"            title="附件"            footer=""          >            <div>              <ImgList                fileList={this.state.pictureUrlArr}                domId="publicStatistics"              />            </div>          </Modal>        }      </div>    );  },});export default MyProjectVip;
 |