Explorar o código

修改维护设备

Limengbo %!s(int64=4) %!d(string=hai) anos
pai
achega
87fed50725

+ 8 - 0
src/api/admin.js

@@ -55,3 +55,11 @@ export function setDeviceStatus(data) {
     data
   })
 }
+// 设备维护
+export function addDeviceLogMaintain(data) {
+  return request({
+    url: '/sharedWhiteBoard/cms/deviceLog',
+    method: 'put',
+    data
+  })
+}

+ 17 - 1
src/store/modules/admin.js

@@ -1,5 +1,6 @@
-import { getDeviceList, getDeviceModifierList, addDeviceModifier, setDeviceModifier, queryLogList, setDeviceAdmin } from '@/api/admin'
+import { getDeviceList, getDeviceModifierList, addDeviceModifier, setDeviceModifier, queryLogList, setDeviceAdmin, addDeviceLogMaintain } from '@/api/admin'
 import { parseTime } from '@/utils/index'
+import { getToken } from '@/utils/auth'
 const state = {
   deviceData: [],
   modifierData: [],
@@ -116,6 +117,21 @@ const actions = {
         reject(error)
       })
     })
+  },
+  addDeviceLogMaintain({ dispatch }, data) {
+    return new Promise((resolve, reject) => {
+      addDeviceLogMaintain(data).then(response => {
+        const { data } = response
+        console.log(data)
+        dispatch('getDeviceData', {
+          modifier: getToken()
+        })
+        // commit('GET_MODIFIER', data.list)
+        resolve()
+      }).catch(error => {
+        reject(error)
+      })
+    })
   }
 }
 

+ 130 - 76
src/views/admin/device/index.vue

@@ -33,72 +33,126 @@
       />
       <el-button type="primary" size="mini" style="float: right;" @click="search">查询</el-button>
     </div>
-    <el-table
-      :data="deviceData"
-      style="width: 100%"
-    >
-      <el-table-column
-        label="设备安装时间"
-        prop="gmtCreated"
-      />
-      <el-table-column
-        label="设备编号"
-        prop="deviceCode"
-      />
-      <el-table-column
-        label="设备尺寸"
-        prop="deviceSize"
-      />
-      <el-table-column
-        label="设备型号"
-        prop="deviceType"
-      />
-      <el-table-column
-        label="设备地区"
-        prop="region"
-      />
-      <el-table-column
-        label="设备地址"
-        prop="address"
-      />
-      <el-table-column
-        align="right"
+    <div v-show="type === '2' || type === '1,2' || type === '2,1'">
+      <el-table
+        :data="deviceData"
+        style="width: 100%"
+      >
+        <el-table-column
+          label="设备安装时间"
+          prop="gmtCreated"
+        />
+        <el-table-column
+          label="设备编号"
+          prop="deviceCode"
+        />
+        <el-table-column
+          label="设备尺寸"
+          prop="deviceSize"
+        />
+        <el-table-column
+          label="设备型号"
+          prop="deviceType"
+        />
+        <el-table-column
+          label="设备地区"
+          prop="region"
+        />
+        <el-table-column
+          label="设备地址"
+          prop="address"
+        />
+        <el-table-column
+          label="状态"
+        >
+          <template slot-scope="scope">
+            <span>
+              {{ scope.row.status === 'UNNORMAL' ? '不正常' : '正常' }}
+            </span>
+          </template>
+        </el-table-column>
+        <el-table-column
+          align="right"
+        >
+          <template slot-scope="scope">
+            <el-button
+              size="mini"
+              style="float: left; margin: 0 10px 0 0;"
+              @click="handleMaintainMessage(scope.$index, scope.row)"
+            >
+              维护信息
+            </el-button>
+            <el-button
+              v-show="scope.row.status === 'UNNORMAL'"
+              size="mini"
+              style="float: left; margin: 0 10px 0 0;"
+              type="danger"
+              @click="handleMaintain(scope.$index, scope.row)"
+            >
+              立即维护
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+    <div v-show="type === '0'">
+      <el-table
+        :data="deviceData"
+        style="width: 100%"
       >
