Selaa lähdekoodia

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

vothin 3 vuotta sitten
vanhempi
commit
ebb566cbf7
1 muutettua tiedostoa jossa 10 lisäystä ja 0 poistoa
  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) => {
         if (valid) {
           const _this = this;
+          this.deviceModel.part_id = this.getPartId(this.deviceModel.frame_id)
           /** 新增 */
           if (!this.deviceModel.id) {
              API_Device.add(this.deviceModel).then(r => {
@@ -965,6 +966,15 @@ export default {
         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() {
       var stockbase = DeviceUrl.replace('http', 'ws')