From e44ecb571bb2df6390503f4303282e18db5d60ef Mon Sep 17 00:00:00 2001
From: lgq <1015864684@qq.com>
Date: 星期一, 20 四月 2026 13:43:52 +0800
Subject: [PATCH] 1.修复安全入仓联动控制按钮无权限问题 2.增加安全入仓联动控制配置项,默认不启用 3.修改气体浓度验证选项默认不启用 4.增加门禁web页面源码  Changes to be committed: 	new file:   "face_webserver/ 	modified:   vf107/src/config.json 	modified:   vf107/src/service/grainService.js 	modified:   vf107/src/view/config/menu/doorControlView.js 	modified:   vf107/src/view/mainView.js

---
 vf107/src/view/mainView.js |  330 +++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 297 insertions(+), 33 deletions(-)

diff --git a/vf107/src/view/mainView.js b/vf107/src/view/mainView.js
index 669dcc6..3680c43 100644
--- a/vf107/src/view/mainView.js
+++ b/vf107/src/view/mainView.js
@@ -21,7 +21,8 @@
 const mainView = {
     authComplete: false, // 璁よ瘉鏄惁瀹屾垚锛岀敤浜庢帶鍒禪I鏇存柊
     verifiedUsers: {}, // 瀛樺偍宸叉牳楠屾垚鍔熺殑鐢ㄦ埛淇℃伅
-    eventListenersRegistered: false // 浜嬩欢鐩戝惉鍣ㄦ槸鍚﹀凡娉ㄥ唽
+    eventListenersRegistered: false, // 浜嬩欢鐩戝惉鍣ㄦ槸鍚﹀凡娉ㄥ唽
+    resetTimerId: null // 瀛樺偍閲嶇疆鐢ㄦ埛UI鐨勫畾鏃跺櫒ID
 }
 
 // 鍔犺浇涓昏鍥剧殑鏂规硶
