Explorar o código

增加lora按钮相关的逻辑

vothin hai 11 meses
pai
achega
1d2ae81796

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
dist/index.html


+ 4 - 1
languages/en.js

@@ -1671,6 +1671,9 @@ module.exports = {
   },
   zy20240611: {
     boolTransfer: 'Enable managed interface',
-    hostDeviceLock: 'Enable card swiping privileges for the nurse\'s console'
+    hostDeviceLock: 'Enable card swiping privileges for the nurse\'s console',
+    learn: 'Learn',
+    learnAll: 'Learn All',
+    deleteAll: 'Delete All'
   }
 }

+ 4 - 1
languages/es.js

@@ -1671,6 +1671,9 @@ module.exports = {
   },
   zy20240611: {
     boolTransfer: 'Habilitar interfaz gestionada',
-    hostDeviceLock: 'Habilitar privilegios de tarjeta para la consola de enfermería'
+    hostDeviceLock: 'Habilitar privilegios de tarjeta para la consola de enfermería',
+    learn: 'Aprender',
+    learnAll: 'Aprender Todo',
+    deleteAll: 'Borrar Todo'
   }
 }

+ 4 - 1
languages/ru-RU.js

@@ -1670,6 +1670,9 @@ module.exports = {
   },
   zy20240611: {
     boolTransfer: 'Включить управляемый интерфейс',
-    hostDeviceLock: 'Включить права использования карты для стационарного монитора медсестры'
+    hostDeviceLock: 'Включить права использования карты для стационарного монитора медсестры',
+    learn: 'Изучать',
+    learnAll: 'Изучать все',
+    deleteAll: 'Удалить все'
   }
 }

+ 4 - 1
languages/zh-CN.js

@@ -1674,6 +1674,9 @@ module.exports = {
   },
   zy20240611: {
     boolTransfer: '开启托管界面',
-    hostDeviceLock: '开启护士主机刷卡权限'
+    hostDeviceLock: '开启护士主机刷卡权限',
+    learn: '学习',
+    learnAll: '全部学习',
+    deleteAll: '全部删除'
   }
 }

+ 1 - 1
set-envs.sh

@@ -15,4 +15,4 @@ echo "const domain = {
   enableSosDevice: ${enableSosDevice}, //报警设备
   enable485:${enable485},
   enableLinux:${enableLinux}
-}"  > /app/domain.js
+}"  > /app/domain.js

+ 42 - 1
src/api/ncs_device.js

@@ -284,7 +284,7 @@ export function getLocationDeviceList(partid) {
     loading: false
   })
 }
-/** 查询定位设备 */
+
 export function getDeviceList(frameId, type) {
   return request({
     url: `/ncs/device/getDeviceList/${frameId}/${type}`,
@@ -293,3 +293,44 @@ export function getDeviceList(frameId, type) {
   })
 }
 
+/** 获取转换盒存储的按钮 */
+export function getLoraButtons(mac) {
+  return request({
+    url: `/ncs/device/get_lora_buttons/${mac}`,
+    method: 'get',
+    loading: false
+  })
+}
+/** 刷新转换盒存储的按钮 */
+export function refreshLoraButtons(mac) {
+  return request({
+    url: `/ncs/device/refresh_lora_buttons/${mac}`,
+    method: 'get',
+    loading: false
+  })
+}
+/** 转换盒添加按钮 */
+export function addLoraButtons(mac, lora_list) {
+  return request({
+    url: `/ncs/device/add_lora_buttons/${mac}/${lora_list}`,
+    method: 'get',
+    loading: false
+  })
+}
+/** 转换盒删除按钮 */
+export function delLoraButtons(mac, lora_mac) {
+  return request({
+    url: `/ncs/device/del_lora_buttons/${mac}/${lora_mac}`,
+    method: 'get',
+    loading: false
+  })
+}
+/** 转换盒清空存储的按钮 */
+export function delAllLoraButtons(mac) {
+  return request({
+    url: `/ncs/device/del_all_lora_buttons/${mac}`,
+    method: 'get',
+    loading: false
+  })
+}
+

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 5 - 5
src/utils/domain.js


+ 132 - 5
src/views/ncs-device/components/deviceManager.vue

@@ -341,8 +341,7 @@
                 </el-row>
             </el-form>
             <div slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="handlerFormSubmit('deviceEditForm')">{{ this.$t('action.yes') }}
-                </el-button>
+                <el-button type="primary" @click="handlerFormSubmit('deviceEditForm')">{{ this.$t('action.yes') }}</el-button>
             </div>
         </el-dialog>
         <!-- 设备编辑弹窗 -->
@@ -368,6 +367,47 @@
                 <el-button type="primary" @click="updateDevicesServerIp()">{{ this.$t('action.yes') }}</el-button>
             </div>
         </el-dialog>
+
+        <el-drawer
+            :title="s433TransferBox.name"
+            :visible.sync="s433TransferBoxDialogVisible"
+            direction="rtl"
+            :before-close="s433TransferBoxHandleClose"
+            size="40%"
+            v-loading="s433TransferBoxLoading"
+        >
+          <div class="drawer-content" style="margin: auto">
+            <div slot="toolbar" class="drawer-toolbar" style="margin: 20px 20px 20px 20px; text-align: right;">
+              <el-button type="primary" @click="addAllLoraButton()" :loading="s433TransferBoxHandleLoading">{{ this.$t('zy20240611.learnAll') }}</el-button>
+              <el-button type="danger" @click="delAllLoraButton()" :loading="s433TransferBoxHandleLoading">{{ this.$t('zy20240611.deleteAll') }}</el-button>
+            </div>
+
+            <el-table
+                :data="emergencyButtons"
+                border
+                style="width: 80%; margin: auto">
+              <el-table-column sortable fixed prop="id" label="ID" width="120" align="center"></el-table-column>
+              <el-table-column fixed prop="name" :label="this.$t('action.name')" width="150" align="center"></el-table-column>
+              <el-table-column fixed prop="eth_mac" :label="this.$t('board.ethMac')" width="150" align="center"></el-table-column>
+              <el-table-column fixed="right" :label="this.$t('action.handle')" width="180" align="center">
+                <template slot-scope="scope">
+                  <el-button
+                      :disabled="isLearn(scope.row)"
+                      size="mini"
+                      type="primary"
+                      :loading="s433TransferBoxHandleLoading"
+                      @click="addLoraButton(scope.$index, scope.row)">{{ $t('zy20240611.learn') }}</el-button>
+                  <el-button
+                      :disabled="!isLearn(scope.row)"
+                      size="mini"
+                      type="danger"
+                      :loading="s433TransferBoxHandleLoading"
+                      @click="delLoraButton(scope.$index, scope.row)">{{ $t('action.delete') }}</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-drawer>
     </div>
 </template>
 
@@ -528,7 +568,13 @@
                     ]
                 },
               startTime: "06:00",
