zhangzengfei
2022-07-20 4a800a8fc83c6bd1f86a8e847b079a51a7532c09
src/pages/internetData/views/helemtTable.vue
@@ -110,25 +110,25 @@
              src="/images/InternetData/视频.png"
              alt=""
              v-if="!scope.row.isSend"
              @click="sendVoice(scope.row)"
              @click="sendVoice(scope.row, scope.$index)"
            />
            <img
              src="/images/InternetData/视频_点击.png"
              alt=""
              v-else
              @click="sendVoice(scope.row)"
              @click="sendVoice(scope.row, scope.$index)"
            />
            <img
              src="/images/InternetData/语音.png"
              alt=""
              v-if="!scope.row.istele"
              @click="telephone(scope.row)"
              @click="telephone(scope.row, scope.$index)"
            />
            <img
              src="/images/InternetData/语音_点击.png"
              alt=""
              v-else
              @click="telephone(scope.row)"
              @click="telephone(scope.row, scope.$index)"
            />
          </div>
        </template>
@@ -166,141 +166,10 @@
      currentPage: 1,
      page_size: 10,
      total: 10,
      tableData: [
        {
          code: "A123123123123",
          elec: 79.1,
          ip: "192.168.1.2",
          mac: "ec:da:da:da:ed:98",
          longitude: 120.123123,
          latitude: 120.123123,
          height: "11.21",
          time: "0.23.45",
          positon: "单向定位",
          isSend: false,
          istele: false,
        },
        {
          code: "A123123123123",
          elec: 29.1,
          ip: "192.168.1.2",
          mac: "ec:da:da:da:ed:98",
          longitude: 120.123123,
          latitude: 120.123123,
          height: "11.21",
          time: "0.23.45",
          positon: "单向定位",
          isSend: false,
          istele: false,
        },
        {
          code: "A123123123123",
          elec: 0,
          ip: "192.168.1.2",
          mac: "ec:da:da:da:ed:98",
          longitude: 120.123123,
          latitude: 120.123123,
          height: "11.21",
          time: "0.23.45",
          positon: "单向定位",
          isSend: false,
          istele: false,
        },
        {
          code: "A123123123123",
          elec: 79.1,
          ip: "192.168.1.2",
          mac: "ec:da:da:da:ed:98",
          longitude: 120.123123,
          latitude: 120.123123,
          height: "11.21",
          time: "0.23.45",
          positon: "单向定位",
          isSend: false,
          istele: false,
        },
        {
          code: "A123123123123",
          elec: 79.1,
          ip: "192.168.1.2",
          mac: "ec:da:da:da:ed:98",
          longitude: 120.123123,
          latitude: 120.123123,
          height: "11.21",
          time: "0.23.45",
          positon: "单向定位",
          isSend: false,
          istele: false,
        },
        {
          code: "A123123123123",
          elec: 79.1,
          ip: "192.168.1.2",
          mac: "ec:da:da:da:ed:98",
          longitude: 120.123123,
          latitude: 120.123123,
          height: "11.21",
          time: "0.23.45",
          positon: "单向定位",
          isSend: false,
          istele: false,
        },
        {
          code: "A123123123123",
          elec: 79.1,
          ip: "192.168.1.2",
          mac: "ec:da:da:da:ed:98",
          longitude: 120.123123,
          latitude: 120.123123,
          height: "11.21",
          time: "0.23.45",
          positon: "单向定位",
          isSend: false,
          istele: false,
        },
        {
          code: "A123123123123",
          elec: 79.1,
          ip: "192.168.1.2",
          mac: "ec:da:da:da:ed:98",
          longitude: 120.123123,
          latitude: 120.123123,
          height: "11.21",
          time: "0.23.45",
          positon: "单向定位",
          isSend: false,
          istele: false,
        },
        {
          code: "A123123123123",
          elec: 79.1,
          ip: "192.168.1.2",
          mac: "ec:da:da:da:ed:98",
          longitude: 120.123123,
          latitude: 120.123123,
          height: "11.21",
          time: "0.23.45",
          positon: "单向定位",
          isSend: false,
          istele: false,
        },
        {
          code: "A123123123123",
          elec: 79.1,
          ip: "192.168.1.2",
          mac: "ec:da:da:da:ed:98",
          longitude: 120.123123,
          latitude: 120.123123,
          height: "11.21",
          time: "0.23.45",
          positon: "单向定位",
          isSend: false,
          istele: false,
        },
      ],
      helemtArr: [],
      commentContent: "",
      telephoneObj: null,
      targetIndex: null,
    };
  },
  created() {
@@ -312,11 +181,11 @@
  methods: {
    async getHelemtArr(data) {
      const res = await getHelemtData(data);
      console.log(res);
      this.helemtArr = res.data.items;
      this.total = res.data.total;
    },
    sendVoice(target) {
    sendVoice(target, index) {
      const _this = this;
      target.isSend = true;
      const h = this.$createElement;
@@ -381,29 +250,41 @@
          target.isSend = false;
          done();
        },
      }).then((action) => {
        if (action == "confirm") {
          if (!voiceText) {
            this.$message({
              message: "指令不能为空",
              type: "warning",
      })
        .then((action) => {
          if (action == "confirm") {
            if (!voiceText) {
              this.$message({
                message: "指令不能为空",
                type: "warning",
              });
              target.isSend = false;
              _this.$set(_this.helemtArr, index, target);
              return;
            }
            console.log(voiceText);
            sendAudio(target.device_sn, voiceText).then((res) => {
              this.$message({
                message: "指令发送成功",
                type: "success",
              });
              target.isSend = false;
              _this.$set(_this.helemtArr, index, target);
            });
            return;
            target.isSend = false;
            _this.$set(_this.helemtArr, index, target);
          } else {
            target.isSend = false;
            _this.$set(_this.helemtArr, index, target);
          }
          console.log(voiceText);
          sendAudio(target.device_sn, voiceText).then((res) => {
            this.$message({
              message: "指令发送成功",
              type: "success",
            });
          });
        })
        .catch(() => {
          target.isSend = false;
        } else {
          target.isSend = false;
        }
      });
          _this.$set(_this.helemtArr, index, target);
        });
    },
    telephone(target) {
    telephone(target, index) {
      this.targetIndex = index;
      target.istele = true;
      this.telephoneObj = target;
    },
@@ -431,7 +312,9 @@
    },
    closeTele(e) {
      e.istele = false;
      this.$set(this.helemtArr, this.targetIndex, e);
      this.telephoneObj = null;
      this.targetIndex = null;
    },
  },
  components: {