zxl
2025-06-12 9f16b5c553b479ea12fe368a7ecc748872ea8b98
web_src/src/components/dialog/chooseChannel.vue
old mode 100644 new mode 100755
@@ -1,14 +1,14 @@
<template>
<div id="chooseChannel" v-loading="isLoging">
<div id="chooseChannel" >
    <el-dialog title="选择通道" v-if="showDialog" top="2rem" width="90%" :close-on-click-modal="false" :visible.sync="showDialog" :destroy-on-close="true" @close="close()">
    <el-dialog title="选择通道" v-loading="loading" v-if="showDialog" top="2rem" width="90%" :close-on-click-modal="false" :visible.sync="showDialog" :destroy-on-close="true" @close="close()">
      <el-row>
        <el-col :span="10">
          <el-tabs v-model="catalogTabActiveName" >
            <el-tab-pane label="目录结构" name="catalog">
              <el-container>
                <el-main style="background-color: #FFF;">
                  <chooseChannelForCatalog ref="chooseChannelForCatalog" :platformId=platformId :platformName=platformName :defaultCatalogId=defaultCatalogId :catalogIdChange="catalogIdChange"></chooseChannelForCatalog>
                <el-main v-bind:style="{backgroundColor: '#FFF', maxHeight:  winHeight + 'px'}">
                  <chooseChannelForCatalog ref="chooseChannelForCatalog" :platformId=platformId :platformDeviceId=platformDeviceId :platformName=platformName :defaultCatalogId=defaultCatalogId :catalogIdChange="catalogIdChange" ></chooseChannelForCatalog>
                </el-main>
              </el-container>
            </el-tab-pane>
@@ -20,14 +20,14 @@
            <el-tab-pane label="国标通道" name="gbChannel">
              <el-container>
                <el-main style="background-color: #FFF;">
                  <chooseChannelForGb ref="chooseChannelForGb" :platformId=platformId :updateChoosedCallback="updateChooseChannelCallback"></chooseChannelForGb>
                  <chooseChannelForGb ref="chooseChannelForGb" :catalogId="catalogId" :catalogName="catalogName" :platformId=platformId ></chooseChannelForGb>
                </el-main>
              </el-container>
            </el-tab-pane>
            <el-tab-pane label="直播流通道" name="streamchannel">
              <el-container>
                <el-main style="background-color: #FFF;">
                  <chooseChannelFoStream ref="chooseChannelFoStream" :platformId=platformId :updateChoosedCallback="updateChooseChannelCallback"></chooseChannelFoStream>
                  <chooseChannelFoStream ref="chooseChannelFoStream" :catalogId="catalogId" :catalogName="catalogName" :currentCatalogId="currentCatalogId" :platformId=platformId ></chooseChannelFoStream>
                </el-main>
              </el-container>
            </el-tab-pane>
@@ -52,45 +52,37 @@
        chooseChannelForCatalog,
    },
    computed: {
        // getPlayerShared: function () {
        //     return {
        //         sharedUrl: window.location.host + '/' + this.videoUrl,
        //         sharedIframe: '<iframe src="' + window.location.host + '/' + this.videoUrl + '"></iframe>',
        //         sharedRtmp: this.videoUrl
        //     };
        // }
    },
    data() {
        return {
            isLoging: false,
            loading: false,
            tabActiveName: "gbChannel",
            catalogTabActiveName: "catalog",
            platformId: "",
            platformDeviceId: "",
            catalogId: "",
            catalogName: "",
            currentCatalogId: "",
            platformName: "",
            defaultCatalogId: "",
            showDialog: false,
            chooseData: {}
            chooseData: {},
            winHeight: window.innerHeight - 250,
        };
    },
    methods: {
        openDialog(platformId, platformName, defaultCatalogId, closeCallback) {
        openDialog(platformId, platformDeviceId, platformName, defaultCatalogId, closeCallback) {
            console.log("defaultCatalogId: " + defaultCatalogId)
            this.platformId = platformId
            this.platformDeviceId = platformDeviceId
            this.platformName = platformName
            this.defaultCatalogId = defaultCatalogId
            this.showDialog = true
            this.closeCallback = closeCallback
        },
        tabClick (tab, event){
          console.log(tab.label)
          if (tab.label === "gbChannel") {
            this.$refs.chooseChannelForGb.catalogIdChange(this.catalogId);
            this.$refs.chooseChannelForGb.initData();
          }else {
            this.$refs.chooseChannelFoStream.catalogIdChange(this.catalogId);
            this.$refs.chooseChannelFoStream.initData();
          }
        },
        close: function() {
@@ -100,18 +92,17 @@
        },
        save: function() {
            var that = this;
            this.$axios({
                method:"post",
                url:"/api/platform/update_channel_for_gb",
                data:{
                    platformId:  that.platformId,
                    channelReduces:  that.chooseData
                    platformId:  this.platformId,
                    channelReduces:  this.chooseData
                }
            }).then((res)=>{
                if (res.data == true) {
                    that.$message({
              if (res.data.code === 0) {
                this.$message({
                        showClose: true,
                        message: '保存成功,',
                        type: 'success'
@@ -120,22 +111,12 @@
            }).catch(function (error) {
                console.log(error);
            });
        },
        catalogIdChange: function (id) {
            console.log("中间模块收到: " + id)
        catalogIdChange: function (id, name) {
            this.catalogId = id;
            if (this.tabActiveName === "gbChannel") {
              this.$refs.chooseChannelForGb.catalogIdChange(id);
            }else {
              this.$refs.chooseChannelFoStream.catalogIdChange(id);
            }
            this.catalogName = name;
        },
        updateChooseChannelCallback (id, nodeIds){
          console.log("中间模块收到选择通道变化: " + id)
          console.log("中间模块收到选择通道变化: " + nodeIds)
          console.log("中间模块收到选择通道变化: " + typeof (nodeIds))
          this.$refs.chooseChannelForCatalog.refreshCatalogById(id, nodeIds)
        }
    }
};
</script>