瀏覽代碼

科室增加图标设置,模拟设备等不显示是否在线,取消led语音必填

vothin 3 年之前
父節點
當前提交
c9d5f75a42

+ 2 - 1
languages/en.js

@@ -136,7 +136,8 @@ module.exports = {
     statisticalSubTable: 'statistical sub table',
     byPerson: 'By Person',
     byEvent: 'By Event',
-    Export: 'Export'
+    export: 'Export',
+    icon: 'Icon'
   },
   member: {
     face: 'Avatar',

+ 2 - 1
languages/zh-CN.js

@@ -138,7 +138,8 @@ module.exports = {
     statisticalSubTable: '统计子表',
     byPerson: '按人',
     byEvent: '按事件',
-    export: '导出'
+    export: '导出',
+    icon: '图标'
   },
   member: {
     face: '头像',

+ 3 - 3
src/views/hospital/ncs_device/deviceManager.vue

@@ -366,9 +366,9 @@ export default {
         led_resolution_ratio: [
           { required: true, message: this.$t('deviceManage.ledResolutionRatio'), trigger: 'blur' }
         ],
-        led_voice: [
-          { required: true, message: this.$t('deviceManage.ledVoice'), trigger: 'blur' }
-        ],
+        // led_voice: [
+        //   { required: true, message: this.$t('deviceManage.ledVoice'), trigger: 'blur' }
+        // ],
         led_font_size: [
           { required: true, message: this.$t('deviceManage.ledFontSize'), trigger: 'blur' }
         ],

+ 42 - 18
src/views/ncs-device/components/deviceManager.vue

@@ -376,9 +376,9 @@ export default {
         led_resolution_ratio: [
           { required: true, message: this.$t('deviceManage.ledResolutionRatio'), trigger: 'blur' }
         ],
-        led_voice: [
-          { required: true, message: this.$t('deviceManage.ledVoice'), trigger: 'blur' }
-        ],
+        // led_voice: [
+        //   { required: true, message: this.$t('deviceManage.ledVoice'), trigger: 'blur' }
+        // ],
         led_font_size: [
           { required: true, message: this.$t('deviceManage.ledFontSize'), trigger: 'blur' }
         ],
@@ -640,17 +640,21 @@ export default {
         const deviceData = [...response.data]
         deviceData.forEach(item => {
           if (this.onlineDevice.length > 0) {
-            if (item.eth_mac) {
-              const mac = this.onlineDevice.filter(p => p.toLowerCase() === item.eth_mac.toLowerCase())[0]
-              // console.log('在线设备1', mac)
-              if (mac !== undefined && mac !== null) {
-                item['online_state'] = this.$t('deviceManage.connectTrue')
-              } else {
-                item['online_state'] = this.$t('deviceManage.connectFalse')
+            if (this.isCannotBeOnline(item.device_type)) {
+              if (item.eth_mac) {
+                const mac = this.onlineDevice.filter(p => p.toLowerCase() === item.eth_mac.toLowerCase())[0]
+                // console.log('在线设备1', mac)
+                if (mac !== undefined && mac !== null) {
+                  item['online_state'] = this.$t('deviceManage.connectTrue')
+                } else {
+                  item['online_state'] = this.$t('deviceManage.connectFalse')
+                }
               }
+            } else {
+              item['online_state'] = '/'
             }
           } else {
-            item['online_state'] = this.$t('deviceManage.connectFalse')
+            item['online_state'] = '/'
           }
         })
         this.rowData = deviceData
@@ -691,8 +695,8 @@ export default {
     },
 
     /**
-         * 过滤状态发生变化,发送到服务器检索数据
-         */
+     * 过滤状态发生变化,发送到服务器检索数据
+     */
     filterModifed(param) {
       var model = param.api.getFilterModel()
       // 连接状态不经过服务器过滤
@@ -764,9 +768,11 @@ export default {
       if (params.value === this.$t('deviceManage.connectTrue')) {
         // return '<span style="color:green;">在线</span>'
         return '<span style="color:green;">' + this.$t('deviceManage.connectTrue') + '</span>'
-      } else {
+      } else if (params.value === this.$t('deviceManage.connectFalse')) {
         // return '<span style="color:gray;">离线</span>'
         return '<span style="color:gray;">' + this.$t('deviceManage.connectFalse') + '</span>'
+      } else {
+        return '<span style="color:gray;"> / </span>'
       }
     },
     /** 删除设备 **/
@@ -1027,9 +1033,13 @@ export default {
       this.onlineDevice = JSON.parse(e.data)
       if (this.rowData !== null) {
         for (let i = 0; i < this.rowData.length; i++) {
-          if (this.rowData[i].eth_mac) {
-            const mac = this.onlineDevice.filter(p => p.toLowerCase() === this.rowData[i].eth_mac.toLowerCase())[0]
-            this.rowData[i]['online_state'] = (mac !== undefined && mac !== null) ? this.$t('deviceManage.connectTrue') : this.$t('deviceManage.connectFalse')
+          if (this.isCannotBeOnline(this.rowData[i].device_type)) {
+            if (this.rowData[i].eth_mac) {
+              const mac = this.onlineDevice.filter(p => p.toLowerCase() === this.rowData[i].eth_mac.toLowerCase())[0]
+              this.rowData[i]['online_state'] = (mac !== undefined && mac !== null) ? this.$t('deviceManage.connectTrue') : this.$t('deviceManage.connectFalse')
+            }
+          } else {
+            this.rowData[i]['online_state'] = '/'
           }
         }
         const rowData = [...this.rowData]
@@ -1059,8 +1069,22 @@ export default {
         this.$message.success(this.$t('action.settingsSuccess'))
         this.serverAddressDialogVisible = false
       })
+    },
+    /**
+     * 判断设备是否为模拟分机这种,无法在线是设备
+     */
+    isCannotBeOnline(val){
+      return val === DEVICE_TYPE.NURSE_HOST ||
+          val === DEVICE_TYPE.OTHER_HOST ||
+          val === DEVICE_TYPE.NURSE_HOST ||
+          val === DEVICE_TYPE.DOCTOR_HOST ||
+          val === DEVICE_TYPE.NURSE_WATCH ||
+          val === DEVICE_TYPE.WORKER_WATCH ||
+          val === DEVICE_TYPE.TRANSFER_DEVICE ||
+          val === DEVICE_TYPE.DOOR_DEVICE ||
+          val === DEVICE_TYPE.DIGIT_BED_DEVICE ||
+          val === DEVICE_TYPE.CELL_PHONE;
     }
-
   }
 }
 </script>

+ 90 - 4
src/views/ncs-orginazition/components/partInfoEdit.vue

@@ -492,6 +492,18 @@
               </el-form-item>
             </el-col>
           </el-row>
+          <el-form-item :label="this.$t('action.icon')">
+            <el-upload
+                class="avatar-uploader"
+                :action="`${uploadurl}?scene=avatar`"
+                :show-file-list="false"
+                :on-success="uploaded"
+                :before-upload="handleShopLogoBefore"
+            >
+              <img v-if="imageUrl" :src="imageUrl" class="avatar">
+              <i v-else class="el-icon-plus avatar-uploader-icon" />
+            </el-upload>
+          </el-form-item>
 
         </fieldset>
 
@@ -516,11 +528,12 @@ import {bindDeviceTransAudio, init485Device, initData, initDeviceList} from '@/a
 import * as API_Clerk from '@/api/ncs_clerk'
 import * as API_SystemConfig from '@/api/ncs_systemconfig'
 import * as API_Device from '@/api/ncs_device'
+const serverUrl = domain.serverUrl
 export default {
   name: 'PartInfoEdit',
   props: {
     partId: {
-      type: Number,
+      type: String,
       default: null
     }
   },
@@ -543,7 +556,9 @@ export default {
       systemConfig: {},
       formmodelAdmin: {},
       noMember: true,
-      otherHostDevice: []
+      otherHostDevice: [],
+      uploadurl: serverUrl + '/ncs/upload/uploadFile',
+      imageUrl: '',
     }
   },
   async mounted() {
@@ -565,6 +580,9 @@ export default {
           } else {
             this.noMember = true
           }
+          if (this.formmodel.qr_url) {
+            this.imageUrl = this.formmodel.qr_url
+          }
           if (!this.formmodel.id) {
             this.formmodel = {
               ...this.formmodel, ...{
@@ -616,7 +634,7 @@ export default {
                 two_color_door_light_valid: 0,
                 customize_hospital_call_first: 0,
                 customize_hospital_call_second: 0,
-                customize_hospital_call_third: 0,
+                customize_hospital_call_third: 0
               }
             }
           } else {
@@ -684,6 +702,9 @@ export default {
               this.noMember = true
             })
           }
+          if (this.formmodel.qr_url) {
+            this.imageUrl = this.formmodel.qr_url
+          }
           API_Part.editPartSetting(this.formmodel, this.partId).then(res => {
             this.$message.success(this.$t('action.saveSuccess'))
             if (this.systemConfig.id != null) {
@@ -782,7 +803,51 @@ export default {
       })
       this.otherHostDevice = _this.otherHostDevice
       console.log("this.otherHostDevice", this.otherHostDevice)
-    }
+    },
+    /** 上传成功后的钩子 更换图片 置空存储数组*/
+    uploaded(res) {
+      this.imageUrl = serverUrl + '/' + res
+      this.formmodel.qr_url = this.imageUrl
+    },
+    /** 图片上传之前的校验 */
+    handleShopLogoBefore(file) {
+      return new Promise((resolve, reject) => {
+        const isImg = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/gif'
+        const isLt2M = file.size / 1024 / 1024 < 2
+
+        if (!isImg) {
+          this.$message.error(this.$t('action.uploaderImg2'))
+          reject()
+        }
+        if (!isLt2M) {
+          this.$message.error(this.$t('action.uploaderSize2'))
+          reject()
+        }
+        const reader = new FileReader()
+        reader.onload = (event) => {
+          const image = new Image()
+          image.onload = () => {
+            const width = image.width
+            const height = image.height
+            if (width > 500 || width < 100) {
+              this.$message.error(this.$t('action.uploaderImgMsg'))
+              reject()
+            }
+            if (width !== height) {
+              this.$message.error(this.$t('action.uploaderImgMsg2'))
+              reject()
+            }
+            if (height > 500 || height < 100) {
+              this.$message.error(this.$t('action.uploaderImgMsg3'))
+              reject()
+            }
+            resolve()
+          }
+          image.src = event.target.result
+        }
+        reader.readAsDataURL(file)
+      })
+    },
   }
 }
 </script>
@@ -804,4 +869,25 @@ fieldset {
 /deep/ .m-colorPicker .box.open{
   z-index: 1000 !important;
 }
+
+/deep/ .avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+
+/deep/ .avatar-uploader .el-upload:hover {
+  border-color: #409EFF;
+}
+
+/deep/ .avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 100px;
+  height: 100px;
+  line-height: 100px;
+  text-align: center;
+}
 </style>