Browse Source

feat: 新增PDU管理模块

lihao16 3 weeks ago
parent
commit
e0e3c8ee9c

+ 51 - 0
src/api/external.js

@@ -303,6 +303,57 @@ export function deleteGateway ({ id }) {
   }, '该网关')
 }
 
+// PDU
+export function getPdus (query) {
+  const { pageNum: pageIndex, pageSize, ...params } = query
+  return request({
+    url: '/device/thirdPartyPdu/list',
+    method: 'GET',
+    params: addTenant({
+      pageIndex, pageSize,
+      ...params
+    })
+  })
+}
+
+export function addPdu (data) {
+  return add({
+    url: '/device/thirdPartyPdu',
+    method: 'POST',
+    data: addTenantAndOrg(data)
+  })
+}
+
+export function updatePdu (data) {
+  return update({
+    url: '/device/thirdPartyPdu',
+    method: 'PUT',
+    data
+  })
+}
+
+export function deletePdu ({ id }) {
+  return del({
+    url: `/device/thirdPartyPdu/${id}`,
+    method: 'DELETE'
+  }, '该PDU')
+}
+
+// pdu 插口状态
+export function updatePduOutletsStatus (slotNo, state, deviceId) {
+  return request({
+    url: `/device/thirdPartyPdu/update/status/${slotNo}/${state}/${deviceId}`,
+    method: 'GET'
+  })
+}
+
+export function pduOutletsStatus (id) {
+  return request({
+    url: `/device/thirdPartyPdu/status/${id}`,
+    method: 'GET'
+  })
+}
+
 export function plcCommand (deviceId, status) {
   return messageSend({
     url: '/device/thirdplc/command',

+ 32 - 3
src/components/service/FullLink/index.vue

@@ -91,6 +91,12 @@ const LinkItems = Object.freeze([
     label: '浪潮物联网关',
     canClick: true
   },
+  {
+    key: ThirdPartyDevice.PDU,
+    alias: 'pdu',
+    label: 'PDU',
+    canClick: true
+  },
   {
     key: ThirdPartyDevice.LED_CAMERA,
     alias: 'led_camera',
@@ -121,7 +127,8 @@ const requiredMap = {
   [ThirdPartyDevice.BOX]: 1,
   [ThirdPartyDevice.GATEWAY]: 1,
   [ThirdPartyDevice.LED_CAMERA]: 1,
-  [ThirdPartyDevice.TRAFFIC_CAMERA]: 1
+  [ThirdPartyDevice.TRAFFIC_CAMERA]: 1,
+  [ThirdPartyDevice.PDU]: 1
 }
 
 const LineFromeTo = {
@@ -131,6 +138,7 @@ const LineFromeTo = {
   4: [ThirdPartyDevice.RECEIVING_CARD, { key: 'led', enable: 1 }],
   5: ['msr', { key: ThirdPartyDevice.GATEWAY, enable: 1 }],
   6: ['msr', { key: ThirdPartyDevice.LED_CAMERA, enable: 1 }],
+  16: ['msr', { key: ThirdPartyDevice.PDU, enable: 1 }],
   15: ['msr', { key: ThirdPartyDevice.TRAFFIC_CAMERA, enable: 1 }],
   7: ['msr', { key: ThirdPartyDevice.TRAFFIC_CAMERA, enable: 1 }],
   8: ['msr', { key: ThirdPartyDevice.TRAFFIC_CAMERA, enable: 1 }],
@@ -311,7 +319,8 @@ export default {
         [ThirdPartyDevice.TRAFFIC_CAMERA]: Status.NONE,
         [ThirdPartyDevice.SENDING_CARD]: Status.NONE,
         [ThirdPartyDevice.RECEIVING_CARD]: Status.NONE,
-        [ThirdPartyDevice.MULTI_FUNCTION_CARD]: Status.NONE
+        [ThirdPartyDevice.MULTI_FUNCTION_CARD]: Status.NONE,
+        [ThirdPartyDevice.PDU]: Status.NONE
       }
       this.led = {
         id: this.targetId,
@@ -340,7 +349,8 @@ export default {
           ThirdPartyDevice.LED_CAMERA,
           ThirdPartyDevice.TRAFFIC_CAMERA,
           ThirdPartyDevice.BOX,
-          ThirdPartyDevice.MULTI_FUNCTION_CARD
+          ThirdPartyDevice.MULTI_FUNCTION_CARD,
+          ThirdPartyDevice.PDU
         ], { custom: true }),
         Promise.resolve(this.$multiCard)
       ]).then(([{ data: nodes }, multiCard]) => {
@@ -372,6 +382,13 @@ export default {
             }
           } else if (nodeType === ThirdPartyDevice.SENDING_CARD) {
             linkDeviceMap[nodeType] = Status.OK
+          } else if (nodeType === ThirdPartyDevice.PDU) {
+            const status = instance.status === 1 ? Status.OK : Status.ERROR
+            if (linkDeviceMap[nodeType] > Status.LOADING && linkDeviceMap[nodeType] !== status) {
+              linkDeviceMap[nodeType] = Status.WARNING
+            } else {
+              linkDeviceMap[nodeType] = status
+            }
           } else if (requiredMap[nodeType]) {
             if (instance) {
               const status = instance.onlineStatus === 1 ? Status.OK : Status.ERROR
@@ -400,6 +417,7 @@ export default {
           [ThirdPartyDevice.SENDING_CARD]: Status.NONE,
           [ThirdPartyDevice.RECEIVING_CARD]: Status.NONE,
           [ThirdPartyDevice.MULTI_FUNCTION_CARD]: Status.NONE,
+          [ThirdPartyDevice.PDU]: Status.NONE,
           ...linkDeviceMap
         }
         this.led = {
@@ -533,6 +551,12 @@ export default {
         width: 138px;
         height: 138px;
       }
+      &.pdu {
+        top: 432px;
+        left: 52px;
+        width: 138px;
+        height: 138px;
+      }
 
       &.led_camera {
         top: 280px;
@@ -685,6 +709,11 @@ export default {
   }
 
   &.gateway {
+    @include getPosition(80px, 270px, 138px, 138px);
+    background-image: url("~@/assets/link/gateway.svg");
+  }
+
+  &.pdu {
     @include getPosition(260px, 270px, 138px, 138px);
     background-image: url("~@/assets/link/gateway.svg");
   }

+ 4 - 2
src/constant.js

@@ -196,7 +196,8 @@ export const ThirdPartyDevice = {
   TEMPERATURE_SENSOR: 10,
   LIGHT_SENSOR: 11,
   FLOODING_SENSOR: 12,
-  TRANSLOCATION_SENSOR: 13
+  TRANSLOCATION_SENSOR: 13,
+  PDU: 15
 }
 
 export const ThirdPartyDeviceInfo = {
@@ -213,7 +214,8 @@ export const ThirdPartyDeviceInfo = {
   [ThirdPartyDevice.TEMPERATURE_SENSOR]: '温度传感器',
   [ThirdPartyDevice.LIGHT_SENSOR]: '光照传感器',
   [ThirdPartyDevice.FLOODING_SENSOR]: '水浸传感器',
-  [ThirdPartyDevice.TRANSLOCATION_SENSOR]: '位移传感器'
+  [ThirdPartyDevice.TRANSLOCATION_SENSOR]: '位移传感器',
+  [ThirdPartyDevice.PDU]: 'PDU'
 }
 
 export const Camera = {

+ 5 - 0
src/router/index.js

@@ -657,6 +657,11 @@ export const asyncRoutes = [
         path: 'plc',
         component: () => import('@/views/external/plc/index'),
         meta: { title: 'PLC' }
+      },
+      {
+        path: 'pdu',
+        component: () => import('@/views/external/pdu/index'),
+        meta: { title: 'PDU' }
       }
     ]
   },

+ 159 - 0
src/views/device/detail/components/DeviceExternal/components/Pdu.vue

@@ -0,0 +1,159 @@
+<template>
+  <div
+    v-loading="loading"
+    class="c-info"
+  >
+    <warning
+      v-if="error"
+      @click="getThirdPartyDevicesByThirdPartyDevice"
+    />
+    <div
+      v-for="info in items"
+      :key="info.id"
+      class="c-sibling-item--v"
+    >
+      <div class="c-sibling-item--v u-bold">
+        PDU({{ info.name }})
+      </div>
+      <div class="c-sibling-item--v">
+        <div class="l-flex--row c-info__block">
+          <div class="l-flex--row l-flex__fill c-sibling-item">
+            <div class="l-flex__none c-info__title">
+              厂商
+            </div>
+            <div class="l-flex__fill c-info__value">
+              {{ info.instance.manufacturerName }}
+            </div>
+          </div>
+          <div class="l-flex--row l-flex__fill c-sibling-item">
+            <div class="l-flex__none c-info__title">
+              服务IP
+            </div>
+            <div class="l-flex__fill c-info__value u-color--blue">
+              {{ info.instance.ip }}
+            </div>
+          </div>
+          <!--          <div class="l-flex&#45;&#45;row l-flex__fill c-sibling-item">
+            <div class="l-flex__none c-info__title">
+              型号
+            </div>
+            <div class="l-flex__fill c-info__value">
+              {{ info.instance.model }}
+            </div>
+          </div>-->
+          <div class="l-flex--row l-flex__fill c-sibling-item">
+            <div class="l-flex__none c-info__title">
+              唯一标识
+            </div>
+            <div class="l-flex__fill c-info__value">
+              {{ info.instance.identifier }}
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+    <div
+      v-for="outlet in outletsStatus"
+      :key="outlet.slot_no"
+      class="c-sibling-item--v"
+    >
+      <div class="c-sibling-item--v">
+        <div class="l-flex--row c-info__block">
+          <div class="l-flex--row l-flex__fill c-sibling-item">
+            <div class="l-flex__none c-info__title">
+              编号
+            </div>
+            <div class="l-flex__fill c-info__value">
+              {{ outlet.slot_no }}
+            </div>
+          </div>
+          <div class="l-flex--row l-flex__fill c-sibling-item">
+            <div class="l-flex__none c-info__title">
+              名称
+            </div>
+            <div class="l-flex__fill c-info__value">
+              {{ outlet.name }}
+            </div>
+          </div>
+          <div class="l-flex--row l-flex__fill c-sibling-item">
+            <div class="l-flex__none c-info__title">
+              状态
+            </div>
+            <div class="l-flex__fill c-info__value">
+              <el-switch
+                :value="outlet.state === 'ON'"
+                active-text="ON"
+                inactive-text="OFF"
+                @change="handleSwitchChange(outlet, $event)"
+              />
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import { ThirdPartyDevice } from '@/constant'
+import { getThirdPartyDevicesByThirdPartyDevice } from '@/api/mesh'
+import {
+  pduOutletsStatus, updatePduOutletsStatus
+} from '@/api/external'
+
+export default {
+  name: 'DevicePdu',
+  props: {
+    device: {
+      type: Object,
+      required: true
+    }
+  },
+  data () {
+    return {
+      loading: true,
+      error: false,
+      items: [],
+      deviceId: null,
+      outletsStatus: []
+    }
+  },
+  created () {
+    this.getThirdPartyDevicesByThirdPartyDevice()
+  },
+  methods: {
+    getThirdPartyDevicesByThirdPartyDevice () {
+      this.loading = true
+      this.error = false
+      getThirdPartyDevicesByThirdPartyDevice(this.device.id, [ThirdPartyDevice.PDU]).then(
+        ({ data }) => {
+          this.items = data.filter(({ instance }) => instance)
+          this.deviceId = this.items[0].instanceId
+          pduOutletsStatus(this.deviceId).then(
+            ({ data }) => {
+              this.outletsStatus = data
+              console.log(this.outletsStatus)
+            }
+          )
+        },
+        () => {
+          this.error = true
+        }
+      ).finally(() => {
+        this.loading = false
+      })
+    },
+    handleSwitchChange (outlet, value) {
+      console.log(outlet, value)
+      // true -> ON
+      const state = value ? 'ON' : 'OFF'
+      updatePduOutletsStatus(outlet.slot_no, state, this.deviceId).then(
+        ({ data }) => {
+          this.outletsStatus = data
+          console.log(this.outletsStatus)
+        }
+      )
+    }
+  }
+}
+</script>

+ 6 - 1
src/views/device/detail/components/DeviceExternal/index.vue

@@ -33,6 +33,7 @@ import ReceivingCard from './components/ReceivingCard.vue'
 import LedCamera from './components/LED.vue'
 import TrafficCamera from './components/Traffic.vue'
 import Gateway from './components/Gateway.vue'
+import Pdu from './components/Pdu.vue'
 
 export default {
   name: 'DeviceExternal',
@@ -41,7 +42,8 @@ export default {
     ReceivingCard,
     TrafficCamera,
     LedCamera,
-    Gateway
+    Gateway,
+    Pdu
   },
   props: {
     device: {
@@ -80,6 +82,9 @@ export default {
         case ThirdPartyDevice.GATEWAY:
           activeComponent = 'Gateway'
           break
+        case ThirdPartyDevice.PDU:
+          activeComponent = 'Pdu'
+          break
         default:
           return
       }

+ 121 - 0
src/views/external/components/PduConfigDialog.vue

@@ -0,0 +1,121 @@
+<template>
+  <confirm-dialog
+    ref="dialog"
+    title="新增PDU"
+    @confirm="onConfirm"
+  >
+    <div class="c-grid-form u-align-self--center">
+      <span class="c-grid-form__label u-required">
+        厂商
+      </span>
+      <schema-select
+        ref="manufacturer"
+        v-model="item.manufacturerKey"
+        class="u-width"
+        placeholder="请选择厂商"
+        :schema="manufacturerSelectSchema"
+      />
+      <span class="c-grid-form__label u-required">
+        型号
+      </span>
+      <el-input
+        v-model.trim="item.model"
+        placeholder="最多50个字符"
+        maxlength="50"
+        clearable
+      />
+      <span class="c-grid-form__label u-required">
+        PDU地址
+      </span>
+      <el-input
+        v-model.trim="item.ip"
+        placeholder="10.180.88.84"
+        clearable
+      />
+      <span class="c-grid-form__label u-required">
+        唯一标识
+      </span>
+      <el-input
+        v-model.trim="item.identifier"
+        placeholder="最多50个字符"
+        maxlength="50"
+        clearable
+      />
+    </div>
+  </confirm-dialog>
+</template>
+
+<script>
+import { ThirdPartyDevice } from '@/constant'
+import {
+  getManufacturersByType,
+  addPdu
+} from '@/api/external'
+
+export default {
+  name: 'PduConfigDialog',
+  data () {
+    return {
+      manufacturerSelectSchema: {
+        remote: this.getManufacturersByType,
+        value: 'manufacturerKey',
+        label: 'manufacturerName'
+      },
+      item: {}
+    }
+  },
+  methods: {
+    show () {
+      this.item = {
+        identifier: '',
+        manufacturerKey: '',
+        model: '',
+        ip: ''
+      }
+      this.$refs.dialog.show()
+    },
+    getManufacturersByType () {
+      return getManufacturersByType(ThirdPartyDevice.PDU)
+    },
+    onConfirm (done) {
+      if (!this.item.manufacturerKey) {
+        this.$message({
+          type: 'warning',
+          message: '请选择厂商'
+        })
+        return
+      }
+      if (!this.item.model) {
+        this.$message({
+          type: 'warning',
+          message: '请填写型号'
+        })
+        return
+      }
+      if (!this.item.identifier) {
+        this.$message({
+          type: 'warning',
+          message: '请填写唯一标识'
+        })
+        return
+      }
+      if (!this.item.ip) {
+        this.$message({
+          type: 'warning',
+          message: '请填写网关服务器地址'
+        })
+        return
+      }
+      const key = this.item.manufacturerKey
+      addPdu({
+        manufacturerName: this.$refs.manufacturer.getOptions().find(({ value }) => value === key).label,
+        ...this.item
+      }).then(() => {
+        done()
+        this.$emit('confirm', this.item)
+      })
+    }
+  }
+}
+</script>
+

+ 61 - 15
src/views/external/mesh/index.vue

@@ -27,7 +27,9 @@
         />
         <template v-else>
           <div class="l-flex__none l-flex--row c-sibling-item--v u-line-height">
-            <div class="c-sibling-item u-font-size--md u-ellipsis">节点</div>
+            <div class="c-sibling-item u-font-size--md u-ellipsis">
+              节点
+            </div>
             <i
               class="l-flex__none c-sibling-item el-icon-circle-plus-outline u-font-size--lg u-color--blue u-bold has-active"
               @click.stop="onAddNode"
@@ -60,12 +62,16 @@
           >
             <template #default>
               <div class="c-grid-form u-align-self--center">
-                <span class="c-grid-form__label u-required">类型</span>
+                <span class="c-grid-form__label u-required">
+                  类型
+                </span>
                 <schema-select
                   v-model="item.nodeType"
                   :schema="thirdPartyDeviceSelectSchema"
                 />
-                <span class="c-grid-form__label">别名</span>
+                <span class="c-grid-form__label">
+                  别名
+                </span>
                 <el-input
                   v-model.trim="item.name"
                   placeholder="最多30个字符"
@@ -73,7 +79,9 @@
                   clearable
                 />
                 <template v-if="needPort">
-                  <span class="c-grid-form__label u-required">端口</span>
+                  <span class="c-grid-form__label u-required">
+                    端口
+                  </span>
                   <div
                     class="has-info"
                     data-info="若设备上的端口从1开始,填入时需减1处理"
@@ -95,7 +103,9 @@
             @confirm="onSubmit"
           >
             <div class="c-grid-form u-align-self--center">
-              <span class="c-grid-form__label">别名</span>
+              <span class="c-grid-form__label">
+                别名
+              </span>
               <el-input
                 v-model.trim="item.name"
                 placeholder="最多30个字符"
@@ -111,7 +121,9 @@
           >
             <template #default>
               <div class="c-grid-form auto u-align-self--center">
-                <span class="c-grid-form__label u-required">端口</span>
+                <span class="c-grid-form__label u-required">
+                  端口
+                </span>
                 <div
                   class="has-info u-width--md"
                   data-info="若设备上的端口从1开始,填入时需减1处理"
@@ -154,7 +166,9 @@
                 @click="onAddChildNode"
               >
                 <i class="c-sibling-item el-icon-circle-plus-outline" />
-                <span class="c-sibling-item">新增子节点</span>
+                <span class="c-sibling-item">
+                  新增子节点
+                </span>
               </div>
               <div
                 v-if="canHasAhead"
@@ -162,7 +176,9 @@
                 @click="onAddParentNode"
               >
                 <i class="c-sibling-item el-icon-circle-plus-outline" />
-                <span class="c-sibling-item">新增父节点</span>
+                <span class="c-sibling-item">
+                  新增父节点
+                </span>
               </div>
               <div
                 v-if="canLink"
@@ -170,7 +186,9 @@
                 @click="onLinkTo"
               >
                 <i class="c-sibling-item el-icon-edit" />
-                <span class="c-sibling-item">连接至</span>
+                <span class="c-sibling-item">
+                  连接至
+                </span>
               </div>
               <div
                 v-if="canEdit"
@@ -178,21 +196,27 @@
                 @click="onEdit"
               >
                 <i class="c-sibling-item el-icon-edit" />
-                <span class="c-sibling-item">修改属性</span>
+                <span class="c-sibling-item">
+                  修改属性
+                </span>
               </div>
               <div
                 class="l-flex--row c-contentmenu__item has-active"
                 @click="onEditNode"
               >
                 <i class="c-sibling-item el-icon-edit" />
-                <span class="c-sibling-item">修改别名</span>
+                <span class="c-sibling-item">
+                  修改别名
+                </span>
               </div>
               <div
                 class="l-flex--row c-contentmenu__item has-active"
                 @click="onToggleInstance"
               >
                 <i class="c-sibling-item el-icon-edit" />
-                <span class="c-sibling-item">{{ hasInstance ? '解绑' : '绑定' }}</span>
+                <span class="c-sibling-item">
+                  {{ hasInstance ? '解绑' : '绑定' }}
+                </span>
               </div>
             </template>
             <template v-else>
@@ -202,7 +226,9 @@
                 @click="onEditPort"
               >
                 <i class="c-sibling-item el-icon-edit" />
-                <span class="c-sibling-item">端口</span>
+                <span class="c-sibling-item">
+                  端口
+                </span>
               </div>
             </template>
             <div
@@ -210,7 +236,9 @@
               @click="onDel"
             >
               <i class="c-sibling-item el-icon-remove-outline" />
-              <span class="c-sibling-item">删除</span>
+              <span class="c-sibling-item">
+                删除
+              </span>
             </div>
           </el-card>
         </template>
@@ -254,7 +282,7 @@ import {
   getMultifunctionCards,
   getSensors,
   getPLCs,
-  getCameras
+  getCameras, getPdus
 } from '@/api/external'
 import { getDevices } from '@/api/device'
 import * as echarts from 'echarts'
@@ -517,6 +545,24 @@ export default {
               { prop: 'identifier', label: '唯一标识' }
             ]
           }
+        case ThirdPartyDevice.PDU:
+          return {
+            list: getPdus,
+            condition: { boundFlag: 0 },
+            buttons: [
+              { type: 'add', on: this.onAddThirdParty }
+            ],
+            filters: [
+              { key: 'manufacturerKey', type: 'select', placeholder: '厂商', remote: this.getManufacturersByType, value: 'manufacturerKey', label: 'manufacturerName' },
+              { key: 'identifier', type: 'search', placeholder: '唯一标识' }
+            ],
+            cols: [
+              { prop: 'manufacturerName', label: '厂商' },
+              { prop: 'model', label: '型号' },
+              { prop: 'ip', label: '服务器地址' },
+              { prop: 'identifier', label: '唯一标识' }
+            ]
+          }
         case ThirdPartyDevice.SCREEN:
           return {
             list: getScreens,

+ 164 - 0
src/views/external/pdu/index.vue

@@ -0,0 +1,164 @@
+<template>
+  <wrapper
+    fill
+    margin
+    padding
+    background
+  >
+    <schema-table
+      ref="table"
+      :schema="schema"
+    />
+    <!--    <table-dialog
+          ref="tableDialog"
+          title="关联设备"
+          :schema="deviceSchema"
+        />-->
+    <mesh-dialog ref="meshDialog" />
+    <pdu-config-dialog
+      ref="pduConfigDialog"
+      @confirm="onConfirm"
+    />
+  </wrapper>
+</template>
+
+<script>
+import { ThirdPartyDevice } from '@/constant'
+import {
+  deletePdu, getManufacturersByType, getPdus, updatePdu
+} from '@/api/external'
+import MeshDialog from '../components/MeshDialog.vue'
+import PduConfigDialog from '../components/PduConfigDialog.vue'
+
+export default {
+  name: 'PduList',
+  components: {
+    MeshDialog,
+    PduConfigDialog
+  },
+  data () {
+    return {
+      schema: {
+        list: getPdus,
+        buttons: [
+          { type: 'add', on: this.onAdd }
+        ],
+        filters: [
+          {
+            key: 'manufacturerKey',
+            type: 'select',
+            placeholder: '厂商',
+            remote: this.getManufacturersByType,
+            value: 'manufacturerKey',
+            label: 'manufacturerName'
+          },
+          {
+            key: 'boundFlag', type: 'select', placeholder: '使用情况', options: [
+              { value: 1, label: '已使用' },
+              { value: 0, label: '未使用' }
+            ]
+          },
+          { key: 'identifier', type: 'search', placeholder: '唯一标识' }
+        ],
+        cols: [
+          { prop: 'manufacturerName', label: '厂商' },
+          { prop: 'model', label: '型号' },
+          {
+            label: '服务器地址', render: (data, h) => h('edit-input', {
+              props: {
+                value: `${data.ip}`
+              },
+              on: { edit: val => this.onEditIP(data, val) }
+            }), 'class-name': 'c-edit-column'
+          },
+          { prop: 'identifier', label: '唯一标识' },
+          {
+            label: '使用情况', type: 'tag', render: ({ bound }) => bound
+              ? { type: 'success', label: '已使用' }
+              : { type: 'primary', label: '未使用' }
+          },
+          {
+            type: 'invoke', render: [
+              /* { label: '关联设备', on: this.onViewDevices }, */
+              { label: '所属网点', allow: ({ bound }) => bound, on: this.onViewMesh },
+              { label: '删除', allow: ({ bound }) => !bound, on: this.onDel }
+            ], width: 200
+          }
+        ]
+      }
+      /* deviceSchema: {
+        nonPagination: true,
+        list: this.getFollowThirdPartyDevicesByThirdPartyDevice,
+        cols: [
+          { prop: 'type', label: '设备类型' },
+          { prop: 'manufacturerName', label: '厂商' },
+          { prop: 'model', label: '型号' },
+          { prop: 'identifier', label: '唯一标识' }
+        ]
+      } */
+    }
+  },
+  methods: {
+    getManufacturersByType () {
+      return getManufacturersByType(ThirdPartyDevice.PDU)
+    },
+    onAdd () {
+      this.$refs.pduConfigDialog.show()
+    },
+    onConfirm ({ manufacturerKey, identifier }) {
+      this.$refs.table.resetCondition({
+        boundFlag: 0,
+        manufacturerKey,
+        identifier
+      })
+    },
+    onDel (item) {
+      deletePdu(item)
+        .then(() => {
+          this.$refs.table.decrease(1)
+        })
+    },
+    onEditIP (pdu, { newVal, oldVal }) {
+      if (newVal === oldVal) {
+        return
+      }
+      pdu.ip = newVal
+      updatePdu({
+        id: pdu.id,
+        ip: newVal
+      })
+        .catch(() => {
+          pdu.ip = oldVal
+        })
+    },
+    /* onViewDevices ({ id }) {
+      this.$pduId = id
+      this.$refs.tableDialog.show()
+    }, */
+    /* getFollowThirdPartyDevicesByThirdPartyDevice () {
+      return getFollowThirdPartyDevicesByThirdPartyDevice(this.$pdu, [
+        ...sensors,
+        ThirdPartyDevice.PLC
+      ]).then(({ data }) => {
+        return { data: data.filter(({ instance }) => instance).map(this.transformThirdPartyDevice) }
+      })
+    }, */
+    /* transformThirdPartyDevice ({ nodeType, instance }) {
+      const { manufacturerName, model, identifier } = instance
+      return {
+        type: ThirdPartyDeviceInfo[nodeType],
+        manufacturerName, model, identifier
+      }
+    }, */
+    onViewMesh ({ id }) {
+      this.$refs.meshDialog.show(id)
+    }
+    /* onEditPLC ({ id }) {
+      this.$refs.plcDialog.show(id)
+    },
+    onEditSensor ({ id }) {
+      this.$refs.sensorDialog.show(id)
+    } */
+  }
+}
+</script>