HW лет назад: 4
Родитель
Сommit
5d89937f78

+ 8 - 10
src/components/common/DataTable/index.tsx

@@ -15,6 +15,8 @@ export interface DataTable {
   requestProcess?: ()=>{},          // 请求前参数处理  用于处理向时间间隔上传时参数重复问题
   onRow?: ()=>{},                   // 内容行操作
   onHeaderRow?: ()=>{},             // 标题行操作
+  scroll?: {},
+  params?: {},                      // 额外的请求参数
 }
 
 const DataTable: React.FC<DataTable> =  (props) => {
@@ -24,15 +26,16 @@ const DataTable: React.FC<DataTable> =  (props) => {
     <ProTable
       columns={
         // 默认配置列都不出现在搜索中
-        // v5中不再支持设置search为true,所以用searchbool代替
+        // v5中不再支持设置search为true,所以用searchBool代替
         props.columns.map((v) => {
-          if(!v.searchbool){
+          if(!v.searchBool){
             v.search = false;
           };
           return v
         })
       }
       actionRef={actionRef}
+      params={props.params || {}}
       request={async (params = {}) =>{
           params.pageNo = params.current;
           delete params.current;
@@ -56,18 +59,13 @@ const DataTable: React.FC<DataTable> =  (props) => {
         type: 'multiple',
       }}
       rowKey={props.rowKey || 'id'}
-      search={{
-        filterType: 'query',
-        labelWidth: 'auto',
-        defaultCollapsed: false,
-        ...props.search,
-      }}
+      search={props.search}
       pagination={{
         pageSize: 10,
       }}
-      scroll={{ x: 1300 }}
+      scroll={props.scroll || {}}
       dateFormatter="string"    // 时间转换格式
-      headerTitle={props.headerTitle || '未知列表'}
+      headerTitle={props.headerTitle || false}
       toolBarRender={() => props.toolBarRender || false}
       rowSelection={props.rowSelection || false}
       tableAlertRender={props.tableAlertRender || false}

+ 108 - 0
src/pages/Order/Billing/components/billingHistory.jsx

@@ -0,0 +1,108 @@
+import React,{ Component } from 'react';
+import Modal from "@/components/common/Modal";
+import {
+  Button
+} from 'antd';
+import DataTable from "@/components/common/DataTable";
+
+import {
+  getInvoiceStatus
+} from '@/utils/tools';
+
+class BillingHistory extends Component{
+  constructor(props) {
+    super(props);
+    this.state={
+      columns: [
+        {
+          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",
+          align: 'center',
+          fixed: 'right',
+          width: 120,
+          render: (text, record) => {
+            return (
+              <div>
+                {record.status === 3 ? (
+                  <Button
+                    type="danger"
+                    onClick={e => {
+                      e.stopPropagation();
+                      // this.reject(record);
+                    }}
+                  >
+                    被拒,查看原因
+                  </Button>
+                ) : (
+                  getInvoiceStatus(text, record)
+                )}
+                {record.status === 3 ? (
+                  <Button
+                    type="primary"
+                    onClick={e => {
+                      e.stopPropagation();
+                      // this.recompose(record);
+                    }}
+                    style={{ marginLeft: "10px" }}
+                  >
+                    修改开票
+                  </Button>
+                ) : (
+                  ""
+                )}
+              </div>
+            );
+          }
+        }
+      ]
+    }
+  }
+
+  componentDidMount() {
+
+  }
+
+  render() {
+    return(
+      <Modal
+        {...this.props}
+        width={1200}
+        footer={null}
+        title='开票历史记录'
+      >
+        <DataTable
+          url='/api/admin/orderInvoice/salesmanOrderInvoiceList'
+          scroll={{ x: 1000 }}
+          params={{
+            orderNo: this.props.orderNo
+          }}
+          columns={this.state.columns}
+          search={false}
+        />
+      </Modal>
+    )
+  }
+}
+
+export default BillingHistory;

+ 241 - 55
src/pages/Order/Billing/index.jsx

@@ -1,9 +1,33 @@
 import React, { Component } from 'react';
 import DataTable from '@/components/common/DataTable';
-import {Button, Dropdown, Menu, Space, Table, DatePicker} from "antd";
+import {
+  Button,
+  Dropdown,
+  Menu,
+  Space,
+  Table,
+  DatePicker,
+  message,
+  Popconfirm
+} from "antd";
 import {EllipsisOutlined, PlusOutlined} from "@ant-design/icons";
 import { TableDropdown } from '@ant-design/pro-table';
+import { ProFormSelect } from '@ant-design/pro-form';
 import TableModal from './components/TableModal';
+import BillingHistory from './components/billingHistory';
+
+import {
+  getSelectSuperId,
+  getFakeCaptcha
+} from './services/API';
+
+import {
+  getProcessStatus,
+  getLiquidationStatus,
+  getApprovedState,
+  getNewOrderStatus
+} from "@/utils/tools";
+import {fakeAccountLogin} from "@/services/login";
 
 const { RangePicker } = DatePicker;
 
@@ -15,6 +39,24 @@ const menu = (
   </Menu>
 );
 
+// 部门
+const departmentList = async() => {
+  const msg = await getSelectSuperId();
+  if(msg.error.length === 0){
+    let theArr = [];
+    msg.data.forEach((item) => {
+      theArr.push({
+        label: item.name,
+        value: item.id
+      });
+    });
+    return theArr;
+  }else{
+    message.info(msg.error[0].message)
+  }
+  return [];
+}
+
 class Billing extends Component{
   constructor(props) {
     super(props);
@@ -24,17 +66,18 @@ class Billing extends Component{
           title: '合同编号',
           dataIndex: 'contractNo',
           width: 200,
-          lock: 'left',
-          searchbool: true,
+          searchBool: true,
         },
         {
           title: '订单编号',
           dataIndex: 'orderNo',
           width: 200,
+          searchBool: true,
         },
         {
           title: '客户名称',
           dataIndex: 'userName',
+          searchBool: true,
           render: text => {
             return text && text.length > 9 ? text.substr(0, 9) + '...' : text;
           },
@@ -42,13 +85,24 @@ class Billing extends Component{
         {
           title: '订单部门',
           dataIndex: 'depName',
+          key: 'depId',
           width: 200,
+          searchBool: true,
+          renderFormItem: () => {
+            return (
+              <ProFormSelect label='' request={departmentList}/>
+            );
+          },
         },
         {
           title: '下单时间',
           dataIndex: 'createDate',
+          key: 'createDate',
           valueType: 'dateRange',
-          searchbool: true,
+          searchBool: true,
+          render: (text, record) => {
+            return record.createDate;
+          }
         },
         {
           title: '合同签订时间',
@@ -56,76 +110,168 @@ class Billing extends Component{
           width: 200,
         },
         {
+          title: "流程状态",
+          dataIndex: "processStatus",
+          key: "processStatus",
+          render: text => {
+            return getProcessStatus(text);
+          }
+        },
+        {
           title: '签单金额(万元)',
           dataIndex: 'totalAmount',
           width: 200,
-          filters: true,
+          searchBool: true,
+          renderFormItem: () => {
+            return (
+              <ProFormSelect label='' valueEnum={{
+                '0': {
+                  text: '10万元以下',
+                },
+                '1': {
+                  text: '10~20万元',
+                },
+                '2': {
+                  text: '20~30万元',
+                },
+                '3': {
+                  text: '30~40万元',
+                },
+                '4': {
+                  text: '20~40万元以上',
+                },
+              }}/>
+            );
+          }
         },
         {
-          title: '自定义筛选',
-          key: 'direction',
-          hideInTable: true,
-          dataIndex: 'direction',
-          searchbool: true,
-          search: {
-            transform: (v)=>{
-              console.log(v)
-              return v
-            }
-          },
-          renderFormItem: (item, props) => {
+          title: "开票金额(万元)",
+          dataIndex: "invoiceAmount",
+          key: "invoiceAmount"
+        },
+        {
+          title: "已收款(万元)",
+          dataIndex: "settlementAmount",
+          key: "settlementAmount"
+        },
+        {
+          title: "结算状态",
+          dataIndex: "liquidationStatus",
+          key: "liquidationStatus",
+          searchBool: true,
+          renderFormItem: () => {
             return (
-              <RangePicker value={props.value} onPanelChange={props.onChange}/>
+              <ProFormSelect label='' valueEnum={{
+                '0': {
+                  text: '首付待付请',
+                },
+                '1': {
+                  text: '尾款待付清',
+                },
+                '2': {
+                  text: '已付清',
+                }
+              }}/>
             );
           },
+          render: text => {
+            return getLiquidationStatus(text);
+          }
         },
         {
-          title: '状态',
-          dataIndex: 'state',
-          initialValue: 'open',
-          valueType: 'select',
-          searchbool: true,
-          filters: true,
-          valueEnum: {
-            all: {
-              text: '全部',
-              status: 'Default'
-            },
-            open: {
-              text: '未解决',
-              status: 'Error',
-            },
-            closed: {
-              text: '已解决',
-              status: 'Success',
-            },
-            processing: {
-              text: '解决中',
-              status: 'Processing',
-            },
+          title: "是否特批",
+          dataIndex: "approval",
+          key: "approval",
+          searchBool: true,
+          renderFormItem: () => {
+            return (
+              <ProFormSelect label='' valueEnum={{
+                '0': {
+                  text: '非特批',
+                },
+                '1': {
+                  text: '特批',
+                },
+              }}/>
+            );
           },
+          render: text => {
+            return getApprovedState(text);
+          }
+        },
+        {
+          title: "订单状态",
+          dataIndex: "orderStatus",
+          key: "orderStatus",
+          render: text => {
+            return getNewOrderStatus(text);
+          }
         },
         {
+          title: "财务负责人",
+          dataIndex: "financeName",
+          key: "financeName"
+        },
+        // {
+        //   title: '自定义筛选',
+        //   key: 'direction',
+        //   hideInTable: true,
+        //   dataIndex: 'direction',
+        //   searchBool: true,
+        //   search: {
+        //     transform: (v)=>{
+        //       console.log(v)
+        //       return v
+        //     }
+        //   },
+        //   renderFormItem: (item, props) => {
+        //     return (
+        //       <ProFormSelect request={departmentList}/>
+        //     );
+        //   },
+        // },
+        {
           title: '操作',
           valueType: 'option',
           key: 'option',
           fixed: 'right',
           align: 'center',
           width: 150,
-          render: (text, record, _, action) => [
+          render: (text, record, key, action) => [
             <a
               key="editable"
-              onClick={() => {}}
+              onClick={(e) => {
+                e.stopPropagation();
+                this.visit(record, key);
+              }}
             >
               开票
             </a>,
-            <a target="_blank" rel="noopener noreferrer" key="view">
-              结项
-            </a>,
+            <Popconfirm
+              title="是否结项?"
+              onConfirm={(e) => {
+                e.stopPropagation();
+                this.delectRow(record.orderNo,action);
+              }}
+              onCancel={(e)=>{e.stopPropagation();}}
+              okText="是"
+              cancelText="否"
+            >
+              <a
+                target="_blank"
+                rel="noopener noreferrer"
+                key="view"
+                onClick={(e)=>{
+                  e.stopPropagation();
+                }}
+              >
+                结项
+              </a>
+            </Popconfirm>,
             <TableDropdown
               key="actionGroup"
               onSelect={(v) => {
-                //操作
+                // 操作
                 console.log(v)
               }}
               menus={[
@@ -138,20 +284,42 @@ class Billing extends Component{
       ],
       tableModal: false,
       tableRowInfor: {},
+      billingHistoryModal: false,
+      billinghistoryorderNo: '',
     }
+    this.dataTableRef = null;
   }
 
   componentDidMount() {
 
   }
 
+  // 结项
+  async delectRow(orderNo,action) {
+    const msg = await getFakeCaptcha(orderNo);
+    if(msg.error.length === 0){
+      message.success("该项目已成功结项!");
+      action.reload();
+    }else{
+      message.info(msg.error[0].message)
+    }
+  }
+
   render() {
     return (
-      <div>
+      <>
         <DataTable
+          ref={res => this.dataTableRef = res}
+          headerTitle='开单与签单'
           url='/api/admin/newOrder/orderNewList'
           rowKey='orderNo'
+          scroll={{ x: 2500 }}
           columns={this.state.columns}
+          search={{
+            filterType: 'query',
+            labelWidth: 'auto',
+            defaultCollapsed: false,
+          }}
           rowSelection={{
             type: 'radio',
             selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
@@ -181,7 +349,7 @@ class Billing extends Component{
           }}
           toolBarRender={[
             <Button key="button" icon={<PlusOutlined />} type="primary">
-              新建
+              开单
             </Button>,
             <Dropdown key="menu" overlay={menu}>
               <Button>
@@ -197,16 +365,21 @@ class Billing extends Component{
                   取消选择
                 </a>
               </span>
-                  <span>{`签单金额: ${selectedRows.reduce(
-                    (pre, item) => pre + item.totalAmount,
-                    0,
-                  )} 万`}</span>
+              <span>{`签单金额: ${selectedRows.reduce(
+                (pre, item) => pre + item.totalAmount,
+                0,
+              )} 万`}</span>
             </Space>
           )}
           tableAlertOptionRender={({ selectedRowKeys, selectedRows, onCleanSelected }) => {
             return (
               <Space size={16}>
-                <a>查看开票记录</a>
+                <a onClick={()=>{
+                  this.setState({
+                    billingHistoryModal: true,
+                    billinghistoryorderNo: selectedRowKeys[0],
+                  })
+                }}>查看开票记录</a>
                 <a>查看催款详情</a>
                 <a>查看项目进度</a>
               </Space>
@@ -226,7 +399,20 @@ class Billing extends Component{
             tableModal: false,
             tableRowInfor: {},
           })}/>
-      </div>
+        {/* 开票历史记录 */}
+        <BillingHistory
+          visible={this.state.billingHistoryModal}
+          orderNo={this.state.billinghistoryorderNo}
+          onCancel={() => this.setState({
+            billingHistoryModal: false,
+            billinghistoryorderNo: '',
+          })}
+          onOk={() => this.setState({
+            billingHistoryModal: false,
+            billinghistoryorderNo: '',
+          })}
+        />
+      </>
     );
   }
 }

+ 13 - 0
src/pages/Order/Billing/services/API.ts

@@ -0,0 +1,13 @@
+import { request } from 'umi';
+
+// 部门
+export async function getSelectSuperId() {
+  return request('/api/admin/organization/selectSuperId');
+}
+
+// 结项
+export async function getFakeCaptcha(orderNo: string) {
+  return request('/api/admin/newOrder/OrderOver',{
+    params:{orderNo}
+  });
+}

Разница между файлами не показана из-за своего большого размера
+ 3438 - 0
src/utils/dataDic.js


+ 88 - 0
src/utils/tools.js

@@ -0,0 +1,88 @@
+import {
+  processStatus,
+  liquidationStatus,
+  approvedState,
+  newOrderStatus,
+  invoiceStatus
+} from './dataDic';
+
+// 流程状态
+const getProcessStatus =(e) => {
+  if (e || e === 0) {
+    let theType = "";
+    processStatus.forEach((item) => {
+      if (item.value === e.toString()) {
+        theType = item.key;
+      }
+    });
+    return theType;
+  }
+  return '';
+}
+
+// 结算状态
+const getLiquidationStatus = (e) => {
+  if (e || e === 0) {
+    let theType = "";
+    liquidationStatus.forEach((item) => {
+      if (item.value === e.toString()) {
+        theType = item.key;
+      }
+    });
+    return theType;
+  }
+  return '';
+}
+
+// 特批状态
+const getApprovedState = (e) => {
+  if (e || e === 0) {
+    let theType = "";
+    approvedState.forEach((item) => {
+      if (item.value === e.toString()) {
+        theType = item.key;
+      }
+    });
+    return theType;
+  }
+  return '';
+}
+
+// 订单状态
+const getNewOrderStatus = (e) => {
+  if (e || e === 0) {
+    let theType = "";
+    newOrderStatus.forEach((item) => {
+      if (item.value === e.toString()) {
+        theType = item.key;
+      }
+    });
+    return theType;
+  }
+  return '';
+}
+
+// 开票状态
+const getInvoiceStatus = (e, record) => {
+  if (record && record.approval === 1) {
+    return "特批待审核";
+  }else{
+    if (e || e === 0) {
+      let theType = "";
+      invoiceStatus.forEach((item) => {
+        if (item.value === e.toString()) {
+          theType = item.key;
+        }
+      });
+      return theType;
+    }
+  }
+}
+
+export {
+  getProcessStatus,
+  getLiquidationStatus,
+  getApprovedState,
+  getNewOrderStatus,
+  getInvoiceStatus,
+};