@@ -30,19 +31,19 @@
     // 渚嬪鏇存柊璁惧淇℃伅銆佹皵浣撴祿搴︽暟鎹瓑
     try {
         // 鏇存柊璁惧淇℃伅
-        let config = screen.getConfig()
-        let sn = config["sys.sn"] || ""
+        let screenConfig = screen.getConfig()
+        let sn = screenConfig["sys.sn"] || ""
         // 鐩存帴浠巒et妯″潡鑾峰彇IP鍦板潃锛岀‘淇濊幏鍙栧埌鏈�鏂扮殑IP
         let ip = ""
         try {
-            let netType = config["net.type"] || 1
-            let netMode = net.getModeByCard(netType)
-            if (netMode && netMode.param && netMode.param.ip) {
-                ip = netMode.param.ip
+            // 浣跨敤getNetParam()鏂规硶鑾峰彇鏈�鏂扮殑缃戠粶鍙傛暟
+            let param = net.getNetParam()
+            if (param && param.ip) {
+                ip = param.ip
             }
         } catch (error) {
-            // 鍑洪敊鏃朵娇鐢╟onfig涓殑IP
-            ip = config["net.ip"] || ""
+            // 鍑洪敊鏃朵娇鐢╯creenConfig涓殑IP
+            ip = screenConfig["net.ip"] || ""
         }
         // 閫氳繃mainView瀵硅薄璁块棶鏍囩
         if (mainView.snInfoLbl && mainView.ipInfoLbl) {
@@ -81,19 +82,19 @@
 
     // 鏇存柊璁惧淇℃伅锛圫N鍜孖P锛�
     function updateDeviceInfo() {
-        let config = screen.getConfig()
-        let sn = config["sys.sn"] || ""
+        let screenConfig = screen.getConfig()
+        let sn = screenConfig["sys.sn"] || ""
         // 鐩存帴浠巒et妯″潡鑾峰彇IP鍦板潃锛岀‘淇濊幏鍙栧埌鏈�鏂扮殑IP
         let ip = ""
         try {
-            let netType = config["net.type"] || 1
-            let netMode = net.getModeByCard(netType)
-            if (netMode && netMode.param && netMode.param.ip) {
-                ip = netMode.param.ip
+            // 浣跨敤getNetParam()鏂规硶鑾峰彇鏈�鏂扮殑缃戠粶鍙傛暟
+            let param = net.getNetParam()
+            if (param && param.ip) {
+                ip = param.ip
             }
         } catch (error) {
-            // 鍑洪敊鏃朵娇鐢╟onfig涓殑IP
-            ip = config["net.ip"] || ""
+            // 鍑洪敊鏃朵娇鐢╯creenConfig涓殑IP
+            ip = screenConfig["net.ip"] || ""
         }
         // 閫氳繃mainView瀵硅薄璁块棶鏍囩
         if (mainView.snInfoLbl && mainView.ipInfoLbl) {
@@ -109,11 +110,11 @@
 
     // 鏇存柊搴撳尯鍚嶇О鍜屼粨鍙凤紙鍙湪绋嬪簭鍚姩鍜岄厤缃慨鏀规椂璋冪敤锛�
     function updateWarehouseInfo() {
-        let config = screen.getConfig()
+        let screenConfig = screen.getConfig()
         // 鑾峰彇浠撳彿淇℃伅
-        let houseName = config["houseName"] || "01鍙蜂粨"
+        let houseName = screenConfig["houseName"] || "01鍙蜂粨"
         // 鑾峰彇搴撳尯鍚嶇О
-        let GranaryName = config["GranaryName"] || "涓ぎ鍌ㄥ绮煇鏌愮洿灞炲簱"
+        let GranaryName = screenConfig["GranaryName"] || "涓ぎ鍌ㄥ绮煇鏌愮洿灞炲簱"
         logger.info(`[mainView]: 鏇存柊搴撳尯鍚嶇О鍜屼粨鍙�: 浠撳彿=${houseName}, 搴撳尯鍚嶇О=${GranaryName}`)
         // 鏇存柊椤堕儴鏍囬鏍忕殑搴撳尯鍚嶇О
         if (mainView.headerLbl) {
@@ -125,6 +126,33 @@
             mainView.warehouseLbl.text(houseName)
         } else {
             logger.error('[mainView]: warehouseLbl涓嶅瓨鍦�')
+        }
+    }
+
+    // 鏇存柊缃戠粶鍥炬爣
+    function updateNetworkIcon() {
+        try {
+            let screenConfig = screen.getConfig()
+            let netType = screenConfig["net.type"] || 1
+            let isConnected = net.isConnected()
+            
+            // 闅愯棌鎵�鏈夌綉缁滃浘鏍�
+            if (topView.ethShow) topView.ethShow.hide()
+            if (topView.wifiShow) topView.wifiShow.hide()
+            if (topView._4gShow) topView._4gShow.hide()
+            
+            // 鏍规嵁缃戠粶绫诲瀷鍜岃繛鎺ョ姸鎬佹樉绀哄搴旂殑鍥炬爣
+            if (isConnected) {
+                if (netType === 1) { // 浠ュお缃�
+                    if (topView.ethShow) topView.ethShow.show()
+                } else if (netType === 2) { // WiFi
+                    if (topView.wifiShow) topView.wifiShow.show()
+                } else if (netType === 4) { // 4G
+                    if (topView._4gShow) topView._4gShow.show()
+                }
+            }
+        } catch (error) {
+            logger.error('[mainView]: 鏇存柊缃戠粶鍥炬爣澶辫触:', error)
         }
     }
 
@@ -148,6 +176,8 @@
 
         // 绋嬪簭鍚姩鏃舵洿鏂板簱鍖哄悕绉板拰浠撳彿
         updateWarehouseInfo()
+        // 鍒濆鍖栫綉缁滃浘鏍�
+        updateNetworkIcon()
 
         // 鍙敞鍐屼竴娆′簨浠剁洃鍚櫒
         if (!mainView.eventListenersRegistered) {
@@ -158,9 +188,11 @@
                 onStatusChange: function(netType, status) {
                     // 缃戠粶鐘舵�佸彉鍖栨椂鏇存柊IP淇℃伅
                     updateDeviceInfo()
+                    // 鏇存柊缃戠粶鍥炬爣
+                    updateNetworkIcon()
                 }
             })
-            
+
             // 鍚姩缃戠粶浜嬩欢寰幆
             std.setInterval(() => {
                 try {
@@ -262,9 +294,9 @@
                 logger.info('[mainView]: accessRes浜嬩欢瑙﹀彂, result=' + result + ', data=' + JSON.stringify(data))
                 
                 // 娓呴櫎涔嬪墠鐨勫畾鏃跺櫒
-                if (resetTimerId) {
-                    std.clearTimeout(resetTimerId)
-                    resetTimerId = null
+                if (mainView.resetTimerId) {
+                    std.clearTimeout(mainView.resetTimerId)
+                    mainView.resetTimerId = null
                     logger.info('[mainView]: 娓呴櫎涔嬪墠鐨勯噸缃畾鏃跺櫒')
                 }
                 
@@ -384,7 +416,7 @@
                 }
                 
                 // 璁剧疆1鍒嗛挓鍚庨噸缃敤鎴稶I鐨勫畾鏃跺櫒
-                resetTimerId = std.setTimeout(() => {
+                mainView.resetTimerId = std.setTimeout(() => {
                     logger.info('[mainView]: 1鍒嗛挓瀹氭椂鍣ㄨЕ鍙戯紝閲嶇疆鐢ㄦ埛UI')
                     // 瑙﹀彂閫氳瑙i攣瀹屾垚浜嬩欢锛岄�氱煡UI閲嶇疆
                     bus.fire("accessUnlockComplete")
@@ -408,6 +440,11 @@
                             let dualAuthInfo = data.dualAuthInfo
                             logger.info('[mainView]: 鍙屼汉璁よ瘉鎴愬姛锛屾洿鏂扮敤鎴稶I, user1=' + dualAuthInfo.firstUserId + ', user2=' + dualAuthInfo.secondUserId)
                             
+                            // 瀛樺偍宸叉牳楠屾垚鍔熺殑鐢ㄦ埛淇℃伅
+                            mainView.verifiedUsers[1] = dualAuthInfo.firstUserId
+                            mainView.verifiedUsers[2] = dualAuthInfo.secondUserId
+                            logger.info('[mainView]: 瀛樺偍鍙屼汉璁よ瘉鐢ㄦ埛淇℃伅, user1=' + dualAuthInfo.firstUserId + ', user2=' + dualAuthInfo.secondUserId)
+                            
                             // 鏇存柊鐢ㄦ埛1鐨刄I
                             mainView.updateUserUI(1, dualAuthInfo.firstUserId, true, data.firstUserFileName || fileName)
                             
@@ -418,12 +455,21 @@
                             let dualAuthInfo = data.dualAuthInfo
                             logger.info('[mainView]: 绗竴鐢ㄦ埛璁よ瘉鎴愬姛锛岀瓑寰呯浜岀敤鎴疯璇侊紝鏇存柊鐢ㄦ埛UI, user1=' + dualAuthInfo.firstUserId)
                             
+                            // 瀛樺偍宸叉牳楠屾垚鍔熺殑鐢ㄦ埛淇℃伅
+                            mainView.verifiedUsers[1] = dualAuthInfo.firstUserId
+                            logger.info('[mainView]: 瀛樺偍绗竴鐢ㄦ埛璁よ瘉淇℃伅, user1=' + dualAuthInfo.firstUserId)
+                            
                             // 鏇存柊鐢ㄦ埛1鐨刄I
                             mainView.updateUserUI(1, dualAuthInfo.firstUserId, true, data.firstUserFileName || fileName)
                         } else {
                             // 鍗曚汉璁よ瘉锛屾洿鏂扮敤鎴�1鐨刄I
                             if (data.userId) {
                                 logger.info('[mainView]: 鍗曚汉璁よ瘉鎴愬姛锛屾洿鏂扮敤鎴稶I, userId=' + data.userId)
+                                
+                                // 瀛樺偍宸叉牳楠屾垚鍔熺殑鐢ㄦ埛淇℃伅
+                                mainView.verifiedUsers[1] = data.userId
+                                logger.info('[mainView]: 瀛樺偍鍗曚汉璁よ瘉鐢ㄦ埛淇℃伅, user1=' + data.userId)
+                                
                                 mainView.updateUserUI(1, data.userId, true, fileName)
                             }
                         }
@@ -622,8 +668,7 @@
             logger.info('[mainView]: 浜嬩欢鐩戝惉鍣ㄦ敞鍐屽畬鎴�')
         }
 
-        // 瀛樺偍瀹氭椂鍣↖D
-        let resetTimerId = null
+
 
         // 鑾峰彇姘斾綋娴撳害鍜岀姸鎬佷俊鎭�
         grainService.checkGasConcentration()
@@ -754,8 +799,8 @@
         const headerLbl = dxui.Label.build('headerLbl', headerBox)
         mainView.headerLbl = headerLbl
         // 浠庨厤缃腑鑾峰彇搴撳尯鍚嶇О
-        const config = screen.getConfig()
-        const GranaryName = config['GranaryName'] || '涓ぎ鍌ㄥ绮煇鏌愮洿灞炲簱'
+        const screenConfig = screen.getConfig()
+        const GranaryName = screenConfig['GranaryName'] || '涓ぎ鍌ㄥ绮煇鏌愮洿灞炲簱'
         headerLbl.text(GranaryName)
         headerLbl.textFont(viewUtils.font(30)) // 澧炲ぇ瀛椾綋
         headerLbl.textColor(0xffffff)
@@ -764,7 +809,7 @@
         const warehouseLbl = dxui.Label.build('warehouseLbl', overlayBox)
         mainView.warehouseLbl = warehouseLbl
         // 浠庨厤缃腑鑾峰彇浠撳彿淇℃伅
-        const houseName = config['houseName'] || '01鍙蜂粨'
+        const houseName = screenConfig['houseName'] || '01鍙蜂粨'
         warehouseLbl.text(houseName)
         warehouseLbl.textFont(viewUtils.font(30, dxui.Utils.FONT_STYLE.BOLD))
         warehouseLbl.textColor(0x000000)
@@ -803,9 +848,10 @@
         oxygenValueContainer.flexAlign(dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER)
         oxygenValueContainer.obj.lvObjSetStylePadGap(5, dxui.Utils.ENUM._LV_STYLE_STATE_CMP_SAME)
         
+        
         // 姘ф皵鏁板�奸儴鍒�
         const oxygenValue = dxui.Label.build('oxygenValue', oxygenValueContainer)
-        oxygenValue.text('20')
+        oxygenValue.text('-')
         oxygenValue.textFont(viewUtils.font(20, dxui.Utils.FONT_STYLE.BOLD))
         oxygenValue.textColor(0xffffff)
         mainView.oxygenValue = oxygenValue // 璁剧疆涓簃ainView灞炴��
@@ -865,7 +911,7 @@
         
         // 纾峰寲姘㈡暟鍊奸儴鍒�
         const ph3Value = dxui.Label.build('ph3Value', ph3ValueContainer)
-        ph3Value.text('0')
+        ph3Value.text('-')
         ph3Value.textFont(viewUtils.font(20, dxui.Utils.FONT_STYLE.BOLD))
         ph3Value.textColor(0xffffff)
         mainView.ph3Value = ph3Value // 璁剧疆涓簃ainView灞炴��
@@ -909,7 +955,7 @@
         
         // 浜屾哀鍖栫⒊鏁板�奸儴鍒�
         const co2Value = dxui.Label.build('co2Value', co2ValueContainer)
-        co2Value.text('400')
+        co2Value.text('-')
         co2Value.textFont(viewUtils.font(20, dxui.Utils.FONT_STYLE.BOLD))
         co2Value.textColor(0xffffff)
         mainView.co2Value = co2Value // 璁剧疆涓簃ainView灞炴��
@@ -1353,6 +1399,18 @@
         // 璁剧疆鎸夐挳鐐瑰嚮浜嬩欢
         mode1Btn.on(dxui.Utils.EVENT.CLICK, () => {
             logger.info('鍏佽杩涗粨妯″紡鎸夐挳鐐瑰嚮')
+            const isSafeInputControlEnabled = config.get('safeInputControl') === 1
+            if (!isSafeInputControlEnabled) {
+                logger.info('[grain]: 瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�')
+                // 瑙﹀彂鏈惎鐢ㄥ脊绐�
+                bus.fire('showAccessResult', {
+                faceAuth: true,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�*"
+                })
+                return false
+            }
             // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
             if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
                 // 鏄剧ず寮圭獥閫氱煡
@@ -1378,6 +1436,18 @@
     
         inBtn.on(dxui.Utils.EVENT.CLICK, () => {
             logger.info('鍏ヤ粨鎸夐挳鐐瑰嚮')
+            const isSafeInputControlEnabled = config.get('safeInputControl') === 1
+            if (!isSafeInputControlEnabled) {
+                logger.info('[grain]: 瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�')
+                // 瑙﹀彂鏈惎鐢ㄥ脊绐�
+                bus.fire('showAccessResult', {
+                faceAuth: true,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�*"
+                })
+                return false
+            }
             // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
             if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
                 // 鏄剧ず寮圭獥閫氱煡
@@ -1404,6 +1474,18 @@
     
         outBtn.on(dxui.Utils.EVENT.CLICK, () => {
             logger.info('鍑轰粨鎸夐挳鐐瑰嚮')
+            const isSafeInputControlEnabled = config.get('safeInputControl') === 1
+            if (!isSafeInputControlEnabled) {
+                logger.info('[grain]: 瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�')
+                // 瑙﹀彂鏈惎鐢ㄥ脊绐�
+                bus.fire('showAccessResult', {
+                faceAuth: true,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�*"
+                })
+                return false
+            }
             // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
             if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
                 // 鏄剧ず寮圭獥閫氱煡
@@ -1430,6 +1512,18 @@
     
         mode2Btn.on(dxui.Utils.EVENT.CLICK, () => {
             logger.info('鍐閫氶妯″紡鎸夐挳鐐瑰嚮')
+            const isSafeInputControlEnabled = config.get('safeInputControl') === 1
+            if (!isSafeInputControlEnabled) {
+                logger.info('[grain]: 瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�')
+                // 瑙﹀彂鏈惎鐢ㄥ脊绐�
+                bus.fire('showAccessResult', {
+                faceAuth: true,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�*"
+                })
+                return false
+            }
             // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
             if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
                 // 鏄剧ず寮圭獥閫氱煡
@@ -1438,6 +1532,49 @@
                     gasConcentration: true,
                     accessAllowed: false,
                     message: "*鑱斿姩鎺у埗鎿嶄綔鏃犳潈闄�*"
+                })
+                // 鎾斁璇煶鎻愮ず
+                driver.audio.play('/app/code/resource/CN/wav/control_f.wav')
+                return
+            }
+            // 妫�鏌ユ槸鍚︽湁绉戦暱鏉冮檺
+            let hasSectionChief = false
+            // 妫�鏌ョ敤鎴�1
+            if (mainView.verifiedUsers[1]) {
+                let user1 = sqliteService.d1_person.find({ userId: mainView.verifiedUsers[1] })
+                if (user1 && user1.length > 0) {
+                    try {
+                        let userType = JSON.parse(user1[0].extra).type || 0
+                        if (userType === 1) {
+                            hasSectionChief = true
+                        }
+                    } catch (error) {
+                        logger.error("瑙f瀽鐢ㄦ埛1绫诲瀷澶辫触")
+                    }
+                }
+            }
+            // 妫�鏌ョ敤鎴�2
+            if (!hasSectionChief && mainView.verifiedUsers[2]) {
+                let user2 = sqliteService.d1_person.find({ userId: mainView.verifiedUsers[2] })
+                if (user2 && user2.length > 0) {
+                    try {
+                        let userType = JSON.parse(user2[0].extra).type || 0
+                        if (userType === 1) {
+                            hasSectionChief = true
+                        }
+                    } catch (error) {
+                        logger.error("瑙f瀽鐢ㄦ埛2绫诲瀷澶辫触")
+                    }
+                }
+            }
+            // 濡傛灉娌℃湁绉戦暱鏉冮檺锛屾樉绀烘牳楠屽け璐�
+            if (!hasSectionChief) {
+                // 鏄剧ず寮圭獥閫氱煡
+                bus.fire('showAccessResult', {
+                    faceAuth: false,
+                    gasConcentration: true,
+                    accessAllowed: false,
+                    message: "*鏃犵闀挎潈闄愶紝绂佹鎿嶄綔*"
                 })
                 // 鎾斁璇煶鎻愮ず
                 driver.audio.play('/app/code/resource/CN/wav/control_f.wav')
@@ -1455,6 +1592,18 @@
     
         startBtn.on(dxui.Utils.EVENT.CLICK, () => {
             logger.info('鍚姩鎸夐挳鐐瑰嚮')
+            const isSafeInputControlEnabled = config.get('safeInputControl') === 1
+            if (!isSafeInputControlEnabled) {
+                logger.info('[grain]: 瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�')
+                // 瑙﹀彂鏈惎鐢ㄥ脊绐�
+                bus.fire('showAccessResult', {
+                faceAuth: true,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�*"
+                })
+                return false
+            }
             // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
             if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
                 // 鏄剧ず寮圭獥閫氱煡
@@ -1481,6 +1630,18 @@
     
         stopBtn.on(dxui.Utils.EVENT.CLICK, () => {
             logger.info('鍏抽棴鎸夐挳鐐瑰嚮')
+            const isSafeInputControlEnabled = config.get('safeInputControl') === 1
+            if (!isSafeInputControlEnabled) {
+                logger.info('[grain]: 瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�')
+                // 瑙﹀彂鏈惎鐢ㄥ脊绐�
+                bus.fire('showAccessResult', {
+                faceAuth: true,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�*"
+                })
+                return false
+            }
             // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
             if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
                 // 鏄剧ず寮圭獥閫氱煡
@@ -1507,6 +1668,18 @@
     
         mode3Btn.on(dxui.Utils.EVENT.CLICK, () => {
             logger.info('绂佹杩涗粨妯″紡鎸夐挳鐐瑰嚮')
+            const isSafeInputControlEnabled = config.get('safeInputControl') === 1
+            if (!isSafeInputControlEnabled) {
+                logger.info('[grain]: 瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�')
+                // 瑙﹀彂鏈惎鐢ㄥ脊绐�
+                bus.fire('showAccessResult', {
+                faceAuth: true,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�*"
+                })
+                return false
+            }
             // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
             if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
                 // 鏄剧ず寮圭獥閫氱煡
@@ -1515,6 +1688,49 @@
                     gasConcentration: true,
                     accessAllowed: false,
                     message: "*鑱斿姩鎺у埗鎿嶄綔鏃犳潈闄�*"
+                })
+                // 鎾斁璇煶鎻愮ず
+                driver.audio.play('/app/code/resource/CN/wav/control_f.wav')
+                return
+            }
+            // 妫�鏌ユ槸鍚︽湁绉戦暱鏉冮檺
+            let hasSectionChief = false
+            // 妫�鏌ョ敤鎴�1
+            if (mainView.verifiedUsers[1]) {
+                let user1 = sqliteService.d1_person.find({ userId: mainView.verifiedUsers[1] })
+                if (user1 && user1.length > 0) {
+                    try {
+                        let userType = JSON.parse(user1[0].extra).type || 0
+                        if (userType === 1) {
+                            hasSectionChief = true
+                        }
+                    } catch (error) {
+                        logger.error("瑙f瀽鐢ㄦ埛1绫诲瀷澶辫触")
+                    }
+                }
+            }
+            // 妫�鏌ョ敤鎴�2
+            if (!hasSectionChief && mainView.verifiedUsers[2]) {
+                let user2 = sqliteService.d1_person.find({ userId: mainView.verifiedUsers[2] })
+                if (user2 && user2.length > 0) {
+                    try {
+                        let userType = JSON.parse(user2[0].extra).type || 0
+                        if (userType === 1) {
+                            hasSectionChief = true
+                        }
+                    } catch (error) {
+                        logger.error("瑙f瀽鐢ㄦ埛2绫诲瀷澶辫触")
+                    }
+                }
+            }
+            // 濡傛灉娌℃湁绉戦暱鏉冮檺锛屾樉绀烘牳楠屽け璐�
+            if (!hasSectionChief) {
+                // 鏄剧ず寮圭獥閫氱煡
+                bus.fire('showAccessResult', {
+                    faceAuth: false,
+                    gasConcentration: true,
+                    accessAllowed: false,
+                    message: "*鏃犵闀挎潈闄愶紝绂佹鎿嶄綔*"
                 })
                 // 鎾斁璇煶鎻愮ず
                 driver.audio.play('/app/code/resource/CN/wav/control_f.wav')
@@ -1532,6 +1748,18 @@
     
         emergencyInBtn.on(dxui.Utils.EVENT.CLICK, () => {
             logger.info('绱ф�ュ叆浠撴寜閽偣鍑�')
+            const isSafeInputControlEnabled = config.get('safeInputControl') === 1
+            if (!isSafeInputControlEnabled) {
+                logger.info('[grain]: 瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�')
+                // 瑙﹀彂鏈惎鐢ㄥ脊绐�
+                bus.fire('showAccessResult', {
+                faceAuth: true,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�*"
+                })
+                return false
+            }
             // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
             if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
                 // 鏄剧ず寮圭獥閫氱煡
@@ -1558,6 +1786,18 @@
     
         emergencyOutBtn.on(dxui.Utils.EVENT.CLICK, () => {
             logger.info('鍑轰粨鎸夐挳鐐瑰嚮')
+            const isSafeInputControlEnabled = config.get('safeInputControl') === 1
+            if (!isSafeInputControlEnabled) {
+                logger.info('[grain]: 瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�')
+                // 瑙﹀彂鏈惎鐢ㄥ脊绐�
+                bus.fire('showAccessResult', {
+                faceAuth: true,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�*"
+                })
+                return false
+            }
             // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
             if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
                 // 鏄剧ず寮圭獥閫氱煡
@@ -1584,6 +1824,18 @@
     
         lightOnBtn.on(dxui.Utils.EVENT.CLICK, () => {
             logger.info('寮�鐏寜閽偣鍑�')
+            const isSafeInputControlEnabled = config.get('safeInputControl') === 1
+            if (!isSafeInputControlEnabled) {
+                logger.info('[grain]: 瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�')
+                // 瑙﹀彂鏈惎鐢ㄥ脊绐�
+                bus.fire('showAccessResult', {
+                faceAuth: true,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�*"
+                })
+                return false
+            }
             // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
             if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
                 // 鏄剧ず寮圭獥閫氱煡
@@ -1610,6 +1862,18 @@
     
         lightOffBtn.on(dxui.Utils.EVENT.CLICK, () => {
             logger.info('鍏崇伅鎸夐挳鐐瑰嚮')
+            const isSafeInputControlEnabled = config.get('safeInputControl') === 1
+            if (!isSafeInputControlEnabled) {
+                logger.info('[grain]: 瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�')
+                // 瑙﹀彂鏈惎鐢ㄥ脊绐�
+                bus.fire('showAccessResult', {
+                faceAuth: true,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*瀹夊叏鍏ヤ粨鑱斿姩鎺у埗鍔熻兘鏈惎鐢�*"
+                })
+                return false
+            }
             // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
             if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
                 // 鏄剧ず寮圭獥閫氱煡

--
Gitblit v1.9.3