Newer
Older
XinYang_SanWei+RongYun / src / views / CesiumCom / CesiumVue.vue
@张强云笔记本 张强云笔记本 on 22 Dec 2021 6 KB 前端提交
<template>
  <div id="CesiumVue">
    <swqj3Dmap @showcall="showcall(arguments)" />
    <div id="userList">
      <div class="TitleBox">选择通讯人员</div>
      <div class="UserBox">
        <!-- <el-input placeholder="输入关键字进行过滤" v-model="filterText">
        </el-input>

        <el-tree
          class="filter-tree"
          :data="data"
          :props="defaultProps"
          default-expand-all
          :filter-node-method="filterNode"
          accordion
          ref="tree"
        >
        </el-tree> -->
        <div class="treeListBox" v-for="(item, index) in data" :key="index">
          <div class="TItle" @click="titleClick(index)">
            {{ item.userName }}
          </div>
          <div class="treeBox" :ref="`tree${index}`" style="display: none">
            <el-tree
              class="filter-tree"
              :data="item.children"
              :props="defaultProps"
              default-expand-all
              :filter-node-method="filterNode"
              @node-click="handleNodeClick"
            >
            </el-tree>
          </div>
        </div>
      </div>
    </div>
    <!-- <div id="SHIPINTONGHUA" @click="spthClick('15824808463')">
      点击进行视频通话
    </div> -->
    <el-dialog
      title="视频对话"
      :visible.sync="dialogVisible"
      width="700px"
      :close-on-click-modal="false"
      @close="closeDialog()"
    >
      <div
        id="TongHuaBox"
        v-loading="loading"
        element-loading-text="拼命加载中"
        element-loading-spinner="el-icon-loading"
        element-loading-background="rgba(0, 0, 0, 0.8)"
      >
        <!-- <router-view ref="TongHua"></router-view> -->
        <div style="height: 500px; position: relative; overflow: hidden">
          <Callss ref="TongHua" :partentInfo="partentInfo"></Callss>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import Callss from "./../../components/call.vue";
import swqj3Dmap from "./swqj3Dmap";
var setting = window.RongCall.setting;
export default {
  name: "CesiumVue",
  data: function () {
    return {
      dialogVisible: false,
      loading: false,
      unsrNo: "",
      RongLoginOkData: {},
      partentInfo: {},
      filterText: "",
      data: [],
      defaultProps: {
        children: "children",
        label: "userName",
      },
    };
  },
  components: { Callss, swqj3Dmap },
  methods: {
    //showcall调用人员的电话视频
    showcall(val) {
      this.spthClick(val[0]);
    },
    // 前端代码======================================================A
    // 关闭弹窗
    closeDialog() {
      this.$refs.TongHua.hungup();
    },
    //视频通话按钮-------------------------------------------------------------------
    spthClick(peopleNo) {
      console.log("人员编号是:" + peopleNo);

      this.login("PCUser", peopleNo);
    },
    // 视频通话功能----------------------------------------------------------A
    login(PCUser, peopleNo) {
      this.loading = true;
      var userId = PCUser;
      let _this = this;
      // var loginDetail;

      console.log("第二次登录");
      //   let result = await this.$axios.login({
      //     userId,
      //   });

      this.$http
        .post(this.nozzle.login, {
          userId: userId,
        })
        .then((result) => {
          if (result.data.code !== 200) {
            this.loading = false;
            _this.$message("登录失败, 请检查 CallLib Demo Server 是否启动");
          } else {
            this.loading = false;
            setting.token = result.data.token;
            this.RongLoginOkData = result.data;
            let RongCall = window.RongCall;
            RongCall.initIM(setting);
            let query = {
              phone: peopleNo,
              userId: PCUser,
            };
            this.partentInfo = query;

            this.dialogVisible = true;
            this.$refs.TongHua.inputCall(false);
          }
        });
    },
    // 视频通话功能----------------------------------------------------------B

    // 前端代码======================================================E
    // 左侧tree人员列表------------------------------------------------------A
    filterNode(value, data) {
      if (!value) return true;
      return data.userName.indexOf(value) !== -1;
    },
    loadTreeData() {
      this.$http.post(this.nozzle.userTree, {}).then((result) => {
        if (result.data.code == 200) {
          this.data = result.data.data;
        }
      });
    },

    titleClick(index) {
      this.$nextTick(() => {
        for (let i = 0; i < this.data.length; i++) {
          if (index != i) {
            this.$refs[`tree${i}`][0].style.display = "none";
          } else {
            this.$refs[`tree${index}`][0].style.display == "none"
              ? (this.$refs[`tree${index}`][0].style.display = "block")
              : (this.$refs[`tree${index}`][0].style.display = "none");
          }
        }
      });
    },
    handleNodeClick(data) {
      if (data.children.length == 0) {
        // 最小的节点
        console.log("GISData:", data);
      }
    },
    // 左侧tree人员列表------------------------------------------------------E
  },
  mounted: function () {
    this.loadTreeData();
  },
  watch: {
    filterText(val) {
      this.$refs.tree.filter(val);
    },
  },
};
</script>

<style scoped>
#CesiumVue {
  width: 100%;
  height: 100%;
  position: relative;
}
#userList {
  width: 280px;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
}
.TitleBox {
  width: 280px;
  height: 30px;
  background-image: url("./../../../static/img/titles.png");
  background-repeat: no-repeat;
  font-size: 16px;
  font-family: Alibaba PuHuiTi;
  font-weight: bold;
  color: #e8f4f9;
  line-height: 30px;
}
.UserBox {
  width: 100%;
  height: calc(100% - 30px);
  overflow: auto;
  background: #051935d3;
}

::v-deep .el-input__inner {
  margin: 10px 0px;
  background: #314242 !important;
}
::v-deep .el-tree {
  background: #051935d3 !important;
  color: white;
}
::v-deep .el-tree-node__content {
  color: #ffffff !important;
}
::v-deep .el-tree-node__content:hover {
  background-color: #3e90a9b9 !important;
  color: white;
}

::v-deep .el-tree-node:focus > .el-tree-node__content {
  background-color: #3e90a9 !important;
  color: white;
}
.treeBox {
  width: 100%;
  height: auto;
  max-height: 600px;
  overflow: auto;
}
.TItle {
  width: 260px;
  height: 44px;
  line-height: 44px;
  cursor: pointer;
  margin: 10px;
  font-size: 18px;
  font-family: Alibaba PuHuiTi;
  font-weight: bold;
  color: #e8f4f9;
  background: #041329;
  border: 1px solid #00ffff;
}
</style>