-              endTime: "18:00"
+              endTime: "18:00",
+              s433TransferBoxDialogVisible: false,
+              s433TransferBoxLoading: false,
+              s433TransferBoxHandleLoading: false,
+              s433TransferBox: {},
+              emergencyButtons: [],
+              s433LearnEmergencyButtons: []
             }
         },
         computed: {
@@ -723,7 +769,7 @@
                                     disabled: param.data['member_name'] === 'superadmin'
                                 },
                                 {
-                                    onClick: this.openDebug,
+                                    onClick: param.data.device_type === DEVICE_TYPE.S433_TRANSFER_BOX ? this.s433TransferBoxHandleOpen : this.openDebug,
                                     label: this.$t('action.opendebug'),
                                     buttonType: 'success',
                                     buttonSize: 'mini',
@@ -1089,7 +1135,8 @@
                     val === DEVICE_TYPE.DOCTOR_HOST ||
                     val === DEVICE_TYPE.TRANSFER_DEVICE ||
                     val === DEVICE_TYPE.DOOR_DEVICE ||
-                    val === DEVICE_TYPE.DIGIT_BED_DEVICE
+                    val === DEVICE_TYPE.DIGIT_BED_DEVICE ||
+                    val === DEVICE_TYPE.S433_TRANSFER_BOX
 
             },
             s485Device(param){
@@ -1377,7 +1424,87 @@
             },
           getDeviceType() {
               return DEVICE_TYPE;
+          },
+          s433TransferBoxHandleOpen(param) {
+            this.s433TransferBoxLoading = true
+            this.s433TransferBoxDialogVisible = true
+            this.s433TransferBox = param
+
+            this.getEmergencyButtons()
+            this.getLoraButtons(param)
+            this.s433TransferBoxLoading = false
+
+          },
+          s433TransferBoxHandleClose(done) {
+            this.s433TransferBoxDialogVisible = false
+            done();
+          },
+          getEmergencyButtons() {
+            API_Device.getDeviceByType(this.$store.getters.partId, DEVICE_TYPE.EMERGENCY_BUTTON).then(r => {
+              this.emergencyButtons = r;
+              console.log(this.emergencyButtons)
+            })
+          },
+          getLoraButtons(param) {
+            API_Device.getLoraButtons(param.eth_mac).then(r => {
+              this.s433LearnEmergencyButtons = r;
+              console.log('this.s433LearnEmergencyButtons:' + this.s433LearnEmergencyButtons)
+            })
+          },
+          delAllLoraButton() {
+            this.s433TransferBoxHandleLoading = true
+            API_Device.delAllLoraButtons(this.s433TransferBox.eth_mac).then(r => {
+              setTimeout(() => {
+                this.getLoraButtons(this.s433TransferBox)
+                this.s433TransferBoxHandleLoading = false
+              }, 3 * 1000)
+            })
+          },
+          delLoraButton(index, row) {
+            this.s433TransferBoxHandleLoading = true
+            API_Device.delLoraButtons(this.s433TransferBox.eth_mac, row.eth_mac).then(r => {
+              setTimeout(() => {
+                this.getLoraButtons(this.s433TransferBox)
+                this.s433TransferBoxHandleLoading = false
+              }, 3 * 1000)
+            })
+          },
+          addAllLoraButton() {
+            this.s433TransferBoxHandleLoading = true
+            let notLearnMac = "";
+            this.emergencyButtons.forEach(p => {
+              if (!this.isLearn(p)) {
+                notLearnMac += p.eth_mac
+              }
+            })
+
+            console.log("notLearnMac: " + notLearnMac)
+            if (notLearnMac !== "") {
+              API_Device.addLoraButtons(this.s433TransferBox.eth_mac, notLearnMac).then(r => {
+                setTimeout(() => {
+                  this.getLoraButtons(this.s433TransferBox)
+                  this.s433TransferBoxHandleLoading = false
+                }, 3 * 1000)
+              })
+            }
+            else {
+              this.s433TransferBoxHandleLoading = false
+            }
+          },
+          addLoraButton(index, row) {
+            this.s433TransferBoxHandleLoading = true
+            API_Device.addLoraButtons(this.s433TransferBox.eth_mac, row.eth_mac).then(r => {
+              setTimeout(() => {
+                this.getLoraButtons(this.s433TransferBox)
+                this.s433TransferBoxHandleLoading = false
+              }, 3 * 1000)
+            })
+          },
+          isLearn(row) {
+            const mac = row.eth_mac;
+            return this.s433LearnEmergencyButtons.includes(mac.toLowerCase());
           }
+
         }
     }
 </script>