浏览代码

列合并

dev01 2 月之前
父节点
当前提交
f3818f6609
共有 1 个文件被更改,包括 294 次插入37 次删除
  1. 294 37
      js/component/manageCenter/project/summary/projecDataStatistics.jsx

+ 294 - 37
js/component/manageCenter/project/summary/projecDataStatistics.jsx

@@ -54,171 +54,374 @@ const ProjecDataStatistics = Form.create()(React.createClass({
           dataIndex: "salesType",
           key: "salesType",
           render: (text, record) => {
-            return (
-              <Tooltip
-                title={salesList[text] + ((text == 3 || text == 4 || text == 5) ? (!record.other ? "" : "," + record.other) : "")}
-              >
+            const obj = {
+              children: <Tooltip title={salesList[text] + ((text == 3 || text == 4 || text == 5) ? (!record.other ? "" : "," + record.other) : "")}>
                 <span>
                   {salesList[text]}
                 </span>
-              </Tooltip>
-            );
+              </Tooltip>,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
           },
         },
         {
           title: "订单类型",
           dataIndex: "serviceType",
           key: "serviceType",
-          render: text => {
-            return (
-              <div style={{ maxWidth: 200 }}>{text}</div>
-            )
+          render: (text, record) => {
+            const obj = {
+              children: <div style={{ maxWidth: 200 }}>{text}</div>,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
           }
         },
         {
           title: "结算状态",
           dataIndex: "liquidationStatus",
           key: "liquidationStatus",
-          render: (text) => {
-            return getLiquidationStatus(text);
-          },
+          render: (text, record) => {
+            const obj = {
+              children: getLiquidationStatus(text),
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
+        },
+        {
+          title: "催款节点",
+          dataIndex: "dunNodeContent",
+          key: "dunNodeContent",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: '是否会员',
           dataIndex: 'projectType',
           key: 'projectType',
-          render: text => { return getWhether(text) }
+          render: (text, record) => {
+            const obj = {
+              children: getWhether(text),
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: '是否大客户',
           dataIndex: 'bigCustomer',
           key: 'bigCustomer',
-          render: text => { return getWhether(text) }
+          render: (text, record) => {
+            const obj = {
+              children: getWhether(text),
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "是否特批",
           dataIndex: "approval",
           key: "approval",
-          render: (text) => {
-            return getApprovedState(text);
-          },
+          render: (text, record) => {
+            const obj = {
+              children: getApprovedState(text),
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: '签单时间',
           dataIndex: 'signTime',
           key: 'signTime',
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "派单时间",
           dataIndex: "createTime",
           key: "createTime",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: '公司名称',
           dataIndex: 'buyerName',
           key: 'buyerName',
-          render: text => {
-            return (
-              <Tooltip title={text}>
+          render: (text, record) => {
+            const obj = {
+              children: <Tooltip title={text}>
                 <div style={{ maxWidth: 200 }}>{text}</div>
-              </Tooltip>
-            )
+              </Tooltip>,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
           }
         },
         {
           title: "合同编号",
           dataIndex: "contractNo",
           key: "contractNo",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: '合同类型',
           dataIndex: 'htlx',
           key: 'htlx',
-          // render: (text) => { return getContractType(text) }
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: '省份',
           dataIndex: 'province',
           key: 'province',
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "派单公司",
           dataIndex: "depName",
           key: "depName",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: '签单金额',
           dataIndex: 'totalAmount',
           key: 'totalAmount',
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: '合同收款比例',
           dataIndex: 'contractAmountProportion',
           key: 'contractAmountProportion',
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: '应收款',
           dataIndex: 'orderReceivables',
           key: 'orderReceivables',
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: '已收款',
           dataIndex: 'settlementAmount',
           key: 'settlementAmount',
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "欠款",
           dataIndex: "arrearsAmount",
           key: "arrearsAmount",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "已报销",
           dataIndex: "expenseAmount",
           key: "expenseAmount",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "应公出/已公出/超出",
           dataIndex: "shouldPublic",
           key: "shouldPublic",
           render: (text, record) => {
-            return (
-              <span>
+            const obj = {
+              children: <span>
                 {text + " / " + record.alreadyPublic + " / " + record.exceedPublic}
-              </span>
-            );
-          },
+              </span>,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "总成本/实付",
           dataIndex: "costAmount",
           key: "costAmount",
           render: (text, record) => {
-            return (
-              <span>
+            const obj = {
+              children: <span>
                 {text + " / " + record.paymentAmount}
-              </span>
-            );
-          },
+              </span>,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "已开票金额",
           dataIndex: "invicueAmount",
           key: "invicueAmount",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "退款金额",
           dataIndex: "refundAmount",
           key: "refundAmount",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "财务负责人",
           dataIndex: "financeName",
           key: "financeName",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "营销负责人",
           dataIndex: "salesmanName",
           key: "salesmanName",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "项目名称",
@@ -286,7 +489,7 @@ const ProjecDataStatistics = Form.create()(React.createClass({
           key: "taskComment",
           render: text => {
             return (
-              <div style={{ maxWidth: 200 }}>{text}</div>
+              <div style={{ maxWidth: 220 }}>{text}</div>
             )
           }
         },
@@ -294,21 +497,57 @@ const ProjecDataStatistics = Form.create()(React.createClass({
           title: "核算比例",
           dataIndex: "hsbl",
           key: "hsbl",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "订单情况",
           dataIndex: "orderStatus",
           key: "orderStatus",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "变更情况",
           dataIndex: "changeType",
           key: "changeType",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
         {
           title: "退单退款",
           dataIndex: "refundType",
           key: "refundType",
+          render: (text, record) => {
+            const obj = {
+              children: text,
+              props: {
+                rowSpan: record.rowSpan || 0
+              }
+            }
+            return obj
+          }
         },
       ],
       dataSource: [],
@@ -350,8 +589,9 @@ const ProjecDataStatistics = Form.create()(React.createClass({
               pagination.current = 0;
               pagination.total = 0;
             }
+            let dList = this.handleData(data.data.list, "contractNo")
             this.setState({
-              dataSource: data.data.list,
+              dataSource: dList,
               pagination: this.state.pagination,
               pageNo: data.data.pageNo,
             });
@@ -503,6 +743,23 @@ const ProjecDataStatistics = Form.create()(React.createClass({
       globalConfig.context + "/open/download?fileName=" + fileName;
   },
 
+  handleData(array, key) {
+    if (array.length === 0) return
+    let arr = [...array]
+    let startItem = arr[0]
+    startItem.rowSpan = 1
+    arr.forEach((item, index) => {
+      let nextItem = arr[index + 1] || {}
+      if (item[key] === nextItem[key]) {
+        startItem.rowSpan++
+      } else {
+        startItem = nextItem
+        startItem.rowSpan = 1
+      }
+    })
+    return arr
+  },
+
   search() {
     this.loadData();
   },
@@ -1319,7 +1576,7 @@ const ProjecDataStatistics = Form.create()(React.createClass({
               dataSource={this.state.dataSource}
               pagination={this.state.pagination}
               bordered
-              rowClassName={getRowClassName}
+              // rowClassName={getRowClassName}
               scroll={{ x: 4000 }}
             />
           </Spin>