Sfoglia il codice sorgente

设备管理添加重启和调试控制

wuyunfeng 2 anni fa
parent
commit
ecbf3bdd7e

+ 4 - 1
languages/en.js

@@ -27,6 +27,7 @@ module.exports = {
     systemCreate: 'System Create',
     cancelHandle: 'Cancel the operation! ',
     handleSuccess: 'The operation succeeded',
+    handleFailed:'operation failed',
     saveEdit: 'Save changes',
     saveSettings: 'Save settings',
     deleteSettings: 'Delete settings',
@@ -212,7 +213,9 @@ module.exports = {
     addParam: 'New parameter',
     openWatchSosInfo: 'Whether to turn off the watch sedentary alarm. If it is turned off, the watch will not trigger the sedentary alarm again',
     closeWatchSos: 'Turn off the watch sedentary alarm',
-    openWatchSos: 'Turn on the alarm for long sitting'
+    openWatchSos: 'Turn on the alarm for long sitting',
+    opendebug:'Debug',
+    reboot:'Reboot'
   },
   member: {
     face: 'Avatar',

+ 4 - 1
languages/es.js

@@ -27,6 +27,7 @@ module.exports = {
     systemCreate: 'Crear sistema',
     cancelHandle: '¡Cancelar la operación! ',
     handleSuccess: 'La operación tuvo éxito',
+    handleFailed:'La operación falló',
     saveEdit: 'Guardar cambios',
     saveSettings: 'Guardar configuración',
     deleteSettings: 'Eliminar configuración',
@@ -212,7 +213,9 @@ module.exports = {
     addParam: 'Nuevos parámetros',
     openWatchSosInfo: 'Si apagar la alarma de sedentarismo del reloj. Si se cierra, el reloj no volverá a activar la alarma sedentaria',
     closeWatchSos: 'Apague la alarma de sedentarismo del reloj',
-    openWatchSos: 'Sentarse durante mucho tiempo y encender la alarma'
+    openWatchSos: 'Sentarse durante mucho tiempo y encender la alarma',
+    opendebug:'depuración',
+    reboot:'reiniciar'
   },
   member: {
     face: 'Avatar',

+ 4 - 1
languages/ru-RU.js

@@ -27,6 +27,7 @@ module.exports = {
     systemCreate: 'Создание системы',
     cancelHandle: 'Отменить операцию! ',
     handleSuccess: 'Операция выполнена успешно',
+    handleFailed:'Ошибка операции',
     saveEdit: 'Сохранить изменения',
     saveSettings: 'Сохранить настройки',
     deleteSettings: 'Удалить настройки',
@@ -209,7 +210,9 @@ module.exports = {
     param: 'Параметры',
     inputParamName: 'Введите имя параметра',
     inputParamValue: 'Введите значение параметра',
-    addParam: 'Дополнительные параметры'
+    addParam: 'Дополнительные параметры',
+    opendebug:'Отладка',
+    reboot:'Перезагрузка'
   },
   member: {
     face: 'Аватар',

+ 4 - 1
languages/zh-CN.js

@@ -27,6 +27,7 @@ module.exports = {
     systemCreate: '系统创建',
     cancelHandle: '取消操作!',
     handleSuccess: '操作成功',
+    handleFailed:'操作失败',
     saveEdit: '保存修改',
     saveSettings: '保存设置',
     deleteSettings: '清空设置',
@@ -212,7 +213,9 @@ module.exports = {
     addParam: '新增参数',
     openWatchSosInfo: '是否关闭手表久坐报警,关闭的话手表不会再触发久坐报警',
     closeWatchSos: '关闭手表久坐报警',
-    openWatchSos: '开启手表久坐报警'
+    openWatchSos: '开启手表久坐报警',
+    opendebug:'调试',
+    reboot:'重启'
   },
   member: {
     face: '头像',

+ 14 - 0
src/api/ncs_device.js

@@ -246,3 +246,17 @@ export function update485s(data) {
   })
 }
 
+export function openDebug(id){
+  return request({
+    url: `/ncs/device/opendebug/${id}`,
+    method: 'get'
+  })
+}
+
+export function rebootDevice(id){
+  return request({
+    url: `/ncs/device/reboot/${id}`,
+    method: 'get'
+  })
+}
+

+ 8 - 4
src/components/AgGridCellRender/ButtonCellRender.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-button v-if="show" :type="buttonType" :size="buttonSize" :disabled="disabled" @click="buttonClick">{{ label }}</el-button>
+    <el-button v-if="show" :type="buttonType" :size="buttonSize" :icon="icon" :disabled="disabled" @click="buttonClick">{{ label }}</el-button>
   </div>
 </template>
 
@@ -11,18 +11,22 @@ export default {
     return {
       buttonType: 'primary',
       buttonSize: 'mini',
-      label: 'button',
+      label: '',
       disabled: false,
-      show: true
+      show: true,
+      icon:''
     }
   },
   beforeMount() {
   },
   mounted() {
-    const { buttonType, buttonSize, label, disabled, show } = this.params
+    const { buttonType, buttonSize, label, disabled, show,icon } = this.params
     if (buttonType) {
       this.buttonType = buttonType
     }
+    if (icon) {
+      this.icon = icon
+    }
     if (buttonSize) {
       this.buttonSize = buttonSize
     }

+ 119 - 31
src/views/ncs-device/components/deviceManager.vue

@@ -349,10 +349,12 @@
     import {VITAL_SIGNS_DEVICE_TYPE} from "@/utils/enum/VitalSignsDeviceEnum";
     import * as shop_API from "@/api/ncs_shop";
 
+    import ButtonCellRenderList from '@/components/AgGridCellRender/ButtonCellRenderList'
     const DeviceUrl = domain.DeviceUrl
     export default {
         name: 'DeviceManager',
-        components: {ButtonCellRender, ListFilter, RadioFilter},
+        components: {ButtonCellRender, ListFilter, RadioFilter,
+            ButtonCellRenderList},
         props: {
             frame: {
                 type: Object,
@@ -662,41 +664,102 @@
                         }
                     }
                 },
-                {
-                    headerName: this.$t('action.edit'), field: 'id',
-                    cellRendererFramework: 'ButtonCellRender',
-                    cellRendererParams: {
-                        onClick: this.handleEdit,
-                        label: this.$t('action.edit'),
-                        buttonType: 'primary',
-                        buttonSize: 'mini'
-                    },
-                    filter: false,
-                    pinned: 'right',
-                    lockPinned: true,
-                    width: 90,
-                    resizable: false,
-                    sortable: false
-                },
-                {
-                    headerName: this.$t('action.delete'), field: 'id',
-                    cellRendererFramework: 'ButtonCellRender',
+
+                { headerName: this.$t('action.handle'), field: 'id',
+                    cellRendererFramework: 'ButtonCellRenderList',
                     cellRendererParams: param => {
                         return {
-                            onClick: this.deleteSingle,
-                            label: this.$t('action.delete'),
-                            buttonType: 'danger',
-                            buttonSize: 'mini',
-                            disabled: param.data['member_name'] === 'superadmin'
-                        }
+                            list: [
+                                {
+                                    onClick: this.handleEdit,
+                                    label: this.$t('action.edit'),
+                                    buttonType: 'primary',
+                                    buttonSize: 'mini'
+                                },
+                                {
+                                    onClick: this.deleteSingle,
+                                    label: this.$t('action.delete'),
+                                    buttonType: 'danger',
+                                    buttonSize: 'mini',
+                                    disabled: param.data['member_name'] === 'superadmin'
+                                },
+                                {
+                                    onClick: this.openDebug,
+                                    label: this.$t('action.opendebug'),
+                                    buttonType: 'success',
+                                    buttonSize: 'mini',
+                                    disabled: !this.androidDevice(param)
+                                },{
+                                    onClick: this.rebootDevice,
+                                    label: this.$t('action.reboot'),
+                                    buttonType: 'warning',
+                                    buttonSize: 'mini',
+                                    disabled: !this.androidDevice(param)
+                                }
+                            ]}
                     },
+                    filter: false,
                     pinned: 'right',
                     lockPinned: true,
-                    width: 90,
+                    minWidth: this.$i18n.locale === 'zh' ? 260 : 380,
                     resizable: false,
-                    filter: false,
-                    sortable: false
-                }
+                    sortable: false },
+
+                // {
+                //     headerName: this.$t('action.edit'), field: 'id',
+                //     cellRendererFramework: 'ButtonCellRender',
+                //     cellRendererParams: {
+                //         onClick: this.handleEdit,
+                //         label: this.$t('action.edit'),
+                //         buttonType: 'primary',
+                //         buttonSize: 'mini'
+                //     },
+                //     filter: false,
+                //     pinned: 'right',
+                //     lockPinned: true,
+                //     width: 80,
+                //     resizable: false,
+                //     sortable: false
+                // },
+                // {
+                //     headerName: this.$t('action.delete'), field: 'id',
+                //     cellRendererFramework: 'ButtonCellRender',
+                //     cellRendererParams: param => {
+                //         return {
+                //             onClick: this.deleteSingle,
+                //             label: this.$t('action.delete'),
+                //             buttonType: 'danger',
+                //             buttonSize: 'mini',
+                //             disabled: param.data['member_name'] === 'superadmin'
+                //         }
+                //     },
+                //     pinned: 'right',
+                //     lockPinned: true,
+                //     width: 80,
+                //     resizable: false,
+                //     filter: false,
+                //     sortable: false
+                // },
+                //
+                // {
+                //     headerName: this.$t('action.debug'), field: 'id',
+                //     cellRendererFramework: 'ButtonCellRender',
+                //     cellRendererParams: param => {
+                //         return {
+                //             onClick: this.deleteSingle,
+                //             label: this.$t('action.debug'),
+                //             buttonType: 'danger',
+                //             buttonSize: 'mini',
+                //             disabled: param.data['member_name'] === 'superadmin'
+                //         }
+                //     },
+                //     pinned: 'right',
+                //     lockPinned: true,
+                //     width: 80,
+                //     resizable: false,
+                //     filter: false,
+                //     sortable: false
+                // }
             ]
             this.defaultColDef = {
                 // filter: 'agTextColumnFilter',
@@ -950,7 +1013,6 @@
             deviceTypeChangeToFrameTypeChange(val) {
                 if (val === DEVICE_TYPE.NURSE_HOST ||
                     val === DEVICE_TYPE.OTHER_HOST ||
-                    val === DEVICE_TYPE.NURSE_HOST ||
                     val === DEVICE_TYPE.DOCTOR_HOST ||
                     val === DEVICE_TYPE.LED_SCREEN ||
                     val === DEVICE_TYPE.LCD_SCREEN ||
@@ -979,6 +1041,17 @@
                     this.typeFrames = this.partFrames
                 }
             },
+            androidDevice(param){
+                const val =param.data.device_type
+                return val === DEVICE_TYPE.NURSE_HOST ||
+                    val === DEVICE_TYPE.OTHER_HOST ||
+                    val === DEVICE_TYPE.NURSE_HOST ||
+                    val === DEVICE_TYPE.DOCTOR_HOST ||
+                    val === DEVICE_TYPE.TRANSFER_DEVICE ||
+                    val === DEVICE_TYPE.DOOR_DEVICE ||
+                    val === DEVICE_TYPE.DIGIT_BED_DEVICE
+
+            },
             /** 添加设备事件 **/
             handleAdd() {
                 this.deviceModel = {
@@ -1215,6 +1288,21 @@
                     this.serverAddressDialogVisible = false
                 })
             },
+
+            openDebug(param){
+                API_Device.openDebug(param.id).then(res=>{
+                    this.$message.success(this.$t('action.handleSuccess'))
+                }).catch(err=>{
+                    this.$message.error(this.$t('action.handleFailed'))
+                })
+            },
+            rebootDevice(params){
+                API_Device.rebootDevice(params.id).then(res=>{
+                    this.$message.success(this.$t('action.handleSuccess'))
+                }).catch(err=>{
+                    this.$message.error(this.$t('action.handleFailed'))
+                })
+            },
             /**
              * 判断设备是否为模拟分机这种,无法在线是设备
              */