From c1f6401598098a38be7b6cd00d91a7750d7fad20 Mon Sep 17 00:00:00 2001
From: 648540858 <456panlinlin>
Date: 星期一, 18 四月 2022 11:45:53 +0800
Subject: [PATCH] 修复级联编辑页面开关的重置

---
 web_src/src/components/dialog/platformEdit.vue |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/web_src/src/components/dialog/platformEdit.vue b/web_src/src/components/dialog/platformEdit.vue
index fad0444..3b32d66 100644
--- a/web_src/src/components/dialog/platformEdit.vue
+++ b/web_src/src/components/dialog/platformEdit.vue
@@ -77,6 +77,7 @@
                 <el-checkbox label="鍚敤" v-model="platform.enable" @change="checkExpires"></el-checkbox>
                 <el-checkbox label="浜戝彴鎺у埗" v-model="platform.ptz"></el-checkbox>
                 <el-checkbox label="鍏变韩鎵�鏈夌洿鎾祦" v-model="platform.shareAllLiveStream"></el-checkbox>
+                <el-checkbox label="鎷夎捣绂荤嚎鎺ㄦ祦" v-model="platform.startOfflinePush"></el-checkbox>
               </el-form-item>
               <el-form-item>
                 <el-button type="primary" @click="onSubmit">{{
@@ -116,6 +117,7 @@
       showDialog: false,
       isLoging: false,
       onSubmit_text: "绔嬪嵆鍒涘缓",
+      saveUrl: "/api/platform/save",
 
       platform: {
         id: null,
@@ -137,6 +139,7 @@
         transport: "UDP",
         characterSet: "GB2312",
         shareAllLiveStream: false,
+        startOfflinePush: false,
       },
       rules: {
         name: [{ required: true, message: "璇疯緭鍏ュ钩鍙板悕绉�", trigger: "blur" }],
@@ -163,6 +166,7 @@
       var that = this;
       if (platform == null) {
         this.onSubmit_text = "绔嬪嵆鍒涘缓";
+        this.saveUrl = "/api/platform/add";
         this.$axios({
           method: 'get',
           url:`/api/platform/server_config`
@@ -196,7 +200,10 @@
         this.platform.transport = platform.transport;
         this.platform.characterSet = platform.characterSet;
         this.platform.shareAllLiveStream = platform.shareAllLiveStream;
+        this.platform.catalogId = platform.catalogId;
+        this.platform.startOfflinePush = platform.startOfflinePush;
         this.onSubmit_text = "淇濆瓨";
+        this.saveUrl = "/api/platform/save";
       }
       this.showDialog = true;
       this.listChangeCallback = callback;
@@ -211,14 +218,13 @@
       this.platform.username = this.platform.deviceGBId ;
     },
     onSubmit: function () {
-      console.log("onSubmit");
       var that = this;
       that.$axios({
         method: 'post',
-        url:`/api/platform/save`,
+        url: this.saveUrl,
         data: that.platform
       }).then(function (res) {
-          if (res.data == "success") {
+          if (res.data.code === 0) {
             that.$message({
               showClose: true,
               message: "淇濆瓨鎴愬姛",
@@ -228,6 +234,12 @@
             if (that.listChangeCallback != null) {
               that.listChangeCallback();
             }
+          }else {
+            that.$message({
+              showClose: true,
+              message: res.data.msg,
+              type: "error",
+            });
           }
         }).catch(function (error) {
           console.log(error);
@@ -257,6 +269,7 @@
         transport: "UDP",
         characterSet: "GB2312",
         shareAllLiveStream: false,
+        startOfflinePush: false,
       }
     },
     deviceGBIdExit: async function (deviceGbId) {

--
Gitblit v1.8.0