Browse Source

打印插件

dev01 11 months ago
parent
commit
19b5606d85

+ 21 - 4
js/component/manageCenter/financialManage/account/accountDetails.jsx

@@ -6,6 +6,7 @@ import {
 } from "../../../tools"
 import ImgList from "../../../common/imgList";
 import ReactToPrint from "react-to-print";
+import Print from 'react-print-html';
 import moment from "moment";
 import $ from "jquery/src/ajax";
 import './accountReview.less';
@@ -701,8 +702,8 @@ class AccountDetails extends Component {
       >
         <Spin spinning={this.state.loading}>
           <div className="m_body"
-            ref={(e) => {
-              this.refs.all = e;
+            ref={ref => {
+              this.printTemp = ref;
             }}
           >
             {this.state.isTable
@@ -1202,7 +1203,23 @@ class AccountDetails extends Component {
           </div>
         </Spin>
 
-        <ReactToPrint
+        <Button
+          type="primary"
+          style={{
+            float: "right",
+            marginTop: 10,
+            position: "absolute",
+            top: 0,
+            right: 50,
+          }}
+          onClick={() => {
+            Print(this.printTemp)
+          }}
+        >
+          打印
+        </Button>
+
+        {/* <ReactToPrint
           trigger={() => (
             <Button
               type="primary"
@@ -1219,7 +1236,7 @@ class AccountDetails extends Component {
           )}
           content={() => this.refs.all}
           bodyClass="print-body"
-        />
+        /> */}
 
         {
           //审核弹窗

+ 6 - 0
js/component/manageCenter/financialManage/account/accountReview.less

@@ -27,6 +27,12 @@
   table {
     font-size: 12px !important;
   }
+
+  table,
+  th,
+  td {
+    white-space: normal;
+  }
 }
 
 .m_table {

+ 2 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "afanti",
-  "version": "1.3.09",
+  "version": "1.3.10",
   "description": "",
   "main": "index.js",
   "scripts": {
@@ -60,6 +60,7 @@
     "react": "^15.4.1",
     "react-dom": "^15.4.1",
     "react-pdf": "^1.8.3",
+    "react-print-html": "^1.0.5",
     "react-quill": "^1.0.0",
     "viewer": "^0.10.11",
     "viewerjs": "^1.6.2",

+ 5 - 0
yarn.lock

@@ -5462,6 +5462,11 @@ react-pdf@^1.8.3:
     react ">=15.5"
     react-dom ">=15.5"
 
+react-print-html@^1.0.5:
+  version "1.0.5"
+  resolved "https://registry.yarnpkg.com/react-print-html/-/react-print-html-1.0.5.tgz#d48beb5ad1059f1c72102940fbc2d3c9d9827033"
+  integrity sha512-LUKVDJPu+95gbFg8wDreYxx2q2Krbh/aa/esTo4WewsizhukjQZiZC8yFohwApX6kfrkk7brT5XqO/yCOzkD6g==
+
 react-quill@^1.0.0:
   version "1.1.0"
   resolved "http://registry.npm.taobao.org/react-quill/download/react-quill-1.1.0.tgz"