浏览代码

修复添加设备时,科室不对的问题

vothin 3 年之前
父节点
当前提交
ebb566cbf7
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      src/views/ncs-device/components/deviceManager.vue

+ 10 - 0
src/views/ncs-device/components/deviceManager.vue

@@ -889,6 +889,7 @@ export default {
       this.$refs[formName].validate((valid) => {
       this.$refs[formName].validate((valid) => {
         if (valid) {
         if (valid) {
           const _this = this;
           const _this = this;
+          this.deviceModel.part_id = this.getPartId(this.deviceModel.frame_id)
           /** 新增 */
           /** 新增 */
           if (!this.deviceModel.id) {
           if (!this.deviceModel.id) {
              API_Device.add(this.deviceModel).then(r => {
              API_Device.add(this.deviceModel).then(r => {
@@ -965,6 +966,15 @@ export default {
         this.getTypeFrame(shopId)
         this.getTypeFrame(shopId)
       })
       })
     },
     },
+    getPartId(frame_id) {
+      let frame= {}
+      frame = this.partFrames.filter(p => p.id === frame_id)[0]
+      if (frame.part_id != null) {
+        return frame.part_id
+      } else {
+        return this.$store.getters.partId
+      }
+    },
 
 
     initWebSocket: function() {
     initWebSocket: function() {
       var stockbase = DeviceUrl.replace('http', 'ws')
       var stockbase = DeviceUrl.replace('http', 'ws')