123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660 |
- import React from "react";
- import $ from "jquery/src/ajax";
- import moment from "moment";
- import "./public.less";
- import {
- Form,
- Button,
- Input,
- Select,
- Spin,
- Table,
- message,
- Modal,
- Upload,
- DatePicker,
- Icon,
- } from "antd";
- import {
- getProjectStatus,
- getProvinceA,
- getInvoiceStatus,
- getprovince,
- getStatus,
- getPeople,
- splitUrl
- } from "@/tools";
- import { ChooseList } from "../../../../component/manageCenter/order/orderNew/chooseList";
- import "./huiKuan.less"
- const { RangePicker } = DatePicker;
- const FormItem = Form.Item;
- const { TextArea } = Input;
- const HuiKuan = React.createClass({
- loadData(pageNo) {
- this.state.data = [];
- this.setState({
- loading: true
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url:
- globalConfig.context +
- "/api/admin/orderInvoice/approvalOrderInvoiceList",
- data: {
- pageNo: pageNo || 1,
- pageSize: this.state.pagination.pageSize,
- name: this.state.nameSearch, //客户名称
- userName: this.state.userName,
- status: this.state.status,
- orderNo: this.state.orderNoSearch,
- orderDep: this.state.departmenttList,
- type: 0,
- approval: this.state.processStatus
- },
- success: function(data) {
- let theArr = [];
- if (!data.data || !data.data.list) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- }
- } else {
- for (let i = 0; i < data.data.list.length; i++) {
- let thisdata = data.data.list[i];
- theArr.push({
- key: i,
- id: thisdata.id,
- status: thisdata.status,
- unitName: thisdata.unitName,
- orderno: thisdata.orderno,
- name: thisdata.name,
- processStatus: thisdata.processStatus,
- projectStatus: thisdata.projectStatus,
- amount: thisdata.amount,
- sumAmount: thisdata.sumAmount,
- createTime: thisdata.createTime
- ? new Date(thisdata.createTime).toLocaleString()
- : "",
- settlementAmount: thisdata.settlementAmount,
- notAmount: thisdata.notAmount,
- approval: thisdata.approval
- });
- }
- }
- 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({
- totalPage: data.data.totalPage,
- dataSource: theArr,
- pagination: this.state.pagination
- });
- }.bind(this)
- }).always(
- function() {
- this.setState({
- loading: false
- });
- }.bind(this)
- );
- },
- departmentList() {
- this.setState({
- loading: true
- });
- $.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() {
- this.setState({
- loading: false
- });
- }.bind(this)
- );
- },
- getInitialState() {
- return {
- visible: false,
- selectedRowKeys: [], // Check here to configure the default column
- loading: false,
- searchMore: true,
- assignVisible: false,
- releaseDate: [],
- totalPage: 0,
- boHuivisible: false,
- selectedRowKeys: [],
- selectedRows: [],
- // 弹出层数据
- modalData: {},
- // userName: "",
- contractNo: "",
- loading: false,
- reason: "",
- foo: 0,
- // 子组件改变的表格title数组
- changeList: undefined,
- pagination: {
- defaultCurrent: 1,
- defaultPageSize: 10,
- showQuickJumper: true,
- pageSize: 10,
- onChange: function(page) {
- this.loadData(page);
- }.bind(this),
- showTotal: function(total) {
- return "共" + total + "条数据";
- }
- },
- columns: [
- {
- title: "合同编号",
- dataIndex: "id",
- key: "id"
- // fixed: "left"
- },
- {
- title: "订单编号",
- dataIndex: "orderNo",
- key: "orderNo"
- },
- {
- title: "客户名称",
- dataIndex: "name",
- key: "name"
- },
- {
- title: "合同额",
- dataIndex: "hetong",
- key: "hetong"
- },
- {
- title: "本次回款(万元)",
- dataIndex: "benci",
- key: "benci"
- },
- {
- title: "回款时间",
- dataIndex: "huiTime",
- key: "huiTime"
- },
- {
- title: "批量导入时间",
- dataIndex: "daoTime",
- key: "daoTime"
- },
- {
- title: "备注",
- dataIndex: "remake",
- key: "remake"
- }
- ],
- columnsDate: [
- {
- title: "编号",
- dataIndex: "id",
- key: "id"
- },
- {
- title: "订单编号",
- dataIndex: "orderno",
- key: "orderno"
- },
- {
- title: "开票金额(万元)",
- dataIndex: "amount",
- key: "amount"
- },
- {
- title: "申请时间",
- dataIndex: "createTime",
- key: "createTime"
- },
- {
- title: "开票状态",
- dataIndex: "status",
- key: "status",
- render: text => {
- return getInvoiceStatus(text);
- }
- }
- ],
- dataSource: [],
- // dataSource: [
- // {
- // id: 1,
- // orderNo: "w1",
- // name: "张三",
- // hetong: 3,
- // benci: 1,
- // huiTime: "2019-10-11",
- // daoTime: "2019-10-11",
- // remake: "hhhhh",
- // key: "w1"
- // },
- // {
- // id: 2,
- // orderNo: "w2",
- // name: "王五",
- // hetong: 3,
- // benci: 1,
- // huiTime: "2019-10-11",
- // daoTime: "2019-10-11",
- // remake: "zzzzzz",
- // key: "w2"
- // },
- // {
- // id: 3,
- // orderNo: "w3",
- // name: "二麻子",
- // hetong: 3,
- // benci: 1,
- // huiTime: "2019-10-11",
- // daoTime: "2019-10-11",
- // remake: "yyyyyyy",
- // key: "w3"
- // },
- // {
- // id: 4,
- // orderNo: "w4",
- // name: "jax",
- // hetong: 3,
- // benci: 1,
- // huiTime: "2019-10-11",
- // daoTime: "2019-10-11",
- // remake: "bbbbbb",
- // key: "w4"
- // }
- // ],
- upLoadFlag: false,
- upLoad: {
- name: "file",
- action: "https://www.mocky.io/v2/5cc8019d300000980a055e76",
- headers: {
- authorization: "authorization-text"
- },
- onChange: info => {
- if (info.file.status !== "uploading") {
- console.log(info.file, info.fileList);
- }
- if (info.file.status === "done") {
- message.success(`${info.file.name} 文件上传成功`);
- this.state.upLoadFlag = true;
- let dataSource = [
- {
- id: 1,
- orderNo: "w1",
- name: "张三",
- hetong: 3,
- benci: 1,
- huiTime: "2019-10-11",
- daoTime: "2019-10-11",
- remake: "hhhhh",
- key: "w1"
- },
- {
- id: 2,
- orderNo: "w2",
- name: "王五",
- hetong: 3,
- benci: 1,
- huiTime: "2019-10-11",
- daoTime: "2019-10-11",
- remake: "zzzzzz",
- key: "w2"
- },
- {
- id: 3,
- orderNo: "w3",
- name: "二麻子",
- hetong: 3,
- benci: 1,
- huiTime: "2019-10-11",
- daoTime: "2019-10-11",
- remake: "yyyyyyy",
- key: "w3"
- },
- {
- id: 4,
- orderNo: "w4",
- name: "jax",
- hetong: 3,
- benci: 1,
- huiTime: "2019-10-11",
- daoTime: "2019-10-11",
- remake: "bbbbbb",
- key: "w4"
- }
- ]
- this.setState({
- upLoadFlag: this.state.upLoadFlag,
- dataSource
- });
- } else if (info.file.status === "error") {
- message.error(`${info.file.name} 文件上传失败`);
- this.state.upLoadFlag = false;
- this.setState({
- upLoadFlag: this.state.upLoadFlag
- });
- }
- console.log(info);
- }
- // beforeUpload: (file,fileList) => {
- // if (fileList.length = 1) {
- // this.state.upLoadFlag = true;
- // this.setState({
- // upLoadFlag: this.state.upLoadFlag
- // });
- // } else {
- // this.state.upLoadFlag = false;
- // this.setState({
- // upLoadFlag: this.state.upLoadFlag
- // });
- // }
- // }
- }
- };
- },
- search() {
- this.loadData();
- },
- componentWillMount() {
- // this.loadData();
- this.departmentList();
- },
- reset() {
- this.state.nameSearch = "";
- this.state.releaseDate = [];
- this.state.orderNoSearch = "";
- this.state.userName = "";
- this.state.departmenttList = [];
- // 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
- });
- },
- onSelectChange(selectedRowKeys) {
- console.log("selectedRowKeys changed: ", selectedRowKeys);
- this.setState({ selectedRowKeys });
- },
- showModal() {
- this.setState({
- visible: true
- });
- this.state.dataSource.forEach((item) => {
- if(item.key == this.state.selectedRowKeys[0]) {
- this.setState({
- modalData: item
- })
- }
- })
- },
- handleOk() {
- this.setState({ loading: true });
- setTimeout(() => {
- this.setState({ loading: false, visible: false });
- }, 3000);
- },
- handleCancel() {
- this.setState({ visible: false });
- },
- render() {
- const formItemLayout = {
- labelCol: { span: 8 },
- wrapperCol: { span: 14 }
- };
- var departmentArr = this.state.departmentArr || [];
- const { loading, selectedRowKeys, visible } = this.state;
- const rowSelection = {
- selectedRowKeys,
- onChange: this.onSelectChange,
- hideDefaultSelections: true
- };
- var departmentArr = this.state.departmentArr || [];
- return (
- <div className="user-content" style={{ position: "relative" }}>
- <div className="content-title">
- <span>回款</span>
- </div>
- <div className="user-search">
- <Input
- placeholder="合同编号"
- value={this.state.nameSearch}
- onChange={e => {
- this.setState({ nameSearch: e.target.value });
- }}
- />
- <Input
- placeholder="订单编号"
- value={this.state.orderNoSearch}
- onChange={e => {
- this.setState({ orderNoSearch: e.target.value });
- }}
- />
- <Input
- placeholder="客户名称"
- value={this.state.userName}
- onChange={e => {
- this.setState({ userName: e.target.value });
- }}
- />
- <Select
- placeholder="订单部门"
- style={{ width: 150, marginRight: 10 }}
- value={this.state.departmenttList}
- onChange={e => {
- this.setState({ departmenttList: e });
- }}
- >
- {departmentArr.map(function(item) {
- return <Select.Option key={item.id}>{item.name}</Select.Option>;
- })}
- </Select>
- <Button
- type="primary"
- onClick={this.search}
- style={{ marginLeft: 10 }}
- >
- 搜索
- </Button>
- <Button onClick={this.reset}>重置</Button>
- </div>
- <ChooseList
- columns={this.state.columns}
- changeFn={this.changeList}
- changeList={this.state.changeList}
- top={55}
- display={"inline-block"}
- />
- <Button
- type="primary"
- style={{ marginLeft: 15 }}
- disabled={this.state.selectedRowKeys.length == 1 ? false : true}
- onClick={this.showModal}
- >
- 修改单条数据
- </Button>
- <div className="patent-table">
- <div
- class={123}
- style={{
- position: "absolute",
- zIndex: 99,
- top: 195,
- left: "50%",
- transform: "translateX(-50%)",
- display: this.state.dataSource.length != 0 ? "none" : "block"
- }}
- >
- <Upload {...this.state.upLoad}>
- <Button type="primary" disabled={ this.state.upLoadFlag }>
- <Icon type="upload" />
- 导入回款列表
- </Button>
- </Upload>
- </div>
- <Spin spinning={this.state.loading}>
- <Table
- columns={
- this.state.changeList == undefined
- ? this.state.columns
- : this.state.changeList
- }
- // scroll={{ x: 1500, y: 0 }}
- dataSource={this.state.dataSource}
- pagination={this.state.pagination}
- rowSelection={rowSelection}
- bordered
- />
- </Spin>
- </div>
- <Modal
- width={800}
- visible={visible}
- title="收款记录"
- onOk={this.handleOk}
- onCancel={this.handleCancel}
- footer={[
- <Button key="back" onClick={this.handleCancel}>
- 取消
- </Button>,
- <Button
- key="submit"
- type="primary"
- loading={loading}
- onClick={this.handleOk}
- >
- 保存
- </Button>
- ]}
- >
- <p style={{ marginBottom: 10 }}>
- 合同编号:{this.state.modalData.name}
- </p>
- <p style={{ marginBottom: 10 }}>
- 订单编号:{this.state.modalData.name}
- </p>
- <p style={{ marginBottom: 10 }}>
- 客户名称:{this.state.modalData.name}
- </p>
- <p style={{ marginBottom: 10 }}>
- 合同额(万元):
- <Input
- style={{ width: "auto" }}
- value={this.state.modalData.hetong}
- onChange={e => {
- let val = e.target.value;
- this.state.modalData.hetong = val;
- this.setState({ modalData: this.state.modalData });
- }}
- />
- </p>
- <p style={{ marginBottom: 10 }}>
- 本次回款(万元):
- <Input
- style={{ width: "auto" }}
- value={this.state.modalData.benci}
- onChange={e => {
- let val = e.target.value;
- this.state.modalData.benci = val;
- this.setState({ modalData: this.state.modalData });
- }}
- />
- </p>
- <p style={{ marginBottom: 10 }}>
- 回款时间:
- <DatePicker
- showTime
- placeholder="选择回款时间"
- value={moment(this.state.modalData.huiTime, "YYYY-MM-DD")}
- onChange={(v, e) => {
- this.state.modalData.huiTime = e;
- console.log(e);
- this.setState({ modalData: this.state.modalData });
- }}
- onOk={() => {}}
- />
- </p>
- <p style={{ marginBottom: 10 }}>
- 批量导入时间:{this.state.modalData.daoTime}
- </p>
- <p style={{ marginBottom: 10 }}>
- <span style={{ display: "inline-block", marginBottom: 20 }}>
- 备注:
- </span>
- <TextArea
- style={{ width: "70%" }}
- value={this.state.modalData.remake}
- onChange={e => {
- this.state.modalData.remake = e.target.value;
- console.log(e);
- this.setState({ modalData: this.state.modalData });
- }}
- placeholder="请输入备注信息"
- autosize={{ minRows: 3, maxRows: 5 }}
- />
- </p>
- </Modal>
- </div>
- );
- }
- });
- export default HuiKuan;
|