浏览代码

1、增加初始化485;2、增加初始化系统;3、解决优化发现的问题

wennn 3 年之前
父节点
当前提交
260332b3c2

+ 14 - 0
src/api/initialize.js

@@ -0,0 +1,14 @@
+import request from '@/utils/request'
+
+export function initData(partId) {
+  return request({
+    url: `/initialize/init_data/${partId}`,
+    method: 'GET'
+  })
+}
+export function init485Device(partId) {
+  return request({
+    url: `/initialize/init_485_device/${partId}`,
+    method: 'GET'
+  })
+}

+ 1 - 1
src/utils/mixin.js

@@ -3,7 +3,7 @@
  */
 
 import Vue from 'vue'
-import { Foundation } from './Foundation'
+import * as Foundation from './Foundation'
 import * as XLSX from 'xlsx'
 
 export default {

+ 1 - 0
src/views/hospital/ncs_customer/customerManager.vue

@@ -1263,6 +1263,7 @@ export default {
         this.$message({ type: 'info', message: '请先勾选需要删除的数据' })
         return
       }
+      console.log('rows===', rows)
       const ids = []
       const uids = []
       rows.forEach(function(item) {

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

@@ -650,8 +650,10 @@ export default {
         soft_ver: 'SV1.0',
         hard_ver: 'HV1.0',
         priority: 1,
+        status: 1,
         code: 'C' + parseInt(Math.random() * 100000),
-        model: 'M' + parseInt(Math.random() * 100000)
+        model: 'M' + parseInt(Math.random() * 100000),
+        part_id: this.$store.getters.partId
       }
       if (Object.keys(this.frame).length > 0) {
         this.$set(this.deviceModel, 'frame_id', this.frame.id)
@@ -690,8 +692,6 @@ export default {
         if (valid) {
           /** 新增 */
           if (!this.deviceModel.id) {
-            this.deviceModel.part_id = this.frame.part_id
-            this.deviceModel.frame_id = this.frame.id
             API_Device.add(this.deviceModel).then(() => {
               this.$message.success('保存成功!')
               this.deviceDialogVisible = false

+ 2 - 1
src/views/ncs-device/components/deviceManager.vue

@@ -711,7 +711,8 @@ export default {
         priority: 1,
         code: 'C' + parseInt(Math.random() * 100000),
         model: 'M' + parseInt(Math.random() * 100000),
-        part_id: this.$store.getters.partId
+        part_id: this.$store.getters.partId,
+        status: 1
       }
       if (Object.keys(this.frame).length > 0) {
         this.$set(this.deviceModel, 'frame_id', this.frame.id)

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

@@ -287,7 +287,9 @@
 
         <el-form-item align="center" class="margin-top-sm">
           <el-button type="success" @click="onSubmit">保存设置</el-button>
-          <el-button type="ss" @click="saveList">批量添加测试用户</el-button>
+          <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-form-item>
       </el-form>
     </el-card>
@@ -297,9 +299,9 @@
 <script>
 // 系统设置
 import * as API_Part from '@/api/ncs_partInfo'
-import * as API_Nurse from '@/api/calling-nurse'
 import { saveListByCustomer } from '@/api/ncs_customer'
-import * as API_ErrorLog from '@/api/ncs_errorlog'
+import Storage from '@/utils/storage'
+import { init485Device, initData } from "@/api/initialize";
 
 export default {
   name: 'PartInfoEdit',
@@ -316,10 +318,13 @@ export default {
       dayStart: new Date(2020, 11, 11, 7, 0),
       nightStart: new Date(2020, 11, 11, 18, 0),
       nurseLevel0Config: [],
-      parents: []
+      parents: [],
+      isShow: false,
+      isDisabled: false
     }
   },
   async mounted() {
+    this.isShow = JSON.parse(Storage.getItem('calling_user')).username === 'superadmin'
     // this.nurseLevel0Config = await API_Nurse.getNurseConfigs(this.partId, 0)
     this.getPartInfo()
     this.getPartents()
@@ -418,6 +423,7 @@ export default {
         this.parents = [...res]
       })
     },
+    // 批量增加测试用户
     saveList() {
       const _this = this
       this.$confirm('确定需要批量增加测试用户吗?', '提示', {
@@ -432,6 +438,29 @@ export default {
       }).catch(() => {
         console.log('取消')
       })
+    },
+    // 初始化485设备
+    initialize485Device() {
+      this.isDisabled = true
+      const _this = this
+      init485Device(_this.partId).then(res => {
+        if (res.success) {
+          _this.$message.info(res.message)
+          setTimeout(() => {
+            _this.isDisabled = false
+          }, 60000)
+        } else {
+          _this.isDisabled = false
+          _this.$message.info(res.message)
+        }
+      })
+    },
+    // 初始化系统
+    initializeSystem() {
+      const _this = this
+      initData(_this.partId).then(res => {
+        _this.$message.info(res.message)
+      })
     }
   }
 }

+ 27 - 27
src/views/ncs-remark/index.vue

@@ -126,33 +126,33 @@
                 this.multipleSelection = val
             },
             /** 删除单条数据 */
-            handlerDelete(ids) {
-                this.$confirm('删除操作后数据不可复原,您确定要删除此数据?', '警告', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-                    API_Remark.remove(ids).then(
-                        response => {
-                            this.getList()
-                            this.$message({
-                                type: 'success',
-                                message: '删除成功!'
-                            })
-                        }
-                    ).catch(response => {
-                        this.$message({
-                            type: 'info',
-                            message: response.message
-                        })
-                    })
-                }).catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消删除'
-                    })
-                })
-            },
+            // handlerDelete(ids) {
+            //     this.$confirm('删除操作后数据不可复原,您确定要删除此数据?', '警告', {
+            //         confirmButtonText: '确定',
+            //         cancelButtonText: '取消',
+            //         type: 'warning'
+            //     }).then(() => {
+            //         API_Remark.remove(ids).then(
+            //             response => {
+            //                 this.getList()
+            //                 this.$message({
+            //                     type: 'success',
+            //                     message: '删除成功!'
+            //                 })
+            //             }
+            //         ).catch(response => {
+            //             this.$message({
+            //                 type: 'info',
+            //                 message: response.message
+            //             })
+            //         })
+            //     }).catch(() => {
+            //         this.$message({
+            //             type: 'info',
+            //             message: '已取消删除'
+            //         })
+            //     })
+            // },
             /** 分页大小发生改变 */
             handlePageSizeChange(size) {
                 this.params.page_size = size