| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996 | import React, { Component } from "react";import {  AutoComplete,  Button,  DatePicker,  Input,  message,  Modal,  Select,  Spin,  Table,  Tabs,  Tag,  Tooltip,} from "antd";import { ShowModal, splitUrl, getClockState } from "@/tools";import { clockState } from "@/dataDic";import { ChooseList } from "../../order/orderNew/chooseList";import $ from "jquery/src/ajax";import "./index.less";import moment from "moment";import ImgList from "../../../common/imgList";const { TabPane } = Tabs;const { RangePicker } = DatePicker;class PublicSummary extends Component {  constructor(props) {    super(props);    this.state = {      pageNo: 1,      loading: false,      changeList: [],      annexUrlArr: [],      photoUrlArr: [],      imgListVisible: false,      columns: [        {          title: "编号",          dataIndex: "key",          key: "key",          width: 45,          fixed: "left",        },        {          title: "客户名称",          dataIndex: "nickname",          key: "nickname",          width: 80,          fixed: "left",          render: (text) => {            return (              <div                style={{                  width: 80,                  wordBreak: "break-all",                }}              >                {text}              </div>            );          },        },        {          title: "跟单人",          dataIndex: "sname",          key: "sname",          width: 90,          render: (text) => {            return (              <Tooltip title={text}>                <div                  style={{                    width: 90,                    overflow: "hidden",                    textOverflow: "ellipsis",                    whiteSpace: "nowrap",                  }}                >                  {text}                </div>              </Tooltip>            );          },        },        {          title: "公出申请人",          dataIndex: "aname",          key: "aname",          width: 90,          render: (text) => {            return (              <Tooltip title={text}>                <div                  style={{                    width: 90,                    overflow: "hidden",                    textOverflow: "ellipsis",                    whiteSpace: "nowrap",                  }}                >                  {text}                </div>              </Tooltip>            );          },        },        {          title: "申请时间",          dataIndex: "createTimes",          key: "createTimes",          width: 130,        },        {          title: "公出时间",          dataIndex: "releaseStarts",          key: "releaseStarts",          width: 130,          render: (text, record) => (            <div>              <div>{text}</div>              <div style={{ paddingLeft: "44px" }}>至</div>              <div>{record.releaseEnds}</div>            </div>          ),        },        {          title: "公出地点",          dataIndex: "userName",          key: "userName",          width: 120,          render: (text) => {            return (              <div              // style={{              //   width: 120,              //   overflow: "hidden",              //   textOverflow: "ellipsis",              //   whiteSpace: "nowrap",              // }}              >                {text}              </div>            );          },        },        {          title: "公出时长(时)",          dataIndex: "duration",          key: "duration",          width: 50,        },        {          title: "打卡时间",          dataIndex: "clockInTimes",          key: "clockInTimes",          width: 130,        },        {          title: "审核状态",          dataIndex: "status",          key: "status",          width: 40,          render: (text, record) => (            <div style={{ display: "flex", flexDirection: "row" }}>              <Tag color={getClockState(text).color}>                {getClockState(text).title}              </Tag>              {record.updateStatus == 1 && <Tag color="#1E90FF">改</Tag>}            </div>            // <Tag color={getClockState(text).color}>            //   {getClockState(text).title}            // </Tag>          ),        },        {          title: "打卡状态",          dataIndex: "clockIn",          key: "clockIn",          width: 70,          render: (text) =>            text === 1 ? "已打卡" : text === 0 ? "未打卡" : "",        },        {          title: "公出类型",          dataIndex: "type",          key: "type",          width: 70,          render: (text) =>            text === 2              ? "行政公出"              : text === 1              ? "技术公出"              : text === 0              ? "业务公出"              : "",          // text === 1 ? "技术公出" : text === 0 ? "业务/行政公出" : "",        },        {          title: "公出目标",          dataIndex: "remarks",          key: "remarks",          width: 280,          render: (text) => {            return (              <div              // style={{              //   width: 60,              //   overflow: "hidden",              //   textOverflow: "ellipsis",              //   whiteSpace: "nowrap",              // }}              >                {text}              </div>            );          },        },        {          title: "公出计划",          dataIndex: "plan",          key: "plan",          width: 280,          render: (text) => {            return (              <div              // style={{              //   width: 60,              //   overflow: "hidden",              //   textOverflow: "ellipsis",              //   whiteSpace: "nowrap",              // }}              // title={text}              >                {text}              </div>            );          },        },        {          title: "预计效果",          dataIndex: "expectedEffect",          key: "expectedEffect",          width: 280,          render: (text) => {            return (              <div              // style={{              //   width: 60,              //   overflow: "hidden",              //   textOverflow: "ellipsis",              //   whiteSpace: "nowrap",              // }}              // title={text}              >                {text}              </div>            );          },        },        {          title: "本次公出目标总结",          dataIndex: "supplement",          key: "supplement",          width: 280,          render: (text) => {            return (              <div              // style={{              //   width: 130,              //   overflow: "hidden",              //   textOverflow: "ellipsis",              //   whiteSpace: "nowrap",              // }}              // title={text}              >                {text}              </div>            );          },        },        {          title: "下一次公出计划",          dataIndex: "nextPlan",          key: "nextPlan",          width: 280,          render: (text) => {            return (              <div              // style={{              //   width: 120,              //   overflow: "hidden",              //   textOverflow: "ellipsis",              //   whiteSpace: "nowrap",              // }}              // title={text}              >                {text}              </div>            );          },        },        {          title: "审核/指导",          dataIndex: "auditInfo",          key: "auditInfo",          width: 200,          render: (text) => {            return <div style={{ wordBreak: "break-all" }}>{text}</div>;          },        },        {          title: "操作",          dataIndex: "annexUrl",          key: "annexUrl",          render: (text, record) => (            <div>              <Button                type={"primary"}                onClick={(e) => {                  e.stopPropagation();                  let arr1 = text || [];                  let arr2 = record.photoUrl || [];                  this.setState(                    {                      annexUrlArr: splitUrl(                        arr1,                        ",",                        globalConfig.avatarHost + "/upload"                      ),                      photoUrlArr: splitUrl(                        arr2,                        ",",                        globalConfig.avatarHost + "/upload"                      ),                    },                    () => {                      this.setState({                        imgListVisible: true,                      });                    }                  );                }}              >                查看附件              </Button>            </div>          ),        },      ],      pagination: {        defaultCurrent: 1,        defaultPageSize: 10,        showQuickJumper: true,        pageSize: 10,        onChange: function (page) {          this.loadData(page);        }.bind(this),        showTotal: function (total) {          return "共" + total + "条数据";        },      },      dataSource: [],      releaseDate: [],      status: undefined,      clockIn: undefined,      depId: undefined,      theTypes: undefined,      theTypes1: undefined,      theCustomerTypes: undefined,    };    this.loadData = this.loadData.bind(this);    this.resetAll = this.resetAll.bind(this);    this.changeList = this.changeList.bind(this);    this.selectSuperId = this.selectSuperId.bind(this);    this.supervisor = this.supervisor.bind(this);    this.httpChange = this.httpChange.bind(this);    this.blurChange = this.blurChange.bind(this);    this.selectAuto = this.selectAuto.bind(this);    this.httpChange1 = this.httpChange1.bind(this);    this.blurChange1 = this.blurChange1.bind(this);    this.selectAuto1 = this.selectAuto1.bind(this);    this.getCustomer = this.getCustomer.bind(this);    this.selectCustomerAuto = this.selectCustomerAuto.bind(this);    this.httpCustomerChange = this.httpCustomerChange.bind(this);    this.blurCustomerChange = this.blurCustomerChange.bind(this);    this.exportExec = this.exportExec.bind(this);  }  //获取上级组织  selectSuperId() {    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/organization/selectSuperId",      data: {},      success: function (data) {        let theArr = [];        if (data.error && data.error.length === 0) {          for (let i = 0; i < data.data.length; i++) {            let theData = data.data[i];            theArr.push(              <Select.Option value={theData.id} key={theData.id}>                {theData.name}              </Select.Option>            );          }          this.setState({            contactsOption: theArr,          });        } else {          message.warning(data.error[0].message);        }      }.bind(this),    }).always(      function () {        this.setState({          loading: false,        });      }.bind(this)    );  }  changeList(arr) {    const newArr = [];    this.state.columns.forEach((item) => {      arr.forEach((val) => {        if (val === item.title) {          newArr.push(item);        }      });    });    this.setState({      changeList: newArr,    });  }  loadData(pageNo) {    this.setState({      loading: true,    });    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/release/publicReleaseDtails",      data: {        pageNo: pageNo || 1,        pageSize: this.state.pagination.pageSize,        releaseStart: this.state.releaseDate[0] || undefined,        releaseEnd: this.state.releaseDate[1] || undefined,        aid: this.state.theTypes || undefined,        sid: this.state.theTypes1 || undefined,        uid: this.state.theCustomerTypes,        status: this.state.status,        clockIn: this.state.clockIn,        depId: this.state.depId || undefined,        publicType: this.state.type,      },      success: function (data) {        ShowModal(this);        let theArr = [];        this.setState({          loading: false,        });        if (data.error && data.error.length === 0) {          for (let i = 0; i < data.data.list.length; i++) {            let thisdata = data.data.list[i];            thisdata.key = (data.data.pageNo - 1) * data.data.pageSize + i + 1;            theArr.push(thisdata);          }          this.state.pagination.current = data.data.pageNo;          this.state.pagination.total = data.data.totalCount;          if (data.data && data.data.list && !data.data.list.length) {            this.state.pagination.current = 0;            this.state.pagination.total = 0;          }          this.setState({            dataSource: theArr,            pagination: this.state.pagination,            pageNo: data.data.pageNo,          });        } else {          message.warning(data.error[0].message);        }      }.bind(this),    }).always(      function () {        this.setState({          loading: false,        });      }.bind(this)    );  }  resetAll() {    this.setState(      {        releaseDate: [],        theCustomerTypes: undefined,        status: undefined,        clockIn: undefined,        depId: undefined,        auto: "",        auto1: "",        customer: "",        theTypes: undefined,        theTypes1: undefined,        type: undefined,      },      () => {        this.loadData();      }    );  }  supervisor(e) {    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/customer/listAdminByName",      data: {        adminName: e,      },      success: function (data) {        if (data.error && data.error.length === 0) {          this.setState({            customerArr: data.data,          });        } else {          message.warning(data.error[0].message);        }      }.bind(this),    }).always(function () {}.bind(this));  }  supervisor1(e) {    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/customer/listAdminByName",      data: {        adminName: e,      },      success: function (data) {        if (data.error && data.error.length === 0) {          this.setState({            customerArr1: data.data,          });        } else {          message.warning(data.error[0].message);        }      }.bind(this),    }).always(function () {}.bind(this));  }  httpChange(e) {    if (e.length >= 1) {      this.supervisor(e);    }    this.setState({      auto: e,    });  }  httpChange1(e) {    if (e.length >= 1) {      this.supervisor1(e);    }    this.setState({      auto1: e,    });  }  selectAuto(value, options) {    this.setState({      auto: value,    });  }  selectAuto1(value, options) {    this.setState({      auto1: value,    });  }  httpCustomerChange(e) {    if (e.length >= 1) {      this.getCustomer(e);    }    this.setState({      customer: e,    });  }  selectCustomerAuto(value, options) {    this.setState({      customer: value,    });  }  getCustomer(e) {    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/customer/getUserByName",      data: {        name: e,      },      success: function (data) {        if (data.error && data.error.length === 0) {          this.setState({            customerList: data.data,          });        } else {          message.warning(data.error[0].message);        }      }.bind(this),    }).always(function () {}.bind(this));  }  blurCustomerChange(e) {    let theType = "";    let contactLists = this.state.customerList || [];    if (e) {      contactLists.map(function (item) {        if (item.name == e.toString()) {          theType = item.id;        }      });    }    this.setState({      theCustomerTypes: theType,    });  }  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,    });  }  blurChange1(e) {    let theType = "";    let contactLists = this.state.customerArr1 || [];    if (e) {      contactLists.map(function (item) {        if (item.name == e.toString()) {          theType = item.id;        }      });    }    this.setState({      theTypes1: theType,    });  }  componentWillMount() {    this.loadData();    this.selectSuperId();  }  exportExec() {    this.setState({      exportPendingLoading: true,    });    message.config({      duration: 20,    });    let loading = message.loading("下载中...");    let data = {      releaseStart: this.state.releaseDate[0],      releaseEnd: this.state.releaseDate[1],      aid: this.state.theTypes,      sid: this.state.theTypes1,      uid: this.state.theCustomerTypes,      status: this.state.status,      clockIn: this.state.clockIn,      depId: this.state.depId,      publicType: this.state.type,    };    for (let i of Object.keys(data)) {      if (i === "status" || i === "clockIn") {        if (isNaN(parseInt(data[i]))) {          delete data[i];        }      } else if (!data[i]) {        delete data[i];      }    }    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url:        globalConfig.context + "/api/admin/release/publicReleaseDtails/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)    );  }  download(fileName) {    window.location.href =      globalConfig.context + "/open/download?fileName=" + fileName;  }  render() {    const dataSources = this.state.customerArr || [];    const dataSources1 = this.state.customerArr1 || [];    const options = dataSources.map((group) => (      <Select.Option key={group.id} value={group.name}>        {group.name}      </Select.Option>    ));    const options1 = dataSources1.map((group) => (      <Select.Option key={group.id} value={group.name}>        {group.name}      </Select.Option>    ));    const customerList = this.state.customerList || [];    const customerOptions = customerList.map((group) => (      <Select.Option key={group.id} value={group.name}>        {group.name}      </Select.Option>    ));    return (      <div>        <div className="user-content">          <div className="content-title">            <span>公出详细列表(全部)</span>          </div>          <Tabs defaultActiveKey="1" className="test">            <TabPane tab="搜索" key="1">              <div                className="user-search"                style={{                  marginTop: "10px",                  marginLeft: "10px",                  marginRight: "10px",                }}              >                <span style={{ marginRight: "10px" }}>                  <AutoComplete                    className="certain-category-search"                    dropdownClassName="certain-category-search-dropdown"                    dropdownMatchSelectWidth={false}                    style={{ width: "120px" }}                    dataSource={customerOptions}                    placeholder="输入客户名称"                    value={this.state.customer}                    onChange={this.httpCustomerChange}                    filterOption={true}                    onBlur={this.blurCustomerChange}                    onSelect={this.selectCustomerAuto}                  >                    <Input />                  </AutoComplete>                </span>                <span style={{ marginRight: "10px" }}>                  <Select                    placeholder="请选择审核状态"                    style={{ width: 200, marginLeft: 10 }}                    value={this.state.status}                    onChange={(e) => {                      this.setState({ status: e });                    }}                  >                    {clockState.map((v, k) => (                      <Select.Option key={k} value={v.id}>                        {v.title}                      </Select.Option>                    ))}                  </Select>                </span>                <span style={{ marginRight: "10px" }}>                  <Select                    placeholder="请选择打卡状态"                    style={{ width: 200, marginLeft: 10 }}                    value={this.state.clockIn}                    onChange={(e) => {                      this.setState({ clockIn: e });                    }}                  >                    <Select.Option value={1}>已打卡</Select.Option>                    <Select.Option value={0}>未打卡</Select.Option>                  </Select>                </span>                <span style={{ marginRight: "10px" }}>                  <Select                    placeholder="请选择公出类型"                    style={{ width: 200, marginLeft: 10 }}                    value={this.state.type}                    onChange={(e) => {                      this.setState({ type: e });                    }}                  >                    <Select.Option value={0}>业务打卡</Select.Option>                    <Select.Option value={1}>技术打卡</Select.Option>                    <Select.Option value={2}>行政打卡</Select.Option>                    {/* <Select.Option value={0}>营销打卡</Select.Option>                    <Select.Option value={1}>技术打卡</Select.Option> */}                  </Select>                </span>                <span style={{ marginRight: "10px" }}>                  <AutoComplete                    className="certain-category-search"                    dropdownClassName="certain-category-search-dropdown"                    dropdownMatchSelectWidth={false}                    style={{ width: "120px" }}                    dataSource={options}                    placeholder="输入公出申请人"                    value={this.state.auto}                    onChange={this.httpChange}                    filterOption={true}                    onBlur={this.blurChange}                    onSelect={this.selectAuto}                  >                    <Input />                  </AutoComplete>                </span>                <span style={{ marginRight: "10px" }}>                  <AutoComplete                    className="certain-category-search"                    dropdownClassName="certain-category-search-dropdown"                    dropdownMatchSelectWidth={false}                    style={{ width: "120px" }}                    dataSource={options1}                    placeholder="输入跟单人"                    value={this.state.auto1}                    onChange={this.httpChange1}                    filterOption={true}                    onBlur={this.blurChange1}                    onSelect={this.selectAuto1}                  >                    <Input />                  </AutoComplete>                </span>                <span style={{ marginRight: "10px" }}>                  <Select                    placeholder="请选择公出部门"                    style={{ width: 200, marginLeft: 10 }}                    value={this.state.depId}                    onChange={(e) => {                      this.setState({ depId: e });                    }}                    notFoundContent="未获取到上级组织列表"                  >                    {this.state.contactsOption}                  </Select>                </span>                <span style={{ marginRight: "10px" }}>                  <span style={{ marginRight: "5px", marginBottom: "10px" }}>                    公出时间 :                  </span>                  <RangePicker                    style={{ marginRight: "10px", marginBottom: "10px" }}                    value={[                      this.state.releaseDate[0]                        ? moment(this.state.releaseDate[0])                        : null,                      this.state.releaseDate[1]                        ? moment(this.state.releaseDate[1])                        : null,                    ]}                    onChange={(data, dataString) => {                      this.setState({ releaseDate: dataString });                    }}                  />                </span>                <Button                  type="primary"                  onClick={() => {                    this.loadData();                  }}                  style={{ marginRight: "10px", marginBottom: "10px" }}                >                  搜索                </Button>                <Button                  onClick={this.resetAll}                  style={{ marginRight: "10px", marginBottom: "10px" }}                >                  重置                </Button>              </div>            </TabPane>            <TabPane tab="更改表格显示数据" key="2">              <div style={{ marginLeft: 10 }}>                <Spin spinning={this.state.loading}>                  <ChooseList                    columns={this.state.columns}                    changeFn={this.changeList}                    changeList={this.state.changeList}                    top={55}                    margin={11}                  />                </Spin>              </div>            </TabPane>            <TabPane tab="导出" key="3">              <div style={{ float: "left" }}>                <Button                  loading={this.state.exportPendingLoading}                  onClick={this.exportExec}                  style={{ margin: 10 }}                >                  导出excel                </Button>              </div>            </TabPane>          </Tabs>          <div className="patent-table">            <Spin spinning={this.state.loading}>              <Table                bordered                size="middle"                scroll={{ x: "120%" }}                columns={                  this.state.changeList.length > 0                    ? this.state.changeList                    : this.state.columns                }                dataSource={this.state.dataSource}                pagination={this.state.pagination}              />            </Spin>          </div>        </div>        {this.state.imgListVisible ? (          <Modal            maskClosable={false}            visible={this.state.imgListVisible}            onOk={() => {              this.setState({                imgListVisible: false,              });            }}            onCancel={() => {              this.setState({                imgListVisible: false,              });            }}            width="500px"            title="图片"            footer=""          >            <div>              <div>申请附件</div>              <ImgList                fileList={this.state.annexUrlArr}                domId="publicStatistics"              />              <div style={{ paddingTop: "35px" }}>打卡照片</div>              <ImgList                fileList={this.state.photoUrlArr}                domId="publicStatistics1"              />            </div>          </Modal>        ) : null}      </div>    );  }}export default PublicSummary;
 |