Browse Source

计量箱装置

wushaodong 1 năm trước cách đây
mục cha
commit
4fa31ff121
2 tập tin đã thay đổi với 78 bổ sung4 xóa
  1. 77 4
      jscore/pages/Desktop/Home.js
  2. 1 0
      package.json

+ 77 - 4
jscore/pages/Desktop/Home.js

@@ -5,6 +5,7 @@ import ReadUHF from "../../utils/ReadUHF";
 import Barcode from "react-native-barcode-builder";
 // import SyncStorage from "sync-storage";
 import {SyncStorage} from '../../utils';
+import QRCode from 'react-native-qrcode-svg';
 
 let screenW = Dimensions.get('window').width;
 
@@ -52,7 +53,7 @@ class DesktopHome extends Component {
     _addCode = async (item) => {
         const str = JSON.parse(item)
         // 防止重复扫描
-        const show_type =  await SyncStorage.get('show_type') // ?? '1'
+        const show_type = await SyncStorage.get('show_type') // ?? '1'
         let {data, userData, error} = this.state;
         const product_index = userData.indexOf(str['userData'])
         if (product_index < 0) {
@@ -274,6 +275,59 @@ class DesktopHome extends Component {
         )
     }
 
+    jiliangRender = (item, index) => {
+        // 计量箱装置
+        return (
+            <View
+                key={item.userData}
+                style={styles.mainView}
+            >
+                <Text style={[styles.textColor, {marginVertical: 10, fontWeight: "bold", fontSize: 18}]}>计量箱装置</Text>
+
+                <View style={{
+                    flexDirection: 'row',
+                }}>
+                    <View style={{width: (screenW - 10) / 3 * 2,}}>
+                        <View style={styles.JLView}>
+                            <Text style={styles.textColor31}>装置型号</Text>
+                            <Text style={styles.JLModel}>BX25</Text>
+                        </View>
+                        <View style={styles.JLView}>
+                            <Text style={styles.textColor31}>额定频率</Text>
+                            <Text style={styles.JLModel}>50Hz</Text>
+                        </View>
+                        <View style={styles.JLView}>
+                            <Text style={styles.textColor31}>额定电流</Text>
+                            <Text style={[styles.JLModel]}>5 A </Text>
+
+                        </View>
+                        <View style={styles.JLView}>
+                            <Text style={styles.textColor31}>制造年月</Text>
+                            <Text style={styles.JLModel}>202302</Text>
+                        </View>
+                    </View>
+                    <View style={{
+                        width: (screenW - 10) / 3 * 1,
+                        textAlign: 'center',
+                        alignItems: 'center',
+                        flex: 1,
+                    }}>
+                        <QRCode
+                            value={'3630002102200000001183'}//二维码内容
+                            logoBorderRadius={1}
+                            color={"#333333"}//二维码颜色
+                            backgroundColor={"#ffffff"}//背景色
+                            size={65}//二维码宽高
+                        />
+                        <Text style={[styles.textColor]}>36300021022</Text>
+                        <Text style={[styles.textColor]}>00000001183</Text>
+                    </View>
+                </View>
+                <Text style={[styles.textColor, {marginVertical: 10, fontWeight: "bold",}]}>郑州市凯贝特互感器有限公司</Text>
+            </View>
+        )
+    }
+
     errorRender = (item, index) => {
         return (
             <View
@@ -302,6 +356,9 @@ class DesktopHome extends Component {
                             else if (item.kind.indexOf('电流') > -1) {
                                 return this.dianLiuRender(item, index)
                             }
+                            else if (item.kind.indexOf('计量箱装置') > -1) {
+                                return this.jiliangRender(item, index)
+                            }
                             else {
                                 // 组合互感器,没有设置,默认用电压模板
                                 if (zuhe_temp === '2') {
@@ -353,7 +410,7 @@ class DesktopHome extends Component {
 const styles = StyleSheet.create({
     container: {
         flex: 1,
-        backgroundColor:'#fff'
+        backgroundColor: '#fff'
     },
     button: {
         borderRadius: 5,
@@ -371,13 +428,11 @@ const styles = StyleSheet.create({
         color: '#333',
         textAlign: 'center',
         width: (screenW - 9) / 3,
-
     },
     textColor4: {
         color: '#333',
         textAlign: 'center',
         width: (screenW - 8) / 4,
-
     },
     textColor2: {
         color: '#333',
@@ -413,6 +468,24 @@ const styles = StyleSheet.create({
         alignItems: 'center',
         flexDirection: 'row',
     },
+    textColor31: {
+        fontWeight: "bold",
+        color: '#333',
+        textAlign: 'center',
+        width: (screenW - 9) * 0.25,
+    },
+    JLModel: {
+        fontWeight: "bold",
+        borderWidth: 1,
+        borderLeftColor: '#7b7b7b',
+        color: '#333',
+        textAlign: 'center',
+        width: (screenW - 9) * 0.40,
+    },
+    JLView: {
+        flexDirection: 'row',
+        marginBottom: 5
+    },
 })
 
 export default DesktopHome;

+ 1 - 0
package.json

@@ -35,6 +35,7 @@
     "react-native-screens": "^3.18.2",
     "react-native-svg": "12.1.1",
     "react-native-tableview-simple": "^4.3.1",
+    "react-native-qrcode-svg": "^6.1.2",
     "react-native-webview": "^11.26.1",
     "react-navigation": "^4.4.4",
     "react-navigation-stack": "^2.10.4",