Browse Source

在科室设置中增加批量刷新设备(主要批量增加测试用户后设备刷新问题)

wennn 3 years ago
parent
commit
607df34f2b
2 changed files with 22 additions and 1 deletions
  1. 6 0
      src/api/initialize.js
  2. 16 1
      src/views/ncs-orginazition/components/partInfoEdit.vue

+ 6 - 0
src/api/initialize.js

@@ -12,3 +12,9 @@ export function init485Device(partId) {
     method: 'GET'
   })
 }
+export function initDeviceList(partId) {
+  return request({
+    url: `/initialize/init_device_list/${partId}`,
+    method: 'GET'
+  })
+}

+ 16 - 1
src/views/ncs-orginazition/components/partInfoEdit.vue

@@ -345,6 +345,7 @@
           <el-button v-if="isShow" type="primary" @click="initializeSystem">初始化系统</el-button>
           <el-button v-if="isShow" type="success" plain :disabled="isDisabled" @click="initialize485Device">初始化485设备</el-button>
           <el-button v-if="isShow" type="ss" @click="saveList">批量添加测试用户</el-button>
+          <el-button v-if="isShow" type="ss" @click="devicesRef">设备批量刷新</el-button>
         </el-form-item>
       </el-form>
     </el-card>
@@ -356,7 +357,7 @@
 import * as API_Part from '@/api/ncs_partInfo'
 import { saveListByCustomer } from '@/api/ncs_customer'
 import Storage from '@/utils/storage'
-import { init485Device, initData } from "@/api/initialize";
+import { init485Device, initData, initDeviceList } from '@/api/initialize'
 import * as API_Clerk from '@/api/ncs_clerk'
 import * as API_SystemConfig from '@/api/ncs_systemconfig'
 export default {
@@ -541,6 +542,20 @@ export default {
       initData(_this.partId).then(res => {
         _this.$message.info(res.message)
       })
+    },
+    devicesRef() {
+      const _this = this
+      this.$confirm('确定需要批量刷新设备吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        initDeviceList(_this.partId).then(res => {
+          _this.$message.success(res.message)
+        })
+      }).catch(() => {
+        console.log('取消')
+      })
     }
   }
 }