-        <template slot-scope="scope">
-          <el-button
-            v-show="type === '0'"
-            size="mini"
-            style="float: left; margin: 0 10px 0 0;"
-            @click="handleInstall(scope.$index, scope.row)"
-          >
-            安装信息
-          </el-button>
-          <el-button
-            size="mini"
-            style="float: left; margin: 0 10px 0 0;"
-            @click="handleMaintainMessage(scope.$index, scope.row)"
-          >
-            维护信息
-          </el-button>
-          <el-button
-            v-show="type === '2' || type === '1,2' || type === '2,1'"
-            size="mini"
-            style="float: left; margin: 0 10px 0 0;"
-            @click="handleMaintain(scope.$index, scope.row)"
-          >
-            立即维护
-          </el-button>
-          <el-button
-            v-show="type === '0'"
-            size="mini"
-            style="float: left; margin: 0 10px 0 0;"
-            @click="handleUse(scope.$index, scope.row)"
-          >
-            使用日志
-          </el-button>
-        </template>
-      </el-table-column>
-    </el-table>
+        <el-table-column
+          label="设备安装时间"
+          prop="gmtCreated"
+        />
+        <el-table-column
+          label="设备编号"
+          prop="deviceCode"
+        />
+        <el-table-column
+          label="设备尺寸"
+          prop="deviceSize"
+        />
+        <el-table-column
+          label="设备型号"
+          prop="deviceType"
+        />
+        <el-table-column
+          label="设备地区"
+          prop="region"
+        />
+        <el-table-column
+          label="设备地址"
+          prop="address"
+        />
+        <el-table-column
+          align="right"
+        >
+          <template slot-scope="scope">
+            <el-button
+              size="mini"
+              style="float: left; margin: 0 10px 0 0;"
+              @click="handleInstall(scope.$index, scope.row)"
+            >
+              安装信息
+            </el-button>
+            <el-button
+              size="mini"
+              style="float: left; margin: 0 10px 0 0;"
+              @click="handleMaintainMessage(scope.$index, scope.row)"
+            >
+              维护信息
+            </el-button>
+            <el-button
+              size="mini"
+              style="float: left; margin: 0 10px 0 0;"
+              @click="handleUse(scope.$index, scope.row)"
+            >
+              使用日志
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
     <el-dialog :title="gridTile" :visible.sync="dialogTableVisible">
       <el-table :data="gridData">
         <el-table-column
@@ -115,19 +169,19 @@
       width="60%"
     >
       <div class="install">
-        安装日期: {{ gridData.length > 0 ? gridData[0].deviceLog.gmtCreated : '' }}
+        安装日期: {{ gridInstallData.length > 0 ? gridInstallData[0].deviceLog.gmtCreated : '' }}
       </div>
       <div class="install">
-        安装人员: {{ gridData.length > 0 ? gridData[0].deviceModifier.name : '' }}
+        安装人员: {{ gridInstallData.length > 0 ? gridInstallData[0].deviceModifier.name : '' }}
       </div>
       <div class="install">
-        安装地区: {{ gridData.length > 0 ? gridData[0].device.region : '' }}
+        安装地区: {{ gridInstallData.length > 0 ? gridInstallData[0].device.region : '' }}
       </div>
       <div class="install">
-        安装地址: {{ gridData.length > 0 ? gridData[0].device.address : '' }}
+        安装地址: {{ gridInstallData.length > 0 ? gridInstallData[0].device.address : '' }}
       </div>
       <div class="install">
-        备注信息: {{ gridData.length > 0 ? gridData[0].deviceLog.description : '' }}
+        备注信息: {{ gridInstallData.length > 0 ? gridInstallData[0].deviceLog.description : '' }}
       </div>
     </el-dialog>
     <el-dialog title="立即维护" :visible.sync="dialogFormVisible">
@@ -155,6 +209,7 @@ export default {
       dialogTableVisible: false,
       dialogVisible: false,
       gridData: [],
+      gridInstallData: [],
       gridTile: '',
       type: getType(),
       uid: getToken(),
@@ -169,7 +224,8 @@ export default {
         deviceCode: '',
         deviceId: '',
         opType: 'MODIFIED',
-        description: ''
+        description: '',
+        status: 'NORMAL'
       }
     }
   },
@@ -218,8 +274,7 @@ export default {
         deviceCode: row.deviceCode,
         opType: 'INSTALL'
       }).then(() => {
-        this.gridData = this.$store.getters.logData
-        // this.gridData.push(row)
+        this.gridInstallData = this.$store.getters.logData
         this.dialogVisible = true
       })
     },
@@ -260,13 +315,12 @@ export default {
         opType: 'USE'
       }).then(() => {
         this.gridData = this.$store.getters.logData
-        // this.gridData.push(row)
         this.gridTile = '使用日志'
         this.information = [{
           label: '设备连接时间',
           type: 'deviceLog[gmtCreated]'
         }, {
-          label: '设备连接日期',
+          label: '设备连接用户',
           type: 'deviceModifier[name]'
         }]
         this.dialogTableVisible = true
@@ -277,7 +331,7 @@ export default {
       // this.dialogTableVisible = true
     },
     handSolve() {
-      this.$store.dispatch('install/addDeviceLog', this.solveForm)
+      this.$store.dispatch('admin/addDeviceLogMaintain', this.solveForm)
       this.dialogFormVisible = false
     }
   }

+ 9 - 0
src/views/admin/installMaintain/index.vue

@@ -51,6 +51,15 @@
         </template>
       </el-table-column>
       <el-table-column
+        label="状态"
+      >
+        <template slot-scope="scope">
+          <span>
+            {{ scope.row.status === 'DEL' ? '不正常' : '正常' }}
+          </span>
+        </template>
+      </el-table-column>
+      <el-table-column
         align="right"
       >
         <template slot-scope="scope">