Browse Source

refactor: adjust some text

Casper Dai 2 years ago
parent
commit
86926fc6c3

+ 8 - 3
src/api/device.js

@@ -365,8 +365,7 @@ export function getDeviceAlarms (query) {
           file: pic && picUrl
             ? {
               type: AssetType.IMAGE,
-              url: picUrl,
-              thumb: picUrl,
+              url: /exception-pic\/.+\/.+/.test(picUrl) ? picUrl.replace('exception-pic/', '') : picUrl,
               origin: true
             }
             : null,
@@ -397,6 +396,7 @@ function getTag (key, status, address) {
       return {
         type: 'primary',
         label: '待发送',
+        key,
         msg,
         address,
         ignore
@@ -404,7 +404,8 @@ function getTag (key, status, address) {
     case 1:
       return {
         type: 'success',
-        label: '成功',
+        label: '已发送',
+        key,
         msg,
         address,
         ignore
@@ -413,6 +414,7 @@ function getTag (key, status, address) {
       return {
         type: 'warning',
         label: '发送中',
+        key,
         msg,
         address,
         ignore
@@ -421,6 +423,7 @@ function getTag (key, status, address) {
       return {
         type: 'danger',
         label: '失败',
+        key,
         msg,
         address,
         ignore
@@ -429,12 +432,14 @@ function getTag (key, status, address) {
       return {
         type: 'danger',
         label: '无目标',
+        key,
         ignore: true
       }
     case 5:
       return {
         type: 'warning',
         label: '未开启',
+        key,
         ignore: true
       }
     default:

+ 5 - 9
src/views/device/detail/components/DeviceInfo/components/Power.vue

@@ -13,7 +13,7 @@
       :schema="powerSchema"
     />
     <template v-if="hasMulti">
-      <div class="c-sibling-item--v u-color--black u-font-size--sm u-bold">多功能卡定时任务</div>
+      <div class="c-sibling-item--v u-color--black u-font-size--sm u-bold">定时任务</div>
       <schema-table
         ref="multiTable"
         class="c-sibling-item--v near"
@@ -48,9 +48,9 @@ const ErrorMessage = {
   TIMEOUT: '暂未获取到操作反馈,请稍后重试',
   BUSY: '终端被他人占用',
   PASSWORD: '登录密码错误,请联系管理员',
-  [GET_POWER_STATUS]: '获取电源状态异常,请稍后重试',
-  [GET_MULTI_POWER_TIMING]: '获取多功能卡定时数据异常,请回读查看',
-  [GET_RELAY_POWER_TIMING]: '获取播控盒定时数据异常,请回读查看'
+  [GET_POWER_STATUS]: '获取电源状态超时,请稍后重试',
+  [GET_MULTI_POWER_TIMING]: '获取定时数据超时,请回读查看',
+  [GET_RELAY_POWER_TIMING]: '获取定时数据超时,请回读查看'
 }
 const RELAY_KEY = -1
 const FOREVER = '4016-06-06'
@@ -72,7 +72,7 @@ export default {
         singlePage: true,
         list: this.getPowers,
         cols: [
-          { label: '设备', render: ({ portIndex }) => portIndex === RELAY_KEY ? '播控盒' : `多功能卡${portIndex}` },
+          { label: '设备', render: ({ portIndex }) => portIndex === RELAY_KEY ? '播控盒' : `控电设备${portIndex}` },
           { prop: 'powerIndex', label: '电源端口' },
           { prop: 'type', label: '电源类型' },
           { type: 'tag', render: ({ action }) => action
@@ -184,10 +184,6 @@ export default {
         ).then(
           messageId => {
             const timer = setTimeout(() => {
-              this.$message({
-                type: 'warning',
-                message: ErrorMessage.TIMEOUT
-              })
               this.$tableStatus[messageId].reject()
               delete this.$tableStatus[messageId]
             }, 10000)

+ 21 - 9
src/views/device/detail/components/DeviceInvoke/MultifunctionCardPowerSwitch.vue

@@ -95,6 +95,7 @@
 </template>
 
 <script>
+import { mapGetters } from 'vuex'
 import { parseTime } from '@/utils'
 import { toDate } from '@/utils/event'
 import {
@@ -118,6 +119,8 @@ const GET_RELAY_POWER_TIMING = 'GetRelayPowerPolicyAsync' // 9.29.1.6、获取
 // const SET_RELAY_POWER_STATUS = 'SetRelayPowerStatusAsync' // 9.29.1.7、获取本板电源状态
 // const SET_POWER_MODE = 'SetPowerModeAsync' // 9.29.2.1、设置终端电源模式
 // const GET_POWER_MODE = 'GetPowerModeAsync' // 9.29.2.2、获取终端电源模式
+const LINK_MULTI = 'LinkMultiFunctionCard' // 开始上报
+const UNLINK_MULTI = 'ReleaseMultiFunctionCard' // 停止上报
 
 const ErrorMessage = {
   TIMEOUT: '暂未获取到操作反馈,请回读查看',
@@ -125,10 +128,10 @@ const ErrorMessage = {
   DEFAULT: '操作异常,请稍后重试',
   BUSY: '终端被他人占用',
   PASSWORD: '登录密码错误,请联系管理员',
-  [GET_POWER_STATUS]: '获取电源状态异常,请稍后重试',
-  [GET_POWER_TIMING]: '获取定时数据异常,请回读查看',
-  [GET_MULTI_POWER_TIMING]: '获取多功能卡定时数据异常,请回读查看',
-  [GET_RELAY_POWER_TIMING]: '获取播控盒定时数据异常,请回读查看'
+  [GET_POWER_STATUS]: '获取电源状态超时,请稍后重试',
+  [GET_POWER_TIMING]: '获取定时数据超时,请回读查看',
+  [GET_MULTI_POWER_TIMING]: '获取定时任务超时,请回读查看',
+  [GET_RELAY_POWER_TIMING]: '获取定时任务超时,请回读查看'
 }
 
 const RELAY_KEY = -1
@@ -158,10 +161,12 @@ export default {
         buttons: [
           { label: '一键开启', on: this.onSwitchOpen },
           { label: '一键关闭', on: this.onSwitchClose },
-          { label: '回读', on: this.getPowerStatus }
+          { label: '回读', on: this.getPowerStatus },
+          { label: '开始上报', render: () => this.isSuperAdmin, on: this.onLink },
+          { label: '停止上报', render: () => this.isSuperAdmin, on: this.onUnlink }
         ],
         cols: [
-          { label: '设备', render: ({ portIndex }) => portIndex === RELAY_KEY ? '播控盒' : `多功能卡${portIndex}` },
+          { label: '设备', render: ({ portIndex }) => portIndex === RELAY_KEY ? '播控盒' : `控电设备${portIndex}` },
           { prop: 'powerIndex', label: '电源端口' },
           { prop: 'type', label: '电源类型' },
           { type: 'tag', render: ({ action }) => action
@@ -221,6 +226,7 @@ export default {
     }
   },
   computed: {
+    ...mapGetters(['isSuperAdmin']),
     loading () {
       return this.active !== GET_POWER_STATUS && !this.timingStatus
     },
@@ -472,7 +478,7 @@ export default {
       this.tabs = [
         { key: GET_POWER_STATUS, name: '电源状态' },
         // { key: GET_POWER_TIMING, name: '定时控制' },
-        hasMulti ? { key: GET_MULTI_POWER_TIMING, name: '多功能卡定时控制' } : null,
+        hasMulti ? { key: GET_MULTI_POWER_TIMING, name: '定时控制' } : null,
         hasRelay ? { key: GET_RELAY_POWER_TIMING, name: '播控盒定时控制' } : null
       ].filter(Boolean)
       this.$hasMulti = hasMulti
@@ -495,7 +501,7 @@ export default {
       const { portIndex, powerIndex, type, action } = power
       const targetAction = action ^ 1
       this.$confirm(
-        `立即${this.actionInfo[targetAction]}电源 ${portIndex === RELAY_KEY ? '播控盒' : `多功能卡${portIndex} ${powerIndex}`} ${type}?`,
+        `立即${this.actionInfo[targetAction]}电源 ${portIndex === RELAY_KEY ? '播控盒' : `控电设备${portIndex} ${powerIndex}`} ${type}?`,
         '操作确认',
         { type: 'warning' }
       ).then(() => {
@@ -506,7 +512,7 @@ export default {
       const { portIndex, type, action } = power
       const targetAction = action ^ 1
       this.$confirm(
-        `立即${this.actionInfo[targetAction]}电源 ${portIndex === RELAY_KEY ? '播控盒' : `多功能卡${portIndex}`} ${type}?`,
+        `立即${this.actionInfo[targetAction]}电源 ${portIndex === RELAY_KEY ? '播控盒' : `控电设备${portIndex}`} ${type}?`,
         '操作确认',
         { type: 'warning' }
       ).then(() => {
@@ -977,6 +983,12 @@ export default {
       this.hasChanged = true
       this.$tasks.splice(index, 1)
       this.$refs.table.pageTo()
+    },
+    onLink () {
+      this.sendTopic(LINK_MULTI)
+    },
+    onUnlink () {
+      this.sendTopic(UNLINK_MULTI)
     }
   }
 }

+ 1 - 1
src/views/device/detail/index.vue

@@ -219,7 +219,7 @@ export default {
         ThirdPartyDevice.MULTI_FUNCTION_CARD
       ], { custom: true }).then(
         ({ data }) => {
-          this.hasPower = !!data?.[0]
+          this.hasPower = !!data?.[0]?.instance
         },
         ({ isCancel }) => {
           if (!isCancel && this.device) {

+ 22 - 12
src/views/external/mesh/index.vue

@@ -69,12 +69,17 @@
                 />
                 <template v-if="needPort">
                   <span class="c-grid-form__label u-required">端口</span>
-                  <el-input-number
-                    v-model="item.port"
-                    controls-position="right"
-                    :min="0"
-                    step-strictly
-                  />
+                  <div
+                    class="has-info"
+                    data-info="若设备上的端口从1开始,填入时需减1处理"
+                  >
+                    <el-input-number
+                      v-model="item.port"
+                      controls-position="right"
+                      :min="0"
+                      step-strictly
+                    />
+                  </div>
                 </template>
               </div>
             </template>
@@ -102,12 +107,17 @@
             <template #default>
               <div class="c-grid-form auto u-align-self--center">
                 <span class="c-grid-form__label u-required">端口</span>
-                <el-input-number
-                  v-model="item.port"
-                  controls-position="right"
-                  :min="0"
-                  step-strictly
-                />
+                <div
+                  class="has-info u-width--md"
+                  data-info="若设备上的端口从1开始,填入时需减1处理"
+                >
+                  <el-input-number
+                    v-model="item.port"
+                    controls-position="right"
+                    :min="0"
+                    step-strictly
+                  />
+                </div>
               </div>
             </template>
           </confirm-dialog>